gpfs: Introduce wrapper for gpfs_set_lease
authorChristof Schmitt <cs@samba.org>
Wed, 10 Dec 2014 22:06:02 +0000 (15:06 -0700)
committerChristof Schmitt <cs@samba.org>
Mon, 2 Mar 2015 21:31:07 +0000 (22:31 +0100)
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
source3/modules/gpfs.c
source3/modules/vfs_gpfs.h

index e2628a56d14d5d53f025a546309a37299dc64606..e2a07661c989f3fc2ecf6f5e9d7a53e525acf3ff 100644 (file)
@@ -27,7 +27,7 @@
 #include "vfs_gpfs.h"
 
 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_set_lease_fn)(int fd, unsigned int type);
 static int (*gpfs_getacl_fn)(char *pathname, int flags, void *acl);
 static int (*gpfs_putacl_fn)(char *pathname, int flags, void *acl);
 static int (*gpfs_get_realfilename_path_fn)(char *pathname, char *filenamep,
@@ -86,6 +86,16 @@ int gpfswrap_set_share(int fd, unsigned int allow, unsigned int deny)
        return gpfs_set_share_fn(fd, allow, deny);
 }
 
+int gpfswrap_set_lease(int fd, unsigned int type)
+{
+       if (gpfs_set_lease_fn == NULL) {
+               errno = ENOSYS;
+               return -1;
+       }
+
+       return gpfs_set_lease_fn(fd, type);
+}
+
 bool set_gpfs_sharemode(files_struct *fsp, uint32 access_mask,
                        uint32 share_access)
 {
@@ -135,11 +145,6 @@ int set_gpfs_lease(int fd, int leasetype)
 {
        int gpfs_type = GPFS_LEASE_NONE;
 
-       if (gpfs_set_lease_fn == NULL) {
-               errno = EINVAL;
-               return -1;
-       }
-
        if (leasetype == F_RDLCK) {
                gpfs_type = GPFS_LEASE_READ;
        }
@@ -153,7 +158,7 @@ int set_gpfs_lease(int fd, int leasetype)
           each time we try this with the wrong capabilities set
        */
        linux_set_lease_capability();
-       return gpfs_set_lease_fn(fd, gpfs_type);
+       return gpfswrap_set_lease(fd, gpfs_type);
 }
 
 int smbd_gpfs_getacl(char *pathname, int flags, void *acl)
index 5ab9ff36497eb5782bcc513212b2086caea8e472..6ceb5e01d93edebb788d53949dd6e20dc447479b 100644 (file)
@@ -29,6 +29,7 @@
 
 int gpfswrap_init(void);
 int gpfswrap_set_share(int fd, unsigned int allow, unsigned int deny);
+int gpfswrap_set_lease(int fd, unsigned int type);
 bool set_gpfs_sharemode(files_struct *fsp, uint32 access_mask,
                        uint32 share_access);
 int set_gpfs_lease(int fd, int leasetype);