[PVFS2-CVS] commit by neill in pvfs2/test/client/sysint: client.c create.c dmkdir.c find.c flush-1.c flush-2.c get-info.c getparent.c io-test-offset.c io-test.c lookup.c mkdir.c readdir.c remove.c rename.c set-info.c symlink.c truncate.c

CVS commit program cvs at parl.clemson.edu
Thu Mar 18 14:16:20 EST 2004


Update of /projects/cvsroot/pvfs2/test/client/sysint
In directory parlweb:/tmp/cvs-serv9509/test/client/sysint

Modified Files:
	client.c create.c dmkdir.c find.c flush-1.c flush-2.c 
	get-info.c getparent.c io-test-offset.c io-test.c lookup.c 
	mkdir.c readdir.c remove.c rename.c set-info.c symlink.c 
	truncate.c 
Log Message:
- more credential generation consolidation (test programs)


Index: client.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/client.c,v
diff -p -u -r1.42 -r1.43
--- client.c	9 Mar 2004 21:42:49 -0000	1.42
+++ client.c	18 Mar 2004 19:16:20 -0000	1.43
@@ -99,15 +99,14 @@ int main(
 	return (-1);
     }
     memcpy(entry_name, filename, strlen(filename) + 1);
+    PVFS_util_gen_credentials(&credentials);
+
     attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
-    attr.owner = 100;
-    attr.group = 100;
+    attr.owner = credentials.uid;
+    attr.group = credentials.gid;
     attr.perms = 1877;
     attr.atime = attr.mtime = attr.ctime = time(NULL);
 
-    credentials.uid = 100;
-    credentials.gid = 100;
-
     parent_refn.handle = resp_look.pinode_refn.handle;
     parent_refn.fs_id = fs_id;
 
@@ -477,9 +476,6 @@ int main(
     pinode_refn.fs_id = fs_id;
     token = PVFS_READDIR_START;
     pvfs_dirent_incount = 6;
-    credentials.uid = 100;
-    credentials.gid = 100;
-
 
     // call readdir 
     ret = PVFS_sys_readdir(pinode_refn, token, pvfs_dirent_incount,

Index: create.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/create.c,v
diff -p -u -r1.35 -r1.36
--- create.c	9 Mar 2004 22:00:21 -0000	1.35
+++ create.c	18 Mar 2004 19:16:20 -0000	1.36
@@ -57,18 +57,18 @@ int main(int argc, char **argv)
     }
 
     memset(&resp_create, 0, sizeof(PVFS_sysresp_create));
+    PVFS_util_gen_credentials(&credentials);
 
     entry_name = str_buf;
     attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
-    attr.owner = getuid();
-    attr.group = getgid();
+    attr.owner = credentials.uid;
+    attr.group = credentials.gid;
     attr.perms = 1877;
     attr.atime = attr.ctime = attr.mtime = 
 	time(NULL);
-    credentials.uid = getuid();
-    credentials.gid = getgid();
+
     ret = PVFS_util_lookup_parent(filename, cur_fs, credentials, 
-	&parent_refn.handle);
+                                  &parent_refn.handle);
     if(ret < 0)
     {
 	PVFS_perror("PVFS_util_lookup_parent", ret);

Index: dmkdir.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/dmkdir.c,v
diff -p -u -r1.8 -r1.9
--- dmkdir.c	9 Mar 2004 22:00:21 -0000	1.8
+++ dmkdir.c	18 Mar 2004 19:16:20 -0000	1.9
@@ -65,27 +65,26 @@ int main(int argc,char **argv)
            str_buf, str_buf2, str_buf3);
 
     memset(&resp_mkdir, 0, sizeof(PVFS_sysresp_mkdir));
+    PVFS_util_gen_credentials(&credentials);
 
     entry_name = str_buf;
     ret = PVFS_util_lookup_parent(dirname, cur_fs, credentials, 
-	&parent_refn.handle);
+                                  &parent_refn.handle);
     if(ret < 0)
     {
 	PVFS_perror("PVFS_util_lookup_parent", ret);
 	return(-1);
     }
+
     parent_refn.fs_id = cur_fs;
     attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
-    attr.owner = getuid();
-    attr.group = getgid();
+    attr.owner = credentials.uid;
+    attr.group = credentials.gid;
     attr.perms = 0777;
-    attr.atime = attr.ctime = attr.mtime =
-	time(NULL);
-    credentials.uid = getuid();
-    credentials.gid = getgid();
+    attr.atime = attr.ctime = attr.mtime = time(NULL);
 
     ret = PVFS_sys_mkdir(entry_name, parent_refn, attr, 
-			credentials, &resp_mkdir);
+                         credentials, &resp_mkdir);
     if (ret < 0)
     {
         printf("mkdir failed\n");
@@ -97,7 +96,7 @@ int main(int argc,char **argv)
     printf("FSID:%d\n",parent_refn.fs_id);
 
     ret = PVFS_sys_mkdir(str_buf2, resp_mkdir.pinode_refn, attr, 
-			credentials, &resp_mkdir);
+                         credentials, &resp_mkdir);
     if (ret < 0)
     {
         printf("mkdir failed\n");

Index: find.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/find.c,v
diff -p -u -r1.36 -r1.37
--- find.c	9 Mar 2004 22:00:21 -0000	1.36
+++ find.c	18 Mar 2004 19:16:20 -0000	1.37
@@ -39,12 +39,12 @@ int is_directory(PVFS_handle handle, PVF
     PVFS_sysresp_getattr getattr_response;
 
     memset(&getattr_response,0,sizeof(PVFS_sysresp_getattr));
-    memset(&credentials,0,sizeof(PVFS_credentials));
 
     pinode_refn.handle = handle;
     pinode_refn.fs_id = fs_id;
     attrmask = PVFS_ATTR_SYS_ALL_NOSIZE;
 
+    PVFS_util_gen_credentials(&credentials);
     if (PVFS_sys_getattr(pinode_refn, attrmask,
                          credentials, &getattr_response))
     {
@@ -90,9 +90,8 @@ int directory_walk(PVFS_fs_id cur_fs,
         strcpy(full_path,start_dir);
     }
     name = full_path;
-    credentials.uid = getuid();
-    credentials.gid = getgid();
 
+    PVFS_util_gen_credentials(&credentials);
     if (PVFS_sys_lookup(cur_fs, name, credentials,
                         &lk_response, PVFS2_LOOKUP_LINK_FOLLOW))
     {
@@ -107,8 +106,6 @@ int directory_walk(PVFS_fs_id cur_fs,
     pinode_refn.fs_id = cur_fs;
     token = 0;
     pvfs_dirent_incount = MAX_NUM_DIRENTS;
-    credentials.uid = getuid();
-    credentials.gid = getgid();
 
     do
     {

Index: flush-1.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/flush-1.c,v
diff -p -u -r1.8 -r1.9
--- flush-1.c	9 Mar 2004 22:00:21 -0000	1.8
+++ flush-1.c	18 Mar 2004 19:16:20 -0000	1.9
@@ -62,15 +62,15 @@ int main(int argc, char **argv)
 
     entry_name = str_buf;
     attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
-    attr.owner = 100;
-    attr.group = 100;
+    attr.owner = credentials.uid;
+    attr.group = credentials.gid;
     attr.perms = 1877;
     attr.atime = attr.ctime = attr.mtime = 
 	time(NULL);
-    credentials.uid = 100;
-    credentials.gid = 100;
+
+    PVFS_util_gen_credentials(&credentials);
     ret = PVFS_util_lookup_parent(filename, cur_fs, credentials, 
-	&parent_refn.handle);
+                                  &parent_refn.handle);
     if(ret < 0)
     {
 	PVFS_perror("PVFS_util_lookup_parent", ret);

Index: flush-2.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/flush-2.c,v
diff -p -u -r1.15 -r1.16
--- flush-2.c	9 Mar 2004 22:24:20 -0000	1.15
+++ flush-2.c	18 Mar 2004 19:16:20 -0000	1.16
@@ -96,9 +96,8 @@ int main(
 	 */
 
     name = filename;
-    credentials.uid = 100;
-    credentials.gid = 100;
 
+    PVFS_util_gen_credentials(&credentials);
     ret = PVFS_sys_lookup(fs_id, name, credentials,
 			  &resp_lk, PVFS2_LOOKUP_LINK_NO_FOLLOW);
     /* TODO: really we probably want to look for a specific error code,
@@ -110,8 +109,6 @@ int main(
 
 	/* get root handle */
 	name = "/";
-	credentials.uid = 100;
-	credentials.gid = 100;
 
 	ret = PVFS_sys_lookup(fs_id, name, credentials,
 			      &resp_lk, PVFS2_LOOKUP_LINK_NO_FOLLOW);
@@ -123,17 +120,14 @@ int main(
 	}
 
 	/* create new file */
-
-	attr.owner = 100;
-	attr.group = 100;
+	attr.owner = credentials.uid;
+	attr.group = credentials.gid;
 	attr.perms = PVFS_U_WRITE | PVFS_U_READ;
 	attr.atime = attr.ctime = attr.mtime = time(NULL);
 	attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
 	parent_refn.handle = resp_lk.pinode_refn.handle;
 	parent_refn.fs_id = fs_id;
 	entry_name = &(filename[1]);	/* leave off slash */
-	credentials.uid = 100;
-	credentials.gid = 100;
 
 	ret = PVFS_sys_create(entry_name, parent_refn, attr,
 			      credentials, &resp_cr);
@@ -161,8 +155,6 @@ int main(
     printf("IO-TEST: performing write on handle: %ld, fs: %d\n",
 	   (long) pinode_refn.handle, (int) pinode_refn.fs_id);
 
-    credentials.uid = 100;
-    credentials.gid = 100;
     buffer = io_buffer;
     buffer_size = io_size * sizeof(int);
 

Index: get-info.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/get-info.c,v
diff -p -u -r1.35 -r1.36
--- get-info.c	9 Mar 2004 22:00:22 -0000	1.35
+++ get-info.c	18 Mar 2004 19:16:20 -0000	1.36
@@ -50,9 +50,9 @@ int main(int argc,char **argv)
 	return (-1);
     }
 
-    credentials.uid = getuid();
-    credentials.gid = getgid();
     name = filename;
+
+    PVFS_util_gen_credentials(&credentials);
     ret = PVFS_sys_lookup(fs_id, name, credentials,
                           &resp_look, PVFS2_LOOKUP_LINK_NO_FOLLOW);
     if (ret < 0)

Index: getparent.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/getparent.c,v
diff -p -u -r1.13 -r1.14
--- getparent.c	9 Mar 2004 22:00:22 -0000	1.13
+++ getparent.c	18 Mar 2004 19:16:20 -0000	1.14
@@ -41,9 +41,7 @@ int main(int argc,char **argv)
 	return (-1);
     }
 
-    credentials.uid = getuid();
-    credentials.gid = getgid();
-
+    PVFS_util_gen_credentials(&credentials);
     ret = PVFS_sys_getparent(fs_id, argv[1], credentials, &resp_getparent);
     if (ret == 0)
     {

Index: io-test-offset.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/io-test-offset.c,v
diff -p -u -r1.20 -r1.21
--- io-test-offset.c	9 Mar 2004 22:24:20 -0000	1.20
+++ io-test-offset.c	18 Mar 2004 19:16:20 -0000	1.21
@@ -101,9 +101,8 @@ int main(
 	 */
 
     name = filename;
-    credentials.uid = 100;
-    credentials.gid = 100;
 
+    PVFS_util_gen_credentials(&credentials);
     ret = PVFS_sys_lookup(fs_id, name, credentials,
 			  &resp_lk, PVFS2_LOOKUP_LINK_NO_FOLLOW);
     /* TODO: really we probably want to look for a specific error code,
@@ -115,8 +114,6 @@ int main(
 
 	/* get root handle */
 	name = "/";
-	credentials.uid = 100;
-	credentials.gid = 100;
 
 	ret = PVFS_sys_lookup(fs_id, name, credentials,
 			      &resp_lk, PVFS2_LOOKUP_LINK_NO_FOLLOW);
@@ -129,16 +126,14 @@ int main(
 
 	/* create new file */
 
-	attr.owner = 100;
-	attr.group = 100;
+	attr.owner = credentials.uid;
+	attr.group = credentials.gid;
 	attr.perms = PVFS_U_WRITE | PVFS_U_READ;
 	attr.atime = attr.ctime = attr.mtime = time(NULL);
 	attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
 	parent_refn.handle = resp_lk.pinode_refn.handle;
 	parent_refn.fs_id = fs_id;
 	entry_name = &(filename[1]);	/* leave off slash */
-	credentials.uid = 100;
-	credentials.gid = 100;
 
 	ret = PVFS_sys_create(entry_name, parent_refn, attr,
 			      credentials, &resp_cr);
@@ -166,8 +161,6 @@ int main(
     printf("IO-TEST: performing write on handle: %ld, fs: %d\n",
 	   (long) pinode_refn.handle, (int) pinode_refn.fs_id);
 
-    credentials.uid = 100;
-    credentials.gid = 100;
     buffer = io_buffer;
     buffer_size = io_size * sizeof(int);
 

Index: io-test.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/io-test.c,v
diff -p -u -r1.48 -r1.49
--- io-test.c	12 Mar 2004 22:03:01 -0000	1.48
+++ io-test.c	18 Mar 2004 19:16:20 -0000	1.49
@@ -100,9 +100,8 @@ int main(
 	 */
 
     name = filename;
-    credentials.uid = getuid();
-    credentials.gid = getgid();
 
+    PVFS_util_gen_credentials(&credentials);
     ret = PVFS_sys_lookup(fs_id, name, credentials,
 			  &resp_lk, PVFS2_LOOKUP_LINK_FOLLOW);
     /* TODO: really we probably want to look for a specific error code,
@@ -114,9 +113,6 @@ int main(
 
 	/* get root handle */
 	name = "/";
-	credentials.uid = getuid();
-	credentials.gid = getgid();
-
 	ret = PVFS_sys_lookup(fs_id, name, credentials,
 			      &resp_lk, PVFS2_LOOKUP_LINK_NO_FOLLOW);
 	if (ret < 0)
@@ -127,17 +123,14 @@ int main(
 	}
 
 	/* create new file */
-
-	attr.owner = getuid();
-	attr.group = getgid();
+	attr.owner = credentials.uid;
+	attr.group = credentials.gid;
 	attr.perms = PVFS_U_WRITE | PVFS_U_READ;
 	attr.atime = attr.ctime = attr.mtime = time(NULL);
 	attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
 	parent_refn.handle = resp_lk.pinode_refn.handle;
 	parent_refn.fs_id = fs_id;
 	entry_name = &(filename[1]);	/* leave off slash */
-	credentials.uid = getuid();
-	credentials.gid = getgid();
 
 	ret = PVFS_sys_create(entry_name, parent_refn, attr,
 			      credentials, &resp_cr);
@@ -165,8 +158,6 @@ int main(
     printf("IO-TEST: performing write on handle: %ld, fs: %d\n",
 	   (long) pinode_refn.handle, (int) pinode_refn.fs_id);
 
-    credentials.uid = getuid();
-    credentials.gid = getgid();
     buffer = io_buffer;
     buffer_size = io_size * sizeof(int);
 

Index: lookup.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/lookup.c,v
diff -p -u -r1.26 -r1.27
--- lookup.c	15 Mar 2004 23:54:42 -0000	1.26
+++ lookup.c	18 Mar 2004 19:16:20 -0000	1.27
@@ -43,8 +43,7 @@ int main(int argc,char **argv)
     filename = argv[1];
     printf("lookup up path %s\n", filename);
 
-    credentials.uid = getuid();
-    credentials.gid = getgid();
+    PVFS_util_gen_credentials(&credentials);
 
     ret = PVFS_util_init_defaults();
     if (ret < 0)

Index: mkdir.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/mkdir.c,v
diff -p -u -r1.29 -r1.30
--- mkdir.c	9 Mar 2004 22:22:35 -0000	1.29
+++ mkdir.c	18 Mar 2004 19:16:20 -0000	1.30
@@ -59,10 +59,11 @@ int main(int argc,char **argv)
     printf("Directory to be created is %s\n",str_buf);
 
     memset(&resp_mkdir, 0, sizeof(PVFS_sysresp_mkdir));
+    PVFS_util_gen_credentials(&credentials);
 
     entry_name = str_buf;
     ret = PVFS_util_lookup_parent(dirname, cur_fs, credentials, 
-	&parent_refn.handle);
+                                  &parent_refn.handle);
     if(ret < 0)
     {
 	PVFS_perror("PVFS_util_lookup_parent", ret);
@@ -70,16 +71,14 @@ int main(int argc,char **argv)
     }
     parent_refn.fs_id = cur_fs;
     attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
-    attr.owner = getuid();
-    attr.group = getgid();
+    attr.owner = credentials.uid;
+    attr.group = credentials.gid;
     attr.perms = 0777;
     attr.atime = attr.ctime = attr.mtime =
 	time(NULL);
-    credentials.uid = getuid();
-    credentials.gid = getgid();
 
     ret = PVFS_sys_mkdir(entry_name, parent_refn, attr, 
-			credentials, &resp_mkdir);
+                         credentials, &resp_mkdir);
     if (ret < 0)
     {
         printf("mkdir failed\n");

Index: readdir.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/readdir.c,v
diff -p -u -r1.30 -r1.31
--- readdir.c	9 Mar 2004 22:22:35 -0000	1.30
+++ readdir.c	18 Mar 2004 19:16:20 -0000	1.31
@@ -51,10 +51,9 @@ int main(int argc,char **argv)
 	return (-1);
     }
 
-    credentials.uid = getuid();
-    credentials.gid = getgid();
 
     name = starting_point;
+    PVFS_util_gen_credentials(&credentials);
     ret = PVFS_sys_lookup(fs_id, name, credentials,
                           &resp_look, PVFS2_LOOKUP_LINK_FOLLOW);
     if (ret < 0)

Index: remove.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/remove.c,v
diff -p -u -r1.22 -r1.23
--- remove.c	9 Mar 2004 22:22:35 -0000	1.22
+++ remove.c	18 Mar 2004 19:16:20 -0000	1.23
@@ -55,16 +55,16 @@ int main(int argc,char **argv)
     printf("File to be removed is %s\n",str_buf);
 
     entry_name = str_buf;
+
+    PVFS_util_gen_credentials(&credentials);
     ret = PVFS_util_lookup_parent(filename, cur_fs, credentials,
-	&parent_refn.handle);
+                                  &parent_refn.handle);
     if(ret < 0)
     {
 	PVFS_perror("PVFS_util_lookup_parent", ret);
 	return(-1);
     }
     parent_refn.fs_id = cur_fs;
-    credentials.uid = getuid();
-    credentials.gid = getgid();
 
     ret = PVFS_sys_remove(entry_name, parent_refn, credentials);
     if (ret < 0)

Index: rename.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/rename.c,v
diff -p -u -r1.20 -r1.21
--- rename.c	9 Mar 2004 22:22:35 -0000	1.20
+++ rename.c	18 Mar 2004 19:16:20 -0000	1.21
@@ -71,12 +71,11 @@ int main(int argc,char **argv)
     }
     printf("New filename is %s\n",new_buf);
 
-    credentials.uid = getuid();
-    credentials.gid = getgid();
+    PVFS_util_gen_credentials(&credentials);
 
     old_entry = old_buf;
     ret = PVFS_util_lookup_parent(old_filename, cur_fs, credentials,
-	&old_parent_refn.handle);
+                                  &old_parent_refn.handle);
     if(ret < 0)
     {
 	PVFS_perror("PVFS_util_lookup_parent", ret);

Index: set-info.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/set-info.c,v
diff -p -u -r1.19 -r1.20
--- set-info.c	9 Mar 2004 22:22:35 -0000	1.19
+++ set-info.c	18 Mar 2004 19:16:20 -0000	1.20
@@ -47,8 +47,7 @@ int main(int argc, char **argv)
 	return (-1);
     }
 
-    credentials.uid = getuid();
-    credentials.gid = getgid();
+    PVFS_util_gen_credentials(&credentials);
 
     printf("about to lookup %s\n", filename);
 

Index: symlink.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/symlink.c,v
diff -p -u -r1.10 -r1.11
--- symlink.c	9 Mar 2004 22:22:35 -0000	1.10
+++ symlink.c	18 Mar 2004 19:16:20 -0000	1.11
@@ -60,15 +60,14 @@ int main(int argc, char **argv)
     printf("Link to be created is %s\n",str_buf);
 
     memset(&resp_sym, 0, sizeof(PVFS_sysresp_symlink));
+    PVFS_util_gen_credentials(&credentials);
 
     entry_name = str_buf;
     attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
-    attr.owner = getuid();
-    attr.group = getgid();
+    attr.owner = credentials.uid;
+    attr.group = credentials.gid;
     attr.perms = 1877;
     attr.atime = attr.ctime = attr.mtime = time(NULL);
-    credentials.uid = attr.owner;
-    credentials.gid = attr.group;
 
     ret = PVFS_util_lookup_parent(filename, cur_fs, credentials, 
                                   &parent_refn.handle);

Index: truncate.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/truncate.c,v
diff -p -u -r1.19 -r1.20
--- truncate.c	9 Mar 2004 22:22:35 -0000	1.19
+++ truncate.c	18 Mar 2004 19:16:20 -0000	1.20
@@ -69,9 +69,8 @@ int main(int argc,char **argv)
     memset(&resp_lk,0,sizeof(PVFS_sysresp_lookup));
 
     name = filename;
-    credentials.uid = 100;
-    credentials.gid = 100;
 
+    PVFS_util_gen_credentials(&credentials);
     ret = PVFS_sys_lookup(fs_id, name, credentials,
                           &resp_lk, PVFS2_LOOKUP_LINK_NO_FOLLOW);
     if (ret < 0)
@@ -84,8 +83,6 @@ int main(int argc,char **argv)
 
     pinode_refn.handle = resp_lk.pinode_refn.handle;
     pinode_refn.fs_id = resp_lk.pinode_refn.fs_id;
-    credentials.uid = 100;
-    credentials.gid = 100;
 
     ret = PVFS_sys_truncate(pinode_refn, size, credentials);
     if (ret < 0)



More information about the PVFS2-CVS mailing list