OPENAFS-SA-2016-002 VldbListByAttributes information leak
[openafs.git] / src / libadmin / vos / vsprocs.c
index 6cedbc8..ecc618b 100644 (file)
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID
-    ("$Header$");
+#include <roken.h>
+
+#include <afs/afs_AdminErrors.h>
 
 #include "vsprocs.h"
 #include "vosutils.h"
 #include "lockprocs.h"
 #include "../adminutil/afs_AdminInternal.h"
-#include <afs/afs_AdminErrors.h>
 #include "afs_vosAdmin.h"
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef AFS_NT40_ENV
-#include <io.h>
-#endif
 
-static afs_int32 GroupEntries();
+static afs_int32 GroupEntries(struct rx_connection *server, volintInfo * pntr, afs_int32 count,
+             struct qHead *myQueue, afs_int32 apart);
 
 struct release {
     afs_int32 time;
@@ -66,12 +54,11 @@ UV_Bind(afs_cell_handle_p cellHandle, afs_int32 aserver, afs_int32 port)
  * start a transaction, delete the <delvol> */
 static afs_int32
 CheckAndDeleteVolume(struct rx_connection *aconn, afs_int32 apart,
-                    afs_int32 okvol, afs_int32 delvol)
+                    afs_uint32 okvol, afs_uint32 delvol)
 {
     afs_int32 error, code, tid, rcode;
 
     error = 0;
-    code = 0;
 
     if (okvol == 0) {
        code = AFSVolTransCreate(aconn, delvol, apart, ITOffline, &tid);
@@ -114,7 +101,7 @@ CheckAndDeleteVolume(struct rx_connection *aconn, afs_int32 apart,
 /* forcibly remove a volume.  Very dangerous call */
 int
 UV_NukeVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
-             unsigned int partition, unsigned int volumeId, afs_status_p st)
+             unsigned int partition, afs_uint32 volumeId, afs_status_p st)
 {
     int rc = 0;
     afs_status_t tst = 0;
@@ -135,8 +122,8 @@ UV_NukeVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
 * back new vol id in <anewid>*/
 int
 UV_CreateVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
-               unsigned int partition, const char *volumeName,
-               unsigned int quota, unsigned int *volumeId, afs_status_p st)
+               unsigned int partition, char *volumeName,
+               unsigned int quota, afs_uint32 *volumeId, afs_status_p st)
 {
     int rc = 0;
     afs_status_t tst = 0;
@@ -150,7 +137,7 @@ UV_CreateVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
     tstatus.maxquota = quota;
 
     /* next the next 3 available ids from the VLDB */
-    tst = ubik_Call(VL_GetNewVolumeId, cellHandle->vos, 0, 3, volumeId);
+    tst = ubik_VL_GetNewVolumeId(cellHandle->vos, 0, 3, volumeId);
     if (tst) {
        goto fail_UV_CreateVolume;
     }
@@ -174,8 +161,8 @@ UV_CreateVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
     entry.nServers = 1;
     entry.serverNumber[0] = ntohl(rx_HostOf(rx_PeerOf(server)));
     entry.serverPartition[0] = partition;
-    entry.flags = RW_EXISTS;
-    entry.serverFlags[0] = ITSRWVOL;
+    entry.flags = VLF_RWEXISTS;
+    entry.serverFlags[0] = VLSF_RWVOL;
     entry.volumeId[RWVOL] = *volumeId;
     entry.volumeId[ROVOL] = *volumeId + 1;
     entry.volumeId[BACKVOL] = *volumeId + 2;
@@ -212,7 +199,7 @@ UV_CreateVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
  */
 int
 UV_DeleteVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
-               unsigned int partition, unsigned int volumeId,
+               unsigned int partition, afs_uint32 volumeId,
                afs_status_p st)
 {
     int rc = 0;
@@ -229,7 +216,7 @@ UV_DeleteVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
 
     /* Find and read the VLDB entry for this volume */
     tst =
-       ubik_Call(VL_SetLock, cellHandle->vos, 0, volumeId, avoltype,
+       ubik_VL_SetLock(cellHandle->vos, 0, volumeId, avoltype,
                  VLOP_DELETE);
     if (tst) {
        if (tst != VL_NOENT) {
@@ -239,7 +226,7 @@ UV_DeleteVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
     } else {
        islocked = 1;
 
-       if (!VLDB_GetEntryByID(cellHandle, volumeId, avoltype, &entry, &tst)) {
+       if (!aVLDB_GetEntryByID(cellHandle, volumeId, avoltype, &entry, &tst)) {
            goto fail_UV_DeleteVolume;
        }
 
@@ -271,13 +258,13 @@ UV_DeleteVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
     }
 
     if (volumeId == entry.volumeId[BACKVOL]) {
-       if (!(entry.flags & BACK_EXISTS)
+       if (!(entry.flags & VLF_BACKEXISTS)
            || !Lp_Match(cellHandle, &entry, serverAddr, partition, &tst)) {
            notinvldb = 2;
            goto fail_UV_DeleteVolume;
        }
 
-       entry.flags &= ~BACK_EXISTS;
+       entry.flags &= ~VLF_BACKEXISTS;
        vtype = BACKVOL;
     }
 
@@ -290,13 +277,13 @@ UV_DeleteVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
        Lp_SetROValue(cellHandle, &entry, serverAddr, partition, 0, 0);
        entry.nServers--;
        if (!Lp_ROMatch(cellHandle, &entry, 0, 0, &tst)) {
-           entry.flags &= ~RO_EXISTS;
+           entry.flags &= ~VLF_ROEXISTS;
        }
        vtype = ROVOL;
     }
 
     else if (volumeId == entry.volumeId[RWVOL]) {
-       if (!(entry.flags & RW_EXISTS)
+       if (!(entry.flags & VLF_RWEXISTS)
            || !Lp_Match(cellHandle, &entry, serverAddr, partition, &tst)) {
            notinvldb = 2;
            goto fail_UV_DeleteVolume;
@@ -321,7 +308,7 @@ UV_DeleteVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
 
        Lp_SetRWValue(cellHandle, &entry, serverAddr, partition, 0L, 0L);
        entry.nServers--;
-       entry.flags &= ~(BACK_EXISTS | RW_EXISTS);
+       entry.flags &= ~(VLF_BACKEXISTS | VLF_RWEXISTS);
        vtype = RWVOL;
 
     }
@@ -331,8 +318,8 @@ UV_DeleteVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
        goto fail_UV_DeleteVolume;
     }
 
-    if ((entry.nServers <= 0) || !(entry.flags & (RO_EXISTS | RW_EXISTS))) {
-       tst = ubik_Call(VL_DeleteEntry, cellHandle->vos, 0, volumeId, vtype);
+    if ((entry.nServers <= 0) || !(entry.flags & (VLF_ROEXISTS | VLF_RWEXISTS))) {
+       tst = ubik_VL_DeleteEntry(cellHandle->vos, 0, volumeId, vtype);
        if (tst) {
            goto fail_UV_DeleteVolume;
        }
@@ -364,7 +351,7 @@ UV_DeleteVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
 
     if (islocked) {
        temp =
-           ubik_Call(VL_ReleaseLock, cellHandle->vos, 0, volumeId, -1,
+           ubik_VL_ReleaseLock(cellHandle->vos, 0, volumeId, -1,
                      (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP));
        if (temp) {
            if (!tst)
@@ -385,7 +372,7 @@ UV_DeleteVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
  */
 
 int
-UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
+UV_MoveVolume(afs_cell_handle_p cellHandle, afs_uint32 afromvol,
              afs_int32 afromserver, afs_int32 afrompart, afs_int32 atoserver,
              afs_int32 atopart, afs_status_p st)
 {
@@ -400,13 +387,12 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
     afs_int32 rcode;
     afs_int32 fromDate;
     struct restoreCookie cookie;
-    afs_int32 newVol, volid, backupId;
+    afs_uint32 newVol, volid, backupId;
     struct volser_status tstatus;
     struct destServer destination;
 
     struct nvldbentry entry;
-    int islocked, pntg;
-    afs_int32 error;
+    int islocked;
     int same;
     afs_int32 store_flags;
 
@@ -421,13 +407,11 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
     fromtid = 0;
     totid = 0;
     clonetid = 0;
-    error = 0;
     volid = 0;
-    pntg = 0;
     backupId = 0;
     newVol = 0;
 
-    if (!VLDB_GetEntryByID(cellHandle, afromvol, -1, &entry, &tst)) {
+    if (!aVLDB_GetEntryByID(cellHandle, afromvol, -1, &entry, &tst)) {
        goto fail_UV_MoveVolume;
     }
 
@@ -437,13 +421,13 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
     }
 
     tst =
-       ubik_Call(VL_SetLock, cellHandle->vos, 0, afromvol, RWVOL, VLOP_MOVE);
+       ubik_VL_SetLock(cellHandle->vos, 0, afromvol, RWVOL, VLOP_MOVE);
     if (tst) {
        goto fail_UV_MoveVolume;
     }
     islocked = 1;
 
-    if (!VLDB_GetEntryByID(cellHandle, afromvol, RWVOL, &entry, &tst)) {
+    if (!aVLDB_GetEntryByID(cellHandle, afromvol, RWVOL, &entry, &tst)) {
        goto fail_UV_MoveVolume;
     }
 
@@ -454,7 +438,7 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
        if (!Lp_Match(cellHandle, &entry, atoserver, atopart, &tst)) {
            /* the to server and partition do not exist in the vldb entry corresponding to volid */
            tst =
-               ubik_Call(VL_ReleaseLock, cellHandle->vos, 0, afromvol, -1,
+               ubik_VL_ReleaseLock(cellHandle->vos, 0, afromvol, -1,
                          (LOCKREL_OPCODE | LOCKREL_AFSID |
                           LOCKREL_TIMESTAMP));
            if (tst) {
@@ -471,7 +455,6 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
         */
        fromconn = UV_Bind(cellHandle, afromserver, AFSCONF_VOLUMEPORT);
        fromtid = 0;
-       pntg = 1;
 
        tst =
            AFSVolTransCreate(fromconn, afromvol, afrompart, ITOffline,
@@ -526,7 +509,6 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
        }
 
        fromtid = 0;
-       error = 0;
        goto fail_UV_MoveVolume;
     }
 
@@ -545,7 +527,6 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
        }
     }
 
-    pntg = 1;
     toconn = UV_Bind(cellHandle, atoserver, AFSCONF_VOLUMEPORT);       /* get connections to the servers */
     fromconn = UV_Bind(cellHandle, afromserver, AFSCONF_VOLUMEPORT);
     fromtid = totid = 0;       /* initialize to uncreated */
@@ -561,7 +542,7 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
 
     /* Get a clone id */
     newVol = 0;
-    tst = ubik_Call(VL_GetNewVolumeId, cellHandle->vos, 0, 1, &newVol);
+    tst = ubik_VL_GetNewVolumeId(cellHandle->vos, 0, 1, &newVol);
     if (tst) {
        goto fail_UV_MoveVolume;
     }
@@ -736,7 +717,7 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
     Lp_SetRWValue(cellHandle, &entry, afromserver, afrompart, atoserver,
                  atopart);
     store_flags = entry.flags;
-    entry.flags &= ~BACK_EXISTS;
+    entry.flags &= ~VLF_BACKEXISTS;
 
     if (!VLDB_ReplaceEntry
        (cellHandle, afromvol, -1, &entry,
@@ -824,7 +805,7 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
 
     if (islocked) {
        etst =
-           ubik_Call(VL_ReleaseLock, cellHandle->vos, 0, afromvol, -1,
+           ubik_VL_ReleaseLock(cellHandle->vos, 0, afromvol, -1,
                      (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP));
        if (etst) {
            if (!tst)
@@ -878,7 +859,7 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
 
     /* unlock VLDB entry */
     if (islocked)
-       ubik_Call(VL_ReleaseLock, cellHandle->vos, 0, afromvol, -1,
+       ubik_VL_ReleaseLock(cellHandle->vos, 0, afromvol, -1,
                  (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP));
 
     if (clonetid)
@@ -890,7 +871,7 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
        AFSVolEndTrans(fromconn, fromtid, &rcode);
     }
 
-    if (!VLDB_GetEntryByID(cellHandle, afromvol, -1, &entry, &tst)) {
+    if (!aVLDB_GetEntryByID(cellHandle, afromvol, -1, &entry, &tst)) {
        goto done;
     }
 
@@ -962,7 +943,7 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
     }
 
     /* unlock VLDB entry */
-    ubik_Call(VL_ReleaseLock, cellHandle->vos, 0, afromvol, -1,
+    ubik_VL_ReleaseLock(cellHandle->vos, 0, afromvol, -1,
              (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP));
 
   done:                        /* routine cleanup */
@@ -989,12 +970,12 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
 
 int
 UV_BackupVolume(afs_cell_handle_p cellHandle, afs_int32 aserver,
-               afs_int32 apart, afs_int32 avolid, afs_status_p st)
+               afs_int32 apart, afs_uint32 avolid, afs_status_p st)
 {
     int rc = 0;
     afs_status_t tst = 0, temp = 0;
     afs_int32 ttid = 0, btid = 0;
-    afs_int32 backupID;
+    afs_uint32 backupID;
     afs_int32 rcode = 0;
     char vname[VOLSER_MAXVOLNAME + 1];
     struct nvldbentry entry;
@@ -1005,20 +986,20 @@ UV_BackupVolume(afs_cell_handle_p cellHandle, afs_int32 aserver,
 
     /* the calls to VLDB will succeed only if avolid is a RW volume,
      * since we are following the RW hash chain for searching */
-    if (!VLDB_GetEntryByID(cellHandle, avolid, RWVOL, &entry, &tst)) {
+    if (!aVLDB_GetEntryByID(cellHandle, avolid, RWVOL, &entry, &tst)) {
        goto fail_UV_BackupVolume;
     }
 
     /* These operations require the VLDB be locked since it means the VLDB
      * will change or the vldb is already locked.
      */
-    if (!(entry.flags & BACK_EXISTS) ||        /* backup volume doesnt exist */
+    if (!(entry.flags & VLF_BACKEXISTS) ||     /* backup volume doesnt exist */
        (entry.flags & VLOP_ALLOPERS) ||        /* vldb lock already held */
        (entry.volumeId[BACKVOL] == INVALID_BID)) {
        /* no assigned backup volume id */
 
        tst =
-           ubik_Call(VL_SetLock, cellHandle->vos, 0, avolid, RWVOL,
+           ubik_VL_SetLock(cellHandle->vos, 0, avolid, RWVOL,
                      VLOP_BACKUP);
        if (tst) {
            goto fail_UV_BackupVolume;
@@ -1026,7 +1007,7 @@ UV_BackupVolume(afs_cell_handle_p cellHandle, afs_int32 aserver,
        vldblocked = 1;
 
        /* Reread the vldb entry */
-       if (!VLDB_GetEntryByID(cellHandle, avolid, RWVOL, &entry, &tst)) {
+       if (!aVLDB_GetEntryByID(cellHandle, avolid, RWVOL, &entry, &tst)) {
            goto fail_UV_BackupVolume;
        }
     }
@@ -1041,7 +1022,7 @@ UV_BackupVolume(afs_cell_handle_p cellHandle, afs_int32 aserver,
        /* Get a backup volume id from the VLDB and update the vldb
         * entry with it. 
         */
-       tst = ubik_Call(VL_GetNewVolumeId, cellHandle->vos, 0, 1, &backupID);
+       tst = ubik_VL_GetNewVolumeId(cellHandle->vos, 0, 1, &backupID);
        if (tst) {
            goto fail_UV_BackupVolume;
        }
@@ -1103,8 +1084,8 @@ UV_BackupVolume(afs_cell_handle_p cellHandle, afs_int32 aserver,
     }
 
     /* Mork vldb as backup exists */
-    if (!(entry.flags & BACK_EXISTS)) {
-       entry.flags |= BACK_EXISTS;
+    if (!(entry.flags & VLF_BACKEXISTS)) {
+       entry.flags |= VLF_BACKEXISTS;
        vldbmod = 1;
     }
 
@@ -1160,7 +1141,7 @@ UV_BackupVolume(afs_cell_handle_p cellHandle, afs_int32 aserver,
            }
        } else {
            temp =
-               ubik_Call(VL_ReleaseLock, cellHandle->vos, 0, avolid, RWVOL,
+               ubik_VL_ReleaseLock(cellHandle->vos, 0, avolid, RWVOL,
                          (LOCKREL_OPCODE | LOCKREL_AFSID |
                           LOCKREL_TIMESTAMP));
            if (temp) {
@@ -1182,18 +1163,16 @@ UV_BackupVolume(afs_cell_handle_p cellHandle, afs_int32 aserver,
 }
 
 static int
-DelVol(struct rx_connection *conn, afs_int32 vid, afs_int32 part,
+DelVol(struct rx_connection *conn, afs_uint32 vid, afs_int32 part,
        afs_int32 flags)
 {
-    afs_int32 acode, ccode, rcode, tid;
-    ccode = rcode = tid = 0;
+    afs_int32 acode, rcode, tid;
+    rcode = tid = 0;
 
     acode = AFSVolTransCreate(conn, vid, part, flags, &tid);
     if (!acode) {              /* It really was there */
        acode = AFSVolDeleteVolume(conn, tid);
-       ccode = AFSVolEndTrans(conn, tid, &rcode);
-       if (!ccode)
-           ccode = rcode;
+       AFSVolEndTrans(conn, tid, &rcode);
     }
 
     return acode;
@@ -1205,7 +1184,7 @@ DelVol(struct rx_connection *conn, afs_int32 vid, afs_int32 part,
 #if 0                          /* doesn't appear to be used, why compile it */
 static int
 CloneVol(afs_cell_handle_p cellHandle, struct rx_connection *conn,
-        afs_int32 rwvid, afs_int32 part, afs_int32 * rovidp, int nottemp,
+        afs_uint32 rwvid, afs_int32 part, afs_uint32 * rovidp, int nottemp,
         struct nvldbentry *entry, afs_int32 * vidCreateDate, afs_status_p st)
 {
     int rc = 0;
@@ -1223,7 +1202,7 @@ CloneVol(afs_cell_handle_p cellHandle, struct rx_connection *conn,
     /* Get the RO volume id. Allocate a new one if need to */
     *rovidp = entry->volumeId[ROVOL];
     if (*rovidp == INVALID_BID) {
-       tst = ubik_Call(VL_GetNewVolumeId, cellHandle->vos, 0, 1, rovidp);
+       tst = ubik_VL_GetNewVolumeId(cellHandle->vos, 0, 1, rovidp);
        if (tst) {
            goto fail_CloneVol;
        }
@@ -1315,8 +1294,8 @@ GetTrans(afs_cell_handle_p cellHandle, struct nvldbentry *vldbEntryPtr,
         afs_int32 * transPtr, afs_int32 * timePtr, afs_status_p st)
 {
     int rc = 0;
-    afs_status_t tst = 0, etst = 0;
-    afs_int32 volid;
+    afs_status_t tst = 0;
+    afs_uint32 volid;
     struct volser_status tstatus;
     int rcode;
 
@@ -1344,14 +1323,18 @@ GetTrans(afs_cell_handle_p cellHandle, struct nvldbentry *vldbEntryPtr,
 
     /* If the volume does not exist, create it */
     if (!volid || tst) {
-       char volname[64];
+       char volname[VL_MAXNAMELEN];
 
        if (volid && (tst != VNOVOL)) {
            goto fail_GetTrans;
        }
 
-       strcpy(volname, vldbEntryPtr->name);
-       strcat(volname, ".readonly");
+       strlcpy(volname, vldbEntryPtr->name, sizeof(volname));
+       if (strlcat(volname, ".readonly", sizeof(volname))
+               >= sizeof(volname)) {
+           tst = ENOMEM;
+           goto fail_GetTrans;
+       }
 
        tst =
            AFSVolCreateVolume(*connPtr, vldbEntryPtr->serverPartition[index],
@@ -1387,10 +1370,8 @@ GetTrans(afs_cell_handle_p cellHandle, struct nvldbentry *vldbEntryPtr,
   fail_GetTrans:
 
     if ((rc == 0) && (*transPtr)) {
-       etst = AFSVolEndTrans(*connPtr, *transPtr, &rcode);
+       AFSVolEndTrans(*connPtr, *transPtr, &rcode);
        *transPtr = 0;
-       if (!etst)
-           etst = rcode;
     }
 
     if (st != NULL) {
@@ -1456,7 +1437,7 @@ VolumeExists(afs_cell_handle_p cellHandle, afs_int32 server,
  * sites if forceflag is 1.If its 0 complete the release if the previous
  * release aborted else start a new release */
 int
-UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
+UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_uint32 afromvol,
                 afs_int32 afromserver, afs_int32 afrompart, int forceflag,
                 afs_status_p st)
 {
@@ -1465,7 +1446,7 @@ UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
 
     char vname[64];
     afs_int32 rcode;
-    afs_int32 cloneVolId, roVolId;
+    afs_uint32 cloneVolId, roVolId;
     struct replica *replicas = 0;
     struct nvldbentry entry;
     int i, volcount, m, fullrelease, vldbindex;
@@ -1491,11 +1472,11 @@ UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
     int releasecount = 0;
     struct volser_status volstatus;
 
-    memset((char *)remembertime, 0, sizeof(remembertime));
-    memset((char *)&results, 0, sizeof(results));
+    memset(remembertime, 0, sizeof(remembertime));
+    memset(&results, 0, sizeof(results));
 
     tst =
-       ubik_Call(VL_SetLock, cellHandle->vos, 0, afromvol, RWVOL,
+       ubik_VL_SetLock(cellHandle->vos, 0, afromvol, RWVOL,
                  VLOP_RELEASE);
     if ((tst) && (tst != VL_RERELEASE)) {
        goto fail_UV_ReleaseVolume;
@@ -1503,7 +1484,7 @@ UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
     islocked = 1;
 
     /* Get the vldb entry in readable format */
-    if (!VLDB_GetEntryByID(cellHandle, afromvol, RWVOL, &entry, &tst)) {
+    if (!aVLDB_GetEntryByID(cellHandle, afromvol, RWVOL, &entry, &tst)) {
        goto fail_UV_ReleaseVolume;
     }
 
@@ -1544,7 +1525,7 @@ UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
     /* Make sure we have a RO volume id to work with */
     if (entry.volumeId[ROVOL] == INVALID_BID) {
        /* need to get a new RO volume id */
-       tst = ubik_Call(VL_GetNewVolumeId, cellHandle->vos, 0, 1, &roVolId);
+       tst = ubik_VL_GetNewVolumeId(cellHandle->vos, 0, 1, &roVolId);
        if (tst) {
            goto fail_UV_ReleaseVolume;
        }
@@ -1557,7 +1538,7 @@ UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
 
     /* Will we be completing a previously unfinished release. -force overrides */
     for (fullrelease = 1, i = 0; (fullrelease && (i < entry.nServers)); i++) {
-       if (entry.serverFlags[i] & NEW_REPSITE)
+       if (entry.serverFlags[i] & VLSF_NEWREPSITE)
            fullrelease = 0;
     }
     if (forceflag && !fullrelease)
@@ -1585,7 +1566,7 @@ UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
         * want to "reclone" a temporary RO clone.
         */
        if (roexists
-           && (!roclone || (entry.serverFlags[roindex] & RO_DONTUSE))) {
+           && (!roclone || (entry.serverFlags[roindex] & VLSF_DONTUSE))) {
            tst = DelVol(fromconn, cloneVolId, afrompart, ITOffline);
            if (tst && (tst != VNOVOL)) {
                goto fail_UV_ReleaseVolume;
@@ -1598,11 +1579,11 @@ UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
         * RO volume is released (temp RO clones don't count).
         */
        for (i = 0; i < entry.nServers; i++) {
-           entry.serverFlags[i] &= ~NEW_REPSITE;
-           entry.serverFlags[i] |= RO_DONTUSE;
+           entry.serverFlags[i] &= ~VLSF_NEWREPSITE;
+           entry.serverFlags[i] |= VLSF_DONTUSE;
        }
-       entry.serverFlags[rwindex] |= NEW_REPSITE;
-       entry.serverFlags[rwindex] &= ~RO_DONTUSE;
+       entry.serverFlags[rwindex] |= VLSF_NEWREPSITE;
+       entry.serverFlags[rwindex] &= ~VLSF_DONTUSE;
 
        /* Begin transaction on RW and mark it busy while we clone it */
        tst =
@@ -1682,9 +1663,9 @@ UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
                sleep(5);
 
            /* Mark the RO clone in the VLDB as a good site (already released) */
-           entry.serverFlags[roindex] |= NEW_REPSITE;
-           entry.serverFlags[roindex] &= ~RO_DONTUSE;
-           entry.flags |= RO_EXISTS;
+           entry.serverFlags[roindex] |= VLSF_NEWREPSITE;
+           entry.serverFlags[roindex] &= ~VLSF_DONTUSE;
+           entry.flags |= VLF_ROEXISTS;
 
            releasecount++;
 
@@ -1717,24 +1698,15 @@ UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
     cookie.clone = 0;
 
     nservers = entry.nServers / 2;     /* how many to do at once, excluding clone */
-    replicas =
-       (struct replica *)malloc(sizeof(struct replica) * nservers + 1);
-    times = (struct release *)malloc(sizeof(struct release) * nservers + 1);
-    toconns =
-       (struct rx_connection **)malloc(sizeof(struct rx_connection *) *
-                                       nservers + 1);
-    results.manyResults_val =
-       (afs_int32 *) malloc(sizeof(afs_int32) * nservers + 1);
+    replicas = calloc(nservers + 1, sizeof(struct replica));
+    times = calloc(nservers + 1, sizeof(struct release));
+    toconns = calloc(nservers + 1, sizeof(struct rx_connection *));
+    results.manyResults_val = calloc(nservers + 1, sizeof(afs_int32));
     if (!replicas || !times || !!!results.manyResults_val || !toconns) {
        tst = ADMNOMEM;
        goto fail_UV_ReleaseVolume;
     }
 
-    memset(replicas, 0, (sizeof(struct replica) * nservers + 1));
-    memset(times, 0, (sizeof(struct release) * nservers + 1));
-    memset(toconns, 0, (sizeof(struct rx_connection *) * nservers + 1));
-    memset(results.manyResults_val, 0, (sizeof(afs_int32) * nservers + 1));
-
     /* Create a transaction on the cloned volume */
     tst =
        AFSVolTransCreate(fromconn, cloneVolId, afrompart, ITBusy, &fromtid);
@@ -1759,10 +1731,10 @@ UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
 
            if (vldbindex == roindex)
                continue;       /* the clone    */
-           if ((entry.serverFlags[vldbindex] & NEW_REPSITE)
-               && !(entry.serverFlags[vldbindex] & RO_DONTUSE))
+           if ((entry.serverFlags[vldbindex] & VLSF_NEWREPSITE)
+               && !(entry.serverFlags[vldbindex] & VLSF_DONTUSE))
                continue;
-           if (!(entry.serverFlags[vldbindex] & ITSROVOL))
+           if (!(entry.serverFlags[vldbindex] & VLSF_ROVOL))
                continue;       /* not a RO vol */
 
 
@@ -1867,9 +1839,9 @@ UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
                    continue;
                }
 
-               entry.serverFlags[times[m].vldbEntryIndex] |= NEW_REPSITE;
-               entry.serverFlags[times[m].vldbEntryIndex] &= ~RO_DONTUSE;
-               entry.flags |= RO_EXISTS;
+               entry.serverFlags[times[m].vldbEntryIndex] |= VLSF_NEWREPSITE;
+               entry.serverFlags[times[m].vldbEntryIndex] &= ~VLSF_DONTUSE;
+               entry.flags |= VLF_ROEXISTS;
                releasecount++;
            }
        }
@@ -1905,7 +1877,7 @@ UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
 
     /* Figure out if any volume were not released and say so */
     for (failure = 0, i = 0; i < entry.nServers; i++) {
-       if (!(entry.serverFlags[i] & NEW_REPSITE))
+       if (!(entry.serverFlags[i] & VLSF_NEWREPSITE))
            failure++;
     }
     if (failure) {
@@ -1928,7 +1900,7 @@ UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
     entry.cloneId = 0;
 
     for (i = 0; i < entry.nServers; i++)
-       entry.serverFlags[i] &= ~NEW_REPSITE;
+       entry.serverFlags[i] &= ~VLSF_NEWREPSITE;
 
     /* Update the VLDB */
     if (!VLDB_ReplaceEntry
@@ -1969,7 +1941,7 @@ UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
     }
     if (islocked) {
        tst =
-           ubik_Call(VL_ReleaseLock, cellHandle->vos, 0, afromvol, RWVOL,
+           ubik_VL_ReleaseLock(cellHandle->vos, 0, afromvol, RWVOL,
                      LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP);
        if (tst) {
            rc = 0;
@@ -1994,11 +1966,11 @@ UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
 }
 
 static int
-ReceiveFile(register int fd, register struct rx_call *call,
-           register struct stat *status)
+ReceiveFile(int fd, struct rx_call *call,
+           struct stat *status)
 {
-    register char *buffer = (char *)0;
-    register int blockSize;
+    char *buffer = (char *)0;
+    int blockSize;
     afs_int32 bytesread, nbytes, bytesleft, w;
     fd_set out;
     afs_int32 error = 0;
@@ -2022,7 +1994,7 @@ t structure!! */
     }
 #endif
     nbytes = blockSize;
-    buffer = (char *)malloc(blockSize);
+    buffer = malloc(blockSize);
     if (!buffer) {
        return ADMNOMEM;
     }
@@ -2062,7 +2034,6 @@ DumpFunction(struct rx_call *call, const char *filename)
     afs_int32 error, code;
 
     error = 0;
-    fd = -1;
 
     fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, 0666);
     if (fd < 0 || fstat(fd, &status) < 0) {
@@ -2092,7 +2063,7 @@ DumpFunction(struct rx_call *call, const char *filename)
 * DumpFunction does the real work behind the scenes after
 * extracting parameters from the rock  */
 int
-UV_DumpVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
+UV_DumpVolume(afs_cell_handle_p cellHandle, afs_uint32 afromvol,
              afs_int32 afromserver, afs_int32 afrompart, afs_int32 fromdate,
              const char *filename, afs_status_p st)
 {
@@ -2102,23 +2073,17 @@ UV_DumpVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
     struct rx_connection *fromconn;
     struct rx_call *fromcall;
     afs_int32 fromtid;
-    afs_int32 rxError;
     afs_int32 rcode;
 
     struct nvldbentry entry;
-    afs_int32 error;
     int islocked;
 
     islocked = 0;
-    error = 0;
-    rxError = 0;
-    fromcall = (struct rx_call *)0;
     fromconn = (struct rx_connection *)0;
     fromtid = 0;
     fromcall = (struct rx_call *)0;
 
-    islocked = 0;
-    if (!VLDB_GetEntryByID(cellHandle, afromvol, -1, &entry, &tst)) {
+    if (!aVLDB_GetEntryByID(cellHandle, afromvol, -1, &entry, &tst)) {
        goto fail_UV_DumpVolume;
     }
 
@@ -2136,7 +2101,7 @@ UV_DumpVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
     if ((tst = DumpFunction(fromcall, filename))) {
        goto fail_UV_DumpVolume;
     }
-    tst = rx_EndCall(fromcall, rxError);
+    tst = rx_EndCall(fromcall, 0);
     fromcall = (struct rx_call *)0;
     if (tst) {
        goto fail_UV_DumpVolume;
@@ -2154,7 +2119,7 @@ UV_DumpVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
 
     if (islocked) {
        etst =
-           ubik_Call(VL_ReleaseLock, cellHandle->vos, 0, afromvol, -1,
+           ubik_VL_ReleaseLock(cellHandle->vos, 0, afromvol, -1,
                      LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP);
        if (etst) {
            if (!tst)
@@ -2163,7 +2128,7 @@ UV_DumpVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
     }
 
     if (fromcall) {
-       etst = rx_EndCall(fromcall, rxError);
+       etst = rx_EndCall(fromcall, 0);
        if (etst) {
            if (!tst)
                tst = etst;
@@ -2191,14 +2156,13 @@ UV_DumpVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
 }
 
 int
-SendFile(register int fd, register struct rx_call *call,
-        register struct stat *status)
+SendFile(int fd, struct rx_call *call,
+        struct stat *status)
 {
     char *buffer = (char *)0;
     int blockSize;
     fd_set in;
     afs_int32 error = 0;
-    int done = 0;
     int nbytes;
 
 #ifdef AFS_NT40_ENV
@@ -2219,12 +2183,12 @@ t structure!! */
        blockSize = 4096;
     }
 #endif
-    buffer = (char *)malloc(blockSize);
+    buffer = malloc(blockSize);
     if (!buffer) {
        return ADMNOMEM;
     }
 
-    while (!error && !done) {
+    while (!error) {
        FD_ZERO(&in);
        FD_SET(fd, &in);
 #ifndef AFS_NT40_ENV           /* NT csn't select on non-socket fd's */
@@ -2235,10 +2199,10 @@ t structure!! */
            error = ADMVOSRESTOREFILEREADFAIL;
            break;
        }
-       if (nbytes == 0) {
-           done = 1;
+
+       if (nbytes == 0)
            break;
-       }
+
        if (rx_Write(call, buffer, nbytes) != nbytes) {
            error = ADMVOSRESTOREFILEWRITEFAIL;
            break;
@@ -2257,7 +2221,6 @@ WriteData(struct rx_call *call, const char *filename)
     afs_int32 error, code;
 
     error = 0;
-    fd = -1;
 
     fd = open(filename, 0);
     if (fd < 0 || fstat(fd, &status) < 0) {
@@ -2291,7 +2254,7 @@ WriteData(struct rx_call *call, const char *filename)
  */
 int
 UV_RestoreVolume(afs_cell_handle_p cellHandle, afs_int32 toserver,
-                afs_int32 topart, afs_int32 tovolid, const char *tovolname,
+                afs_int32 topart, afs_uint32 tovolid, char *tovolname,
                 int flags, const char *dumpFile, afs_status_p st)
 {
     int rc = 0;
@@ -2300,14 +2263,12 @@ UV_RestoreVolume(afs_cell_handle_p cellHandle, afs_int32 toserver,
     struct rx_connection *toconn, *tempconn;
     struct rx_call *tocall;
     afs_int32 totid, rcode;
-    afs_int32 rxError = 0;
     struct volser_status tstatus;
     char partName[10];
-    afs_int32 pvolid;
+    afs_uint32 pvolid;
     afs_int32 temptid;
     int success;
     struct nvldbentry entry;
-    afs_int32 error;
     int islocked;
     struct restoreCookie cookie;
     int reuseID;
@@ -2317,11 +2278,8 @@ UV_RestoreVolume(afs_cell_handle_p cellHandle, afs_int32 toserver,
 
     memset(&cookie, 0, sizeof(cookie));
     islocked = 0;
-    success = 0;
-    error = 0;
     reuseID = 1;
     tocall = (struct rx_call *)0;
-    toconn = (struct rx_connection *)0;
     tempconn = (struct rx_connection *)0;
     totid = 0;
     temptid = 0;
@@ -2329,10 +2287,10 @@ UV_RestoreVolume(afs_cell_handle_p cellHandle, afs_int32 toserver,
     pvolid = tovolid;
     toconn = UV_Bind(cellHandle, toserver, AFSCONF_VOLUMEPORT);
     if (pvolid == 0) {         /*alot a new id if needed */
-       VLDB_GetEntryByName(cellHandle, tovolname, &entry, &tst);
+       aVLDB_GetEntryByName(cellHandle, tovolname, &entry, &tst);
        if (tst == VL_NOENT) {
            tst =
-               ubik_Call(VL_GetNewVolumeId, cellHandle->vos, 0, 1, &pvolid);
+               ubik_VL_GetNewVolumeId(cellHandle->vos, 0, 1, &pvolid);
            if (tst) {
                goto fail_UV_RestoreVolume;
            }
@@ -2411,7 +2369,7 @@ UV_RestoreVolume(afs_cell_handle_p cellHandle, afs_int32 toserver,
     if (tst) {
        goto fail_UV_RestoreVolume;
     }
-    tst = rx_EndCall(tocall, rxError);
+    tst = rx_EndCall(tocall, 0);
     tocall = (struct rx_call *)0;
     if (tst) {
        goto fail_UV_RestoreVolume;
@@ -2450,7 +2408,7 @@ UV_RestoreVolume(afs_cell_handle_p cellHandle, afs_int32 toserver,
        /* Volume was restored on the file server, update the 
         * VLDB to reflect the change.
         */
-       VLDB_GetEntryByID(cellHandle, pvolid, RWVOL, &entry, &tst);
+       aVLDB_GetEntryByID(cellHandle, pvolid, RWVOL, &entry, &tst);
        if (tst && tst != VL_NOENT && tst != VL_ENTDELETED) {
            goto fail_UV_RestoreVolume;
        }
@@ -2460,8 +2418,8 @@ UV_RestoreVolume(afs_cell_handle_p cellHandle, afs_int32 toserver,
            entry.nServers = 1;
            entry.serverNumber[0] = toserver;   /*should be indirect */
            entry.serverPartition[0] = topart;
-           entry.serverFlags[0] = ITSRWVOL;
-           entry.flags = RW_EXISTS;
+           entry.serverFlags[0] = VLSF_RWVOL;
+           entry.flags = VLF_RWEXISTS;
            if (tstatus.cloneID != 0) {
                entry.volumeId[ROVOL] = tstatus.cloneID;        /*this should come from status info on the volume if non zero */
            } else
@@ -2479,7 +2437,7 @@ UV_RestoreVolume(afs_cell_handle_p cellHandle, afs_int32 toserver,
            islocked = 0;
        } else {                /*update the existing entry */
            tst =
-               ubik_Call(VL_SetLock, cellHandle->vos, 0, pvolid, RWVOL,
+               ubik_VL_SetLock(cellHandle->vos, 0, pvolid, RWVOL,
                          VLOP_RESTORE);
            if (tst) {
                goto fail_UV_RestoreVolume;
@@ -2493,7 +2451,7 @@ UV_RestoreVolume(afs_cell_handle_p cellHandle, afs_int32 toserver,
                /* Add the rw site for the volume being restored */
                entry.serverNumber[entry.nServers] = toserver;
                entry.serverPartition[entry.nServers] = topart;
-               entry.serverFlags[entry.nServers] = ITSRWVOL;
+               entry.serverFlags[entry.nServers] = VLSF_RWVOL;
                entry.nServers++;
            } else {
                /* This volume should be deleted on the old site
@@ -2537,7 +2495,7 @@ UV_RestoreVolume(afs_cell_handle_p cellHandle, afs_int32 toserver,
                entry.serverPartition[index] = topart;
            }
 
-           entry.flags |= RW_EXISTS;
+           entry.flags |= VLF_RWEXISTS;
            if (!VLDB_ReplaceEntry
                (cellHandle, pvolid, RWVOL, &entry,
                 LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP, &tst)) {
@@ -2551,13 +2509,13 @@ UV_RestoreVolume(afs_cell_handle_p cellHandle, afs_int32 toserver,
   fail_UV_RestoreVolume:
 
     if (tocall) {
-       etst = rx_EndCall(tocall, rxError);
+       etst = rx_EndCall(tocall, 0);
        if (!tst)
            tst = etst;
     }
     if (islocked) {
        etst =
-           ubik_Call(VL_ReleaseLock, cellHandle->vos, 0, pvolid, RWVOL,
+           ubik_VL_ReleaseLock(cellHandle->vos, 0, pvolid, RWVOL,
                      LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP);
        if (etst) {
            if (!tst)
@@ -2598,7 +2556,7 @@ UV_RestoreVolume(afs_cell_handle_p cellHandle, afs_int32 toserver,
 *in vldb */
 int
 UV_AddSite(afs_cell_handle_p cellHandle, afs_int32 server, afs_int32 part,
-          afs_int32 volid, afs_status_p st)
+          afs_uint32 volid, afs_status_p st)
 {
     int rc = 0;
     afs_status_t tst = 0;
@@ -2607,13 +2565,13 @@ UV_AddSite(afs_cell_handle_p cellHandle, afs_int32 server, afs_int32 part,
     int same = 0;
 
     tst =
-       ubik_Call(VL_SetLock, cellHandle->vos, 0, volid, RWVOL, VLOP_ADDSITE);
+       ubik_VL_SetLock(cellHandle->vos, 0, volid, RWVOL, VLOP_ADDSITE);
     if (tst) {
        goto fail_UV_AddSite;
     }
     islocked = 1;
 
-    if (!VLDB_GetEntryByID(cellHandle, volid, RWVOL, &entry, &tst)) {
+    if (!aVLDB_GetEntryByID(cellHandle, volid, RWVOL, &entry, &tst)) {
        goto fail_UV_AddSite;
     }
     if (!ISNAMEVALID(entry.name)) {
@@ -2629,7 +2587,7 @@ UV_AddSite(afs_cell_handle_p cellHandle, afs_int32 server, afs_int32 part,
 
     /* See if it's on the same server */
     for (j = 0; j < entry.nServers; j++) {
-       if (entry.serverFlags[j] & ITSROVOL) {
+       if (entry.serverFlags[j] & VLSF_ROVOL) {
            nro++;
            if (!VLDB_IsSameAddrs
                (cellHandle, server, entry.serverNumber[j], &same, &tst)) {
@@ -2650,7 +2608,7 @@ UV_AddSite(afs_cell_handle_p cellHandle, afs_int32 server, afs_int32 part,
 
     entry.serverNumber[entry.nServers] = server;
     entry.serverPartition[entry.nServers] = part;
-    entry.serverFlags[entry.nServers] = (ITSROVOL | RO_DONTUSE);
+    entry.serverFlags[entry.nServers] = (VLSF_ROVOL | VLSF_DONTUSE);
     entry.nServers++;
 
     if (!VLDB_ReplaceEntry
@@ -2665,7 +2623,7 @@ UV_AddSite(afs_cell_handle_p cellHandle, afs_int32 server, afs_int32 part,
 
     if (islocked) {
        tst =
-           ubik_Call(VL_ReleaseLock, cellHandle->vos, 0, volid, RWVOL,
+           ubik_VL_ReleaseLock(cellHandle->vos, 0, volid, RWVOL,
                      LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP);
     }
 
@@ -2678,7 +2636,7 @@ UV_AddSite(afs_cell_handle_p cellHandle, afs_int32 server, afs_int32 part,
 /*removes <server> <part> as read only site for <volid> from the vldb */
 int
 UV_RemoveSite(afs_cell_handle_p cellHandle, afs_int32 server, afs_int32 part,
-             afs_int32 volid, afs_status_p st)
+             afs_uint32 volid, afs_status_p st)
 {
     int rc = 0;
     afs_status_t tst = 0;
@@ -2686,13 +2644,13 @@ UV_RemoveSite(afs_cell_handle_p cellHandle, afs_int32 server, afs_int32 part,
     int islocked = 0;
 
     tst =
-       ubik_Call(VL_SetLock, cellHandle->vos, 0, volid, RWVOL, VLOP_ADDSITE);
+       ubik_VL_SetLock(cellHandle->vos, 0, volid, RWVOL, VLOP_ADDSITE);
     if (tst) {
        goto fail_UV_RemoveSite;
     }
     islocked = 1;
 
-    if (!VLDB_GetEntryByID(cellHandle, volid, RWVOL, &entry, &tst)) {
+    if (!aVLDB_GetEntryByID(cellHandle, volid, RWVOL, &entry, &tst)) {
        goto fail_UV_RemoveSite;
     }
     if (!Lp_ROMatch(cellHandle, &entry, server, part, &tst)) {
@@ -2701,10 +2659,10 @@ UV_RemoveSite(afs_cell_handle_p cellHandle, afs_int32 server, afs_int32 part,
     } else {                   /*remove the rep site */
        Lp_SetROValue(cellHandle, &entry, server, part, 0, 0);
        entry.nServers--;
-       if ((entry.nServers == 1) && (entry.flags & RW_EXISTS))
-           entry.flags &= ~RO_EXISTS;
+       if ((entry.nServers == 1) && (entry.flags & VLF_RWEXISTS))
+           entry.flags &= ~VLF_ROEXISTS;
        if (entry.nServers < 1) {       /*this is the last ref */
-           tst = ubik_Call(VL_DeleteEntry, cellHandle->vos, 0, volid, ROVOL);
+           tst = ubik_VL_DeleteEntry(cellHandle->vos, 0, volid, ROVOL);
            if (tst) {
                goto fail_UV_RemoveSite;
            }
@@ -2721,7 +2679,7 @@ UV_RemoveSite(afs_cell_handle_p cellHandle, afs_int32 server, afs_int32 part,
 
     if (islocked) {
        afs_status_t t;
-       t = ubik_Call(VL_ReleaseLock, cellHandle->vos, 0, volid, RWVOL,
+       t = ubik_VL_ReleaseLock(cellHandle->vos, 0, volid, RWVOL,
                      LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP);
        if (tst == 0) {
            tst = t;
@@ -2743,7 +2701,7 @@ UV_ListPartitions(struct rx_connection *server, struct partList *ptrPartList,
     afs_status_t tst = 0;
     struct pIDs partIds;
     struct partEntries partEnts;
-    register int i, j = 0;
+    int i, j = 0;
 
     *cntp = 0;
 
@@ -2901,7 +2859,7 @@ UV_XListVolumes(struct rx_connection *server, afs_int32 a_partID, int a_all,
 
 int
 UV_XListOneVolume(struct rx_connection *server, afs_int32 a_partID,
-                 afs_int32 a_volID, struct volintXInfo **a_resultPP,
+                 afs_uint32 a_volID, struct volintXInfo **a_resultPP,
                  afs_status_p st)
 {
     int rc = 0;
@@ -2938,14 +2896,76 @@ UV_XListOneVolume(struct rx_connection *server, afs_int32 a_partID,
 
 }                              /*UV_XListOneVolume */
 
+/*------------------------------------------------------------------------
+ * EXPORTED UV_ListOneVolume
+ *
+ * Description:
+ *     List the volume information for a volume on a particular File
+ *     Server and partition.
+ *
+ * Arguments:
+ *     server     : a handle to the server where the volume resides.
+ *     a_partID           : Partition for which we want the extended
+ *                             volume info.
+ *     a_volID            : Volume ID for which we want the info.
+ *     a_resultPP         : Ptr to the address of the area containing
+ *                             the returned volume info.
+ *
+ * Returns:
+ *     0 on success,
+ *     Otherise, the return value of AFSVolXListOneVolume.
+ *
+ * Side Effects:
+ *     As advertised.
+ *------------------------------------------------------------------------*/
+
+int UV_ListOneVolume(struct rx_connection *server, afs_int32 a_partID,
+                 afs_uint32 a_volID, struct volintInfo **a_resultPP,
+                 afs_status_p st)
+{
+    int rc = 0;
+    afs_status_t tst = 0;
+    volEntries volumeInfo;     /*Area for returned info */
+
+    /*
+     * Set the area we're in which we are returning
+     * the info.  Setting the val field to a null pointer tells the stub
+     * to allocate space for us.
+     */
+    *a_resultPP = (volintInfo *) 0;
+    volumeInfo.volEntries_val = (volintInfo *) 0;
+    volumeInfo.volEntries_len = 0;
+
+    tst = AFSVolListOneVolume(server, a_partID, a_volID, &volumeInfo);
+
+    if (tst) {
+       goto fail_UV_ListOneVolume;
+    } else {
+       /*
+        * We got the info; pull out the pointer to where the results lie.
+        */
+       *a_resultPP = volumeInfo.volEntries_val;
+    }
+    rc = 1;
+
+  fail_UV_ListOneVolume:
+
+    if (st != NULL) {
+       *st = tst;
+    }
+    return rc;
+}/*UV_ListOneVolume*/
+
 /*sync vldb with all the entries on <myQueue> on <aserver> and <apart>*/
 static afs_int32
 ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
               struct rx_connection *server, afs_int32 apart, afs_int32 force)
 {
     struct aqueue elem;
-    int success, temp, temp1, temp2;
-    afs_int32 vcode, maxVolid = 0;
+    int success, temp;
+    afs_uint32 temp2;
+    afs_int32 vcode;
+    afs_uint32 maxVolid = 0;
     struct nvldbentry entry;
     int noError = 1, error, same;
     int totalC, totalU, totalCE, totalUE, totalG;
@@ -2957,7 +2977,7 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
     counter = 0;
 
     /* get the next  available id's from the vldb server */
-    vcode = ubik_Call(VL_GetNewVolumeId, cellHandle->vos, 0, 0, &maxVolid);
+    vcode = ubik_VL_GetNewVolumeId(cellHandle->vos, 0, 0, &maxVolid);
     if (vcode) {
        return (vcode);
     }
@@ -2975,38 +2995,36 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
            continue;
        }
        if (maxVolid <= elem.ids[RWVOL]) {
-           temp1 = maxVolid;
            temp2 = elem.ids[RWVOL] - maxVolid + 1;
            maxVolid = 0;
-           vcode =
-               ubik_Call(VL_GetNewVolumeId, cellHandle->vos, 0, temp2,
-                         &maxVolid);
-           maxVolid += temp2;
-
+           vcode = ubik_VL_GetNewVolumeId(cellHandle->vos, 0, temp2,
+                                          &maxVolid);
+           if (vcode)
+               return vcode;
 
+           maxVolid += temp2;
        }
        if (maxVolid <= elem.ids[ROVOL]) {
-
-           temp1 = maxVolid;
            temp2 = elem.ids[ROVOL] - maxVolid + 1;
            maxVolid = 0;
-           vcode =
-               ubik_Call(VL_GetNewVolumeId, cellHandle->vos, 0, temp2,
-                         &maxVolid);
-           maxVolid += temp2;
+           vcode = ubik_VL_GetNewVolumeId(cellHandle->vos, 0, temp2,
+                                          &maxVolid);
+           if (vcode)
+               return vcode;
 
+           maxVolid += temp2;
        }
        if (maxVolid <= elem.ids[BACKVOL]) {
-           temp1 = maxVolid;
-           temp2 = elem.ids[BACKVOL] - temp1 + 1;
+           temp2 = elem.ids[BACKVOL] - maxVolid + 1;
            maxVolid = 0;
-           vcode =
-               ubik_Call(VL_GetNewVolumeId, cellHandle->vos, 0, temp2,
-                         &maxVolid);
-           maxVolid += temp2;
+           vcode = ubik_VL_GetNewVolumeId(cellHandle->vos, 0, temp2,
+                                          &maxVolid);
+           if (vcode)
+               return vcode;
 
+           maxVolid += temp2;
        }
-       VLDB_GetEntryByID(cellHandle, elem.ids[RWVOL], RWVOL, &entry, &tst);
+       aVLDB_GetEntryByID(cellHandle, elem.ids[RWVOL], RWVOL, &entry, &tst);
        if (tst && (tst != VL_NOENT)) {
            noError = 0;
            totalCE++;
@@ -3015,8 +3033,8 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
            memset(&entry, 0, sizeof(entry));
            strncpy(entry.name, elem.name, VOLSER_OLDMAXVOLNAME);
            if (elem.isValid[RWVOL]) {  /*rw exists */
-               entry.flags |= RW_EXISTS;
-               entry.serverFlags[entry.nServers] = ITSRWVOL;
+               entry.flags |= VLF_RWEXISTS;
+               entry.serverFlags[entry.nServers] = VLSF_RWVOL;
                entry.serverNumber[entry.nServers] = aserver;
                entry.serverPartition[entry.nServers] = apart;
                entry.nServers += 1;
@@ -3025,8 +3043,8 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
                entry.volumeId[BACKVOL] = elem.ids[BACKVOL];
            }
            if (elem.isValid[ROVOL]) {  /*ro volume exists */
-               entry.flags |= RO_EXISTS;
-               entry.serverFlags[entry.nServers] = ITSROVOL;
+               entry.flags |= VLF_ROEXISTS;
+               entry.serverFlags[entry.nServers] = VLSF_ROVOL;
                entry.serverNumber[entry.nServers] = aserver;
                entry.serverPartition[entry.nServers] = apart;
                entry.nServers += 1;
@@ -3035,9 +3053,9 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
 
            }
            if (elem.isValid[BACKVOL]) {        /*backup volume exists */
-               entry.flags |= BACK_EXISTS;
-               if (!(entry.flags & RW_EXISTS)) {       /*this helps to check for a stray backup if parent moves */
-                   entry.serverFlags[entry.nServers] = ITSRWVOL;
+               entry.flags |= VLF_BACKEXISTS;
+               if (!(entry.flags & VLF_RWEXISTS)) {    /*this helps to check for a stray backup if parent moves */
+                   entry.serverFlags[entry.nServers] = VLSF_RWVOL;
                    entry.serverNumber[entry.nServers] = aserver;
                    entry.serverPartition[entry.nServers] = apart;
                    entry.nServers += 1;
@@ -3061,10 +3079,10 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
                if (temp == -1) {
                    /* A RW index is not found in the VLDB entry - will add it */
 
-                   entry.flags |= RW_EXISTS;
+                   entry.flags |= VLF_RWEXISTS;
                    entry.serverNumber[entry.nServers] = aserver;
                    entry.serverPartition[entry.nServers] = apart;
-                   entry.serverFlags[entry.nServers] = ITSRWVOL;
+                   entry.serverFlags[entry.nServers] = VLSF_RWVOL;
                    entry.nServers++;
                } else {
                    /* A RW index is found in the VLDB entry.
@@ -3085,7 +3103,7 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
                        entry.serverPartition[temp] = apart;
 
                    }
-                   entry.flags |= RW_EXISTS;
+                   entry.flags |= VLF_RWEXISTS;
                }
                if ((elem.ids[BACKVOL] != 0) && elem.isValid[BACKVOL])
                    entry.volumeId[BACKVOL] = elem.ids[BACKVOL];
@@ -3109,14 +3127,14 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
                        count = entry.nServers;
                        rwsite = -1;
                        for (j = 0; j < count; j++) {
-                           if (entry.serverFlags[j] & ITSROVOL) {
+                           if (entry.serverFlags[j] & VLSF_ROVOL) {
 
                                /*delete the site */
                                entry.serverNumber[j] = 0;
                                entry.serverPartition[j] = 0;
                                entry.serverFlags[j] = 0;
 
-                           } else if (entry.serverFlags[j] & ITSRWVOL)
+                           } else if (entry.serverFlags[j] & VLSF_RWVOL)
                                rwsite = j;
                        }
                        entry.nServers = 0;
@@ -3131,19 +3149,19 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
                        }
                        entry.serverNumber[entry.nServers] = aserver;
                        entry.serverPartition[entry.nServers] = apart;
-                       entry.serverFlags[entry.nServers] = ITSROVOL;
+                       entry.serverFlags[entry.nServers] = VLSF_ROVOL;
                        entry.nServers++;
                        entry.volumeId[ROVOL] = elem.ids[ROVOL];
-                       entry.flags |= RO_EXISTS;
+                       entry.flags |= VLF_ROEXISTS;
 
                    } else if (elem.ids[ROVOL] < entry.volumeId[ROVOL]) {
-                       if (!(entry.flags & RO_EXISTS)) {
+                       if (!(entry.flags & VLF_ROEXISTS)) {
                            entry.volumeId[ROVOL] = elem.ids[ROVOL];
                            entry.serverNumber[entry.nServers] = aserver;
                            entry.serverPartition[entry.nServers] = apart;
-                           entry.serverFlags[entry.nServers] = ITSROVOL;
+                           entry.serverFlags[entry.nServers] = VLSF_ROVOL;
                            entry.nServers++;
-                           entry.flags |= RO_EXISTS;
+                           entry.flags |= VLF_ROEXISTS;
                        }
 
                    }
@@ -3151,9 +3169,9 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
                    else if (elem.ids[ROVOL] == entry.volumeId[ROVOL]) {
                        entry.serverNumber[entry.nServers] = aserver;
                        entry.serverPartition[entry.nServers] = apart;
-                       entry.serverFlags[entry.nServers] = ITSROVOL;
+                       entry.serverFlags[entry.nServers] = VLSF_ROVOL;
                        entry.nServers++;
-                       entry.flags |= RO_EXISTS;
+                       entry.flags |= VLF_ROEXISTS;
                        entry.volumeId[ROVOL] = elem.ids[ROVOL];
                    }
                }
@@ -3174,7 +3192,7 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
                } else {
                    /*tackle the backup volume */
                    entry.volumeId[BACKVOL] = elem.ids[BACKVOL];
-                   entry.flags |= BACK_EXISTS;
+                   entry.flags |= VLF_BACKEXISTS;
                }
                if (entry.volumeId[BACKVOL] == INVALID_BID)
                    entry.volumeId[BACKVOL] = elem.ids[BACKVOL];
@@ -3188,7 +3206,7 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
                totalUE++;
 
                vcode =
-                   ubik_Call(VL_ReleaseLock, cellHandle->vos, 0,
+                   ubik_VL_ReleaseLock(cellHandle->vos, 0,
                              elem.ids[RWVOL], RWVOL,
                              LOCKREL_OPCODE | LOCKREL_AFSID |
                              LOCKREL_TIMESTAMP);
@@ -3310,65 +3328,65 @@ CheckVldbRWBK(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
        *modified = 0;
     idx = Lp_GetRwIndex(cellHandle, entry, 0);
 
-    /* Check to see if the RW volume exists and set the RW_EXISTS
+    /* Check to see if the RW volume exists and set the VLF_RWEXISTS
      * flag accordingly.
      */
     if (idx == -1) {           /* Did not find a RW entry */
-       if (entry->flags & RW_EXISTS) { /* ... yet entry says RW exists */
-           entry->flags &= ~RW_EXISTS; /* ... so say RW does not exist */
+       if (entry->flags & VLF_RWEXISTS) {      /* ... yet entry says RW exists */
+           entry->flags &= ~VLF_RWEXISTS;      /* ... so say RW does not exist */
            modentry++;
        }
     } else {
        if (VolumeExists
            (cellHandle, entry->serverNumber[idx],
             entry->serverPartition[idx], entry->volumeId[RWVOL], &tst)) {
-           if (!(entry->flags & RW_EXISTS)) {  /* ... yet entry says RW does no
+           if (!(entry->flags & VLF_RWEXISTS)) {       /* ... yet entry says RW does no
                                                 * t exist */
-               entry->flags |= RW_EXISTS;      /* ... so say RW does exist */
+               entry->flags |= VLF_RWEXISTS;   /* ... so say RW does exist */
                modentry++;
            }
        } else if (tst == ENODEV) {     /* RW volume does not exist */
-           if (entry->flags & RW_EXISTS) {     /* ... yet entry says RW exists
+           if (entry->flags & VLF_RWEXISTS) {  /* ... yet entry says RW exists
                                                 */
-               entry->flags &= ~RW_EXISTS;     /* ... so say RW does not exist
+               entry->flags &= ~VLF_RWEXISTS;  /* ... so say RW does not exist
                                                 */
                modentry++;
            }
        } else {
            /* If VLDB says it didn't exist, then ignore error */
-           if (entry->flags & RW_EXISTS) {
+           if (entry->flags & VLF_RWEXISTS) {
                goto fail_CheckVldbRWBK;
            }
        }
     }
 
-    /* Check to see if the BK volume exists and set the BACK_EXISTS
+    /* Check to see if the BK volume exists and set the VLF_BACKEXISTS
      * flag accordingly. idx already ponts to the RW entry.
      */
     if (idx == -1) {           /* Did not find a RW entry */
-       if (entry->flags & BACK_EXISTS) {       /* ... yet entry says BK exists */
-           entry->flags &= ~BACK_EXISTS;       /* ... so say BK does not exist */
+       if (entry->flags & VLF_BACKEXISTS) {    /* ... yet entry says BK exists */
+           entry->flags &= ~VLF_BACKEXISTS;    /* ... so say BK does not exist */
            modentry++;
        }
     } else {                   /* Found a RW entry */
        if (VolumeExists
            (cellHandle, entry->serverNumber[idx],
             entry->serverPartition[idx], entry->volumeId[BACKVOL], &tst)) {
-           if (!(entry->flags & BACK_EXISTS)) {        /* ... yet entry says BK does n
+           if (!(entry->flags & VLF_BACKEXISTS)) {     /* ... yet entry says BK does n
                                                         * ot exist */
-               entry->flags |= BACK_EXISTS;    /* ... so say BK does exist */
+               entry->flags |= VLF_BACKEXISTS; /* ... so say BK does exist */
                modentry++;
            }
        } else if (tst == ENODEV) {     /* BK volume does not exist */
-           if (entry->flags & BACK_EXISTS) {   /* ... yet entry says BK exists
+           if (entry->flags & VLF_BACKEXISTS) {        /* ... yet entry says BK exists
                                                 */
-               entry->flags &= ~BACK_EXISTS;   /* ... so say BK does not exist
+               entry->flags &= ~VLF_BACKEXISTS;        /* ... so say BK does not exist
                                                 */
                modentry++;
            }
        } else {
            /* If VLDB says it didn't exist, then ignore error */
-           if (entry->flags & BACK_EXISTS) {
+           if (entry->flags & VLF_BACKEXISTS) {
                goto fail_CheckVldbRWBK;
            }
        }
@@ -3377,8 +3395,8 @@ CheckVldbRWBK(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
     /* If there is an idx but the BK and RW volumes no
      * longer exist, then remove the RW entry.
      */
-    if ((idx != -1) && !(entry->flags & RW_EXISTS)
-       && !(entry->flags & BACK_EXISTS)) {
+    if ((idx != -1) && !(entry->flags & VLF_RWEXISTS)
+       && !(entry->flags & VLF_BACKEXISTS)) {
        Lp_SetRWValue(cellHandle, entry, entry->serverNumber[idx],
                      entry->serverPartition[idx], 0L, 0L);
        entry->nServers--;
@@ -3410,11 +3428,11 @@ CheckVldbRO(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
     if (modified)
        *modified = 0;
 
-    /* Check to see if the RO volumes exist and set the RO_EXISTS
+    /* Check to see if the RO volumes exist and set the VLF_ROEXISTS
      * flag accordingly.
      */
     for (idx = 0; idx < entry->nServers; idx++) {
-       if (!(entry->serverFlags[idx] & ITSROVOL)) {
+       if (!(entry->serverFlags[idx] & VLSF_ROVOL)) {
            continue;           /* not a RO */
        }
 
@@ -3434,14 +3452,14 @@ CheckVldbRO(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
     }
 
     if (foundro) {             /* A RO volume exists */
-       if (!(entry->flags & RO_EXISTS)) {      /* ... yet entry says RW does not e
+       if (!(entry->flags & VLF_ROEXISTS)) {   /* ... yet entry says RW does not e
                                                 * xist */
-           entry->flags |= RO_EXISTS;  /* ... so say RW does exist */
+           entry->flags |= VLF_ROEXISTS;       /* ... so say RW does exist */
            modentry++;
        }
     } else {                   /* A RO volume does not exist */
-       if (entry->flags & RO_EXISTS) { /* ... yet entry says RO exists */
-           entry->flags &= ~RO_EXISTS; /* ... so say RO does not exist */
+       if (entry->flags & VLF_ROEXISTS) {      /* ... yet entry says RO exists */
+           entry->flags &= ~VLF_ROEXISTS;      /* ... so say RO does not exist */
            modentry++;
        }
     }
@@ -3469,7 +3487,6 @@ CheckVldb(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
     int islocked = 0;
     int pass = 0;
     afs_int32 modentry = 0;
-    afs_int32 delentry = 0;
 
     if (modified) {
        *modified = 0;
@@ -3488,14 +3505,14 @@ CheckVldb(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
      */
     if (++pass == 2) {
        tst =
-           ubik_Call(VL_SetLock, cellHandle->vos, 0, entry->volumeId[RWVOL],
+           ubik_VL_SetLock(cellHandle->vos, 0, entry->volumeId[RWVOL],
                      RWVOL, VLOP_DELETE);
        if (tst) {
            goto fail_CheckVldb;
        }
        islocked = 1;
 
-       if (!VLDB_GetEntryByID
+       if (!aVLDB_GetEntryByID
            (cellHandle, entry->volumeId[RWVOL], RWVOL, entry, &tst)) {
            goto fail_CheckVldb;
        }
@@ -3524,16 +3541,15 @@ CheckVldb(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
        if (pass == 1)
            goto retry;
 
-       if (!(entry->flags & RW_EXISTS) && !(entry->flags & BACK_EXISTS)
-           && !(entry->flags & RO_EXISTS)) {
+       if (!(entry->flags & VLF_RWEXISTS) && !(entry->flags & VLF_BACKEXISTS)
+           && !(entry->flags & VLF_ROEXISTS)) {
            /* The RW, BK, nor RO volumes do not exist. Delete the VLDB entry */
            tst =
-               ubik_Call(VL_DeleteEntry, cellHandle->vos, 0,
+               ubik_VL_DeleteEntry(cellHandle->vos, 0,
                          entry->volumeId[RWVOL], RWVOL);
            if (tst) {
                goto fail_CheckVldb;
            }
-           delentry = 1;
        } else {
            /* Replace old entry with our new one */
            if (!VLDB_ReplaceEntry
@@ -3553,10 +3569,9 @@ CheckVldb(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
 
     if (islocked) {
        vcode =
-           ubik_Call(VL_ReleaseLock, cellHandle->vos, 0,
-                     entry->volumeId[RWVOL], RWVOL,
-                     (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP),
-                     &tst);
+           ubik_VL_ReleaseLock(cellHandle->vos, 0,
+                               entry->volumeId[RWVOL], RWVOL,
+                               (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP));
        if (vcode) {
            if (!tst)
                tst = vcode;
@@ -3577,21 +3592,19 @@ UV_SyncServer(afs_cell_handle_p cellHandle, struct rx_connection *server,
 {
     int rc = 0;
     afs_status_t tst = 0;
-    afs_int32 code, vcode;
     int noError;
     afs_int32 nentries, tentries = 0;
     struct VldbListByAttributes attributes;
     nbulkentries arrayEntries;
     int totalF;
-    register struct nvldbentry *vllist;
-    register int j;
+    struct nvldbentry *vllist;
+    int j;
     afs_int32 si, nsi;
     afs_int32 modified = 0;
 
-    code = 0;
-    vcode = 0;
     noError = 1;
     arrayEntries.nbulkentries_val = 0;
+    memset(&attributes, 0, sizeof(attributes));
 
     /* Set up attributes to search VLDB  */
     attributes.server = ntohl(rx_HostOf(rx_PeerOf(server)));
@@ -3638,30 +3651,32 @@ UV_SyncServer(afs_cell_handle_p cellHandle, struct rx_connection *server,
     return rc;
 }
 
-/*rename volume <oldname> to <newname>, changing the names of the related 
- *readonly and backup volumes. This operation is also idempotent.
- *salvager is capable of recovering from rename operation stopping halfway.
- *to recover run syncserver on the affected machines,it will force renaming to completion. name clashes should have been detected before calling this proc */
+/* rename volume <oldname> to <newname>, changing the names of the related
+ * readonly and backup volumes. This operation is also idempotent.
+ * salvager is capable of recovering from rename operation stopping halfway.
+ * to recover run syncserver on the affected machines,it will force
+ * renaming to completion. name clashes should have been detected before
+ * calling this proc
+ */
 int
 UV_RenameVolume(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
-               const char *newname, afs_status_p st)
+               char *newname, afs_status_p st)
 {
     int rc = 0;
     afs_status_t tst = 0;
     afs_status_t etst = 0;
-    afs_int32 rcode, error;
+    afs_int32 rcode;
     int i, index;
     char nameBuffer[256];
     afs_int32 tid;
     struct rx_connection *aconn;
     int islocked;
 
-    error = 0;
     aconn = (struct rx_connection *)0;
     tid = 0;
     islocked = 0;
 
-    tst = ubik_Call(VL_SetLock, cellHandle->vos, 0, entry->volumeId[RWVOL], RWVOL, VLOP_ADDSITE);      /*last param is dummy */
+    tst = ubik_VL_SetLock(cellHandle->vos, 0, entry->volumeId[RWVOL], RWVOL, VLOP_ADDSITE);    /*last param is dummy */
     if (tst) {
        goto fail_UV_RenameVolume;
     }
@@ -3676,7 +3691,7 @@ UV_RenameVolume(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
     /*at this stage the intent to rename is recorded in the vldb, as far
      * as the vldb 
      * is concerned, oldname is lost */
-    if (entry->flags & RW_EXISTS) {
+    if (entry->flags & VLF_RWEXISTS) {
        index = Lp_GetRwIndex(cellHandle, entry, 0);
        if (index == -1) {      /* there is a serious discrepancy */
            tst = VOLSERVLDB_ERROR;
@@ -3712,7 +3727,7 @@ UV_RenameVolume(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
        aconn = (struct rx_connection *)0;
     }
     /*end rw volume processing */
-    if (entry->flags & BACK_EXISTS) {  /*process the backup volume */
+    if (entry->flags & VLF_BACKEXISTS) {       /*process the backup volume */
        index = Lp_GetRwIndex(cellHandle, entry, 0);
        if (index == -1) {      /* there is a serious discrepancy */
            tst = VOLSERVLDB_ERROR;
@@ -3750,9 +3765,9 @@ UV_RenameVolume(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
     if (aconn)
        rx_ReleaseCachedConnection(aconn);
     aconn = (struct rx_connection *)0;
-    if (entry->flags & RO_EXISTS) {    /*process the ro volumes */
+    if (entry->flags & VLF_ROEXISTS) { /*process the ro volumes */
        for (i = 0; i < entry->nServers; i++) {
-           if (entry->serverFlags[i] & ITSROVOL) {
+           if (entry->serverFlags[i] & VLSF_ROVOL) {
                aconn =
                    UV_Bind(cellHandle, entry->serverNumber[i],
                            AFSCONF_VOLUMEPORT);
@@ -3793,7 +3808,7 @@ UV_RenameVolume(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
 
     if (islocked) {
        etst =
-           ubik_Call(VL_ReleaseLock, cellHandle->vos, 0,
+           ubik_VL_ReleaseLock(cellHandle->vos, 0,
                      entry->volumeId[RWVOL], RWVOL,
                      LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP);
        if (etst) {
@@ -3929,7 +3944,7 @@ GroupEntries(struct rx_connection *server, volintInfo * pntr, afs_int32 count,
                        error = VOLSERBADOP;
                }
            } else {            /*create a fresh entry */
-               qPtr = (struct aqueue *)malloc(sizeof(struct aqueue));
+               qPtr = malloc(sizeof(struct aqueue));
                if (pntr->type == RWVOL) {
                    qPtr->isValid[RWVOL] = 1;
                    qPtr->isValid[BACKVOL] = 0;
@@ -4011,14 +4026,12 @@ UV_VolserStatus(struct rx_connection *server, transDebugInfo ** rpntr,
 /*delete the volume without interacting with the vldb */
 int
 UV_VolumeZap(afs_cell_handle_p cellHandle, struct rx_connection *server,
-            unsigned int partition, unsigned int volumeId, afs_status_p st)
+            unsigned int partition, afs_uint32 volumeId, afs_status_p st)
 {
-    afs_int32 rcode, ttid, error, code;
+    afs_int32 rcode, ttid;
     int rc = 0;
     afs_status_t tst = 0;
 
-    code = 0;
-    error = 0;
     ttid = 0;
 
     tst = AFSVolTransCreate(server, volumeId, partition, ITOffline, &ttid);
@@ -4049,7 +4062,7 @@ UV_VolumeZap(afs_cell_handle_p cellHandle, struct rx_connection *server,
 
 int
 UV_SetVolume(struct rx_connection *server, afs_int32 partition,
-            afs_int32 volid, afs_int32 transflag, afs_int32 setflag,
+            afs_uint32 volid, afs_int32 transflag, afs_int32 setflag,
             unsigned int sleepTime, afs_status_p st)
 {
     int rc = 0;
@@ -4077,6 +4090,7 @@ UV_SetVolume(struct rx_connection *server, afs_int32 partition,
 
     if (tid) {
        etst = AFSVolEndTrans(server, tid, &rcode);
+       /* FIXME: this looks like a typo */
        if (etst || etst) {
            if (!tst)
                tst = (etst ? etst : rcode);