[Pvfs2-cvs] commit by dbonnie in pvfs2/test/client/sysint:
create-with-dist.c create.c create.set.get.eattr.c
del-eattr.c dmkdir.c find.c flush-1.c flush-2.c get-eattr.c
getattr-test-threaded.c getparent.c io-bug.c io-hole.c
io-stress.c io-test-offset.c io-test-threaded.c io-test.c
list-eattr.c ls.c readdir.c remove.c rename.c set-eattr.c
symlink.c test-accesses.c test-create-scale.c
test-hindexed-test.c truncate.c
CVS commit program
cvs at parl.clemson.edu
Fri Jul 25 15:06:33 EDT 2008
Update of /anoncvs/pvfs2/test/client/sysint
In directory parlweb1:/tmp/cvs-serv32282/test/client/sysint
Modified Files:
Tag: cu-security-branch
create-with-dist.c create.c create.set.get.eattr.c del-eattr.c
dmkdir.c find.c flush-1.c flush-2.c get-eattr.c
getattr-test-threaded.c getparent.c io-bug.c io-hole.c
io-stress.c io-test-offset.c io-test-threaded.c io-test.c
list-eattr.c ls.c readdir.c remove.c rename.c set-eattr.c
symlink.c test-accesses.c test-create-scale.c
test-hindexed-test.c truncate.c
Log Message:
Updated server/client test code.
Index: create-with-dist.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/create-with-dist.c,v
diff -p -u -r1.8 -r1.8.10.1
--- create-with-dist.c 6 Jul 2007 05:23:22 -0000 1.8
+++ create-with-dist.c 25 Jul 2008 19:06:32 -0000 1.8.10.1
@@ -8,6 +8,8 @@
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
+#include <assert.h>
+
#include "client.h"
#include "pvfs2-util.h"
@@ -26,7 +28,7 @@ int main(int argc, char **argv)
char* entry_name;
PVFS_object_ref parent_refn;
PVFS_sys_attr attr;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
PVFS_sys_dist *dist = NULL;
PVFS_size new_strip_size = 8192;
@@ -62,17 +64,18 @@ int main(int argc, char **argv)
}
memset(&resp_create, 0, sizeof(PVFS_sysresp_create));
- PVFS_util_gen_credentials(&credentials);
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
entry_name = str_buf;
attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
- attr.owner = credentials.uid;
- attr.group = credentials.gid;
+ attr.owner = cred->userid;
+ attr.group = cred->group_array[0];
attr.perms = 1877;
attr.atime = attr.ctime = attr.mtime =
time(NULL);
- ret = PINT_lookup_parent(filename, cur_fs, &credentials,
+ ret = PINT_lookup_parent(filename, cur_fs, cred,
&parent_refn.handle);
if(ret < 0)
{
@@ -102,7 +105,7 @@ int main(int argc, char **argv)
/*printf("strip size: %i\n",
((PVFS_simple_stripe_params*)dist->params)->strip_size);*/
ret = PVFS_sys_create(entry_name, parent_refn, attr,
- &credentials, dist, NULL, &resp_create);
+ cred, dist, NULL, &resp_create);
if (ret < 0)
{
PVFS_perror("create failed with errcode", ret);
Index: create.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/create.c,v
diff -p -u -r1.43 -r1.43.10.1
--- create.c 6 Jul 2007 05:23:22 -0000 1.43
+++ create.c 25 Jul 2008 19:06:32 -0000 1.43.10.1
@@ -25,7 +25,7 @@ int main(int argc, char **argv)
char* entry_name;
PVFS_object_ref parent_refn;
PVFS_sys_attr attr;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
if (argc != 2)
{
@@ -59,17 +59,18 @@ int main(int argc, char **argv)
}
memset(&resp_create, 0, sizeof(PVFS_sysresp_create));
- PVFS_util_gen_credentials(&credentials);
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
entry_name = str_buf;
attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
- attr.owner = credentials.uid;
- attr.group = credentials.gid;
+ attr.owner = cred->userid;
+ attr.group = cred->group_array[0];
attr.perms = 1877;
attr.atime = attr.ctime = attr.mtime =
time(NULL);
- ret = PINT_lookup_parent(filename, cur_fs, &credentials,
+ ret = PINT_lookup_parent(filename, cur_fs, cred,
&parent_refn.handle);
if(ret < 0)
{
@@ -82,7 +83,7 @@ int main(int argc, char **argv)
str_buf, llu(parent_refn.handle));
ret = PVFS_sys_create(entry_name, parent_refn, attr,
- &credentials, NULL, NULL, &resp_create);
+ cred, NULL, NULL, &resp_create);
if (ret < 0)
{
PVFS_perror("create failed with errcode", ret);
Index: create.set.get.eattr.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/create.set.get.eattr.c,v
diff -p -u -r1.6 -r1.6.10.1
--- create.set.get.eattr.c 6 Jul 2007 05:23:22 -0000 1.6
+++ create.set.get.eattr.c 25 Jul 2008 19:06:32 -0000 1.6.10.1
@@ -8,6 +8,7 @@
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
+#include <assert.h>
#include "client.h"
#include "pvfs2-util.h"
@@ -30,7 +31,7 @@ int main(int argc, char **argv)
char* entry_name;
PVFS_object_ref parent_refn;
PVFS_sys_attr attr;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
PVFS_ds_keyval key, val;
if (argc != 4)
@@ -67,16 +68,17 @@ int main(int argc, char **argv)
}
memset(&resp_create, 0, sizeof(PVFS_sysresp_create));
- PVFS_util_gen_credentials(&credentials);
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
entry_name = str_buf;
attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
- attr.owner = credentials.uid;
- attr.group = credentials.gid;
+ attr.owner = cred->userid;
+ attr.group = cred->group_array[0];
attr.perms = 1877;
attr.atime = attr.ctime = attr.mtime = time(NULL);
- ret = PINT_lookup_parent(filename, cur_fs, &credentials,
+ ret = PINT_lookup_parent(filename, cur_fs, cred,
&parent_refn.handle);
if(ret < 0)
{
@@ -89,7 +91,7 @@ int main(int argc, char **argv)
str_buf, llu(parent_refn.handle));
ret = PVFS_sys_create(entry_name, parent_refn, attr,
- &credentials, NULL, NULL, &resp_create);
+ cred, NULL, NULL, &resp_create);
if (ret < 0)
{
PVFS_perror("create failed with errcode", ret);
@@ -106,7 +108,7 @@ int main(int argc, char **argv)
key.buffer_sz = strlen(key_s) + 1;
val.buffer = val_s;
val.buffer_sz = strlen(val_s) + 1;
- ret = PVFS_sys_seteattr(resp_create.ref, &credentials, &key, &val, 0);
+ ret = PVFS_sys_seteattr(resp_create.ref, cred, &key, &val, 0);
if (ret < 0)
{
PVFS_perror("seteattr failed with errcode", ret);
@@ -120,7 +122,7 @@ int main(int argc, char **argv)
printf("--geteattr--\n");
val.buffer_sz = strlen(val_s) + 10;
val.buffer = malloc(val.buffer_sz);
- ret = PVFS_sys_geteattr(resp_create.ref, &credentials, &key, &val);
+ ret = PVFS_sys_geteattr(resp_create.ref, cred, &key, &val);
if (ret < 0)
{
PVFS_perror("geteattr failed with errcode", ret);
Index: del-eattr.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/del-eattr.c,v
diff -p -u -r1.2 -r1.2.60.1
--- del-eattr.c 21 Jul 2005 16:17:58 -0000 1.2
+++ del-eattr.c 25 Jul 2008 19:06:32 -0000 1.2.60.1
@@ -13,6 +13,7 @@
#include <sys/time.h>
#include <time.h>
#include <stdlib.h>
+#include <assert.h>
#include "pvfs2.h"
#include "str-utils.h"
@@ -86,7 +87,7 @@ int pvfs2_deleattr (PVFS_ds_keyval key,
PVFS_fs_id cur_fs;
PVFS_sysresp_lookup resp_lookup;
PVFS_object_ref parent_ref;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
/* translate local path into pvfs2 relative path */
ret = PVFS_util_resolve(destfile,&cur_fs, pvfs_path, PVFS_NAME_MAX);
if(ret < 0)
@@ -95,7 +96,8 @@ int pvfs2_deleattr (PVFS_ds_keyval key,
return -1;
}
- PVFS_util_gen_credentials(&credentials);
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
/* this if-else statement just pulls apart the pathname into its
* parts....I think...this should be a function somewhere
@@ -104,7 +106,7 @@ int pvfs2_deleattr (PVFS_ds_keyval key,
{
memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
ret = PVFS_sys_lookup(cur_fs, pvfs_path,
- &credentials, &resp_lookup,
+ cred, &resp_lookup,
PVFS2_LOOKUP_LINK_FOLLOW);
if (ret < 0)
{
@@ -128,7 +130,7 @@ int pvfs2_deleattr (PVFS_ds_keyval key,
return -1;
}
- ret = PINT_lookup_parent(pvfs_path, cur_fs, &credentials,
+ ret = PINT_lookup_parent(pvfs_path, cur_fs, cred,
&parent_ref.handle);
if(ret < 0)
{
@@ -143,7 +145,7 @@ int pvfs2_deleattr (PVFS_ds_keyval key,
memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
ret = PVFS_sys_ref_lookup(parent_ref.fs_id, str_buf,
- parent_ref, &credentials, &resp_lookup,
+ parent_ref, cred, &resp_lookup,
PVFS2_LOOKUP_LINK_NO_FOLLOW);
if (ret != 0)
{
@@ -155,7 +157,7 @@ int pvfs2_deleattr (PVFS_ds_keyval key,
/* gossip_set_debug_mask(1,0xffffffffffffffffUL);
* gossip_enable_stderr();
*/
- ret = PVFS_sys_deleattr(resp_lookup.ref, &credentials, &key);
+ ret = PVFS_sys_deleattr(resp_lookup.ref, cred, &key);
if (ret < 0)
{
PVFS_perror("deleattr failed with errcode", ret);
Index: dmkdir.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/dmkdir.c,v
diff -p -u -r1.14 -r1.14.48.1
--- dmkdir.c 11 Nov 2005 21:31:12 -0000 1.14
+++ dmkdir.c 25 Jul 2008 19:06:32 -0000 1.14.48.1
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
+#include <assert.h>
#include "pvfs2-util.h"
#include "str-utils.h"
@@ -28,7 +29,7 @@ int main(int argc,char **argv)
char* entry_name;
PVFS_object_ref parent_refn;
PVFS_sys_attr attr;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
if (argc != 2)
{
@@ -67,10 +68,11 @@ 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);
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
entry_name = str_buf;
- ret = PINT_lookup_parent(dirname, cur_fs, &credentials,
+ ret = PINT_lookup_parent(dirname, cur_fs, cred,
&parent_refn.handle);
if(ret < 0)
{
@@ -80,13 +82,13 @@ int main(int argc,char **argv)
parent_refn.fs_id = cur_fs;
attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
- attr.owner = credentials.uid;
- attr.group = credentials.gid;
+ attr.owner = cred->userid;
+ attr.group = cred->group_array[0];
attr.perms = 0777;
attr.atime = attr.ctime = attr.mtime = time(NULL);
ret = PVFS_sys_mkdir(entry_name, parent_refn, attr,
- &credentials, &resp_mkdir);
+ cred, &resp_mkdir);
if (ret < 0)
{
printf("mkdir failed\n");
@@ -98,7 +100,7 @@ int main(int argc,char **argv)
printf("FSID:%d\n",parent_refn.fs_id);
ret = PVFS_sys_mkdir(str_buf2, resp_mkdir.ref, attr,
- &credentials, &resp_mkdir);
+ cred, &resp_mkdir);
if (ret < 0)
{
printf("mkdir failed\n");
@@ -110,7 +112,7 @@ int main(int argc,char **argv)
printf("FSID:%d\n",parent_refn.fs_id);
ret = PVFS_sys_mkdir(str_buf3, resp_mkdir.ref, attr,
- &credentials, &resp_mkdir);
+ cred, &resp_mkdir);
if (ret < 0)
{
printf("mkdir failed\n");
Index: find.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/find.c,v
diff -p -u -r1.42 -r1.42.36.1
--- find.c 17 May 2006 15:42:58 -0000 1.42
+++ find.c 25 Jul 2008 19:06:32 -0000 1.42.36.1
@@ -10,6 +10,8 @@
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
+#include <assert.h>
+
#include "pvfs2-util.h"
#include "pvfs2-internal.h"
@@ -41,7 +43,7 @@ int is_directory(PVFS_handle handle, PVF
{
PVFS_object_ref pinode_refn;
uint32_t attrmask;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
PVFS_sysresp_getattr getattr_response;
memset(&getattr_response,0,sizeof(PVFS_sysresp_getattr));
@@ -50,9 +52,11 @@ int is_directory(PVFS_handle handle, PVF
pinode_refn.fs_id = fs_id;
attrmask = PVFS_ATTR_SYS_ALL_NOSIZE;
- PVFS_util_gen_credentials(&credentials);
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
+
if (PVFS_sys_getattr(pinode_refn, attrmask,
- &credentials, &getattr_response))
+ cred, &getattr_response))
{
fprintf(stderr,"Failed to get attributes on handle 0x%08llx "
"(fs_id is %d)\n",llu(handle),fs_id);
@@ -72,7 +76,7 @@ int directory_walk(PVFS_fs_id cur_fs,
PVFS_sysresp_readdir rd_response;
char full_path[PVFS_NAME_MAX] = {0};
char* name;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
PVFS_object_ref pinode_refn;
PVFS_ds_position token;
int pvfs_dirent_incount;
@@ -97,8 +101,10 @@ int directory_walk(PVFS_fs_id cur_fs,
}
name = full_path;
- PVFS_util_gen_credentials(&credentials);
- if (PVFS_sys_lookup(cur_fs, name, &credentials,
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
+
+ if (PVFS_sys_lookup(cur_fs, name, cred,
&lk_response, PVFS2_LOOKUP_LINK_FOLLOW))
{
fprintf(stderr,"Failed to lookup %s on fs_id %d!\n",
@@ -119,7 +125,7 @@ int directory_walk(PVFS_fs_id cur_fs,
if (PVFS_sys_readdir(pinode_refn,
(!token ? PVFS_READDIR_START : token),
pvfs_dirent_incount,
- &credentials, &rd_response))
+ cred, &rd_response))
{
fprintf(stderr,"Failed to perform readdir operation\n");
return 1;
Index: flush-1.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/flush-1.c,v
diff -p -u -r1.17 -r1.17.10.1
--- flush-1.c 6 Jul 2007 05:23:22 -0000 1.17
+++ flush-1.c 25 Jul 2008 19:06:32 -0000 1.17.10.1
@@ -26,7 +26,7 @@ int main(int argc, char **argv)
char* entry_name;
PVFS_object_ref parent_refn;
PVFS_sys_attr attr;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
if (argc != 2)
{
@@ -61,16 +61,17 @@ int main(int argc, char **argv)
printf("File to be created is %s\n",str_buf);
memset(&resp_create, 0, sizeof(PVFS_sysresp_create));
- PVFS_util_gen_credentials(&credentials);
+ PVFS_util_gen_fake_credential();
+ assert(cred);
entry_name = str_buf;
attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
- attr.owner = credentials.uid;
- attr.group = credentials.gid;
+ attr.owner = cred->userid;
+ attr.group = cred->group_array[0];
attr.perms = 1877;
attr.atime = attr.ctime = attr.mtime = time(NULL);
- ret = PINT_lookup_parent(filename, cur_fs, &credentials,
+ ret = PINT_lookup_parent(filename, cur_fs, cred,
&parent_refn.handle);
if(ret < 0)
{
@@ -80,7 +81,7 @@ int main(int argc, char **argv)
parent_refn.fs_id = cur_fs;
ret = PVFS_sys_create(entry_name, parent_refn, attr,
- &credentials, NULL, NULL, &resp_create);
+ cred, NULL, NULL, &resp_create);
if (ret < 0)
{
printf("create failed with errcode = %d\n", ret);
@@ -91,7 +92,7 @@ int main(int argc, char **argv)
printf("--create--\n");
printf("Handle: %lld\n",lld(resp_create.ref.handle));
- ret = PVFS_sys_flush(resp_create.ref, &credentials);
+ ret = PVFS_sys_flush(resp_create.ref, cred);
if (ret < 0)
{
PVFS_perror_gossip("flush failed", ret);
Index: flush-2.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/flush-2.c,v
diff -p -u -r1.21 -r1.21.10.1
--- flush-2.c 6 Jul 2007 05:23:22 -0000 1.21
+++ flush-2.c 25 Jul 2008 19:06:32 -0000 1.21.10.1
@@ -12,6 +12,8 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
+#include <assert.h>
+
#include "pvfs2-util.h"
int main(
@@ -30,7 +32,7 @@ int main(
int errors;
PVFS_fs_id fs_id;
char *name;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
char *entry_name;
PVFS_object_ref parent_refn;
PVFS_sys_attr attr;
@@ -97,8 +99,10 @@ int main(
name = filename;
- PVFS_util_gen_credentials(&credentials);
- ret = PVFS_sys_lookup(fs_id, name, &credentials,
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
+
+ ret = PVFS_sys_lookup(fs_id, name, cred,
&resp_lk, PVFS2_LOOKUP_LINK_NO_FOLLOW);
/* TODO: really we probably want to look for a specific error code,
* like maybe ENOENT?
@@ -110,7 +114,7 @@ int main(
/* get root handle */
name = "/";
- ret = PVFS_sys_lookup(fs_id, name, &credentials,
+ ret = PVFS_sys_lookup(fs_id, name, cred,
&resp_lk, PVFS2_LOOKUP_LINK_NO_FOLLOW);
if (ret < 0)
{
@@ -120,8 +124,8 @@ int main(
}
/* create new file */
- attr.owner = credentials.uid;
- attr.group = credentials.gid;
+ attr.owner = cred->userid;
+ attr.group = cred->group_array[0];
attr.perms = PVFS_U_WRITE | PVFS_U_READ;
attr.atime = attr.ctime = attr.mtime = time(NULL);
attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
@@ -130,7 +134,7 @@ int main(
entry_name = &(filename[1]); /* leave off slash */
ret = PVFS_sys_create(entry_name, parent_refn, attr,
- &credentials, NULL, NULL, &resp_cr);
+ cred, NULL, NULL, &resp_cr);
if (ret < 0)
{
fprintf(stderr, "Error: PVFS_sys_create() failure.\n");
@@ -168,7 +172,7 @@ int main(
}
ret = PVFS_sys_write(pinode_refn, file_req, 0, buffer, mem_req,
- &credentials, &resp_io);
+ cred, &resp_io);
if (ret < 0)
{
fprintf(stderr, "Error: PVFS_sys_write() failure.\n");
@@ -185,7 +189,7 @@ int main(
printf("IO-TEST: performing read on handle: %ld, fs: %d\n",
(long) pinode_refn.handle, (int) pinode_refn.fs_id);
ret = PVFS_sys_read(pinode_refn, file_req, 0, buffer, mem_req,
- &credentials, &resp_io);
+ cred, &resp_io);
if (ret < 0)
{
fprintf(stderr, "Error: PVFS_sys_read() failure.\n");
@@ -220,7 +224,7 @@ int main(
}
/* now that we've done some i/o, flush the data to disk */
- ret = PVFS_sys_flush(pinode_refn, &credentials);
+ ret = PVFS_sys_flush(pinode_refn, cred);
if (ret < 0)
{
fprintf(stderr, "Error: PVFS_sys_flush() error.\n");
Index: get-eattr.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/get-eattr.c,v
diff -p -u -r1.2 -r1.2.60.1
--- get-eattr.c 21 Jul 2005 16:17:58 -0000 1.2
+++ get-eattr.c 25 Jul 2008 19:06:32 -0000 1.2.60.1
@@ -13,6 +13,7 @@
#include <sys/time.h>
#include <time.h>
#include <stdlib.h>
+#include <assert.h>
#include "pvfs2.h"
#include "str-utils.h"
@@ -99,7 +100,7 @@ int pvfs2_geteattr(int nkey, PVFS_ds_key
PVFS_sysresp_lookup resp_lookup;
PVFS_sysresp_geteattr resp_geteattr;
PVFS_object_ref parent_ref;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
/* translate local path into pvfs2 relative path */
ret = PVFS_util_resolve(destfile,&cur_fs, pvfs_path, PVFS_NAME_MAX);
if(ret < 0)
@@ -108,7 +109,8 @@ int pvfs2_geteattr(int nkey, PVFS_ds_key
return -1;
}
- PVFS_util_gen_credentials(&credentials);
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
/* this if-else statement just pulls apart the pathname into its
* parts....I think...this should be a function somewhere
@@ -117,7 +119,7 @@ int pvfs2_geteattr(int nkey, PVFS_ds_key
{
memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
ret = PVFS_sys_lookup(cur_fs, pvfs_path,
- &credentials, &resp_lookup,
+ cred, &resp_lookup,
PVFS2_LOOKUP_LINK_FOLLOW);
if (ret < 0)
{
@@ -141,7 +143,7 @@ int pvfs2_geteattr(int nkey, PVFS_ds_key
return -1;
}
- ret = PINT_lookup_parent(pvfs_path, cur_fs, &credentials,
+ ret = PINT_lookup_parent(pvfs_path, cur_fs, cred,
&parent_ref.handle);
if(ret < 0)
{
@@ -156,7 +158,7 @@ int pvfs2_geteattr(int nkey, PVFS_ds_key
memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
ret = PVFS_sys_ref_lookup(parent_ref.fs_id, str_buf,
- parent_ref, &credentials, &resp_lookup,
+ parent_ref, cred, &resp_lookup,
PVFS2_LOOKUP_LINK_NO_FOLLOW);
if (ret != 0)
{
@@ -167,7 +169,7 @@ int pvfs2_geteattr(int nkey, PVFS_ds_key
/* get extended attribute */
resp_geteattr.val_array = val_p;
ret = PVFS_sys_geteattr_list(resp_lookup.ref,
- &credentials, nkey, key_p, &resp_geteattr);
+ cred, nkey, key_p, &resp_geteattr);
if (ret < 0)
{
PVFS_perror("PVFS_sys_geteattr failed with errcode", ret);
Index: getattr-test-threaded.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/getattr-test-threaded.c,v
diff -p -u -r1.1 -r1.1.4.1
--- getattr-test-threaded.c 6 Feb 2008 15:15:57 -0000 1.1
+++ getattr-test-threaded.c 25 Jul 2008 19:06:32 -0000 1.1.4.1
@@ -26,7 +26,7 @@ struct thread_info
{
PVFS_object_ref* pinode_refn;
PVFS_object_ref* pinode_refn2;
- PVFS_credentials* credentials;
+ PVFS_credential *cred;
};
void* thread_fn(void* foo);
@@ -42,7 +42,7 @@ int main(int argc, char **argv)
PVFS_fs_id fs_id;
char name[512] = {0};
char *entry_name = NULL;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
PVFS_object_ref parent_refn;
PVFS_sys_attr attr;
PVFS_object_ref pinode_refn;
@@ -93,23 +93,25 @@ int main(int argc, char **argv)
snprintf(name, 512, "/%s", argv[2]);
}
- PVFS_util_gen_credentials(&credentials);
- ret = PVFS_sys_lookup(fs_id, name, &credentials,
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
+
+ ret = PVFS_sys_lookup(fs_id, name, cred,
&resp_lk, PVFS2_LOOKUP_LINK_FOLLOW);
if (ret == -PVFS_ENOENT)
{
PVFS_sysresp_getparent gp_resp;
memset(&gp_resp, 0, sizeof(PVFS_sysresp_getparent));
- ret = PVFS_sys_getparent(fs_id, name, &credentials, &gp_resp);
+ ret = PVFS_sys_getparent(fs_id, name, cred, &gp_resp);
if (ret < 0)
{
PVFS_perror("PVFS_sys_getparent failed", ret);
return ret;
}
- attr.owner = credentials.uid;
- attr.group = credentials.gid;
+ attr.owner = cred->userid;
+ attr.group = cred->group_array[0];
attr.perms = PVFS_U_WRITE | PVFS_U_READ;
attr.atime = attr.ctime = attr.mtime = time(NULL);
attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
@@ -121,7 +123,7 @@ int main(int argc, char **argv)
assert(entry_name);
ret = PVFS_sys_create(entry_name, parent_refn, attr,
- &credentials, NULL, NULL, &resp_cr);
+ cred, NULL, NULL, &resp_cr);
if (ret < 0)
{
PVFS_perror("PVFS_sys_create() failure", ret);
@@ -147,23 +149,25 @@ int main(int argc, char **argv)
snprintf(name, 512, "/%s", argv[3]);
}
- PVFS_util_gen_credentials(&credentials);
- ret = PVFS_sys_lookup(fs_id, name, &credentials,
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
+
+ ret = PVFS_sys_lookup(fs_id, name, cred,
&resp_lk, PVFS2_LOOKUP_LINK_FOLLOW);
if (ret == -PVFS_ENOENT)
{
PVFS_sysresp_getparent gp_resp;
memset(&gp_resp, 0, sizeof(PVFS_sysresp_getparent));
- ret = PVFS_sys_getparent(fs_id, name, &credentials, &gp_resp);
+ ret = PVFS_sys_getparent(fs_id, name, cred, &gp_resp);
if (ret < 0)
{
PVFS_perror("PVFS_sys_getparent failed", ret);
return ret;
}
- attr.owner = credentials.uid;
- attr.group = credentials.gid;
+ attr.owner = cred->userid;
+ attr.group = cred->group_array[0];
attr.perms = PVFS_U_WRITE | PVFS_U_READ;
attr.atime = attr.ctime = attr.mtime = time(NULL);
attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
@@ -175,7 +179,7 @@ int main(int argc, char **argv)
assert(entry_name);
ret = PVFS_sys_create(entry_name, parent_refn, attr,
- &credentials, NULL, NULL, &resp_cr);
+ cred, NULL, NULL, &resp_cr);
if (ret < 0)
{
PVFS_perror("PVFS_sys_create() failure", ret);
@@ -195,7 +199,7 @@ int main(int argc, char **argv)
/* fill in information for threads */
info.pinode_refn = &pinode_refn;
info.pinode_refn2 = &pinode_refn2;
- info.credentials = &credentials;
+ info.cred = cred;
/* launch threads then wait for them to finish */
for(i=0; i<num_threads; i++)
@@ -248,7 +252,7 @@ void* thread_fn(void* foo)
for(i=0; i<1000; i++)
{
ret = PVFS_sys_getattr(*info->pinode_refn, PVFS_ATTR_SYS_ALL,
- info->credentials, &resp_getattr);
+ info->cred, &resp_getattr);
if (ret < 0)
{
PVFS_perror("PVFS_sys_getattr failure", ret);
@@ -258,7 +262,7 @@ void* thread_fn(void* foo)
return (NULL);
}
ret = PVFS_sys_getattr(*info->pinode_refn2, PVFS_ATTR_SYS_ALL,
- info->credentials, &resp_getattr);
+ info->cred, &resp_getattr);
if (ret < 0)
{
PVFS_perror("PVFS_sys_getattr failure", ret);
Index: getparent.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/getparent.c,v
diff -p -u -r1.18 -r1.18.48.1
--- getparent.c 11 Nov 2005 21:31:12 -0000 1.18
+++ getparent.c 25 Jul 2008 19:06:32 -0000 1.18.48.1
@@ -9,6 +9,7 @@
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
+#include <assert.h>
#include "client.h"
#include "pvfs2-util.h"
@@ -19,7 +20,7 @@ int main(int argc,char **argv)
PVFS_sysresp_getparent resp_getparent;
int ret = -1;
PVFS_fs_id fs_id;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
if (argc != 2)
{
@@ -42,8 +43,10 @@ int main(int argc,char **argv)
return (-1);
}
- PVFS_util_gen_credentials(&credentials);
- ret = PVFS_sys_getparent(fs_id, argv[1], &credentials, &resp_getparent);
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
+
+ ret = PVFS_sys_getparent(fs_id, argv[1], cred, &resp_getparent);
if (ret == 0)
{
printf("=== getparent data:\n");
Index: io-bug.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/io-bug.c,v
diff -p -u -r1.8 -r1.8.10.1
--- io-bug.c 6 Jul 2007 05:23:22 -0000 1.8
+++ io-bug.c 25 Jul 2008 19:06:32 -0000 1.8.10.1
@@ -11,6 +11,8 @@
#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
+#include <assert.h>
+
#include "pvfs2-util.h"
#include "pvfs2-mgmt.h"
@@ -31,7 +33,7 @@ int main(
int i;
PVFS_fs_id fs_id;
char *name;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
char *entry_name;
PVFS_object_ref parent_refn;
PVFS_sys_attr attr;
@@ -102,8 +104,10 @@ int main(
name = filename;
- PVFS_util_gen_credentials(&credentials);
- ret = PVFS_sys_lookup(fs_id, name, &credentials,
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
+
+ ret = PVFS_sys_lookup(fs_id, name, cred,
&resp_lk, PVFS2_LOOKUP_LINK_FOLLOW);
/* TODO: really we probably want to look for a specific error code,
* like maybe ENOENT?
@@ -114,7 +118,7 @@ int main(
/* get root handle */
name = "/";
- ret = PVFS_sys_lookup(fs_id, name, &credentials,
+ ret = PVFS_sys_lookup(fs_id, name, cred,
&resp_lk, PVFS2_LOOKUP_LINK_NO_FOLLOW);
if (ret < 0)
{
@@ -124,8 +128,8 @@ int main(
}
/* create new file */
- attr.owner = credentials.uid;
- attr.group = credentials.gid;
+ attr.owner = cred->userid;
+ attr.group = cred->group_array[0];
attr.perms = PVFS_U_WRITE | PVFS_U_READ;
attr.atime = attr.ctime = attr.mtime = time(NULL);
attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
@@ -136,7 +140,7 @@ int main(
entry_name = &(filename[1]); /* leave off slash */
ret = PVFS_sys_create(entry_name, parent_refn, attr,
- &credentials, NULL, NULL, &resp_cr);
+ cred, NULL, NULL, &resp_cr);
if (ret < 0)
{
fprintf(stderr, "Error: PVFS_sys_create() failure.\n");
@@ -182,7 +186,7 @@ int main(
off_array2, PVFS_BYTE, &file_req);
ret = PVFS_sys_write(pinode_refn, file_req, 0, PVFS_BOTTOM, mem_req,
- &credentials, &resp_io);
+ cred, &resp_io);
if (ret < 0)
{
fprintf(stderr, "Error: PVFS_sys_write() failure.\n");
Index: io-hole.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/io-hole.c,v
diff -p -u -r1.4 -r1.4.10.1
--- io-hole.c 6 Jul 2007 05:23:22 -0000 1.4
+++ io-hole.c 25 Jul 2008 19:06:32 -0000 1.4.10.1
@@ -12,6 +12,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
+
#include "pvfs2-util.h"
#include "pvfs2-mgmt.h"
#include "pvfs2-internal.h"
@@ -27,7 +28,7 @@ int main(int argc, char **argv)
PVFS_sysresp_lookup resp_lk;
PVFS_sysresp_create resp_cr;
PVFS_sysresp_io resp_io;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
PVFS_object_ref parent_refn;
PVFS_sys_attr attr;
PVFS_object_ref pinode_refn;
@@ -63,8 +64,10 @@ int main(int argc, char **argv)
snprintf(name, 512, "/%s", argv[1]);
}
- PVFS_util_gen_credentials(&credentials);
- ret = PVFS_sys_lookup(fs_id, name, &credentials,
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
+
+ ret = PVFS_sys_lookup(fs_id, name, cred,
&resp_lk, PVFS2_LOOKUP_LINK_FOLLOW);
if (ret == -PVFS_ENOENT)
{
@@ -73,15 +76,15 @@ int main(int argc, char **argv)
printf("IO-HOLE: lookup failed; creating new file.\n");
memset(&gp_resp, 0, sizeof(PVFS_sysresp_getparent));
- ret = PVFS_sys_getparent(fs_id, name, &credentials, &gp_resp);
+ ret = PVFS_sys_getparent(fs_id, name, cred, &gp_resp);
if (ret < 0)
{
PVFS_perror("PVFS_sys_getparent failed", ret);
return ret;
}
- attr.owner = credentials.uid;
- attr.group = credentials.gid;
+ attr.owner = cred->userid;
+ attr.group = cred->group_array[0];
attr.perms = PVFS_U_WRITE | PVFS_U_READ;
attr.atime = attr.ctime = attr.mtime = time(NULL);
attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
@@ -93,7 +96,7 @@ int main(int argc, char **argv)
assert(entry_name);
ret = PVFS_sys_create(entry_name, parent_refn, attr,
- &credentials, NULL, NULL, &resp_cr);
+ cred, NULL, NULL, &resp_cr);
if (ret < 0)
{
PVFS_perror("PVFS_sys_create() failure", ret);
@@ -124,7 +127,7 @@ int main(int argc, char **argv)
memset(buf, 'A', MAX_BUF_LEN);
ret = PVFS_sys_write(pinode_refn, file_req, 0, buf, mem_req,
- &credentials, &resp_io);
+ cred, &resp_io);
if ((ret < 0) || (resp_io.total_completed != MAX_BUF_LEN))
{
PVFS_perror("PVFS_sys_write failure", ret);
@@ -134,7 +137,7 @@ int main(int argc, char **argv)
lld(resp_io.total_completed));
ret = PVFS_sys_write(pinode_refn, file_req, 100000, buf, mem_req,
- &credentials, &resp_io);
+ cred, &resp_io);
if ((ret < 0) || (resp_io.total_completed != MAX_BUF_LEN))
{
PVFS_perror("PVFS_sys_write failure", ret);
@@ -144,7 +147,7 @@ int main(int argc, char **argv)
lld(resp_io.total_completed));
ret = PVFS_sys_read(pinode_refn, file_req, 10, buf, mem_req,
- &credentials, &resp_io);
+ cred, &resp_io);
if ((ret < 0) || (resp_io.total_completed != MAX_BUF_LEN))
{
fprintf(stderr, "Failed to read %d bytes at offset 10! %lld "
Index: io-stress.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/io-stress.c,v
diff -p -u -r1.3 -r1.3.10.1
--- io-stress.c 7 Dec 2006 21:47:22 -0000 1.3
+++ io-stress.c 25 Jul 2008 19:06:32 -0000 1.3.10.1
@@ -19,12 +19,14 @@
#include <getopt.h>
#include <pthread.h>
#include <aio.h>
+#include <assert.h>
#define __PINT_REQPROTO_ENCODE_FUNCS_C
#include "pvfs2.h"
#include "str-utils.h"
#include "pint-sysint-utils.h"
#include "pint-util.h"
+#include "pvfs2-util.h"
#include "pvfs2-internal.h"
#include "quicklist.h"
#include "quickhash.h"
@@ -68,7 +70,7 @@ typedef struct file_object_s {
static struct options* parse_args(int argc, char* argv[]);
static void usage(int argc, char** argv);
static int resolve_filename(file_object *obj, char *filename);
-static int generic_open(file_object *obj, PVFS_credentials *credentials);
+static int generic_open(file_object *obj, PVFS_credential *cred);
static file_object src;
static char buf[2097152];
@@ -84,7 +86,7 @@ typedef struct {
char *buffer;
int64_t offset;
int64_t count;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
struct aiocb acb;
struct qlist_head hash_link;
} io_request;
@@ -197,7 +199,9 @@ static void post_op(io_request *req)
req->src = &src;
req->buffer = buf;
req->count = 2097152;
- PVFS_util_gen_credentials(&req->credentials);
+ req->cred = PVFS_util_gen_fake_credential();
+ assert(req->cred);
+
if (rd_wr == 0)
post_generic_read(req);
else
@@ -337,7 +341,7 @@ int main(int argc, char ** argv)
{
struct options* user_opts = NULL;
int64_t ret;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
initialize_ops_in_progress_table();
user_opts = parse_args(argc, argv);
@@ -357,9 +361,10 @@ int main(int argc, char ** argv)
resolve_filename(&src, user_opts->srcfile);
- PVFS_util_gen_credentials(&credentials);
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
- ret = generic_open(&src, &credentials);
+ ret = generic_open(&src, cred);
if (ret < 0)
{
fprintf(stderr, "Could not open %s\n", user_opts->srcfile);
@@ -452,7 +457,7 @@ static int resolve_filename(file_object
/* generic_open:
* given a file_object, perform the apropriate open calls.
*/
-static int generic_open(file_object *obj, PVFS_credentials *credentials)
+static int generic_open(file_object *obj, PVFS_credential *cred)
{
struct stat stat_buf;
PVFS_sysresp_lookup resp_lookup;
@@ -493,7 +498,7 @@ static int generic_open(file_object *obj
memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
ret = PVFS_sys_lookup(obj->u.pvfs2.fs_id,
(char *) obj->u.pvfs2.pvfs2_path,
- credentials,
+ cred,
&resp_lookup,
PVFS2_LOOKUP_LINK_FOLLOW);
if (ret < 0)
@@ -506,7 +511,7 @@ static int generic_open(file_object *obj
memset(&resp_getattr, 0, sizeof(PVFS_sysresp_getattr));
ret = PVFS_sys_getattr(ref, PVFS_ATTR_SYS_ALL,
- credentials, &resp_getattr);
+ cred, &resp_getattr);
if (ret)
{
fprintf(stderr, "Failed to do pvfs2 getattr on %s\n",
@@ -554,7 +559,7 @@ static PVFS_error post_generic_read(io_r
return (ret);
}
ret = PVFS_isys_io(req->src->u.pvfs2.ref, req->file_req, req->offset,
- req->buffer, req->mem_req, &req->credentials, &req->resp_io,
+ req->buffer, req->mem_req, req->cred, &req->resp_io,
PVFS_IO_READ, &req->op_id, req);
if (ret != 0)
{
@@ -592,7 +597,7 @@ static PVFS_error post_generic_write(io_
return (ret);
}
ret = PVFS_isys_io(req->src->u.pvfs2.ref, req->file_req, req->offset,
- req->buffer, req->mem_req, &req->credentials, &req->resp_io,
+ req->buffer, req->mem_req, req->cred, &req->resp_io,
PVFS_IO_WRITE, &req->op_id, req);
if (ret != 0)
{
Index: io-test-offset.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/io-test-offset.c,v
diff -p -u -r1.26 -r1.26.10.1
--- io-test-offset.c 6 Jul 2007 05:23:22 -0000 1.26
+++ io-test-offset.c 25 Jul 2008 19:06:32 -0000 1.26.10.1
@@ -14,6 +14,7 @@
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
+#include <assert.h>
#include "pvfs2-util.h"
@@ -33,7 +34,7 @@ int main(
int errors;
PVFS_fs_id fs_id;
char *name;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
char *entry_name;
PVFS_object_ref parent_refn;
PVFS_sys_attr attr;
@@ -102,8 +103,10 @@ int main(
name = filename;
- PVFS_util_gen_credentials(&credentials);
- ret = PVFS_sys_lookup(fs_id, name, &credentials,
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
+
+ ret = PVFS_sys_lookup(fs_id, name, cred,
&resp_lk, PVFS2_LOOKUP_LINK_NO_FOLLOW);
/* TODO: really we probably want to look for a specific error code,
* like maybe ENOENT?
@@ -115,7 +118,7 @@ int main(
/* get root handle */
name = "/";
- ret = PVFS_sys_lookup(fs_id, name, &credentials,
+ ret = PVFS_sys_lookup(fs_id, name, cred,
&resp_lk, PVFS2_LOOKUP_LINK_NO_FOLLOW);
if (ret < 0)
{
@@ -126,8 +129,8 @@ int main(
/* create new file */
- attr.owner = credentials.uid;
- attr.group = credentials.gid;
+ attr.owner = cred->userid;
+ attr.group = cred->group_array[0];
attr.perms = PVFS_U_WRITE | PVFS_U_READ;
attr.atime = attr.ctime = attr.mtime = time(NULL);
attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
@@ -136,7 +139,7 @@ int main(
entry_name = &(filename[1]); /* leave off slash */
ret = PVFS_sys_create(entry_name, parent_refn, attr,
- &credentials, NULL, NULL, &resp_cr);
+ cred, NULL, NULL, &resp_cr);
if (ret < 0)
{
fprintf(stderr, "Error: PVFS_sys_create() failure.\n");
@@ -182,7 +185,7 @@ int main(
}
ret = PVFS_sys_write(pinode_refn, file_req, 0, buffer, mem_req,
- &credentials, &resp_io);
+ cred, &resp_io);
if (ret < 0)
{
fprintf(stderr, "Error: PVFS_sys_write() failure.\n");
@@ -206,7 +209,7 @@ int main(
printf("IO-TEST: performing read on handle: %ld, fs: %d\n",
(long) pinode_refn.handle, (int) pinode_refn.fs_id);
ret = PVFS_sys_read(pinode_refn, file_req, (5 * sizeof(int)), off_buffer,
- mem_req2, &credentials, &resp_io);
+ mem_req2, cred, &resp_io);
if (ret < 0)
{
fprintf(stderr, "Error: PVFS_sys_read() failure.\n");
Index: io-test-threaded.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/io-test-threaded.c,v
diff -p -u -r1.3 -r1.3.8.1
--- io-test-threaded.c 15 Jan 2008 17:16:36 -0000 1.3
+++ io-test-threaded.c 25 Jul 2008 19:06:32 -0000 1.3.8.1
@@ -30,7 +30,7 @@ struct thread_info
PVFS_object_ref* pinode_refn;
PVFS_Request* file_req;
PVFS_Request* mem_req;
- PVFS_credentials* credentials;
+ PVFS_credential *cred;
};
void* thread_fn(void* foo);
@@ -49,7 +49,7 @@ int main(int argc, char **argv)
PVFS_fs_id fs_id;
char name[512] = {0};
char *entry_name = NULL;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
PVFS_object_ref parent_refn;
PVFS_sys_attr attr;
PVFS_object_ref pinode_refn;
@@ -114,23 +114,25 @@ int main(int argc, char **argv)
snprintf(name, 512, "/%s", argv[2]);
}
- PVFS_util_gen_credentials(&credentials);
- ret = PVFS_sys_lookup(fs_id, name, &credentials,
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
+
+ ret = PVFS_sys_lookup(fs_id, name, cred,
&resp_lk, PVFS2_LOOKUP_LINK_FOLLOW);
if (ret == -PVFS_ENOENT)
{
PVFS_sysresp_getparent gp_resp;
memset(&gp_resp, 0, sizeof(PVFS_sysresp_getparent));
- ret = PVFS_sys_getparent(fs_id, name, &credentials, &gp_resp);
+ ret = PVFS_sys_getparent(fs_id, name, cred, &gp_resp);
if (ret < 0)
{
PVFS_perror("PVFS_sys_getparent failed", ret);
return ret;
}
- attr.owner = credentials.uid;
- attr.group = credentials.gid;
+ attr.owner = cred->userid;
+ attr.group = cred->group_array[0];
attr.perms = PVFS_U_WRITE | PVFS_U_READ;
attr.atime = attr.ctime = attr.mtime = time(NULL);
attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
@@ -142,7 +144,7 @@ int main(int argc, char **argv)
assert(entry_name);
ret = PVFS_sys_create(entry_name, parent_refn, attr,
- &credentials, NULL, NULL, &resp_cr);
+ cred, NULL, NULL, &resp_cr);
if (ret < 0)
{
PVFS_perror("PVFS_sys_create() failure", ret);
@@ -180,7 +182,7 @@ int main(int argc, char **argv)
}
ret = PVFS_sys_write(pinode_refn, file_req, 0, buffer, mem_req,
- &credentials, &resp_io);
+ cred, &resp_io);
if (ret < 0)
{
PVFS_perror("PVFS_sys_write failure", ret);
@@ -191,7 +193,7 @@ int main(int argc, char **argv)
info.pinode_refn = &pinode_refn;
info.file_req = &file_req;
info.mem_req = &mem_req;
- info.credentials = &credentials;
+ info.cred = cred;
/* launch threads then wait for them to finish */
for(i=0; i<num_threads; i++)
@@ -262,7 +264,7 @@ void* thread_fn(void* foo)
/* verify */
ret = PVFS_sys_read(*info->pinode_refn, *info->file_req, 0, io_buffer, *info->mem_req,
- info->credentials, &resp_io);
+ info->cred, &resp_io);
if (ret < 0)
{
PVFS_perror("PVFS_sys_read failure", ret);
Index: io-test.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/io-test.c,v
diff -p -u -r1.57 -r1.57.10.1
--- io-test.c 6 Jul 2007 05:23:22 -0000 1.57
+++ io-test.c 25 Jul 2008 19:06:32 -0000 1.57.10.1
@@ -30,7 +30,7 @@ int main(int argc, char **argv)
PVFS_fs_id fs_id;
char name[512] = {0};
char *entry_name = NULL;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
PVFS_object_ref parent_refn;
PVFS_sys_attr attr;
PVFS_object_ref pinode_refn;
@@ -81,8 +81,10 @@ int main(int argc, char **argv)
snprintf(name, 512, "/%s", argv[1]);
}
- PVFS_util_gen_credentials(&credentials);
- ret = PVFS_sys_lookup(fs_id, name, &credentials,
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
+
+ ret = PVFS_sys_lookup(fs_id, name, cred,
&resp_lk, PVFS2_LOOKUP_LINK_FOLLOW);
if (ret == -PVFS_ENOENT)
{
@@ -91,15 +93,15 @@ int main(int argc, char **argv)
printf("IO-TEST: lookup failed; creating new file.\n");
memset(&gp_resp, 0, sizeof(PVFS_sysresp_getparent));
- ret = PVFS_sys_getparent(fs_id, name, &credentials, &gp_resp);
+ ret = PVFS_sys_getparent(fs_id, name, cred, &gp_resp);
if (ret < 0)
{
PVFS_perror("PVFS_sys_getparent failed", ret);
return ret;
}
- attr.owner = credentials.uid;
- attr.group = credentials.gid;
+ attr.owner = cred->userid;
+ attr.group = cred->group_array[0];
attr.perms = PVFS_U_WRITE | PVFS_U_READ;
attr.atime = attr.ctime = attr.mtime = time(NULL);
attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
@@ -111,7 +113,7 @@ int main(int argc, char **argv)
assert(entry_name);
ret = PVFS_sys_create(entry_name, parent_refn, attr,
- &credentials, NULL, NULL, &resp_cr);
+ cred, NULL, NULL, &resp_cr);
if (ret < 0)
{
PVFS_perror("PVFS_sys_create() failure", ret);
@@ -155,7 +157,7 @@ int main(int argc, char **argv)
}
ret = PVFS_sys_write(pinode_refn, file_req, 0, buffer, mem_req,
- &credentials, &resp_io);
+ cred, &resp_io);
if (ret < 0)
{
PVFS_perror("PVFS_sys_write failure", ret);
@@ -173,7 +175,7 @@ int main(int argc, char **argv)
(long) pinode_refn.handle, (int) pinode_refn.fs_id);
ret = PVFS_sys_read(pinode_refn, file_req, 0, buffer, mem_req,
- &credentials, &resp_io);
+ cred, &resp_io);
if (ret < 0)
{
PVFS_perror("PVFS_sys_read failure", ret);
@@ -209,7 +211,7 @@ int main(int argc, char **argv)
/* test out some of the mgmt functionality */
ret = PVFS_sys_getattr(pinode_refn, PVFS_ATTR_SYS_ALL_NOSIZE,
- &credentials, &resp_getattr);
+ cred, &resp_getattr);
if (ret < 0)
{
PVFS_perror("PVFS_sys_getattr", ret);
@@ -226,7 +228,7 @@ int main(int argc, char **argv)
return (-1);
}
- ret = PVFS_mgmt_get_dfile_array(pinode_refn, &credentials,
+ ret = PVFS_mgmt_get_dfile_array(pinode_refn, cred,
dfile_array, resp_getattr.attr.dfile_count);
if (ret < 0)
{
Index: list-eattr.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/list-eattr.c,v
diff -p -u -r1.1 -r1.1.56.1
--- list-eattr.c 27 Oct 2005 18:43:12 -0000 1.1
+++ list-eattr.c 25 Jul 2008 19:06:32 -0000 1.1.56.1
@@ -13,6 +13,7 @@
#include <sys/time.h>
#include <time.h>
#include <stdlib.h>
+#include <assert.h>
#include "pvfs2.h"
#include "str-utils.h"
@@ -101,7 +102,7 @@ int pvfs2_listeattr(int nkey, PVFS_ds_ke
PVFS_sysresp_lookup resp_lookup;
PVFS_sysresp_listeattr resp_listeattr;
PVFS_object_ref parent_ref;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
PVFS_ds_position token = PVFS_ITERATE_START;
/* translate local path into pvfs2 relative path */
@@ -112,7 +113,8 @@ int pvfs2_listeattr(int nkey, PVFS_ds_ke
return -1;
}
- PVFS_util_gen_credentials(&credentials);
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
/* this if-else statement just pulls apart the pathname into its
* parts....I think...this should be a function somewhere
@@ -121,7 +123,7 @@ int pvfs2_listeattr(int nkey, PVFS_ds_ke
{
memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
ret = PVFS_sys_lookup(cur_fs, pvfs_path,
- &credentials, &resp_lookup,
+ cred, &resp_lookup,
PVFS2_LOOKUP_LINK_FOLLOW);
if (ret < 0)
{
@@ -145,7 +147,7 @@ int pvfs2_listeattr(int nkey, PVFS_ds_ke
return -1;
}
- ret = PINT_lookup_parent(pvfs_path, cur_fs, &credentials,
+ ret = PINT_lookup_parent(pvfs_path, cur_fs, cred,
&parent_ref.handle);
if(ret < 0)
{
@@ -160,7 +162,7 @@ int pvfs2_listeattr(int nkey, PVFS_ds_ke
memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
ret = PVFS_sys_ref_lookup(parent_ref.fs_id, str_buf,
- parent_ref, &credentials, &resp_lookup,
+ parent_ref, cred, &resp_lookup,
PVFS2_LOOKUP_LINK_NO_FOLLOW);
if (ret != 0)
{
@@ -171,7 +173,7 @@ int pvfs2_listeattr(int nkey, PVFS_ds_ke
/* list extended attribute */
resp_listeattr.key_array = key_p;
ret = PVFS_sys_listeattr(resp_lookup.ref,
- token, nkey, &credentials, &resp_listeattr);
+ token, nkey, cred, &resp_listeattr);
if (ret < 0)
{
PVFS_perror("PVFS_sys_listeattr failed with errcode", ret);
Index: ls.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/ls.c,v
diff -p -u -r1.34 -r1.34.36.1
--- ls.c 17 May 2006 15:42:58 -0000 1.34
+++ ls.c 25 Jul 2008 19:06:32 -0000 1.34.36.1
@@ -101,18 +101,19 @@ void print_entry(
PVFS_fs_id fs_id)
{
PVFS_object_ref pinode_refn;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
PVFS_sysresp_getattr getattr_response;
memset(&getattr_response,0, sizeof(PVFS_sysresp_getattr));
- PVFS_util_gen_credentials(&credentials);
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
pinode_refn.handle = handle;
pinode_refn.fs_id = fs_id;
if (PVFS_sys_getattr(pinode_refn, PVFS_ATTR_SYS_ALL,
- &credentials, &getattr_response))
+ cred, &getattr_response))
{
fprintf(stderr,"Failed to get attributes on handle 0x%08llx "
"(fs_id is %d)\n",llu(handle),fs_id);
@@ -132,7 +133,7 @@ int do_list(
PVFS_sysresp_lookup lk_response;
PVFS_sysresp_readdir rd_response;
PVFS_sysresp_getattr getattr_response;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
PVFS_object_ref pinode_refn;
PVFS_ds_position token;
@@ -141,9 +142,10 @@ int do_list(
name = start_dir;
- PVFS_util_gen_credentials(&credentials);
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
- if (PVFS_sys_lookup(fs_id, name, &credentials,
+ if (PVFS_sys_lookup(fs_id, name, cred,
&lk_response, PVFS2_LOOKUP_LINK_NO_FOLLOW))
{
fprintf(stderr,"Failed to lookup %s on fs_id %d!\n",
@@ -154,10 +156,9 @@ int do_list(
pinode_refn.handle = lk_response.ref.handle;
pinode_refn.fs_id = fs_id;
pvfs_dirent_incount = MAX_NUM_DIRENTS;
- PVFS_util_gen_credentials(&credentials);
if (PVFS_sys_getattr(pinode_refn, PVFS_ATTR_SYS_ALL,
- &credentials, &getattr_response) == 0)
+ cred, &getattr_response) == 0)
{
if ((getattr_response.attr.objtype == PVFS_TYPE_METAFILE) ||
(getattr_response.attr.objtype == PVFS_TYPE_SYMLINK))
@@ -175,7 +176,7 @@ int do_list(
memset(&rd_response,0,sizeof(PVFS_sysresp_readdir));
if (PVFS_sys_readdir(pinode_refn,
(!token ? PVFS_READDIR_START : token),
- pvfs_dirent_incount, &credentials, &rd_response))
+ pvfs_dirent_incount, cred, &rd_response))
{
fprintf(stderr,"readdir failed\n");
return -1;
Index: readdir.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/readdir.c,v
diff -p -u -r1.37 -r1.37.48.1
--- readdir.c 11 Nov 2005 21:31:12 -0000 1.37
+++ readdir.c 25 Jul 2008 19:06:32 -0000 1.37.48.1
@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
+#include <assert.h>
#include "pvfs2-util.h"
#include "pvfs2-internal.h"
@@ -23,7 +24,7 @@ int main(int argc,char **argv)
char starting_point[256] = "/";
PVFS_fs_id fs_id;
char* name;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
PVFS_object_ref pinode_refn;
PVFS_ds_position token;
int pvfs_dirent_incount;
@@ -54,8 +55,10 @@ int main(int argc,char **argv)
name = starting_point;
- PVFS_util_gen_credentials(&credentials);
- ret = PVFS_sys_lookup(fs_id, name, &credentials,
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
+
+ ret = PVFS_sys_lookup(fs_id, name, cred,
&resp_look, PVFS2_LOOKUP_LINK_FOLLOW);
if (ret < 0)
{
@@ -77,7 +80,7 @@ int main(int argc,char **argv)
memset(&resp_readdir,0,sizeof(PVFS_sysresp_readdir));
ret = PVFS_sys_readdir(pinode_refn, (!token ? PVFS_READDIR_START :
token), pvfs_dirent_incount,
- &credentials, &resp_readdir);
+ cred, &resp_readdir);
if (ret < 0)
{
PVFS_perror_gossip("readdir failed", ret);
Index: remove.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/remove.c,v
diff -p -u -r1.26 -r1.26.68.1
--- remove.c 14 Jun 2004 21:48:44 -0000 1.26
+++ remove.c 25 Jul 2008 19:06:33 -0000 1.26.68.1
@@ -7,6 +7,7 @@
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
+#include <assert.h>
#include "client.h"
#include "pvfs2-util.h"
@@ -21,7 +22,7 @@ int main(int argc,char **argv)
PVFS_fs_id cur_fs;
char* entry_name;
PVFS_object_ref parent_refn;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
if (argc != 2)
{
@@ -57,8 +58,9 @@ int main(int argc,char **argv)
entry_name = str_buf;
- PVFS_util_gen_credentials(&credentials);
- ret = PINT_lookup_parent(filename, cur_fs, &credentials,
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
+ ret = PINT_lookup_parent(filename, cur_fs, cred,
&parent_refn.handle);
if(ret < 0)
{
@@ -67,7 +69,7 @@ int main(int argc,char **argv)
}
parent_refn.fs_id = cur_fs;
- ret = PVFS_sys_remove(entry_name, parent_refn, &credentials);
+ ret = PVFS_sys_remove(entry_name, parent_refn, cred);
if (ret < 0)
{
PVFS_perror("remove failed ", ret);
Index: rename.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/rename.c,v
diff -p -u -r1.24 -r1.24.68.1
--- rename.c 14 Jun 2004 21:48:44 -0000 1.24
+++ rename.c 25 Jul 2008 19:06:33 -0000 1.24.68.1
@@ -7,6 +7,8 @@
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
+#include <assert.h>
+
#include "client.h"
#include "pvfs2-types.h"
#include "pvfs2-util.h"
@@ -25,7 +27,7 @@ int main(int argc,char **argv)
PVFS_object_ref old_parent_refn;
char* new_entry;
PVFS_object_ref new_parent_refn;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
if (argc != 3)
{
@@ -72,10 +74,11 @@ int main(int argc,char **argv)
}
printf("New filename is %s\n",new_buf);
- PVFS_util_gen_credentials(&credentials);
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
old_entry = old_buf;
- ret = PINT_lookup_parent(old_filename, cur_fs, &credentials,
+ ret = PINT_lookup_parent(old_filename, cur_fs, cred,
&old_parent_refn.handle);
if(ret < 0)
{
@@ -84,7 +87,7 @@ int main(int argc,char **argv)
}
old_parent_refn.fs_id = cur_fs;
new_entry = new_buf;
- ret = PINT_lookup_parent(new_filename, cur_fs, &credentials,
+ ret = PINT_lookup_parent(new_filename, cur_fs, cred,
&new_parent_refn.handle);
if(ret < 0)
{
@@ -94,7 +97,7 @@ int main(int argc,char **argv)
new_parent_refn.fs_id = cur_fs;
ret = PVFS_sys_rename(old_entry, old_parent_refn, new_entry,
- new_parent_refn, &credentials);
+ new_parent_refn, cred);
if (ret < 0)
{
printf("rename failed with errcode = %d\n",ret);
Index: set-eattr.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/set-eattr.c,v
diff -p -u -r1.3 -r1.3.60.1
--- set-eattr.c 1 Aug 2005 22:49:52 -0000 1.3
+++ set-eattr.c 25 Jul 2008 19:06:33 -0000 1.3.60.1
@@ -13,6 +13,7 @@
#include <sys/time.h>
#include <time.h>
#include <stdlib.h>
+#include <assert.h>
#include "pvfs2.h"
#include "str-utils.h"
@@ -91,7 +92,7 @@ int pvfs2_seteattr (int nkey, PVFS_ds_ke
PVFS_fs_id cur_fs;
PVFS_sysresp_lookup resp_lookup;
PVFS_object_ref parent_ref;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
/* translate local path into pvfs2 relative path */
ret = PVFS_util_resolve(destfile,&cur_fs, pvfs_path, PVFS_NAME_MAX);
if(ret < 0)
@@ -100,7 +101,8 @@ int pvfs2_seteattr (int nkey, PVFS_ds_ke
return -1;
}
- PVFS_util_gen_credentials(&credentials);
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
/* this if-else statement just pulls apart the pathname into its
* parts....I think...this should be a function somewhere
@@ -109,7 +111,7 @@ int pvfs2_seteattr (int nkey, PVFS_ds_ke
{
memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
ret = PVFS_sys_lookup(cur_fs, pvfs_path,
- &credentials, &resp_lookup,
+ cred, &resp_lookup,
PVFS2_LOOKUP_LINK_FOLLOW);
if (ret < 0)
{
@@ -133,7 +135,7 @@ int pvfs2_seteattr (int nkey, PVFS_ds_ke
return -1;
}
- ret = PINT_lookup_parent(pvfs_path, cur_fs, &credentials,
+ ret = PINT_lookup_parent(pvfs_path, cur_fs, cred,
&parent_ref.handle);
if(ret < 0)
{
@@ -148,7 +150,7 @@ int pvfs2_seteattr (int nkey, PVFS_ds_ke
memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
ret = PVFS_sys_ref_lookup(parent_ref.fs_id, str_buf,
- parent_ref, &credentials, &resp_lookup,
+ parent_ref, cred, &resp_lookup,
PVFS2_LOOKUP_LINK_NO_FOLLOW);
if (ret != 0)
{
@@ -165,7 +167,7 @@ int pvfs2_seteattr (int nkey, PVFS_ds_ke
(char *)val[k].buffer);
}
}
- ret = PVFS_sys_seteattr_list(resp_lookup.ref, &credentials, nkey, key, val, 0);
+ ret = PVFS_sys_seteattr_list(resp_lookup.ref, cred, nkey, key, val, 0);
if (ret < 0)
{
PVFS_perror("seteattr_list failed with errcode", ret);
Index: symlink.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/symlink.c,v
diff -p -u -r1.16 -r1.16.48.1
--- symlink.c 11 Nov 2005 21:31:12 -0000 1.16
+++ symlink.c 25 Jul 2008 19:06:33 -0000 1.16.48.1
@@ -8,6 +8,7 @@
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
+#include <assert.h>
#include "client.h"
#include "pvfs2-util.h"
@@ -26,7 +27,7 @@ int main(int argc, char **argv)
char *target = NULL;
PVFS_object_ref parent_refn;
PVFS_sys_attr attr;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
if (argc != 3)
{
@@ -62,16 +63,17 @@ 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);
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
entry_name = str_buf;
attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
- attr.owner = credentials.uid;
- attr.group = credentials.gid;
+ attr.owner = cred->userid;
+ attr.group = cred->group_array[0];
attr.perms = 1877;
attr.atime = attr.ctime = attr.mtime = time(NULL);
- ret = PINT_lookup_parent(filename, cur_fs, &credentials,
+ ret = PINT_lookup_parent(filename, cur_fs, cred,
&parent_refn.handle);
if(ret < 0)
{
@@ -81,7 +83,7 @@ int main(int argc, char **argv)
parent_refn.fs_id = cur_fs;
ret = PVFS_sys_symlink(entry_name, parent_refn, target,
- attr, &credentials, &resp_sym);
+ attr, cred, &resp_sym);
if (ret < 0)
{
printf("symlink failed with errcode = %d\n", ret);
Index: test-accesses.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/test-accesses.c,v
diff -p -u -r1.5 -r1.5.10.1
--- test-accesses.c 6 Jul 2007 05:23:22 -0000 1.5
+++ test-accesses.c 25 Jul 2008 19:06:33 -0000 1.5.10.1
@@ -4,8 +4,10 @@
#include <errno.h>
#include <assert.h>
#include <time.h>
+
#include "pvfs2.h"
#include "pvfs2-sysint.h"
+#include "pvfs2-util.h"
#if PVFS2_SIZEOF_VOIDP == 32
# define llu(x) (x)
@@ -30,7 +32,7 @@ int main(int argc, char * argv[])
char line[255];
int size;
PVFS_offset offset=0;
- PVFS_credentials creds;
+ PVFS_credential *cred;
PVFS_sysresp_create create_resp;
PVFS_sysresp_io io_resp;
PVFS_sysresp_lookup lookup_resp;
@@ -65,26 +67,27 @@ int main(int argc, char * argv[])
exit(1);
}
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
+
ret = PVFS_util_init_defaults();
if(ret < 0) goto error;
ret = PVFS_util_get_default_fsid(&curfs);
if(ret < 0) goto error;
- ret = PVFS_sys_lookup(curfs, "/", &creds, &lookup_resp, 0);
+ ret = PVFS_sys_lookup(curfs, "/", cred, &lookup_resp, 0);
if(ret < 0) goto error;
- PVFS_util_gen_credentials(&creds);
-
attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
- attr.owner = creds.uid;
- attr.group = creds.gid;
+ attr.owner = cred->userid;
+ attr.group = cred->group_array[0];
attr.perms = 0644;
attr.atime = attr.ctime = attr.mtime = time(NULL);
ret = PVFS_sys_create(
(char*)filename,
- lookup_resp.ref, attr, &creds, NULL, NULL, &create_resp);
+ lookup_resp.ref, attr, cred, NULL, NULL, &create_resp);
if(ret < 0) goto error;
for(; i < count; ++i)
@@ -122,7 +125,7 @@ int main(int argc, char * argv[])
ret = PVFS_sys_io(
create_resp.ref, file_req, offset, membuff, mem_req,
- &creds, &io_resp, PVFS_IO_WRITE);
+ cred, &io_resp, PVFS_IO_WRITE);
if(ret < 0) goto error;
printf("Write response: size: %llu\n", llu(io_resp.total_completed));
@@ -141,7 +144,7 @@ error:
PVFS_sys_remove(
(char*)filename,
lookup_resp.ref,
- &creds);
+ cred);
PVFS_perror_gossip(errormsg, ret);
fprintf(stderr, "%s\n", errormsg);
Index: test-create-scale.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/test-create-scale.c,v
diff -p -u -r1.6 -r1.6.10.1
--- test-create-scale.c 6 Jul 2007 05:23:22 -0000 1.6
+++ test-create-scale.c 25 Jul 2008 19:06:33 -0000 1.6.10.1
@@ -35,7 +35,7 @@ int main(int argc, char **argv)
char entry_name[256];
PVFS_object_ref parent_refn;
PVFS_sys_attr attr;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
int max_dfiles = 0;
int iters = 0;
int i,j;
@@ -97,17 +97,18 @@ int main(int argc, char **argv)
}
memset(&resp_create, 0, sizeof(PVFS_sysresp_create));
- PVFS_util_gen_credentials(&credentials);
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
- attr.owner = credentials.uid;
- attr.group = credentials.gid;
+ attr.owner = cred->userid;
+ attr.group = cred->group_array[0];
attr.perms = 1877;
attr.atime = attr.ctime = attr.mtime = time(NULL);
attr.dfile_count = max_dfiles;
attr.mask |= PVFS_ATTR_SYS_DFILE_COUNT;
- ret = PINT_lookup_parent(basename, cur_fs, &credentials,
+ ret = PINT_lookup_parent(basename, cur_fs, cred,
&parent_refn.handle);
if(ret < 0)
{
@@ -119,13 +120,13 @@ int main(int argc, char **argv)
/* do one big one to prime connections if needed */
sprintf(entry_name, "%s%d", str_buf, 0);
ret = PVFS_sys_create(entry_name, parent_refn, attr,
- &credentials, NULL, NULL, &resp_create);
+ cred, NULL, NULL, &resp_create);
if (ret < 0)
{
PVFS_perror("PVFS_sys_create", ret);
return(-1);
}
- ret = PVFS_sys_remove(entry_name, parent_refn, &credentials);
+ ret = PVFS_sys_remove(entry_name, parent_refn, cred);
if(ret < 0)
{
PVFS_perror("PVFS_sys_remove", ret);
@@ -140,7 +141,7 @@ int main(int argc, char **argv)
attr.dfile_count = i+1;
start_time = Wtime();
ret = PVFS_sys_create(entry_name, parent_refn, attr,
- &credentials, NULL, NULL, &resp_create);
+ cred, NULL, NULL, &resp_create);
end_time = Wtime();
if (ret < 0)
{
@@ -153,7 +154,7 @@ int main(int argc, char **argv)
for(j=0; j<iters; j++)
{
sprintf(entry_name, "%s%d", str_buf, j);
- ret = PVFS_sys_remove(entry_name, parent_refn, &credentials);
+ ret = PVFS_sys_remove(entry_name, parent_refn, cred);
if(ret < 0)
{
PVFS_perror("PVFS_sys_remove", ret);
Index: test-hindexed-test.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/test-hindexed-test.c,v
diff -p -u -r1.4 -r1.4.10.1
--- test-hindexed-test.c 6 Jul 2007 05:23:22 -0000 1.4
+++ test-hindexed-test.c 25 Jul 2008 19:06:33 -0000 1.4.10.1
@@ -131,7 +131,7 @@ int main(int argc, char **argv)
char* entry_name;
PVFS_object_ref parent_ref;
PVFS_sys_attr attr;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
PVFS_object_ref ref;
PVFS_Request file_req;
PVFS_Request mem_req;
@@ -191,11 +191,12 @@ int main(int argc, char **argv)
ret = -1;
goto main_out;
}
- PVFS_util_gen_credentials(&credentials);
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
entry_name = str_buf;
- attr.owner = credentials.uid;
- attr.group = credentials.gid;
+ attr.owner = cred->userid;
+ attr.group = cred->group_array[0];
attr.perms = PVFS_U_WRITE|PVFS_U_READ;
attr.atime = time(NULL);
attr.mtime = attr.atime;
@@ -210,7 +211,7 @@ int main(int argc, char **argv)
memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
ret = PVFS_sys_lookup(cur_fs, pvfs_path,
- &credentials, &resp_lookup,
+ cred, &resp_lookup,
PVFS2_LOOKUP_LINK_FOLLOW);
if (ret < 0)
{
@@ -243,7 +244,7 @@ int main(int argc, char **argv)
goto main_out;
}
- ret = PINT_lookup_parent(pvfs_path, cur_fs, &credentials, &parent_ref.handle);
+ ret = PINT_lookup_parent(pvfs_path, cur_fs, cred, &parent_ref.handle);
if(ret < 0)
{
@@ -273,13 +274,13 @@ int main(int argc, char **argv)
memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
ret = PVFS_sys_ref_lookup(parent_ref.fs_id, entry_name,
- parent_ref, &credentials, &resp_lookup,
+ parent_ref, cred, &resp_lookup,
PVFS2_LOOKUP_LINK_NO_FOLLOW);
if (ret == 0)
{
fprintf(stderr, "Target file %s already exists! Deleting.\n", entry_name);
if (PVFS_sys_remove(entry_name,
- parent_ref, &credentials) < 0)
+ parent_ref, cred) < 0)
{
fprintf(stderr, "Could not unlink?\n");
}
@@ -292,7 +293,7 @@ int main(int argc, char **argv)
memset(&resp_create, 0, sizeof(PVFS_sysresp_create));
ret = PVFS_sys_create(entry_name, parent_ref, attr,
- &credentials, NULL, NULL, &resp_create);
+ cred, NULL, NULL, &resp_create);
if (ret < 0)
{
PVFS_perror("PVFS_sys_create", ret);
@@ -333,7 +334,7 @@ int main(int argc, char **argv)
/* write out the data */
ret = PVFS_sys_write(ref, file_req,
0, frame.wr_buffer, mem_req,
- &credentials, &resp_io);
+ cred, &resp_io);
if(ret < 0)
{
PVFS_perror("PVFS_sys_write", ret);
@@ -370,7 +371,7 @@ int main(int argc, char **argv)
printf("********************************************************\n\n");
ret = PVFS_sys_getattr(ref, PVFS_ATTR_SYS_ALL,
- &credentials, &resp_getattr);
+ cred, &resp_getattr);
if (ret < 0)
{
PVFS_perror("Getattr failed", ret);
@@ -413,7 +414,7 @@ int main(int argc, char **argv)
/* read back the data */
ret = PVFS_sys_read(ref, file_req,
0, frame.rd_buffer, mem_req,
- &credentials, &resp_io);
+ cred, &resp_io);
if(ret < 0)
{
PVFS_perror("PVFS_sys_read", ret);
Index: truncate.c
===================================================================
RCS file: /anoncvs/pvfs2/test/client/sysint/truncate.c,v
diff -p -u -r1.26 -r1.26.48.1
--- truncate.c 11 Nov 2005 21:31:12 -0000 1.26
+++ truncate.c 25 Jul 2008 19:06:33 -0000 1.26.48.1
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <assert.h>
#include "client.h"
#include "pvfs2-util.h"
@@ -19,7 +20,7 @@ int main(int argc,char **argv)
PVFS_sysresp_lookup resp_lk;
PVFS_size trunc_size;
PVFS_fs_id fs_id;
- PVFS_credentials credentials;
+ PVFS_credential *cred;
PVFS_object_ref pinode_refn;
PVFS_size size;
@@ -49,10 +50,13 @@ int main(int argc,char **argv)
PVFS_perror("PVFS_util_get_default_fsid", ret);
return (-1);
}
+
+ cred = PVFS_util_gen_fake_credential();
+ assert(cred);
/* lookup the root handle */
printf("looking up the root handle for fsid = %d\n", fs_id);
- ret = PVFS_sys_lookup(fs_id, "/", &credentials,
+ ret = PVFS_sys_lookup(fs_id, "/", cred,
&resp_look, PVFS2_LOOKUP_LINK_FOLLOW);
if (ret < 0)
{
@@ -62,8 +66,7 @@ int main(int argc,char **argv)
memset(&resp_lk,0,sizeof(PVFS_sysresp_lookup));
- PVFS_util_gen_credentials(&credentials);
- ret = PVFS_sys_lookup(fs_id, filename, &credentials,
+ ret = PVFS_sys_lookup(fs_id, filename, cred,
&resp_lk, PVFS2_LOOKUP_LINK_FOLLOW);
if (ret < 0)
{
@@ -76,7 +79,7 @@ int main(int argc,char **argv)
pinode_refn.handle = resp_lk.ref.handle;
pinode_refn.fs_id = resp_lk.ref.fs_id;
- ret = PVFS_sys_truncate(pinode_refn, size, &credentials);
+ ret = PVFS_sys_truncate(pinode_refn, size, cred);
if (ret < 0)
{
printf("truncate failed with errcode = %d\n",ret);
More information about the Pvfs2-cvs
mailing list