From: Volker Lendecke Date: Sun, 23 Nov 2025 07:09:10 +0000 (+0100) Subject: smbd: Give statvfs.c its own header file X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5444c27dec1dab882becb2ab9989959cf2f241d;p=thirdparty%2Fsamba.git smbd: Give statvfs.c its own header file Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S --- diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 09cab759bb5..ef2dc8b6d59 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -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. */ diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 1c84059b184..51d3940910b 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -32,6 +32,7 @@ #include "includes.h" #include "smbd/smbd.h" +#include "smbd/statvfs.h" #include "system/filesys.h" #include #include diff --git a/source3/modules/vfs_ceph_new.c b/source3/modules/vfs_ceph_new.c index 4b92c3f7215..e0ead9a6383 100644 --- a/source3/modules/vfs_ceph_new.c +++ b/source3/modules/vfs_ceph_new.c @@ -32,6 +32,7 @@ #include "includes.h" #include "smbd/smbd.h" +#include "smbd/statvfs.h" #include "system/filesys.h" #include #include diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 0bfdaef4998..54e085a8b2a 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -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 diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index a2a98995b8a..5f5ca928204 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -37,6 +37,7 @@ #include "includes.h" #include "smbd/smbd.h" +#include "smbd/statvfs.h" #include #include #include "lib/util/dlinklist.h" diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 509c3019644..b30e4c858c4 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -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, diff --git a/source3/smbd/smb2_trans2.c b/source3/smbd/smb2_trans2.c index e1bb2ef8214..a684ebbde6a 100644 --- a/source3/smbd/smb2_trans2.c +++ b/source3/smbd/smb2_trans2.c @@ -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" diff --git a/source3/smbd/statvfs.c b/source3/smbd/statvfs.c index 0c45f3c238d..91a7152c66a 100644 --- a/source3/smbd/statvfs.c +++ b/source3/smbd/statvfs.c @@ -19,9 +19,10 @@ along with this program. If not, see . */ -#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 diff --git a/source3/smbd/statvfs.h b/source3/smbd/statvfs.h new file mode 100644 index 00000000000..3309f83dbda --- /dev/null +++ b/source3/smbd/statvfs.h @@ -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 . + */ + +#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 diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index bac4b38112c..9f0aa9b4358 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -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"