[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-1595-g3ad798d

Volker Lendecke vl at samba.org
Mon Jan 21 16:31:37 GMT 2008


The branch, v3-2-test has been updated
       via  3ad798d803b3b023533bb48e6993885f22b96095 (commit)
      from  74a71f198866ba0a0217e58a6a47bdc858d5df68 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 3ad798d803b3b023533bb48e6993885f22b96095
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jan 21 15:10:44 2008 +0100

    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!

-----------------------------------------------------------------------

Summary of changes:
 source/include/vfs.h               |    3 +++
 source/include/vfs_macros.h        |    3 +++
 source/modules/vfs_default.c       |   13 +++++++++++++
 source/modules/vfs_streams_depot.c |   13 +++----------
 source/modules/vfs_streams_xattr.c |   13 +++----------
 source/smbd/service.c              |   10 +---------
 6 files changed, 26 insertions(+), 29 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/vfs.h b/source/include/vfs.h
index cda28a1..ca176aa 100644
--- a/source/include/vfs.h
+++ b/source/include/vfs.h
@@ -149,6 +149,7 @@ typedef enum _vfs_op_type {
 	SMB_VFS_OP_SET_QUOTA,
 	SMB_VFS_OP_GET_SHADOW_COPY_DATA,
 	SMB_VFS_OP_STATVFS,
+	SMB_VFS_OP_FS_CAPABILITIES,
 
 	/* Directory operations */
 
@@ -284,6 +285,7 @@ struct vfs_ops {
 		int (*set_quota)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
 		int (*get_shadow_copy_data)(struct vfs_handle_struct *handle, struct files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels);
 		int (*statvfs)(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf);
+		uint32_t (*fs_capabilities)(struct vfs_handle_struct *handle);
 
 		/* Directory operations */
 
@@ -435,6 +437,7 @@ struct vfs_ops {
 		struct vfs_handle_struct *set_quota;
 		struct vfs_handle_struct *get_shadow_copy_data;
 		struct vfs_handle_struct *statvfs;
+		struct vfs_handle_struct *fs_capabilities;
 
 		/* Directory operations */
 
diff --git a/source/include/vfs_macros.h b/source/include/vfs_macros.h
index 1674f26..1e64bd5 100644
--- a/source/include/vfs_macros.h
+++ b/source/include/vfs_macros.h
@@ -34,6 +34,7 @@
 #define SMB_VFS_SET_QUOTA(conn, qtype, id, qt) ((conn)->vfs.ops.set_quota((conn)->vfs.handles.set_quota, (qtype), (id), (qt)))
 #define SMB_VFS_GET_SHADOW_COPY_DATA(fsp,shadow_copy_data,labels) ((fsp)->conn->vfs.ops.get_shadow_copy_data((fsp)->conn->vfs.handles.get_shadow_copy_data,(fsp),(shadow_copy_data),(labels)))
 #define SMB_VFS_STATVFS(conn, path, statbuf) ((conn)->vfs.ops.statvfs((conn)->vfs.handles.statvfs, (path), (statbuf)))
+#define SMB_VFS_FS_CAPABILITIES(conn) ((conn)->vfs.ops.fs_capabilities((conn)->vfs.handles.fs_capabilities))
 
 /* Directory operations */
 #define SMB_VFS_OPENDIR(conn, fname, mask, attr) ((conn)->vfs.ops.opendir((conn)->vfs.handles.opendir, (fname), (mask), (attr)))
@@ -159,6 +160,7 @@
 #define SMB_VFS_OPAQUE_SET_QUOTA(conn, qtype, id, qt) ((conn)->vfs_opaque.ops.set_quota((conn)->vfs_opaque.handles.set_quota, (qtype), (id), (qt)))
 #define SMB_VFS_OPAQUE_GET_SHADOW_COPY_DATA(fsp,shadow_copy_data,labels) ((fsp)->conn->vfs_opaque.ops.get_shadow_copy_data((fsp)->conn->vfs_opaque.handles.get_shadow_copy_data,(fsp),(shadow_copy_data),(labels)))
 #define SMB_VFS_OPAQUE_STATVFS(conn, path, statbuf) ((conn)->vfs_opaque.ops.statvfs((conn)->vfs_opaque.handles.statvfs, (path), (statbuf)))
+#define SMB_VFS_OPAQUE_FS_CAPABILITIES(conn) ((conn)->vfs_opaque.ops.fs_capabilities((conn)->vfs_opaque.handles.fs_capabilities))
 
 /* Directory operations */
 #define SMB_VFS_OPAQUE_OPENDIR(conn, fname, mask, attr) ((conn)->vfs_opaque.ops.opendir((conn)->vfs_opaque.handles.opendir, (fname), (mask), (attr)))
@@ -284,6 +286,7 @@
 #define SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, qt) ((handle)->vfs_next.ops.set_quota((handle)->vfs_next.handles.set_quota, (qtype), (id), (qt)))
 #define SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data ,labels) ((handle)->vfs_next.ops.get_shadow_copy_data((handle)->vfs_next.handles.get_shadow_copy_data,(fsp),(shadow_copy_data),(labels)))
 #define SMB_VFS_NEXT_STATVFS(handle, path, statbuf) ((handle)->vfs_next.ops.statvfs((handle)->vfs_next.handles.statvfs, (path), (statbuf)))
+#define SMB_VFS_NEXT_FS_CAPABILITIES(handle) ((handle)->vfs_next.ops.fs_capabilities((handle)->vfs_next.handles.fs_capabilities))
 
 /* Directory operations */
 #define SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr) ((handle)->vfs_next.ops.opendir((handle)->vfs_next.handles.opendir, (fname), (mask), (attr)))
diff --git a/source/modules/vfs_default.c b/source/modules/vfs_default.c
index 2e620d0..17d0dfa 100644
--- a/source/modules/vfs_default.c
+++ b/source/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/source/modules/vfs_streams_depot.c b/source/modules/vfs_streams_depot.c
index 68e7a75..fa85ea4 100644
--- a/source/modules/vfs_streams_depot.c
+++ b/source/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/source/modules/vfs_streams_xattr.c b/source/modules/vfs_streams_xattr.c
index 7ce90ab..965d57f 100644
--- a/source/modules/vfs_streams_xattr.c
+++ b/source/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},
diff --git a/source/smbd/service.c b/source/smbd/service.c
index ed8061e..a8aa254 100644
--- a/source/smbd/service.c
+++ b/source/smbd/service.c
@@ -1171,16 +1171,8 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
 	 * assumes that all the filesystem mounted withing a share path have
 	 * the same characteristics, which is likely but not guaranteed.
 	 */
-	{
-		vfs_statvfs_struct svfs;
-
-		conn->fs_capabilities =
-		    FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
 
-		if (SMB_VFS_STATVFS(conn, conn->connectpath, &svfs) == 0) {
-			conn->fs_capabilities = svfs.FsCapabilities;
-		}
-	}
+	conn->fs_capabilities = SMB_VFS_FS_CAPABILITIES(conn);
 
 	/*
 	 * Print out the 'connected as' stuff here as we need


-- 
Samba Shared Repository


More information about the samba-cvs mailing list