From 9a226532221b88369b913bc9f9d6ec335620349f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 21 Jan 2008 15:10:44 +0100 Subject: Add SMB_VFS_FS_CAPABILITIES It turns out that this is a necessary operation, separate from statvfs. statvfs can fail during tcon, so conn->fs_capabilities would never see that we support streams on a particular share. James, can you check that I got the darwin variant right? Thanks! (This used to be commit 3ad798d803b3b023533bb48e6993885f22b96095) --- source3/modules/vfs_default.c | 13 +++++++++++++ source3/modules/vfs_streams_depot.c | 13 +++---------- source3/modules/vfs_streams_xattr.c | 13 +++---------- 3 files changed, 19 insertions(+), 20 deletions(-) (limited to 'source3/modules') diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 2e620d04cc..17d0dfabaf 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -90,6 +90,17 @@ static int vfswrap_statvfs(struct vfs_handle_struct *handle, const char *path, return sys_statvfs(path, statbuf); } +static uint32_t vfswrap_fs_capabilities(struct vfs_handle_struct *handle) +{ +#if defined(DARWINOS) + struct statfs sbuf; + ZERO_STRUCT(sbuf); + sys_statvfs(handle->conn->connectpath, &sbuf); + return sbuf.FsCapabilities; +#endif + return FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES; +} + /* Directory operations */ static SMB_STRUCT_DIR *vfswrap_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attr) @@ -1330,6 +1341,8 @@ static vfs_op_tuple vfs_default_ops[] = { SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(vfswrap_statvfs), SMB_VFS_OP_STATVFS, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(vfswrap_fs_capabilities), SMB_VFS_OP_FS_CAPABILITIES, + SMB_VFS_LAYER_OPAQUE}, /* Directory operations */ diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c index 68e7a75947..fa85ea4a57 100644 --- a/source3/modules/vfs_streams_depot.c +++ b/source3/modules/vfs_streams_depot.c @@ -610,22 +610,15 @@ static NTSTATUS streams_depot_streaminfo(vfs_handle_struct *handle, return NT_STATUS_OK; } -static int streams_depot_statvfs(struct vfs_handle_struct *handle, - const char *path, - struct vfs_statvfs_struct *statbuf) +static uint32_t streams_depot_fs_capabilities(struct vfs_handle_struct *handle) { - int ret; - - ret = SMB_VFS_NEXT_STATVFS(handle, path, statbuf); - statbuf->FsCapabilities |= FILE_NAMED_STREAMS; - return ret; - + return SMB_VFS_NEXT_FS_CAPABILITIES(handle) | FILE_NAMED_STREAMS; } /* VFS operations structure */ static vfs_op_tuple streams_depot_ops[] = { - {SMB_VFS_OP(streams_depot_statvfs), SMB_VFS_OP_STATVFS, + {SMB_VFS_OP(streams_depot_fs_capabilities), SMB_VFS_OP_FS_CAPABILITIES, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(streams_depot_open), SMB_VFS_OP_OPEN, SMB_VFS_LAYER_TRANSPARENT}, diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index 7ce90ab30b..965d57ff88 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -560,16 +560,9 @@ static NTSTATUS streams_xattr_streaminfo(vfs_handle_struct *handle, return NT_STATUS_OK; } -static int streams_xattr_statvfs(struct vfs_handle_struct *handle, - const char *path, - struct vfs_statvfs_struct *statbuf) +static uint32_t streams_xattr_fs_capabilities(struct vfs_handle_struct *handle) { - int ret; - - ret = SMB_VFS_NEXT_STATVFS(handle, path, statbuf); - statbuf->FsCapabilities |= FILE_NAMED_STREAMS; - return ret; - + return SMB_VFS_NEXT_FS_CAPABILITIES(handle) | FILE_NAMED_STREAMS; } static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle, @@ -663,7 +656,7 @@ static ssize_t streams_xattr_pread(vfs_handle_struct *handle, /* VFS operations structure */ static vfs_op_tuple streams_xattr_ops[] = { - {SMB_VFS_OP(streams_xattr_statvfs), SMB_VFS_OP_STATVFS, + {SMB_VFS_OP(streams_xattr_fs_capabilities), SMB_VFS_OP_FS_CAPABILITIES, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(streams_xattr_open), SMB_VFS_OP_OPEN, SMB_VFS_LAYER_TRANSPARENT}, -- cgit