[PVFS2-CVS] commit by robl in pvfs2-1/src/apps/admin: pvfs2-rm.c

CVS commit program cvs at parl.clemson.edu
Fri Jul 22 17:39:12 EDT 2005


Update of /projects/cvsroot/pvfs2-1/src/apps/admin
In directory parlweb:/tmp/cvs-serv23891/src/apps/admin

Modified Files:
	pvfs2-rm.c 
Log Message:
[pcarns]:
	- You can now mount a pvfs2 voume by hand and the pvfs2 utilities will
	  find it (i.e. pvfs2 looks in /etc/fstab, /etc/pvfs2tab,
	  $PVFS2TAB_FILE, and /etc/mtab). 
	- Introduce PINT_util_resolve_absolute, a routine which, in conjunction
	  with the earlier added PINT_realpath, lets pvfs2 utilities better
	  deal with relative paths
	- clean up pvfs2-rm error handling


Index: pvfs2-rm.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/apps/admin/pvfs2-rm.c,v
diff -u -w -p -u -r1.8 -r1.9
--- pvfs2-rm.c	19 Oct 2004 13:42:09 -0000	1.8
+++ pvfs2-rm.c	22 Jul 2005 20:39:12 -0000	1.9
@@ -72,23 +72,30 @@ int main(int argc, char **argv)
         PVFS_object_ref parent_ref;
 
         /* Translate path into pvfs2 relative path */
-        rc = PINT_get_base_dir(working_file, directory, PVFS_NAME_MAX);
-        num_segs = PINT_string_count_segments(working_file);
-        rc = PINT_get_path_element(working_file, num_segs - 1,
-                                   filename, PVFS_SEGMENT_MAX);
+        rc = PVFS_util_resolve(working_file, &cur_fs, pvfs_path,
+            PVFS_NAME_MAX);
+        if(rc < 0)
+        {
+            PVFS_perror("PVFS_util_resolve", rc);
+            ret = -1;
+            break;
+        }
 
-        if (rc)
+        /* break into file and directory */
+        rc = PINT_get_base_dir(pvfs_path, directory, PVFS_NAME_MAX);
+        if(rc < 0)
         {
-            fprintf(stderr, "Unknown path format: %s\n", working_file);
+            PVFS_perror("PINT_get_base_dir", rc);
             ret = -1;
             break;
         }
+        num_segs = PINT_string_count_segments(pvfs_path);
+        rc = PINT_get_path_element(pvfs_path, num_segs - 1,
+                                   filename, PVFS_SEGMENT_MAX);
 
-        rc = PVFS_util_resolve(directory, &cur_fs,
-                               pvfs_path, PVFS_NAME_MAX);
         if (rc)
         {
-            PVFS_perror("PVFS_util_resolve", rc);
+            PVFS_perror("PINT_get_path_element", rc);
             ret = -1;
             break;
         }
@@ -97,7 +104,7 @@ int main(int argc, char **argv)
         credentials.gid = getuid();
 
         memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
-        rc = PVFS_sys_lookup(cur_fs, pvfs_path, &credentials,
+        rc = PVFS_sys_lookup(cur_fs, directory, &credentials,
                              &resp_lookup, PVFS2_LOOKUP_LINK_NO_FOLLOW);
         if (rc)
         {



More information about the PVFS2-CVS mailing list