]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Give statvfs.c its own header file
authorVolker Lendecke <vl@samba.org>
Sun, 23 Nov 2025 07:09:10 +0000 (08:09 +0100)
committerAnoop C S <anoopcs@samba.org>
Sun, 15 Feb 2026 10:42:34 +0000 (10:42 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/include/vfs.h
source3/modules/vfs_ceph.c
source3/modules/vfs_ceph_new.c
source3/modules/vfs_default.c
source3/modules/vfs_glusterfs.c
source3/smbd/proto.h
source3/smbd/smb2_trans2.c
source3/smbd/statvfs.c
source3/smbd/statvfs.h [new file with mode: 0644]
source3/smbd/vfs.c

index 09cab759bb58e6ebb14f41624f9cd5ac631843b9..ef2dc8b6d59ac2c1f3b46d5445ae96eed831bd1b 100644 (file)
@@ -1371,36 +1371,6 @@ typedef struct vfs_handle_struct {
        void (*free_data)(void **data);
 } vfs_handle_struct;
 
-
-struct vfs_statvfs_struct {
-       /* For undefined recommended transfer size return -1 in that field */
-       uint32_t OptimalTransferSize;  /* bsize on some os, iosize on other os */
-       uint32_t BlockSize;
-
-       /*
-        The next three fields are in terms of the block size.
-        (above). If block size is unknown, 4096 would be a
-        reasonable block size for a server to report.
-        Note that returning the blocks/blocksavail removes need
-        to make a second call (to QFSInfo level 0x103 to get this info.
-        UserBlockAvail is typically less than or equal to BlocksAvail,
-        if no distinction is made return the same value in each.
-       */
-
-       uint64_t TotalBlocks;
-       uint64_t BlocksAvail;       /* bfree */
-       uint64_t UserBlocksAvail;   /* bavail */
-
-       /* For undefined Node fields or FSID return -1 */
-       uint64_t TotalFileNodes;
-       uint64_t FreeFileNodes;
-       uint64_t FsIdentifier;   /* fsid */
-       /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */
-       /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call   */
-
-       int FsCapabilities;
-};
-
 /* Add a new FSP extension of the given type. Returns a pointer to the
  * extension data.
  */
index 1c84059b184fe5db5b6512ab435dacb0de28a9c9..51d3940910b4ee72fe49c9ff25e982425632903d 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "includes.h"
 #include "smbd/smbd.h"
+#include "smbd/statvfs.h"
 #include "system/filesys.h"
 #include <dirent.h>
 #include <sys/statvfs.h>
index 4b92c3f7215835214b670561df675e3d84a57aa4..e0ead9a63838a846857f3d76fd6eff38aecc0edd 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "includes.h"
 #include "smbd/smbd.h"
+#include "smbd/statvfs.h"
 #include "system/filesys.h"
 #include <dirent.h>
 #include <sys/statvfs.h>
index 0bfdaef49980a0d5350d3d9da2b3da0bd314b1d5..54e085a8b2a6a9c75e05b1fa829b9597c9cc7cf8 100644 (file)
@@ -37,6 +37,7 @@
 #include "offload_token.h"
 #include "util_reparse.h"
 #include "lib/util/string_wrappers.h"
+#include "source3/smbd/statvfs.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
index a2a98995b8a032d5944f0b2ba663065ccea7932a..5f5ca9282041e0b693cffa942aebd0cb1d4e7357 100644 (file)
@@ -37,6 +37,7 @@
 
 #include "includes.h"
 #include "smbd/smbd.h"
+#include "smbd/statvfs.h"
 #include <stdio.h>
 #include <glusterfs/api/glfs.h>
 #include "lib/util/dlinklist.h"
index 509c3019644c5bd25d4c184aeffd258f8d0ecf46..b30e4c858c43457224dcfb68d9a02e300109fe72 100644 (file)
@@ -1046,11 +1046,6 @@ bool is_share_read_only_for_token(const char *username,
 NTSTATUS srvstr_push_fn(const char *base_ptr, uint16_t smb_flags2, void *dest,
                      const char *src, int dest_len, int flags, size_t *ret_len);
 
-/* The following definitions come from smbd/statvfs.c  */
-
-int sys_statvfs(const char *path, struct vfs_statvfs_struct *statbuf);
-int sys_fstatvfs(int fd, struct vfs_statvfs_struct *statbuf);
-
 /* The following definitions come from smbd/trans2.c  */
 
 char *store_file_unix_basic(connection_struct *conn,
index e1bb2ef8214e2a8e016bc076651630cb28ad967e..a684ebbde6aefd370f3a48ff34e1b61cd0ca6695 100644 (file)
@@ -30,6 +30,7 @@
 #include "version.h"
 #include "smbd/smbd.h"
 #include "smbd/globals.h"
+#include "smbd/statvfs.h"
 #include "../libcli/auth/libcli_auth.h"
 #include "../librpc/gen_ndr/xattr.h"
 #include "../librpc/gen_ndr/ndr_security.h"
index 0c45f3c238d3107f00c639968f3d6da9a82a68d4..91a7152c66a7e814dfefdb29274294d864baff76 100644 (file)
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "includes.h"
+#include "replace.h"
 #include "system/filesys.h"
-#include "smbd/smbd.h"
+#include "libcli/smb/smb_constants.h"
+#include "statvfs.h"
 
 #if defined(DARWINOS)
 #include <sys/attr.h>
diff --git a/source3/smbd/statvfs.h b/source3/smbd/statvfs.h
new file mode 100644 (file)
index 0000000..3309f83
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * VFS API's statvfs abstraction
+ * Copyright (C) Alexander Bokovoy                     2005
+ * Copyright (C) Steve French                          2005
+ * Copyright (C) James Peach                           2006
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __SMBD_STATVFS_H__
+#define __SMBD_STATVFS_H__
+
+struct vfs_statvfs_struct {
+       /* For undefined recommended transfer size return -1 in that field */
+       uint32_t OptimalTransferSize; /* bsize on some os, iosize on
+                                      * other os */
+       uint32_t BlockSize;
+
+       /*
+        The next three fields are in terms of the block size.
+        (above). If block size is unknown, 4096 would be a
+        reasonable block size for a server to report.
+        Note that returning the blocks/blocksavail removes need
+        to make a second call (to QFSInfo level 0x103 to get this info.
+        UserBlockAvail is typically less than or equal to BlocksAvail,
+        if no distinction is made return the same value in each.
+       */
+
+       uint64_t TotalBlocks;
+       uint64_t BlocksAvail;     /* bfree */
+       uint64_t UserBlocksAvail; /* bavail */
+
+       /* For undefined Node fields or FSID return -1 */
+       uint64_t TotalFileNodes;
+       uint64_t FreeFileNodes;
+       uint64_t FsIdentifier; /* fsid */
+       /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */
+       /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call   */
+
+       int FsCapabilities;
+};
+
+int sys_statvfs(const char *path, struct vfs_statvfs_struct *statbuf);
+int sys_fstatvfs(int fd, struct vfs_statvfs_struct *statbuf);
+
+#endif
index bac4b38112c00dee310c03aa808a039e73ba9e81..9f0aa9b435811a15dd382e65412bf7739ace8425 100644 (file)
@@ -27,6 +27,7 @@
 #include "system/filesys.h"
 #include "smbd/smbd.h"
 #include "smbd/globals.h"
+#include "smbd/statvfs.h"
 #include "../lib/util/memcache.h"
 #include "transfer_file.h"
 #include "ntioctl.h"