Remove is_remotestorage() call from VFS. We already have statvfs() there to handle...
authorAlexander Bokovoy <ab@samba.org>
Thu, 17 Jan 2008 13:51:14 +0000 (16:51 +0300)
committerAlexander Bokovoy <ab@samba.org>
Thu, 17 Jan 2008 13:59:29 +0000 (16:59 +0300)
As discussed with Volker, it is better to calculate FS capabilities at
connection time. We already do this with help of VFS statvfs() call
which allows to fill-in system-specific attributes including FS
capabilities. So just re-use it if you want to represent additional
capabilities in your modules. The only caution is that you need to
call underlying statvfs() call to actually get system-specific
capabilities (and other fields) added. Then add module-specific ones.
(This used to be commit e342ca0d931f9a5c8ec9e472dc9c63f1fe012b3a)

examples/VFS/skel_opaque.c
examples/VFS/skel_transparent.c
source3/include/vfs.h
source3/include/vfs_macros.h
source3/modules/vfs_default.c
source3/modules/vfs_tsmsm.c
source3/smbd/trans2.c

index 42154c47a66682c283e499e6b7d6755a65d25d3e..4a6e6be42fd04b1c40ebd52a42cbf4a162af35e6 100644 (file)
@@ -595,11 +595,6 @@ static int skel_set_offline(struct vfs_handle_struct *handle, const char *path)
        return vfswrap_set_offline(NULL, path);
 }
 
-static bool skel_is_remotestorage(struct vfs_handle_struct *handle, const char *path)
-{
-       return vfswrap_is_remotestorage(NULL, path);
-}
-
 /* VFS operations structure */
 
 static vfs_op_tuple skel_op_tuples[] = {
@@ -724,7 +719,6 @@ static vfs_op_tuple skel_op_tuples[] = {
         /* offline operations */
        {SMB_VFS_OP(skel_is_offline),                   SMB_VFS_OP_IS_OFFLINE,                  SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(skel_set_offline),                  SMB_VFS_OP_SET_OFFLINE,                 SMB_VFS_LAYER_OPAQUE},
-       {SMB_VFS_OP(skel_is_remotestorage),             SMB_VFS_OP_IS_REMOTESTORAGE,            SMB_VFS_LAYER_OPAQUE},
 
        {NULL,                                          SMB_VFS_OP_NOOP,                        SMB_VFS_LAYER_NOOP}
 };
index 997783819c03c689db78af922e2136a3eab07a42..f4cb9b15ba2e048dfa7523e6c54ba707e1f03fc7 100644 (file)
@@ -681,7 +681,6 @@ static vfs_op_tuple skel_op_tuples[] = {
        /* offline operations */
        {SMB_VFS_OP(skel_is_offline),                   SMB_VFS_OP_IS_OFFLINE,                  SMB_VFS_LAYER_TRANSPARENT},
        {SMB_VFS_OP(skel_set_offline),                  SMB_VFS_OP_SET_OFFLINE,                 SMB_VFS_LAYER_TRANSPARENT},
-       {SMB_VFS_OP(skel_is_remotestorage),             SMB_VFS_OP_IS_REMOTESTORAGE,            SMB_VFS_LAYER_TRANSPARENT},
 
        {NULL,                                          SMB_VFS_OP_NOOP,                        SMB_VFS_LAYER_NOOP}
 };
index da5494927e1e2f718b11f994f3bfc0b8937fbbbc..d03cf3477dc2202484ff95db2e6f8a5ba7192899 100644 (file)
@@ -261,7 +261,6 @@ typedef enum _vfs_op_type {
        /* offline operations */
        SMB_VFS_OP_IS_OFFLINE,
        SMB_VFS_OP_SET_OFFLINE,
-       SMB_VFS_OP_IS_REMOTESTORAGE,
 
        /* This should always be last enum value */
 
@@ -415,8 +414,6 @@ struct vfs_ops {
                /* offline operations */
                bool (*is_offline)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf);
                int (*set_offline)(struct vfs_handle_struct *handle, const char *path);
-               bool (*is_remotestorage)(struct vfs_handle_struct *handle, const char *path);
-
        } ops;
 
        struct vfs_handles_pointers {
@@ -542,7 +539,6 @@ struct vfs_ops {
                /* offline operations */
                struct vfs_handle_struct *is_offline;
                struct vfs_handle_struct *set_offline;
-               struct vfs_handle_struct *is_remotestorage;
        } handles;
 };
 
index f7c7e7d623a17352b5f83fd5b5d5d1fc33b37521..dd30f977dc8adb5fbeb65da269e6f21d6b1c3ca9 100644 (file)
 /* Offline operations */
 #define SMB_VFS_IS_OFFLINE(conn,path,sbuf) ((conn)->vfs.ops.is_offline((conn)->vfs.handles.is_offline,(path),(sbuf)))
 #define SMB_VFS_SET_OFFLINE(conn,path) ((conn)->vfs.ops.set_offline((conn)->vfs.handles.set_offline,(path)))
-#define SMB_VFS_IS_REMOTESTORAGE(conn,path) ((conn)->vfs.ops.is_remotestorage((conn)->vfs.handles.is_remotestorage,(path)))
 
 /*******************************************************************
  Don't access conn->vfs_opaque.ops directly!!!
 /* Offline operations */
 #define SMB_VFS_OPAQUE_IS_OFFLINE(conn,path,sbuf) ((conn)->vfs_opaque.ops.is_offline((conn)->vfs_opaque.handles.is_offline,(path),(sbuf)))
 #define SMB_VFS_OPAQUE_SET_OFFLINE(conn,path) ((conn)->vfs_opaque.ops.set_offline((conn)->vfs_opaque.handles.set_offline,(path)))
-#define SMB_VFS_OPAQUE_IS_REMOTESTORAGE(conn,path) ((conn)->vfs_opaque.ops.is_remotestorage((conn)->vfs_opaque.handles.is_remotestorage,(path)))
 
 /*******************************************************************
  Don't access handle->vfs_next.ops.* directly!!!
 /* Offline operations */
 #define SMB_VFS_NEXT_IS_OFFLINE(handle,path,sbuf) ((handle)->vfs_next.ops.is_offline((handle)->vfs_next.handles.is_offline,(path),(sbuf)))
 #define SMB_VFS_NEXT_SET_OFFLINE(handle,path) ((handle)->vfs_next.ops.set_offline((handle)->vfs_next.handles.set_offline,(path)))
-#define SMB_VFS_NEXT_IS_REMOTESTORAGE(handle,path) ((handle)->vfs_next.ops.is_remotestorage((handle)->vfs_next.handles.is_remotestorage,(path)))
 
 #endif /* _VFS_MACROS_H */
index 755bcdeefa25f818811b2fb45061819d7a9fd7c8..31234f23ecfc86b2edf66d9e62e69bfb216410b8 100644 (file)
@@ -1255,13 +1255,6 @@ static int vfswrap_set_offline(struct vfs_handle_struct *handle, const char *pat
        return -1;
 }
 
-static bool vfswrap_is_remotestorage(struct vfs_handle_struct *handle, const char *path)
-{
-       /* We don't know how to detect that volume is remote storage. VFS modules should redefine it. */
-       return false;
-}
-
-
 static vfs_op_tuple vfs_default_ops[] = {
 
        /* Disk operations */
@@ -1486,8 +1479,6 @@ static vfs_op_tuple vfs_default_ops[] = {
         SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(vfswrap_set_offline),SMB_VFS_OP_SET_OFFLINE,
         SMB_VFS_LAYER_OPAQUE},
-       {SMB_VFS_OP(vfswrap_is_remotestorage),SMB_VFS_OP_IS_REMOTESTORAGE,
-        SMB_VFS_LAYER_OPAQUE},
 
        /* Finish VFS operations definition */
 
index c737032907a3fdbc96e6a689b7d3f315537a1544..2805488e8b5c3b33d001a38a48154fd42c21fef0 100644 (file)
@@ -294,8 +294,14 @@ static int tsmsm_set_offline(struct vfs_handle_struct *handle,
        return result;
 }
 
-static bool tsmsm_is_remotestorage(struct vfs_handle_struct *handle, const char *path) {
-       return True;
+static bool tsmsm_statvfs(struct vfs_handle_struct *handle,  const char *path, vfs_statvfs_struct *statbuf)
+{
+       bool result;
+
+       result = SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
+       statbuf->FsCapabilities | = FILE_SUPPORTS_REMOTE_STORAGE | FILE_SUPPORTS_REPARSE_POINTS;
+
+       return result;
 }
 
 static vfs_op_tuple vfs_tsmsm_ops[] = {
@@ -304,6 +310,8 @@ static vfs_op_tuple vfs_tsmsm_ops[] = {
 
        {SMB_VFS_OP(tsmsm_connect),     SMB_VFS_OP_CONNECT,
         SMB_VFS_LAYER_TRANSPARENT},
+       {SMB_VFS_OP(tsmsm_statvfs),     SMB_VFS_OP_STATVFS,
+        SMB_VFS_LAYER_TRANSPARENT},
        {SMB_VFS_OP(tsmsm_aio_force),   SMB_VFS_OP_AIO_FORCE,
         SMB_VFS_LAYER_TRANSPARENT},
        {SMB_VFS_OP(tsmsm_aio_return),  SMB_VFS_OP_AIO_RETURN,
@@ -314,11 +322,9 @@ static vfs_op_tuple vfs_tsmsm_ops[] = {
         SMB_VFS_LAYER_TRANSPARENT},
        {SMB_VFS_OP(tsmsm_sendfile),    SMB_VFS_OP_SENDFILE,
         SMB_VFS_LAYER_TRANSPARENT},
-       {SMB_VFS_OP(tsmsm_is_offline),SMB_VFS_OP_IS_OFFLINE,
-        SMB_VFS_LAYER_OPAQUE},
-       {SMB_VFS_OP(tsmsm_set_offline),SMB_VFS_OP_SET_OFFLINE,
+       {SMB_VFS_OP(tsmsm_is_offline),  SMB_VFS_OP_IS_OFFLINE,
         SMB_VFS_LAYER_OPAQUE},
-       {SMB_VFS_OP(tsmsm_is_remotestorage),SMB_VFS_OP_IS_REMOTESTORAGE,
+       {SMB_VFS_OP(tsmsm_set_offline), SMB_VFS_OP_SET_OFFLINE,
         SMB_VFS_LAYER_OPAQUE},
 
        /* Finish VFS operations definition */
index 5729ab534997850fd69a3d7c7cdd3b660a6d35f3..23d6f129969e34517efcebd732a8eb980610abcc 100644 (file)
@@ -2495,12 +2495,10 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)st.st_dev, (unsi
                        if(lp_nt_acl_support(SNUM(conn))) {
                                additional_flags |= FILE_PERSISTENT_ACLS;
                        }
-                       
-                       if(SMB_VFS_IS_REMOTESTORAGE(conn, lp_pathname(SNUM(conn)))) {
-                               additional_flags |= FILE_SUPPORTS_REMOTE_STORAGE;
-                               additional_flags |= FILE_SUPPORTS_REPARSE_POINTS;
-                       }
-                       
+
+                       /* Capabilities are filled in at connection time through STATVFS call */
+                       additional_flags |= conn->fs_capabilities;
+
                        SIVAL(pdata,0,FILE_CASE_PRESERVED_NAMES|FILE_CASE_SENSITIVE_SEARCH|
                                FILE_SUPPORTS_OBJECT_IDS|FILE_UNICODE_ON_DISK|
                                additional_flags); /* FS ATTRIBUTES */