Cache the underlying filesystem capabilities at connection time.
authorJames Peach <jpeach@samba.org>
Sat, 22 Dec 2007 22:01:25 +0000 (14:01 -0800)
committerJames Peach <jpeach@samba.org>
Sat, 22 Dec 2007 22:01:25 +0000 (14:01 -0800)
This change alters the Samba connection code to cache the filesystem
capabilities when a new client connects. This can be used to enable
filesystem specific optimisations is a general manner.
(This used to be commit de3c5b808a941ac8e9ebe7169536d8290067eef5)

source3/include/smb.h
source3/smbd/service.c

index 1222c9a73ad29b63b691d00ac30a3868ea1f6531..63ae51ecd4fcdbe25bf3cb325e90b3cd7b2bb69f 100644 (file)
@@ -658,10 +658,14 @@ typedef struct connection_struct {
        int num_files_open;
        unsigned int num_smb_operations; /* Count of smb operations on this tree. */
 
+       /* Semantics requested by the client or forced by the server config. */
        bool case_sensitive;
        bool case_preserve;
        bool short_case_preserve;
 
+       /* Semantics provided by the underlying filesystem. */
+       int fs_capabilities;
+
        name_compare_entry *hide_list; /* Per-share list of files to return as hidden. */
        name_compare_entry *veto_list; /* Per-share list of files to veto (never show). */
        name_compare_entry *veto_oplock_list; /* Per-share list of files to refuse oplocks on. */       
index ed43528c76d011446fc66cd727f963f86eee0de7..8e69a3b3817482bda2c88921049ef6ea7270fc20 100644 (file)
@@ -1165,6 +1165,21 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
        }
 #endif
 
+       /* Figure out the characteristics of the underlying filesystem. This
+        * 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;
+               }
+       }
+
        /*
         * Print out the 'connected as' stuff here as we need
         * to know the effective uid and gid we will be using