[Pvfs2-cvs] commit by kunkel in pvfs2/src/apps/admin: pvfs2-cp.c

CVS commit program cvs at parl.clemson.edu
Tue Aug 29 05:37:17 EDT 2006


Update of /projects/cvsroot/pvfs2/src/apps/admin
In directory parlweb1:/tmp/cvs-serv30210/src/apps/admin

Modified Files:
      Tag: kunkel-branch
	pvfs2-cp.c 
Log Message:
Added function for hints which allows to specify hints in environemt 
variable.


Index: pvfs2-cp.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/admin/pvfs2-cp.c,v
diff -p -u -r1.19.4.4 -r1.19.4.5
--- pvfs2-cp.c	19 Aug 2006 13:09:32 -0000	1.19.4.4
+++ pvfs2-cp.c	29 Aug 2006 09:37:17 -0000	1.19.4.5
@@ -70,6 +70,7 @@ typedef struct file_object_s {
     } u;
 } file_object;
 
+static PVFS_hint * hints = NULL;
 
 static struct options* parse_args(int argc, char* argv[]);
 static void usage(int argc, char** argv);
@@ -132,6 +133,8 @@ int main (int argc, char ** argv)
 	return(-1);
     }
 
+    PINT_hint_add_environment_hints(& hints);
+    
     ret = PVFS_util_init_defaults();
     if (ret < 0)
     {
@@ -198,6 +201,7 @@ int main (int argc, char ** argv)
     {
 	print_timings(time2-time1, total_written);
     }
+    
     ret = 0;
 
 main_out:
@@ -205,6 +209,8 @@ main_out:
     PVFS_sys_finalize();
     free(user_opts);
     free(buffer);
+    
+    PVFS_free_hint(& hints);
     return(ret);
 }
 
@@ -331,7 +337,7 @@ static size_t generic_read(file_object *
 	    return (ret);
 	}
 	ret = PVFS_sys_read(src->u.pvfs2.ref, file_req, offset,
-		buffer, mem_req, credentials, &resp_io, NULL);
+		buffer, mem_req, credentials, &resp_io, hints);
 	if (ret == 0)
 	{
             PVFS_Request_free(&mem_req);
@@ -363,7 +369,7 @@ static size_t generic_write(file_object 
 	    return(ret);
 	}
 	ret = PVFS_sys_write(dest->u.pvfs2.ref, file_req, offset,
-		buffer, mem_req, credentials, &resp_io, NULL);
+		buffer, mem_req, credentials, &resp_io, hints);
 	if (ret == 0) 
         {
             PVFS_Request_free(&mem_req);
@@ -484,7 +490,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, obj->u.pvfs2.pvfs2_path,
                                   credentials, &resp_lookup,
-                                  PVFS2_LOOKUP_LINK_FOLLOW, NULL);
+                                  PVFS2_LOOKUP_LINK_FOLLOW, hints);
 	    if (ret < 0)
 	    {
 		PVFS_perror("PVFS_sys_lookup", ret);
@@ -553,13 +559,13 @@ static int generic_open(file_object *obj
 	memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
 	ret = PVFS_sys_ref_lookup(parent_ref.fs_id, entry_name,
                                   parent_ref, credentials, &resp_lookup,
-                                  PVFS2_LOOKUP_LINK_FOLLOW, NULL);
+                                  PVFS2_LOOKUP_LINK_FOLLOW, hints);
 
         if ((ret == 0) && (open_type == OPEN_SRC))
         {
             memset(&resp_getattr, 0, sizeof(PVFS_sysresp_getattr));
             ret = PVFS_sys_getattr(resp_lookup.ref, PVFS_ATTR_SYS_ALL_NOHINT,
-                                   credentials, &resp_getattr, NULL);
+                                   credentials, &resp_getattr, hints);
             if (ret)
             {
                 fprintf(stderr, "Failed to do pvfs2 getattr on %s\n",
@@ -628,7 +634,7 @@ static int generic_open(file_object *obj
             
 		ret = PVFS_sys_create(entry_name, parent_ref, 
                                       obj->u.pvfs2.attr, credentials,
-                                      new_dist, &resp_create, NULL);
+                                      new_dist, &resp_create, hints);
 		if (ret < 0)
 		{
 		    PVFS_perror("PVFS_sys_create", ret); 
@@ -662,7 +668,7 @@ static int generic_cleanup(file_object *
     /* preserve permissions doing a pvfs2 => pvfs2 copy */
     if ((src->fs_type == PVFS2_FILE) && (dest->fs_type == PVFS2_FILE))
     {
-        PVFS_sys_setattr(dest->u.pvfs2.ref, src->u.pvfs2.attr, credentials, NULL);
+        PVFS_sys_setattr(dest->u.pvfs2.ref, src->u.pvfs2.attr, credentials, hints);
     }
 
     if ((src->fs_type == UNIX_FILE) && (src->u.ufs.fd != -1))



More information about the Pvfs2-cvs mailing list