Do not print volume name in DisplayFormat2 if status is not VOK
authorJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 16 Jul 2009 15:53:52 +0000 (11:53 -0400)
committerDerrick Brashear <shadow@dementia.org>
Thu, 16 Jul 2009 17:05:08 +0000 (11:05 -0600)
DisplayFormat2 is used to generate volume output for ListVolumes
and ExamineVolume.  If the volume status is not VOK, the name field
will not have been populated with valid data.  Do not print it.

This commit also removes an extraneous switch block from
XDisplayFormat2.  The switch variable is already known to
have the value VOK due to an enclosing conditional.

FIXES 125111

LICENSE MIT

Reviewed-on: http://gerrit.openafs.org/140
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Verified-by: Derrick Brashear <shadow@dementia.org>

src/volser/vos.c

index df766d4..f79ae7c 100644 (file)
@@ -882,17 +882,7 @@ XDisplayFormat2(volintXInfo *a_xInfoP, afs_int32 a_servID, afs_int32 a_partID,
                fprintf(STDOUT, "id\t\t%lu\n", afs_printable_uint32_lu(a_xInfoP->volid));
                fprintf(STDOUT, "serv\t\t%s\t%s\n", address, hostname);
                fprintf(STDOUT, "part\t\t%s\n", pname);
-               switch (a_xInfoP->status) {
-               case VOK:
-                       fprintf(STDOUT, "status\t\tOK\n");
-                       break;
-               case VBUSY:
-                       fprintf(STDOUT, "status\t\tBUSY\n");
-                       return;
-               default:
-                       fprintf(STDOUT, "status\t\tUNATTACHABLE\n");
-                       return;
-               }
+                fprintf(STDOUT, "status\t\tOK\n");
                fprintf(STDOUT, "backupID\t%lu\n", 
                        afs_printable_uint32_lu(a_xInfoP->backupID));
                fprintf(STDOUT, "parentID\t%lu\n", 
@@ -1031,7 +1021,10 @@ DisplayFormat2(long server, long partition, volintInfo *pntr)
        MapPartIdIntoName(partition, pname);
        partition_cache = partition;
     }
-    fprintf(STDOUT, "name\t\t%s\n", pntr->name);
+
+    if (pntr->status == VOK)
+        fprintf(STDOUT, "name\t\t%s\n", pntr->name);
+
     fprintf(STDOUT, "id\t\t%lu\n", 
            afs_printable_uint32_lu(pntr->volid));
     fprintf(STDOUT, "serv\t\t%s\t%s\n", address, hostname);