Convert from using nvldbentry to uvldbentry
authorJeffrey Altman <jaltman@your-file-system.com>
Sun, 6 Jun 2010 15:03:44 +0000 (11:03 -0400)
committerJeffrey Altman <jaltman@openafs.org>
Thu, 18 Nov 2010 00:40:54 +0000 (16:40 -0800)
The support routines relied upon by vos use the older nvldbentry
data structures which do not include the UUID for the server.
This patchset updates the code to use the uvldbentry structure
so that a future patchset can make use of UUID values when available.

Any functions from vsprocs.c which are referenced by vos.c are
considered public.  This includes all of the VL_xxxx, UV_xxxx
and Lp_xxxx functions, the EnumerateEntry, SubEnumerateEntry, and
host mapping functions.  For any which references an nvldbentry as a
parameter a new 'U' version is created that accepts a uvldbentry.
These new 'U' functions are then used throughout vos.c and the internal
routines.

Change-Id: Ib95e4c38574c97284e6b8eee06d92555365a179e
Reviewed-on: http://gerrit.openafs.org/2089
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

src/volser/lockprocs.c
src/volser/lockprocs_prototypes.h
src/volser/volint.xg
src/volser/volser_internal.h
src/volser/volser_prototypes.h
src/volser/vos.c
src/volser/vsprocs.c
src/volser/vsutils.c
src/volser/vsutils_prototypes.h

index fc4fa1f..7ab1c57 100644 (file)
@@ -44,8 +44,8 @@
  * If server is zero, will match first index of ANY server and partition
  * Zero is a valid partition field.
  */
-int
-FindIndex(struct nvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32 type)
+static int
+FindIndex(struct uvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32 type)
 {
     int e;
     afs_int32 error = 0;
@@ -54,7 +54,7 @@ FindIndex(struct nvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32
        if (!type || (entry->serverFlags[e] & type)) {
            if ((!server || (entry->serverPartition[e] == part))
                && (!server
-                   || VLDB_IsSameAddrs(entry->serverNumber[e], server,
+                   || VLDB_IsSameAddrs(entry->serverUnique[e], server,
                                        &error)))
                break;
            if (type == ITSRWVOL)
@@ -65,7 +65,7 @@ FindIndex(struct nvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32
     if (error) {
        fprintf(STDERR,
                "Failed to get info about server's %d address(es) from vlserver (err=%d)\n",
-               entry->serverNumber[e], error);
+               entry->serverUnique[e], error);
        return -1;
     }
 
@@ -76,8 +76,8 @@ FindIndex(struct nvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32
 }
 
 /* Changes the rw site only */
-void
-SetAValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
+static void
+SetAValue(struct uvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
           afs_uint32 nserver, afs_int32 npart, afs_int32 type)
 {
     int e;
@@ -86,13 +86,13 @@ SetAValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
     if (e == -1)
        return;                 /* If didn't find it, just return */
 
-    entry->serverNumber[e] = nserver;
+    entry->serverUnique[e] = nserver;
     entry->serverPartition[e] = npart;
 
     /* Now move rest of entries up */
     if ((nserver == 0L) && (npart == 0L)) {
        for (e++; e < entry->nServers; e++) {
-           entry->serverNumber[e - 1] = entry->serverNumber[e];
+           entry->serverUnique[e - 1] = entry->serverUnique[e];
            entry->serverPartition[e - 1] = entry->serverPartition[e];
            entry->serverFlags[e - 1] = entry->serverFlags[e];
        }
@@ -101,7 +101,18 @@ SetAValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
 
 /* Changes the RW site only */
 void
-Lp_SetRWValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
+Lp_SetRWValue(struct nvldbentry *entryp, afs_uint32 oserver, afs_int32 opart,
+              afs_uint32 nserver, afs_int32 npart)
+{
+    struct uvldbentry uentry;
+
+    nvlentry_to_uvlentry(entryp, &uentry);
+    SetAValue(&uentry, oserver, opart, nserver, npart, ITSRWVOL);
+    uvlentry_to_nvlentry(&uentry, entryp);
+}
+
+void
+Lp_SetRWValueU(struct uvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
               afs_uint32 nserver, afs_int32 npart)
 {
     SetAValue(entry, oserver, opart, nserver, npart, ITSRWVOL);
@@ -109,7 +120,18 @@ Lp_SetRWValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
 
 /* Changes the RO site only */
 void
-Lp_SetROValue(struct nvldbentry *entry, afs_uint32 oserver,
+Lp_SetROValue(struct nvldbentry *entryp, afs_uint32 oserver,
+              afs_int32 opart, afs_uint32 nserver, afs_int32 npart)
+{
+    struct uvldbentry uentry;
+
+    nvlentry_to_uvlentry(entryp, &uentry);
+    SetAValue(&uentry, oserver, opart, nserver, npart, ITSROVOL);
+    uvlentry_to_nvlentry(&uentry, entryp);
+}
+
+void
+Lp_SetROValueU(struct uvldbentry *entry, afs_uint32 oserver,
               afs_int32 opart, afs_uint32 nserver, afs_int32 npart)
 {
     SetAValue(entry, oserver, opart, nserver, npart, ITSROVOL);
@@ -118,7 +140,20 @@ Lp_SetROValue(struct nvldbentry *entry, afs_uint32 oserver,
 /* Returns success if this server and partition matches the RW entry */
 int
 Lp_Match(afs_uint32 server, afs_int32 part,
-         struct nvldbentry *entry)
+         struct nvldbentry *entryp)
+{
+    struct uvldbentry uentry;
+
+    nvlentry_to_uvlentry(entryp, &uentry);
+    if (FindIndex(&uentry, server, part, ITSRWVOL) == -1)
+       return 0;
+    uvlentry_to_nvlentry(&uentry, entryp);
+    return 1;
+}
+
+int
+Lp_MatchU(afs_uint32 server, afs_int32 part,
+         struct uvldbentry *entry)
 {
     if (FindIndex(entry, server, part, ITSRWVOL) == -1)
        return 0;
@@ -127,14 +162,40 @@ Lp_Match(afs_uint32 server, afs_int32 part,
 
 /* Return the index of the RO entry (plus 1) if it exists, else return 0 */
 int
-Lp_ROMatch(afs_uint32 server, afs_int32 part, struct nvldbentry *entry)
+Lp_ROMatch(afs_uint32 server, afs_int32 part, struct nvldbentry *entryp)
+{
+    struct uvldbentry uentry;
+    int idx;
+
+    nvlentry_to_uvlentry(entryp, &uentry);
+    idx = (FindIndex(&uentry, server, part, ITSROVOL) + 1);
+    if (idx)
+        uvlentry_to_nvlentry(&uentry, entryp);
+    return idx;
+}
+
+int
+Lp_ROMatchU(afs_uint32 server, afs_int32 part, struct uvldbentry *entry)
 {
     return (FindIndex(entry, server, part, ITSROVOL) + 1);
 }
 
 /* Return the index of the RW entry if it exists, else return -1 */
 int
-Lp_GetRwIndex(struct nvldbentry *entry)
+Lp_GetRwIndex(struct nvldbentry *entryp)
+{
+    struct uvldbentry uentry;
+    int idx;
+
+    nvlentry_to_uvlentry(entryp, &uentry);
+    idx = (FindIndex(&uentry, 0, 0, ITSRWVOL));
+    if (idx > -1)
+        uvlentry_to_nvlentry(&uentry, entryp);
+    return idx;
+}
+
+int
+Lp_GetRwIndexU(struct uvldbentry *entry)
 {
     return (FindIndex(entry, 0, 0, ITSRWVOL));
 }
index 9c9e990..50b079a 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef        _LOCKPROCS_PROTOTYPES_H
 #define _LOCKPROCS_PROTOTYPES_H
-extern int FindIndex(struct nvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32 type);
-extern void SetAValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
-          afs_uint32 nserver, afs_int32 npart, afs_int32 type);
+/* older nvldbentry versions */
 extern void Lp_SetRWValue(struct nvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
               afs_uint32 nserver, afs_int32 npart);
 extern void Lp_SetROValue(struct nvldbentry *entry, afs_uint32 oserver,
@@ -10,6 +8,16 @@ extern void Lp_SetROValue(struct nvldbentry *entry, afs_uint32 oserver,
 extern int Lp_Match(afs_uint32 server, afs_int32 part, struct nvldbentry *entry);
 extern int Lp_ROMatch(afs_uint32 server, afs_int32 part, struct nvldbentry *entry);
 extern int Lp_GetRwIndex(struct nvldbentry *entry);
+
+/* newer uvldbentry versions */
+extern void Lp_SetRWValueU(struct uvldbentry *entry, afs_uint32 oserver, afs_int32 opart,
+              afs_uint32 nserver, afs_int32 npart);
+extern void Lp_SetROValueU(struct uvldbentry *entry, afs_uint32 oserver,
+              afs_int32 opart, afs_uint32 nserver, afs_int32 npart);
+extern int Lp_MatchU(afs_uint32 server, afs_int32 part, struct uvldbentry *entry);
+extern int Lp_ROMatchU(afs_uint32 server, afs_int32 part, struct uvldbentry *entry);
+extern int Lp_GetRwIndexU(struct uvldbentry *entry);
+
 extern void Lp_QInit(struct qHead *ahead);
 extern void Lp_QAdd(struct qHead *ahead, struct aqueue *elem);
 extern int Lp_QScan(struct qHead *ahead, afs_int32 id, int *success, struct aqueue **elem);
index 4d20f0a..55b98e4 100644 (file)
@@ -212,7 +212,7 @@ struct pIDs {
 struct diskPartition {
         char   name[32];       /* Mounted partition name */
         char   devName[32];
-        int    lock_fd;
+        int    lock_fd;        /* assigned from DiskPartition FD_t (64-bit on Windows) */
        int     totalUsable;
        int     free;
        int     minFree;
@@ -222,7 +222,7 @@ struct diskPartition {
 struct diskPartition64 {
     char       name[256];      /* Mounted partition name */
     char       devName[256];
-    int                lock_fd;
+    int                lock_fd;        /* assigned from DiskPartition64 FD_t (64-bit on Windows) */
     afs_int64  totalUsable;
     afs_int64  free;
     afs_int64  minFree;
index 26a9e85..41d13a6 100644 (file)
@@ -32,10 +32,12 @@ extern int VPFullUnlock(void);
 extern afs_int32 GCTrans(void);
 
 /* vsprocs.c */
+struct uvldbentry;
 struct nvldbentry;
-extern int yesprompt(char *str);
 extern int PrintError(char *msg, afs_int32 errcode);
 extern void init_volintInfo(struct volintInfo *vinfo);
+extern void SubEnumerateEntryU(struct uvldbentry *entry);
+extern void EnumerateEntryU(struct uvldbentry *entry);
 extern void SubEnumerateEntry(struct nvldbentry *entry);
 extern void EnumerateEntry(struct nvldbentry *entry);
 extern int UV_NukeVolume(afs_uint32 server, afs_int32 partid, afs_uint32 volid);
@@ -62,7 +64,6 @@ extern int UV_BackupVolume(afs_uint32 aserver, afs_int32 apart,
                           afs_uint32 avolid);
 extern int UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
                            afs_int32 afrompart, int forceflag);
-extern void dump_sig_handler(int x);
 extern int UV_DumpVolume(afs_uint32 afromvol, afs_uint32 afromserver,
                         afs_int32 afrompart, afs_int32 fromdate,
                         afs_int32(*DumpFunction) (struct rx_call *, void *),
@@ -96,22 +97,16 @@ extern int UV_XListVolumes(afs_uint32 a_serverID, afs_int32 a_partID,
 extern int UV_XListOneVolume(afs_uint32 a_serverID, afs_int32 a_partID,
                             afs_uint32 a_volID,
                             struct volintXInfo **a_resultPP);
-extern int sortVolumes(const void *a, const void *b);
 extern int UV_SyncVolume(afs_uint32 aserver, afs_int32 apart, char *avolname,
                         int flags);
 extern int UV_SyncVldb(afs_uint32 aserver, afs_int32 apart, int flags,
                       int force);
-extern afs_int32 VolumeExists(afs_uint32 server, afs_int32 partition,
-                             afs_uint32 volumeid);
-extern afs_int32 CheckVldbRWBK(struct nvldbentry *entry,
-                              afs_int32 * modified);
-extern int CheckVldbRO(struct nvldbentry *entry, afs_int32 * modified);
-extern afs_int32 CheckVldb(struct nvldbentry *entry, afs_int32 * modified,
-                           afs_int32 *deleted);
 extern int UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags,
                         int force);
 extern int UV_RenameVolume(struct nvldbentry *entry, char oldname[],
                           char newname[]);
+extern int UV_RenameVolumeU(struct uvldbentry *entry, char oldname[],
+                          char newname[]);
 extern int UV_VolserStatus(afs_uint32 server, transDebugInfo ** rpntr,
                           afs_int32 * rcount);
 extern int UV_VolumeZap(afs_uint32 server, afs_int32 part, afs_uint32 volid);
@@ -120,6 +115,7 @@ extern int UV_SetVolume(afs_uint32 server, afs_int32 partition,
                        afs_int32 setflag, int sleeptime);
 extern int UV_SetVolumeInfo(afs_uint32 server, afs_int32 partition,
                            afs_uint32 volid, volintInfo * infop);
+extern void MapNetworkToHostU(struct uvldbentry *old, struct uvldbentry *new);
 extern void MapNetworkToHost(struct nvldbentry *old, struct nvldbentry *new);
 extern int UV_CopyVolume2(afs_uint32 afromvol, afs_uint32 afromserver,
                           afs_int32 afrompart, char *atovolname,
index e41f37c..fb00e7d 100644 (file)
@@ -11,6 +11,7 @@
 #define AFS_SRC_VOLSER_PROTOTYPES_H
 
 struct nvldbentry;
+struct uvldbentry;
 struct volintInfo;
 
 /* vsprocs.c */
@@ -18,6 +19,8 @@ extern void MapPartIdIntoName(afs_int32 partId, char *partName);
 
 extern void MapHostToNetwork(struct nvldbentry *entry);
 
+extern void MapHostToNetworkU(struct uvldbentry *entry);
+
 extern struct rx_connection *UV_Bind(afs_uint32 aserver, afs_int32 port);
 
 extern int UV_CreateVolume(afs_uint32 aserver, afs_int32 apart, char *aname,
index fcff325..6d83c1e 100644 (file)
@@ -77,7 +77,7 @@
 /* Local Prototypes */
 int PrintDiagnostics(char *astring, afs_int32 acode);
 int GetVolumeInfo(afs_uint32 volid, afs_uint32 *server, afs_int32 *part,
-                  afs_int32 *voltype, struct nvldbentry *rentry);
+                  afs_int32 *voltype, struct uvldbentry *rentry);
 
 struct tqElem {
     afs_uint32 volid;
@@ -167,8 +167,7 @@ FileExists(char *filename)
 static int
 VolNameOK(char *name)
 {
-    int total;
-
+    size_t total;
 
     total = strlen(name);
     if (!strcmp(&name[total - 9], ".readonly")) {
@@ -184,7 +183,8 @@ VolNameOK(char *name)
 static int
 IsNumeric(char *name)
 {
-    int result, len, i;
+    int result, i;
+    size_t len;
     char *ptr;
 
     result = 1;
@@ -1379,7 +1379,7 @@ XDisplayVolumes2(afs_uint32 a_servID, afs_int32 a_partID, volintXInfo *a_xInfoP,
 /* set <server> and <part> to the correct values depending on
  * <voltype> and <entry> */
 static void
-GetServerAndPart(struct nvldbentry *entry, int voltype, afs_uint32 *server,
+GetServerAndPart(struct uvldbentry *entry, int voltype, afs_uint32 *server,
                 afs_int32 *part, int *previdx)
 {
     int i, istart, vtype;
@@ -1397,9 +1397,10 @@ GetServerAndPart(struct nvldbentry *entry, int voltype, afs_uint32 *server,
        istart = ((*previdx < 0) ? 0 : *previdx + 1);
     }
 
-    for (i = istart; i < entry->nServers; i++) {
+    for (i = istart; i < entry->nServers && i < NMAXNSERVERS; i++) {
        if (entry->serverFlags[i] & vtype) {
-           *server = entry->serverNumber[i];
+            /* *uuid = entry->serverNumber[i]; */
+           *server = entry->serverUnique[i];
            *part = entry->serverPartition[i];
            *previdx = i;
            return;
@@ -1438,9 +1439,9 @@ PrintLocked(afs_int32 aflags)
 }
 
 static void
-PostVolumeStats(struct nvldbentry *entry)
+PostVolumeStats(struct uvldbentry *entry)
 {
-    SubEnumerateEntry(entry);
+    SubEnumerateEntryU(entry);
     /* Check for VLOP_ALLOPERS */
     PrintLocked(entry->flags);
     return;
@@ -1470,7 +1471,7 @@ PostVolumeStats(struct nvldbentry *entry)
  *------------------------------------------------------------------------*/
 
 static void
-XVolumeStats(volintXInfo *a_xInfoP, struct nvldbentry *a_entryP,
+XVolumeStats(volintXInfo *a_xInfoP, struct uvldbentry *a_entryP,
             afs_int32 a_srvID, afs_int32 a_partID, int a_volType)
 {                              /*XVolumeStats */
 
@@ -1490,7 +1491,7 @@ XVolumeStats(volintXInfo *a_xInfoP, struct nvldbentry *a_entryP,
 }                              /*XVolumeStats */
 
 static void
-VolumeStats_int(volintInfo *pntr, struct nvldbentry *entry, afs_uint32 server,
+VolumeStats_int(volintInfo *pntr, struct uvldbentry *entry, afs_uint32 server,
             afs_int32 part, int voltype)
 {
     int totalOK, totalNotOK, totalBusy;
@@ -1570,7 +1571,7 @@ NukeVolume(struct cmd_syndesc *as)
 static int
 ExamineVolume(struct cmd_syndesc *as, void *arock)
 {
-    struct nvldbentry entry;
+    struct uvldbentry entry;
     afs_int32 vcode = 0;
     volintInfo *pntr = (volintInfo *) 0;
     volintXInfo *xInfoP = (volintXInfo *) 0;
@@ -1599,7 +1600,7 @@ ExamineVolume(struct cmd_syndesc *as, void *arock)
                (unsigned long)volid);
        fflush(STDOUT);
     }
-    vcode = VLDB_GetEntryByID(volid, -1, &entry);
+    vcode = VLDB_GetEntryByIDU(volid, -1, &entry);
     if (vcode) {
        fprintf(STDERR,
                "Could not fetch the entry for volume number %lu from VLDB \n",
@@ -1608,7 +1609,7 @@ ExamineVolume(struct cmd_syndesc *as, void *arock)
     }
     if (verbose)
        fprintf(STDOUT, "done\n");
-    MapHostToNetwork(&entry);
+    MapHostToNetworkU(&entry);
 
     if (entry.volumeId[RWVOL] == volid)
        voltype = RWVOL;
@@ -1670,7 +1671,7 @@ ExamineVolume(struct cmd_syndesc *as, void *arock)
                XVolumeStats(xInfoP, &entry, aserver, apart, voltype);
            else if (as->parms[2].items) {
                DisplayFormat2(aserver, apart, pntr);
-               EnumerateEntry(&entry);
+               EnumerateEntryU(&entry);
                isSubEnum = 1;
            } else
                VolumeStats_int(pntr, &entry, aserver, apart, voltype);
@@ -1723,7 +1724,7 @@ ExamineVolume(struct cmd_syndesc *as, void *arock)
 static int
 SetFields(struct cmd_syndesc *as, void *arock)
 {
-    struct nvldbentry entry;
+    struct uvldbentry entry;
     volintInfo info;
     afs_uint32 volid;
     afs_int32 code, err;
@@ -1741,14 +1742,14 @@ SetFields(struct cmd_syndesc *as, void *arock)
        return -1;
     }
 
-    code = VLDB_GetEntryByID(volid, RWVOL, &entry);
+    code = VLDB_GetEntryByIDU(volid, RWVOL, &entry);
     if (code) {
        fprintf(STDERR,
                "Could not fetch the entry for volume number %lu from VLDB \n",
                (unsigned long)volid);
        return (code);
     }
-    MapHostToNetwork(&entry);
+    MapHostToNetworkU(&entry);
 
     GetServerAndPart(&entry, RWVOL, &aserver, &apart, &previdx);
     if (previdx == -1) {
@@ -1925,7 +1926,7 @@ CreateVolume(struct cmd_syndesc *as, void *arock)
     afs_uint32 volid = 0, rovolid = 0, bkvolid = 0;
     afs_uint32 *arovolid;
     afs_int32 code;
-    struct nvldbentry entry;
+    struct uvldbentry entry;
     afs_int32 vcode;
     afs_int32 quota;
 
@@ -1970,7 +1971,7 @@ CreateVolume(struct cmd_syndesc *as, void *arock)
                as->parms[2].items->data);
        return EINVAL;
     }
-    vcode = VLDB_GetEntryByName(as->parms[2].items->data, &entry);
+    vcode = VLDB_GetEntryByNameU(as->parms[2].items->data, &entry);
     if (!vcode) {
        fprintf(STDERR, "Volume %s already exists\n",
                as->parms[2].items->data);
@@ -2034,16 +2035,16 @@ CreateVolume(struct cmd_syndesc *as, void *arock)
 
 #if 0
 static afs_int32
-DeleteAll(struct nvldbentry *entry)
+DeleteAll(struct uvldbentry *entry)
 {
     int i;
     afs_int32 error, code, curserver, curpart;
     afs_uint32 volid;
 
-    MapHostToNetwork(entry);
+    MapHostToNetworkU(entry);
     error = 0;
     for (i = 0; i < entry->nServers; i++) {
-       curserver = entry->serverNumber[i];
+       curserver = entry->serverUnique[i];
        curpart = entry->serverPartition[i];
        if (entry->serverFlags[i] & ITSROVOL) {
            volid = entry->volumeId[ROVOL];
@@ -2111,9 +2112,9 @@ DeleteVolume(struct cmd_syndesc *as, void *arock)
      * them in from the VLDB entry.
      */
     if ((partition == -1) || !server) {
-       struct nvldbentry entry;
+       struct uvldbentry entry;
 
-       code = VLDB_GetEntryByID(volid, -1, &entry);
+       code = VLDB_GetEntryByIDU(volid, -1, &entry);
        if (code) {
            fprintf(STDERR,
                    "Could not fetch the entry for volume %lu from VLDB\n",
@@ -2125,8 +2126,8 @@ DeleteVolume(struct cmd_syndesc *as, void *arock)
        if (((volid == entry.volumeId[RWVOL]) && (entry.flags & RW_EXISTS))
            || ((volid == entry.volumeId[BACKVOL])
                && (entry.flags & BACK_EXISTS))) {
-           idx = Lp_GetRwIndex(&entry);
-           if ((idx == -1) || (server && (server != entry.serverNumber[idx]))
+           idx = Lp_GetRwIndexU(&entry);
+           if ((idx == -1) || (server && (server != entry.serverUnique[idx]))
                || ((partition != -1)
                    && (partition != entry.serverPartition[idx]))) {
                fprintf(STDERR, "VLDB: Volume '%s' no match\n",
@@ -2139,7 +2140,7 @@ DeleteVolume(struct cmd_syndesc *as, void *arock)
                if (entry.serverFlags[j] != ITSROVOL)
                    continue;
 
-               if (((server == 0) || (server == entry.serverNumber[j]))
+               if (((server == 0) || (server == entry.serverUnique[j]))
                    && ((partition == -1)
                        || (partition == entry.serverPartition[j]))) {
                    if (idx != -1) {
@@ -2162,7 +2163,7 @@ DeleteVolume(struct cmd_syndesc *as, void *arock)
            return ENOENT;
        }
 
-       server = htonl(entry.serverNumber[idx]);
+       server = htonl(entry.serverUnique[idx]);
        partition = entry.serverPartition[idx];
     }
 
@@ -2316,7 +2317,7 @@ CopyVolume(struct cmd_syndesc *as, void *arock)
     afs_uint32 fromserver, toserver;
     afs_int32 frompart, topart, code, err, flags;
     char fromPartName[10], toPartName[10], *tovolume;
-    struct nvldbentry entry;
+    struct uvldbentry entry;
     struct diskPartition64 partition;  /* for space check */
     volintInfo *p;
 
@@ -2361,7 +2362,7 @@ CopyVolume(struct cmd_syndesc *as, void *arock)
                tovolume);
        return EINVAL;
     }
-    code = VLDB_GetEntryByName(tovolume, &entry);
+    code = VLDB_GetEntryByNameU(tovolume, &entry);
     if (!code) {
        fprintf(STDERR, "Volume %s already exists\n", tovolume);
        PrintDiagnostics("copy", code);
@@ -2662,7 +2663,7 @@ CloneVolume(struct cmd_syndesc *as, void *arock)
     afs_int32 part, voltype;
     char partName[10], *volname;
     afs_int32 code, err, flags;
-    struct nvldbentry entry;
+    struct uvldbentry entry;
 
     volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
     if (volid == 0) {
@@ -2775,12 +2776,12 @@ BackupVolume(struct cmd_syndesc *as, void *arock)
     afs_uint32 avolid;
     afs_uint32 aserver;
     afs_int32 apart, vtype, code, err;
-    struct nvldbentry entry;
+    struct uvldbentry entry;
 
     afs_uint32 buvolid;
     afs_uint32 buserver;
     afs_int32 bupart, butype;
-    struct nvldbentry buentry;
+    struct uvldbentry buentry;
 
     avolid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
     if (avolid == 0) {
@@ -2845,7 +2846,7 @@ static int
 ReleaseVolume(struct cmd_syndesc *as, void *arock)
 {
 
-    struct nvldbentry entry;
+    struct uvldbentry entry;
     afs_uint32 avolid;
     afs_uint32 aserver;
     afs_int32 apart, vtype, code, err;
@@ -2895,7 +2896,7 @@ DumpVolumeCmd(struct cmd_syndesc *as, void *arock)
     afs_uint32 aserver;
     afs_int32 apart, voltype, fromdate = 0, code, err, i, flags;
     char filename[MAXPATHLEN];
-    struct nvldbentry entry;
+    struct uvldbentry entry;
 
     rx_SetRxDeadTime(60 * 10);
     for (i = 0; i < MAXSERVERS; i++) {
@@ -3002,7 +3003,7 @@ RestoreVolumeCmd(struct cmd_syndesc *as, void *arock)
     int readonly = 0, offline = 0, voltype = RWVOL;
     char afilename[MAXPATHLEN], avolname[VOLSER_MAXVOLNAME + 1], apartName[10];
     char volname[VOLSER_MAXVOLNAME + 1];
-    struct nvldbentry entry;
+    struct uvldbentry entry;
 
     aparentid = 0;
     if (as->parms[4].items) {
@@ -3124,7 +3125,7 @@ RestoreVolumeCmd(struct cmd_syndesc *as, void *arock)
     /* Check if volume exists or not */
 
     vsu_ExtractName(volname, avolname);
-    vcode = VLDB_GetEntryByName(volname, &entry);
+    vcode = VLDB_GetEntryByNameU(volname, &entry);
     if (vcode) {               /* no volume - do a full restore */
        restoreflags = RV_FULLRST;
        if ((aoverwrite == INC) || (aoverwrite == ABORT))
@@ -3132,8 +3133,8 @@ RestoreVolumeCmd(struct cmd_syndesc *as, void *arock)
                    "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 */
+    else if ((!readonly && Lp_GetRwIndexU(&entry) == -1)       /* RW volume does not exist - do a full */
+            ||(readonly && !Lp_ROMatchU(0, 0, &entry))) {      /* RO volume does not exist - do a full */
        restoreflags = RV_FULLRST;
        if ((aoverwrite == INC) || (aoverwrite == ABORT))
            fprintf(STDERR,
@@ -3152,7 +3153,7 @@ RestoreVolumeCmd(struct cmd_syndesc *as, void *arock)
     else {                     /* volume exists - do we do a full incremental or abort */
        afs_uint32 Oserver;
        afs_int32 Opart, Otype, vol_elsewhere = 0;
-       struct nvldbentry Oentry;
+       struct uvldbentry Oentry;
        int c, dc;
 
        if (avolid == 0) {
@@ -3929,19 +3930,19 @@ SyncServer(struct cmd_syndesc *as, void *arock)
 static int
 VolumeInfoCmd(char *name)
 {
-    struct nvldbentry entry;
+    struct uvldbentry entry;
     afs_int32 vcode;
 
     /* The vlserver will handle names with the .readonly
      * and .backup extension as well as volume ids.
      */
-    vcode = VLDB_GetEntryByName(name, &entry);
+    vcode = VLDB_GetEntryByNameU(name, &entry);
     if (vcode) {
        PrintError("", vcode);
        exit(1);
     }
-    MapHostToNetwork(&entry);
-    EnumerateEntry(&entry);
+    MapHostToNetworkU(&entry);
+    EnumerateEntryU(&entry);
 
     /* Defect #3027: grubby check to handle locked volume.
      * If VLOP_ALLOPERS is set, the entry is locked.
@@ -3955,7 +3956,7 @@ VolumeInfoCmd(char *name)
 static int
 VolumeZap(struct cmd_syndesc *as, void *arock)
 {
-    struct nvldbentry entry;
+    struct uvldbentry entry;
     afs_uint32 volid, zapbackupid = 0, backupid = 0;
     afs_int32 code, server, part, err;
 
@@ -3998,7 +3999,7 @@ VolumeZap(struct cmd_syndesc *as, void *arock)
                    as->parms[1].items->data);
        exit(1);
     }
-    code = VLDB_GetEntryByID(volid, -1, &entry);
+    code = VLDB_GetEntryByIDU(volid, -1, &entry);
     if (!code) {
        if (volid == entry.volumeId[RWVOL])
            backupid = entry.volumeId[BACKVOL];
@@ -4140,15 +4141,15 @@ static int
 RenameVolume(struct cmd_syndesc *as, void *arock)
 {
     afs_int32 code1, code2, code;
-    struct nvldbentry entry;
+    struct uvldbentry entry;
 
-    code1 = VLDB_GetEntryByName(as->parms[0].items->data, &entry);
+    code1 = VLDB_GetEntryByNameU(as->parms[0].items->data, &entry);
     if (code1) {
        fprintf(STDERR, "vos: Could not find entry for volume %s\n",
                as->parms[0].items->data);
        exit(1);
     }
-    code2 = VLDB_GetEntryByName(as->parms[1].items->data, &entry);
+    code2 = VLDB_GetEntryByNameU(as->parms[1].items->data, &entry);
     if ((!code1) && (!code2)) {        /*the newname already exists */
        fprintf(STDERR, "vos: volume %s already exists\n",
                as->parms[1].items->data);
@@ -4183,10 +4184,10 @@ RenameVolume(struct cmd_syndesc *as, void *arock)
                as->parms[1].items->data);
        exit(1);
     }
-    MapHostToNetwork(&entry);
+    MapHostToNetworkU(&entry);
     code =
-       UV_RenameVolume(&entry, as->parms[0].items->data,
-                       as->parms[1].items->data);
+       UV_RenameVolumeU(&entry, as->parms[0].items->data,
+                        as->parms[1].items->data);
     if (code) {
        PrintDiagnostics("rename", code);
        exit(1);
@@ -4198,12 +4199,12 @@ RenameVolume(struct cmd_syndesc *as, void *arock)
 
 int
 GetVolumeInfo(afs_uint32 volid, afs_uint32 *server, afs_int32 *part, afs_int32 *voltype,
-              struct nvldbentry *rentry)
+              struct uvldbentry *rentry)
 {
     afs_int32 vcode;
     int i, index = -1;
 
-    vcode = VLDB_GetEntryByID(volid, -1, rentry);
+    vcode = VLDB_GetEntryByIDU(volid, -1, rentry);
     if (vcode) {
        fprintf(STDERR,
                "Could not fetch the entry for volume %lu from VLDB \n",
@@ -4211,7 +4212,7 @@ GetVolumeInfo(afs_uint32 volid, afs_uint32 *server, afs_int32 *part, afs_int32 *
        PrintError("", vcode);
        return (vcode);
     }
-    MapHostToNetwork(rentry);
+    MapHostToNetworkU(rentry);
     if (volid == rentry->volumeId[ROVOL]) {
        *voltype = ROVOL;
        for (i = 0; i < rentry->nServers; i++) {
@@ -4226,12 +4227,12 @@ GetVolumeInfo(afs_uint32 volid, afs_uint32 *server, afs_int32 *part, afs_int32 *
            return -1;
        }
 
-       *server = rentry->serverNumber[index];
+       *server = rentry->serverUnique[index];
        *part = rentry->serverPartition[index];
        return 0;
     }
 
-    index = Lp_GetRwIndex(rentry);
+    index = Lp_GetRwIndexU(rentry);
     if (index == -1) {
        fprintf(STDERR,
                "RW Volume is not found in VLDB entry for volume %lu\n",
@@ -4240,13 +4241,13 @@ GetVolumeInfo(afs_uint32 volid, afs_uint32 *server, afs_int32 *part, afs_int32 *
     }
     if (volid == rentry->volumeId[RWVOL]) {
        *voltype = RWVOL;
-       *server = rentry->serverNumber[index];
+       *server = rentry->serverUnique[index];
        *part = rentry->serverPartition[index];
        return 0;
     }
     if (volid == rentry->volumeId[BACKVOL]) {
        *voltype = BACKVOL;
-       *server = rentry->serverNumber[index];
+       *server = rentry->serverUnique[index];
        *part = rentry->serverPartition[index];
        return 0;
     }
@@ -4263,8 +4264,8 @@ DeleteEntry(struct cmd_syndesc *as, void *arock)
     afs_uint32 avolid;
     afs_int32 vcode;
     struct VldbListByAttributes attributes;
-    nbulkentries arrayEntries;
-    struct nvldbentry *vllist;
+    ubulkentries arrayEntries;
+    struct uvldbentry *vllist;
     struct cmd_item *itp;
     afs_int32 nentries;
     int j;
@@ -4375,7 +4376,7 @@ DeleteEntry(struct cmd_syndesc *as, void *arock)
 
     /* Get all the VLDB entries on a server and/or partition */
     memset(&arrayEntries, 0, sizeof(arrayEntries));
-    vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries);
+    vcode = VLDB_ListAttributesU(&attributes, &nentries, &arrayEntries);
     if (vcode) {
        fprintf(STDERR, "Could not access the VLDB for attributes\n");
        PrintError("", vcode);
@@ -4384,7 +4385,7 @@ DeleteEntry(struct cmd_syndesc *as, void *arock)
 
     /* Process each entry */
     for (j = 0; j < nentries; j++) {
-       vllist = &arrayEntries.nbulkentries_val[j];
+       vllist = &arrayEntries.ubulkentries_val[j];
        if (seenprefix) {
            /* It only deletes the RW volumes */
            if (strncmp(vllist->name, prefix, strlen(prefix))) {
@@ -4426,8 +4427,8 @@ DeleteEntry(struct cmd_syndesc *as, void *arock)
     fprintf(STDOUT,
            "Total VLDB entries deleted: %lu; failed to delete: %lu\n",
            (unsigned long)totalBack, (unsigned long)totalFail);
-    if (arrayEntries.nbulkentries_val)
-       free(arrayEntries.nbulkentries_val);
+    if (arrayEntries.ubulkentries_val)
+       free(arrayEntries.ubulkentries_val);
     return 0;
 }
 
@@ -4435,24 +4436,24 @@ DeleteEntry(struct cmd_syndesc *as, void *arock)
 static int
 CompareVldbEntryByName(const void *p1, const void *p2)
 {
-    struct nvldbentry *arg1, *arg2;
+    struct uvldbentry *arg1, *arg2;
 
-    arg1 = (struct nvldbentry *)p1;
-    arg2 = (struct nvldbentry *)p2;
+    arg1 = (struct uvldbentry *)p1;
+    arg2 = (struct uvldbentry *)p2;
     return (strcmp(arg1->name, arg2->name));
 }
 
 /*
 static int CompareVldbEntry(char *p1, char *p2)
 {
-    struct nvldbentry *arg1,*arg2;
+    struct uvldbentry *arg1,*arg2;
     int i;
     int pos1, pos2;
     char comp1[100],comp2[100];
     char temp1[20],temp2[20];
 
-    arg1 = (struct nvldbentry *)p1;
-    arg2 = (struct nvldbentry *)p2;
+    arg1 = (struct uvldbentry *)p1;
+    arg2 = (struct uvldbentry *)p2;
     pos1 = -1;
     pos2 = -1;
 
@@ -4464,8 +4465,8 @@ static int CompareVldbEntry(char *p1, char *p2)
        pos1 = 0;
        pos2 = 0;
     }
-    sprintf(comp1,"%10u",arg1->serverNumber[pos1]);
-    sprintf(comp2,"%10u",arg2->serverNumber[pos2]);
+    sprintf(comp1,"%10u",arg1->serverUnique[pos1]);
+    sprintf(comp2,"%10u",arg2->serverUnique[pos2]);
     sprintf(temp1,"%10u",arg1->serverPartition[pos1]);
     sprintf(temp2,"%10u",arg2->serverPartition[pos2]);
     strcat(comp1,temp1);
@@ -4485,8 +4486,8 @@ ListVLDB(struct cmd_syndesc *as, void *arock)
     afs_int32 code;
     afs_int32 vcode;
     struct VldbListByAttributes attributes;
-    nbulkentries arrayEntries;
-    struct nvldbentry *vllist, *tarray = 0, *ttarray;
+    ubulkentries arrayEntries;
+    struct uvldbentry *vllist, *tarray = 0, *ttarray;
     afs_int32 centries, nentries = 0;
     afs_int32 tarraysize = 0;
     afs_int32 parraysize;
@@ -4566,12 +4567,12 @@ ListVLDB(struct cmd_syndesc *as, void *arock)
        nextindex = -1;
 
        vcode =
-           VLDB_ListAttributesN2(&attributes, 0, thisindex, &centries,
+           VLDB_ListAttributesN2U(&attributes, 0, thisindex, &centries,
                                  &arrayEntries, &nextindex);
        if (vcode == RXGEN_OPCODE) {
            /* Vlserver not running with ListAttributesN2. Fall back */
            vcode =
-               VLDB_ListAttributes(&attributes, &centries, &arrayEntries);
+               VLDB_ListAttributesU(&attributes, &centries, &arrayEntries);
            nextindex = -1;
        }
        if (vcode) {
@@ -4584,9 +4585,9 @@ ListVLDB(struct cmd_syndesc *as, void *arock)
        /* We don't sort, so just print the entries now */
        if (!sort) {
            for (j = 0; j < centries; j++) {    /* process each entry */
-               vllist = &arrayEntries.nbulkentries_val[j];
-               MapHostToNetwork(vllist);
-               EnumerateEntry(vllist);
+               vllist = &arrayEntries.ubulkentries_val[j];
+               MapHostToNetworkU(vllist);
+               EnumerateEntryU(vllist);
 
                PrintLocked(vllist->flags);
            }
@@ -4598,14 +4599,14 @@ ListVLDB(struct cmd_syndesc *as, void *arock)
        else if (centries > 0) {
            if (!tarray) {
                /* steal away the first bulk entries array */
-               tarray = (struct nvldbentry *)arrayEntries.nbulkentries_val;
-               tarraysize = centries * sizeof(struct nvldbentry);
-               arrayEntries.nbulkentries_val = 0;
+               tarray = (struct uvldbentry *)arrayEntries.ubulkentries_val;
+               tarraysize = centries * sizeof(struct uvldbentry);
+               arrayEntries.ubulkentries_val = 0;
            } else {
                /* Grow the tarray to keep the extra entries */
-               parraysize = (centries * sizeof(struct nvldbentry));
+               parraysize = (centries * sizeof(struct uvldbentry));
                ttarray =
-                   (struct nvldbentry *)realloc(tarray,
+                   (struct uvldbentry *)realloc(tarray,
                                                 tarraysize + parraysize);
                if (!ttarray) {
                    fprintf(STDERR,
@@ -4616,25 +4617,25 @@ ListVLDB(struct cmd_syndesc *as, void *arock)
 
                /* Copy them in */
                memcpy(((char *)tarray) + tarraysize,
-                      (char *)arrayEntries.nbulkentries_val, parraysize);
+                      (char *)arrayEntries.ubulkentries_val, parraysize);
                tarraysize += parraysize;
            }
        }
 
        /* Free the bulk array */
-       if (arrayEntries.nbulkentries_val) {
-           free(arrayEntries.nbulkentries_val);
-           arrayEntries.nbulkentries_val = 0;
+       if (arrayEntries.ubulkentries_val) {
+           free(arrayEntries.ubulkentries_val);
+           arrayEntries.ubulkentries_val = 0;
        }
     }
 
     /* Here is where we now sort all the entries and print them */
     if (sort && (nentries > 0)) {
-       qsort((char *)tarray, nentries, sizeof(struct nvldbentry),
+       qsort((char *)tarray, nentries, sizeof(struct uvldbentry),
              CompareVldbEntryByName);
        for (vllist = tarray, j = 0; j < nentries; j++, vllist++) {
-           MapHostToNetwork(vllist);
-           EnumerateEntry(vllist);
+           MapHostToNetworkU(vllist);
+           EnumerateEntryU(vllist);
 
            PrintLocked(vllist->flags);
        }
@@ -4657,8 +4658,8 @@ BackSys(struct cmd_syndesc *as, void *arock)
     afs_int32 code, apart1;
     afs_int32 vcode;
     struct VldbListByAttributes attributes;
-    nbulkentries arrayEntries;
-    struct nvldbentry *vllist;
+    ubulkentries arrayEntries;
+    struct uvldbentry *vllist;
     afs_int32 nentries;
     int j;
     char pname[10];
@@ -4763,7 +4764,7 @@ BackSys(struct cmd_syndesc *as, void *arock)
     }
 
     memset(&arrayEntries, 0, sizeof(arrayEntries));    /* initialize to hint the stub to alloc space */
-    vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries);
+    vcode = VLDB_ListAttributesU(&attributes, &nentries, &arrayEntries);
     if (vcode) {
        fprintf(STDERR, "Could not access the VLDB for attributes\n");
        PrintError("", vcode);
@@ -4817,7 +4818,7 @@ BackSys(struct cmd_syndesc *as, void *arock)
     }
 
     for (j = 0; j < nentries; j++) {   /* process each vldb entry */
-       vllist = &arrayEntries.nbulkentries_val[j];
+       vllist = &arrayEntries.ubulkentries_val[j];
 
        if (seenprefix) {
            for (ti = as->parms[0].items; ti; ti = ti->next) {
@@ -4929,7 +4930,7 @@ BackSys(struct cmd_syndesc *as, void *arock)
        }
 
        avolid = vllist->volumeId[RWVOL];
-       MapHostToNetwork(vllist);
+       MapHostToNetworkU(vllist);
        GetServerAndPart(vllist, RWVOL, &aserver1, &apart1, &previdx);
        if (aserver1 == -1 || apart1 == -1) {
            fprintf(STDOUT, "could not backup %s, invalid VLDB entry\n",
@@ -4977,8 +4978,8 @@ BackSys(struct cmd_syndesc *as, void *arock)
     fprintf(STDOUT, "Total volumes backed up: %lu; failed to backup: %lu\n",
            (unsigned long)totalBack, (unsigned long)totalFail);
     fflush(STDOUT);
-    if (arrayEntries.nbulkentries_val)
-       free(arrayEntries.nbulkentries_val);
+    if (arrayEntries.ubulkentries_val)
+       free(arrayEntries.ubulkentries_val);
     return 0;
 }
 
@@ -4990,8 +4991,8 @@ UnlockVLDB(struct cmd_syndesc *as, void *arock)
     afs_int32 code;
     afs_int32 vcode;
     struct VldbListByAttributes attributes;
-    nbulkentries arrayEntries;
-    struct nvldbentry *vllist;
+    ubulkentries arrayEntries;
+    struct uvldbentry *vllist;
     afs_int32 nentries;
     int j;
     afs_uint32 volid;
@@ -5034,14 +5035,14 @@ UnlockVLDB(struct cmd_syndesc *as, void *arock)
     attributes.flag = VLOP_ALLOPERS;
     attributes.Mask |= VLLIST_FLAG;
     memset(&arrayEntries, 0, sizeof(arrayEntries));    /*initialize to hint the stub  to alloc space */
-    vcode = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries);
+    vcode = VLDB_ListAttributesU(&attributes, &nentries, &arrayEntries);
     if (vcode) {
        fprintf(STDERR, "Could not access the VLDB for attributes\n");
        PrintError("", vcode);
        exit(1);
     }
     for (j = 0; j < nentries; j++) {   /* process each entry */
-       vllist = &arrayEntries.nbulkentries_val[j];
+       vllist = &arrayEntries.ubulkentries_val[j];
        volid = vllist->volumeId[RWVOL];
        vcode =
            ubik_VL_ReleaseLock(cstruct, 0, volid, -1,
@@ -5079,8 +5080,8 @@ UnlockVLDB(struct cmd_syndesc *as, void *arock)
        }
     }
 
-    if (arrayEntries.nbulkentries_val)
-       free(arrayEntries.nbulkentries_val);
+    if (arrayEntries.ubulkentries_val)
+       free(arrayEntries.ubulkentries_val);
     return 0;
 }
 
@@ -5557,7 +5558,7 @@ ConvertRO(struct cmd_syndesc *as, void *arock)
     afs_uint32 volid;
     afs_uint32 server;
     afs_int32 code, i, same;
-    struct nvldbentry entry, storeEntry;
+    struct uvldbentry entry, storeEntry;
     afs_int32 vcode;
     afs_int32 rwindex = 0;
     afs_uint32 rwserver = 0;
@@ -5602,7 +5603,7 @@ ConvertRO(struct cmd_syndesc *as, void *arock)
     if (as->parms[3].items)
        force = 1;
 
-    vcode = VLDB_GetEntryByID(volid, -1, &entry);
+    vcode = VLDB_GetEntryByIDU(volid, -1, &entry);
     if (vcode) {
        fprintf(STDERR,
                "Could not fetch the entry for volume %lu from VLDB\n",
@@ -5616,15 +5617,15 @@ ConvertRO(struct cmd_syndesc *as, void *arock)
     if (volid != entry.volumeId[ROVOL])
        volid = entry.volumeId[ROVOL];
 
-    MapHostToNetwork(&entry);
+    MapHostToNetworkU(&entry);
     for (i = 0; i < entry.nServers; i++) {
        if (entry.serverFlags[i] & ITSRWVOL) {
            rwindex = i;
-           rwserver = entry.serverNumber[i];
+           rwserver = entry.serverUnique[i];
            rwpartition = entry.serverPartition[i];
        }
        if (entry.serverFlags[i] & ITSROVOL) {
-           same = VLDB_IsSameAddrs(server, entry.serverNumber[i], &code);
+           same = VLDB_IsSameAddrs(server, entry.serverUnique[i], &code);
            if (code) {
                fprintf(STDERR,
                        "Failed to get info about server's %d address(es) from vlserver (err=%d); aborting call!\n",
@@ -5633,7 +5634,7 @@ ConvertRO(struct cmd_syndesc *as, void *arock)
            }
            if (same) {
                roindex = i;
-               roserver = entry.serverNumber[i];
+               roserver = entry.serverUnique[i];
                ropartition = entry.serverPartition[i];
                break;
            }
@@ -5683,11 +5684,11 @@ ConvertRO(struct cmd_syndesc *as, void *arock)
     if (rwserver) {
        (entry.nServers)--;
        if (rwindex != entry.nServers) {
-           entry.serverNumber[rwindex] = entry.serverNumber[entry.nServers];
+           entry.serverUnique[rwindex] = entry.serverUnique[entry.nServers];
            entry.serverPartition[rwindex] =
                entry.serverPartition[entry.nServers];
            entry.serverFlags[rwindex] = entry.serverFlags[entry.nServers];
-           entry.serverNumber[entry.nServers] = 0;
+           entry.serverUnique[entry.nServers] = 0;
            entry.serverPartition[entry.nServers] = 0;
            entry.serverFlags[entry.nServers] = 0;
        }
@@ -5699,9 +5700,9 @@ ConvertRO(struct cmd_syndesc *as, void *arock)
                entry.flags |= RO_EXISTS;
        }
     }
-    MapNetworkToHost(&entry, &storeEntry);
+    MapNetworkToHostU(&entry, &storeEntry);
     code =
-       VLDB_ReplaceEntry(entry.volumeId[RWVOL], RWVOL, &storeEntry,
+       VLDB_ReplaceEntryU(entry.volumeId[RWVOL], RWVOL, &storeEntry,
                          (LOCKREL_OPCODE | LOCKREL_AFSID |
                           LOCKREL_TIMESTAMP));
     if (code) {
@@ -5722,7 +5723,7 @@ Sizes(struct cmd_syndesc *as, void *arock)
     afs_uint32 avolid;
     afs_uint32 aserver;
     afs_int32 apart, voltype, fromdate = 0, code, err, i;
-    struct nvldbentry entry;
+    struct uvldbentry entry;
     volintSize vol_size;
 
     rx_SetRxDeadTime(60 * 10);
index 050df99..2ef8e75 100644 (file)
@@ -147,6 +147,8 @@ do { \
        { if (verbose) { fprintf(STDOUT, (es), (p1), (p2)); fflush(STDOUT); } }
 #define VPRINT3(es, p1, p2, p3) \
        { if (verbose) { fprintf(STDOUT, (es), (p1), (p2), (p3)); fflush(STDOUT); } }
+#define VPRINT4(es, p1, p2, p3, p4) \
+       { if (verbose) { fprintf(STDOUT, (es), (p1), (p2), (p3), (p4)); fflush(STDOUT); } }
 #define VDONE \
        { if (verbose) { fprintf(STDOUT, " done\n"); fflush(STDOUT); } }
 #define VEPRINT(es) \
@@ -174,7 +176,7 @@ static afs_int32 CheckAndDeleteVolume(struct rx_connection *aconn,
 #endif
 static int DelVol(struct rx_connection *conn, afs_uint32 vid, afs_int32 part,
                  afs_int32 flags);
-static int GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index,
+static int GetTrans(struct uvldbentry *vldbEntryPtr, afs_int32 index,
                    struct rx_connection **connPtr, afs_int32 * transPtr,
                    afs_uint32 * crtimePtr, afs_uint32 * uptimePtr,
                    afs_int32 *origflags);
@@ -184,8 +186,16 @@ static int SimulateForwardMultiple(struct rx_connection *fromconn,
                                   void *cookie, manyResults * results);
 static afs_int32 CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver,
                             afs_int32 apart, afs_int32 * modentry,
-                            afs_uint32 * maxvolid, struct nvldbentry *aentry);
-
+                            afs_uint32 * maxvolid, struct uvldbentry *aentry);
+static void dump_sig_handler(int x);
+static int sortVolumes(const void *a, const void *b);
+static afs_int32 CheckVldbRWBK(struct uvldbentry *entry,
+                              afs_int32 * modified);
+static int CheckVldbRO(struct uvldbentry *entry, afs_int32 * modified);
+static afs_int32 CheckVldb(struct uvldbentry *entry, afs_int32 * modified,
+                           afs_int32 *deleted);
+static afs_int32 VolumeExists(afs_uint32 server, afs_int32 partition,
+                             afs_uint32 volumeid);
 
 /*map the partition <partId> into partition name <partName>*/
 void
@@ -416,7 +426,8 @@ PrintError(char *msg, afs_int32 errcode)
     return 0;
 }
 
-void init_volintInfo(struct volintInfo *vinfo) {
+void
+init_volintInfo(struct volintInfo *vinfo) {
     memset(vinfo, 0, sizeof(struct volintInfo));
 
     vinfo->maxquota = -1;
@@ -547,7 +558,88 @@ CheckAndDeleteVolume(struct rx_connection *aconn, afs_int32 apart,
 
 #endif
 
-/* called by EmuerateEntry, show vldb entry in a reasonable format */
+/* called by EnumerateEntryU, show vldb entry in a reasonable format */
+void
+SubEnumerateEntryU(struct uvldbentry *entry)
+{
+    int i;
+    char pname[10];
+    int isMixed = 0;
+    char hoststr[16];
+
+#ifdef notdef
+    fprintf(STDOUT, "  readWriteID %-10u ", entry->volumeId[RWVOL]);
+    if (entry->flags & RW_EXISTS)
+       fprintf(STDOUT, " valid \n");
+    else
+       fprintf(STDOUT, " invalid \n");
+    fprintf(STDOUT, "  readOnlyID  %-10u ", entry->volumeId[ROVOL]);
+    if (entry->flags & RO_EXISTS)
+       fprintf(STDOUT, " valid \n");
+    else
+       fprintf(STDOUT, " invalid \n");
+    fprintf(STDOUT, "  backUpID    %-10u ", entry->volumeId[BACKVOL]);
+    if (entry->flags & BACK_EXISTS)
+       fprintf(STDOUT, " valid \n");
+    else
+       fprintf(STDOUT, " invalid \n");
+    if ((entry->cloneId != 0) && (entry->flags & RO_EXISTS))
+       fprintf(STDOUT, "    releaseClone %-10u \n", entry->cloneId);
+#else
+    if (entry->flags & RW_EXISTS)
+       fprintf(STDOUT, "    RWrite: %-10u", entry->volumeId[RWVOL]);
+    if (entry->flags & RO_EXISTS)
+       fprintf(STDOUT, "    ROnly: %-10u", entry->volumeId[ROVOL]);
+    if (entry->flags & BACK_EXISTS)
+       fprintf(STDOUT, "    Backup: %-10u", entry->volumeId[BACKVOL]);
+    if ((entry->cloneId != 0) && (entry->flags & RO_EXISTS))
+       fprintf(STDOUT, "    RClone: %-10lu", (unsigned long)entry->cloneId);
+    fprintf(STDOUT, "\n");
+#endif
+    fprintf(STDOUT, "    number of sites -> %lu\n",
+           (unsigned long)entry->nServers);
+    for (i = 0; i < entry->nServers; i++) {
+       if (entry->serverFlags[i] & NEW_REPSITE)
+           isMixed = 1;
+    }
+    for (i = 0; i < entry->nServers; i++) {
+       MapPartIdIntoName(entry->serverPartition[i], pname);
+       fprintf(STDOUT, "       server %s partition %s ",
+               noresolve ? afs_inet_ntoa_r(entry->serverUnique[i], hoststr) :
+                hostutil_GetNameByINet(entry->serverUnique[i]), pname);
+       if (entry->serverFlags[i] & ITSRWVOL)
+           fprintf(STDOUT, "RW Site ");
+       else
+           fprintf(STDOUT, "RO Site ");
+       if (isMixed) {
+           if (entry->serverFlags[i] & NEW_REPSITE)
+               fprintf(STDOUT," -- New release");
+           else
+               if (!(entry->serverFlags[i] & ITSRWVOL))
+                   fprintf(STDOUT," -- Old release");
+       } else {
+           if (entry->serverFlags[i] & RO_DONTUSE)
+               fprintf(STDOUT, " -- Not released");
+       }
+       fprintf(STDOUT, "\n");
+    }
+
+    return;
+
+}
+
+/*enumerate the vldb entry corresponding to <entry> */
+void
+EnumerateEntryU(struct uvldbentry *entry)
+{
+
+    fprintf(STDOUT, "\n");
+    fprintf(STDOUT, "%s \n", entry->name);
+    SubEnumerateEntryU(entry);
+    return;
+}
+
+/* called by EnumerateEntry, show vldb entry in a reasonable format */
 void
 SubEnumerateEntry(struct nvldbentry *entry)
 {
@@ -728,7 +820,7 @@ UV_CreateVolume3(afs_uint32 aserver, afs_int32 apart, char *aname,
     afs_int32 error;
     afs_int32 rcode, vcode;
     afs_int32 lastid;
-    struct nvldbentry entry, storeEntry;       /*the new vldb entry */
+    struct uvldbentry entry, storeEntry;       /*the new vldb entry */
     struct volintInfo tstatus;
 
     tid = 0;
@@ -748,7 +840,7 @@ UV_CreateVolume3(afs_uint32 aserver, afs_int32 apart, char *aname,
     }
 
     if (*anewid) {
-        vcode = VLDB_GetEntryByID(*anewid, -1, &entry);
+        vcode = VLDB_GetEntryByIDU(*anewid, -1, &entry);
        if (!vcode) {
            fprintf(STDERR, "Volume ID %d already exists\n", *anewid);
            return VVOLEXISTS;
@@ -797,7 +889,7 @@ UV_CreateVolume3(afs_uint32 aserver, afs_int32 apart, char *aname,
     /* set up the vldb entry for this volume */
     strncpy(entry.name, aname, VOLSER_OLDMAXVOLNAME);
     entry.nServers = 1;
-    entry.serverNumber[0] = aserver;   /* this should have another
+    entry.serverUnique[0] = aserver;   /* this should have another
                                         * level of indirection later */
     entry.serverPartition[0] = apart;  /* this should also have
                                         * another indirection level */
@@ -809,9 +901,9 @@ UV_CreateVolume3(afs_uint32 aserver, afs_int32 apart, char *aname,
     entry.cloneId = 0;
     /*map into right byte order, before passing to xdr, the stuff has to be in host
      * byte order. Xdr converts it into network order */
-    MapNetworkToHost(&entry, &storeEntry);
+    MapNetworkToHostU(&entry, &storeEntry);
     /* create the vldb entry */
-    vcode = VLDB_CreateEntry(&storeEntry);
+    vcode = VLDB_CreateEntryU(&storeEntry);
     if (vcode) {
        fprintf(STDERR,
                "Could not create a VLDB entry for the volume %s %lu\n",
@@ -857,7 +949,7 @@ UV_AddVLDBEntry(afs_uint32 aserver, afs_int32 apart, char *aname,
     struct rx_connection *aconn;
     afs_int32 error;
     afs_int32 vcode;
-    struct nvldbentry entry, storeEntry;       /*the new vldb entry */
+    struct uvldbentry entry, storeEntry;       /*the new vldb entry */
 
     aconn = (struct rx_connection *)0;
     error = 0;
@@ -865,7 +957,7 @@ UV_AddVLDBEntry(afs_uint32 aserver, afs_int32 apart, char *aname,
     /* set up the vldb entry for this volume */
     strncpy(entry.name, aname, VOLSER_OLDMAXVOLNAME);
     entry.nServers = 1;
-    entry.serverNumber[0] = aserver;   /* this should have another
+    entry.serverUnique[0] = aserver;   /* this should have another
                                         * level of indirection later */
     entry.serverPartition[0] = apart;  /* this should also have
                                         * another indirection level */
@@ -882,9 +974,9 @@ UV_AddVLDBEntry(afs_uint32 aserver, afs_int32 apart, char *aname,
     entry.cloneId = 0;
     /*map into right byte order, before passing to xdr, the stuff has to be in host
      * byte order. Xdr converts it into network order */
-    MapNetworkToHost(&entry, &storeEntry);
+    MapNetworkToHostU(&entry, &storeEntry);
     /* create the vldb entry */
-    vcode = VLDB_CreateEntry(&storeEntry);
+    vcode = VLDB_CreateEntryU(&storeEntry);
     if (vcode) {
        fprintf(STDERR,
                "Could not create a VLDB entry for the  volume %s %lu\n",
@@ -912,7 +1004,7 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
     afs_int32 ttid = 0;
     afs_int32 code, rcode;
     afs_int32 error = 0;
-    struct nvldbentry entry, storeEntry;
+    struct uvldbentry entry, storeEntry;
     int islocked = 0;
     afs_int32 avoltype = -1, vtype;
     int notondisk = 0, notinvldb = 0;
@@ -928,13 +1020,13 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
     } else {
        islocked = 1;
 
-       code = VLDB_GetEntryByID(avolid, avoltype, &entry);
+       code = VLDB_GetEntryByIDU(avolid, avoltype, &entry);
        EGOTO1(error_exit, code, "Could not fetch VLDB entry for volume %u\n",
               avolid);
-       MapHostToNetwork(&entry);
+       MapHostToNetworkU(&entry);
 
        if (verbose)
-           EnumerateEntry(&entry);
+           EnumerateEntryU(&entry);
     }
 
     /* Whether volume is in the VLDB or not. Delete the volume on disk */
@@ -972,7 +1064,7 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
        /* Its a backup volume, modify the VLDB entry. Check that the
         * backup volume is on the server/partition we asked to delete.
         */
-       if (!(entry.flags & BACK_EXISTS) || !Lp_Match(aserver, apart, &entry)) {
+       if (!(entry.flags & BACK_EXISTS) || !Lp_MatchU(aserver, apart, &entry)) {
            notinvldb = 2;      /* Not on this server and partition */
            ERROR_EXIT(0);
        }
@@ -989,7 +1081,7 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
         * If flags does not have RO_EIXSTS set, then this may mean the RO
         * hasn't been released (and could exist in VLDB).
         */
-       if (!Lp_ROMatch(aserver, apart, &entry)) {
+       if (!Lp_ROMatchU(aserver, apart, &entry)) {
            notinvldb = 2;      /* Not found on this server and partition */
            ERROR_EXIT(0);
        }
@@ -999,9 +1091,9 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
                    "Marking the readonly volume %lu deleted in the VLDB\n",
                    (unsigned long)avolid);
 
-       Lp_SetROValue(&entry, aserver, apart, 0, 0);    /* delete the site */
+       Lp_SetROValueU(&entry, aserver, apart, 0, 0);   /* delete the site */
        entry.nServers--;
-       if (!Lp_ROMatch(0, 0, &entry))
+       if (!Lp_ROMatchU(0, 0, &entry))
            entry.flags &= ~RO_EXISTS;  /* This was the last ro volume */
        vtype = ROVOL;
     }
@@ -1011,7 +1103,7 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
         * Check that the readwrite volumes is on the server/partition we
         * asked to delete.
         */
-       if (!(entry.flags & RW_EXISTS) || !Lp_Match(aserver, apart, &entry)) {
+       if (!(entry.flags & RW_EXISTS) || !Lp_MatchU(aserver, apart, &entry)) {
            notinvldb = 2;      /* Not found on this server and partition */
            ERROR_EXIT(0);
        }
@@ -1049,7 +1141,7 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
                      flags & BACK_EXISTS) ? ", and its backup volume," :
                     ""));
 
-       Lp_SetRWValue(&entry, aserver, apart, 0L, 0L);
+       Lp_SetRWValueU(&entry, aserver, apart, 0L, 0L);
        entry.nServers--;
        entry.flags &= ~(BACK_EXISTS | RW_EXISTS);
        vtype = RWVOL;
@@ -1074,9 +1166,9 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
               "Could not delete the VLDB entry for the volume %u \n",
               avolid);
     } else {
-       MapNetworkToHost(&entry, &storeEntry);
+       MapNetworkToHostU(&entry, &storeEntry);
        code =
-           VLDB_ReplaceEntry(avolid, vtype, &storeEntry,
+           VLDB_ReplaceEntryU(avolid, vtype, &storeEntry,
                              (LOCKREL_OPCODE | LOCKREL_AFSID |
                               LOCKREL_TIMESTAMP));
        EGOTO1(error_exit, code,
@@ -1213,7 +1305,7 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
     struct volser_status tstatus;
     struct destServer destination;
 
-    struct nvldbentry entry, storeEntry;
+    struct uvldbentry entry, storeEntry;
     int i;
     afs_int32 error;
     char in, lf;               /* for test code */
@@ -1261,7 +1353,7 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
        /* or drop through */
     }
 
-    vcode = VLDB_GetEntryByID(afromvol, -1, &entry);
+    vcode = VLDB_GetEntryByIDU(afromvol, -1, &entry);
     EGOTO1(mfail, vcode,
           "Could not fetch the entry for the volume  %u from the VLDB \n",
           afromvol);
@@ -1275,17 +1367,17 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
     EGOTO1(mfail, vcode, "Could not lock entry for volume %u \n", afromvol);
     islocked = 1;
 
-    vcode = VLDB_GetEntryByID(afromvol, RWVOL, &entry);
+    vcode = VLDB_GetEntryByIDU(afromvol, RWVOL, &entry);
     EGOTO1(mfail, vcode,
           "Could not fetch the entry for the volume  %u from the VLDB \n",
           afromvol);
 
     backupId = entry.volumeId[BACKVOL];
-    MapHostToNetwork(&entry);
+    MapHostToNetworkU(&entry);
 
-    if (!Lp_Match(afromserver, afrompart, &entry)) {
+    if (!Lp_MatchU(afromserver, afrompart, &entry)) {
        /* the from server and partition do not exist in the vldb entry corresponding to volid */
-       if (!Lp_Match(atoserver, atopart, &entry)) {
+       if (!Lp_MatchU(atoserver, atopart, &entry)) {
            /* the to server and partition do not exist in the vldb entry corresponding to volid */
            fprintf(STDERR, "The volume %lu is not on the specified site. \n",
                    (unsigned long)afromvol);
@@ -1295,8 +1387,8 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
                    char pname[10];
                    MapPartIdIntoName(entry.serverPartition[i], pname);
                    fprintf(STDERR, " server %s partition %s \n",
-                           noresolve ? afs_inet_ntoa_r(entry.serverNumber[i], hoststr) :
-                            hostutil_GetNameByINet(entry.serverNumber[i]),
+                           noresolve ? afs_inet_ntoa_r(entry.serverUnique[i], hoststr) :
+                            hostutil_GetNameByINet(entry.serverUnique[i]),
                            pname);
                }
            }
@@ -1676,8 +1768,8 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
           afromvol);
     VDONE;
 
-    Lp_SetRWValue(&entry, afromserver, afrompart, atoserver, atopart);
-    MapNetworkToHost(&entry, &storeEntry);
+    Lp_SetRWValueU(&entry, afromserver, afrompart, atoserver, atopart);
+    MapNetworkToHostU(&entry, &storeEntry);
     storeEntry.flags &= ~BACK_EXISTS;
 
     if (TESTC) {
@@ -1700,7 +1792,7 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
 
     VPRINT1("Releasing lock on VLDB entry for volume %u ...", afromvol);
     vcode =
-       VLDB_ReplaceEntry(afromvol, -1, &storeEntry,
+       VLDB_ReplaceEntryU(afromvol, -1, &storeEntry,
                          (LOCKREL_OPCODE | LOCKREL_AFSID |
                           LOCKREL_TIMESTAMP));
     if (vcode) {
@@ -1978,20 +2070,20 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
     }
 
     VPRINT("Recovery: Accessing VLDB.\n");
-    vcode = VLDB_GetEntryByID(afromvol, -1, &entry);
+    vcode = VLDB_GetEntryByIDU(afromvol, -1, &entry);
     if (vcode) {
        fprintf(STDOUT, "FATAL: VLDB access error: abort cleanup\n");
        fflush(STDOUT);
        goto done;
     }
-    MapHostToNetwork(&entry);
+    MapHostToNetworkU(&entry);
 
     /* Delete either the volume on the source location or the target location.
      * If the vldb entry still points to the source location, then we know the
      * volume move didn't finish so we remove the volume from the target
      * location. Otherwise, we remove the volume from the source location.
      */
-    if (Lp_Match(afromserver, afrompart, &entry)) {    /* didn't move - delete target volume */
+    if (Lp_MatchU(afromserver, afrompart, &entry)) {   /* didn't move - delete target volume */
        if (pntg) {
            fprintf(STDOUT,
                    "move incomplete - attempt cleanup of target partition - no guarantee\n");
@@ -2242,7 +2334,7 @@ UV_CopyVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
     afs_int32 volflag;
     struct volser_status tstatus;
     struct destServer destination;
-    struct nvldbentry entry, newentry, storeEntry;
+    struct uvldbentry entry, newentry, storeEntry;
     afs_int32 error;
     afs_int32 tmp;
     afs_uint32 tmpVol;
@@ -2261,11 +2353,11 @@ UV_CopyVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
        goto mfail;
     (void)signal(SIGINT, sigint_handler);
 
-    vcode = VLDB_GetEntryByID(afromvol, -1, &entry);
+    vcode = VLDB_GetEntryByIDU(afromvol, -1, &entry);
     EGOTO1(mfail, vcode,
           "Could not fetch the entry for the volume  %u from the VLDB \n",
           afromvol);
-    MapHostToNetwork(&entry);
+    MapHostToNetworkU(&entry);
 
     pntg = 1;
     toconn = UV_Bind(atoserver, AFSCONF_VOLUMEPORT);   /* get connections to the servers */
@@ -2575,7 +2667,7 @@ cpincr:
        /* create the vldb entry for the copied volume */
        strncpy(newentry.name, atovolname, VOLSER_OLDMAXVOLNAME);
        newentry.nServers = 1;
-       newentry.serverNumber[0] = atoserver;
+       newentry.serverUnique[0] = atoserver;
        newentry.serverPartition[0] = atopart;
        newentry.flags = (flags & RV_RDONLY) ? RO_EXISTS : RW_EXISTS;
        newentry.serverFlags[0] = (flags & RV_RDONLY) ? ITSROVOL : ITSRWVOL;
@@ -2585,9 +2677,9 @@ cpincr:
        newentry.cloneId = 0;
        /*map into right byte order, before passing to xdr, the stuff has to be in host
         * byte order. Xdr converts it into network order */
-       MapNetworkToHost(&newentry, &storeEntry);
+       MapNetworkToHostU(&newentry, &storeEntry);
        /* create the vldb entry */
-       vcode = VLDB_CreateEntry(&storeEntry);
+       vcode = VLDB_CreateEntryU(&storeEntry);
        if (vcode) {
            fprintf(STDERR,
                    "Could not create a VLDB entry for the volume %s %lu\n",
@@ -2682,13 +2774,13 @@ cpincr:
     }
 
     VPRINT("Recovery: Accessing VLDB.\n");
-    vcode = VLDB_GetEntryByID(afromvol, -1, &entry);
+    vcode = VLDB_GetEntryByIDU(afromvol, -1, &entry);
     if (vcode) {
        fprintf(STDOUT, "FATAL: VLDB access error: abort cleanup\n");
        fflush(STDOUT);
        goto done;
     }
-    MapHostToNetwork(&entry);
+    MapHostToNetworkU(&entry);
 
     /* common cleanup - delete local clone */
     if (cloneVol) {
@@ -2753,7 +2845,7 @@ UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
     afs_uint32 backupID;
     afs_int32 code = 0, rcode = 0;
     char vname[VOLSER_MAXVOLNAME + 1];
-    struct nvldbentry entry, storeEntry;
+    struct uvldbentry entry, storeEntry;
     afs_int32 error = 0;
     int vldblocked = 0, vldbmod = 0, backexists = 1;
 
@@ -2761,7 +2853,7 @@ UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
 
     /* the calls to VLDB will succeed only if avolid is a RW volume,
      * since we are following the RW hash chain for searching */
-    code = VLDB_GetEntryByID(avolid, RWVOL, &entry);
+    code = VLDB_GetEntryByIDU(avolid, RWVOL, &entry);
     if (code) {
        fprintf(STDERR,
                "Could not fetch the entry for the volume %lu from the VLDB \n",
@@ -2769,7 +2861,7 @@ UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
        error = code;
        goto bfail;
     }
-    MapHostToNetwork(&entry);
+    MapHostToNetworkU(&entry);
 
     /* These operations require the VLDB be locked since it means the VLDB
      * will change or the vldb is already locked.
@@ -2789,7 +2881,7 @@ UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
        vldblocked = 1;
 
        /* Reread the vldb entry */
-       code = VLDB_GetEntryByID(avolid, RWVOL, &entry);
+       code = VLDB_GetEntryByIDU(avolid, RWVOL, &entry);
        if (code) {
            fprintf(STDERR,
                    "Could not fetch the entry for the volume %lu from the VLDB \n",
@@ -2797,7 +2889,7 @@ UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
            error = code;
            goto bfail;
        }
-       MapHostToNetwork(&entry);
+       MapHostToNetworkU(&entry);
     }
 
     if (!ISNAMEVALID(entry.name)) {
@@ -2962,9 +3054,9 @@ UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
     /* Now update the vldb - if modified */
     if (vldblocked) {
        if (vldbmod) {
-           MapNetworkToHost(&entry, &storeEntry);
+           MapNetworkToHostU(&entry, &storeEntry);
            code =
-               VLDB_ReplaceEntry(avolid, RWVOL, &storeEntry,
+               VLDB_ReplaceEntryU(avolid, RWVOL, &storeEntry,
                                  (LOCKREL_OPCODE | LOCKREL_AFSID |
                                   LOCKREL_TIMESTAMP));
            if (code) {
@@ -3223,7 +3315,7 @@ DelVol(struct rx_connection *conn, afs_uint32 vid, afs_int32 part,
  * be made (0 if it's a new volume)
  */
 static int
-GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index,
+GetTrans(struct uvldbentry *vldbEntryPtr, afs_int32 index,
         struct rx_connection **connPtr, afs_int32 * transPtr,
         afs_uint32 * crtimePtr, afs_uint32 * uptimePtr,
         afs_int32 *origflags)
@@ -3240,7 +3332,7 @@ GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index,
     *uptimePtr = 0;
 
     /* get connection to the replication site */
-    *connPtr = UV_Bind(vldbEntryPtr->serverNumber[index], AFSCONF_VOLUMEPORT);
+    *connPtr = UV_Bind(vldbEntryPtr->serverUnique[index], AFSCONF_VOLUMEPORT);
     if (!*connPtr)
        goto fail;              /* server is down */
 
@@ -3261,9 +3353,9 @@ GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index,
 
            VPRINT1("Deleting extant RO_DONTUSE site on %s...",
                     noresolve ? afs_inet_ntoa_r(vldbEntryPtr->
-                                                serverNumber[index], hoststr) :
+                                                serverUnique[index], hoststr) :
                     hostutil_GetNameByINet(vldbEntryPtr->
-                                          serverNumber[index]));
+                                          serverUnique[index]));
 
            code = AFSVolDeleteVolume(*connPtr, *transPtr);
            if (code) {
@@ -3309,9 +3401,9 @@ GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index,
                    "Creating new volume %lu on replication site %s: ",
                    (unsigned long)volid,
                     noresolve ? afs_inet_ntoa_r(vldbEntryPtr->
-                                                serverNumber[index], hoststr) :
+                                                serverUnique[index], hoststr) :
                     hostutil_GetNameByINet(vldbEntryPtr->
-                                          serverNumber[index]));
+                                          serverUnique[index]));
            fflush(STDOUT);
        }
 
@@ -3344,8 +3436,8 @@ GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index,
     else {
        VPRINT2("Updating existing ro volume %u on %s ...\n", volid,
                 noresolve ? afs_inet_ntoa_r(vldbEntryPtr->
-                                            serverNumber[index], hoststr) :
-                hostutil_GetNameByINet(vldbEntryPtr->serverNumber[index]));
+                                            serverUnique[index], hoststr) :
+                hostutil_GetNameByINet(vldbEntryPtr->serverUnique[index]));
 
        code = AFSVolGetStatus(*connPtr, *transPtr, &tstatus);
        if (code) {
@@ -3412,7 +3504,7 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
     afs_int32 vcode, rcode, tcode;
     afs_uint32 cloneVolId, roVolId;
     struct replica *replicas = 0;
-    struct nvldbentry entry, storeEntry;
+    struct uvldbentry entry, storeEntry;
     int i, volcount, m, fullrelease, vldbindex;
     int failure;
     struct restoreCookie cookie;
@@ -3453,13 +3545,13 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
     islocked = 1;
 
     /* Get the vldb entry in readable format */
-    vcode = VLDB_GetEntryByID(afromvol, RWVOL, &entry);
+    vcode = VLDB_GetEntryByIDU(afromvol, RWVOL, &entry);
     ONERROR(vcode, afromvol,
            "Could not fetch the entry for the volume %u from the VLDB.\n");
-    MapHostToNetwork(&entry);
+    MapHostToNetworkU(&entry);
 
     if (verbose)
-       EnumerateEntry(&entry);
+       EnumerateEntryU(&entry);
 
     if (!ISNAMEVALID(entry.name))
        ONERROR(VOLSERBADOP, entry.name,
@@ -3479,9 +3571,9 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
      * on the same partition a clone instead of a complete copy.
      */
 
-    roindex = Lp_ROMatch(afromserver, afrompart, &entry) - 1;
+    roindex = Lp_ROMatchU(afromserver, afrompart, &entry) - 1;
     roclone = ((roindex == -1) ? 0 : 1);
-    rwindex = Lp_GetRwIndex(&entry);
+    rwindex = Lp_GetRwIndexU(&entry);
     if (rwindex < 0)
        ONERROR0(VOLSERNOVOL, "There is no RW volume \n");
 
@@ -3492,8 +3584,8 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
        ONERROR(vcode, entry.name, "Cant allocate ID for RO volume of %s\n");
 
        entry.volumeId[ROVOL] = roVolId;
-       MapNetworkToHost(&entry, &storeEntry);
-       vcode = VLDB_ReplaceEntry(afromvol, RWVOL, &storeEntry, 0);
+       MapNetworkToHostU(&entry, &storeEntry);
+       vcode = VLDB_ReplaceEntryU(afromvol, RWVOL, &storeEntry, 0);
        ONERROR(vcode, entry.name, "Could not update vldb entry for %s.\n");
     }
 
@@ -3699,9 +3791,9 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
             * up marking all the ROs as "old release" making the ROs
             * temporarily unavailable.
             */
-           MapNetworkToHost(&entry, &storeEntry);
+           MapNetworkToHostU(&entry, &storeEntry);
            VPRINT1("Replacing VLDB entry for %s...", entry.name);
-           vcode = VLDB_ReplaceEntry(afromvol, RWVOL, &storeEntry, 0);
+           vcode = VLDB_ReplaceEntryU(afromvol, RWVOL, &storeEntry, 0);
            ONERROR(vcode, entry.name,
                    "Could not update vldb entry for %s.\n");
            VDONE;
@@ -3782,7 +3874,7 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
             * volume).  Each volume might have a different time.
             */
            replicas[volcount].server.destHost =
-               ntohl(entry.serverNumber[vldbindex]);
+               ntohl(entry.serverUnique[vldbindex]);
            replicas[volcount].server.destPort = AFSCONF_VOLUMEPORT;
            replicas[volcount].server.destSSID = 1;
            times[volcount].vldbEntryIndex = vldbindex;
@@ -3845,18 +3937,18 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
        if (verbose) {
            fprintf(STDOUT, "Starting ForwardMulti from %lu to %u on %s",
                    (unsigned long)cloneVolId, entry.volumeId[ROVOL],
-                    noresolve ? afs_inet_ntoa_r(entry.serverNumber[times[0].
+                    noresolve ? afs_inet_ntoa_r(entry.serverUnique[times[0].
                                                 vldbEntryIndex], hoststr) :
                     hostutil_GetNameByINet(entry.
-                                          serverNumber[times[0].
+                                          serverUnique[times[0].
                                                        vldbEntryIndex]));
 
            for (s = 1; s < volcount; s++) {
                fprintf(STDOUT, " and %s",
-                        noresolve ? afs_inet_ntoa_r(entry.serverNumber[times[s].
+                        noresolve ? afs_inet_ntoa_r(entry.serverUnique[times[s].
                                                     vldbEntryIndex], hoststr) :
                         hostutil_GetNameByINet(entry.
-                                              serverNumber[times[s].
+                                              serverUnique[times[s].
                                                            vldbEntryIndex]));
            }
 
@@ -3956,8 +4048,8 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
            toconns[s] = 0;
        }
 
-       MapNetworkToHost(&entry, &storeEntry);
-       vcode = VLDB_ReplaceEntry(afromvol, RWVOL, &storeEntry, 0);
+       MapNetworkToHostU(&entry, &storeEntry);
+       vcode = VLDB_ReplaceEntryU(afromvol, RWVOL, &storeEntry, 0);
        ONERROR(vcode, afromvol,
                " Could not update VLDB entry for volume %u\n");
     }                          /* for each index in the vldb */
@@ -3984,14 +4076,14 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
            if (!(entry.serverFlags[i] & NEW_REPSITE)) {
                MapPartIdIntoName(entry.serverPartition[i], pname);
                fprintf(STDERR, "\t%35s %s\n",
-                        noresolve ? afs_inet_ntoa_r(entry.serverNumber[i], hoststr) :
-                        hostutil_GetNameByINet(entry.serverNumber[i]), pname);
+                        noresolve ? afs_inet_ntoa_r(entry.serverUnique[i], hoststr) :
+                        hostutil_GetNameByINet(entry.serverUnique[i]), pname);
            }
        }
 
-       MapNetworkToHost(&entry, &storeEntry);
+       MapNetworkToHostU(&entry, &storeEntry);
        vcode =
-           VLDB_ReplaceEntry(afromvol, RWVOL, &storeEntry,
+           VLDB_ReplaceEntryU(afromvol, RWVOL, &storeEntry,
                              LOCKREL_TIMESTAMP);
        ONERROR(vcode, afromvol,
                " Could not update VLDB entry for volume %u\n");
@@ -4018,9 +4110,9 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
     /* Update the VLDB */
     VPRINT("updating VLDB ...");
 
-    MapNetworkToHost(&entry, &storeEntry);
+    MapNetworkToHostU(&entry, &storeEntry);
     vcode =
-       VLDB_ReplaceEntry(afromvol, RWVOL, &storeEntry,
+       VLDB_ReplaceEntryU(afromvol, RWVOL, &storeEntry,
                          LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP);
     ONERROR(vcode, afromvol, " Could not update VLDB entry for volume %u\n");
     VDONE;
@@ -4098,7 +4190,7 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
 }
 
 
-void
+static void
 dump_sig_handler(int x)
 {
     fprintf(STDERR, "\nSignal handler: vos dump operation\n");
@@ -4375,7 +4467,7 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
     afs_uint32 pvolid;
     afs_int32 temptid, pparentid;
     int success;
-    struct nvldbentry entry, storeEntry;
+    struct uvldbentry entry, storeEntry;
     afs_int32 error;
     int islocked;
     struct restoreCookie cookie;
@@ -4409,7 +4501,7 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
     pparentid = toparentid;
     toconn = UV_Bind(toserver, AFSCONF_VOLUMEPORT);
     if (pvolid == 0) {         /*alot a new id if needed */
-       vcode = VLDB_GetEntryByName(tovolname, &entry);
+       vcode = VLDB_GetEntryByNameU(tovolname, &entry);
        if (vcode == VL_NOENT) {
            vcode = ubik_VL_GetNewVolumeId(cstruct, 0, 1, &pvolid);
            if (vcode) {
@@ -4620,7 +4712,7 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
        /* Volume was restored on the file server, update the
         * VLDB to reflect the change.
         */
-       vcode = VLDB_GetEntryByID(pvolid, voltype, &entry);
+       vcode = VLDB_GetEntryByIDU(pvolid, voltype, &entry);
        if (vcode && vcode != VL_NOENT && vcode != VL_ENTDELETED) {
            fprintf(STDERR,
                    "Could not fetch the entry for volume number %lu from VLDB \n",
@@ -4629,13 +4721,13 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
            goto refail;
        }
        if (!vcode)
-           MapHostToNetwork(&entry);
+           MapHostToNetworkU(&entry);
        if (vcode == VL_NOENT) {        /* it doesnot exist already */
            /*make the vldb return this indication specifically */
            VPRINT("------- Creating a new VLDB entry ------- \n");
            strcpy(entry.name, tovolname);
            entry.nServers = 1;
-           entry.serverNumber[0] = toserver;   /*should be indirect */
+           entry.serverUnique[0] = toserver;   /*should be indirect */
            entry.serverPartition[0] = topart;
            entry.serverFlags[0] = (flags & RV_RDONLY) ? ITSROVOL : ITSRWVOL;
            entry.flags = (flags & RV_RDONLY) ? RO_EXISTS : RW_EXISTS;
@@ -4652,8 +4744,8 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
                /*this should come from status info on the volume if non zero */
            } else
                entry.volumeId[BACKVOL] = INVALID_BID;
-           MapNetworkToHost(&entry, &storeEntry);
-           vcode = VLDB_CreateEntry(&storeEntry);
+           MapNetworkToHostU(&entry, &storeEntry);
+           vcode = VLDB_CreateEntryU(&storeEntry);
            if (vcode) {
                fprintf(STDERR,
                        "Could not create the VLDB entry for volume number %lu  \n",
@@ -4663,12 +4755,12 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
            }
            islocked = 0;
            if (verbose)
-               EnumerateEntry(&entry);
+               EnumerateEntryU(&entry);
        } else {                /*update the existing entry */
            if (verbose) {
                fprintf(STDOUT, "Updating the existing VLDB entry\n");
                fprintf(STDOUT, "------- Old entry -------\n");
-               EnumerateEntry(&entry);
+               EnumerateEntryU(&entry);
                fprintf(STDOUT, "------- New entry -------\n");
            }
            vcode =
@@ -4686,12 +4778,12 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
 
            /* Update the vlentry with the new information */
            if (flags & RV_RDONLY)
-               index = Lp_ROMatch(toserver, topart, &entry) - 1;
+               index = Lp_ROMatchU(toserver, topart, &entry) - 1;
            else
-               index = Lp_GetRwIndex(&entry);
+               index = Lp_GetRwIndexU(&entry);
            if (index == -1) {
                /* Add the new site for the volume being restored */
-               entry.serverNumber[entry.nServers] = toserver;
+               entry.serverUnique[entry.nServers] = toserver;
                entry.serverPartition[entry.nServers] = topart;
                entry.serverFlags[entry.nServers] =
                    (flags & RV_RDONLY) ? ITSROVOL : ITSRWVOL;
@@ -4701,7 +4793,7 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
                 * if its different from new site.
                 */
                same =
-                   VLDB_IsSameAddrs(toserver, entry.serverNumber[index],
+                   VLDB_IsSameAddrs(toserver, entry.serverUnique[index],
                                     &errcode);
                if (errcode)
                    EPRINT2(errcode,
@@ -4713,11 +4805,11 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
                        VPRINT2
                            ("Not deleting the previous volume %u on server %s, ...",
                             pvolid,
-                             noresolve ? afs_inet_ntoa_r(entry.serverNumber[index], hoststr) :
-                            hostutil_GetNameByINet(entry.serverNumber[index]));
+                             noresolve ? afs_inet_ntoa_r(entry.serverUnique[index], hoststr) :
+                            hostutil_GetNameByINet(entry.serverUnique[index]));
                    } else {
                        tempconn =
-                           UV_Bind(entry.serverNumber[index],
+                           UV_Bind(entry.serverUnique[index],
                                    AFSCONF_VOLUMEPORT);
 
                        MapPartIdIntoName(entry.serverPartition[index],
@@ -4725,8 +4817,8 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
                        VPRINT3
                            ("Deleting the previous volume %u on server %s, partition %s ...",
                             pvolid,
-                             noresolve ? afs_inet_ntoa_r(entry.serverNumber[index], hoststr) :
-                            hostutil_GetNameByINet(entry.serverNumber[index]),
+                             noresolve ? afs_inet_ntoa_r(entry.serverUnique[index], hoststr) :
+                            hostutil_GetNameByINet(entry.serverUnique[index]),
                             apartName);
                        code =
                            AFSVolTransCreate_retry(tempconn, pvolid,
@@ -4769,14 +4861,14 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
                        }
                    }
                }
-               entry.serverNumber[index] = toserver;
+               entry.serverUnique[index] = toserver;
                entry.serverPartition[index] = topart;
            }
 
            entry.flags |= (flags & RV_RDONLY) ? RO_EXISTS : RW_EXISTS;
-           MapNetworkToHost(&entry, &storeEntry);
+           MapNetworkToHostU(&entry, &storeEntry);
            vcode =
-               VLDB_ReplaceEntry(pvolid, voltype, &storeEntry,
+               VLDB_ReplaceEntryU(pvolid, voltype, &storeEntry,
                                  LOCKREL_OPCODE | LOCKREL_AFSID |
                                  LOCKREL_TIMESTAMP);
            if (vcode) {
@@ -4788,7 +4880,7 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
            }
            islocked = 0;
            if (verbose)
-               EnumerateEntry(&entry);
+               EnumerateEntryU(&entry);
        }
 
 
@@ -4889,7 +4981,7 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid,
            afs_uint32 rovolid, afs_int32 valid)
 {
     int j, nro = 0, islocked = 0;
-    struct nvldbentry entry, storeEntry, entry2;
+    struct uvldbentry entry, storeEntry, entry2;
     afs_int32 vcode, error = 0;
     char apartName[10];
 
@@ -4902,7 +4994,7 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid,
     }
     islocked = 1;
 
-    error = VLDB_GetEntryByID(volid, RWVOL, &entry);
+    error = VLDB_GetEntryByIDU(volid, RWVOL, &entry);
     if (error) {
        fprintf(STDERR,
                "Could not fetch the VLDB entry for volume number %lu  \n",
@@ -4917,7 +5009,7 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid,
        error = VOLSERBADOP;
        goto asfail;
     }
-    MapHostToNetwork(&entry);
+    MapHostToNetworkU(&entry);
 
     /* See if it's too many entries */
     if (entry.nServers >= NMAXNSERVERS) {
@@ -4931,7 +5023,7 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid,
     for (j = 0; j < entry.nServers; j++) {
        if (entry.serverFlags[j] & ITSROVOL) {
            nro++;
-           if (VLDB_IsSameAddrs(server, entry.serverNumber[j], &error)) {
+           if (VLDB_IsSameAddrs(server, entry.serverUnique[j], &error)) {
                if (error) {
                    fprintf(STDERR,
                            "Failed to get info about server's %d address(es) from vlserver (err=%d); aborting call!\n",
@@ -4962,7 +5054,7 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid,
      */
     if (rovolid) {
        if (entry.volumeId[ROVOL] == INVALID_BID) {
-           vcode = VLDB_GetEntryByID(rovolid, -1, &entry2);
+           vcode = VLDB_GetEntryByIDU(rovolid, -1, &entry2);
            if (!vcode) {
                fprintf(STDERR, "Volume ID %d already exists\n", rovolid);
                return VVOLEXISTS;
@@ -4976,7 +5068,7 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid,
     }
 
     VPRINT("Adding a new site ...");
-    entry.serverNumber[entry.nServers] = server;
+    entry.serverUnique[entry.nServers] = server;
     entry.serverPartition[entry.nServers] = part;
     if (!valid) {
        entry.serverFlags[entry.nServers] = (ITSROVOL | RO_DONTUSE);
@@ -4985,9 +5077,9 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid,
     }
     entry.nServers++;
 
-    MapNetworkToHost(&entry, &storeEntry);
+    MapNetworkToHostU(&entry, &storeEntry);
     error =
-       VLDB_ReplaceEntry(volid, RWVOL, &storeEntry,
+       VLDB_ReplaceEntryU(volid, RWVOL, &storeEntry,
                          LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP);
     if (error) {
        fprintf(STDERR, "Could not update entry for volume %lu \n",
@@ -5019,7 +5111,7 @@ int
 UV_RemoveSite(afs_uint32 server, afs_int32 part, afs_uint32 volid)
 {
     afs_int32 vcode;
-    struct nvldbentry entry, storeEntry;
+    struct uvldbentry entry, storeEntry;
 
     vcode = ubik_VL_SetLock(cstruct, 0, volid, RWVOL, VLOP_ADDSITE);
     if (vcode) {
@@ -5028,7 +5120,7 @@ UV_RemoveSite(afs_uint32 server, afs_int32 part, afs_uint32 volid)
        PrintError("", vcode);
        return (vcode);
     }
-    vcode = VLDB_GetEntryByID(volid, RWVOL, &entry);
+    vcode = VLDB_GetEntryByIDU(volid, RWVOL, &entry);
     if (vcode) {
        fprintf(STDERR,
                "Could not fetch the entry for volume number %lu from VLDB \n",
@@ -5036,8 +5128,8 @@ UV_RemoveSite(afs_uint32 server, afs_int32 part, afs_uint32 volid)
        PrintError("", vcode);
        return (vcode);
     }
-    MapHostToNetwork(&entry);
-    if (!Lp_ROMatch(server, part, &entry)) {
+    MapHostToNetworkU(&entry);
+    if (!Lp_ROMatchU(server, part, &entry)) {
        /*this site doesnot exist  */
        fprintf(STDERR, "This site is not a replication site \n");
        vcode =
@@ -5053,7 +5145,7 @@ UV_RemoveSite(afs_uint32 server, afs_int32 part, afs_uint32 volid)
        }
        return VOLSERBADOP;
     } else {                   /*remove the rep site */
-       Lp_SetROValue(&entry, server, part, 0, 0);
+       Lp_SetROValueU(&entry, server, part, 0, 0);
        entry.nServers--;
        if ((entry.nServers == 1) && (entry.flags & RW_EXISTS))
            entry.flags &= ~RO_EXISTS;
@@ -5070,12 +5162,12 @@ UV_RemoveSite(afs_uint32 server, afs_int32 part, afs_uint32 volid)
            }
            VDONE;
        }
-       MapNetworkToHost(&entry, &storeEntry);
+       MapNetworkToHostU(&entry, &storeEntry);
        fprintf(STDOUT, "Deleting the replication site for volume %lu ...",
                (unsigned long)volid);
        fflush(STDOUT);
        vcode =
-           VLDB_ReplaceEntry(volid, RWVOL, &storeEntry,
+           VLDB_ReplaceEntryU(volid, RWVOL, &storeEntry,
                              LOCKREL_OPCODE | LOCKREL_AFSID |
                              LOCKREL_TIMESTAMP);
        if (vcode) {
@@ -5097,7 +5189,7 @@ int
 UV_ChangeLocation(afs_uint32 server, afs_int32 part, afs_uint32 volid)
 {
     afs_int32 vcode;
-    struct nvldbentry entry, storeEntry;
+    struct uvldbentry entry, storeEntry;
     int index;
 
     vcode = ubik_VL_SetLock(cstruct, 0, volid, RWVOL, VLOP_ADDSITE);
@@ -5107,7 +5199,7 @@ UV_ChangeLocation(afs_uint32 server, afs_int32 part, afs_uint32 volid)
        PrintError("", vcode);
        return (vcode);
     }
-    vcode = VLDB_GetEntryByID(volid, RWVOL, &entry);
+    vcode = VLDB_GetEntryByIDU(volid, RWVOL, &entry);
     if (vcode) {
        fprintf(STDERR,
                "Could not fetch the entry for volume number %lu from VLDB \n",
@@ -5115,8 +5207,8 @@ UV_ChangeLocation(afs_uint32 server, afs_int32 part, afs_uint32 volid)
        PrintError("", vcode);
        return (vcode);
     }
-    MapHostToNetwork(&entry);
-    index = Lp_GetRwIndex(&entry);
+    MapHostToNetworkU(&entry);
+    index = Lp_GetRwIndexU(&entry);
     if (index < 0) {
        /* no RW site exists  */
        fprintf(STDERR, "No existing RW site for volume %lu",
@@ -5133,11 +5225,11 @@ UV_ChangeLocation(afs_uint32 server, afs_int32 part, afs_uint32 volid)
        }
        return VOLSERBADOP;
     } else {                   /* change the RW site */
-       entry.serverNumber[index] = server;
+       entry.serverUnique[index] = server;
        entry.serverPartition[index] = part;
-       MapNetworkToHost(&entry, &storeEntry);
+       MapNetworkToHostU(&entry, &storeEntry);
        vcode =
-           VLDB_ReplaceEntry(volid, RWVOL, &storeEntry,
+           VLDB_ReplaceEntryU(volid, RWVOL, &storeEntry,
                              LOCKREL_OPCODE | LOCKREL_AFSID |
                              LOCKREL_TIMESTAMP);
        if (vcode) {
@@ -5587,12 +5679,12 @@ UV_XListOneVolume(afs_uint32 a_serverID, afs_int32 a_partID, afs_uint32 a_volID,
 static afs_int32
 CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
            afs_int32 * modentry, afs_uint32 * maxvolid,
-            struct nvldbentry *aentry)
+            struct uvldbentry *aentry)
 {
     int idx = 0;
     int j;
     afs_int32 code, error = 0;
-    struct nvldbentry entry, storeEntry;
+    struct uvldbentry entry, storeEntry;
     char pname[10];
     int pass = 0, createentry, addvolume, modified, mod, doit = 1;
     afs_uint32 rwvolid;
@@ -5629,7 +5721,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
        memcpy(&entry, aentry, sizeof(entry));
     } else {
        /* Read the entry from VLDB by its RW volume id */
-       code = VLDB_GetEntryByID(rwvolid, RWVOL, &entry);
+       code = VLDB_GetEntryByIDU(rwvolid, RWVOL, &entry);
        if (code) {
            if (code != VL_NOENT) {
                fprintf(STDOUT,
@@ -5643,7 +5735,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
 
            createentry = 1;
        } else {
-           MapHostToNetwork(&entry);
+           MapHostToNetworkU(&entry);
        }
     }
 
@@ -5655,7 +5747,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
        } else {
            if ((entry.flags & RW_EXISTS) || (entry.flags & RO_EXISTS)
                || (entry.flags & BACK_EXISTS))
-               EnumerateEntry(&entry);
+               EnumerateEntryU(&entry);
        }
        fprintf(STDOUT, "\n");
     }
@@ -5673,14 +5765,14 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
            if (mod)
                modified++;
 
-           idx = Lp_GetRwIndex(&entry);
+           idx = Lp_GetRwIndexU(&entry);
            if (idx == -1) {    /* RW index not found in the VLDB entry */
                idx = entry.nServers;   /* put it into next index */
                entry.nServers++;
                addvolume++;
            } else {            /* RW index found in the VLDB entry. */
                /* Verify if this volume's location matches where the VLDB says it is */
-               if (!Lp_Match(aserver, apart, &entry)) {
+               if (!Lp_MatchU(aserver, apart, &entry)) {
                    if (entry.flags & RW_EXISTS) {
                        /* The RW volume exists elsewhere - report this one a duplicate */
                        if (pass == 1) {
@@ -5696,10 +5788,10 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
                            fprintf(STDERR,
                                    "    VLDB reports RW volume %lu exists on %s %s\n",
                                    (unsigned long)rwvolid,
-                                    noresolve ?
-                                    afs_inet_ntoa_r(entry.serverNumber[idx], hoststr) :
+                                    noresolve ? 
+                                    afs_inet_ntoa_r(entry.serverUnique[idx], hoststr) :
                                    hostutil_GetNameByINet(entry.
-                                                          serverNumber[idx]),
+                                                          serverUnique[idx]),
                                    pname);
                        }
                    } else {
@@ -5715,9 +5807,9 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
                                        "*** Warning: Orphaned BK volume %u exists on %s %s\n",
                                        entry.volumeId[BACKVOL],
                                         noresolve ?
-                                        afs_inet_ntoa_r(entry.serverNumber[idx], hoststr) :
+                                        afs_inet_ntoa_r(entry.serverUnique[idx], hoststr) :
                                        hostutil_GetNameByINet(entry.
-                                                              serverNumber
+                                                              serverUnique
                                                               [idx]), pname);
                                MapPartIdIntoName(apart, pname);
                                fprintf(STDERR,
@@ -5753,7 +5845,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
                entry.volumeId[ROVOL] = volumeinfo->cloneID;
 
            entry.serverFlags[idx] = ITSRWVOL;
-           entry.serverNumber[idx] = aserver;
+           entry.serverUnique[idx] = aserver;
            entry.serverPartition[idx] = apart;
            strncpy(entry.name, volumeinfo->name, VOLSER_OLDMAXVOLNAME);
 
@@ -5781,14 +5873,14 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
            if (mod)
                modified++;
 
-           idx = Lp_GetRwIndex(&entry);
+           idx = Lp_GetRwIndexU(&entry);
            if (idx == -1) {    /* RW index not found in the VLDB entry */
                idx = entry.nServers;   /* Put it into next index */
                entry.nServers++;
                addvolume++;
            } else {            /* RW index found in the VLDB entry */
                /* Verify if this volume's location matches where the VLDB says it is */
-               if (!Lp_Match(aserver, apart, &entry)) {
+               if (!Lp_MatchU(aserver, apart, &entry)) {
                    /* VLDB says RW and/or BK is elsewhere - report this BK volume orphaned */
                    if (pass == 1) {
                        MapPartIdIntoName(apart, pname);
@@ -5803,9 +5895,9 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
                                "    VLDB reports its RW/BK volume %lu exists on %s %s\n",
                                (unsigned long)rwvolid,
                                 noresolve ?
-                                afs_inet_ntoa_r(entry.serverNumber[idx], hoststr) :
+                                afs_inet_ntoa_r(entry.serverUnique[idx], hoststr) :
                                hostutil_GetNameByINet(entry.
-                                                      serverNumber[idx]),
+                                                      serverUnique[idx]),
                                pname);
                    }
                } else {
@@ -5857,7 +5949,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
            entry.volumeId[RWVOL] = rwvolid;
            entry.volumeId[BACKVOL] = volumeinfo->volid;
 
-           entry.serverNumber[idx] = aserver;
+           entry.serverUnique[idx] = aserver;
            entry.serverPartition[idx] = apart;
            entry.serverFlags[idx] = ITSBACKVOL;
 
@@ -5871,7 +5963,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
             * VLDB so we avoid the CheckVldbRO() call (which checks if each
             * RO volume listed in the VLDB exists).
             */
-           idx = Lp_ROMatch(aserver, apart, &entry) - 1;
+           idx = Lp_ROMatchU(aserver, apart, &entry) - 1;
            if (idx == -1) {
                idx = entry.nServers;
                entry.nServers++;
@@ -5910,16 +6002,16 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
                                    "*** Warning: Orphaned RO volume %u exists on %s %s\n",
                                    entry.volumeId[ROVOL],
                                     noresolve ?
-                                    afs_inet_ntoa_r(entry.serverNumber[j], hoststr) :
+                                    afs_inet_ntoa_r(entry.serverUnique[j], hoststr) :
                                     hostutil_GetNameByINet(entry.
-                                                          serverNumber[j]),
+                                                          serverUnique[j]),
                                    pname);
                            fprintf(STDERR,
                                    "    VLDB reports its RO volume ID is %lu\n",
                                    (unsigned long)volumeinfo->volid);
                        }
 
-                       Lp_SetRWValue(&entry, entry.serverNumber[idx],
+                       Lp_SetRWValueU(&entry, entry.serverUnique[idx],
                                      entry.serverPartition[idx], 0L, 0L);
                        entry.nServers--;
                        modified++;
@@ -5951,7 +6043,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
                 * and there exist RO volumes in the VLDB entry. See if any of them
                 * are this one. If not, then we add it.
                 */
-               idx = Lp_ROMatch(aserver, apart, &entry) - 1;
+               idx = Lp_ROMatchU(aserver, apart, &entry) - 1;
                if (idx == -1) {
                    idx = entry.nServers;
                    entry.nServers++;
@@ -5965,7 +6057,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
            entry.volumeId[RWVOL] = rwvolid;
            entry.volumeId[ROVOL] = volumeinfo->volid;
 
-           entry.serverNumber[idx] = aserver;
+           entry.serverUnique[idx] = aserver;
            entry.serverPartition[idx] = apart;
            entry.serverFlags[idx] = ITSROVOL;
 
@@ -5982,10 +6074,10 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
        *maxvolid = entry.volumeId[RWVOL];
 
     if (modified && doit) {
-       MapNetworkToHost(&entry, &storeEntry);
+       MapNetworkToHostU(&entry, &storeEntry);
 
        if (createentry) {
-           code = VLDB_CreateEntry(&storeEntry);
+           code = VLDB_CreateEntryU(&storeEntry);
            if (code) {
                fprintf(STDOUT,
                        "Could not create a VLDB entry for the volume %lu\n",
@@ -5996,7 +6088,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
            if (pass == 1)
                goto retry;
            code =
-               VLDB_ReplaceEntry(rwvolid, RWVOL, &storeEntry,
+               VLDB_ReplaceEntryU(rwvolid, RWVOL, &storeEntry,
                                  LOCKREL_OPCODE | LOCKREL_AFSID |
                                  LOCKREL_TIMESTAMP);
            if (code) {
@@ -6025,7 +6117,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
     if (verbose) {
        fprintf(STDOUT, "-- status after --\n");
        if (modified)
-           EnumerateEntry(&entry);
+           EnumerateEntryU(&entry);
        else
            fprintf(STDOUT, "\n**no change**\n");
     }
@@ -6035,7 +6127,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
     return (error);
 }
 
-int
+static int
 sortVolumes(const void *a, const void *b)
 {
     volintInfo *v1 = (volintInfo *) a;
@@ -6080,7 +6172,7 @@ UV_SyncVolume(afs_uint32 aserver, afs_int32 apart, char *avolname, int flags)
     afs_int32 j, k, code, vcode, error = 0;
     afs_int32 tverbose;
     afs_int32 mod, modified = 0, deleted = 0;
-    struct nvldbentry vldbentry;
+    struct uvldbentry vldbentry;
     afs_uint32 volumeid = 0;
     volEntries volumeInfo;
     struct partList PartList;
@@ -6104,13 +6196,13 @@ UV_SyncVolume(afs_uint32 aserver, afs_int32 apart, char *avolname, int flags)
     }
 
     /* Read the VLDB entry */
-    vcode = VLDB_GetEntryByName(avolname, &vldbentry);
+    vcode = VLDB_GetEntryByNameU(avolname, &vldbentry);
     if (vcode && (vcode != VL_NOENT)) {
        fprintf(STDERR, "Could not access the VLDB for volume %s\n",
                avolname);
        ERROR_EXIT(vcode);
     } else if (!vcode) {
-       MapHostToNetwork(&vldbentry);
+       MapHostToNetworkU(&vldbentry);
     }
 
     if (tverbose) {
@@ -6122,7 +6214,7 @@ UV_SyncVolume(afs_uint32 aserver, afs_int32 apart, char *avolname, int flags)
        } else {
            if ((vldbentry.flags & RW_EXISTS) || (vldbentry.flags & RO_EXISTS)
                || (vldbentry.flags & BACK_EXISTS))
-               EnumerateEntry(&vldbentry);
+               EnumerateEntryU(&vldbentry);
        }
        fprintf(STDOUT, "\n");
     }
@@ -6245,7 +6337,7 @@ UV_SyncVolume(afs_uint32 aserver, afs_int32 apart, char *avolname, int flags)
        if (deleted) {
            fprintf(STDOUT, "\n**entry deleted**\n");
        } else if (modified) {
-           EnumerateEntry(&vldbentry);
+           EnumerateEntryU(&vldbentry);
        } else {
            fprintf(STDOUT, "\n**no change**\n");
        }
@@ -6450,7 +6542,7 @@ UV_SyncVldb(afs_uint32 aserver, afs_int32 apart, int flags, int force)
  *      Some error codes mean the volume is unavailable but
  *      still exists - so we catch these error codes.
  */
-afs_int32
+static afs_int32
 VolumeExists(afs_uint32 server, afs_int32 partition, afs_uint32 volumeid)
 {
     struct rx_connection *conn = (struct rx_connection *)0;
@@ -6474,8 +6566,8 @@ VolumeExists(afs_uint32 server, afs_int32 partition, afs_uint32 volumeid)
 /* CheckVldbRWBK()
  *
  */
-afs_int32
-CheckVldbRWBK(struct nvldbentry * entry, afs_int32 * modified)
+static afs_int32
+CheckVldbRWBK(struct uvldbentry * entry, afs_int32 * modified)
 {
     int modentry = 0;
     int idx;
@@ -6485,7 +6577,7 @@ CheckVldbRWBK(struct nvldbentry * entry, afs_int32 * modified)
 
     if (modified)
        *modified = 0;
-    idx = Lp_GetRwIndex(entry);
+    idx = Lp_GetRwIndexU(entry);
 
     /* Check to see if the RW volume exists and set the RW_EXISTS
      * flag accordingly.
@@ -6497,7 +6589,7 @@ CheckVldbRWBK(struct nvldbentry * entry, afs_int32 * modified)
        }
     } else {
        code =
-           VolumeExists(entry->serverNumber[idx],
+           VolumeExists(entry->serverUnique[idx],
                         entry->serverPartition[idx], entry->volumeId[RWVOL]);
        if (code == 0) {        /* RW volume exists */
            if (!(entry->flags & RW_EXISTS)) {  /* ... yet entry says RW does not exist */
@@ -6517,8 +6609,8 @@ CheckVldbRWBK(struct nvldbentry * entry, afs_int32 * modified)
                        "Transaction call failed for RW volume %u on server %s %s\n",
                        entry->volumeId[RWVOL],
                         noresolve ?
-                        afs_inet_ntoa_r(entry->serverNumber[idx], hoststr) :
-                        hostutil_GetNameByINet(entry->serverNumber[idx]),
+                        afs_inet_ntoa_r(entry->serverUnique[idx], hoststr) :
+                        hostutil_GetNameByINet(entry->serverUnique[idx]),
                        pname);
                ERROR_EXIT(code);
            }
@@ -6535,7 +6627,7 @@ CheckVldbRWBK(struct nvldbentry * entry, afs_int32 * modified)
        }
     } else {                   /* Found a RW entry */
        code =
-           VolumeExists(entry->serverNumber[idx],
+           VolumeExists(entry->serverUnique[idx],
                         entry->serverPartition[idx],
                         entry->volumeId[BACKVOL]);
        if (code == 0) {        /* BK volume exists */
@@ -6556,8 +6648,8 @@ CheckVldbRWBK(struct nvldbentry * entry, afs_int32 * modified)
                        "Transaction call failed for BK volume %u on server %s %s\n",
                        entry->volumeId[BACKVOL],
                         noresolve ?
-                        afs_inet_ntoa_r(entry->serverNumber[idx], hoststr) :
-                        hostutil_GetNameByINet(entry->serverNumber[idx]),
+                        afs_inet_ntoa_r(entry->serverUnique[idx], hoststr) :
+                        hostutil_GetNameByINet(entry->serverUnique[idx]),
                        pname);
                ERROR_EXIT(code);
            }
@@ -6569,7 +6661,7 @@ CheckVldbRWBK(struct nvldbentry * entry, afs_int32 * modified)
      */
     if ((idx != -1) && !(entry->flags & RW_EXISTS)
        && !(entry->flags & BACK_EXISTS)) {
-       Lp_SetRWValue(entry, entry->serverNumber[idx],
+       Lp_SetRWValueU(entry, entry->serverUnique[idx],
                      entry->serverPartition[idx], 0L, 0L);
        entry->nServers--;
        modentry++;
@@ -6581,8 +6673,8 @@ CheckVldbRWBK(struct nvldbentry * entry, afs_int32 * modified)
     return (error);
 }
 
-int
-CheckVldbRO(struct nvldbentry *entry, afs_int32 * modified)
+static int
+CheckVldbRO(struct uvldbentry *entry, afs_int32 * modified)
 {
     int idx;
     int foundro = 0, modentry = 0;
@@ -6602,12 +6694,12 @@ CheckVldbRO(struct nvldbentry *entry, afs_int32 * modified)
        }
 
        code =
-           VolumeExists(entry->serverNumber[idx],
+           VolumeExists(entry->serverUnique[idx],
                         entry->serverPartition[idx], entry->volumeId[ROVOL]);
        if (code == 0) {        /* RO volume exists */
            foundro++;
        } else if (code == ENODEV) {    /* RW volume does not exist */
-           Lp_SetROValue(entry, entry->serverNumber[idx],
+           Lp_SetROValueU(entry, entry->serverUnique[idx],
                          entry->serverPartition[idx], 0L, 0L);
            entry->nServers--;
            idx--;
@@ -6618,8 +6710,8 @@ CheckVldbRO(struct nvldbentry *entry, afs_int32 * modified)
                    "Transaction call failed for RO %u on server %s %s\n",
                    entry->volumeId[ROVOL],
                     noresolve ?
-                    afs_inet_ntoa_r(entry->serverNumber[idx], hoststr) :
-                    hostutil_GetNameByINet(entry->serverNumber[idx]), pname);
+                    afs_inet_ntoa_r(entry->serverUnique[idx], hoststr) :
+                    hostutil_GetNameByINet(entry->serverUnique[idx]), pname);
            ERROR_EXIT(code);
        }
     }
@@ -6645,11 +6737,11 @@ CheckVldbRO(struct nvldbentry *entry, afs_int32 * modified)
 /* CheckVldb()
  *      Ensure that <entry> matches with the info on file servers
  */
-afs_int32
-CheckVldb(struct nvldbentry * entry, afs_int32 * modified, afs_int32 * deleted)
+static afs_int32
+CheckVldb(struct uvldbentry * entry, afs_int32 * modified, afs_int32 * deleted)
 {
     afs_int32 code, error = 0;
-    struct nvldbentry storeEntry;
+    struct uvldbentry storeEntry;
     int islocked = 0, mod, modentry, delentry = 0;
     int pass = 0, doit=1;
 
@@ -6663,7 +6755,7 @@ CheckVldb(struct nvldbentry * entry, afs_int32 * modified, afs_int32 * deleted)
        fprintf(STDOUT, "\n-- status before -- \n");
        if ((entry->flags & RW_EXISTS) || (entry->flags & RO_EXISTS)
            || (entry->flags & BACK_EXISTS))
-           EnumerateEntry(entry);
+           EnumerateEntryU(entry);
        fprintf(STDOUT, "\n");
     }
 
@@ -6688,13 +6780,13 @@ CheckVldb(struct nvldbentry * entry, afs_int32 * modified, afs_int32 * deleted)
        }
        islocked = 1;
 
-       code = VLDB_GetEntryByID(entry->volumeId[RWVOL], RWVOL, entry);
+       code = VLDB_GetEntryByIDU(entry->volumeId[RWVOL], RWVOL, entry);
        if (code) {
            fprintf(STDERR, "Could not read VLDB entry for volume %s\n",
                    entry->name);
            ERROR_EXIT(code);
        } else {
-           MapHostToNetwork(entry);
+           MapHostToNetworkU(entry);
        }
     }
 
@@ -6740,9 +6832,9 @@ CheckVldb(struct nvldbentry * entry, afs_int32 * modified, afs_int32 * deleted)
            delentry = 1;
        } else {
            /* Replace old entry with our new one */
-           MapNetworkToHost(entry, &storeEntry);
+           MapNetworkToHostU(entry, &storeEntry);
            code =
-               VLDB_ReplaceEntry(entry->volumeId[RWVOL], RWVOL, &storeEntry,
+               VLDB_ReplaceEntryU(entry->volumeId[RWVOL], RWVOL, &storeEntry,
                                  (LOCKREL_OPCODE | LOCKREL_AFSID |
                                   LOCKREL_TIMESTAMP));
            if (code) {
@@ -6766,7 +6858,7 @@ CheckVldb(struct nvldbentry * entry, afs_int32 * modified, afs_int32 * deleted)
        if (delentry)
            fprintf(STDOUT, "\n**entry deleted**\n");
        else if (modentry)
-           EnumerateEntry(entry);
+           EnumerateEntryU(entry);
        else
            fprintf(STDOUT, "\n**no change**\n");
     }
@@ -6800,9 +6892,9 @@ UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force)
     afs_int32 code, error = 0;
     afs_int32 nentries, tentries = 0;
     struct VldbListByAttributes attributes;
-    nbulkentries arrayEntries;
+    ubulkentries arrayEntries;
     afs_int32 failures = 0, modified, modifications = 0;
-    struct nvldbentry *vlentry;
+    struct uvldbentry *vlentry;
     afs_int32 si, nsi, j;
 
     if (flags & 2)
@@ -6826,10 +6918,10 @@ UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force)
 
        /* Collect set of VLDB entries */
        code =
-           VLDB_ListAttributesN2(&attributes, 0, si, &nentries,
+           VLDB_ListAttributesN2U(&attributes, 0, si, &nentries,
                                  &arrayEntries, &nsi);
        if (code == RXGEN_OPCODE) {
-           code = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries);
+           code = VLDB_ListAttributesU(&attributes, &nentries, &arrayEntries);
            nsi = -1;
        }
        if (code) {
@@ -6839,8 +6931,8 @@ UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force)
        tentries += nentries;
 
        for (j = 0; j < nentries; j++) {
-           vlentry = &arrayEntries.nbulkentries_val[j];
-           MapHostToNetwork(vlentry);
+           vlentry = &arrayEntries.ubulkentries_val[j];
+           MapHostToNetworkU(vlentry);
 
            VPRINT1("Processing VLDB entry %d ...\n", j + 1);
 
@@ -6869,9 +6961,9 @@ UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force)
            }
        }
 
-       if (arrayEntries.nbulkentries_val) {
-           free(arrayEntries.nbulkentries_val);
-           arrayEntries.nbulkentries_val = 0;
+       if (arrayEntries.ubulkentries_val) {
+           free(arrayEntries.ubulkentries_val);
+           arrayEntries.ubulkentries_val = 0;
        }
     }
 
@@ -6886,8 +6978,8 @@ UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force)
   error_exit:
     if (aconn)
        rx_DestroyConnection(aconn);
-    if (arrayEntries.nbulkentries_val)
-       free(arrayEntries.nbulkentries_val);
+    if (arrayEntries.ubulkentries_val)
+       free(arrayEntries.ubulkentries_val);
 
     if (failures)
        error = VOLSERFAILEDOP;
@@ -6897,11 +6989,26 @@ UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force)
 /*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 */
+ *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(struct nvldbentry *entryp, char oldname[], char newname[])
+{
+    struct uvldbentry uentry;
+    int error;
+
+    nvlentry_to_uvlentry(entryp, &uentry);
+    error = UV_RenameVolumeU(&uentry, oldname, newname);
+    if (!error)
+        error = uvlentry_to_nvlentry(&uentry, entryp);
+
+    return error;
+}
+
 int
-UV_RenameVolume(struct nvldbentry *entry, char oldname[], char newname[])
+UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[])
 {
-    struct nvldbentry storeEntry;
+    struct uvldbentry storeEntry;
     afs_int32 vcode, code, rcode, error;
     int i, index;
     char nameBuffer[256];
@@ -6925,8 +7032,8 @@ UV_RenameVolume(struct nvldbentry *entry, char oldname[], char newname[])
     }
     islocked = 1;
     strncpy(entry->name, newname, VOLSER_OLDMAXVOLNAME);
-    MapNetworkToHost(entry, &storeEntry);
-    vcode = VLDB_ReplaceEntry(entry->volumeId[RWVOL], RWVOL, &storeEntry, 0);
+    MapNetworkToHostU(entry, &storeEntry);
+    vcode = VLDB_ReplaceEntryU(entry->volumeId[RWVOL], RWVOL, &storeEntry, 0);
     if (vcode) {
        fprintf(STDERR, "Could not update VLDB entry for %u\n",
                entry->volumeId[RWVOL]);
@@ -6937,7 +7044,7 @@ UV_RenameVolume(struct nvldbentry *entry, char oldname[], char newname[])
     /*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) {
-       index = Lp_GetRwIndex(entry);
+       index = Lp_GetRwIndexU(entry);
        if (index == -1) {      /* there is a serious discrepancy */
            fprintf(STDERR,
                    "There is a serious discrepancy in VLDB entry for volume %u\n",
@@ -6946,7 +7053,7 @@ UV_RenameVolume(struct nvldbentry *entry, char oldname[], char newname[])
            error = VOLSERVLDB_ERROR;
            goto rvfail;
        }
-       aconn = UV_Bind(entry->serverNumber[index], AFSCONF_VOLUMEPORT);
+       aconn = UV_Bind(entry->serverUnique[index], AFSCONF_VOLUMEPORT);
        code =
            AFSVolTransCreate_retry(aconn, entry->volumeId[RWVOL],
                              entry->serverPartition[index], ITOffline, &tid);
@@ -6987,7 +7094,7 @@ UV_RenameVolume(struct nvldbentry *entry, char oldname[], char newname[])
     }
     /*end rw volume processing */
     if (entry->flags & BACK_EXISTS) {  /*process the backup volume */
-       index = Lp_GetRwIndex(entry);
+       index = Lp_GetRwIndexU(entry);
        if (index == -1) {      /* there is a serious discrepancy */
            fprintf(STDERR,
                    "There is a serious discrepancy in the VLDB entry for the backup volume %u\n",
@@ -6996,7 +7103,7 @@ UV_RenameVolume(struct nvldbentry *entry, char oldname[], char newname[])
            error = VOLSERVLDB_ERROR;
            goto rvfail;
        }
-       aconn = UV_Bind(entry->serverNumber[index], AFSCONF_VOLUMEPORT);
+       aconn = UV_Bind(entry->serverUnique[index], AFSCONF_VOLUMEPORT);
        code =
            AFSVolTransCreate_retry(aconn, entry->volumeId[BACKVOL],
                              entry->serverPartition[index], ITOffline, &tid);
@@ -7046,7 +7153,7 @@ UV_RenameVolume(struct nvldbentry *entry, char oldname[], char newname[])
     if (entry->flags & RO_EXISTS) {    /*process the ro volumes */
        for (i = 0; i < entry->nServers; i++) {
            if (entry->serverFlags[i] & ITSROVOL) {
-               aconn = UV_Bind(entry->serverNumber[i], AFSCONF_VOLUMEPORT);
+               aconn = UV_Bind(entry->serverUnique[i], AFSCONF_VOLUMEPORT);
                code =
                    AFSVolTransCreate_retry(aconn, entry->volumeId[ROVOL],
                                      entry->serverPartition[i], ITOffline,
@@ -7074,9 +7181,9 @@ UV_RenameVolume(struct nvldbentry *entry, char oldname[], char newname[])
                        VPRINT2("Renamed RO volume %s on host %s\n",
                                nameBuffer,
                                 noresolve ?
-                                afs_inet_ntoa_r(entry->serverNumber[i], hoststr) :
+                                afs_inet_ntoa_r(entry->serverUnique[i], hoststr) :
                                 hostutil_GetNameByINet(entry->
-                                                      serverNumber[i]));
+                                                      serverUnique[i]));
                        code = AFSVolEndTrans(aconn, tid, &rcode);
                        tid = 0;
                        if (code) {
@@ -7128,7 +7235,6 @@ UV_RenameVolume(struct nvldbentry *entry, char oldname[], char newname[])
        rx_DestroyConnection(aconn);
     PrintError("", error);
     return error;
-
 }
 
 /*report on all the active transactions on volser */
@@ -7352,6 +7458,30 @@ UV_GetSize(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
 /*maps the host addresses in <old > (present in network byte order) to
  that in< new> (present in host byte order )*/
 void
+MapNetworkToHostU(struct uvldbentry *old, struct uvldbentry *new)
+{
+    int i, count;
+
+    /*copy all the fields */
+    strcpy(new->name, old->name);
+/*    new->volumeType = old->volumeType;*/
+    new->nServers = old->nServers;
+    count = old->nServers;
+    if (count < NMAXNSERVERS)
+       count++;
+    for (i = 0; i < count; i++) {
+       new->serverUnique[i] = ntohl(old->serverUnique[i]);
+       new->serverPartition[i] = old->serverPartition[i];
+       new->serverFlags[i] = old->serverFlags[i];
+    }
+    new->volumeId[RWVOL] = old->volumeId[RWVOL];
+    new->volumeId[ROVOL] = old->volumeId[ROVOL];
+    new->volumeId[BACKVOL] = old->volumeId[BACKVOL];
+    new->cloneId = old->cloneId;
+    new->flags = old->flags;
+}
+
+void
 MapNetworkToHost(struct nvldbentry *old, struct nvldbentry *new)
 {
     int i, count;
@@ -7377,6 +7507,19 @@ MapNetworkToHost(struct nvldbentry *old, struct nvldbentry *new)
 
 /*maps the host entries in <entry> which are present in host byte order to network byte order */
 void
+MapHostToNetworkU(struct uvldbentry *entry)
+{
+    int i, count;
+
+    count = entry->nServers;
+    if (count < NMAXNSERVERS)
+       count++;
+    for (i = 0; i < count; i++) {
+       entry->serverUnique[i] = htonl(entry->serverUnique[i]);
+    }
+}
+
+void
 MapHostToNetwork(struct nvldbentry *entry)
 {
     int i, count;
@@ -7388,3 +7531,4 @@ MapHostToNetwork(struct nvldbentry *entry)
        entry->serverNumber[i] = htonl(entry->serverNumber[i]);
     }
 }
+
index 7ced576..3a3092a 100644 (file)
@@ -60,7 +60,16 @@ ovlentry_to_nvlentry(struct vldbentry *oentryp,
     memset(nentryp, 0, sizeof(struct nvldbentry));
     strncpy(nentryp->name, oentryp->name, sizeof(nentryp->name));
     for (i = 0; i < oentryp->nServers; i++) {
-       nentryp->serverNumber[i] = oentryp->serverNumber[i];
+        bulkaddrs m_addrs;
+        ListAddrByAttributes m_attrs;
+        afs_int32 m_nentries;
+
+        m_attrs.Mask = VLADDR_IPADDR;
+        m_attrs.ipaddr = oentryp->serverNumber[i];
+        m_nentries = 0;
+        m_addrs.bulkaddrs_val = 0;
+        m_addrs.bulkaddrs_len = 0;
+        nentryp->serverNumber[i] = oentryp->serverNumber[i];
        nentryp->serverPartition[i] = oentryp->serverPartition[i];
        nentryp->serverFlags[i] = oentryp->serverFlags[i];
     }
@@ -71,6 +80,8 @@ ovlentry_to_nvlentry(struct vldbentry *oentryp,
     nentryp->flags = oentryp->flags;
 }
 
+#if 0
+/* It is here for when we need it.  Not currently used. */
 static int
 nvlentry_to_ovlentry(struct nvldbentry *nentryp,
                      struct vldbentry *oentryp)
@@ -98,31 +109,181 @@ nvlentry_to_ovlentry(struct nvldbentry *nentryp,
     oentryp->flags = nentryp->flags;
     return 0;
 }
+#endif
+
+static void
+ovlentry_to_uvlentry(struct vldbentry *oentryp,
+                     struct uvldbentry *uentryp)
+{
+    int i;
+
+    memset(uentryp, 0, sizeof(struct uvldbentry));
+    strncpy(uentryp->name, oentryp->name, sizeof(uentryp->name));
+    for (i = 0; i < oentryp->nServers; i++) {
+        afs_int32 vcode, m_uniq=0;
+        bulkaddrs m_addrs;
+        ListAddrByAttributes m_attrs;
+        afs_int32 m_nentries;
+
+        m_attrs.Mask = VLADDR_IPADDR;
+        m_attrs.ipaddr = oentryp->serverNumber[i];
+        m_nentries = 0;
+        m_addrs.bulkaddrs_val = 0;
+        m_addrs.bulkaddrs_len = 0;
+        vcode =
+            ubik_VL_GetAddrsU(cstruct, 0, &m_attrs,
+                               &uentryp->serverNumber[i],
+                               &m_uniq, &m_nentries,
+                               &m_addrs);
+        uentryp->serverUnique[i] = oentryp->serverNumber[i];
+       uentryp->serverPartition[i] = oentryp->serverPartition[i];
+       uentryp->serverFlags[i] = oentryp->serverFlags[i];
+    }
+    uentryp->nServers = oentryp->nServers;
+    for (i = 0; i < MAXTYPES; i++)
+       uentryp->volumeId[i] = oentryp->volumeId[i];
+    uentryp->cloneId = oentryp->cloneId;
+    uentryp->flags = oentryp->flags;
+}
+
+static int
+uvlentry_to_ovlentry(struct uvldbentry *uentryp,
+                     struct vldbentry *oentryp)
+{
+    int i;
+
+    memset(oentryp, 0, sizeof(struct vldbentry));
+    strncpy(oentryp->name, uentryp->name, sizeof(oentryp->name));
+    if (uentryp->nServers > OMAXNSERVERS) {
+       /*
+        * The alternative is to store OMAXSERVERS but it's always better
+        * to know what's going on...
+        */
+       return VL_BADSERVER;
+    }
+    for (i = 0; i < uentryp->nServers; i++) {
+       oentryp->serverNumber[i] = uentryp->serverUnique[i];
+       oentryp->serverPartition[i] = uentryp->serverPartition[i];
+       oentryp->serverFlags[i] = uentryp->serverFlags[i];
+    }
+    oentryp->nServers = i;
+    for (i = 0; i < MAXTYPES; i++)
+       oentryp->volumeId[i] = uentryp->volumeId[i];
+    oentryp->cloneId = uentryp->cloneId;
+    oentryp->flags = uentryp->flags;
+    return 0;
+}
+
+void
+nvlentry_to_uvlentry(struct nvldbentry *nentryp,
+                     struct uvldbentry *uentryp)
+{
+    int i;
 
-static int newvlserver = 0;
+    memset(uentryp, 0, sizeof(struct uvldbentry));
+    strncpy(uentryp->name, nentryp->name, sizeof(uentryp->name));
+    for (i = 0; i < nentryp->nServers; i++) {
+        afs_int32 vcode, m_uniq=0;
+        bulkaddrs m_addrs;
+        ListAddrByAttributes m_attrs;
+        afs_int32 m_nentries;
+
+        m_attrs.Mask = VLADDR_IPADDR;
+        m_attrs.ipaddr = nentryp->serverNumber[i];
+        m_nentries = 0;
+        m_addrs.bulkaddrs_val = 0;
+        m_addrs.bulkaddrs_len = 0;
+        vcode =
+            ubik_VL_GetAddrsU(cstruct, 0, &m_attrs,
+                               &uentryp->serverNumber[i],
+                               &m_uniq, &m_nentries,
+                               &m_addrs);
+       uentryp->serverUnique[i] = nentryp->serverNumber[i];
+       uentryp->serverPartition[i] = nentryp->serverPartition[i];
+       uentryp->serverFlags[i] = nentryp->serverFlags[i];
+    }
+    uentryp->nServers = nentryp->nServers;
+    for (i = 0; i < MAXTYPES; i++)
+       uentryp->volumeId[i] = nentryp->volumeId[i];
+    uentryp->cloneId = nentryp->cloneId;
+    uentryp->flags = nentryp->flags;
+    uentryp->matchindex = nentryp->matchindex;
+}
+
+int
+uvlentry_to_nvlentry(struct uvldbentry *uentryp,
+                     struct nvldbentry *nentryp)
+{
+    int i;
+
+    memset(nentryp, 0, sizeof(struct vldbentry));
+    strncpy(nentryp->name, uentryp->name, sizeof(nentryp->name));
+    if (uentryp->nServers > NMAXNSERVERS) {
+       /*
+        * The alternative is to store NMAXSERVERS but it's always better
+        * to know what's going on...
+        */
+       return VL_BADSERVER;
+    }
+    for (i = 0; i < uentryp->nServers; i++) {
+       nentryp->serverNumber[i] = uentryp->serverUnique[i];
+       nentryp->serverPartition[i] = uentryp->serverPartition[i];
+       nentryp->serverFlags[i] = uentryp->serverFlags[i];
+    }
+    nentryp->nServers = i;
+    for (i = 0; i < MAXTYPES; i++)
+       nentryp->volumeId[i] = uentryp->volumeId[i];
+    nentryp->cloneId = uentryp->cloneId;
+    nentryp->flags = uentryp->flags;
+    nentryp->matchindex = uentryp->matchindex;
+    return 0;
+}
+
+enum _vlserver_type {
+    vltype_unknown = 0,
+    vltype_old = 1,
+    vltype_new = 2,
+    vltype_uuid = 3
+};
+
+static enum _vlserver_type newvlserver = vltype_unknown;
 
 int
 VLDB_CreateEntry(struct nvldbentry *entryp)
 {
-    struct vldbentry oentry;
     int code;
+    struct uvldbentry uentry;
 
-    if (newvlserver == 1) {
+    nvlentry_to_uvlentry(entryp, &uentry);
+    code = VLDB_CreateEntryU(&uentry);
+    if (!code)
+        code = uvlentry_to_nvlentry(&uentry, entryp);
+    return code;
+}
+
+int
+VLDB_CreateEntryU(struct uvldbentry *entryp)
+{
+    struct nvldbentry nentry;
+    int code;
+
+    if (newvlserver == vltype_old) {
+        struct vldbentry oentry;
       tryold:
-       code = nvlentry_to_ovlentry(entryp, &oentry);
+       code = uvlentry_to_ovlentry(entryp, &oentry);
        if (code)
            return code;
        code = ubik_VL_CreateEntry(cstruct, 0, &oentry);
        return code;
     }
-    code = ubik_VL_CreateEntryN(cstruct, 0, entryp);
-    if (!newvlserver) {
-       if (code == RXGEN_OPCODE) {
-           newvlserver = 1;    /* Doesn't support new interface */
-           goto tryold;
-       } else if (!code) {
-           newvlserver = 2;
-       }
+
+    code = uvlentry_to_nvlentry(entryp, &nentry);
+    if (code)
+        return code;
+    code = ubik_VL_CreateEntryN(cstruct, 0, &nentry);
+    if (code == RXGEN_OPCODE) {
+        newvlserver = vltype_old;
+        goto tryold;
     }
     return code;
 }
@@ -130,80 +291,128 @@ VLDB_CreateEntry(struct nvldbentry *entryp)
 int
 VLDB_GetEntryByID(afs_uint32 volid, afs_int32 voltype, struct nvldbentry *entryp)
 {
-    struct vldbentry oentry;
+    int code;
+    struct uvldbentry uentry;
+
+    nvlentry_to_uvlentry(entryp, &uentry);
+    code = VLDB_GetEntryByIDU(volid, voltype, &uentry);
+    if (!code)
+        code = uvlentry_to_nvlentry(&uentry, entryp);
+    return code;
+}
+
+int
+VLDB_GetEntryByIDU(afs_uint32 volid, afs_int32 voltype, struct uvldbentry *entryp)
+{
+    struct nvldbentry nentry;
     int code;
 
-    if (newvlserver == 1) {
+    if (newvlserver == vltype_old) {
+        struct vldbentry oentry;
       tryold:
        code =
            ubik_VL_GetEntryByID(cstruct, 0, volid, voltype, &oentry);
        if (!code)
-           ovlentry_to_nvlentry(&oentry, entryp);
+           ovlentry_to_uvlentry(&oentry, entryp);
        return code;
     }
-    code = ubik_VL_GetEntryByIDN(cstruct, 0, volid, voltype, entryp);
-    if (!newvlserver) {
-       if (code == RXGEN_OPCODE) {
-           newvlserver = 1;    /* Doesn't support new interface */
-           goto tryold;
-       } else if (!code) {
-           newvlserver = 2;
-       }
+
+    code = ubik_VL_GetEntryByIDN(cstruct, 0, volid, voltype, &nentry);
+    if (code == RXGEN_OPCODE) {
+        newvlserver = vltype_old;
+        goto tryold;
     }
+    if (!code)
+        nvlentry_to_uvlentry(&nentry, entryp);
     return code;
 }
 
 int
 VLDB_GetEntryByName(char *namep, struct nvldbentry *entryp)
 {
-    struct vldbentry oentry;
+    int code;
+    struct uvldbentry uentry;
+
+    nvlentry_to_uvlentry(entryp, &uentry);
+    code = VLDB_GetEntryByNameU(namep, &uentry);
+    if (!code)
+        code = uvlentry_to_nvlentry(&uentry, entryp);
+    return code;
+}
+
+int
+VLDB_GetEntryByNameU(char *namep, struct uvldbentry *entryp)
+{
     int code;
 
-    if (newvlserver == 1) {
+    if (newvlserver == vltype_old) {
+        struct vldbentry oentry;
       tryold:
        code = ubik_VL_GetEntryByNameO(cstruct, 0, namep, &oentry);
        if (!code)
-           ovlentry_to_nvlentry(&oentry, entryp);
+           ovlentry_to_uvlentry(&oentry, entryp);
        return code;
     }
-    code = ubik_VL_GetEntryByNameN(cstruct, 0, namep, entryp);
-    if (!newvlserver) {
+    if (newvlserver == vltype_new) {
+        struct nvldbentry nentry;
+      trynew:
+        code = ubik_VL_GetEntryByNameN(cstruct, 0, namep, &nentry);
+        if (code == RXGEN_OPCODE) {
+            newvlserver = vltype_old;
+            goto tryold;
+        }
+       if (!code)
+           nvlentry_to_uvlentry(&nentry, entryp);
+    }
+    code = ubik_VL_GetEntryByNameU(cstruct, 0, namep, entryp);
+    if (newvlserver == vltype_unknown) {
        if (code == RXGEN_OPCODE) {
-           newvlserver = 1;    /* Doesn't support new interface */
-           goto tryold;
+           newvlserver = vltype_new;
+           goto trynew;
        } else if (!code) {
-           newvlserver = 2;
+           newvlserver = vltype_uuid;
        }
     }
     return code;
 }
 
 int
-VLDB_ReplaceEntry(afs_uint32 volid, afs_int32 voltype, struct nvldbentry *entryp, afs_int32 releasetype)
+VLDB_ReplaceEntry(afs_uint32 volid, afs_int32 voltype, struct nvldbentry *nentryp, afs_int32 releasetype)
+{
+    struct uvldbentry uentry;
+    int code;
+
+    nvlentry_to_uvlentry(nentryp, &uentry);
+    code = VLDB_ReplaceEntryU(volid, voltype, &uentry, releasetype);
+    if (!code)
+        code = uvlentry_to_nvlentry(&uentry, nentryp);
+
+    return code;
+}
+
+int
+VLDB_ReplaceEntryU(afs_uint32 volid, afs_int32 voltype, struct uvldbentry *entryp, afs_int32 releasetype)
 {
-    struct vldbentry oentry;
     int code;
+    struct nvldbentry nentry;
 
-    if (newvlserver == 1) {
+    if (newvlserver == vltype_old) {
+        struct vldbentry oentry;
       tryold:
-       code = nvlentry_to_ovlentry(entryp, &oentry);
+       code = uvlentry_to_ovlentry(entryp, &oentry);
        if (code)
            return code;
        code =
-           ubik_VL_ReplaceEntry(cstruct, 0, volid, voltype, &oentry,
-                     releasetype);
+           ubik_VL_ReplaceEntry(cstruct, 0, volid, voltype, &oentry, releasetype);
        return code;
     }
-    code =
-       ubik_VL_ReplaceEntryN(cstruct, 0, volid, voltype, entryp,
-                 releasetype);
-    if (!newvlserver) {
-       if (code == RXGEN_OPCODE) {
-           newvlserver = 1;    /* Doesn't support new interface */
-           goto tryold;
-       } else if (!code) {
-           newvlserver = 2;
-       }
+    code = uvlentry_to_nvlentry(entryp, &nentry);
+    if (code)
+        return code;
+    code = ubik_VL_ReplaceEntryN(cstruct, 0, volid, voltype, &nentry, releasetype);
+    if (code == RXGEN_OPCODE) {
+        newvlserver = vltype_old;
+            goto tryold;
     }
     return code;
 }
@@ -214,10 +423,11 @@ VLDB_ListAttributes(VldbListByAttributes *attrp,
                     afs_int32 *entriesp,
                     nbulkentries *blkentriesp)
 {
-    bulkentries arrayEntries;
-    int code, i;
+    int code;
 
-    if (newvlserver == 1) {
+    if (newvlserver == vltype_old) {
+        int i;
+        bulkentries arrayEntries;
       tryold:
        memset(&arrayEntries, 0, sizeof(arrayEntries)); /*initialize to hint the stub  to alloc space */
        code =
@@ -225,27 +435,71 @@ VLDB_ListAttributes(VldbListByAttributes *attrp,
                      &arrayEntries);
        if (!code) {
            blkentriesp->nbulkentries_val =
-               (nvldbentry *) malloc(*entriesp * sizeof(struct nvldbentry));
+               (nvldbentry *) xdr_alloc(*entriesp * sizeof(struct nvldbentry));
            for (i = 0; i < *entriesp; i++) {   /* process each entry */
                ovlentry_to_nvlentry(&arrayEntries.bulkentries_val[i],
                                     &blkentriesp->nbulkentries_val[i]);
            }
        }
        if (arrayEntries.bulkentries_val)
-           free(arrayEntries.bulkentries_val);
+           xdr_free((xdrproc_t) xdr_bulkentries, &arrayEntries);
        return code;
     }
+
     code =
-       ubik_VL_ListAttributesN(cstruct, 0, attrp, entriesp,
-                 blkentriesp);
-    if (!newvlserver) {
-       if (code == RXGEN_OPCODE) {
-           newvlserver = 1;    /* Doesn't support new interface */
-           goto tryold;
-       } else if (!code) {
-           newvlserver = 2;
+        ubik_VL_ListAttributesN(cstruct, 0, attrp, entriesp, blkentriesp);
+    if (code == RXGEN_OPCODE) {
+        newvlserver = vltype_old;      /* Doesn't support new interface */
+        goto tryold;
+    }
+    return code;
+}
+
+int
+VLDB_ListAttributesU(VldbListByAttributes *attrp,
+                    afs_int32 *entriesp,
+                    ubulkentries *blkentriesp)
+{
+    nbulkentries narrayEntries;
+    int code, i;
+
+    if (newvlserver == vltype_old) {
+        bulkentries arrayEntries;
+      tryold:
+       memset(&arrayEntries, 0, sizeof(arrayEntries)); /*initialize to hint the stub  to alloc space */
+       code =
+           ubik_VL_ListAttributes(cstruct, 0, attrp, entriesp,
+                     &arrayEntries);
+       if (!code) {
+           blkentriesp->ubulkentries_val =
+               (uvldbentry *) xdr_alloc(*entriesp * sizeof(struct uvldbentry));
+           for (i = 0; i < *entriesp; i++) {   /* process each entry */
+               ovlentry_to_uvlentry(&arrayEntries.bulkentries_val[i],
+                                    &blkentriesp->ubulkentries_val[i]);
+           }
        }
+       if (arrayEntries.bulkentries_val)
+           xdr_free((xdrproc_t) xdr_bulkentries, &arrayEntries);
+       return code;
+    }
+
+    memset(&narrayEntries, 0, sizeof(narrayEntries));  /*initialize to hint the stub  to alloc space */
+    code =
+        ubik_VL_ListAttributesN(cstruct, 0, attrp, entriesp, &narrayEntries);
+    if (code == RXGEN_OPCODE) {
+        newvlserver = vltype_old;      /* Doesn't support new interface */
+        goto tryold;
+    }
+    if (!code) {
+        blkentriesp->ubulkentries_val =
+            (uvldbentry *) xdr_alloc(*entriesp * sizeof(struct uvldbentry));
+        for (i = 0; i < *entriesp; i++) {      /* process each entry */
+            nvlentry_to_uvlentry(&narrayEntries.nbulkentries_val[i],
+                                 &blkentriesp->ubulkentries_val[i]);
+        }
     }
+    if (narrayEntries.nbulkentries_val)
+        xdr_free((xdrproc_t) xdr_bulkentries, &narrayEntries);
     return code;
 }
 
@@ -257,16 +511,50 @@ VLDB_ListAttributesN2(VldbListByAttributes *attrp,
                       nbulkentries *blkentriesp,
                       afs_int32 *nextindexp)
 {
-    afs_int32 code;
+    afs_int32 code = RXGEN_OPCODE;
 
-    code =
-       ubik_VL_ListAttributesN2(cstruct, 0, attrp, (name ? name : ""),
-                 thisindex, nentriesp, blkentriesp, nextindexp);
+    if (newvlserver != vltype_old) {
+        code =
+            ubik_VL_ListAttributesN2(cstruct, 0, attrp, (name ? name : ""),
+                                     thisindex, nentriesp, blkentriesp, nextindexp);
+    }
+    return code;
+}
+
+int
+VLDB_ListAttributesN2U(VldbListByAttributes *attrp,
+                      char *name,
+                      afs_int32 thisindex,
+                      afs_int32 *nentriesp,
+                      ubulkentries *blkentriesp,
+                      afs_int32 *nextindexp)
+{
+    afs_int32 code = RXGEN_OPCODE;
+    int i;
+
+    if (newvlserver != vltype_old) {
+        nbulkentries narrayEntries;
+
+       memset(&narrayEntries, 0, sizeof(narrayEntries));       /*initialize to hint the stub  to alloc space */
+        code =
+            ubik_VL_ListAttributesN2(cstruct, 0, attrp, (name ? name : ""),
+                                     thisindex, nentriesp, &narrayEntries, nextindexp);
+        if (!code) {
+           blkentriesp->ubulkentries_val =
+               (uvldbentry *) xdr_alloc(*nentriesp * sizeof(struct uvldbentry));
+           for (i = 0; i < *nentriesp; i++) {  /* process each entry */
+               nvlentry_to_uvlentry(&narrayEntries.nbulkentries_val[i],
+                                    &blkentriesp->ubulkentries_val[i]);
+           }
+       }
+       if (narrayEntries.nbulkentries_val)
+           xdr_free((xdrproc_t) xdr_bulkentries, &narrayEntries);
+       return code;
+    }
     return code;
 }
 
 
-static int vlserverv4 = -1;
 struct cacheips {
     afs_uint32 server;
     afs_int32 count;
@@ -287,8 +575,8 @@ VLDB_IsSameAddrs(afs_uint32 serv1, afs_uint32 serv2, afs_int32 *errorp)
     int code;
     ListAddrByAttributes attrs;
     bulkaddrs addrs;
-    afs_uint32 *addrp, i, j, f1, f2;
-    afs_int32 unique, nentries;
+    afs_uint32 *addrp, f1, f2;
+    afs_int32 i, j, unique, nentries;
     afsUUID uuid;
     static int initcache = 0;
 
@@ -296,7 +584,8 @@ VLDB_IsSameAddrs(afs_uint32 serv1, afs_uint32 serv2, afs_int32 *errorp)
 
     if (serv1 == serv2)
        return 1;
-    if (vlserverv4 == 1) {
+    if (newvlserver == vltype_old ||
+        newvlserver == vltype_new) {
        return 0;
     }
     if (!initcache) {
@@ -332,12 +621,12 @@ VLDB_IsSameAddrs(afs_uint32 serv1, afs_uint32 serv2, afs_int32 *errorp)
     code =
        ubik_VL_GetAddrsU(cstruct, 0, &attrs, &uuid, &unique, &nentries,
                  &addrs);
-    if (vlserverv4 == -1) {
+    if (newvlserver == vltype_unknown) {
        if (code == RXGEN_OPCODE) {
-           vlserverv4 = 1;     /* Doesn't support new interface */
+           newvlserver = vltype_new;
            return 0;
        } else if (!code) {
-           vlserverv4 = 2;
+           newvlserver = vltype_uuid;
        }
     }
     if (code == VL_NOENT)
@@ -404,7 +693,7 @@ int
 vsu_ExtractName(char rname[], char name[])
 {
     char sname[VOLSER_OLDMAXVOLNAME + 1];
-    int total;
+    size_t total;
 
     strncpy(sname, name, sizeof(sname));
     sname[sizeof(sname) - 1] = '\0';
@@ -431,9 +720,9 @@ afs_uint32
 vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp)
 {
     char volname[VOLSER_OLDMAXVOLNAME + 1];
-    struct nvldbentry entry;
+    struct uvldbentry entry;
     afs_int32 vcode = 0;
-    int total;
+    size_t total;
 
     *errp = 0;
 
@@ -448,7 +737,7 @@ vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp)
     /* It was not a volume number but something else */
     total = strlen(astring);
     vsu_ExtractName(volname, astring);
-    vcode = VLDB_GetEntryByName(volname, &entry);
+    vcode = VLDB_GetEntryByNameU(volname, &entry);
     if (!vcode) {
       if ((total >= 9) && (!strcmp(&astring[total - 9], ".readonly")))
        return entry.volumeId[ROVOL];
index 042e91a..2fa65c8 100644 (file)
@@ -9,10 +9,26 @@ extern int VLDB_ReplaceEntry(afs_uint32 volid, afs_int32 voltype, struct nvldben
 extern int VLDB_ListAttributes(VldbListByAttributes *attrp, afs_int32 *entriesp, nbulkentries *blkentriesp);
 extern int VLDB_ListAttributesN2(VldbListByAttributes *attrp, char *name, afs_int32 thisindex,
            afs_int32 *nentriesp, nbulkentries *blkentriesp, afs_int32 *nextindexp);
+
+extern int VLDB_CreateEntryU(struct uvldbentry *entryp);
+extern int VLDB_GetEntryByIDU(afs_uint32 volid, afs_int32 voltype, struct uvldbentry *entryp);
+extern int VLDB_GetEntryByNameU(char *namep, struct uvldbentry *entryp);
+extern int VLDB_ReplaceEntryU(afs_uint32 volid, afs_int32 voltype, struct uvldbentry *entryp, afs_int32 releasetype);
+extern int VLDB_ListAttributesU(VldbListByAttributes *attrp, afs_int32 *entriesp, ubulkentries *blkentriesp);
+extern int VLDB_ListAttributesN2U(VldbListByAttributes *attrp, char *name, afs_int32 thisindex,
+           afs_int32 *nentriesp, ubulkentries *blkentriesp, afs_int32 *nextindexp);
+
 extern int VLDB_IsSameAddrs(afs_uint32 serv1, afs_uint32 serv2, afs_int32 *errorp);
+
 extern void vsu_SetCrypt(int cryptflag);
 extern afs_int32 vsu_ClientInit(int noAuthFlag, const char *confDir, char *cellName, afs_int32 sauth,
                struct ubik_client **uclientp, int (*secproc)(struct rx_securityClass *, afs_int32));
 extern int vsu_ExtractName(char rname[], char name[]);
 extern afs_uint32 vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp);
+
+/* private */
+extern void nvlentry_to_uvlentry(struct nvldbentry *nentryp,
+                                 struct uvldbentry *uentryp);
+extern int uvlentry_to_nvlentry(struct uvldbentry *uentryp,
+                                struct nvldbentry *nentryp);
 #endif