svn commit: samba r23228 - in branches: SAMBA_3_0/source/modules SAMBA_3_0_26/source/modules

vlendec at samba.org vlendec at samba.org
Tue May 29 19:54:28 GMT 2007


Author: vlendec
Date: 2007-05-29 19:54:26 +0000 (Tue, 29 May 2007)
New Revision: 23228

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23228

Log:
Merge cleanup to the gpfs module from Tridge. Also potentially disable
gpfs share modes in special situations. This might be split up in
several modules later.

Modified:
   branches/SAMBA_3_0/source/modules/gpfs.c
   branches/SAMBA_3_0_26/source/modules/gpfs.c


Changeset:
Modified: branches/SAMBA_3_0/source/modules/gpfs.c
===================================================================
--- branches/SAMBA_3_0/source/modules/gpfs.c	2007-05-29 19:48:34 UTC (rev 23227)
+++ branches/SAMBA_3_0/source/modules/gpfs.c	2007-05-29 19:54:26 UTC (rev 23228)
@@ -25,6 +25,7 @@
 #include "gpfs_gpl.h"
 
 static void *libgpfs_handle = NULL;
+static BOOL gpfs_share_modes;
 
 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);
@@ -39,6 +40,10 @@
 	unsigned int deny = GPFS_DENY_NONE;
 	int result;
 
+	if (!gpfs_share_modes) {
+		return True;
+	}
+
 	if (gpfs_set_share_fn == NULL) {
 		return False;
 	}
@@ -84,6 +89,10 @@
 {
 	int gpfs_type = GPFS_LEASE_NONE;
 
+	if (!gpfs_share_modes) {
+		return True;
+	}
+
 	if (gpfs_set_lease_fn == NULL) {
 		errno = EINVAL;
 		return -1;
@@ -138,15 +147,7 @@
 	if (gpfs_set_share_fn == NULL) {
 		DEBUG(3, ("libgpfs_gpl.so does not contain the symbol "
 			  "'gpfs_set_share'\n"));
-		sys_dlclose(libgpfs_handle);
-
-		/* leave libgpfs_handle != NULL around, no point
-		   in trying twice */
-		gpfs_set_share_fn = NULL;
-		gpfs_set_lease_fn = NULL;
-		gpfs_getacl_fn = NULL;
-		gpfs_putacl_fn = NULL;
-		return;
+		goto failed;
 	}
 
 	gpfs_set_lease_fn = sys_dlsym(libgpfs_handle, "gpfs_set_lease");
@@ -155,45 +156,39 @@
 			  "'gpfs_set_lease'\n"));
 		sys_dlclose(libgpfs_handle);
 
-		/* leave libgpfs_handle != NULL around, no point
-		   in trying twice */
-		gpfs_set_share_fn = NULL;
-		gpfs_set_lease_fn = NULL;
-		gpfs_getacl_fn = NULL;
-		gpfs_putacl_fn = NULL;
-		return;
+		goto failed;
 	}
 
 	gpfs_getacl_fn = sys_dlsym(libgpfs_handle, "gpfs_getacl");
 	if (gpfs_getacl_fn == NULL) {
 		DEBUG(3, ("libgpfs_gpl.so does not contain the symbol "
 			  "'gpfs_getacl'\n"));
-		sys_dlclose(libgpfs_handle);
-
-		/* leave libgpfs_handle != NULL around, no point
-		   in trying twice */
-		gpfs_set_share_fn = NULL;
-		gpfs_set_lease_fn = NULL;
-		gpfs_getacl_fn = NULL;
-		gpfs_putacl_fn = NULL;
-		return;
+		goto failed;
 	}
 
 	gpfs_putacl_fn = sys_dlsym(libgpfs_handle, "gpfs_putacl");
 	if (gpfs_putacl_fn == NULL) {
 		DEBUG(3, ("libgpfs_gpl.so does not contain the symbol "
 			  "'gpfs_putacl'\n"));
-		sys_dlclose(libgpfs_handle);
+		goto failed;
+	}
 
-		/* leave libgpfs_handle != NULL around, no point
-		   in trying twice */
-		gpfs_set_share_fn = NULL;
-		gpfs_set_lease_fn = NULL;
-		gpfs_getacl_fn = NULL;
-		gpfs_putacl_fn = NULL;
-		return;
+	if (lp_parm_bool(-1, "gpfs", "sharemodes", True)) {
+		gpfs_share_modes = True;
+	} else {
+		gpfs_share_modes = False;
 	}
 
+	return;
+
+failed:
+	sys_dlclose(libgpfs_handle);
+	/* leave libgpfs_handle != NULL around, no point
+	   in trying twice */
+	gpfs_set_share_fn = NULL;
+	gpfs_set_lease_fn = NULL;
+	gpfs_getacl_fn = NULL;
+	gpfs_putacl_fn = NULL;
 }
 
 #else

Modified: branches/SAMBA_3_0_26/source/modules/gpfs.c
===================================================================
--- branches/SAMBA_3_0_26/source/modules/gpfs.c	2007-05-29 19:48:34 UTC (rev 23227)
+++ branches/SAMBA_3_0_26/source/modules/gpfs.c	2007-05-29 19:54:26 UTC (rev 23228)
@@ -25,6 +25,7 @@
 #include "gpfs_gpl.h"
 
 static void *libgpfs_handle = NULL;
+static BOOL gpfs_share_modes;
 
 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);
@@ -39,6 +40,10 @@
 	unsigned int deny = GPFS_DENY_NONE;
 	int result;
 
+	if (!gpfs_share_modes) {
+		return True;
+	}
+
 	if (gpfs_set_share_fn == NULL) {
 		return False;
 	}
@@ -84,6 +89,10 @@
 {
 	int gpfs_type = GPFS_LEASE_NONE;
 
+	if (!gpfs_share_modes) {
+		return True;
+	}
+
 	if (gpfs_set_lease_fn == NULL) {
 		errno = EINVAL;
 		return -1;
@@ -138,15 +147,7 @@
 	if (gpfs_set_share_fn == NULL) {
 		DEBUG(3, ("libgpfs_gpl.so does not contain the symbol "
 			  "'gpfs_set_share'\n"));
-		sys_dlclose(libgpfs_handle);
-
-		/* leave libgpfs_handle != NULL around, no point
-		   in trying twice */
-		gpfs_set_share_fn = NULL;
-		gpfs_set_lease_fn = NULL;
-		gpfs_getacl_fn = NULL;
-		gpfs_putacl_fn = NULL;
-		return;
+		goto failed;
 	}
 
 	gpfs_set_lease_fn = sys_dlsym(libgpfs_handle, "gpfs_set_lease");
@@ -155,45 +156,39 @@
 			  "'gpfs_set_lease'\n"));
 		sys_dlclose(libgpfs_handle);
 
-		/* leave libgpfs_handle != NULL around, no point
-		   in trying twice */
-		gpfs_set_share_fn = NULL;
-		gpfs_set_lease_fn = NULL;
-		gpfs_getacl_fn = NULL;
-		gpfs_putacl_fn = NULL;
-		return;
+		goto failed;
 	}
 
 	gpfs_getacl_fn = sys_dlsym(libgpfs_handle, "gpfs_getacl");
 	if (gpfs_getacl_fn == NULL) {
 		DEBUG(3, ("libgpfs_gpl.so does not contain the symbol "
 			  "'gpfs_getacl'\n"));
-		sys_dlclose(libgpfs_handle);
-
-		/* leave libgpfs_handle != NULL around, no point
-		   in trying twice */
-		gpfs_set_share_fn = NULL;
-		gpfs_set_lease_fn = NULL;
-		gpfs_getacl_fn = NULL;
-		gpfs_putacl_fn = NULL;
-		return;
+		goto failed;
 	}
 
 	gpfs_putacl_fn = sys_dlsym(libgpfs_handle, "gpfs_putacl");
 	if (gpfs_putacl_fn == NULL) {
 		DEBUG(3, ("libgpfs_gpl.so does not contain the symbol "
 			  "'gpfs_putacl'\n"));
-		sys_dlclose(libgpfs_handle);
+		goto failed;
+	}
 
-		/* leave libgpfs_handle != NULL around, no point
-		   in trying twice */
-		gpfs_set_share_fn = NULL;
-		gpfs_set_lease_fn = NULL;
-		gpfs_getacl_fn = NULL;
-		gpfs_putacl_fn = NULL;
-		return;
+	if (lp_parm_bool(-1, "gpfs", "sharemodes", True)) {
+		gpfs_share_modes = True;
+	} else {
+		gpfs_share_modes = False;
 	}
 
+	return;
+
+failed:
+	sys_dlclose(libgpfs_handle);
+	/* leave libgpfs_handle != NULL around, no point
+	   in trying twice */
+	gpfs_set_share_fn = NULL;
+	gpfs_set_lease_fn = NULL;
+	gpfs_getacl_fn = NULL;
+	gpfs_putacl_fn = NULL;
 }
 
 #else



More information about the samba-cvs mailing list