Hi Dharani,
Good catch. I think the test program had not been updated..
Attached patch should fix it.
thanks,
Murali

On 6/28/07, Dharani Sankar Vijayakumar <[EMAIL PROTECTED]> wrote:
Murali,
I infact executed test/client/sysint/get-eattr with command line arguments
user.XXX filename.

But, test/client/sysint/set-eattr seems to be working fine!

Regards,
Dharani



On Thu, 28 Jun 2007, Murali Vilayannur wrote:

> Hi Dharani,
> Can you send a snippet of the code using this function? It is possible
> that you may be calling the function with incorrect parameters.
> There are several test programs making use of this function that will
> show you how to make use of these functions correctly under :
> test/client/sysint/create.set.get.eattr.c
> test/client/sysint/del-eattr.c
> test/client/sysint/get-eattr.c
> test/client/sysint/set-eattr.c
> test/client/sysint/list-eattr.c
> Good luck.
> thanks,
> Murali
>
> On 6/28/07, Dharani Sankar Vijayakumar <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I tried using the PVFS_sys_geteattr() function provided in
>> src/client/sysint/sys-get-eattr.c. I seem to be getting segfault from
>> within this function! Is there anything within the source code of
>> sys-get-eattr.c that creates this problem?
>> I am able to use this sys-set-eattr.c properly !
>>
>> Regards,
>> Dharani
>>
>>
>>
>> _______________________________________________
>> Pvfs2-developers mailing list
>> [email protected]
>> http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers
>>
>

--- test/client/sysint/get-eattr.c.old	2007-06-28 03:40:58.000000000 -0700
+++ test/client/sysint/get-eattr.c	2007-06-28 03:47:07.000000000 -0700
@@ -30,13 +30,16 @@
     int nkey;
     PVFS_ds_keyval *key;
     PVFS_ds_keyval *val;
+    PVFS_error *err;
     int target_count;
     char** destfiles;
 };
 
 static struct options* parse_args(int argc, char* argv[]);
 int pvfs2_geteattr (int nkey, PVFS_ds_keyval *key_p,
-        PVFS_ds_keyval *val_p, char *destfile);
+        PVFS_ds_keyval *val_p,
+        PVFS_error *err_p,
+        char *destfile);
 static void usage(int argc, char** argv);
 int check_perm(char c);
 
@@ -68,15 +71,19 @@
    */
   for (i = 0; i < user_opts->target_count; i++) {
     ret = pvfs2_geteattr(user_opts->nkey, user_opts->key, user_opts->val,
-            user_opts->destfiles[i]);
+            user_opts->err, user_opts->destfiles[i]);
     if (ret != 0) {
         printf("geteattr returned error code - exiting\n");
         break;
     }
     for (k = 0; k < user_opts->nkey; k++) {
-        printf("key[%d]:%s Value:\n%s\n",k,
-                (char *)user_opts->key[k].buffer,
-                (char *)user_opts->val[k].buffer);
+        if (user_opts->err[k] == 0) {
+            printf("key[%d]:%s Value:\n%s\n",k,
+                    (char *)user_opts->key[k].buffer,
+                    (char *)user_opts->val[k].buffer);
+        } else {
+            printf("key %d: error:%d\n",k, user_opts->err[k]);
+        }
     }
     /* TODO: need to free the request descriptions */
   }
@@ -91,7 +98,10 @@
  * returns zero on success and negative one on failure
  */
 int pvfs2_geteattr(int nkey, PVFS_ds_keyval *key_p,
-        PVFS_ds_keyval *val_p, char *destfile) {
+        PVFS_ds_keyval *val_p,
+        PVFS_error *err_p,
+        char *destfile) 
+{
   int ret = -1;
   char str_buf[PVFS_NAME_MAX] = {0};
   char pvfs_path[PVFS_NAME_MAX] = {0};
@@ -100,6 +110,7 @@
   PVFS_sysresp_geteattr resp_geteattr;
   PVFS_object_ref parent_ref;
   PVFS_credentials credentials;
+
   /* translate local path into pvfs2 relative path */
   ret = PVFS_util_resolve(destfile,&cur_fs, pvfs_path, PVFS_NAME_MAX);
   if(ret < 0)
@@ -166,6 +177,7 @@
 
   /* get extended attribute */
   resp_geteattr.val_array = val_p;
+  resp_geteattr.err_array = err_p;
   ret = PVFS_sys_geteattr_list(resp_lookup.ref,
           &credentials, nkey, key_p, &resp_geteattr);
   if (ret < 0)
@@ -252,6 +264,8 @@
             malloc(sizeof(PVFS_ds_keyval) * tmp_opts->nkey);
     tmp_opts->val = (PVFS_ds_keyval *)
             malloc(sizeof(PVFS_ds_keyval) * tmp_opts->nkey);
+    tmp_opts->err = (PVFS_error *)
+            malloc(sizeof(PVFS_error) * tmp_opts->nkey);
     /* now re-run the list to set up the key strings */
     cptr = argv[optind];
     for (k = 0; k < tmp_opts->nkey; k++)
_______________________________________________
Pvfs2-developers mailing list
[email protected]
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers

Reply via email to