2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afsconfig.h>
11 #include <afs/param.h>
16 #include <sys/types.h>
26 #include <netinet/in.h>
27 #include <arpa/inet.h>
31 #include <sys/statfs.h>
39 #include <rx/rx_globals.h>
41 #include <afs/vlserver.h>
42 #include <afs/cellconfig.h>
44 #include <afs/afsutil.h>
46 #include <afs/afsint.h>
51 #include <afs/ihandle.h>
52 #include <afs/vnode.h>
53 #include <afs/volume.h>
60 #include "volser_prototypes.h"
61 #include "vsutils_prototypes.h"
62 #include "lockprocs_prototypes.h"
64 #ifdef HAVE_POSIX_REGEX
68 /* Local Prototypes */
69 int PrintDiagnostics(char *astring, afs_int32 acode);
70 int GetVolumeInfo(afs_int32 volid, afs_int32 *server, afs_int32 *part,
71 afs_int32 *voltype, struct nvldbentry *rentry);
83 #define COMMONPARMS cmd_Seek(ts, 12);\
84 cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell name");\
85 cmd_AddParm(ts, "-noauth", CMD_FLAG, CMD_OPTIONAL, "don't authenticate");\
86 cmd_AddParm(ts, "-localauth",CMD_FLAG,CMD_OPTIONAL,"use server tickets");\
87 cmd_AddParm(ts, "-verbose", CMD_FLAG, CMD_OPTIONAL, "verbose");\
88 cmd_AddParm(ts, "-encrypt", CMD_FLAG, CMD_OPTIONAL, "encrypt commands");\
89 cmd_AddParm(ts, "-noresolve", CMD_FLAG, CMD_OPTIONAL, "don't resolve addresses"); \
91 #define ERROR_EXIT(code) {error=(code); goto error_exit;}
94 struct rx_connection *tconn;
96 extern struct ubik_client *cstruct;
99 static struct tqHead busyHead, notokHead;
102 qInit(struct tqHead *ahead)
104 memset((char *)ahead, 0, sizeof(struct tqHead));
110 qPut(struct tqHead *ahead, afs_int32 volid)
114 elem = (struct tqElem *)malloc(sizeof(struct tqElem));
115 elem->next = ahead->next;
123 qGet(struct tqHead *ahead, afs_int32 *volid)
127 if (ahead->count <= 0)
129 *volid = ahead->next->volid;
131 ahead->next = tmp->next;
137 /* returns 1 if <filename> exists else 0 */
139 FileExists(char *filename)
145 code = usd_Open(filename, USD_OPEN_RDONLY, 0, &ufd);
149 code = USD_IOCTL(ufd, USD_IOCTL_GETSIZE, &size);
157 /* returns 1 if <name> doesnot end in .readonly or .backup, else 0 */
159 VolNameOK(char *name)
164 total = strlen(name);
165 if (!strcmp(&name[total - 9], ".readonly")) {
167 } else if (!strcmp(&name[total - 7], ".backup")) {
174 /* return 1 if name is a number else 0 */
176 IsNumeric(char *name)
184 for (i = 0; i < len; i++) {
185 if (*ptr < '0' || *ptr > '9') {
197 * Parse a server name/address and return the address in HOST BYTE order
200 GetServer(char *aname)
202 register struct hostent *th;
205 register afs_int32 code;
206 char hostname[MAXHOSTCHARS];
208 code = sscanf(aname, "%d.%d.%d.%d", &b1, &b2, &b3, &b4);
210 addr = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
211 addr = ntohl(addr); /* convert to host order */
213 th = gethostbyname(aname);
216 memcpy(&addr, th->h_addr, sizeof(addr));
219 if (addr == htonl(0x7f000001)) { /* local host */
220 code = gethostname(hostname, MAXHOSTCHARS);
223 th = gethostbyname(hostname); /* returns host byte order */
226 memcpy(&addr, th->h_addr, sizeof(addr));
233 GetVolumeType(char *aname)
236 if (!strcmp(aname, "ro"))
238 else if (!strcmp(aname, "rw"))
240 else if (!strcmp(aname, "bk"))
247 IsPartValid(afs_int32 partId, afs_int32 server, afs_int32 *code)
249 struct partList dummyPartList;
255 *code = UV_ListPartitions(server, &dummyPartList, &cnt);
258 for (i = 0; i < cnt; i++) {
259 if (dummyPartList.partFlags[i] & PARTVALID)
260 if (dummyPartList.partId[i] == partId)
268 /*sends the contents of file associated with <fd> and <blksize> to Rx Stream
269 * associated with <call> */
271 SendFile(usd_handle_t ufd, register struct rx_call *call, long blksize)
273 char *buffer = (char *)0;
278 buffer = (char *)malloc(blksize);
280 fprintf(STDERR, "malloc failed\n");
284 while (!error && !done) {
285 #ifndef AFS_NT40_ENV /* NT csn't select on non-socket fd's */
288 FD_SET((int)(ufd->handle), &in);
289 /* don't timeout if read blocks */
290 #if defined(AFS_PTHREAD_ENV)
291 select(((int)(ufd->handle)) + 1, &in, 0, 0, 0);
293 IOMGR_Select(((int)(ufd->handle)) + 1, &in, 0, 0, 0);
296 error = USD_READ(ufd, buffer, blksize, &nbytes);
298 fprintf(STDERR, "File system read failed\n");
305 if (rx_Write(call, buffer, nbytes) != nbytes) {
315 /* function invoked by UV_RestoreVolume, reads the data from rx_trx_stream and
316 * writes it out to the volume. */
318 WriteData(struct rx_call *call, char *rock)
323 afs_int32 error, code;
325 afs_hyper_t filesize, currOffset;
332 if (!filename || !*filename) {
333 usd_StandardInput(&ufd);
337 code = usd_Open(filename, USD_OPEN_RDONLY, 0, &ufd);
340 code = USD_IOCTL(ufd, USD_IOCTL_GETBLKSIZE, &blksize);
343 fprintf(STDERR, "Could not access file '%s'\n", filename);
347 /* test if we have a valid dump */
348 hset64(filesize, 0, 0);
349 USD_SEEK(ufd, filesize, SEEK_END, &currOffset);
350 hset64(filesize, hgethi(currOffset), hgetlo(currOffset)-sizeof(afs_uint32));
351 USD_SEEK(ufd, filesize, SEEK_SET, &currOffset);
352 USD_READ(ufd, (char *)&buffer, sizeof(afs_uint32), &got);
353 if ((got != sizeof(afs_uint32)) || (ntohl(buffer) != DUMPENDMAGIC)) {
354 fprintf(STDERR, "Signature missing from end of file '%s'\n", filename);
358 /* rewind, we are done */
359 hset64(filesize, 0, 0);
360 USD_SEEK(ufd, filesize, SEEK_SET, &currOffset);
362 code = SendFile(ufd, call, blksize);
369 code = USD_CLOSE(ufd);
371 fprintf(STDERR, "Could not close dump file %s\n",
372 (filename && *filename) ? filename : "STDOUT");
380 /* Receive data from <call> stream into file associated
381 * with <fd> <blksize>
384 ReceiveFile(usd_handle_t ufd, struct rx_call *call, long blksize)
388 afs_uint32 bytesleft, w;
391 buffer = (char *)malloc(blksize);
393 fprintf(STDERR, "memory allocation failed\n");
397 while ((bytesread = rx_Read(call, buffer, blksize)) > 0) {
398 for (bytesleft = bytesread; bytesleft; bytesleft -= w) {
399 #ifndef AFS_NT40_ENV /* NT csn't select on non-socket fd's */
402 FD_SET((int)(ufd->handle), &out);
403 /* don't timeout if write blocks */
404 #if defined(AFS_PTHREAD_ENV)
405 select(((int)(ufd->handle)) + 1, &out, 0, 0, 0);
407 IOMGR_Select(((int)(ufd->handle)) + 1, 0, &out, 0, 0);
411 USD_WRITE(ufd, &buffer[bytesread - bytesleft], bytesleft, &w);
413 fprintf(STDERR, "File system write failed\n");
426 DumpFunction(struct rx_call *call, char *filename)
428 usd_handle_t ufd; /* default is to stdout */
429 afs_int32 error = 0, code;
434 /* Open the output file */
435 if (!filename || !*filename) {
436 usd_StandardOutput(&ufd);
441 usd_Open(filename, USD_OPEN_CREATE | USD_OPEN_RDWR, 0666, &ufd);
445 code = USD_IOCTL(ufd, USD_IOCTL_SETSIZE, &size);
448 code = USD_IOCTL(ufd, USD_IOCTL_GETBLKSIZE, &blksize);
451 fprintf(STDERR, "Could not create file '%s'\n", filename);
452 ERROR_EXIT(VOLSERBADOP);
456 code = ReceiveFile(ufd, call, blksize);
461 /* Close the output file */
463 code = USD_CLOSE(ufd);
465 fprintf(STDERR, "Could not close dump file %s\n",
466 (filename && *filename) ? filename : "STDIN");
476 vos_ctime(afs_int32 *timep)
483 DisplayFormat(pntr, server, part, totalOK, totalNotOK, totalBusy, fast,
486 afs_int32 server, part;
487 int *totalOK, *totalNotOK, *totalBusy;
488 int fast, longlist, disp;
493 fprintf(STDOUT, "%-10lu\n", (unsigned long)pntr->volid);
494 } else if (longlist) {
495 if (pntr->status == VOK) {
496 fprintf(STDOUT, "%-32s ", pntr->name);
497 fprintf(STDOUT, "%10lu ", (unsigned long)pntr->volid);
499 fprintf(STDOUT, "RW ");
501 fprintf(STDOUT, "RO ");
503 fprintf(STDOUT, "BK ");
504 fprintf(STDOUT, "%10d K ", pntr->size);
505 if (pntr->inUse == 1) {
506 fprintf(STDOUT, "On-line");
509 fprintf(STDOUT, "Off-line");
512 if (pntr->needsSalvaged == 1)
513 fprintf(STDOUT, "**needs salvage**");
514 fprintf(STDOUT, "\n");
515 MapPartIdIntoName(part, pname);
516 fprintf(STDOUT, " %s %s \n", hostutil_GetNameByINet(server),
518 fprintf(STDOUT, " RWrite %10lu ROnly %10lu Backup %10lu \n",
519 (unsigned long)pntr->parentID,
520 (unsigned long)pntr->cloneID,
521 (unsigned long)pntr->backupID);
522 fprintf(STDOUT, " MaxQuota %10d K \n", pntr->maxquota);
523 fprintf(STDOUT, " Creation %s",
524 vos_ctime(& pntr->creationDate));
525 #ifdef FULL_LISTVOL_SWITCH
526 fprintf(STDOUT, " Copy %s",
527 vos_ctime( & pntr->copyDate));
528 if (!pntr->backupDate)
529 fprintf(STDOUT, " Backup Never\n");
531 fprintf(STDOUT, " Backup %s",
532 vos_ctime( & pntr->backupDate));
533 if (pntr->accessDate)
534 fprintf(STDOUT, " Last Access %s",
535 vos_ctime( & pntr->accessDate));
537 if (!pntr->updateDate)
538 fprintf(STDOUT, " Last Update Never\n");
540 fprintf(STDOUT, " Last Update %s",
541 vos_ctime( & pntr->updateDate));
543 " %d accesses in the past day (i.e., vnode references)\n",
546 } else if (pntr->status == VBUSY) {
548 qPut(&busyHead, pntr->volid);
550 fprintf(STDOUT, "**** Volume %lu is busy ****\n",
551 (unsigned long)pntr->volid);
554 qPut(¬okHead, pntr->volid);
556 fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
557 (unsigned long)pntr->volid);
559 fprintf(STDOUT, "\n");
560 } else { /* default listing */
561 if (pntr->status == VOK) {
562 fprintf(STDOUT, "%-32s ", pntr->name);
563 fprintf(STDOUT, "%10lu ", (unsigned long)pntr->volid);
565 fprintf(STDOUT, "RW ");
567 fprintf(STDOUT, "RO ");
569 fprintf(STDOUT, "BK ");
570 fprintf(STDOUT, "%10d K ", pntr->size);
571 if (pntr->inUse == 1) {
572 fprintf(STDOUT, "On-line");
575 fprintf(STDOUT, "Off-line");
578 if (pntr->needsSalvaged == 1)
579 fprintf(STDOUT, "**needs salvage**");
580 fprintf(STDOUT, "\n");
581 } else if (pntr->status == VBUSY) {
583 qPut(&busyHead, pntr->volid);
585 fprintf(STDOUT, "**** Volume %lu is busy ****\n",
586 (unsigned long)pntr->volid);
589 qPut(¬okHead, pntr->volid);
591 fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
592 (unsigned long)pntr->volid);
597 /*------------------------------------------------------------------------
598 * PRIVATE XDisplayFormat
601 * Display the contents of one extended volume info structure.
604 * a_xInfoP : Ptr to extended volume info struct to print.
605 * a_servID : Server ID to print.
606 * a_partID : Partition ID to print.
607 * a_totalOKP : Ptr to total-OK counter.
608 * a_totalNotOKP : Ptr to total-screwed counter.
609 * a_totalBusyP : Ptr to total-busy counter.
610 * a_fast : Fast listing?
611 * a_int32 : Int32 listing?
612 * a_showProblems : Show volume problems?
618 * Nothing interesting.
622 *------------------------------------------------------------------------*/
625 XDisplayFormat(a_xInfoP, a_servID, a_partID, a_totalOKP, a_totalNotOKP,
626 a_totalBusyP, a_fast, a_int32, a_showProblems)
627 volintXInfo *a_xInfoP;
637 { /*XDisplayFormat */
645 fprintf(STDOUT, "%-10lu\n", (unsigned long)a_xInfoP->volid);
646 } else if (a_int32) {
648 * Fully-detailed listing.
650 if (a_xInfoP->status == VOK) {
652 * Volume's status is OK - all the fields are valid.
654 fprintf(STDOUT, "%-32s ", a_xInfoP->name);
655 fprintf(STDOUT, "%10lu ", (unsigned long)a_xInfoP->volid);
656 if (a_xInfoP->type == 0)
657 fprintf(STDOUT, "RW ");
658 if (a_xInfoP->type == 1)
659 fprintf(STDOUT, "RO ");
660 if (a_xInfoP->type == 2)
661 fprintf(STDOUT, "BK ");
662 fprintf(STDOUT, "%10d K used ", a_xInfoP->size);
663 fprintf(STDOUT, "%d files ", a_xInfoP->filecount);
664 if (a_xInfoP->inUse == 1) {
665 fprintf(STDOUT, "On-line");
668 fprintf(STDOUT, "Off-line");
671 fprintf(STDOUT, "\n");
672 MapPartIdIntoName(a_partID, pname);
673 fprintf(STDOUT, " %s %s \n", hostutil_GetNameByINet(a_servID),
675 fprintf(STDOUT, " RWrite %10lu ROnly %10lu Backup %10lu \n",
676 (unsigned long)a_xInfoP->parentID,
677 (unsigned long)a_xInfoP->cloneID,
678 (unsigned long)a_xInfoP->backupID);
679 fprintf(STDOUT, " MaxQuota %10d K \n", a_xInfoP->maxquota);
680 fprintf(STDOUT, " Creation %s",
681 vos_ctime( & a_xInfoP->creationDate));
682 #ifdef FULL_LISTVOL_SWITCH
683 fprintf(STDOUT, " Copy %s",
684 vos_ctime( & a_xInfoP->copyDate));
685 if (!a_xInfoP->backupDate)
686 fprintf(STDOUT, " Backup Never\n");
688 fprintf(STDOUT, " Backup %s",
689 vos_ctime( & a_xInfoP->backupDate));
690 if (a_xInfoP->accessDate)
691 fprintf(STDOUT, " Last Access %s",
692 vos_ctime( & a_xInfoP->accessDate));
694 if (!a_xInfoP->updateDate)
695 fprintf(STDOUT, " Last Update Never\n");
697 fprintf(STDOUT, " Last Update %s",
698 vos_ctime( & a_xInfoP->updateDate));
700 " %d accesses in the past day (i.e., vnode references)\n",
705 * Print all the read/write and authorship stats.
707 fprintf(STDOUT, "\n Raw Read/Write Stats\n");
709 " |-------------------------------------------|\n");
711 " | Same Network | Diff Network |\n");
713 " |----------|----------|----------|----------|\n");
715 " | Total | Auth | Total | Auth |\n");
717 " |----------|----------|----------|----------|\n");
718 fprintf(STDOUT, "Reads | %8d | %8d | %8d | %8d |\n",
719 a_xInfoP->stat_reads[VOLINT_STATS_SAME_NET],
720 a_xInfoP->stat_reads[VOLINT_STATS_SAME_NET_AUTH],
721 a_xInfoP->stat_reads[VOLINT_STATS_DIFF_NET],
722 a_xInfoP->stat_reads[VOLINT_STATS_DIFF_NET_AUTH]);
723 fprintf(STDOUT, "Writes | %8d | %8d | %8d | %8d |\n",
724 a_xInfoP->stat_writes[VOLINT_STATS_SAME_NET],
725 a_xInfoP->stat_writes[VOLINT_STATS_SAME_NET_AUTH],
726 a_xInfoP->stat_writes[VOLINT_STATS_DIFF_NET],
727 a_xInfoP->stat_writes[VOLINT_STATS_DIFF_NET_AUTH]);
729 " |-------------------------------------------|\n\n");
732 " Writes Affecting Authorship\n");
734 " |-------------------------------------------|\n");
736 " | File Authorship | Directory Authorship|\n");
738 " |----------|----------|----------|----------|\n");
740 " | Same | Diff | Same | Diff |\n");
742 " |----------|----------|----------|----------|\n");
743 fprintf(STDOUT, "0-60 sec | %8d | %8d | %8d | %8d |\n",
744 a_xInfoP->stat_fileSameAuthor[VOLINT_STATS_TIME_IDX_0],
745 a_xInfoP->stat_fileDiffAuthor[VOLINT_STATS_TIME_IDX_0],
746 a_xInfoP->stat_dirSameAuthor[VOLINT_STATS_TIME_IDX_0],
747 a_xInfoP->stat_dirDiffAuthor[VOLINT_STATS_TIME_IDX_0]);
748 fprintf(STDOUT, "1-10 min | %8d | %8d | %8d | %8d |\n",
749 a_xInfoP->stat_fileSameAuthor[VOLINT_STATS_TIME_IDX_1],
750 a_xInfoP->stat_fileDiffAuthor[VOLINT_STATS_TIME_IDX_1],
751 a_xInfoP->stat_dirSameAuthor[VOLINT_STATS_TIME_IDX_1],
752 a_xInfoP->stat_dirDiffAuthor[VOLINT_STATS_TIME_IDX_1]);
753 fprintf(STDOUT, "10min-1hr | %8d | %8d | %8d | %8d |\n",
754 a_xInfoP->stat_fileSameAuthor[VOLINT_STATS_TIME_IDX_2],
755 a_xInfoP->stat_fileDiffAuthor[VOLINT_STATS_TIME_IDX_2],
756 a_xInfoP->stat_dirSameAuthor[VOLINT_STATS_TIME_IDX_2],
757 a_xInfoP->stat_dirDiffAuthor[VOLINT_STATS_TIME_IDX_2]);
758 fprintf(STDOUT, "1hr-1day | %8d | %8d | %8d | %8d |\n",
759 a_xInfoP->stat_fileSameAuthor[VOLINT_STATS_TIME_IDX_3],
760 a_xInfoP->stat_fileDiffAuthor[VOLINT_STATS_TIME_IDX_3],
761 a_xInfoP->stat_dirSameAuthor[VOLINT_STATS_TIME_IDX_3],
762 a_xInfoP->stat_dirDiffAuthor[VOLINT_STATS_TIME_IDX_3]);
763 fprintf(STDOUT, "1day-1wk | %8d | %8d | %8d | %8d |\n",
764 a_xInfoP->stat_fileSameAuthor[VOLINT_STATS_TIME_IDX_4],
765 a_xInfoP->stat_fileDiffAuthor[VOLINT_STATS_TIME_IDX_4],
766 a_xInfoP->stat_dirSameAuthor[VOLINT_STATS_TIME_IDX_4],
767 a_xInfoP->stat_dirDiffAuthor[VOLINT_STATS_TIME_IDX_4]);
768 fprintf(STDOUT, "> 1wk | %8d | %8d | %8d | %8d |\n",
769 a_xInfoP->stat_fileSameAuthor[VOLINT_STATS_TIME_IDX_5],
770 a_xInfoP->stat_fileDiffAuthor[VOLINT_STATS_TIME_IDX_5],
771 a_xInfoP->stat_dirSameAuthor[VOLINT_STATS_TIME_IDX_5],
772 a_xInfoP->stat_dirDiffAuthor[VOLINT_STATS_TIME_IDX_5]);
774 " |-------------------------------------------|\n");
775 } /*Volume status OK */
776 else if (a_xInfoP->status == VBUSY) {
778 qPut(&busyHead, a_xInfoP->volid);
780 fprintf(STDOUT, "**** Volume %lu is busy ****\n",
781 (unsigned long)a_xInfoP->volid);
785 qPut(¬okHead, a_xInfoP->volid);
787 fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
788 (unsigned long)a_xInfoP->volid);
789 } /*Screwed volume */
790 fprintf(STDOUT, "\n");
796 if (a_xInfoP->status == VOK) {
797 fprintf(STDOUT, "%-32s ", a_xInfoP->name);
798 fprintf(STDOUT, "%10lu ", (unsigned long)a_xInfoP->volid);
799 if (a_xInfoP->type == 0)
800 fprintf(STDOUT, "RW ");
801 if (a_xInfoP->type == 1)
802 fprintf(STDOUT, "RO ");
803 if (a_xInfoP->type == 2)
804 fprintf(STDOUT, "BK ");
805 fprintf(STDOUT, "%10d K ", a_xInfoP->size);
806 if (a_xInfoP->inUse == 1) {
807 fprintf(STDOUT, "On-line");
810 fprintf(STDOUT, "Off-line");
813 fprintf(STDOUT, "\n");
815 else if (a_xInfoP->status == VBUSY) {
817 qPut(&busyHead, a_xInfoP->volid);
819 fprintf(STDOUT, "**** Volume %lu is busy ****\n",
820 (unsigned long)a_xInfoP->volid);
824 qPut(¬okHead, a_xInfoP->volid);
826 fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
827 (unsigned long)a_xInfoP->volid);
828 } /*Screwed volume */
829 } /*Default listing */
830 } /*XDisplayFormat */
832 #ifdef FULL_LISTVOL_SWITCH
833 /*------------------------------------------------------------------------
834 * PRIVATE XDisplayFormat2
837 * Display the formated contents of one extended volume info structure.
840 * a_xInfoP : Ptr to extended volume info struct to print.
841 * a_servID : Server ID to print.
842 * a_partID : Partition ID to print.
843 * a_totalOKP : Ptr to total-OK counter.
844 * a_totalNotOKP : Ptr to total-screwed counter.
845 * a_totalBusyP : Ptr to total-busy counter.
846 * a_fast : Fast listing?
847 * a_int32 : Int32 listing?
848 * a_showProblems : Show volume problems?
854 * Nothing interesting.
858 *------------------------------------------------------------------------*/
861 XDisplayFormat2(a_xInfoP, a_servID, a_partID, a_totalOKP, a_totalNotOKP,
862 a_totalBusyP, a_fast, a_int32, a_showProblems)
863 volintXInfo *a_xInfoP;
873 { /*XDisplayFormat */
878 fprintf(STDOUT, "vold_id\t%-10lu\n", (unsigned long)a_xInfoP->volid);
879 } else if (a_int32) {
881 * Fully-detailed listing.
883 if (a_xInfoP->status == VOK) {
885 * Volume's status is OK - all the fields are valid.
888 static long server_cache = -1, partition_cache = -1;
889 static char hostname[256], address[32], pname[16];
890 int i,ai[] = {VOLINT_STATS_TIME_IDX_0,VOLINT_STATS_TIME_IDX_1,VOLINT_STATS_TIME_IDX_2,
891 VOLINT_STATS_TIME_IDX_3,VOLINT_STATS_TIME_IDX_4,VOLINT_STATS_TIME_IDX_5};
893 if (a_servID != server_cache) {
897 strcpy(hostname, hostutil_GetNameByINet(a_servID));
898 strcpy(address, inet_ntoa(s));
899 server_cache = a_servID;
901 if (a_partID != partition_cache) {
902 MapPartIdIntoName(a_partID, pname);
903 partition_cache = a_partID;
906 fprintf(STDOUT, "name\t\t%s\n", a_xInfoP->name);
907 fprintf(STDOUT, "id\t\t%lu\n", a_xInfoP->volid);
908 fprintf(STDOUT, "serv\t\t%s\t%s\n", address, hostname);
909 fprintf(STDOUT, "part\t\t%s\n", pname);
910 switch (a_xInfoP->status) {
912 fprintf(STDOUT, "status\t\tOK\n");
915 fprintf(STDOUT, "status\t\tBUSY\n");
918 fprintf(STDOUT, "status\t\tUNATTACHABLE\n");
921 fprintf(STDOUT, "backupID\t%lu\n", a_xInfoP->backupID);
922 fprintf(STDOUT, "parentID\t%lu\n", a_xInfoP->parentID);
923 fprintf(STDOUT, "cloneID\t\t%lu\n", a_xInfoP->cloneID);
924 fprintf(STDOUT, "inUse\t\t%s\n", a_xInfoP->inUse ? "Y" : "N");
925 switch (a_xInfoP->type) {
927 fprintf(STDOUT, "type\t\tRW\n");
930 fprintf(STDOUT, "type\t\tRO\n");
933 fprintf(STDOUT, "type\t\tBK\n");
936 fprintf(STDOUT, "type\t\t?\n");
939 fprintf(STDOUT, "creationDate\t%-9lu\t%s", a_xInfoP->creationDate,
940 vos_ctime(&a_xInfoP->creationDate));
941 fprintf(STDOUT, "accessDate\t%-9lu\t%s", a_xInfoP->accessDate,
942 vos_ctime(&a_xInfoP->accessDate));
943 fprintf(STDOUT, "updateDate\t%-9lu\t%s", a_xInfoP->updateDate,
944 vos_ctime(&a_xInfoP->updateDate));
945 fprintf(STDOUT, "backupDate\t%-9lu\t%s", a_xInfoP->backupDate,
946 vos_ctime(&a_xInfoP->backupDate));
947 fprintf(STDOUT, "copyDate\t%-9lu\t%s", a_xInfoP->copyDate,
948 vos_ctime(&a_xInfoP->copyDate));
950 fprintf(STDOUT, "diskused\t%u\n", a_xInfoP->size);
951 fprintf(STDOUT, "maxquota\t%u\n", a_xInfoP->maxquota);
953 fprintf(STDOUT, "filecount\t%u\n", a_xInfoP->filecount);
954 fprintf(STDOUT, "dayUse\t\t%u\n", a_xInfoP->dayUse);
958 fprintf(STDOUT,"reads_same_net\t%8d\n",a_xInfoP->stat_reads[VOLINT_STATS_SAME_NET]);
959 fprintf(STDOUT,"reads_same_net_auth\t%8d\n",a_xInfoP->stat_reads[VOLINT_STATS_SAME_NET_AUTH]);
960 fprintf(STDOUT,"reads_diff_net\t%8d\n",a_xInfoP->stat_reads[VOLINT_STATS_DIFF_NET]);
961 fprintf(STDOUT,"reads_diff_net_auth\t%8d\n",a_xInfoP->stat_reads[VOLINT_STATS_DIFF_NET_AUTH]);
963 fprintf(STDOUT,"writes_same_net\t%8d\n",a_xInfoP->stat_writes[VOLINT_STATS_SAME_NET]);
964 fprintf(STDOUT,"writes_same_net_auth\t%8d\n",a_xInfoP->stat_writes[VOLINT_STATS_SAME_NET_AUTH]);
965 fprintf(STDOUT,"writes_diff_net\t%8d\n",a_xInfoP->stat_writes[VOLINT_STATS_DIFF_NET]);
966 fprintf(STDOUT,"writes_diff_net_auth\t%8d\n",a_xInfoP->stat_writes[VOLINT_STATS_DIFF_NET_AUTH]);
970 fprintf(STDOUT,"file_same_author_idx_%d\t%8d\n",i+1,a_xInfoP->stat_fileSameAuthor[ai[i]]);
971 fprintf(STDOUT,"file_diff_author_idx_%d\t%8d\n",i+1,a_xInfoP->stat_fileDiffAuthor[ai[i]]);
972 fprintf(STDOUT,"dir_same_author_idx_%d\t%8d\n",i+1,a_xInfoP->stat_dirSameAuthor[ai[i]]);
973 fprintf(STDOUT,"dir_dif_author_idx_%d\t%8d\n",i+1,a_xInfoP->stat_dirDiffAuthor[ai[i]]);
976 } /*Volume status OK */
977 else if (a_xInfoP->status == VBUSY) {
979 qPut(&busyHead, a_xInfoP->volid);
981 fprintf(STDOUT, "BUSY_VOL\t%lu\n",
982 (unsigned long)a_xInfoP->volid);
986 qPut(¬okHead, a_xInfoP->volid);
988 fprintf(STDOUT, "COULD_NOT_ATTACH\t%lu\n",
989 (unsigned long)a_xInfoP->volid);
990 } /*Screwed volume */
996 if (a_xInfoP->status == VOK) {
997 fprintf(STDOUT, "name\t%-32s\n", a_xInfoP->name);
998 fprintf(STDOUT, "volID\t%10lu\n", (unsigned long)a_xInfoP->volid);
999 if (a_xInfoP->type == 0)
1000 fprintf(STDOUT, "type\tRW\n");
1001 if (a_xInfoP->type == 1)
1002 fprintf(STDOUT, "type\tRO\n");
1003 if (a_xInfoP->type == 2)
1004 fprintf(STDOUT, "type\tBK\n");
1005 fprintf(STDOUT, "size\t%10dK\n", a_xInfoP->size);
1007 fprintf(STDOUT, "inUse\t%d\n",a_xInfoP->inUse);
1008 if (a_xInfoP->inUse == 1)
1014 else if (a_xInfoP->status == VBUSY) {
1016 qPut(&busyHead, a_xInfoP->volid);
1018 fprintf(STDOUT, "VOLUME_BUSY\t%lu\n",
1019 (unsigned long)a_xInfoP->volid);
1023 qPut(¬okHead, a_xInfoP->volid);
1025 fprintf(STDOUT, "COULD_NOT_ATTACH_VOLUME\t%lu\n",
1026 (unsigned long)a_xInfoP->volid);
1027 } /*Screwed volume */
1028 } /*Default listing */
1029 } /*XDisplayFormat */
1030 #endif /*FULL_LISTVOL_SWITCH*/
1032 #ifdef FULL_LISTVOL_SWITCH
1034 DisplayFormat2(server, partition, pntr)
1035 long server, partition;
1038 static long server_cache = -1, partition_cache = -1;
1039 static char hostname[256], address[32], pname[16];
1041 if (server != server_cache) {
1045 strcpy(hostname, hostutil_GetNameByINet(server));
1046 strcpy(address, inet_ntoa(s));
1047 server_cache = server;
1049 if (partition != partition_cache) {
1050 MapPartIdIntoName(partition, pname);
1051 partition_cache = partition;
1053 fprintf(STDOUT, "name\t\t%s\n", pntr->name);
1054 fprintf(STDOUT, "id\t\t%lu\n", pntr->volid);
1055 fprintf(STDOUT, "serv\t\t%s\t%s\n", address, hostname);
1056 fprintf(STDOUT, "part\t\t%s\n", pname);
1057 switch (pntr->status) {
1059 fprintf(STDOUT, "status\t\tOK\n");
1062 fprintf(STDOUT, "status\t\tBUSY\n");
1065 fprintf(STDOUT, "status\t\tUNATTACHABLE\n");
1068 fprintf(STDOUT, "backupID\t%lu\n", pntr->backupID);
1069 fprintf(STDOUT, "parentID\t%lu\n", pntr->parentID);
1070 fprintf(STDOUT, "cloneID\t\t%lu\n", pntr->cloneID);
1071 fprintf(STDOUT, "inUse\t\t%s\n", pntr->inUse ? "Y" : "N");
1072 fprintf(STDOUT, "needsSalvaged\t%s\n", pntr->needsSalvaged ? "Y" : "N");
1073 /* 0xD3 is from afs/volume.h since I had trouble including the file */
1074 fprintf(STDOUT, "destroyMe\t%s\n", pntr->destroyMe == 0xD3 ? "Y" : "N");
1075 switch (pntr->type) {
1077 fprintf(STDOUT, "type\t\tRW\n");
1080 fprintf(STDOUT, "type\t\tRO\n");
1083 fprintf(STDOUT, "type\t\tBK\n");
1086 fprintf(STDOUT, "type\t\t?\n");
1089 fprintf(STDOUT, "creationDate\t%-9lu\t%s", pntr->creationDate,
1090 vos_ctime(&pntr->creationDate));
1091 fprintf(STDOUT, "accessDate\t%-9lu\t%s", pntr->accessDate,
1092 vos_ctime(&pntr->accessDate));
1093 fprintf(STDOUT, "updateDate\t%-9lu\t%s", pntr->updateDate,
1094 vos_ctime(&pntr->updateDate));
1095 fprintf(STDOUT, "backupDate\t%-9lu\t%s", pntr->backupDate,
1096 vos_ctime(&pntr->backupDate));
1097 fprintf(STDOUT, "copyDate\t%-9lu\t%s", pntr->copyDate,
1098 vos_ctime(&pntr->copyDate));
1099 fprintf(STDOUT, "flags\t\t%#lx\t(Optional)\n", pntr->flags);
1100 fprintf(STDOUT, "diskused\t%u\n", pntr->size);
1101 fprintf(STDOUT, "maxquota\t%u\n", pntr->maxquota);
1102 fprintf(STDOUT, "minquota\t%lu\t(Optional)\n", pntr->spare0);
1103 fprintf(STDOUT, "filecount\t%u\n", pntr->filecount);
1104 fprintf(STDOUT, "dayUse\t\t%u\n", pntr->dayUse);
1105 fprintf(STDOUT, "weekUse\t\t%lu\t(Optional)\n", pntr->spare1);
1106 fprintf(STDOUT, "spare2\t\t%lu\t(Optional)\n", pntr->spare2);
1107 fprintf(STDOUT, "spare3\t\t%lu\t(Optional)\n", pntr->spare3);
1112 DisplayVolumes2(server, partition, pntr, count)
1114 long server, partition, count;
1118 for (i = 0; i < count; i++) {
1119 fprintf(STDOUT, "BEGIN_OF_ENTRY\n");
1120 DisplayFormat2(server, partition, pntr);
1121 fprintf(STDOUT, "END_OF_ENTRY\n\n");
1126 #endif /* FULL_LISTVOL_SWITCH */
1129 DisplayVolumes(server, part, pntr, count, longlist, fast, quiet)
1130 afs_int32 server, part;
1132 afs_int32 count, longlist, fast;
1135 int totalOK, totalNotOK, totalBusy, i;
1136 afs_int32 volid = 0;
1143 for (i = 0; i < count; i++) {
1144 DisplayFormat(pntr, server, part, &totalOK, &totalNotOK, &totalBusy,
1149 while (busyHead.count) {
1150 qGet(&busyHead, &volid);
1151 fprintf(STDOUT, "**** Volume %lu is busy ****\n",
1152 (unsigned long)volid);
1156 while (notokHead.count) {
1157 qGet(¬okHead, &volid);
1158 fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
1159 (unsigned long)volid);
1163 fprintf(STDOUT, "\n");
1166 "Total volumes onLine %d ; Total volumes offLine %d ; Total busy %d\n\n",
1167 totalOK, totalNotOK, totalBusy);
1171 /*------------------------------------------------------------------------
1172 * PRIVATE XDisplayVolumes
1175 * Display extended volume information.
1178 * a_servID : Pointer to the Rx call we're performing.
1179 * a_partID : Partition for which we want the extended list.
1180 * a_xInfoP : Ptr to extended volume info.
1181 * a_count : Number of volume records contained above.
1182 * a_int32 : Int32 listing generated?
1183 * a_fast : Fast listing generated?
1184 * a_quiet : Quiet listing generated?
1190 * Nothing interesting.
1194 *------------------------------------------------------------------------*/
1197 XDisplayVolumes(a_servID, a_partID, a_xInfoP, a_count, a_int32, a_fast,
1201 volintXInfo *a_xInfoP;
1207 { /*XDisplayVolumes */
1209 int totalOK; /*Total OK volumes */
1210 int totalNotOK; /*Total screwed volumes */
1211 int totalBusy; /*Total busy volumes */
1212 int i; /*Loop variable */
1213 afs_int32 volid = 0; /*Current volume ID */
1216 * Initialize counters and (global!!) queues.
1225 * Display each volume in the list.
1227 for (i = 0; i < a_count; i++) {
1228 XDisplayFormat(a_xInfoP, a_servID, a_partID, &totalOK, &totalNotOK,
1229 &totalBusy, a_fast, a_int32, 0);
1234 * If any volumes were found to be busy or screwed, display them.
1237 while (busyHead.count) {
1238 qGet(&busyHead, &volid);
1239 fprintf(STDOUT, "**** Volume %lu is busy ****\n",
1240 (unsigned long)volid);
1244 while (notokHead.count) {
1245 qGet(¬okHead, &volid);
1246 fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
1247 (unsigned long)volid);
1252 fprintf(STDOUT, "\n");
1255 "Total volumes: %d on-line, %d off-line, %d busyd\n\n",
1256 totalOK, totalNotOK, totalBusy);
1260 } /*XDisplayVolumes */
1261 #ifdef FULL_LISTVOL_SWITCH
1262 /*------------------------------------------------------------------------
1263 * PRIVATE XDisplayVolumes2
1266 * Display extended formated volume information.
1269 * a_servID : Pointer to the Rx call we're performing.
1270 * a_partID : Partition for which we want the extended list.
1271 * a_xInfoP : Ptr to extended volume info.
1272 * a_count : Number of volume records contained above.
1273 * a_int32 : Int32 listing generated?
1274 * a_fast : Fast listing generated?
1275 * a_quiet : Quiet listing generated?
1281 * Nothing interesting.
1285 *------------------------------------------------------------------------*/
1288 XDisplayVolumes2(a_servID, a_partID, a_xInfoP, a_count, a_int32, a_fast,
1292 volintXInfo *a_xInfoP;
1298 { /*XDisplayVolumes */
1300 int totalOK; /*Total OK volumes */
1301 int totalNotOK; /*Total screwed volumes */
1302 int totalBusy; /*Total busy volumes */
1303 int i; /*Loop variable */
1304 afs_int32 volid = 0; /*Current volume ID */
1307 * Initialize counters and (global!!) queues.
1316 * Display each volume in the list.
1318 for (i = 0; i < a_count; i++) {
1319 fprintf(STDOUT, "BEGIN_OF_ENTRY\n");
1320 XDisplayFormat2(a_xInfoP, a_servID, a_partID, &totalOK, &totalNotOK,
1321 &totalBusy, a_fast, a_int32, 0);
1322 fprintf(STDOUT, "END_OF_ENTRY\n");
1327 * If any volumes were found to be busy or screwed, display them.
1330 while (busyHead.count) {
1331 qGet(&busyHead, &volid);
1332 fprintf(STDOUT, "BUSY_VOL\t%lu\n",
1333 (unsigned long)volid);
1337 while (notokHead.count) {
1338 qGet(¬okHead, &volid);
1339 fprintf(STDOUT, "COULD_NOT_ATTACH\t%lu\n",
1340 (unsigned long)volid);
1345 fprintf(STDOUT, "\n");
1348 "VOLUMES_ONLINE\t%d\nVOLUMES_OFFLINE\t%d\nVOLUMES_BUSY\t%d\n",
1349 totalOK, totalNotOK, totalBusy);
1353 } /*XDisplayVolumes2 */
1354 #endif /* FULL_LISTVOL_SWITCH */
1357 /* set <server> and <part> to the correct values depending on
1358 * <voltype> and <entry> */
1360 GetServerAndPart(entry, voltype, server, part, previdx)
1361 struct nvldbentry *entry;
1362 afs_int32 *server, *part;
1366 int i, istart, vtype;
1371 /* Doesn't check for non-existance of backup volume */
1372 if ((voltype == RWVOL) || (voltype == BACKVOL)) {
1374 istart = 0; /* seach the entire entry */
1377 /* Seach from beginning of entry or pick up where we left off */
1378 istart = ((*previdx < 0) ? 0 : *previdx + 1);
1381 for (i = istart; i < entry->nServers; i++) {
1382 if (entry->serverFlags[i] & vtype) {
1383 *server = entry->serverNumber[i];
1384 *part = entry->serverPartition[i];
1390 /* Didn't find any, return -1 */
1396 PostVolumeStats(struct nvldbentry *entry)
1398 SubEnumerateEntry(entry);
1399 /* Check for VLOP_ALLOPERS */
1400 if (entry->flags & VLOP_ALLOPERS)
1401 fprintf(STDOUT, " Volume is currently LOCKED \n");
1405 /*------------------------------------------------------------------------
1406 * PRIVATE XVolumeStats
1409 * Display extended volume information.
1412 * a_xInfoP : Ptr to extended volume info.
1413 * a_entryP : Ptr to the volume's VLDB entry.
1414 * a_srvID : Server ID.
1415 * a_partID : Partition ID.
1416 * a_volType : Type of volume to print.
1422 * Nothing interesting.
1426 *------------------------------------------------------------------------*/
1429 XVolumeStats(a_xInfoP, a_entryP, a_srvID, a_partID, a_volType)
1430 volintXInfo *a_xInfoP;
1431 struct nvldbentry *a_entryP;
1438 int totalOK, totalNotOK, totalBusy; /*Dummies - we don't really count here */
1440 XDisplayFormat(a_xInfoP, /*Ptr to extended volume info */
1441 a_srvID, /*Server ID to print */
1442 a_partID, /*Partition ID to print */
1443 &totalOK, /*Ptr to total-OK counter */
1444 &totalNotOK, /*Ptr to total-screwed counter */
1445 &totalBusy, /*Ptr to total-busy counter */
1446 0, /*Don't do a fast listing */
1447 1, /*Do a long listing */
1448 1); /*Show volume problems */
1454 VolumeStats_int(volintInfo *pntr, struct nvldbentry *entry, afs_int32 server,
1455 afs_int32 part, int voltype)
1457 int totalOK, totalNotOK, totalBusy;
1459 DisplayFormat(pntr, server, part, &totalOK, &totalNotOK, &totalBusy, 0, 1,
1464 /* command to forcibly remove a volume */
1466 NukeVolume(register struct cmd_syndesc *as)
1468 register afs_int32 code;
1469 afs_int32 volID, err;
1474 server = GetServer(tp = as->parms[0].items->data);
1476 fprintf(STDERR, "vos: server '%s' not found in host table\n", tp);
1480 partID = volutil_GetPartitionID(tp = as->parms[1].items->data);
1482 fprintf(STDERR, "vos: could not parse '%s' as a partition name", tp);
1486 volID = vsu_GetVolumeID(tp = as->parms[2].items->data, cstruct, &err);
1489 PrintError("", err);
1492 "vos: could not parse '%s' as a numeric volume ID", tp);
1497 "vos: forcibly removing all traces of volume %d, please wait...",
1500 code = UV_NukeVolume(server, partID, volID);
1502 fprintf(STDOUT, "done.\n");
1504 fprintf(STDOUT, "failed with code %d.\n", code);
1509 /*------------------------------------------------------------------------
1510 * PRIVATE ExamineVolume
1513 * Routine used to examine a single volume, contacting the VLDB as
1514 * well as the Volume Server.
1517 * as : Ptr to parsed command line arguments.
1520 * 0 for a successful operation,
1521 * Otherwise, one of the ubik or VolServer error values.
1524 * Nothing interesting.
1528 *------------------------------------------------------------------------
1531 ExamineVolume(register struct cmd_syndesc *as, void *arock)
1533 struct nvldbentry entry;
1534 afs_int32 vcode = 0;
1535 volintInfo *pntr = (volintInfo *) 0;
1536 volintXInfo *xInfoP = (volintXInfo *) 0;
1538 afs_int32 code, err, error = 0;
1539 int voltype, foundserv = 0, foundentry = 0;
1540 afs_int32 aserver, apart;
1542 int wantExtendedInfo; /*Do we want extended vol info? */
1544 wantExtendedInfo = (as->parms[1].items ? 1 : 0); /* -extended */
1546 volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err); /* -id */
1549 PrintError("", err);
1551 fprintf(STDERR, "Unknown volume ID or name '%s'\n",
1552 as->parms[0].items->data);
1557 fprintf(STDOUT, "Fetching VLDB entry for %lu .. ",
1558 (unsigned long)volid);
1561 vcode = VLDB_GetEntryByID(volid, -1, &entry);
1564 "Could not fetch the entry for volume number %lu from VLDB \n",
1565 (unsigned long)volid);
1569 fprintf(STDOUT, "done\n");
1570 MapHostToNetwork(&entry);
1572 if (entry.volumeId[RWVOL] == volid)
1574 else if (entry.volumeId[BACKVOL] == volid)
1576 else /* (entry.volumeId[ROVOL] == volid) */
1579 do { /* do {...} while (voltype == ROVOL) */
1580 /* Get the entry for the volume. If its a RW vol, get the RW entry.
1581 * It its a BK vol, get the RW entry (even if VLDB may say the BK doen't exist).
1582 * If its a RO vol, get the next RO entry.
1584 GetServerAndPart(&entry, ((voltype == ROVOL) ? ROVOL : RWVOL),
1585 &aserver, &apart, &previdx);
1586 if (previdx == -1) { /* searched all entries */
1588 fprintf(STDERR, "Volume %s does not exist in VLDB\n\n",
1589 as->parms[0].items->data);
1596 /* Get information about the volume from the server */
1598 fprintf(STDOUT, "Getting volume listing from the server %s .. ",
1599 hostutil_GetNameByINet(aserver));
1602 if (wantExtendedInfo)
1603 code = UV_XListOneVolume(aserver, apart, volid, &xInfoP);
1605 code = UV_ListOneVolume(aserver, apart, volid, &pntr);
1607 fprintf(STDOUT, "done\n");
1611 if (code == ENODEV) {
1612 if ((voltype == BACKVOL) && !(entry.flags & BACK_EXISTS)) {
1613 /* The VLDB says there is no backup volume and its not on disk */
1614 fprintf(STDERR, "Volume %s does not exist\n",
1615 as->parms[0].items->data);
1619 "Volume does not exist on server %s as indicated by the VLDB\n",
1620 hostutil_GetNameByINet(aserver));
1623 PrintDiagnostics("examine", code);
1625 fprintf(STDOUT, "\n");
1628 if (wantExtendedInfo)
1629 XVolumeStats(xInfoP, &entry, aserver, apart, voltype);
1631 #ifdef FULL_LISTVOL_SWITCH
1632 if (as->parms[2].items) {
1633 DisplayFormat2(aserver, apart, pntr);
1634 EnumerateEntry(&entry);
1636 #endif /* FULL_LISTVOL_SWITCH */
1637 VolumeStats_int(pntr, &entry, aserver, apart, voltype);
1639 if ((voltype == BACKVOL) && !(entry.flags & BACK_EXISTS)) {
1640 /* The VLDB says there is no backup volume yet we found one on disk */
1641 fprintf(STDERR, "Volume %s does not exist in VLDB\n",
1642 as->parms[0].items->data);
1651 } while (voltype == ROVOL);
1654 fprintf(STDERR, "Dump only information from VLDB\n\n");
1655 fprintf(STDOUT, "%s \n", entry.name); /* PostVolumeStats doesn't print name */
1657 PostVolumeStats(&entry);
1662 /*------------------------------------------------------------------------
1666 * Routine used to change the status of a single volume.
1669 * as : Ptr to parsed command line arguments.
1672 * 0 for a successful operation,
1673 * Otherwise, one of the ubik or VolServer error values.
1676 * Nothing interesting.
1680 *------------------------------------------------------------------------
1683 SetFields(register struct cmd_syndesc *as, void *arock)
1685 struct nvldbentry entry;
1686 afs_int32 vcode = 0;
1689 afs_int32 code, err;
1690 afs_int32 aserver, apart;
1693 volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err); /* -id */
1696 PrintError("", err);
1698 fprintf(STDERR, "Unknown volume ID or name '%s'\n",
1699 as->parms[0].items->data);
1703 code = VLDB_GetEntryByID(volid, RWVOL, &entry);
1706 "Could not fetch the entry for volume number %lu from VLDB \n",
1707 (unsigned long)volid);
1710 MapHostToNetwork(&entry);
1712 GetServerAndPart(&entry, RWVOL, &aserver, &apart, &previdx);
1713 if (previdx == -1) {
1714 fprintf(STDERR, "Volume %s does not exist in VLDB\n\n",
1715 as->parms[0].items->data);
1719 init_volintInfo(&info);
1723 if (as->parms[1].items) {
1725 code = util_GetInt32(as->parms[1].items->data, &info.maxquota);
1727 fprintf(STDERR, "invalid quota value\n");
1731 if (as->parms[2].items) {
1735 if (as->parms[3].items) {
1736 /* -clearVolUpCounter */
1739 code = UV_SetVolumeInfo(aserver, apart, volid, &info);
1742 "Could not update volume info fields for volume number %lu\n",
1743 (unsigned long)volid);
1747 /*------------------------------------------------------------------------
1751 * Brings a volume online.
1754 * as : Ptr to parsed command line arguments.
1757 * 0 for a successful operation,
1760 * Nothing interesting.
1764 *------------------------------------------------------------------------
1767 volOnline(register struct cmd_syndesc *as, void *arock)
1769 afs_int32 server, partition, volid;
1770 afs_int32 code, err = 0;
1772 server = GetServer(as->parms[0].items->data);
1774 fprintf(STDERR, "vos: server '%s' not found in host table\n",
1775 as->parms[0].items->data);
1779 partition = volutil_GetPartitionID(as->parms[1].items->data);
1780 if (partition < 0) {
1781 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
1782 as->parms[1].items->data);
1786 volid = vsu_GetVolumeID(as->parms[2].items->data, cstruct, &err); /* -id */
1789 PrintError("", err);
1791 fprintf(STDERR, "Unknown volume ID or name '%s'\n",
1792 as->parms[0].items->data);
1796 code = UV_SetVolume(server, partition, volid, ITOffline, 0 /*online */ ,
1799 fprintf(STDERR, "Failed to set volume. Code = %d\n", code);
1806 /*------------------------------------------------------------------------
1807 * PRIVATE volOffline
1810 * Brings a volume offline.
1813 * as : Ptr to parsed command line arguments.
1816 * 0 for a successful operation,
1819 * Nothing interesting.
1823 *------------------------------------------------------------------------
1826 volOffline(register struct cmd_syndesc *as, void *arock)
1828 afs_int32 server, partition, volid;
1829 afs_int32 code, err = 0;
1830 afs_int32 transflag, sleeptime, transdone;
1832 server = GetServer(as->parms[0].items->data);
1834 fprintf(STDERR, "vos: server '%s' not found in host table\n",
1835 as->parms[0].items->data);
1839 partition = volutil_GetPartitionID(as->parms[1].items->data);
1840 if (partition < 0) {
1841 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
1842 as->parms[1].items->data);
1846 volid = vsu_GetVolumeID(as->parms[2].items->data, cstruct, &err); /* -id */
1849 PrintError("", err);
1851 fprintf(STDERR, "Unknown volume ID or name '%s'\n",
1852 as->parms[0].items->data);
1856 transflag = (as->parms[4].items ? ITBusy : ITOffline);
1857 sleeptime = (as->parms[3].items ? atol(as->parms[3].items->data) : 0);
1858 transdone = (sleeptime ? 0 /*online */ : VTOutOfService);
1859 if (as->parms[4].items && !as->parms[3].items) {
1860 fprintf(STDERR, "-sleep option must be used with -busy flag\n");
1865 UV_SetVolume(server, partition, volid, transflag, transdone,
1868 fprintf(STDERR, "Failed to set volume. Code = %d\n", code);
1876 CreateVolume(register struct cmd_syndesc *as, void *arock)
1880 afs_int32 volid, code;
1881 struct nvldbentry entry;
1886 tserver = GetServer(as->parms[0].items->data);
1888 fprintf(STDERR, "vos: host '%s' not found in host table\n",
1889 as->parms[0].items->data);
1892 pnum = volutil_GetPartitionID(as->parms[1].items->data);
1894 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
1895 as->parms[1].items->data);
1898 if (!IsPartValid(pnum, tserver, &code)) { /*check for validity of the partition */
1900 PrintError("", code);
1903 "vos : partition %s does not exist on the server\n",
1904 as->parms[1].items->data);
1907 if (!ISNAMEVALID(as->parms[2].items->data)) {
1909 "vos: the name of the root volume %s exceeds the size limit of %d\n",
1910 as->parms[2].items->data, VOLSER_OLDMAXVOLNAME - 10);
1913 if (!VolNameOK(as->parms[2].items->data)) {
1915 "Illegal volume name %s, should not end in .readonly or .backup\n",
1916 as->parms[2].items->data);
1919 if (IsNumeric(as->parms[2].items->data)) {
1920 fprintf(STDERR, "Illegal volume name %s, should not be a number\n",
1921 as->parms[2].items->data);
1924 vcode = VLDB_GetEntryByName(as->parms[2].items->data, &entry);
1926 fprintf(STDERR, "Volume %s already exists\n",
1927 as->parms[2].items->data);
1928 PrintDiagnostics("create", code);
1932 if (as->parms[3].items) {
1933 if (!IsNumeric(as->parms[3].items->data)) {
1934 fprintf(STDERR, "Initial quota %s should be numeric.\n",
1935 as->parms[3].items->data);
1939 code = util_GetInt32(as->parms[3].items->data, "a);
1941 fprintf(STDERR, "vos: bad integer specified for quota.\n");
1947 UV_CreateVolume2(tserver, pnum, as->parms[2].items->data, quota, 0,
1950 PrintDiagnostics("create", code);
1953 MapPartIdIntoName(pnum, part);
1954 fprintf(STDOUT, "Volume %lu created on partition %s of %s\n",
1955 (unsigned long)volid, part, as->parms[0].items->data);
1962 struct nvldbentry *entry;
1965 afs_int32 error, code, curserver, curpart, volid;
1967 MapHostToNetwork(entry);
1969 for (i = 0; i < entry->nServers; i++) {
1970 curserver = entry->serverNumber[i];
1971 curpart = entry->serverPartition[i];
1972 if (entry->serverFlags[i] & ITSROVOL) {
1973 volid = entry->volumeId[ROVOL];
1975 volid = entry->volumeId[RWVOL];
1977 code = UV_DeleteVolume(curserver, curpart, volid);
1985 DeleteVolume(struct cmd_syndesc *as, void *arock)
1987 afs_int32 err, code = 0;
1988 afs_int32 server = 0, partition = -1, volid;
1992 if (as->parms[0].items) {
1993 server = GetServer(as->parms[0].items->data);
1995 fprintf(STDERR, "vos: server '%s' not found in host table\n",
1996 as->parms[0].items->data);
2001 if (as->parms[1].items) {
2002 partition = volutil_GetPartitionID(as->parms[1].items->data);
2003 if (partition < 0) {
2004 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
2005 as->parms[1].items->data);
2009 /* Check for validity of the partition */
2010 if (!IsPartValid(partition, server, &code)) {
2012 PrintError("", code);
2015 "vos : partition %s does not exist on the server\n",
2016 as->parms[1].items->data);
2022 volid = vsu_GetVolumeID(as->parms[2].items->data, cstruct, &err);
2024 fprintf(STDERR, "Can't find volume name '%s' in VLDB\n",
2025 as->parms[2].items->data);
2027 PrintError("", err);
2031 /* If the server or partition option are not complete, try to fill
2032 * them in from the VLDB entry.
2034 if ((partition == -1) || !server) {
2035 struct nvldbentry entry;
2037 code = VLDB_GetEntryByID(volid, -1, &entry);
2040 "Could not fetch the entry for volume %lu from VLDB\n",
2041 (unsigned long)volid);
2042 PrintError("", code);
2046 if (((volid == entry.volumeId[RWVOL]) && (entry.flags & RW_EXISTS))
2047 || ((volid == entry.volumeId[BACKVOL])
2048 && (entry.flags & BACK_EXISTS))) {
2049 idx = Lp_GetRwIndex(&entry);
2050 if ((idx == -1) || (server && (server != entry.serverNumber[idx]))
2051 || ((partition != -1)
2052 && (partition != entry.serverPartition[idx]))) {
2053 fprintf(STDERR, "VLDB: Volume '%s' no match\n",
2054 as->parms[2].items->data);
2057 } else if ((volid == entry.volumeId[ROVOL])
2058 && (entry.flags & RO_EXISTS)) {
2059 for (idx = -1, j = 0; j < entry.nServers; j++) {
2060 if (entry.serverFlags[j] != ITSROVOL)
2063 if (((server == 0) || (server == entry.serverNumber[j]))
2064 && ((partition == -1)
2065 || (partition == entry.serverPartition[j]))) {
2068 "VLDB: Volume '%s' matches more than one RO\n",
2069 as->parms[2].items->data);
2076 fprintf(STDERR, "VLDB: Volume '%s' no match\n",
2077 as->parms[2].items->data);
2081 fprintf(STDERR, "VLDB: Volume '%s' no match\n",
2082 as->parms[2].items->data);
2086 server = htonl(entry.serverNumber[idx]);
2087 partition = entry.serverPartition[idx];
2091 code = UV_DeleteVolume(server, partition, volid);
2093 PrintDiagnostics("remove", code);
2097 MapPartIdIntoName(partition, pname);
2098 fprintf(STDOUT, "Volume %lu on partition %s server %s deleted\n",
2099 (unsigned long)volid, pname, hostutil_GetNameByINet(server));
2103 #define TESTM 0 /* set for move space tests, clear for production */
2105 MoveVolume(register struct cmd_syndesc *as, void *arock)
2108 afs_int32 volid, fromserver, toserver, frompart, topart;
2109 afs_int32 flags, code, err;
2110 char fromPartName[10], toPartName[10];
2112 struct diskPartition64 partition; /* for space check */
2115 volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
2118 PrintError("", err);
2120 fprintf(STDERR, "vos: can't find volume ID or name '%s'\n",
2121 as->parms[0].items->data);
2124 fromserver = GetServer(as->parms[1].items->data);
2125 if (fromserver == 0) {
2126 fprintf(STDERR, "vos: server '%s' not found in host table\n",
2127 as->parms[1].items->data);
2130 toserver = GetServer(as->parms[3].items->data);
2131 if (toserver == 0) {
2132 fprintf(STDERR, "vos: server '%s' not found in host table\n",
2133 as->parms[3].items->data);
2136 frompart = volutil_GetPartitionID(as->parms[2].items->data);
2138 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
2139 as->parms[2].items->data);
2142 if (!IsPartValid(frompart, fromserver, &code)) { /*check for validity of the partition */
2144 PrintError("", code);
2147 "vos : partition %s does not exist on the server\n",
2148 as->parms[2].items->data);
2151 topart = volutil_GetPartitionID(as->parms[4].items->data);
2153 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
2154 as->parms[4].items->data);
2157 if (!IsPartValid(topart, toserver, &code)) { /*check for validity of the partition */
2159 PrintError("", code);
2162 "vos : partition %s does not exist on the server\n",
2163 as->parms[4].items->data);
2168 if (as->parms[5].items) flags |= RV_NOCLONE;
2171 * check source partition for space to clone volume
2174 MapPartIdIntoName(topart, toPartName);
2175 MapPartIdIntoName(frompart, fromPartName);
2178 * check target partition for space to move volume
2181 code = UV_PartitionInfo64(toserver, toPartName, &partition);
2183 fprintf(STDERR, "vos: cannot access partition %s\n", toPartName);
2187 fprintf(STDOUT, "target partition %s free space %" AFS_INT64_FMT "\n", toPartName,
2190 p = (volintInfo *) 0;
2191 code = UV_ListOneVolume(fromserver, frompart, volid, &p);
2193 fprintf(STDERR, "vos:cannot access volume %lu\n",
2194 (unsigned long)volid);
2198 fprintf(STDOUT, "volume %lu size %d\n", (unsigned long)volid,
2200 if (partition.free <= p->size) {
2202 "vos: no space on target partition %s to move volume %lu\n",
2203 toPartName, (unsigned long)volid);
2210 fprintf(STDOUT, "size test - don't do move\n");
2214 /* successful move still not guaranteed but shoot for it */
2217 UV_MoveVolume2(volid, fromserver, frompart, toserver, topart, flags);
2219 PrintDiagnostics("move", code);
2222 MapPartIdIntoName(topart, toPartName);
2223 MapPartIdIntoName(frompart, fromPartName);
2224 fprintf(STDOUT, "Volume %lu moved from %s %s to %s %s \n",
2225 (unsigned long)volid, as->parms[1].items->data, fromPartName,
2226 as->parms[3].items->data, toPartName);
2232 CopyVolume(register struct cmd_syndesc *as, void *arock)
2234 afs_int32 volid, fromserver, toserver, frompart, topart, code, err, flags;
2235 char fromPartName[10], toPartName[10], *tovolume;
2236 struct nvldbentry entry;
2237 struct diskPartition64 partition; /* for space check */
2240 volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
2243 PrintError("", err);
2245 fprintf(STDERR, "vos: can't find volume ID or name '%s'\n",
2246 as->parms[0].items->data);
2249 fromserver = GetServer(as->parms[1].items->data);
2250 if (fromserver == 0) {
2251 fprintf(STDERR, "vos: server '%s' not found in host table\n",
2252 as->parms[1].items->data);
2256 toserver = GetServer(as->parms[4].items->data);
2257 if (toserver == 0) {
2258 fprintf(STDERR, "vos: server '%s' not found in host table\n",
2259 as->parms[4].items->data);
2263 tovolume = as->parms[3].items->data;
2264 if (!ISNAMEVALID(tovolume)) {
2266 "vos: the name of the root volume %s exceeds the size limit of %d\n",
2267 tovolume, VOLSER_OLDMAXVOLNAME - 10);
2270 if (!VolNameOK(tovolume)) {
2272 "Illegal volume name %s, should not end in .readonly or .backup\n",
2276 if (IsNumeric(tovolume)) {
2277 fprintf(STDERR, "Illegal volume name %s, should not be a number\n",
2281 code = VLDB_GetEntryByName(tovolume, &entry);
2283 fprintf(STDERR, "Volume %s already exists\n", tovolume);
2284 PrintDiagnostics("copy", code);
2288 frompart = volutil_GetPartitionID(as->parms[2].items->data);
2290 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
2291 as->parms[2].items->data);
2294 if (!IsPartValid(frompart, fromserver, &code)) { /*check for validity of the partition */
2296 PrintError("", code);
2299 "vos : partition %s does not exist on the server\n",
2300 as->parms[2].items->data);
2304 topart = volutil_GetPartitionID(as->parms[5].items->data);
2306 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
2307 as->parms[5].items->data);
2310 if (!IsPartValid(topart, toserver, &code)) { /*check for validity of the partition */
2312 PrintError("", code);
2315 "vos : partition %s does not exist on the server\n",
2316 as->parms[5].items->data);
2321 if (as->parms[6].items) flags |= RV_OFFLINE;
2322 if (as->parms[7].items) flags |= RV_RDONLY;
2323 if (as->parms[8].items) flags |= RV_NOCLONE;
2325 MapPartIdIntoName(topart, toPartName);
2326 MapPartIdIntoName(frompart, fromPartName);
2329 * check target partition for space to move volume
2332 code = UV_PartitionInfo64(toserver, toPartName, &partition);
2334 fprintf(STDERR, "vos: cannot access partition %s\n", toPartName);
2338 fprintf(STDOUT, "target partition %s free space %" AFS_INT64_FMT "\n", toPartName,
2341 p = (volintInfo *) 0;
2342 code = UV_ListOneVolume(fromserver, frompart, volid, &p);
2344 fprintf(STDERR, "vos:cannot access volume %lu\n",
2345 (unsigned long)volid);
2349 if (partition.free <= p->size) {
2351 "vos: no space on target partition %s to copy volume %lu\n",
2352 toPartName, (unsigned long)volid);
2358 /* successful copy still not guaranteed but shoot for it */
2361 UV_CopyVolume2(volid, fromserver, frompart, tovolume, toserver,
2364 PrintDiagnostics("copy", code);
2367 MapPartIdIntoName(topart, toPartName);
2368 MapPartIdIntoName(frompart, fromPartName);
2369 fprintf(STDOUT, "Volume %lu copied from %s %s to %s on %s %s \n",
2370 (unsigned long)volid, as->parms[1].items->data, fromPartName,
2371 tovolume, as->parms[4].items->data, toPartName);
2378 ShadowVolume(register struct cmd_syndesc *as, void *arock)
2380 afs_int32 volid, fromserver, toserver, frompart, topart, tovolid;
2381 afs_int32 code, err, flags;
2382 char fromPartName[10], toPartName[10], toVolName[32], *tovolume;
2383 struct diskPartition64 partition; /* for space check */
2386 p = (volintInfo *) 0;
2387 q = (volintInfo *) 0;
2389 volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
2392 PrintError("", err);
2394 fprintf(STDERR, "vos: can't find volume ID or name '%s'\n",
2395 as->parms[0].items->data);
2398 fromserver = GetServer(as->parms[1].items->data);
2399 if (fromserver == 0) {
2400 fprintf(STDERR, "vos: server '%s' not found in host table\n",
2401 as->parms[1].items->data);
2405 toserver = GetServer(as->parms[3].items->data);
2406 if (toserver == 0) {
2407 fprintf(STDERR, "vos: server '%s' not found in host table\n",
2408 as->parms[3].items->data);
2412 frompart = volutil_GetPartitionID(as->parms[2].items->data);
2414 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
2415 as->parms[2].items->data);
2418 if (!IsPartValid(frompart, fromserver, &code)) { /*check for validity of the partition */
2420 PrintError("", code);
2423 "vos : partition %s does not exist on the server\n",
2424 as->parms[2].items->data);
2428 topart = volutil_GetPartitionID(as->parms[4].items->data);
2430 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
2431 as->parms[4].items->data);
2434 if (!IsPartValid(topart, toserver, &code)) { /*check for validity of the partition */
2436 PrintError("", code);
2439 "vos : partition %s does not exist on the server\n",
2440 as->parms[4].items->data);
2444 if (as->parms[5].items) {
2445 tovolume = as->parms[5].items->data;
2446 if (!ISNAMEVALID(tovolume)) {
2448 "vos: the name of the root volume %s exceeds the size limit of %d\n",
2449 tovolume, VOLSER_OLDMAXVOLNAME - 10);
2452 if (!VolNameOK(tovolume)) {
2454 "Illegal volume name %s, should not end in .readonly or .backup\n",
2458 if (IsNumeric(tovolume)) {
2460 "Illegal volume name %s, should not be a number\n",
2465 /* use actual name of source volume */
2466 code = UV_ListOneVolume(fromserver, frompart, volid, &p);
2468 fprintf(STDERR, "vos:cannot access volume %lu\n",
2469 (unsigned long)volid);
2472 strcpy(toVolName, p->name);
2473 tovolume = toVolName;
2474 /* save p for size checks later */
2477 if (as->parms[6].items) {
2478 tovolid = vsu_GetVolumeID(as->parms[6].items->data, cstruct, &err);
2481 PrintError("", err);
2483 fprintf(STDERR, "vos: can't find volume ID or name '%s'\n",
2484 as->parms[6].items->data);
2490 tovolid = vsu_GetVolumeID(tovolume, cstruct, &err);
2493 PrintError("", err);
2495 fprintf(STDERR, "vos: can't find volume ID or name '%s'\n",
2504 if (as->parms[7].items) flags |= RV_OFFLINE;
2505 if (as->parms[8].items) flags |= RV_RDONLY;
2506 if (as->parms[9].items) flags |= RV_NOCLONE;
2507 if (as->parms[10].items) flags |= RV_CPINCR;
2509 MapPartIdIntoName(topart, toPartName);
2510 MapPartIdIntoName(frompart, fromPartName);
2513 * check target partition for space to move volume
2516 code = UV_PartitionInfo64(toserver, toPartName, &partition);
2518 fprintf(STDERR, "vos: cannot access partition %s\n", toPartName);
2522 fprintf(STDOUT, "target partition %s free space %" AFS_INT64_FMT "\n", toPartName,
2525 /* Don't do this again if we did it above */
2527 code = UV_ListOneVolume(fromserver, frompart, volid, &p);
2529 fprintf(STDERR, "vos:cannot access volume %lu\n",
2530 (unsigned long)volid);
2535 /* OK if this fails */
2536 code = UV_ListOneVolume(toserver, topart, tovolid, &q);
2538 /* Treat existing volume size as "free" */
2540 p->size = (q->size < p->size) ? p->size - q->size : 0;
2542 if (partition.free <= p->size) {
2544 "vos: no space on target partition %s to copy volume %lu\n",
2545 toPartName, (unsigned long)volid);
2553 /* successful copy still not guaranteed but shoot for it */
2556 UV_CopyVolume2(volid, fromserver, frompart, tovolume, toserver,
2557 topart, tovolid, flags);
2559 PrintDiagnostics("shadow", code);
2562 MapPartIdIntoName(topart, toPartName);
2563 MapPartIdIntoName(frompart, fromPartName);
2564 fprintf(STDOUT, "Volume %lu shadowed from %s %s to %s %s \n",
2565 (unsigned long)volid, as->parms[1].items->data, fromPartName,
2566 as->parms[3].items->data, toPartName);
2573 CloneVolume(register struct cmd_syndesc *as, void *arock)
2575 afs_int32 server, part, volid, cloneid, voltype;
2576 char partName[10], *volname;
2577 afs_int32 code, err, flags;
2578 struct nvldbentry entry;
2580 volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
2583 PrintError("", err);
2585 fprintf(STDERR, "vos: can't find volume ID or name '%s'\n",
2586 as->parms[0].items->data);
2590 if (as->parms[1].items || as->parms[2].items) {
2591 if (!as->parms[1].items || !as->parms[2].items) {
2593 "Must specify both -server and -partition options\n");
2596 server = GetServer(as->parms[1].items->data);
2598 fprintf(STDERR, "vos: server '%s' not found in host table\n",
2599 as->parms[1].items->data);
2602 part = volutil_GetPartitionID(as->parms[2].items->data);
2604 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
2605 as->parms[2].items->data);
2608 if (!IsPartValid(part, server, &code)) { /*check for validity of the partition */
2610 PrintError("", code);
2613 "vos : partition %s does not exist on the server\n",
2614 as->parms[2].items->data);
2618 code = GetVolumeInfo(volid, &server, &part, &voltype, &entry);
2624 if (as->parms[3].items) {
2625 volname = as->parms[3].items->data;
2626 if (strlen(volname) > VOLSER_OLDMAXVOLNAME - 1) {
2628 "vos: the name of the root volume %s exceeds the size limit of %d\n",
2629 volname, VOLSER_OLDMAXVOLNAME - 1);
2634 * In order that you be able to make clones of RO or BK, this
2635 * check must be omitted.
2637 if (!VolNameOK(volname)) {
2639 "Illegal volume name %s, should not end in .readonly or .backup\n",
2644 if (IsNumeric(volname)) {
2646 "Illegal volume name %s, should not be a number\n",
2653 if (as->parms[4].items) {
2654 cloneid = vsu_GetVolumeID(as->parms[4].items->data, cstruct, &err);
2657 PrintError("", err);
2659 fprintf(STDERR, "vos: can't find volume ID or name '%s'\n",
2660 as->parms[4].items->data);
2666 if (as->parms[5].items) flags |= RV_OFFLINE;
2667 if (as->parms[6].items) flags |= RV_RDONLY;
2671 UV_CloneVolume(server, part, volid, cloneid, volname, flags);
2674 PrintDiagnostics("clone", code);
2677 MapPartIdIntoName(part, partName);
2678 fprintf(STDOUT, "Created clone for volume %s\n",
2679 as->parms[0].items->data);
2686 BackupVolume(register struct cmd_syndesc *as, void *arock)
2688 afs_int32 avolid, aserver, apart, vtype, code, err;
2689 struct nvldbentry entry;
2691 afs_int32 buvolid, buserver, bupart, butype;
2692 struct nvldbentry buentry;
2694 avolid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
2697 PrintError("", err);
2699 fprintf(STDERR, "vos: can't find volume ID or name '%s'\n",
2700 as->parms[0].items->data);
2703 code = GetVolumeInfo(avolid, &aserver, &apart, &vtype, &entry);
2707 /* verify this is a readwrite volume */
2709 if (vtype != RWVOL) {
2710 fprintf(STDERR, "%s not RW volume\n", as->parms[0].items->data);
2714 /* is there a backup volume already? */
2716 if (entry.flags & BACK_EXISTS) {
2717 /* yep, where is it? */
2719 buvolid = entry.volumeId[BACKVOL];
2720 code = GetVolumeInfo(buvolid, &buserver, &bupart, &butype, &buentry);
2725 code = VLDB_IsSameAddrs(buserver, aserver, &err);
2728 "Failed to get info about server's %d address(es) from vlserver; aborting call!\n",
2734 "FATAL ERROR: backup volume %lu exists on server %lu\n",
2735 (unsigned long)buvolid, (unsigned long)buserver);
2740 /* nope, carry on */
2742 code = UV_BackupVolume(aserver, apart, avolid);
2745 PrintDiagnostics("backup", code);
2748 fprintf(STDOUT, "Created backup volume for %s \n",
2749 as->parms[0].items->data);
2754 ReleaseVolume(register struct cmd_syndesc *as, void *arock)
2757 struct nvldbentry entry;
2758 afs_int32 avolid, aserver, apart, vtype, code, err;
2761 if (as->parms[1].items)
2763 avolid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
2766 PrintError("", err);
2768 fprintf(STDERR, "vos: can't find volume '%s'\n",
2769 as->parms[0].items->data);
2772 code = GetVolumeInfo(avolid, &aserver, &apart, &vtype, &entry);
2776 if (vtype != RWVOL) {
2777 fprintf(STDERR, "%s not a RW volume\n", as->parms[0].items->data);
2781 if (!ISNAMEVALID(entry.name)) {
2783 "Volume name %s is too long, rename before releasing\n",
2788 code = UV_ReleaseVolume(avolid, aserver, apart, force);
2790 PrintDiagnostics("release", code);
2793 fprintf(STDOUT, "Released volume %s successfully\n",
2794 as->parms[0].items->data);
2799 DumpVolume(register struct cmd_syndesc *as, void *arock)
2801 afs_int32 avolid, aserver, apart, voltype, fromdate = 0, code, err, i, flags;
2802 char filename[MAXPATHLEN];
2803 struct nvldbentry entry;
2805 rx_SetRxDeadTime(60 * 10);
2806 for (i = 0; i < MAXSERVERS; i++) {
2807 struct rx_connection *rxConn = ubik_GetRPCConn(cstruct, i);
2810 rx_SetConnDeadTime(rxConn, rx_connDeadTime);
2811 if (rxConn->service)
2812 rxConn->service->connDeadTime = rx_connDeadTime;
2815 avolid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
2818 PrintError("", err);
2820 fprintf(STDERR, "vos: can't find volume '%s'\n",
2821 as->parms[0].items->data);
2825 if (as->parms[3].items || as->parms[4].items) {
2826 if (!as->parms[3].items || !as->parms[4].items) {
2828 "Must specify both -server and -partition options\n");
2831 aserver = GetServer(as->parms[3].items->data);
2833 fprintf(STDERR, "Invalid server name\n");
2836 apart = volutil_GetPartitionID(as->parms[4].items->data);
2838 fprintf(STDERR, "Invalid partition name\n");
2842 code = GetVolumeInfo(avolid, &aserver, &apart, &voltype, &entry);
2847 if (as->parms[1].items && strcmp(as->parms[1].items->data, "0")) {
2848 code = ktime_DateToInt32(as->parms[1].items->data, &fromdate);
2850 fprintf(STDERR, "vos: failed to parse date '%s' (error=%d))\n",
2851 as->parms[1].items->data, code);
2855 if (as->parms[2].items) {
2856 strcpy(filename, as->parms[2].items->data);
2858 strcpy(filename, "");
2861 flags = as->parms[6].items ? VOLDUMPV2_OMITDIRS : 0;
2863 if (as->parms[5].items) {
2865 UV_DumpClonedVolume(avolid, aserver, apart, fromdate,
2866 DumpFunction, filename, flags);
2869 UV_DumpVolume(avolid, aserver, apart, fromdate, DumpFunction,
2872 if ((code == RXGEN_OPCODE) && (as->parms[6].items)) {
2873 flags &= ~VOLDUMPV2_OMITDIRS;
2877 PrintDiagnostics("dump", code);
2880 if (strcmp(filename, ""))
2881 fprintf(STDERR, "Dumped volume %s in file %s\n",
2882 as->parms[0].items->data, filename);
2884 fprintf(STDERR, "Dumped volume %s in stdout \n",
2885 as->parms[0].items->data);
2899 RestoreVolume(register struct cmd_syndesc *as, void *arock)
2901 afs_int32 avolid, aparentid, aserver, apart, code, vcode, err;
2902 afs_int32 aoverwrite = ASK;
2903 afs_int32 acreation = 0, alastupdate = 0;
2904 int restoreflags = 0;
2905 int readonly = 0, offline = 0, voltype = RWVOL;
2907 char afilename[MAXPATHLEN], avolname[VOLSER_MAXVOLNAME + 1], apartName[10];
2908 char volname[VOLSER_MAXVOLNAME + 1];
2909 struct nvldbentry entry;
2914 if (as->parms[4].items) {
2915 avolid = vsu_GetVolumeID(as->parms[4].items->data, cstruct, &err);
2918 PrintError("", err);
2920 fprintf(STDERR, "vos: can't find volume '%s'\n",
2921 as->parms[4].items->data);
2927 if (as->parms[5].items) {
2928 if ((strcmp(as->parms[5].items->data, "a") == 0)
2929 || (strcmp(as->parms[5].items->data, "abort") == 0)) {
2931 } else if ((strcmp(as->parms[5].items->data, "f") == 0)
2932 || (strcmp(as->parms[5].items->data, "full") == 0)) {
2934 } else if ((strcmp(as->parms[5].items->data, "i") == 0)
2935 || (strcmp(as->parms[5].items->data, "inc") == 0)
2936 || (strcmp(as->parms[5].items->data, "increment") == 0)
2937 || (strcmp(as->parms[5].items->data, "incremental") == 0)) {
2940 fprintf(STDERR, "vos: %s is not a valid argument to -overwrite\n",
2941 as->parms[5].items->data);
2945 if (as->parms[6].items)
2947 if (as->parms[7].items) {
2952 if (as->parms[8].items) {
2953 if ((strcmp(as->parms[8].items->data, "d") == 0)
2954 || (strcmp(as->parms[8].items->data, "dump") == 0)) {
2955 acreation = TS_DUMP;
2956 } else if ((strcmp(as->parms[8].items->data, "k") == 0)
2957 || (strcmp(as->parms[8].items->data, "keep") == 0)) {
2958 acreation = TS_KEEP;
2959 } else if ((strcmp(as->parms[8].items->data, "n") == 0)
2960 || (strcmp(as->parms[8].items->data, "new") == 0)) {
2963 fprintf(STDERR, "vos: %s is not a valid argument to -creation\n",
2964 as->parms[8].items->data);
2969 if (as->parms[9].items) {
2970 if ((strcmp(as->parms[9].items->data, "d") == 0)
2971 || (strcmp(as->parms[9].items->data, "dump") == 0)) {
2972 alastupdate = TS_DUMP;
2973 } else if ((strcmp(as->parms[9].items->data, "k") == 0)
2974 || (strcmp(as->parms[9].items->data, "keep") == 0)) {
2975 alastupdate = TS_KEEP;
2976 } else if ((strcmp(as->parms[9].items->data, "n") == 0)
2977 || (strcmp(as->parms[9].items->data, "new") == 0)) {
2978 alastupdate = TS_NEW;
2980 fprintf(STDERR, "vos: %s is not a valid argument to -lastupdate\n",
2981 as->parms[9].items->data);
2986 aserver = GetServer(as->parms[0].items->data);
2988 fprintf(STDERR, "vos: server '%s' not found in host table\n",
2989 as->parms[0].items->data);
2992 apart = volutil_GetPartitionID(as->parms[1].items->data);
2994 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
2995 as->parms[1].items->data);
2998 if (!IsPartValid(apart, aserver, &code)) { /*check for validity of the partition */
3000 PrintError("", code);
3003 "vos : partition %s does not exist on the server\n",
3004 as->parms[1].items->data);
3007 strcpy(avolname, as->parms[2].items->data);
3008 if (!ISNAMEVALID(avolname)) {
3010 "vos: the name of the volume %s exceeds the size limit\n",
3014 if (!VolNameOK(avolname)) {
3016 "Illegal volume name %s, should not end in .readonly or .backup\n",
3020 if (as->parms[3].items) {
3021 strcpy(afilename, as->parms[3].items->data);
3022 if (!FileExists(afilename)) {
3023 fprintf(STDERR, "Can't access file %s\n", afilename);
3027 strcpy(afilename, "");
3030 /* Check if volume exists or not */
3032 vsu_ExtractName(volname, avolname);
3033 vcode = VLDB_GetEntryByName(volname, &entry);
3034 if (vcode) { /* no volume - do a full restore */
3035 restoreflags = RV_FULLRST;
3036 if ((aoverwrite == INC) || (aoverwrite == ABORT))
3038 "Volume does not exist; Will perform a full restore\n");
3041 else if ((!readonly && Lp_GetRwIndex(&entry) == -1) /* RW volume does not exist - do a full */
3042 ||(readonly && !Lp_ROMatch(0, 0, &entry))) { /* RO volume does not exist - do a full */
3043 restoreflags = RV_FULLRST;
3044 if ((aoverwrite == INC) || (aoverwrite == ABORT))
3046 "%s Volume does not exist; Will perform a full restore\n",
3047 readonly ? "RO" : "RW");
3050 avolid = entry.volumeId[voltype];
3051 } else if (entry.volumeId[voltype] != 0
3052 && entry.volumeId[voltype] != avolid) {
3053 avolid = entry.volumeId[voltype];
3055 aparentid = entry.volumeId[RWVOL];
3058 else { /* volume exists - do we do a full incremental or abort */
3059 int Oserver, Opart, Otype, vol_elsewhere = 0;
3060 struct nvldbentry Oentry;
3064 avolid = entry.volumeId[voltype];
3065 } else if (entry.volumeId[voltype] != 0
3066 && entry.volumeId[voltype] != avolid) {
3067 avolid = entry.volumeId[voltype];
3069 aparentid = entry.volumeId[RWVOL];
3071 /* A file name was specified - check if volume is on another partition */
3072 vcode = GetVolumeInfo(avolid, &Oserver, &Opart, &Otype, &Oentry);
3076 vcode = VLDB_IsSameAddrs(Oserver, aserver, &err);
3079 "Failed to get info about server's %d address(es) from vlserver (err=%d); aborting call!\n",
3083 if (!vcode || (Opart != apart))
3086 if (aoverwrite == ASK) {
3087 if (strcmp(afilename, "") == 0) { /* The file is from standard in */
3089 "Volume exists and no -overwrite option specified; Aborting restore command\n");
3093 /* Ask what to do */
3094 if (vol_elsewhere) {
3096 "The volume %s %u already exists on a different server/part\n",
3097 volname, entry.volumeId[voltype]);
3099 "Do you want to do a full restore or abort? [fa](a): ");
3102 "The volume %s %u already exists in the VLDB\n",
3103 volname, entry.volumeId[voltype]);
3105 "Do you want to do a full/incremental restore or abort? [fia](a): ");
3108 while (!(dc == EOF || dc == '\n'))
3109 dc = getchar(); /* goto end of line */
3110 if ((c == 'f') || (c == 'F'))
3112 else if ((c == 'i') || (c == 'I'))
3118 if (aoverwrite == ABORT) {
3119 fprintf(STDERR, "Volume exists; Aborting restore command\n");
3121 } else if (aoverwrite == FULL) {
3122 restoreflags = RV_FULLRST;
3124 "Volume exists; Will delete and perform full restore\n");
3125 } else if (aoverwrite == INC) {
3127 if (vol_elsewhere) {
3129 "%s volume %lu already exists on a different server/part; not allowed\n",
3130 readonly ? "RO" : "RW", (unsigned long)avolid);
3136 restoreflags |= RV_OFFLINE;
3138 restoreflags |= RV_RDONLY;
3140 switch (acreation) {
3142 restoreflags |= RV_CRDUMP;
3145 restoreflags |= RV_CRKEEP;
3148 restoreflags |= RV_CRNEW;
3151 if (aoverwrite == FULL)
3152 restoreflags |= RV_CRNEW;
3154 restoreflags |= RV_CRKEEP;
3157 switch (alastupdate) {
3159 restoreflags |= RV_LUDUMP;
3162 restoreflags |= RV_LUKEEP;
3165 restoreflags |= RV_LUNEW;
3168 restoreflags |= RV_LUDUMP;
3170 if (as->parms[10].items) {
3171 restoreflags |= RV_NODEL;
3176 UV_RestoreVolume2(aserver, apart, avolid, aparentid,
3177 avolname, restoreflags, WriteData, afilename);
3179 PrintDiagnostics("restore", code);
3182 MapPartIdIntoName(apart, apartName);
3185 * patch typo here - originally "parms[1]", should be "parms[0]"
3188 fprintf(STDOUT, "Restored volume %s on %s %s\n", avolname,
3189 as->parms[0].items->data, apartName);
3194 LockReleaseCmd(register struct cmd_syndesc *as, void *arock)
3196 afs_int32 avolid, code, err;
3198 avolid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
3201 PrintError("", err);
3203 fprintf(STDERR, "vos: can't find volume '%s'\n",
3204 as->parms[0].items->data);
3208 code = UV_LockRelease(avolid);
3210 PrintDiagnostics("unlock", code);
3213 fprintf(STDOUT, "Released lock on vldb entry for volume %s\n",
3214 as->parms[0].items->data);
3219 AddSite(register struct cmd_syndesc *as, void *arock)
3221 afs_int32 avolid, aserver, apart, code, err, valid = 0;
3222 char apartName[10], avolname[VOLSER_MAXVOLNAME + 1];
3224 vsu_ExtractName(avolname, as->parms[2].items->data);;
3225 avolid = vsu_GetVolumeID(avolname, cstruct, &err);
3228 PrintError("", err);
3230 fprintf(STDERR, "vos: can't find volume '%s'\n",
3231 as->parms[2].items->data);
3234 aserver = GetServer(as->parms[0].items->data);
3236 fprintf(STDERR, "vos: server '%s' not found in host table\n",
3237 as->parms[0].items->data);
3240 apart = volutil_GetPartitionID(as->parms[1].items->data);
3242 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
3243 as->parms[1].items->data);
3246 if (!IsPartValid(apart, aserver, &code)) { /*check for validity of the partition */
3248 PrintError("", code);
3251 "vos : partition %s does not exist on the server\n",
3252 as->parms[1].items->data);
3255 if (as->parms[3].items) {
3258 code = UV_AddSite(aserver, apart, avolid, valid);
3260 PrintDiagnostics("addsite", code);
3263 MapPartIdIntoName(apart, apartName);
3264 fprintf(STDOUT, "Added replication site %s %s for volume %s\n",
3265 as->parms[0].items->data, apartName, as->parms[2].items->data);
3270 RemoveSite(register struct cmd_syndesc *as, void *arock)
3273 afs_int32 avolid, aserver, apart, code, err;
3274 char apartName[10], avolname[VOLSER_MAXVOLNAME + 1];
3276 vsu_ExtractName(avolname, as->parms[2].items->data);
3277 avolid = vsu_GetVolumeID(avolname, cstruct, &err);
3280 PrintError("", err);
3282 fprintf(STDERR, "vos: can't find volume '%s'\n",
3283 as->parms[2].items->data);
3286 aserver = GetServer(as->parms[0].items->data);
3288 fprintf(STDERR, "vos: server '%s' not found in host table\n",
3289 as->parms[0].items->data);
3292 apart = volutil_GetPartitionID(as->parms[1].items->data);
3294 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
3295 as->parms[1].items->data);
3299 *skip the partition validity check, since it is possible that the partition
3300 *has since been decomissioned.
3303 if (!IsPartValid(apart,aserver,&code)){
3304 if(code) PrintError("",code);
3305 else fprintf(STDERR,"vos : partition %s does not exist on the server\n",as->parms[1].items->data);
3309 code = UV_RemoveSite(aserver, apart, avolid);
3311 PrintDiagnostics("remsite", code);
3314 MapPartIdIntoName(apart, apartName);
3315 fprintf(STDOUT, "Removed replication site %s %s for volume %s\n",
3316 as->parms[0].items->data, apartName, as->parms[2].items->data);
3321 ChangeLocation(register struct cmd_syndesc *as, void *arock)
3323 afs_int32 avolid, aserver, apart, code, err;
3326 avolid = vsu_GetVolumeID(as->parms[2].items->data, cstruct, &err);
3329 PrintError("", err);
3331 fprintf(STDERR, "vos: can't find volume '%s'\n",
3332 as->parms[2].items->data);
3335 aserver = GetServer(as->parms[0].items->data);
3337 fprintf(STDERR, "vos: server '%s' not found in host table\n",
3338 as->parms[0].items->data);
3341 apart = volutil_GetPartitionID(as->parms[1].items->data);
3343 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
3344 as->parms[1].items->data);
3347 if (!IsPartValid(apart, aserver, &code)) { /*check for validity of the partition */
3349 PrintError("", code);
3352 "vos : partition %s does not exist on the server\n",
3353 as->parms[1].items->data);
3356 code = UV_ChangeLocation(aserver, apart, avolid);
3358 PrintDiagnostics("addsite", code);
3361 MapPartIdIntoName(apart, apartName);
3362 fprintf(STDOUT, "Changed location to %s %s for volume %s\n",
3363 as->parms[0].items->data, apartName, as->parms[2].items->data);
3368 ListPartitions(register struct cmd_syndesc *as, void *arock)
3370 afs_int32 aserver, code;
3371 struct partList dummyPartList;
3376 aserver = GetServer(as->parms[0].items->data);
3378 fprintf(STDERR, "vos: server '%s' not found in host table\n",
3379 as->parms[0].items->data);
3384 code = UV_ListPartitions(aserver, &dummyPartList, &cnt);
3386 PrintDiagnostics("listpart", code);
3390 fprintf(STDOUT, "The partitions on the server are:\n");
3391 for (i = 0; i < cnt; i++) {
3392 if (dummyPartList.partFlags[i] & PARTVALID) {
3393 memset(pname, 0, sizeof(pname));
3394 MapPartIdIntoName(dummyPartList.partId[i], pname);
3395 fprintf(STDOUT, " %10s ", pname);
3397 if ((i % 5) == 0 && (i != 0))
3398 fprintf(STDOUT, "\n");
3401 fprintf(STDOUT, "\n");
3402 fprintf(STDOUT, "Total: %d\n", total);
3408 CompareVolName(p1, p2)
3411 volintInfo *arg1, *arg2;
3413 arg1 = (volintInfo *) p1;
3414 arg2 = (volintInfo *) p2;
3415 return (strcmp(arg1->name, arg2->name));
3419 /*------------------------------------------------------------------------
3420 * PRIVATE XCompareVolName
3423 * Comparison routine for volume names coming from an extended
3427 * a_obj1P : Char ptr to first extended vol info object
3428 * a_obj1P : Char ptr to second extended vol info object
3431 * The value of strcmp() on the volume names within the passed
3432 * objects (i,e., -1, 0, or 1).
3435 * Passed to qsort() as the designated comparison routine.
3439 *------------------------------------------------------------------------*/
3442 XCompareVolName(a_obj1P, a_obj2P)
3443 char *a_obj1P, *a_obj2P;
3445 { /*XCompareVolName */
3448 (((struct volintXInfo *)(a_obj1P))->name,
3449 ((struct volintXInfo *)(a_obj2P))->name));
3451 } /*XCompareVolName */
3454 CompareVolID(p1, p2)
3457 volintInfo *arg1, *arg2;
3459 arg1 = (volintInfo *) p1;
3460 arg2 = (volintInfo *) p2;
3461 if (arg1->volid == arg2->volid)
3463 if (arg1->volid > arg2->volid)
3470 /*------------------------------------------------------------------------
3471 * PRIVATE XCompareVolID
3474 * Comparison routine for volume IDs coming from an extended
3478 * a_obj1P : Char ptr to first extended vol info object
3479 * a_obj1P : Char ptr to second extended vol info object
3482 * The value of strcmp() on the volume names within the passed
3483 * objects (i,e., -1, 0, or 1).
3486 * Passed to qsort() as the designated comparison routine.
3490 *------------------------------------------------------------------------*/
3493 XCompareVolID(a_obj1P, a_obj2P)
3494 char *a_obj1P, *a_obj2P;
3496 { /*XCompareVolID */
3498 afs_int32 id1, id2; /*Volume IDs we're comparing */
3500 id1 = ((struct volintXInfo *)(a_obj1P))->volid;
3501 id2 = ((struct volintXInfo *)(a_obj2P))->volid;
3509 } /*XCompareVolID */
3511 /*------------------------------------------------------------------------
3512 * PRIVATE ListVolumes
3515 * Routine used to list volumes, contacting the Volume Server
3516 * directly, bypassing the VLDB.
3519 * as : Ptr to parsed command line arguments.
3522 * 0 Successful operation
3525 * Nothing interesting.
3529 *------------------------------------------------------------------------*/
3532 ListVolumes(register struct cmd_syndesc *as, void *arock)
3534 afs_int32 apart, int32list, fast;
3535 afs_int32 aserver, code;
3537 volintInfo *oldpntr = NULL;
3541 volintXInfo *xInfoP;
3542 volintXInfo *origxInfoP = NULL; /*Ptr to current/orig extended vol info */
3543 int wantExtendedInfo; /*Do we want extended vol info? */
3546 struct partList dummyPartList;
3554 if (as->parms[3].items)
3556 if (as->parms[4].items)
3560 if (as->parms[2].items)
3566 if (as->parms[5].items) {
3568 * We can't coexist with the fast flag.
3572 "vos: Can't use the -fast and -extended flags together\n");
3577 * We need to turn on ``long'' listings to get the full effect.
3579 wantExtendedInfo = 1;
3582 wantExtendedInfo = 0;
3583 if (as->parms[1].items) {
3584 apart = volutil_GetPartitionID(as->parms[1].items->data);
3586 fprintf(STDERR, "vos: could not interpret partition name '%s'\n",
3587 as->parms[1].items->data);
3590 dummyPartList.partId[0] = apart;
3591 dummyPartList.partFlags[0] = PARTVALID;
3594 aserver = GetServer(as->parms[0].items->data);
3596 fprintf(STDERR, "vos: server '%s' not found in host table\n",
3597 as->parms[0].items->data);
3602 if (!IsPartValid(apart, aserver, &code)) { /*check for validity of the partition */
3604 PrintError("", code);
3607 "vos : partition %s does not exist on the server\n",
3608 as->parms[1].items->data);
3612 code = UV_ListPartitions(aserver, &dummyPartList, &cnt);
3614 PrintDiagnostics("listvol", code);
3618 for (i = 0; i < cnt; i++) {
3619 if (dummyPartList.partFlags[i] & PARTVALID) {
3620 if (wantExtendedInfo)
3622 UV_XListVolumes(aserver, dummyPartList.partId[i], all,
3626 UV_ListVolumes(aserver, dummyPartList.partId[i], all,
3629 PrintDiagnostics("listvol", code);
3634 if (wantExtendedInfo) {
3635 origxInfoP = xInfoP;
3636 base = (char *)xInfoP;
3639 base = (char *)pntr;
3643 if (wantExtendedInfo)
3644 qsort(base, count, sizeof(volintXInfo), XCompareVolName);
3646 qsort(base, count, sizeof(volintInfo), CompareVolName);
3648 if (wantExtendedInfo)
3649 qsort(base, count, sizeof(volintXInfo), XCompareVolID);
3651 qsort(base, count, sizeof(volintInfo), CompareVolID);
3653 MapPartIdIntoName(dummyPartList.partId[i], pname);
3656 "Total number of volumes on server %s partition %s: %lu \n",
3657 as->parms[0].items->data, pname,
3658 (unsigned long)count);
3659 if (wantExtendedInfo) {
3660 #ifdef FULL_LISTVOL_SWITCH