[SCM] Samba Shared Repository - branch master updated

Christof Schmitt cs at samba.org
Wed Jul 8 05:56:04 CEST 2015


The branch, master has been updated
       via  b6c9d9a gpfswrap: Use gpfs.h instead of gpfs_fcntl.h
       via  e4a9667 gpfswrap: Remove unused wrapper for gpfs_fnctl
       via  2d62b9a vfs_gpfs: Use C99 initializers instead of ZERO_STRUCT
       via  4099bdf vfs_gpfs: Use ACL defines from GPFS 3.5 header files
       via  cd55349 ctdb: Accept hex format for pdelete and ptrans commands
       via  663db9f ctdb: Create helper function for optional hex input
      from  93c91bd Remove ctdb_conn.[ch]

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b6c9d9a59e015fdf0ab9c11f4d808e28a2d0d109
Author: Christof Schmitt <cs at samba.org>
Date:   Thu Jul 2 15:31:29 2015 -0700

    gpfswrap: Use gpfs.h instead of gpfs_fcntl.h
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Christof Schmitt <cs at samba.org>
    Autobuild-Date(master): Wed Jul  8 05:55:13 CEST 2015 on sn-devel-104

commit e4a96670781631894b2fe649710e99fb0a75a1e8
Author: Christof Schmitt <cs at samba.org>
Date:   Thu Jul 2 15:20:01 2015 -0700

    gpfswrap: Remove unused wrapper for gpfs_fnctl
    
    With the removal of the fileset quota check this wrapper function is
    longer used.
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 2d62b9ab7d80b8970ca16c962e6fbc942b9d1bd6
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Mar 23 12:57:39 2015 -0700

    vfs_gpfs: Use C99 initializers instead of ZERO_STRUCT
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 4099bdfae84962b126cb5420f61fc0caebd38268
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Mar 23 12:54:34 2015 -0700

    vfs_gpfs: Use ACL defines from GPFS 3.5 header files
    
    GPFS 3.5 is now the oldest support version. Cleanup the ACL code by
    using the defines and structs from the 3.5 header file.
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit cd55349e9b0cfc9bb8c04a5cfa3c142efead6b83
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Jul 6 14:32:15 2015 -0700

    ctdb: Accept hex format for pdelete and ptrans commands
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 663db9fbb028fe524bb0eef09398c62bf4fb08d4
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Jul 6 13:07:33 2015 -0700

    ctdb: Create helper function for optional hex input
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 ctdb/tools/ctdb.c          | 82 ++++++++++++++++++++++------------------------
 lib/util/gpfswrap.c        | 12 -------
 lib/util/gpfswrap.h        |  3 +-
 lib/util/wscript_configure |  2 +-
 source3/modules/vfs_gpfs.c | 40 +++++++++-------------
 5 files changed, 57 insertions(+), 82 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index 91ada44..57c7052 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -180,12 +180,11 @@ static int h2i(char h)
 	return h - '0';
 }
 
-static TDB_DATA hextodata(TALLOC_CTX *mem_ctx, const char *str)
+static TDB_DATA hextodata(TALLOC_CTX *mem_ctx, const char *str, size_t len)
 {
-	int i, len;
+	int i;
 	TDB_DATA key = {NULL, 0};
 
-	len = strlen(str);
 	if (len & 0x01) {
 		DEBUG(DEBUG_ERR,("Key specified with odd number of hexadecimal digits\n"));
 		return key;
@@ -200,6 +199,20 @@ static TDB_DATA hextodata(TALLOC_CTX *mem_ctx, const char *str)
 	return key;
 }
 
+static TDB_DATA strtodata(TALLOC_CTX *mem_ctx, const char *str, size_t len)
+{
+	TDB_DATA key;
+
+	if (!strncmp(str, "0x", 2)) {
+		key = hextodata(mem_ctx, str + 2, len - 2);
+	} else {
+		key.dptr  = talloc_memdup(mem_ctx, str, len);
+		key.dsize = len;
+	}
+
+	return key;
+}
+
 /* Parse a nodestring.  Parameter dd_ok controls what happens to nodes
  * that are disconnected or deleted.  If dd_ok is true those nodes are
  * included in the output list of nodes.  If dd_ok is false, those
@@ -4031,15 +4044,10 @@ static int control_tfetch(struct ctdb_context *ctdb, int argc, const char **argv
 		return -1;
 	}
 
-	if (!strncmp(argv[1], "0x", 2)) {
-		key = hextodata(tmp_ctx, argv[1] + 2);
-		if (key.dsize == 0) {
-			printf("Failed to convert \"%s\" into a TDB_DATA\n", argv[1]);
-			return -1;
-		}
-	} else {
-		key.dptr  = discard_const(argv[1]);
-		key.dsize = strlen(argv[1]);
+	key = strtodata(tmp_ctx, argv[1], strlen(argv[1]));
+	if (key.dptr == NULL) {
+		printf("Failed to convert \"%s\" into a TDB_DATA\n", argv[1]);
+		return -1;
 	}
 
 	data = tdb_fetch(tdb, key);
@@ -4098,26 +4106,16 @@ static int control_tstore(struct ctdb_context *ctdb, int argc, const char **argv
 		return -1;
 	}
 
-	if (!strncmp(argv[1], "0x", 2)) {
-		key = hextodata(tmp_ctx, argv[1] + 2);
-		if (key.dsize == 0) {
-			printf("Failed to convert \"%s\" into a TDB_DATA\n", argv[1]);
-			return -1;
-		}
-	} else {
-		key.dptr  = discard_const(argv[1]);
-		key.dsize = strlen(argv[1]);
+	key = strtodata(tmp_ctx, argv[1], strlen(argv[1]));
+	if (key.dptr == NULL) {
+		printf("Failed to convert \"%s\" into a TDB_DATA\n", argv[1]);
+		return -1;
 	}
 
-	if (!strncmp(argv[2], "0x", 2)) {
-		value = hextodata(tmp_ctx, argv[2] + 2);
-		if (value.dsize == 0) {
-			printf("Failed to convert \"%s\" into a TDB_DATA\n", argv[2]);
-			return -1;
-		}
-	} else {
-		value.dptr  = discard_const(argv[2]);
-		value.dsize = strlen(argv[2]);
+	value = strtodata(tmp_ctx, argv[2], strlen(argv[2]));
+	if (value.dptr == NULL) {
+		printf("Failed to convert \"%s\" into a TDB_DATA\n", argv[2]);
+		return -1;
 	}
 
 	ZERO_STRUCT(header);
@@ -4231,15 +4229,10 @@ static int control_pstore(struct ctdb_context *ctdb, int argc, const char **argv
 		return -1;
 	}
 
-	if (!strncmp(argv[1], "0x", 2)) {
-		key = hextodata(tmp_ctx, argv[1] + 2);
-		if (key.dsize == 0) {
-			printf("Failed to convert \"%s\" into a TDB_DATA\n", argv[1]);
-			return -1;
-		}
-	} else {
-		key.dptr  = discard_const(argv[1]);
-		key.dsize = strlen(argv[1]);
+	key = strtodata(tmp_ctx, argv[1], strlen(argv[1]));
+	if (key.dptr == NULL) {
+		printf("Failed to convert \"%s\" into a TDB_DATA\n", argv[1]);
+		return -1;
 	}
 
 	ret = ctdb_transaction_store(h, key, data);
@@ -4306,8 +4299,12 @@ static int control_pdelete(struct ctdb_context *ctdb, int argc, const char **arg
 		return -1;
 	}
 
-	key.dptr = discard_const(argv[1]);
-	key.dsize = strlen(argv[1]);
+	key = strtodata(tmp_ctx, argv[1], strlen(argv[1]));
+	if (key.dptr == NULL) {
+		printf("Failed to convert \"%s\" into a TDB_DATA\n", argv[1]);
+		return -1;
+	}
+
 	ret = ctdb_transaction_store(h, key, tdb_null);
 	if (ret != 0) {
 		DEBUG(DEBUG_ERR, ("Failed to delete record\n"));
@@ -4348,8 +4345,7 @@ static const char *ptrans_parse_string(TALLOC_CTX *mem_ctx, const char *s,
 		n = strcspn(t, "\"");
 		if (t[n] == '"') {
 			if (n > 0) {
-				data->dsize = n;
-				data->dptr = talloc_memdup(mem_ctx, t, n);
+				*data = strtodata(mem_ctx, t, n);
 				CTDB_NOMEM_ABORT(data->dptr);
 			}
 			ret = t + n + 1;
diff --git a/lib/util/gpfswrap.c b/lib/util/gpfswrap.c
index 732fcb6..4c74105 100644
--- a/lib/util/gpfswrap.c
+++ b/lib/util/gpfswrap.c
@@ -38,7 +38,6 @@ static int (*gpfs_lib_init_fn)(int flags);
 static int (*gpfs_set_times_path_fn)(char *pathname, int flags,
 				     gpfs_timestruc_t times[4]);
 static int (*gpfs_quotactl_fn)(char *pathname, int cmd, int id, void *bufp);
-static int (*gpfs_fcntl_fn)(int fd, void *argp);
 static int (*gpfs_getfilesetid_fn)(char *pathname, char *name, int *idp);
 static int (*gpfs_init_trace_fn)(void);
 static int (*gpfs_query_trace_fn)(void);
@@ -71,7 +70,6 @@ int gpfswrap_init(void)
 	gpfs_lib_init_fn	      = dlsym(l, "gpfs_lib_init");
 	gpfs_set_times_path_fn	      = dlsym(l, "gpfs_set_times_path");
 	gpfs_quotactl_fn	      = dlsym(l, "gpfs_quotactl");
-	gpfs_fcntl_fn		      = dlsym(l, "gpfs_fcntl");
 	gpfs_getfilesetid_fn	      = dlsym(l, "gpfs_getfilesetid");
 	gpfs_init_trace_fn	      = dlsym(l, "gpfs_init_trace");
 	gpfs_query_trace_fn	      = dlsym(l, "gpfs_query_trace");
@@ -213,16 +211,6 @@ int gpfswrap_quotactl(char *pathname, int cmd, int id, void *bufp)
 	return gpfs_quotactl_fn(pathname, cmd, id, bufp);
 }
 
-int gpfswrap_fcntl(int fd, void *argp)
-{
-	if (gpfs_fcntl_fn == NULL) {
-		errno = ENOSYS;
-		return -1;
-	}
-
-	return gpfs_fcntl_fn(fd, argp);
-}
-
 int gpfswrap_getfilesetid(char *pathname, char *name, int *idp)
 {
 	if (gpfs_getfilesetid_fn == NULL) {
diff --git a/lib/util/gpfswrap.h b/lib/util/gpfswrap.h
index fc8ac4a..25b1ba8 100644
--- a/lib/util/gpfswrap.h
+++ b/lib/util/gpfswrap.h
@@ -24,7 +24,7 @@
 #ifndef __GPFSWRAP_H__
 #define __GPFSWRAP_H__
 
-#include <gpfs_fcntl.h>
+#include <gpfs.h>
 
 int gpfswrap_init(void);
 int gpfswrap_set_share(int fd, unsigned int allow, unsigned int deny);
@@ -42,7 +42,6 @@ int gpfswrap_lib_init(int flags);
 int gpfswrap_set_times_path(char *pathname, int flags,
 			    gpfs_timestruc_t times[4]);
 int gpfswrap_quotactl(char *pathname, int cmd, int id, void *bufp);
-int gpfswrap_fcntl(int fd, void *argp);
 int gpfswrap_getfilesetid(char *pathname, char *name, int *idp);
 int gpfswrap_init_trace(void);
 int gpfswrap_query_trace(void);
diff --git a/lib/util/wscript_configure b/lib/util/wscript_configure
index a17cb56..95a8949 100644
--- a/lib/util/wscript_configure
+++ b/lib/util/wscript_configure
@@ -136,5 +136,5 @@ else:
     conf.undefine('HAVE_LTTNG_TRACEF')
 
 conf.env['CPPPATH_GPFS'] = '/usr/lpp/mmfs/include/'
-if conf.CHECK_HEADERS('gpfs_fcntl.h', False, False, "gpfs"):
+if conf.CHECK_HEADERS('gpfs.h', False, False, "gpfs"):
     conf.DEFINE('HAVE_GPFS', '1')
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 9ad8fbc..3260d2f 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -56,19 +56,16 @@ struct gpfs_config_data {
 
 static inline unsigned int gpfs_acl_flags(gpfs_acl_t *gacl)
 {
-	if (gacl->acl_level == 1) { /* GPFS_ACL_LEVEL_V4FLAGS */
-		/* gacl->v4Level1.acl_flags requires gpfs 3.5 */
-		return *(unsigned int *)&gacl->ace_v4;
+	if (gacl->acl_level == GPFS_ACL_LEVEL_V4FLAGS) {
+		return gacl->v4Level1.acl_flags;
 	}
 	return 0;
 }
 
 static inline gpfs_ace_v4_t *gpfs_ace_ptr(gpfs_acl_t *gacl, unsigned int i)
 {
-	if (gacl->acl_level == 1) { /* GPFS_ACL_LEVEL_V4FLAGS */
-		/* &gacl->v4Level1.ace_v4[i] requires gpfs 3.5 */
-		char *ptr = (char *)&gacl->ace_v4[i] + sizeof(unsigned int);
-		return (gpfs_ace_v4_t *)ptr;
+	if (gacl->acl_level == GPFS_ACL_LEVEL_V4FLAGS) {
+		return &gacl->v4Level1.ace_v4[i];
 	}
 	return &gacl->ace_v4[i];
 }
@@ -315,12 +312,11 @@ static void sd2gpfs_control(uint16_t control, struct gpfs_acl *gacl)
 		SEC_DESC_DACL_PRESENT | SEC_DESC_SACL_PRESENT;
 	gpfs_aclflags = control << 8;
 	if (!(control & SEC_DESC_DACL_PRESENT))
-		gpfs_aclflags |= 0x00800000; /* ACL4_FLAG_NULL_DACL; */
+		gpfs_aclflags |= ACL4_FLAG_NULL_DACL;
 	if (!(control & SEC_DESC_SACL_PRESENT))
-		gpfs_aclflags |= 0x01000000; /* ACL4_FLAG_NULL_SACL; */
-	gacl->acl_level = 1; /* GPFS_ACL_LEVEL_V4FLAGS*/
-	/* gacl->v4Level1.acl_flags requires gpfs 3.5 */
-	*(unsigned int *)&gacl->ace_v4 = gpfs_aclflags;
+		gpfs_aclflags |= ACL4_FLAG_NULL_SACL;
+	gacl->acl_level = GPFS_ACL_LEVEL_V4FLAGS;
+	gacl->v4Level1.acl_flags = gpfs_aclflags;
 }
 
 static uint16_t gpfs2sd_control(unsigned int gpfs_aclflags)
@@ -396,7 +392,7 @@ again:
 	} else {
 		struct gpfs_acl *buf = (struct gpfs_acl *) aclbuf;
 		buf->acl_type = type;
-		buf->acl_level = 1; /* GPFS_ACL_LEVEL_V4FLAGS */
+		buf->acl_level = GPFS_ACL_LEVEL_V4FLAGS;
 		flags = GPFS_GETACL_STRUCT;
 		len = &(buf->acl_len);
 		/* reserve space for control flags in gpfs 3.5 and beyond */
@@ -471,7 +467,7 @@ static int gpfs_get_nfs4_acl(TALLOC_CTX *mem_ctx, const char *fname, SMB4ACL_T *
 
 	*ppacl = smb_create_smb4acl(mem_ctx);
 
-	if (gacl->acl_level == 1) { /* GPFS_ACL_LEVEL_V4FLAGS */
+	if (gacl->acl_level == GPFS_ACL_LEVEL_V4FLAGS) {
 		uint16_t control = gpfs2sd_control(gpfs_acl_flags(gacl));
 		smbacl4_set_controlflags(*ppacl, control);
 	}
@@ -482,12 +478,11 @@ static int gpfs_get_nfs4_acl(TALLOC_CTX *mem_ctx, const char *fname, SMB4ACL_T *
 
 	for (i=0; i<gacl->acl_nace; i++) {
 		struct gpfs_ace_v4 *gace = gpfs_ace_ptr(gacl, i);
-		SMB_ACE4PROP_T smbace;
+		SMB_ACE4PROP_T smbace = { 0 };
 		DEBUG(10, ("type: %d, iflags: %x, flags: %x, mask: %x, "
 			   "who: %d\n", gace->aceType, gace->aceIFlags,
 			   gace->aceFlags, gace->aceMask, gace->aceWho));
 
-		ZERO_STRUCT(smbace);
 		if (gace->aceIFlags & ACE4_IFLAG_SPECIAL_ID) {
 			smbace.flags |= SMB_ACE4_ID_SPECIAL;
 			switch (gace->aceWho) {
@@ -648,13 +643,13 @@ static struct gpfs_acl *vfs_gpfs_smbacl2gpfsacl(TALLOC_CTX *mem_ctx,
 		return NULL;
 	}
 
-	gacl->acl_level = 0; /* GPFS_ACL_LEVEL_BASE */
+	gacl->acl_level = GPFS_ACL_LEVEL_BASE;
 	gacl->acl_version = GPFS_ACL_VERSION_NFS4;
 	gacl->acl_type = GPFS_ACL_TYPE_NFS4;
 	gacl->acl_nace = 0; /* change later... */
 
 	if (controlflags) {
-		gacl->acl_level = 1; /* GPFS_ACL_LEVEL_V4FLAGS */
+		gacl->acl_level = GPFS_ACL_LEVEL_V4FLAGS;
 		sd2gpfs_control(smbacl4_get_controlflags(smbacl), gacl);
 	}
 
@@ -1303,7 +1298,7 @@ static int gpfsacl_emu_chmod(vfs_handle_struct *handle,
 	int     result;
 	bool    haveAllowEntry[SMB_ACE4_WHO_EVERYONE + 1] = {False, False, False, False};
 	int     i;
-	files_struct    fake_fsp; /* TODO: rationalize parametrization */
+	files_struct fake_fsp = { 0 }; /* TODO: rationalize parametrization */
 	SMB4ACE_T       *smbace;
 	TALLOC_CTX *frame = talloc_stackframe();
 
@@ -1349,12 +1344,11 @@ static int gpfsacl_emu_chmod(vfs_handle_struct *handle,
 	 * - if necessary
 	 */
 	for(i = SMB_ACE4_WHO_OWNER; i<=SMB_ACE4_WHO_EVERYONE; i++) {
-		SMB_ACE4PROP_T  ace;
+		SMB_ACE4PROP_T ace = { 0 };
 
 		if (haveAllowEntry[i]==True)
 			continue;
 
-		ZERO_STRUCT(ace);
 		ace.aceType = SMB_ACE4_ACCESS_ALLOWED_ACE_TYPE;
 		ace.flags |= SMB_ACE4_ID_SPECIAL;
 		ace.who.special_id = i;
@@ -1376,7 +1370,6 @@ static int gpfsacl_emu_chmod(vfs_handle_struct *handle,
 	}
 
 	/* don't add complementary DENY ACEs here */
-	ZERO_STRUCT(fake_fsp);
 	fake_fsp.fsp_name = synthetic_smb_fname(
 		frame, path, NULL, NULL);
 	if (fake_fsp.fsp_name == NULL) {
@@ -2071,7 +2064,6 @@ static int get_gpfs_quota(const char *pathname, int type, int id,
 {
 	int ret;
 
-	ZERO_STRUCTP(qi);
 	ret = gpfswrap_quotactl(discard_const_p(char, pathname),
 				GPFS_QCMD(Q_GETQUOTA, type), id, qi);
 
@@ -2137,7 +2129,7 @@ static uint64_t vfs_gpfs_disk_free(vfs_handle_struct *handle, const char *path,
 				   uint64_t *dfree, uint64_t *dsize)
 {
 	struct security_unix_token *utok;
-	struct gpfs_quotaInfo qi_user, qi_group;
+	struct gpfs_quotaInfo qi_user = { 0 }, qi_group = { 0 };
 	struct gpfs_config_data *config;
 	int err;
 	time_t cur_time;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list