s3:vfs_gpfs: make "gpfs:getrealfilename" a per share option
authorStefan Metzmacher <metze@samba.org>
Thu, 22 Dec 2011 14:54:41 +0000 (15:54 +0100)
committerChristian Ambach <ambi@samba.org>
Fri, 10 Feb 2012 17:08:01 +0000 (18:08 +0100)
metze

Signed-off-by: Christian Ambach <ambi@samba.org>
source3/modules/gpfs.c
source3/modules/vfs_gpfs.c

index 57a5a0c9fb9d0b8d5fd48c65675057f3999fe459..5ce23810c428a8c761abddcb1ddb8b17a3b54c43 100644 (file)
@@ -25,8 +25,6 @@
 #include "gpfs_gpl.h"
 #include "vfs_gpfs.h"
 
-static bool gpfs_getrealfilename;
-
 static int (*gpfs_set_share_fn)(int fd, unsigned int allow, unsigned int deny);
 static int (*gpfs_set_lease_fn)(int fd, unsigned int leaseType);
 static int (*gpfs_getacl_fn)(char *pathname, int flags, void *acl);
@@ -145,8 +143,7 @@ int smbd_gpfs_ftruncate(int fd, gpfs_off64_t length)
 int smbd_gpfs_get_realfilename_path(char *pathname, char *filenamep,
                                    int *buflen)
 {
-       if ((!gpfs_getrealfilename)
-           || (gpfs_get_realfilename_path_fn == NULL)) {
+       if (gpfs_get_realfilename_path_fn == NULL) {
                errno = ENOSYS;
                return -1;
        }
@@ -262,8 +259,5 @@ void init_gpfs(void)
        init_gpfs_function(&gpfs_ftruncate_fn, "gpfs_ftruncate");
         init_gpfs_function(&gpfs_lib_init_fn,"gpfs_lib_init");
 
-       gpfs_getrealfilename = lp_parm_bool(-1, "gpfs", "getrealfilename",
-                                           True);
-
        return;
 }
index 088d8c0d6bf5405d184f225dafa69747c83f4bf4..8400c50d2e401a357ef9850bd00473685f4c7fc7 100644 (file)
@@ -41,6 +41,7 @@ struct gpfs_config_data {
        bool syncio;
        bool winattr;
        bool ftruncate;
+       bool getrealfilename;
 };
 
 
@@ -125,6 +126,16 @@ static int vfs_gpfs_get_real_filename(struct vfs_handle_struct *handle,
        char real_pathname[PATH_MAX+1];
        int buflen;
        bool mangled;
+       struct gpfs_config_data *config;
+
+       SMB_VFS_HANDLE_GET_DATA(handle, config,
+                               struct gpfs_config_data,
+                               return -1);
+
+       if (!config->getrealfilename) {
+               return SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name,
+                                                     mem_ctx, found_name);
+       }
 
        mangled = mangle_is_mangled(name, handle->conn->params);
        if (mangled) {
@@ -1363,6 +1374,9 @@ int vfs_gpfs_connect(struct vfs_handle_struct *handle, const char *service,
        config->ftruncate = lp_parm_bool(SNUM(handle->conn), "gpfs",
                                         "ftruncate", true);
 
+       config->getrealfilename = lp_parm_bool(SNUM(handle->conn), "gpfs",
+                                              "getrealfilename", true);
+
        SMB_VFS_HANDLE_SET_DATA(handle, config,
                                NULL, struct gpfs_config_data,
                                return -1);