Use vsu_ExtractName() to get the RW volume name before doing the vid lookup
[openafs.git] / src / volser / vos.c
index d4164fa..fb7e805 100644 (file)
@@ -7,8 +7,8 @@
  * directory or online at http://www.openafs.org/dl/license10.html
  */
 
-#include <afs/param.h>
 #include <afsconfig.h>
+#include <afs/param.h>
 
 RCSID("$Header$");
 
@@ -67,6 +67,7 @@ cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell name");\
 cmd_AddParm(ts, "-noauth", CMD_FLAG, CMD_OPTIONAL, "don't authenticate");\
 cmd_AddParm(ts, "-localauth",CMD_FLAG,CMD_OPTIONAL,"use server tickets");\
 cmd_AddParm(ts, "-verbose", CMD_FLAG, CMD_OPTIONAL, "verbose");\
+cmd_AddParm(ts, "-encrypt", CMD_FLAG, CMD_OPTIONAL, "encrypt commands");\
 
 #define ERROR_EXIT(code) {error=(code); goto error_exit;}
 
@@ -79,6 +80,8 @@ const char *confdir;
 extern struct rx_connection *UV_Bind();
 extern  struct rx_securityClass *rxnull_NewClientSecurityObject();
 extern int UV_SetSecurity();
+extern int UV_SetVolumeInfo();
+extern int vsu_SetCrypt();
 extern VL_SetLock();
 extern VL_ReleaseLock();
 extern VL_DeleteEntry();
@@ -101,7 +104,7 @@ static struct tqHead busyHead, notokHead;
 static void qInit(ahead)
 struct tqHead *ahead;
 {
-    bzero((char *)ahead, sizeof(struct tqHead));
+    memset((char *)ahead, 0, sizeof(struct tqHead));
     return;
 }
 
@@ -216,7 +219,7 @@ char *aname; {
     } else {
         th = gethostbyname(aname);
        if (!th) return 0;
-       bcopy(th->h_addr, &addr, sizeof(addr));
+       memcpy(&addr, th->h_addr, sizeof(addr));
     }
 
     if (addr == htonl(0x7f000001)) {                /* local host */
@@ -224,7 +227,7 @@ char *aname; {
        if (code) return 0;
        th = gethostbyname(hostname); /* returns host byte order */
        if (!th) return 0;
-       bcopy(th->h_addr, &addr, sizeof(addr));
+       memcpy(&addr, th->h_addr, sizeof(addr));
     }
 
     return (addr); 
@@ -482,6 +485,18 @@ int fast,longlist, disp;
            fprintf(STDOUT,"    MaxQuota %10d K \n",pntr->maxquota);
            fprintf(STDOUT,"    Creation    %s",
                    ctime((time_t *)&pntr->creationDate));
+#if 0
+           fprintf(STDOUT,"    Copy        %s",
+                   ctime((time_t *)&pntr->copyDate));
+           if(!pntr->backupDate)
+               fprintf(STDOUT,"    Backup      Never\n");
+           else
+               fprintf(STDOUT,"    Backup      %s",
+                       ctime((time_t *)&pntr->backupDate));
+           if (pntr->accessDate)
+               fprintf(STDOUT,"    Last Access %s",
+                       ctime((time_t *)&pntr->accessDate));
+#endif
            if(pntr->updateDate < pntr->creationDate)
                fprintf(STDOUT,"    Last Update %s",
                        ctime((time_t *)&pntr->creationDate));
@@ -619,6 +634,18 @@ static void XDisplayFormat(a_xInfoP, a_servID, a_partID, a_totalOKP,
                        a_xInfoP->maxquota);
                fprintf(STDOUT, "    Creation    %s",
                        ctime((time_t *)&a_xInfoP->creationDate));
+#if 0
+               fprintf(STDOUT,"    Copy        %s",
+                       ctime((time_t *)&a_xInfoP->copyDate));
+               if(!a_xInfoP->backupDate)
+                   fprintf(STDOUT,"    Backup      Never\n");
+               else
+                   fprintf(STDOUT,"    Backup      %s",
+                       ctime((time_t *)&a_xInfoP->backupDate));
+               if (a_xInfoP->accessDate)
+                   fprintf(STDOUT,"    Last Access %s",
+                           ctime((time_t *)&a_xInfoP->accessDate));
+#endif
                if (a_xInfoP->updateDate < a_xInfoP->creationDate)
                    fprintf(STDOUT, "    Last Update %s",
                            ctime((time_t *)&a_xInfoP->creationDate));
@@ -764,6 +791,97 @@ static void XDisplayFormat(a_xInfoP, a_servID, a_partID, a_totalOKP,
        } /*Default listing*/
 } /*XDisplayFormat*/
 
+#ifdef FULL_LISTVOL_SWITCH
+static void  DisplayFormat2(server, partition, pntr)
+    long    server, partition;
+    volintInfo *pntr;
+{
+  static long server_cache = -1, partition_cache = -1;
+  static char hostname[256],
+  address[32],
+  pname[16];
+
+  if (server != server_cache) {
+    struct in_addr s;
+    
+    s.s_addr = server;
+    strcpy(hostname, hostutil_GetNameByINet(server));
+    strcpy(address, inet_ntoa(s));
+    server_cache = server;
+  }
+  if (partition != partition_cache) {
+    MapPartIdIntoName(partition, pname);
+    partition_cache = partition;
+  }
+  fprintf(STDOUT, "name\t\t%s\n", pntr->name);
+  fprintf(STDOUT, "id\t\t%lu\n", pntr->volid);
+  fprintf(STDOUT, "serv\t\t%s\t%s\n", address, hostname);
+  fprintf(STDOUT, "part\t\t%s\n", pname);
+  switch (pntr->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, "backupID\t%lu\n", pntr->backupID);
+  fprintf(STDOUT, "parentID\t%lu\n", pntr->parentID);
+  fprintf(STDOUT, "cloneID\t\t%lu\n", pntr->cloneID);
+  fprintf(STDOUT, "inUse\t\t%s\n", pntr->inUse ? "Y" : "N");
+  fprintf(STDOUT, "needsSalvaged\t%s\n", pntr->needsSalvaged ? "Y" : "N");
+  /* 0xD3 is from afs/volume.h since I had trouble including the file */
+  fprintf(STDOUT, "destroyMe\t%s\n", pntr->destroyMe == 0xD3 ? "Y" : "N");
+  switch (pntr->type) {
+  case 0:
+    fprintf(STDOUT, "type\t\tRW\n");
+    break;
+  case 1:
+    fprintf(STDOUT, "type\t\tRO\n");
+    break;
+  case 2:
+    fprintf(STDOUT, "type\t\tBK\n");
+    break;
+  default:
+    fprintf(STDOUT, "type\t\t?\n");
+    break;
+  }
+  fprintf(STDOUT, "creationDate\t%-9lu\t%s", pntr->creationDate, ctime(&pntr->creationDate));
+  fprintf(STDOUT, "accessDate\t%-9lu\t%s", pntr->accessDate, ctime(&pntr->accessDate));
+  fprintf(STDOUT, "updateDate\t%-9lu\t%s", pntr->updateDate, ctime(&pntr->updateDate));
+  fprintf(STDOUT, "backupDate\t%-9lu\t%s", pntr->backupDate, ctime(&pntr->backupDate));
+  fprintf(STDOUT, "copyDate\t%-9lu\t%s", pntr->copyDate, ctime(&pntr->copyDate));
+  fprintf(STDOUT, "flags\t\t%#lx\t(Optional)\n", pntr->flags);
+  fprintf(STDOUT, "diskused\t%u\n", pntr->size);
+  fprintf(STDOUT, "maxquota\t%u\n", pntr->maxquota);
+  fprintf(STDOUT, "minquota\t%lu\t(Optional)\n", pntr->spare0);
+  fprintf(STDOUT, "filecount\t%u\n", pntr->filecount);
+  fprintf(STDOUT, "dayUse\t\t%u\n", pntr->dayUse);
+  fprintf(STDOUT, "weekUse\t\t%lu\t(Optional)\n", pntr->spare1);
+  fprintf(STDOUT, "spare2\t\t%lu\t(Optional)\n", pntr->spare2);
+  fprintf(STDOUT, "spare3\t\t%lu\t(Optional)\n", pntr->spare3);
+  return;
+}
+
+static void DisplayVolumes2(server, partition, pntr, count)
+    volintInfo *pntr;
+    long    server, partition, count;
+{
+  long    i;
+  
+  for (i = 0; i < count; i++) {
+    fprintf(STDOUT, "BEGIN_OF_ENTRY\n");
+    DisplayFormat2(server, partition, pntr);
+    fprintf(STDOUT, "END_OF_ENTRY\n\n");
+    pntr++;
+  }
+  return;
+}
+#endif /* FULL_LISTVOL_SWITCH */
+
 static void DisplayVolumes(server,part,pntr,count,longlist,fast,quiet)
 afs_int32 server,part;
 volintInfo *pntr;
@@ -1155,6 +1273,12 @@ register struct cmd_syndesc *as;
          if (wantExtendedInfo)
             XVolumeStats(xInfoP, &entry, aserver, apart, voltype);
          else
+#ifdef FULL_LISTVOL_SWITCH
+            if (as->parms[2].items) {
+              DisplayFormat2(aserver, apart, pntr);
+              EnumerateEntry(&entry);
+            } else
+#endif /* FULL_LISTVOL_SWITCH */
             VolumeStats(pntr, &entry, aserver, apart, voltype);
 
          if ((voltype == BACKVOL) && !(entry.flags & BACK_EXISTS)) {
@@ -1178,6 +1302,86 @@ register struct cmd_syndesc *as;
 }
 
 /*------------------------------------------------------------------------
+ * PRIVATE SetFields
+ *
+ * Description:
+ *     Routine used to change the status of a single volume.
+ *
+ * Arguments:
+ *     as : Ptr to parsed command line arguments.
+ *
+ * Returns:
+ *     0 for a successful operation,
+ *     Otherwise, one of the ubik or VolServer error values.
+ *
+ * Environment:
+ *     Nothing interesting.
+ *
+ * Side Effects:
+ *     As advertised.
+ *------------------------------------------------------------------------
+ */
+static SetFields(as)
+register struct cmd_syndesc *as;
+{
+    struct nvldbentry entry;
+    afs_int32 vcode = 0;
+    volintInfo info;
+    afs_int32 volid;
+    afs_int32 code, err;
+    afs_int32 aserver, apart;
+    int previdx = -1;
+
+    volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);    /* -id */
+    if (volid == 0) {
+       if (err) PrintError("", err);
+       else fprintf(STDERR, "Unknown volume ID or name '%s'\n", as->parms[0].items->data);
+       return -1;
+    }
+
+    code = VLDB_GetEntryByID (volid, RWVOL, &entry);
+    if (code) {
+       fprintf(STDERR, "Could not fetch the entry for volume number %u from VLDB \n",volid);
+       return (code);
+    }
+    MapHostToNetwork(&entry);
+
+    GetServerAndPart(&entry, RWVOL, &aserver, &apart, &previdx);
+    if (previdx == -1) {
+       fprintf(STDERR,"Volume %s does not exist in VLDB\n\n", as->parms[0].items->data);
+       return (ENOENT);
+    }
+
+    memset(&info, 0, sizeof(info));
+    info.volid    = volid;
+    info.type     = RWVOL;
+    info.dayUse   = -1;
+    info.maxquota = -1;
+    info.flags    = -1;
+    info.spare0   = -1;
+    info.spare1   = -1;
+    info.spare2   = -1;
+    info.spare3   = -1;
+
+    if (as->parms[1].items) {
+       /* -max <quota> */
+       code = util_GetInt32(as->parms[1].items->data, &info.maxquota);
+       if (code) {
+           fprintf(STDERR,"invalid quota value\n");
+           return code;
+       }
+    }
+    if (as->parms[2].items) {
+       /* -clearuse */
+       info.dayUse = 0;
+    }
+    code = UV_SetVolumeInfo(aserver, apart, volid, &info);
+    if (code)
+       fprintf(STDERR,"Could not update volume info fields for volume number %u\n",volid);
+    return (code);
+}
+
+/*------------------------------------------------------------------------
  * PRIVATE volOnline
  *
  * Description:
@@ -1785,7 +1989,7 @@ register struct cmd_syndesc *as;
 {    
         afs_int32 avolid, aserver, apart, code,vcode, err;
        afs_int32 aoverwrite = ASK;
-       int restoreflags;
+       int restoreflags, readonly = 0, offline = 0, voltype = RWVOL;
        char prompt;
        char afilename[NameLen], avolname[VOLSER_MAXVOLNAME +1],apartName[10];
        char volname[VOLSER_MAXVOLNAME +1];
@@ -1825,6 +2029,11 @@ register struct cmd_syndesc *as;
                exit(1);
            }
        }
+       if (as->parms[6].items) offline = 1;
+       if (as->parms[7].items) {
+           readonly = 1;
+           voltype = ROVOL;
+       }
 
        aserver = GetServer(as->parms[0].items->data);
        if (aserver == 0) {
@@ -1871,17 +2080,19 @@ register struct cmd_syndesc *as;
                fprintf(STDERR,"Volume does not exist; Will perform a full restore\n");
        }
 
-       else if (Lp_GetRwIndex(&entry) == -1) {    /* RW volume does not exist - do a full */
-          restoreflags = RV_FULLRST;
-          if ( (aoverwrite == INC) || (aoverwrite == ABORT) )
-             fprintf(STDERR,"RW Volume does not exist; Will perform a full restore\n");
+       else if ((!readonly && Lp_GetRwIndex(&entry) == -1)        /* RW volume does not exist - do a full */
+            ||  (readonly && !Lp_ROMatch(0, 0, &entry))) {        /* RO volume does not exist - do a full */
+           restoreflags = RV_FULLRST;
+           if ( (aoverwrite == INC) || (aoverwrite == ABORT) )
+               fprintf(STDERR,"%s Volume does not exist; Will perform a full restore\n",
+                       readonly ? "RO" : "RW");
 
-          if (avolid == 0) {
-             avolid = entry.volumeId[RWVOL];
-          }
-          else if (entry.volumeId[RWVOL] != 0  && entry.volumeId[RWVOL] != avolid) {
-             avolid = entry.volumeId[RWVOL];
-          }
+           if (avolid == 0) {
+               avolid = entry.volumeId[voltype];
+           }
+           else if (entry.volumeId[voltype] != 0  && entry.volumeId[voltype] != avolid) {
+               avolid = entry.volumeId[voltype];
+           }
        }
 
        else {                    /* volume exists - do we do a full incremental or abort */
@@ -1890,10 +2101,10 @@ register struct cmd_syndesc *as;
            char   c, dc;
 
            if(avolid == 0) {
-               avolid = entry.volumeId[RWVOL];
+               avolid = entry.volumeId[voltype];
            }
-           else if(entry.volumeId[RWVOL] != 0  && entry.volumeId[RWVOL] != avolid) {
-               avolid = entry.volumeId[RWVOL];
+           else if(entry.volumeId[voltype] != 0  && entry.volumeId[voltype] != avolid) {
+               avolid = entry.volumeId[voltype];
            }
            
            /* A file name was specified  - check if volume is on another partition */
@@ -1917,14 +2128,14 @@ register struct cmd_syndesc *as;
                /* Ask what to do */
                if (vol_elsewhere) {
                    fprintf(STDERR,"The volume %s %u already exists on a different server/part\n",
-                           volname, entry.volumeId[RWVOL]);
+                           volname, entry.volumeId[voltype]);
                    fprintf(STDERR, 
                            "Do you want to do a full restore or abort? [fa](a): ");
                }
                else
                {
                    fprintf(STDERR,"The volume %s %u already exists in the VLDB\n",
-                           volname, entry.volumeId[RWVOL]);
+                           volname, entry.volumeId[voltype]);
                    fprintf(STDERR, 
                            "Do you want to do a full/incremental restore or abort? [fia](a): ");
                }
@@ -1947,12 +2158,14 @@ register struct cmd_syndesc *as;
                restoreflags = 0;
                if (vol_elsewhere) {
                    fprintf(STDERR,
-                           "RW volume %u already exists on a different server/part; not allowed\n",
-                           avolid);
+                           "%s volume %u already exists on a different server/part; not allowed\n",
+                           readonly ? "RO" : "RW", avolid);
                    exit(1);
                }
            }
        }
+       if (offline)  restoreflags |= RV_OFFLINE;
+       if (readonly) restoreflags |= RV_RDONLY;
        code = UV_RestoreVolume(aserver, apart, avolid, avolname,
                                restoreflags, WriteData, afilename);
        if (code) {
@@ -1994,9 +2207,10 @@ static AddSite(as)
 register struct cmd_syndesc *as;
 {
    afs_int32 avolid, aserver, apart,code, err;
-   char apartName[10];
+   char apartName[10], avolname[VOLSER_MAXVOLNAME+1];
 
-       avolid = vsu_GetVolumeID(as->parms[2].items->data, cstruct, &err);
+       vsu_ExtractName(avolname, as->parms[2].items->data);;
+       avolid = vsu_GetVolumeID(avolname, cstruct, &err);
        if (avolid == 0) {
            if (err) PrintError("", err);
            else fprintf(STDERR, "vos: can't find volume '%s'\n", as->parms[2].items->data);
@@ -2032,9 +2246,10 @@ register struct cmd_syndesc *as;
 { 
 
     afs_int32 avolid, aserver, apart, code, err;
-    char apartName[10];
+    char apartName[10], avolname[VOLSER_MAXVOLNAME+1];
 
-       avolid = vsu_GetVolumeID(as->parms[2].items->data, cstruct, &err);
+       vsu_ExtractName(avolname, as->parms[2].items->data);
+       avolid = vsu_GetVolumeID(avolname, cstruct, &err);
        if (avolid == 0) {
            if (err) PrintError("", err);
            else fprintf(STDERR, "vos: can't find volume '%s'\n", as->parms[2].items->data);
@@ -2070,6 +2285,42 @@ register struct cmd_syndesc *as;
        fprintf(STDOUT,"Removed replication site %s %s for volume %s\n",as->parms[0].items->data,apartName,as->parms[2].items->data);
     return 0;
 }
+static ChangeLocation(as)
+register struct cmd_syndesc *as;
+{
+   afs_int32 avolid, aserver, apart,code, err;
+   char apartName[10];
+
+       avolid = vsu_GetVolumeID(as->parms[2].items->data, cstruct, &err);
+       if (avolid == 0) {
+           if (err) PrintError("", err);
+           else fprintf(STDERR, "vos: can't find volume '%s'\n", as->parms[2].items->data);
+           exit(1);
+       }
+       aserver = GetServer(as->parms[0].items->data);
+       if (aserver == 0) {
+           fprintf(STDERR,"vos: server '%s' not found in host table\n", as->parms[0].items->data);
+           exit(1);
+       }
+       apart = volutil_GetPartitionID(as->parms[1].items->data);
+       if (apart < 0) {
+           fprintf(STDERR,"vos: could not interpret partition name '%s'\n",as->parms[1].items->data );
+           exit(1);
+       }
+       if (!IsPartValid(apart,aserver,&code)){/*check for validity of the partition */
+           if(code) PrintError("",code);
+           else fprintf(STDERR,"vos : partition %s does not exist on the server\n",as->parms[1].items->data);
+           exit(1);
+       }
+       code = UV_ChangeLocation(aserver, apart, avolid);
+       if (code) {
+           PrintDiagnostics("addsite", code);
+           exit(1);
+       }
+       MapPartIdIntoName(apart,apartName);
+       fprintf(STDOUT,"Changed location to %s %s for volume %s\n",as->parms[0].items->data, apartName,as->parms[2].items->data);
+   return 0;
+}
 
 static ListPartitions(as)
 register struct cmd_syndesc *as;
@@ -2096,7 +2347,7 @@ register struct cmd_syndesc *as;
     fprintf(STDOUT,"The partitions on the server are:\n");
     for(i = 0 ; i < cnt ; i++){
        if(dummyPartList.partFlags[i] & PARTVALID){
-           bzero(pname,sizeof(pname));
+           memset(pname, 0, sizeof(pname));
            MapPartIdIntoName(dummyPartList.partId[i],pname);
            fprintf(STDOUT," %10s ",pname);
            total++;
@@ -2355,6 +2606,12 @@ register struct cmd_syndesc *as;
                xInfoP = (volintXInfo *)0;
            }
            else {
+#ifdef FULL_LISTVOL_SWITCH
+              if (as->parms[6].items)
+                DisplayVolumes2(aserver, dummyPartList.partId[i], oldpntr, 
+                                count);
+              else
+#endif /* FULL_LISTVOL_SWITCH */
                DisplayVolumes(aserver,
                               dummyPartList.partId[i],
                               oldpntr,
@@ -2377,7 +2634,7 @@ static SyncVldb(as)
   afs_int32 pname, code;       /* part name */
   char part[10];
   int flags = 0;
-  char *volname;
+  char *volname = 0;
 
   tserver = 0;
   if (as->parms[0].items) {
@@ -2811,7 +3068,7 @@ register struct cmd_syndesc *as;
     }
 
     /* Zero out search attributes */
-    bzero(&attributes,sizeof(struct VldbListByAttributes));
+    memset(&attributes, 0, sizeof(struct VldbListByAttributes));
 
     if (as->parms[1].items) { /* -prefix */
        strncpy(prefix, as->parms[1].items->data, VOLSER_MAXVOLNAME);
@@ -2865,7 +3122,7 @@ register struct cmd_syndesc *as;
     fflush(STDOUT);
 
     /* Get all the VLDB entries on a server and/or partition */
-    bzero(&arrayEntries, sizeof(arrayEntries));
+    memset(&arrayEntries, 0, sizeof(arrayEntries));
     vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries);
     if (vcode) {
        fprintf(STDERR,"Could not access the VLDB for attributes\n");
@@ -3041,7 +3298,7 @@ static ListVLDB(as)
     }
 
     for (thisindex = 0; (thisindex != -1); thisindex = nextindex) {
-       bzero(&arrayEntries, sizeof(arrayEntries));
+       memset(&arrayEntries, 0, sizeof(arrayEntries));
        centries = 0;
        nextindex = -1;
 
@@ -3050,7 +3307,7 @@ static ListVLDB(as)
        if (vcode == RXGEN_OPCODE) {
          /* Vlserver not running with ListAttributesN2. Fall back */
          vcode = VLDB_ListAttributes(&attributes, &centries, &arrayEntries);
-         nextindex == -1;
+         nextindex = -1;
        }
        if (vcode) {
          fprintf(STDERR,"Could not access the VLDB for attributes\n");
@@ -3091,8 +3348,7 @@ static ListVLDB(as)
             tarray = ttarray;
             
             /* Copy them in */
-            bcopy((char *)arrayEntries.nbulkentries_val,
-                  ((char *)tarray)+tarraysize, parraysize);
+            memcpy(((char *)tarray)+tarraysize, (char *)arrayEntries.nbulkentries_val, parraysize);
             tarraysize += parraysize;
          }
        }
@@ -3144,7 +3400,7 @@ static BackSys(as)
     char *ccode;
     int match;
 
-    bzero(&attributes,sizeof(struct VldbListByAttributes));
+    memset(&attributes, 0, sizeof(struct VldbListByAttributes));
     attributes.Mask = 0;
 
     seenprefix  = (as->parms[0].items ? 1 : 0);
@@ -3198,7 +3454,7 @@ static BackSys(as)
        }
     }
 
-    bzero(&arrayEntries, sizeof(arrayEntries)); /* initialize to hint the stub to alloc space */
+    memset(&arrayEntries, 0, sizeof(arrayEntries)); /* initialize to hint the stub to alloc space */
     vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries);
     if (vcode) {
        fprintf(STDERR,"Could not access the VLDB for attributes\n");
@@ -3407,7 +3663,7 @@ register struct cmd_syndesc *as;
     }
     attributes.flag = VLOP_ALLOPERS;
     attributes.Mask |=  VLLIST_FLAG;
-    bzero(&arrayEntries, sizeof(arrayEntries)); /*initialize to hint the stub  to alloc space */
+    memset(&arrayEntries, 0, sizeof(arrayEntries)); /*initialize to hint the stub  to alloc space */
     vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries);
     if(vcode) {
        fprintf(STDERR,"Could not access the VLDB for attributes\n");
@@ -3697,6 +3953,8 @@ char *arock; {
        tcell = as->parms[12].items->data;
     if(as->parms[14].items)    /* -serverauth specified */
        sauth = 1;
+    if(as->parms[16].items)    /* -crypt specified */
+       vsu_SetCrypt(1);
     if (code = vsu_ClientInit((as->parms[13].items != 0), confdir, tcell, sauth,
                              &cstruct, UV_SetSecurity)) {
        fprintf(STDERR,"could not initialize VLDB library (code=%u) \n",code);
@@ -3794,12 +4052,22 @@ char **argv; {
     cmd_AddParm(ts, "-file", CMD_SINGLE,CMD_OPTIONAL, "dump file");
     cmd_AddParm(ts, "-id", CMD_SINGLE,CMD_OPTIONAL,  "volume ID");
     cmd_AddParm(ts, "-overwrite", CMD_SINGLE,CMD_OPTIONAL,  "abort | full | incremental");
+    cmd_AddParm(ts, "-offline", CMD_FLAG, CMD_OPTIONAL,
+               "leave restored volume offline");
+    cmd_AddParm(ts, "-readonly", CMD_FLAG, CMD_OPTIONAL,
+               "make restored volume read-only");
     COMMONPARMS;
 
     ts = cmd_CreateSyntax("unlock", LockReleaseCmd, 0, "release lock on VLDB entry for a volume");
     cmd_AddParm(ts, "-id", CMD_SINGLE, 0, "volume name or ID");
     COMMONPARMS;
 
+    ts = cmd_CreateSyntax("changeloc", ChangeLocation, 0, "change an RW volume's location in the VLDB");
+    cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name for new location");
+    cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name for new location");
+    cmd_AddParm(ts, "-id", CMD_SINGLE, 0, "volume name or ID");
+    COMMONPARMS;
+
     ts = cmd_CreateSyntax("addsite", AddSite, 0, "add a replication site");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name for new site");
     cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name for new site");
@@ -3825,6 +4093,10 @@ char **argv; {
     cmd_AddParm(ts, "-quiet", CMD_FLAG, CMD_OPTIONAL, "generate minimal information");
     cmd_AddParm(ts, "-extended", CMD_FLAG, CMD_OPTIONAL,
                "list extended volume fields");
+#ifdef FULL_LISTVOL_SWITCH
+    cmd_AddParm(ts, "-format", CMD_FLAG, CMD_OPTIONAL, 
+              "machine readable format");
+#endif /* FULL_LISTVOL_SWITCH */
     COMMONPARMS;
 
     ts = cmd_CreateSyntax("syncvldb", SyncVldb, 0, "synchronize VLDB with server");
@@ -3842,9 +4114,19 @@ char **argv; {
     cmd_AddParm(ts, "-id", CMD_SINGLE, 0, "volume name or ID");
     cmd_AddParm(ts, "-extended", CMD_FLAG, CMD_OPTIONAL,
                "list extended volume fields");
+#ifdef FULL_LISTVOL_SWITCH
+    cmd_AddParm(ts, "-format", CMD_FLAG, CMD_OPTIONAL, 
+              "machine readable format");
+#endif /* FULL_LISTVOL_SWITCH */
     COMMONPARMS;
     cmd_CreateAlias (ts, "volinfo");
 
+    ts = cmd_CreateSyntax("setfields", SetFields, 0, "change volume info fields");
+    cmd_AddParm(ts, "-id",        CMD_SINGLE, 0, "volume name or ID");
+    cmd_AddParm(ts, "-maxquota", CMD_SINGLE, CMD_OPTIONAL, "quota (KB)");
+    cmd_AddParm(ts, "-clearuse",  CMD_FLAG,   CMD_OPTIONAL, "clear dayUse");
+    COMMONPARMS;
+
     ts = cmd_CreateSyntax("offline", volOffline, 0, (char *) CMD_HIDDEN);
     cmd_AddParm(ts, "-server",    CMD_SINGLE, 0, "server name");
     cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name");