Prototype the vlserver directory
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Thu, 9 Jul 2009 12:53:33 +0000 (13:53 +0100)
committerDerrick Brashear <shadow@dementia.org>
Fri, 10 Jul 2009 14:41:39 +0000 (08:41 -0600)
Prototype, ansify, and other do warning cleanups on code in the vlserver
directory.

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

src/vlserver/cnvldb.c
src/vlserver/vlclient.c
src/vlserver/vldb_check.c
src/vlserver/vlprocs.c
src/vlserver/vlserver.c
src/vlserver/vlserver_internal.h [new file with mode: 0644]
src/vlserver/vlutils.c

index ae2e62f..b9e6d55 100644 (file)
 
 static char pn[] = "cnvldb";
 static char tempname[] = "XXnewvldb";
-static char space[MAXSIZE];
 static int MaxServers[3] = { 30, 254, 254 };   /* max server # permitted in this version */
 
-static afs_int32 Conv4to3();
+static afs_int32 Conv4to3(afs_int32 addr);
 
-static int convert_vlentry();
-static int rewrite_header();
+static void convert_vlentry(int, int, int, struct vlheader_1 *,
+                           struct vlheader_1 *, struct vlentry_1 *);
+static void rewrite_header(int, int, void *);
+static void readheader(int fd, int version, void *addr);
+static int readentry(int fd, int version, void *addr);
+static void printentry(int version, void *addr);
 
 static char tspace[1024];      /* chdir can't handle anything bigger, anyway */
 
 void read_mhentries(afs_uint32 mh_addr, int oldfd);
 void convert_mhentries(int oldfd, int newfd, struct vlheader_2 *header, int fromver, int tover);
 
+static int convert_header(int ofd, int fd, int fromv, int tov, void *fromaddr,
+                         void *toaddr);
+
 /* return a static pointer to a buffer */
 static char *
-Parent(apath)
-     char *apath;
+Parent(const char *apath)
 {
     register char *tp;
     strcpy(tspace, apath);
@@ -65,22 +70,19 @@ int oldpos = 0;
 int fromvers = 0, tovers = 0, showversion = 0;
 afs_uint32 mhaddr;
 afs_int32 dbsize;
-char *pathname = NULL;
+const char *pathname = NULL;
 const char *dbPath;
 
 static int
 handleit(struct cmd_syndesc *as, void *arock)
 {
-    register struct cmd_item *ti;
-    register afs_int32 code;
     int w, old, new, rc, dump = 0, fromv = 0;
-    short uvers;
     char ubik[80];             /* space for some ubik header */
     union {
        struct vlheader_1 header1;
        struct vlheader_2 header2;
        struct vlheader_3 header3;
-    } oldheader, oldheader1, newheader;        /* large enough for either */
+    } oldheader, newheader;    /* large enough for either */
 
     union {
        struct vlentry_1 entry1;
@@ -222,14 +224,17 @@ handleit(struct cmd_syndesc *as, void *arock)
        rc = readentry(old, fromvers, &xvlentry);
        if ((rc == 0) || (rc == EOF))
            break;
-       convert_vlentry(new, fromvers, tovers, &oldheader, &newheader,
-                       &xvlentry);
+       convert_vlentry(new, fromvers, tovers,
+                       (struct vlheader_1 *)&oldheader,
+                       (struct vlheader_1 *)&newheader,
+                       (struct vlentry_1 *)&xvlentry);
     }
 
     /* We have now finished sequentially reading and writing the database.
      * Now randomly offset into database and update multihome entries.
      */
-    convert_mhentries(old, new, &newheader, fromvers, tovers);
+    convert_mhentries(old, new, (struct vlheader_2 *)&newheader,
+                     fromvers, tovers);
     rewrite_header(new, tovers, &newheader);
 
     close(old);
@@ -245,10 +250,8 @@ handleit(struct cmd_syndesc *as, void *arock)
 }
 
 
-readheader(fd, version, addr)
-     int fd;
-     int version;
-     char *addr;
+static void
+readheader(int fd, int version, void *addr)
 {
     int hdrsize, size = 0;
 
@@ -265,14 +268,13 @@ readheader(fd, version, addr)
     return;
 }
 
-readentry(fd, version, addr)
-     int fd;
-     int version;
-     char *addr;
+static int
+readentry(int fd, int version, void *addr)
 {
     int rc, rc1;
     struct vlentry_3 *vl3p = (struct vlentry_3 *)addr;
     int toread;
+    char *caddr = (char *)addr;
 
     toread =
        ((version ==
@@ -288,7 +290,7 @@ readentry(fd, version, addr)
        if (!mhaddr)            /* Remember first mh block */
            mhaddr = oldpos - rc;
 
-       rc1 = read(fd, &addr[rc], VL_ADDREXTBLK_SIZE - rc);
+       rc1 = read(fd, &caddr[rc], VL_ADDREXTBLK_SIZE - rc);
        if (rc1 != VL_ADDREXTBLK_SIZE - rc)
            printf("Partial read of mhblock at pos %u: %d\n", oldpos + rc,
                   rc1);
@@ -301,9 +303,8 @@ readentry(fd, version, addr)
     return rc;
 }
 
-printentry(version, addr)
-     int version;
-     char *addr;
+static void
+printentry(int version, void *addr)
 {
     struct vlentry_2 *vl2p = (struct vlentry_2 *)addr;
     struct vlentry_3 *vl3p = (struct vlentry_3 *)addr;
@@ -318,7 +319,7 @@ printentry(version, addr)
        printf("%s\t%5d [%10d:%10d:%10d]%8X%8d\n", vl2p->name, vl2p->spares3,
               vl2p->volumeId[0], vl2p->volumeId[1], vl2p->volumeId[2],
               vl2p->flags, vl2p->LockAfsId);
-       printf("\t%8d%8d%8d [%7d%7d%7d]%7d% [%4d%4d%4d%4d][%4d%4d%4d%4d]\n",
+       printf("\t%8d%8d%8d [%7d%7d%7d]%7d [%4d%4d%4d%4d][%4d%4d%4d%4d]\n",
               vl2p->LockTimestamp, vl2p->cloneId, vl2p->spares0,
               vl2p->nextIdHash[0], vl2p->nextIdHash[1], vl2p->nextIdHash[2],
               vl2p->nextNameHash, vl2p->serverNumber[0],
@@ -360,9 +361,7 @@ struct extentaddr *base[VL_MAX_ADDREXTBLKS];
  * If it's not good, then don't read the block in.
  */
 void
-read_mhentries(mh_addr, oldfd)
-     int oldfd;
-     afs_uint32 mh_addr;
+read_mhentries(afs_uint32 mh_addr, int oldfd)
 {
     afs_uint32 sit, a;
     afs_int32 code;
@@ -467,12 +466,9 @@ read_mhentries(mh_addr, oldfd)
  * Before this can be called, the routine read_mhentries must be called.
  */
 void
-convert_mhentries(oldfd, newfd, header, fromver, tover)
-     int oldfd, newfd;
-     struct vlheader_2 *header;
-     int fromver, tover;
+convert_mhentries(int oldfd, int newfd, struct vlheader_2 *header,
+                 int fromver, int tover)
 {
-    afs_uint32 sit;
     afs_int32 code;
     int i, j, modified = 0, w;
     afs_uint32 raddr, addr;
@@ -597,9 +593,9 @@ convert_mhentries(oldfd, newfd, header, fromver, tover)
 }
 
 
-convert_header(ofd, fd, fromv, tov, fromaddr, toaddr)
-     int ofd, fd, fromv, tov;
-     char *fromaddr, *toaddr;
+int
+convert_header(int ofd, int fd, int fromv, int tov, void *fromaddr,
+              void *toaddr)
 {
     struct vlheader_1 *tvp1;
     struct vlheader_2 *tvp2;
@@ -747,8 +743,7 @@ convert_header(ofd, fd, fromv, tov, fromaddr, toaddr)
  * Before this can be called, the routine read_mhentries must be called.
  */
 static afs_int32
-Conv4to3(addr)
-     afs_int32 addr;
+Conv4to3(afs_int32 addr)
 {
     afs_int32 raddr;
     int i;
@@ -771,11 +766,10 @@ Conv4to3(addr)
  * aren't any more or any larger, so they match up pretty well.
 */
 
-static int
-convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp)
-     int new, fromvers, tovers;
-     struct vlheader_1 *oldheader, *newheader; /* close enough */
-     struct vlentry_1 *vlentryp;       /* 1 and 2 are identical */
+static void
+convert_vlentry(int new, int fromvers, int tovers,
+               struct vlheader_1 *oldheader, struct vlheader_1 *newheader,
+               struct vlentry_1 *vlentryp)
 {
     int diff, i, s, w;
     struct vlentry_3 *vl3p = (struct vlentry_3 *)vlentryp;
@@ -793,7 +787,7 @@ convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp)
                exit(1);
            }
        }
-       return 0;
+       return;
     }
 
     if (fromvers == 2 && tovers == 3) {
@@ -825,7 +819,7 @@ convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp)
            exit(1);
        }
 
-       return 0;
+       return;
     } else if (fromvers == 3 && tovers == 2) {
        struct vlentry_2 vl;
        struct vlentry_3 *xnvlentry = (struct vlentry_3 *)vlentryp;
@@ -855,7 +849,7 @@ convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp)
            printf("Write of entry failed %d; error %u\n", w, errno);
            exit(1);
        }
-       return 0;
+       return;
     } else if (fromvers == 3 && tovers == 1) {
        struct vlentry_1 vl;
        struct vlentry_3 *xnvlentry = (struct vlentry_3 *)vlentryp;
@@ -904,7 +898,7 @@ convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp)
            printf("Write of entry failed %d; error %u\n", w, errno);
            exit(1);
        }
-       return 0;
+       return;
     } else if (fromvers == 4 && tovers == 3) {
        struct vlentry_3 vl;
        /* We are converting from version 4 to 3. In this conversion, mh info
@@ -922,7 +916,7 @@ convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp)
            printf("Write of entry failed %d; error %u\n", w, errno);
            exit(1);
        }
-       return 0;
+       return;
     }
 
     if (tovers == 1) {
@@ -953,10 +947,8 @@ convert_vlentry(new, fromvers, tovers, oldheader, newheader, vlentryp)
     return;
 }
 
-static int
-rewrite_header(new, tovers, newheader)
-     int new, tovers;
-     char *newheader;
+static void
+rewrite_header(int new, int tovers, void *newheader)
 {
     int pos, w, towrite;
 
@@ -985,9 +977,8 @@ rewrite_header(new, tovers, newheader)
 
 #include "AFS_component_version_number.c"
 
-main(argc, argv)
-     int argc;
-     char **argv;
+int
+main(int argc, char **argv)
 {
     register struct cmd_syndesc *ts;
     afs_int32 code;
index 0e53eab..7dcfbac 100644 (file)
 #include "vlserver.h"
 #include "vlclient.h"
 
-void fill_listattributes_entry();
-void display_listattributes_entry();
-void display_entry();
-void display_entryN();
-void display_update_entry();
-void dump_stats();
-void GetArgs();
-void print_usage();
-void fill_entry();
-void fill_update_entry();
+void fill_listattributes_entry(struct VldbListByAttributes *, char **, int);
+void display_listattributes_entry(struct VldbListByAttributes *,int);
+void display_entry(struct vldbentry *, int);
+void display_entryN(struct nvldbentry *, int);
+void display_update_entry(struct VldbUpdateEntry *, int);
+void dump_stats(vldstats *, vital_vlheader *);
+void GetArgs(char *, char **, int *);
+void print_usage(void);
+void fill_entry(struct vldbentry *, char **, int);
+void fill_update_entry(struct VldbUpdateEntry *, char **, int);
 
 #define        VL_NUMBER_OPCODESX      34
 static char *opcode_names[VL_NUMBER_OPCODESX] = {
@@ -120,8 +120,7 @@ char confdir[AFSDIR_PATH_MAX];
 char *(args[50]);
 
 struct Vlent *
-GetVolume(vol, entry)
-     struct vldbentry *entry;
+GetVolume(int vol, struct vldbentry *entry)
 {
     register int i;
     register struct Vlent *vl;
@@ -189,18 +188,18 @@ handleit(struct cmd_syndesc *as, void *arock)
     register afs_int32 code, server = 0, sawserver = 0;
     afs_int32 id, voltype;
     struct vldbentry entry;
-    char *cmd = 0, *cellp = 0;
+    char *cellp = 0;
     struct VldbUpdateEntry updateentry;
     struct VldbListByAttributes listbyattributes;
     int noAuth = 1;            /* Default is authenticated connections */
 
-    if (ti = as->parms[0].items)       /* -cellpath <dir> */
+    if ((ti = as->parms[0].items))     /* -cellpath <dir> */
        strcpy(confdir, ti->data);
     if (as->parms[1].items)    /* -server */
        strcpy(confdir, AFSDIR_SERVER_ETC_DIRPATH);
     if (as->parms[2].items)    /* -noauth */
        noAuth = 0;
-    if (ti = as->parms[3].items) {     /* -host */
+    if ((ti = as->parms[3].items)) {   /* -host */
        server = GetServer(ti->data);
        if (server == 0) {
            printf("server '%s' not found in host table\n", ti->data);
@@ -213,10 +212,10 @@ handleit(struct cmd_syndesc *as, void *arock)
            ("Must also specify the -cell' option along with -host for authenticated conns\n");
        exit(1);
     }
-    if (ti = as->parms[4].items) {     /* -cell */
+    if ((ti = as->parms[4].items)) {   /* -cell */
        cellp = ti->data;
     }
-    if (code = vl_Initialize(noAuth, confdir, server, cellp)) {
+    if ((code = vl_Initialize(noAuth, confdir, server, cellp))) {
        printf("Couldn't initialize vldb library (code=%d).\n", code);
        exit(1);
     }
@@ -322,21 +321,21 @@ handleit(struct cmd_syndesc *as, void *arock)
                    if (!next_index)
                        break;
                    num++;
-                   if (vl1 = GetVolume(entry.volumeId[0], &entry)) {
+                   if ((vl1 = GetVolume(entry.volumeId[0], &entry))) {
                        num1++;
                        printf
                            ("Duplicate entry is found for RW vol %u: [RW %u, RO %u, BA %u, name=%s]\n",
                             entry.volumeId[0], vl1->rwid, vl1->roid,
                             vl1->baid, vl1->name);
                    }
-                   if (vl1 = GetVolume(entry.volumeId[1], &entry)) {
+                   if ((vl1 = GetVolume(entry.volumeId[1], &entry))) {
                        num1++;
                        printf
                            ("Duplicate entry is found for RO vol %u: [RW %u, RO %u, BA %u, name=%s]\n",
                             entry.volumeId[1], vl1->rwid, vl1->roid,
                             vl1->baid, vl1->name);
                    }
-                   if (vl1 = GetVolume(entry.volumeId[2], &entry)) {
+                   if ((vl1 = GetVolume(entry.volumeId[2], &entry))) {
                        num1++;
                        printf
                            ("Duplicate entry is found for BA vol %u: [RW %u, RO %u, BA %u, name=%s]\n",
@@ -616,8 +615,8 @@ handleit(struct cmd_syndesc *as, void *arock)
                       (netries == 1 ? "y" : "ies"));
                for (vllist = linkedvldbs.node; vllist; vllist = vllist1) {
                    vllist1 = vllist->next_vldb;
-                   display_entry(&vllist->VldbEntry, 0);
-                   free((char *)vllist);
+                   display_entry((struct vldbentry *) &vllist->VldbEntry, 0);
+                   free(vllist);
                }
            } else if (!strcmp(oper, "lnn")) {
                int netries;
@@ -962,7 +961,6 @@ handleit(struct cmd_syndesc *as, void *arock)
                    continue;
                }
            } else if (!strcmp(oper, "ca")) {
-               extern struct hostent *hostutil_GetHostByName();
                struct hostent *h1, *h2;
                afs_uint32 a1, a2;
 
@@ -1020,9 +1018,8 @@ handleit(struct cmd_syndesc *as, void *arock)
 
 #include "AFS_component_version_number.c"
 
-main(argc, argv)
-     int argc;
-     char **argv;
+int
+main(int argc, char **argv)
 {
     register struct cmd_syndesc *ts;
     afs_int32 code;
@@ -1047,10 +1044,7 @@ main(argc, argv)
 
 
 void
-fill_entry(entry, argp, nargs)
-     struct vldbentry *entry;
-     char **argp;
-     int nargs;
+fill_entry(struct vldbentry *entry, char **argp, int nargs)
 {
     char *name;
     int i;
@@ -1084,10 +1078,7 @@ fill_entry(entry, argp, nargs)
 }
 
 void
-fill_update_entry(entry, argp, nargs)
-     struct VldbUpdateEntry *entry;
-     char **argp;
-     int nargs;
+fill_update_entry(struct VldbUpdateEntry *entry, char **argp, int nargs)
 {
     int i, Mask;
     char *name;
@@ -1152,10 +1143,8 @@ fill_update_entry(entry, argp, nargs)
 }
 
 void
-fill_listattributes_entry(entry, argp, nargs)
-     struct VldbListByAttributes *entry;
-     char **argp;
-     int nargs;
+fill_listattributes_entry(struct VldbListByAttributes *entry, char **argp,
+                         int nargs)
 {
     entry->Mask = 0;
 
@@ -1189,9 +1178,7 @@ fill_listattributes_entry(entry, argp, nargs)
 }
 
 void
-display_listattributes_entry(entry, error)
-     struct VldbListByAttributes *entry;
-     int error;
+display_listattributes_entry(struct VldbListByAttributes *entry, int error)
 {
     if (error)
        return;
@@ -1212,9 +1199,7 @@ display_listattributes_entry(entry, error)
 #define        volumetype_string(type) (type == RWVOL? "read/write":type == ROVOL? "readonly":type == BACKVOL? "backup":"unknown")
 
 void
-display_entry(entry, error)
-     struct vldbentry *entry;
-     int error;
+display_entry(struct vldbentry *entry, int error)
 {
     int i;
 
@@ -1233,9 +1218,7 @@ display_entry(entry, error)
 }
 
 void
-display_entryN(entry, error)
-     struct nvldbentry *entry;
-     int error;
+display_entryN(struct nvldbentry *entry, int error)
 {
     int i, et, ei;
 
@@ -1261,9 +1244,7 @@ display_entryN(entry, error)
 }
 
 void
-display_update_entry(entry, error)
-     struct VldbUpdateEntry *entry;
-     int error;
+display_update_entry(struct VldbUpdateEntry *entry, int error)
 {
     int i;
 
@@ -1277,19 +1258,19 @@ display_update_entry(entry, error)
     if (entry->Mask & VLUPDATE_CLONEID)
        printf("\tNew CloneId: %X\n", entry->cloneId);
     if (entry->Mask & VLUPDATE_READONLYID)
-       printf("\tNew RO id: %D\n", entry->ReadOnlyId);
+       printf("\tNew RO id: %d\n", entry->ReadOnlyId);
     if (entry->Mask & VLUPDATE_BACKUPID)
-       printf("\tNew BACKUP id: %D\n", entry->BackupId);
+       printf("\tNew BACKUP id: %d\n", entry->BackupId);
     if (entry->Mask & VLUPDATE_REPSITES) {
        printf("\tRepsites info:\n");
        printf("\tFlag\tTServer\tTPart\tNServer\tNPart\tNFlag\n");
        for (i = 0; i < entry->nModifiedRepsites; i++) {
-           printf("\t%4x\t%7U\t%5d", entry->RepsitesMask[i],
+           printf("\t%4x\t%7u\t%5d", entry->RepsitesMask[i],
                   entry->RepsitesTargetServer[i],
                   entry->RepsitesTargetPart[i]);
            if ((entry->RepsitesMask[i] & VLUPDATE_REPS_ADD)
                || (entry->RepsitesMask[i] & VLUPDATE_REPS_MODSERV))
-               printf("\t%7U", entry->RepsitesNewServer[i]);
+               printf("\t%7u", entry->RepsitesNewServer[i]);
            else
                printf("\t-------");
            if ((entry->RepsitesMask[i] & VLUPDATE_REPS_ADD)
@@ -1307,9 +1288,7 @@ display_update_entry(entry, error)
 }
 
 void
-dump_stats(stats, vital_header)
-     vldstats *stats;
-     vital_vlheader *vital_header;
+dump_stats(vldstats *stats, vital_vlheader *vital_header)
 {
     int i;
     char strg[30];
@@ -1333,10 +1312,7 @@ dump_stats(stats, vital_header)
 }
 
 void
-GetArgs(line, args, nargs)
-     register char *line;
-     register char **args;
-     register int *nargs;
+GetArgs(char *line, char **args, int *nargs)
 {
     *nargs = 0;
     while (*line) {
@@ -1354,7 +1330,7 @@ GetArgs(line, args, nargs)
 }
 
 void
-print_usage()
+print_usage(void)
 {
     printf("Valid Commands:\n");
 
index 1f0cf6d..0b96185 100644 (file)
@@ -123,7 +123,7 @@ writeUbikHeader()
 
 #define HDRSIZE 64
 int
-readUbikHeader()
+readUbikHeader(void)
 {
     int offset, r;
     struct ubik_hdr uheader;
@@ -166,7 +166,7 @@ readUbikHeader()
 }
 
 int
-vldbio(int position, char *buffer, int size, int rdwr)
+vldbio(int position, void *buffer, int size, int rdwr)
 {
     int offset, r, p;
 
@@ -625,7 +625,7 @@ void
 SetHashEnd(long addr, int type, long new)
 {
     struct nvlentry vlentry;
-    afs_int32 i, rindex, type2, next = -1;
+    afs_int32 type2, next = -1;
 
     for (; addr; addr = next) {
        readentry(addr, &vlentry, &type2);
@@ -1083,10 +1083,10 @@ int
 WorkerBee(struct cmd_syndesc *as, void *arock)
 {
     char *dbfile;
-    afs_int32 maxentries, type, tmp;
+    afs_int32 maxentries, type;
     struct vlheader header;
     struct nvlentry vlentry, vlentry2;
-    int i, j, help = 0;
+    int i, j;
 
     error_level = 0;  /*  start clean with no error status */
     dbfile = as->parms[0].items->data; /* -database */
index d052b64..5a5dc1b 100644 (file)
 #include <ubik.h>
 #include <rx/xdr.h>
 #include <rx/rx.h>
+#include <rx/rxkad.h>
 #ifdef AFS_NT40_ENV
 #include <winsock2.h>
 #else
 #include <netinet/in.h>
 #endif
 #include <afs/keys.h>
+#include <afs/cellconfig.h>
 #include "vlserver.h"
+#include "vlserver_internal.h"
 #include "afs/audit.h"
 #ifndef AFS_NT40_ENV
 #include <unistd.h>
@@ -35,7 +38,7 @@
 #endif
 
 extern int smallMem;
-extern extent_mod;
+extern int extent_mod;
 extern struct afsconf_dir *vldb_confdir;
 extern struct ubik_dbase *VL_dbase;
 struct vlheader cheader;       /* kept in network byte order */
@@ -50,30 +53,45 @@ static char rxinfo_str[128];        /* Need rxinfo string to be non-local */
 #define VLDBALLOCLIMIT 10000
 #define VLDBALLOCINCR  2048
 
-static int put_attributeentry();
-static int put_nattributeentry();
-static int RemoveEntry();
-static void ReleaseEntry();
-static int check_vldbentry();
-static int check_nvldbentry();
-static int vldbentry_to_vlentry();
-static int nvldbentry_to_vlentry();
-static get_vldbupdateentry();
-static int repsite_exists();
-static void repsite_compress();
-static void vlentry_to_vldbentry();
-static void vlentry_to_nvldbentry();
-static void vlentry_to_uvldbentry();
-static int InvalidVolname();
-static int InvalidVoltype();
-static int InvalidOperation();
-static int InvalidReleasetype();
-static int IpAddrToRelAddr();
-static int ChangeIPAddr();
+static int put_attributeentry(struct vldbentry **, struct vldbentry **,
+                             struct vldbentry **, bulkentries *,
+                             struct nvlentry *, afs_int32 *, afs_int32 *);
+static int put_nattributeentry(struct nvldbentry **, struct nvldbentry **,
+                              struct nvldbentry **, nbulkentries *,
+                              struct nvlentry *, afs_int32, afs_int32,
+                              afs_int32 *, afs_int32 *);
+static int RemoveEntry(struct ubik_trans *trans, afs_int32 entryptr,
+                      struct nvlentry *tentry);
+static void ReleaseEntry(struct nvlentry *tentry, afs_int32 releasetype);
+static int check_vldbentry(struct vldbentry *aentry);
+static int check_nvldbentry(struct nvldbentry *aentry);
+static int vldbentry_to_vlentry(struct ubik_trans *atrans,
+                               struct vldbentry *VldbEntry,
+                               struct nvlentry *VlEntry);
+static int nvldbentry_to_vlentry(struct ubik_trans *atrans,
+                                struct nvldbentry *VldbEntry,
+                                struct nvlentry *VlEntry);
+static int get_vldbupdateentry(struct ubik_trans *trans, afs_int32 blockindex,
+                              struct VldbUpdateEntry *updateentry,
+                              struct nvlentry *VlEntry);
+static int repsite_exists(struct nvlentry *VlEntry, int server, int partition);
+static void repsite_compress(struct nvlentry *VlEntry, int offset);
+static void vlentry_to_vldbentry(struct nvlentry *VlEntry,
+                                struct vldbentry *VldbEntry);
+static void vlentry_to_nvldbentry(struct nvlentry *VlEntry,
+                                 struct nvldbentry *VldbEntry);
+static void vlentry_to_uvldbentry(struct nvlentry *VlEntry,
+                                 struct uvldbentry *VldbEntry);
+static int InvalidVolname(char *volname);
+static int InvalidVoltype(afs_int32 voltype);
+static int InvalidOperation(afs_int32 voloper);
+static int InvalidReleasetype(afs_int32 releasetype);
+static int IpAddrToRelAddr(afs_uint32 ipaddr, struct ubik_trans *atrans);
+static int ChangeIPAddr(afs_uint32 ipaddr1, afs_uint32 ipaddr2,
+                       struct ubik_trans *atrans);
 
 char *
-rxinfo(rxcall)
-     struct rx_call *rxcall;
+rxinfo(struct rx_call *rxcall)
 {
     int code;
     register struct rx_connection *tconn;
@@ -98,10 +116,9 @@ rxinfo(rxcall)
 
 /* This is called to initialize the database, set the appropriate locks and make sure that the vldb header is valid */
 int
-Init_VLdbase(trans, locktype, this_op)
-     struct ubik_trans **trans;
-     int locktype;             /* indicate read or write transaction */
-     int this_op;
+Init_VLdbase(struct ubik_trans **trans,
+            int locktype,      /* indicate read or write transaction */
+            int this_op)
 {
     int errorcode = 0, pass, wl;
 
@@ -153,12 +170,12 @@ Init_VLdbase(trans, locktype, this_op)
 }
 
 
-/* Create a new vldb entry; both new volume id and name must be unique (non-existant in vldb). */
+/* Create a new vldb entry; both new volume id and name must be unique
+ * (non-existant in vldb).
+ */
 
 afs_int32
-SVL_CreateEntry(rxcall, newentry)
-     struct rx_call *rxcall;
-     struct vldbentry *newentry;
+SVL_CreateEntry(struct rx_call *rxcall, struct vldbentry *newentry)
 {
     struct ubik_trans *trans;
     afs_int32 errorcode, blockindex;
@@ -204,7 +221,7 @@ SVL_CreateEntry(rxcall, newentry)
 
     memset(&tentry, 0, sizeof(struct nvlentry));
     /* Convert to its internal representation; both in host byte order */
-    if (errorcode = vldbentry_to_vlentry(trans, newentry, &tentry)) {
+    if ((errorcode = vldbentry_to_vlentry(trans, newentry, &tentry))) {
        FreeBlock(trans, blockindex);
        goto abort;
     }
@@ -231,9 +248,7 @@ SVL_CreateEntry(rxcall, newentry)
 
 
 afs_int32
-SVL_CreateEntryN(rxcall, newentry)
-     struct rx_call *rxcall;
-     struct nvldbentry *newentry;
+SVL_CreateEntryN(struct rx_call *rxcall, struct nvldbentry *newentry)
 {
     struct ubik_trans *trans;
     afs_int32 errorcode, blockindex;
@@ -279,7 +294,7 @@ SVL_CreateEntryN(rxcall, newentry)
 
     memset(&tentry, 0, sizeof(struct nvlentry));
     /* Convert to its internal representation; both in host byte order */
-    if (errorcode = nvldbentry_to_vlentry(trans, newentry, &tentry)) {
+    if ((errorcode = nvldbentry_to_vlentry(trans, newentry, &tentry))) {
        FreeBlock(trans, blockindex);
        goto abort;
     }
@@ -306,9 +321,7 @@ SVL_CreateEntryN(rxcall, newentry)
 
 
 afs_int32
-SVL_ChangeAddr(rxcall, ip1, ip2)
-     struct rx_call *rxcall;
-     afs_uint32 ip1, ip2;
+SVL_ChangeAddr(struct rx_call *rxcall, afs_uint32 ip1, afs_uint32 ip2)
 {
     struct ubik_trans *trans;
     afs_int32 errorcode;
@@ -319,11 +332,11 @@ SVL_ChangeAddr(rxcall, ip1, ip2)
        goto end;
     }
 
-    if (errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op)))
        goto end;
 
     VLog(1, ("Change Addr %u -> %u %s\n", ip1, ip2, rxinfo(rxcall)));
-    if (errorcode = ChangeIPAddr(ip1, ip2, trans))
+    if ((errorcode = ChangeIPAddr(ip1, ip2, trans)))
        goto abort;
     else {
        errorcode = ubik_EndTrans(trans);
@@ -342,10 +355,7 @@ SVL_ChangeAddr(rxcall, ip1, ip2)
 
 /* Delete a vldb entry given the volume id. */
 afs_int32
-SVL_DeleteEntry(rxcall, volid, voltype)
-     struct rx_call *rxcall;
-     afs_uint32 volid;
-     afs_int32 voltype;
+SVL_DeleteEntry(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype)
 {
     struct ubik_trans *trans;
     afs_int32 blockindex, errorcode;
@@ -358,7 +368,7 @@ SVL_DeleteEntry(rxcall, volid, voltype)
     if ((voltype != -1) && (InvalidVoltype(voltype)))
        END(VL_BADVOLTYPE);
 
-    if (errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op)))
        goto end;
 
     VLog(1, ("Delete Volume %u %s\n", volid, rxinfo(rxcall)));
@@ -372,7 +382,7 @@ SVL_DeleteEntry(rxcall, volid, voltype)
     if (tentry.flags & VLDELETED) {    /* Already deleted; return */
        ABORT(VL_ENTDELETED);
     }
-    if (errorcode = RemoveEntry(trans, blockindex, &tentry)) {
+    if ((errorcode = RemoveEntry(trans, blockindex, &tentry))) {
        goto abort;
     }
     errorcode = (ubik_EndTrans(trans));
@@ -390,11 +400,13 @@ SVL_DeleteEntry(rxcall, volid, voltype)
 
 
 /* Get a vldb entry given its volume id; make sure it's not a deleted entry. */
-GetEntryByID(rxcall, volid, voltype, aentry, new, this_op)
-     struct rx_call *rxcall;
-     afs_uint32 volid;
-     afs_int32 voltype, new, this_op;
-     char *aentry;             /* entry data copied here */
+int
+GetEntryByID(struct rx_call *rxcall,
+            afs_uint32 volid,
+            afs_int32 voltype,
+            char *aentry,      /* entry data copied here */
+            afs_int32 new,
+            afs_int32 this_op)
 {
     struct ubik_trans *trans;
     afs_int32 blockindex, errorcode;
@@ -402,7 +414,7 @@ GetEntryByID(rxcall, volid, voltype, aentry, new, this_op)
 
     if ((voltype != -1) && (InvalidVoltype(voltype)))
        return VL_BADVOLTYPE;
-    if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
        return errorcode;
 
     VLog(5, ("GetVolumeByID %u (%d) %s\n", volid, new, rxinfo(rxcall)));
@@ -430,33 +442,30 @@ GetEntryByID(rxcall, volid, voltype, aentry, new, this_op)
 }
 
 afs_int32
-SVL_GetEntryByID(rxcall, volid, voltype, aentry)
-     struct rx_call *rxcall;
-     afs_uint32 volid;
-     afs_int32 voltype;
-     vldbentry *aentry;                /* entry data copied here */
+SVL_GetEntryByID(struct rx_call *rxcall,
+                afs_uint32 volid,
+                afs_int32 voltype,
+                vldbentry *aentry)             /* entry data copied here */
 {
     COUNT_REQ(VLGETENTRYBYID);
     return (GetEntryByID(rxcall, volid, voltype, (char *)aentry, 0, this_op));
 }
 
 afs_int32
-SVL_GetEntryByIDN(rxcall, volid, voltype, aentry)
-     struct rx_call *rxcall;
-     afs_uint32 volid;
-     afs_int32 voltype;
-     nvldbentry *aentry;       /* entry data copied here */
+SVL_GetEntryByIDN(struct rx_call *rxcall,
+                 afs_uint32 volid,
+                 afs_int32 voltype,
+                 nvldbentry *aentry)   /* entry data copied here */
 {
     COUNT_REQ(VLGETENTRYBYIDN);
     return (GetEntryByID(rxcall, volid, voltype, (char *)aentry, 1, this_op));
 }
 
 afs_int32
-SVL_GetEntryByIDU(rxcall, volid, voltype, aentry)
-     struct rx_call *rxcall;
-     afs_uint32 volid;
-     afs_int32 voltype;
-     uvldbentry *aentry;       /* entry data copied here */
+SVL_GetEntryByIDU(struct rx_call *rxcall,
+                 afs_uint32 volid,
+                 afs_int32 voltype,
+                 uvldbentry *aentry)   /* entry data copied here */
 {
     COUNT_REQ(VLGETENTRYBYIDU);
     return (GetEntryByID(rxcall, volid, voltype, (char *)aentry, 2, this_op));
@@ -464,26 +473,27 @@ SVL_GetEntryByIDU(rxcall, volid, voltype, aentry)
 
 
 
-/* returns true if the id is a decimal integer, in which case we interpret it
-    as an id.  make the cache manager much simpler */
+/* returns true if the id is a decimal integer, in which case we interpret
+ * it as an id.  make the cache manager much simpler */
 static int
-NameIsId(aname)
-     register char *aname;
+NameIsId(char *aname)
 {
     register int tc;
-    while (tc = *aname++) {
+    while ((tc = *aname++)) {
        if (tc > '9' || tc < '0')
            return 0;
     }
     return 1;
 }
 
-/* Get a vldb entry given the volume's name; of course, very similar to VLGetEntryByID() above. */
-GetEntryByName(rxcall, volname, aentry, new, this_op)
-     struct rx_call *rxcall;
-     char *volname;
-     char *aentry;             /* entry data copied here */
-     int new, this_op;
+/* Get a vldb entry given the volume's name; of course, very similar to
+ * VLGetEntryByID() above. */
+afs_int32
+GetEntryByName(struct rx_call *rxcall,
+              char *volname,
+              char *aentry,            /* entry data copied here */
+              int new,
+              int this_op)
 {
     struct ubik_trans *trans;
     afs_int32 blockindex, errorcode;
@@ -494,7 +504,7 @@ GetEntryByName(rxcall, volname, aentry, new, this_op)
     }
     if (InvalidVolname(volname))
        return VL_BADNAME;
-    if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
        return errorcode;
     VLog(5, ("GetVolumeByName %s (%d) %s\n", volname, new, rxinfo(rxcall)));
     blockindex = FindByName(trans, volname, &tentry, &errorcode);
@@ -521,10 +531,9 @@ GetEntryByName(rxcall, volname, aentry, new, this_op)
 }
 
 afs_int32
-SVL_GetEntryByNameO(rxcall, volname, aentry)
-     struct rx_call *rxcall;
-     char *volname;
-     struct vldbentry *aentry; /* entry data copied here */
+SVL_GetEntryByNameO(struct rx_call *rxcall,
+                   char *volname,
+                   struct vldbentry *aentry)   /* entry data copied here */
 {
     COUNT_REQ(VLGETENTRYBYNAME);
     return (GetEntryByName(rxcall, volname, (char *)aentry, 0, this_op));
@@ -532,20 +541,18 @@ SVL_GetEntryByNameO(rxcall, volname, aentry)
 
 
 afs_int32
-SVL_GetEntryByNameN(rxcall, volname, aentry)
-     struct rx_call *rxcall;
-     char *volname;
-     struct nvldbentry *aentry;        /* entry data copied here */
+SVL_GetEntryByNameN(struct rx_call *rxcall,
+                   char *volname,
+                   struct nvldbentry *aentry)  /* entry data copied here */
 {
     COUNT_REQ(VLGETENTRYBYNAMEN);
     return (GetEntryByName(rxcall, volname, (char *)aentry, 1, this_op));
 }
 
 afs_int32
-SVL_GetEntryByNameU(rxcall, volname, aentry)
-     struct rx_call *rxcall;
-     char *volname;
-     struct uvldbentry *aentry;        /* entry data copied here */
+SVL_GetEntryByNameU(struct rx_call *rxcall,
+                   char *volname,
+                   struct uvldbentry *aentry)  /* entry data copied here */
 {
     COUNT_REQ(VLGETENTRYBYNAMEU);
     return (GetEntryByName(rxcall, volname, (char *)aentry, 2, this_op));
@@ -555,10 +562,8 @@ SVL_GetEntryByNameU(rxcall, volname, aentry)
 
 /* Get the current value of the maximum volume id and bump the volume id counter by Maxvolidbump. */
 afs_int32
-SVL_GetNewVolumeId(rxcall, Maxvolidbump, newvolumeid)
-     struct rx_call *rxcall;
-     afs_uint32 Maxvolidbump;
-     afs_uint32 *newvolumeid;
+SVL_GetNewVolumeId(struct rx_call *rxcall, afs_uint32 Maxvolidbump,
+                  afs_uint32 *newvolumeid)
 {
     register afs_int32 errorcode;
     afs_uint32 maxvolumeid;
@@ -571,7 +576,7 @@ SVL_GetNewVolumeId(rxcall, Maxvolidbump, newvolumeid)
     if (Maxvolidbump < 0 || Maxvolidbump > MAXBUMPCOUNT)
        END(VL_BADVOLIDBUMP);
 
-    if (errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op)))
        goto end;
 
     *newvolumeid = maxvolumeid = ntohl(cheader.vital_header.MaxVolumeId);
@@ -599,12 +604,8 @@ SVL_GetNewVolumeId(rxcall, Maxvolidbump, newvolumeid)
  * VLUpdateEntry) is done. */
 
 afs_int32
-SVL_ReplaceEntry(rxcall, volid, voltype, newentry, releasetype)
-     struct rx_call *rxcall;
-     afs_uint32 volid;
-     afs_int32 voltype;
-     struct vldbentry *newentry;
-     afs_int32 releasetype;
+SVL_ReplaceEntry(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype,
+                struct vldbentry *newentry, afs_int32 releasetype)
 {
     struct ubik_trans *trans;
     afs_int32 blockindex, errorcode, typeindex;
@@ -619,7 +620,7 @@ SVL_ReplaceEntry(rxcall, volid, voltype, newentry, releasetype)
     if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL))
        END(VL_PERM);
 
-    if (errorcode = check_vldbentry(newentry))
+    if ((errorcode = check_vldbentry(newentry)))
        goto end;
 
     if (voltype != -1 && InvalidVoltype(voltype))
@@ -627,7 +628,7 @@ SVL_ReplaceEntry(rxcall, volid, voltype, newentry, releasetype)
 
     if (releasetype && InvalidReleasetype(releasetype))
        END(VL_BADRELLOCKTYPE);
-    if (errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op)))
        goto end;
 
     VLog(1, ("OReplace Volume %u %s\n", volid, rxinfo(rxcall)));
@@ -650,8 +651,8 @@ SVL_ReplaceEntry(rxcall, volid, voltype, newentry, releasetype)
     for (typeindex = ROVOL; typeindex <= BACKVOL; typeindex++) {
        if (tentry.volumeId[typeindex] != newentry->volumeId[typeindex]) {
            if (tentry.volumeId[typeindex])
-               if (errorcode =
-                   UnhashVolid(trans, typeindex, blockindex, &tentry)) {
+               if ((errorcode =
+                   UnhashVolid(trans, typeindex, blockindex, &tentry))) {
                    goto abort;
                }
            /* we must rehash new id if the id is different and the ID is nonzero */
@@ -661,7 +662,7 @@ SVL_ReplaceEntry(rxcall, volid, voltype, newentry, releasetype)
 
     /* Rehash volname if it changes */
     if (strcmp(newentry->name, tentry.name)) { /* Name changes; redo hashing */
-       if (errorcode = UnhashVolname(trans, blockindex, &tentry)) {
+       if ((errorcode = UnhashVolname(trans, blockindex, &tentry))) {
            goto abort;
        }
        hashnewname = 1;
@@ -669,13 +670,13 @@ SVL_ReplaceEntry(rxcall, volid, voltype, newentry, releasetype)
 
     /* after this, tentry is new entry, not old one.  vldbentry_to_vlentry
      * doesn't touch hash chains */
-    if (errorcode = vldbentry_to_vlentry(trans, newentry, &tentry)) {
+    if ((errorcode = vldbentry_to_vlentry(trans, newentry, &tentry))) {
        goto abort;
     }
 
     for (typeindex = ROVOL; typeindex <= BACKVOL; typeindex++) {
        if (hashVol[typeindex] && tentry.volumeId[typeindex]) {
-           if (errorcode = HashVolid(trans, typeindex, blockindex, &tentry)) {
+           if ((errorcode = HashVolid(trans, typeindex, blockindex, &tentry))) {
                goto abort;
            }
        }
@@ -703,12 +704,8 @@ SVL_ReplaceEntry(rxcall, volid, voltype, newentry, releasetype)
 }
 
 afs_int32
-SVL_ReplaceEntryN(rxcall, volid, voltype, newentry, releasetype)
-     struct rx_call *rxcall;
-     afs_uint32 volid;
-     afs_int32 voltype;
-     struct nvldbentry *newentry;
-     afs_int32 releasetype;
+SVL_ReplaceEntryN(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype,
+                 struct nvldbentry *newentry, afs_int32 releasetype)
 {
     struct ubik_trans *trans;
     afs_int32 blockindex, errorcode, typeindex;
@@ -723,7 +720,7 @@ SVL_ReplaceEntryN(rxcall, volid, voltype, newentry, releasetype)
     if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL))
        END(VL_PERM);
 
-    if (errorcode = check_nvldbentry(newentry))
+    if ((errorcode = check_nvldbentry(newentry)))
        goto end;
 
     if (voltype != -1 && InvalidVoltype(voltype))
@@ -731,7 +728,7 @@ SVL_ReplaceEntryN(rxcall, volid, voltype, newentry, releasetype)
 
     if (releasetype && InvalidReleasetype(releasetype))
        END(VL_BADRELLOCKTYPE);
-    if (errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op)))
        goto end;
 
     VLog(1, ("Replace Volume %u %s\n", volid, rxinfo(rxcall)));
@@ -754,8 +751,8 @@ SVL_ReplaceEntryN(rxcall, volid, voltype, newentry, releasetype)
     for (typeindex = ROVOL; typeindex <= BACKVOL; typeindex++) {
        if (tentry.volumeId[typeindex] != newentry->volumeId[typeindex]) {
            if (tentry.volumeId[typeindex])
-               if (errorcode =
-                   UnhashVolid(trans, typeindex, blockindex, &tentry)) {
+               if ((errorcode =
+                   UnhashVolid(trans, typeindex, blockindex, &tentry))) {
                    goto abort;
                }
            /* we must rehash new id if the id is different and the ID is nonzero */
@@ -765,7 +762,7 @@ SVL_ReplaceEntryN(rxcall, volid, voltype, newentry, releasetype)
 
     /* Rehash volname if it changes */
     if (strcmp(newentry->name, tentry.name)) { /* Name changes; redo hashing */
-       if (errorcode = UnhashVolname(trans, blockindex, &tentry)) {
+       if ((errorcode = UnhashVolname(trans, blockindex, &tentry))) {
            goto abort;
        }
        hashnewname = 1;
@@ -773,13 +770,13 @@ SVL_ReplaceEntryN(rxcall, volid, voltype, newentry, releasetype)
 
     /* after this, tentry is new entry, not old one.  vldbentry_to_vlentry
      * doesn't touch hash chains */
-    if (errorcode = nvldbentry_to_vlentry(trans, newentry, &tentry)) {
+    if ((errorcode = nvldbentry_to_vlentry(trans, newentry, &tentry))) {
        goto abort;
     }
 
     for (typeindex = ROVOL; typeindex <= BACKVOL; typeindex++) {
        if (hashVol[typeindex] && tentry.volumeId[typeindex]) {
-           if (errorcode = HashVolid(trans, typeindex, blockindex, &tentry)) {
+           if ((errorcode = HashVolid(trans, typeindex, blockindex, &tentry))) {
                goto abort;
            }
        }
@@ -807,15 +804,17 @@ SVL_ReplaceEntryN(rxcall, volid, voltype, newentry, releasetype)
 }
 
 
-/* Update a vldb entry (accessed thru its volume id). Almost all of the entry's fields can be modified in a single call by setting the appropriate bits in the Mask field in VldbUpdateentry. */
-/* this routine may never have been tested; use replace entry instead unless you're brave */
+/* Update a vldb entry (accessed thru its volume id). Almost all of the
+ * entry's fields can be modified in a single call by setting the
+ * appropriate bits in the Mask field in VldbUpdateentry. */
+/* this routine may never have been tested; use replace entry instead
+ * unless you're brave */
 afs_int32
-SVL_UpdateEntry(rxcall, volid, voltype, updateentry, releasetype)
-     struct rx_call *rxcall;
-     afs_uint32 volid;
-     afs_int32 voltype;
-     afs_int32 releasetype;
-     struct VldbUpdateEntry *updateentry;      /* Update entry copied here */
+SVL_UpdateEntry(struct rx_call *rxcall,
+               afs_uint32 volid,
+               afs_int32 voltype,
+               struct VldbUpdateEntry *updateentry,    /* Update entry copied here */
+               afs_int32 releasetype)
 {
     struct ubik_trans *trans;
     afs_int32 blockindex, errorcode;
@@ -828,7 +827,7 @@ SVL_UpdateEntry(rxcall, volid, voltype, updateentry, releasetype)
        END(VL_BADVOLTYPE);
     if (releasetype && InvalidReleasetype(releasetype))
        END(VL_BADRELLOCKTYPE);
-    if (errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op)))
        goto end;
 
     VLog(1, ("Update Volume %u %s\n", volid, rxinfo(rxcall)));
@@ -840,8 +839,8 @@ SVL_UpdateEntry(rxcall, volid, voltype, updateentry, releasetype)
     }
 
     /* Do the actual updating of the entry, tentry. */
-    if (errorcode =
-       get_vldbupdateentry(trans, blockindex, updateentry, &tentry)) {
+    if ((errorcode =
+       get_vldbupdateentry(trans, blockindex, updateentry, &tentry))) {
        goto abort;
     }
     if (releasetype)
@@ -863,11 +862,10 @@ SVL_UpdateEntry(rxcall, volid, voltype, updateentry, releasetype)
 
 
 afs_int32
-SVL_UpdateEntryByName(rxcall, volname, updateentry, releasetype)
-     struct rx_call *rxcall;
-     char *volname;
-     afs_int32 releasetype;
-     struct VldbUpdateEntry *updateentry;      /* Update entry copied here */
+SVL_UpdateEntryByName(struct rx_call *rxcall,
+                     char *volname,
+                     struct VldbUpdateEntry *updateentry, /* Update entry copied here */
+                     afs_int32 releasetype)
 {
     struct ubik_trans *trans;
     afs_int32 blockindex, errorcode;
@@ -878,7 +876,7 @@ SVL_UpdateEntryByName(rxcall, volname, updateentry, releasetype)
        END(VL_PERM);
     if (releasetype && InvalidReleasetype(releasetype))
        END(VL_BADRELLOCKTYPE);
-    if (errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op)))
        goto end;
 
     blockindex = FindByName(trans, volname, &tentry, &errorcode);
@@ -889,8 +887,8 @@ SVL_UpdateEntryByName(rxcall, volname, updateentry, releasetype)
     }
 
     /* Do the actual updating of the entry, tentry. */
-    if (errorcode =
-       get_vldbupdateentry(trans, blockindex, updateentry, &tentry)) {
+    if ((errorcode =
+       get_vldbupdateentry(trans, blockindex, updateentry, &tentry))) {
        goto abort;
     }
     if (releasetype)
@@ -912,11 +910,8 @@ SVL_UpdateEntryByName(rxcall, volname, updateentry, releasetype)
 
 /* Set a lock to the vldb entry for volid (of type voltype if not -1). */
 afs_int32
-SVL_SetLock(rxcall, volid, voltype, voloper)
-     struct rx_call *rxcall;
-     afs_uint32 volid;
-     afs_int32 voltype;
-     afs_int32 voloper;
+SVL_SetLock(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype,
+           afs_int32 voloper)
 {
     afs_int32 timestamp, blockindex, errorcode;
     struct ubik_trans *trans;
@@ -929,7 +924,7 @@ SVL_SetLock(rxcall, volid, voltype, voloper)
        END(VL_BADVOLTYPE);
     if (InvalidOperation(voloper))
        END(VL_BADVOLOPER);
-    if (errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op)))
        goto end;
 
     VLog(1, ("SetLock Volume %u %s\n", volid, rxinfo(rxcall)));
@@ -981,11 +976,8 @@ SVL_SetLock(rxcall, volid, voltype, voloper)
  * the lock time stamp. */
 
 afs_int32
-SVL_ReleaseLock(rxcall, volid, voltype, releasetype)
-     struct rx_call *rxcall;
-     afs_uint32 volid;
-     afs_int32 voltype;
-     afs_int32 releasetype;
+SVL_ReleaseLock(struct rx_call *rxcall, afs_uint32 volid, afs_int32 voltype,
+               afs_int32 releasetype)
 {
     afs_int32 blockindex, errorcode;
     struct ubik_trans *trans;
@@ -998,7 +990,7 @@ SVL_ReleaseLock(rxcall, volid, voltype, releasetype)
        END(VL_BADVOLTYPE);
     if (releasetype && InvalidReleasetype(releasetype))
        END(VL_BADRELLOCKTYPE);
-    if (errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKWRITE, this_op)))
        goto end;
 
     VLog(1, ("ReleaseLock Volume %u %s\n", volid, rxinfo(rxcall)));
@@ -1029,21 +1021,21 @@ SVL_ReleaseLock(rxcall, volid, voltype, releasetype)
 }
 
 
-/* ListEntry returns a single vldb entry, aentry, with offset previous_index; the remaining parameters (i.e. next_index) are used so that sequential calls to this routine will get the next (all) vldb entries. */
+/* ListEntry returns a single vldb entry, aentry, with offset previous_index;
+ * the remaining parameters (i.e. next_index) are used so that sequential
+ * calls to this routine will get the next (all) vldb entries.
+ */
 afs_int32
-SVL_ListEntry(rxcall, previous_index, count, next_index, aentry)
-     struct rx_call *rxcall;
-     afs_int32 previous_index;
-     afs_int32 *count;
-     afs_int32 *next_index;
-     struct vldbentry *aentry;
+SVL_ListEntry(struct rx_call *rxcall, afs_int32 previous_index,
+             afs_int32 *count, afs_int32 *next_index,
+             struct vldbentry *aentry)
 {
     int errorcode;
     struct ubik_trans *trans;
     struct nvlentry tentry;
 
     COUNT_REQ(VLLISTENTRY);
-    if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
        return errorcode;
     VLog(25, ("OListEntry index=%d %s\n", previous_index, rxinfo(rxcall)));
     *next_index = NextEntry(trans, previous_index, &tentry, count);
@@ -1052,21 +1044,21 @@ SVL_ListEntry(rxcall, previous_index, count, next_index, aentry)
     return (ubik_EndTrans(trans));
 }
 
-/* ListEntry returns a single vldb entry, aentry, with offset previous_index; the remaining parameters (i.e. next_index) are used so that sequential calls to this routine will get the next (all) vldb entries. */
+/* ListEntry returns a single vldb entry, aentry, with offset previous_index;
+ * the remaining parameters (i.e. next_index) are used so that sequential
+ * calls to this routine will get the next (all) vldb entries.
+ */
 afs_int32
-SVL_ListEntryN(rxcall, previous_index, count, next_index, aentry)
-     struct rx_call *rxcall;
-     afs_int32 previous_index;
-     afs_int32 *count;
-     afs_int32 *next_index;
-     struct nvldbentry *aentry;
+SVL_ListEntryN(struct rx_call *rxcall, afs_int32 previous_index,
+              afs_int32 *count, afs_int32 *next_index,
+              struct nvldbentry *aentry)
 {
     int errorcode;
     struct ubik_trans *trans;
     struct nvlentry tentry;
 
     COUNT_REQ(VLLISTENTRYN);
-    if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
        return errorcode;
     VLog(25, ("ListEntry index=%d %s\n", previous_index, rxinfo(rxcall)));
     *next_index = NextEntry(trans, previous_index, &tentry, count);
@@ -1076,13 +1068,17 @@ SVL_ListEntryN(rxcall, previous_index, count, next_index, aentry)
 }
 
 
-/* Retrieves in vldbentries all vldb entries that match the specified attributes (by server number, partition, volume type, and flag); if volume id is specified then the associated list for that entry is returned. CAUTION: This could be a very expensive call since in most cases sequential search of all vldb entries is performed. */
+/* Retrieves in vldbentries all vldb entries that match the specified
+ * attributes (by server number, partition, volume type, and flag); if volume
+ * id is specified then the associated list for that entry is returned.
+ * CAUTION: This could be a very expensive call since in most cases
+ * sequential search of all vldb entries is performed.
+ */
 afs_int32
-SVL_ListAttributes(rxcall, attributes, nentries, vldbentries)
-     struct rx_call *rxcall;
-     struct VldbListByAttributes *attributes;
-     afs_int32 *nentries;
-     bulkentries *vldbentries;
+SVL_ListAttributes(struct rx_call *rxcall,
+                  struct VldbListByAttributes *attributes,
+                  afs_int32 *nentries,
+                  bulkentries *vldbentries)
 {
     int errorcode, allocCount = 0;
     struct ubik_trans *trans;
@@ -1093,7 +1089,7 @@ SVL_ListAttributes(rxcall, attributes, nentries, vldbentries)
     COUNT_REQ(VLLISTATTRIBUTES);
     vldbentries->bulkentries_val = 0;
     vldbentries->bulkentries_len = *nentries = 0;
-    if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
        return errorcode;
     allocCount = VLDBALLOCCOUNT;
     Vldbentry = VldbentryFirst = vldbentries->bulkentries_val =
@@ -1104,7 +1100,8 @@ SVL_ListAttributes(rxcall, attributes, nentries, vldbentries)
        return VL_NOMEM;
     }
     VldbentryLast = VldbentryFirst + allocCount;
-    /* Handle the attribute by volume id totally separate of the rest (thus additional Mask values are ignored if VLLIST_VOLUMEID is set!) */
+    /* Handle the attribute by volume id totally separate of the rest
+     * (thus additional Mask values are ignored if VLLIST_VOLUMEID is set!) */
     if (attributes->Mask & VLLIST_VOLUMEID) {
        afs_int32 blockindex;
 
@@ -1121,9 +1118,9 @@ SVL_ListAttributes(rxcall, attributes, nentries, vldbentries)
            vldbentries->bulkentries_len = 0;
            return errorcode;
        }
-       if (errorcode =
+       if ((errorcode =
            put_attributeentry(&Vldbentry, &VldbentryFirst, &VldbentryLast,
-                              vldbentries, &tentry, nentries, &allocCount)) {
+                              vldbentries, &tentry, nentries, &allocCount))) {
            COUNT_ABO;
            ubik_AbortTrans(trans);
            if (vldbentries->bulkentries_val)
@@ -1134,8 +1131,8 @@ SVL_ListAttributes(rxcall, attributes, nentries, vldbentries)
        }
     } else {
        afs_int32 nextblockindex = 0, count = 0, k = 0, match = 0;
-       while (nextblockindex =
-              NextEntry(trans, nextblockindex, &tentry, &count)) {
+       while ((nextblockindex =
+              NextEntry(trans, nextblockindex, &tentry, &count))) {
            if (++pollcount > 50) {
 #ifndef AFS_PTHREAD_ENV
                IOMGR_Poll();
@@ -1146,8 +1143,7 @@ SVL_ListAttributes(rxcall, attributes, nentries, vldbentries)
            if (attributes->Mask & VLLIST_SERVER) {
                int serverindex;
                if ((serverindex =
-                    IpAddrToRelAddr(attributes->server,
-                                    (struct ubik_trans *)0)) == -1)
+                    IpAddrToRelAddr(attributes->server, NULL)) == -1)
                    continue;
                for (k = 0; k < OMAXNSERVERS; k++) {
                    if (tentry.serverNumber[k] == BADSERVERID)
@@ -1183,10 +1179,10 @@ SVL_ListAttributes(rxcall, attributes, nentries, vldbentries)
                if (!(tentry.flags & attributes->flag))
                    continue;
            }
-           if (errorcode =
+           if ((errorcode =
                put_attributeentry(&Vldbentry, &VldbentryFirst,
                                   &VldbentryLast, vldbentries, &tentry,
-                                  nentries, &allocCount)) {
+                                  nentries, &allocCount))) {
                COUNT_ABO;
                ubik_AbortTrans(trans);
                if (vldbentries->bulkentries_val)
@@ -1217,11 +1213,10 @@ SVL_ListAttributes(rxcall, attributes, nentries, vldbentries)
 }
 
 afs_int32
-SVL_ListAttributesN(rxcall, attributes, nentries, vldbentries)
-     struct rx_call *rxcall;
-     struct VldbListByAttributes *attributes;
-     afs_int32 *nentries;
-     nbulkentries *vldbentries;
+SVL_ListAttributesN(struct rx_call *rxcall,
+                   struct VldbListByAttributes *attributes,
+                   afs_int32 *nentries,
+                   nbulkentries *vldbentries)
 {
     int errorcode, allocCount = 0;
     struct ubik_trans *trans;
@@ -1232,7 +1227,7 @@ SVL_ListAttributesN(rxcall, attributes, nentries, vldbentries)
     COUNT_REQ(VLLISTATTRIBUTESN);
     vldbentries->nbulkentries_val = 0;
     vldbentries->nbulkentries_len = *nentries = 0;
-    if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
        return errorcode;
     allocCount = VLDBALLOCCOUNT;
     Vldbentry = VldbentryFirst = vldbentries->nbulkentries_val =
@@ -1243,7 +1238,8 @@ SVL_ListAttributesN(rxcall, attributes, nentries, vldbentries)
        return VL_NOMEM;
     }
     VldbentryLast = VldbentryFirst + allocCount;
-    /* Handle the attribute by volume id totally separate of the rest (thus additional Mask values are ignored if VLLIST_VOLUMEID is set!) */
+    /* Handle the attribute by volume id totally separate of the rest
+     * (thus additional Mask values are ignored if VLLIST_VOLUMEID is set!) */
     if (attributes->Mask & VLLIST_VOLUMEID) {
        afs_int32 blockindex;
 
@@ -1260,10 +1256,10 @@ SVL_ListAttributesN(rxcall, attributes, nentries, vldbentries)
            vldbentries->nbulkentries_len = 0;
            return errorcode;
        }
-       if (errorcode =
+       if ((errorcode =
            put_nattributeentry(&Vldbentry, &VldbentryFirst, &VldbentryLast,
                                vldbentries, &tentry, 0, 0, nentries,
-                               &allocCount)) {
+                               &allocCount))) {
            COUNT_ABO;
            ubik_AbortTrans(trans);
            if (vldbentries->nbulkentries_val)
@@ -1274,8 +1270,8 @@ SVL_ListAttributesN(rxcall, attributes, nentries, vldbentries)
        }
     } else {
        afs_int32 nextblockindex = 0, count = 0, k = 0, match = 0;
-       while (nextblockindex =
-              NextEntry(trans, nextblockindex, &tentry, &count)) {
+       while ((nextblockindex =
+              NextEntry(trans, nextblockindex, &tentry, &count))) {
            if (++pollcount > 50) {
 #ifndef AFS_PTHREAD_ENV
                IOMGR_Poll();
@@ -1287,8 +1283,7 @@ SVL_ListAttributesN(rxcall, attributes, nentries, vldbentries)
            if (attributes->Mask & VLLIST_SERVER) {
                int serverindex;
                if ((serverindex =
-                    IpAddrToRelAddr(attributes->server,
-                                    (struct ubik_trans *)0)) == -1)
+                    IpAddrToRelAddr(attributes->server, NULL)) == -1)
                    continue;
                for (k = 0; k < NMAXNSERVERS; k++) {
                    if (tentry.serverNumber[k] == BADSERVERID)
@@ -1324,10 +1319,10 @@ SVL_ListAttributesN(rxcall, attributes, nentries, vldbentries)
                if (!(tentry.flags & attributes->flag))
                    continue;
            }
-           if (errorcode =
+           if ((errorcode =
                put_nattributeentry(&Vldbentry, &VldbentryFirst,
                                    &VldbentryLast, vldbentries, &tentry, 0,
-                                   0, nentries, &allocCount)) {
+                                   0, nentries, &allocCount))) {
                COUNT_ABO;
                ubik_AbortTrans(trans);
                if (vldbentries->nbulkentries_val)
@@ -1359,15 +1354,13 @@ SVL_ListAttributesN(rxcall, attributes, nentries, vldbentries)
 
 
 afs_int32
-SVL_ListAttributesN2(rxcall, attributes, name, startindex, nentries,
-                    vldbentries, nextstartindex)
-     struct rx_call *rxcall;
-     struct VldbListByAttributes *attributes;
-     char *name;               /* Wildcarded volume name */
-     afs_int32 startindex;
-     afs_int32 *nentries;
-     nbulkentries *vldbentries;
-     afs_int32 *nextstartindex;
+SVL_ListAttributesN2(struct rx_call *rxcall,
+                    struct VldbListByAttributes *attributes,
+                    char *name,                /* Wildcarded volume name */
+                    afs_int32 startindex,
+                    afs_int32 *nentries,
+                    nbulkentries *vldbentries,
+                    afs_int32 *nextstartindex)
 {
     int errorcode = 0, maxCount = VLDBALLOCCOUNT;
     struct ubik_trans *trans;
@@ -1377,7 +1370,6 @@ SVL_ListAttributesN2(rxcall, attributes, name, startindex, nentries,
     afs_int32 matchindex = 0;
     int serverindex = -1;      /* no server found */
     int findserver = 0, findpartition = 0, findflag = 0, findname = 0;
-    char *t;
     int pollcount = 0;
     int namematchRWBK, namematchRO, thismatch;
     int matchtype = 0;
@@ -1385,6 +1377,8 @@ SVL_ListAttributesN2(rxcall, attributes, name, startindex, nentries,
 #ifdef HAVE_POSIX_REGEX
     regex_t re;
     int need_regfree = 0;
+#else
+    char *t;
 #endif
 
     COUNT_REQ(VLLISTATTRIBUTESN2);
@@ -1434,7 +1428,7 @@ SVL_ListAttributesN2(rxcall, attributes, name, startindex, nentries,
        /* Get the server index for matching server address */
        if (attributes->Mask & VLLIST_SERVER) {
            serverindex =
-               IpAddrToRelAddr(attributes->server, (struct ubik_trans *)0);
+               IpAddrToRelAddr(attributes->server, NULL);
            if (serverindex == -1)
                goto done;
            findserver = 1;
@@ -1461,7 +1455,7 @@ SVL_ListAttributesN2(rxcall, attributes, name, startindex, nentries,
 
        /* Read each entry and see if it is the one we want */
        blockindex = startindex;
-       while (blockindex = NextEntry(trans, blockindex, &tentry, &count)) {
+       while ((blockindex = NextEntry(trans, blockindex, &tentry, &count))) {
            if (++pollcount > 50) {
 #ifndef AFS_PTHREAD_ENV
                IOMGR_Poll();
@@ -1634,11 +1628,10 @@ SVL_ListAttributesN2(rxcall, attributes, name, startindex, nentries,
  * cases sequential search of all vldb entries is performed.
  */
 afs_int32
-SVL_LinkedList(rxcall, attributes, nentries, vldbentries)
-     struct rx_call *rxcall;
-     struct VldbListByAttributes *attributes;
-     afs_int32 *nentries;
-     vldb_list *vldbentries;
+SVL_LinkedList(struct rx_call *rxcall,
+              struct VldbListByAttributes *attributes,
+              afs_int32 *nentries,
+              vldb_list *vldbentries)
 {
     int errorcode;
     struct ubik_trans *trans;
@@ -1650,7 +1643,7 @@ SVL_LinkedList(rxcall, attributes, nentries, vldbentries)
     int pollcount = 0;
 
     COUNT_REQ(VLLINKEDLIST);
-    if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
        return errorcode;
 
     *nentries = 0;
@@ -1697,8 +1690,7 @@ SVL_LinkedList(rxcall, attributes, nentries, vldbentries)
            /* Does this volume exist on the desired server */
            if (attributes->Mask & VLLIST_SERVER) {
                serverindex =
-                   IpAddrToRelAddr(attributes->server,
-                                   (struct ubik_trans *)0);
+                   IpAddrToRelAddr(attributes->server, NULL);
                if (serverindex == -1)
                    continue;
                for (k = 0; k < OMAXNSERVERS; k++) {
@@ -1763,11 +1755,10 @@ SVL_LinkedList(rxcall, attributes, nentries, vldbentries)
 }
 
 afs_int32
-SVL_LinkedListN(rxcall, attributes, nentries, vldbentries)
-     struct rx_call *rxcall;
-     struct VldbListByAttributes *attributes;
-     afs_int32 *nentries;
-     nvldb_list *vldbentries;
+SVL_LinkedListN(struct rx_call *rxcall,
+               struct VldbListByAttributes *attributes,
+               afs_int32 *nentries,
+               nvldb_list *vldbentries)
 {
     int errorcode;
     struct ubik_trans *trans;
@@ -1779,7 +1770,7 @@ SVL_LinkedListN(rxcall, attributes, nentries, vldbentries)
     int pollcount = 0;
 
     COUNT_REQ(VLLINKEDLISTN);
-    if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
        return errorcode;
 
     *nentries = 0;
@@ -1826,8 +1817,7 @@ SVL_LinkedListN(rxcall, attributes, nentries, vldbentries)
            /* Does this volume exist on the desired server */
            if (attributes->Mask & VLLIST_SERVER) {
                serverindex =
-                   IpAddrToRelAddr(attributes->server,
-                                   (struct ubik_trans *)0);
+                   IpAddrToRelAddr(attributes->server, NULL);
                if (serverindex == -1)
                    continue;
                for (k = 0; k < NMAXNSERVERS; k++) {
@@ -1891,12 +1881,14 @@ SVL_LinkedListN(rxcall, attributes, nentries, vldbentries)
     return (ubik_EndTrans(trans));
 }
 
-/* Get back vldb header statistics (allocs, frees, maxvolumeid, totalentries, etc) and dynamic statistics (number of requests and/or aborts per remote procedure call, etc) */
+/* Get back vldb header statistics (allocs, frees, maxvolumeid,
+ * totalentries, etc) and dynamic statistics (number of requests and/or
+ * aborts per remote procedure call, etc)
+ */
 afs_int32
-SVL_GetStats(rxcall, stats, vital_header)
-     struct rx_call *rxcall;
-     vldstats *stats;
-     vital_vlheader *vital_header;
+SVL_GetStats(struct rx_call *rxcall,
+            vldstats *stats,
+            vital_vlheader *vital_header)
 {
     register afs_int32 errorcode;
     struct ubik_trans *trans;
@@ -1907,7 +1899,7 @@ SVL_GetStats(rxcall, stats, vital_header)
     if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL))        /* Must be in 'UserList' to use */
        return VL_PERM;
 #endif
-    if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
        return errorcode;
     VLog(5, ("GetStats %s\n", rxinfo(rxcall)));
     memcpy((char *)vital_header, (char *)&cheader.vital_header,
@@ -1921,12 +1913,12 @@ SVL_GetStats(rxcall, stats, vital_header)
  * through the VLDB, but that's life.
  */
 afs_int32
-SVL_GetAddrs(rxcall, Handle, spare2, spare3, nentries, addrsp)
-     struct rx_call *rxcall;
-     afs_int32 Handle, spare2;
-     struct VLCallBack *spare3;
-     afs_int32 *nentries;
-     bulkaddrs *addrsp;
+SVL_GetAddrs(struct rx_call *rxcall,
+            afs_int32 Handle,
+            afs_int32 spare2,
+            struct VLCallBack *spare3,
+            afs_int32 *nentries,
+            bulkaddrs *addrsp)
 {
     register afs_int32 errorcode;
     struct ubik_trans *trans;
@@ -1938,7 +1930,7 @@ SVL_GetAddrs(rxcall, Handle, spare2, spare3, nentries, addrsp)
     addrsp->bulkaddrs_val = 0;
     memset(spare3, 0, sizeof(struct VLCallBack));
 
-    if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
        return errorcode;
 
     VLog(5, ("GetAddrs\n"));
@@ -1953,7 +1945,7 @@ SVL_GetAddrs(rxcall, Handle, spare2, spare3, nentries, addrsp)
     }
 
     for (i = 0; i <= MAXSERVERID; i++) {
-       if (*taddrp = ntohl(cheader.IpMappedAddr[i])) {
+       if ((*taddrp = ntohl(cheader.IpMappedAddr[i]))) {
            taddrp++;
            nservers++;
        }
@@ -1966,11 +1958,8 @@ SVL_GetAddrs(rxcall, Handle, spare2, spare3, nentries, addrsp)
 #define PADDR(addr) VLog(0,("%d.%d.%d.%d", (addr>>24)&0xff, (addr>>16)&0xff, (addr>>8) &0xff, addr&0xff));
 
 afs_int32
-SVL_RegisterAddrs(rxcall, uuidp, spare1, addrsp)
-     struct rx_call *rxcall;
-     afsUUID *uuidp;
-     afs_int32 spare1;
-     bulkaddrs *addrsp;
+SVL_RegisterAddrs(struct rx_call *rxcall, afsUUID *uuidp, afs_int32 spare1,
+                 bulkaddrs *addrsp)
 {
     afs_int32 code;
     struct ubik_trans *trans;
@@ -1988,7 +1977,7 @@ SVL_RegisterAddrs(rxcall, uuidp, spare1, addrsp)
     COUNT_REQ(VLREGADDR);
     if (!afsconf_SuperUser(vldb_confdir, rxcall, NULL))
        return (VL_PERM);
-    if (code = Init_VLdbase(&trans, LOCKWRITE, this_op))
+    if ((code = Init_VLdbase(&trans, LOCKWRITE, this_op)))
        return code;
 
     /* Eliminate duplicates from IP address list */
@@ -2344,12 +2333,12 @@ SVL_RegisterAddrs(rxcall, uuidp, spare1, addrsp)
 }
 
 afs_int32
-SVL_GetAddrsU(rxcall, attributes, uuidpo, uniquifier, nentries, addrsp)
-     struct rx_call *rxcall;
-     struct ListAddrByAttributes *attributes;
-     afsUUID *uuidpo;
-     afs_int32 *uniquifier, *nentries;
-     bulkaddrs *addrsp;
+SVL_GetAddrsU(struct rx_call *rxcall,
+             struct ListAddrByAttributes *attributes,
+             afsUUID *uuidpo,
+             afs_int32 *uniquifier,
+             afs_int32 *nentries,
+             bulkaddrs *addrsp)
 {
     register afs_int32 errorcode, index = -1, offset;
     struct ubik_trans *trans;
@@ -2362,7 +2351,7 @@ SVL_GetAddrsU(rxcall, attributes, uuidpo, uniquifier, nentries, addrsp)
     addrsp->bulkaddrs_len = *nentries = 0;
     addrsp->bulkaddrs_val = 0;
     VLog(5, ("GetAddrsU %s\n", rxinfo(rxcall)));
-    if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
+    if ((errorcode = Init_VLdbase(&trans, LOCKREAD, this_op)))
        return errorcode;
 
     if (attributes->Mask & VLADDR_IPADDR) {
@@ -2425,8 +2414,8 @@ SVL_GetAddrsU(rxcall, attributes, uuidpo, uniquifier, nentries, addrsp)
            ubik_AbortTrans(trans);
            return VL_NOENT;
        }
-       if (errorcode =
-           FindExtentBlock(trans, &attributes->uuid, 0, -1, &exp, &base)) {
+       if ((errorcode =
+           FindExtentBlock(trans, &attributes->uuid, 0, -1, &exp, &base))) {
            ubik_AbortTrans(trans);
            return errorcode;
        }
@@ -2480,12 +2469,13 @@ SVL_GetAddrsU(rxcall, attributes, uuidpo, uniquifier, nentries, addrsp)
 
 /* Routine that copies the given vldb entry to the output buffer, vldbentries. */
 static int
-put_attributeentry(Vldbentry, VldbentryFirst, VldbentryLast, vldbentries,
-                  entry, nentries, alloccnt)
-     struct vldbentry **Vldbentry, **VldbentryFirst, **VldbentryLast;
-     bulkentries *vldbentries;
-     struct nvlentry *entry;
-     afs_int32 *nentries, *alloccnt;
+put_attributeentry(struct vldbentry **Vldbentry,
+                  struct vldbentry **VldbentryFirst,
+                  struct vldbentry **VldbentryLast,
+                  bulkentries *vldbentries,
+                  struct nvlentry *entry,
+                  afs_int32 *nentries,
+                  afs_int32 *alloccnt)
 {
     vldbentry *reall;
     afs_int32 allo;
@@ -2518,12 +2508,15 @@ put_attributeentry(Vldbentry, VldbentryFirst, VldbentryLast, vldbentries,
 }
 
 static int
-put_nattributeentry(Vldbentry, VldbentryFirst, VldbentryLast, vldbentries,
-                   entry, matchtype, matchindex, nentries, alloccnt)
-     struct nvldbentry **Vldbentry, **VldbentryFirst, **VldbentryLast;
-     nbulkentries *vldbentries;
-     struct nvlentry *entry;
-     afs_int32 matchtype, matchindex, *nentries, *alloccnt;
+put_nattributeentry(struct nvldbentry **Vldbentry,
+                   struct nvldbentry **VldbentryFirst,
+                   struct nvldbentry **VldbentryLast,
+                   nbulkentries *vldbentries,
+                   struct nvlentry *entry,
+                   afs_int32 matchtype,
+                   afs_int32 matchindex,
+                   afs_int32 *nentries,
+                   afs_int32 *alloccnt)
 {
     nvldbentry *reall;
     afs_int32 allo;
@@ -2559,24 +2552,20 @@ put_nattributeentry(Vldbentry, VldbentryFirst, VldbentryLast, vldbentries,
 
 /* Common code to actually remove a vldb entry from the database. */
 static int
-RemoveEntry(trans, entryptr, tentry)
-     struct ubik_trans *trans;
-     afs_int32 entryptr;
-     struct nvlentry *tentry;
+RemoveEntry(struct ubik_trans *trans, afs_int32 entryptr,
+           struct nvlentry *tentry)
 {
     register int errorcode;
 
-    if (errorcode = UnthreadVLentry(trans, entryptr, tentry))
+    if ((errorcode = UnthreadVLentry(trans, entryptr, tentry)))
        return errorcode;
-    if (errorcode = FreeBlock(trans, entryptr))
+    if ((errorcode = FreeBlock(trans, entryptr)))
        return errorcode;
     return 0;
 }
 
 static void
-ReleaseEntry(tentry, releasetype)
-     struct nvlentry *tentry;
-     afs_int32 releasetype;
+ReleaseEntry(struct nvlentry *tentry, afs_int32 releasetype)
 {
     if (releasetype & LOCKREL_TIMESTAMP)
        tentry->LockTimestamp = 0;
@@ -2587,10 +2576,10 @@ ReleaseEntry(tentry, releasetype)
 }
 
 
-/* Verify that the incoming vldb entry is valid; multi type of error codes are returned. */
+/* Verify that the incoming vldb entry is valid; multi type of error codes
+ * are returned. */
 static int
-check_vldbentry(aentry)
-     struct vldbentry *aentry;
+check_vldbentry(struct vldbentry *aentry)
 {
     afs_int32 i;
 
@@ -2612,8 +2601,7 @@ check_vldbentry(aentry)
 }
 
 static int
-check_nvldbentry(aentry)
-     struct nvldbentry *aentry;
+check_nvldbentry(struct nvldbentry *aentry)
 {
     afs_int32 i;
 
@@ -2638,10 +2626,9 @@ check_nvldbentry(aentry)
 /* Convert from the external vldb entry representation to its internal
    (more compact) form.  This call should not change the hash chains! */
 static int
-vldbentry_to_vlentry(atrans, VldbEntry, VlEntry)
-     struct ubik_trans *atrans;
-     struct vldbentry *VldbEntry;
-     struct nvlentry *VlEntry;
+vldbentry_to_vlentry(struct ubik_trans *atrans,
+                    struct vldbentry *VldbEntry,
+                    struct nvlentry *VlEntry)
 {
     int i, serverindex;
 
@@ -2666,10 +2653,9 @@ vldbentry_to_vlentry(atrans, VldbEntry, VlEntry)
 }
 
 static int
-nvldbentry_to_vlentry(atrans, VldbEntry, VlEntry)
-     struct ubik_trans *atrans;
-     struct nvldbentry *VldbEntry;
-     struct nvlentry *VlEntry;
+nvldbentry_to_vlentry(struct ubik_trans *atrans,
+                     struct nvldbentry *VldbEntry,
+                     struct nvlentry *VlEntry)
 {
     int i, serverindex;
 
@@ -2694,27 +2680,29 @@ nvldbentry_to_vlentry(atrans, VldbEntry, VlEntry)
 }
 
 
-/* Update the vldb entry with the new fields as indicated by the value of the Mask entry in the updateentry structure. All necessary validation checks are performed. */
-static
-get_vldbupdateentry(trans, blockindex, updateentry, VlEntry)
-     struct ubik_trans *trans;
-     afs_int32 blockindex;
-     struct VldbUpdateEntry *updateentry;
-     struct nvlentry *VlEntry;
+/* Update the vldb entry with the new fields as indicated by the value of
+ * the Mask entry in the updateentry structure. All necessary validation
+ * checks are performed.
+ */
+static int
+get_vldbupdateentry(struct ubik_trans *trans,
+                   afs_int32 blockindex,
+                   struct VldbUpdateEntry *updateentry,
+                   struct nvlentry *VlEntry)
 {
     int i, j, errorcode, serverindex;
 
     if (updateentry->Mask & VLUPDATE_VOLUMENAME) {
        if (InvalidVolname(updateentry->name))
            return VL_BADNAME;
-       if (errorcode = UnhashVolname(trans, blockindex, VlEntry))
+       if ((errorcode = UnhashVolname(trans, blockindex, VlEntry)))
            return errorcode;
        strncpy(VlEntry->name, updateentry->name, sizeof(VlEntry->name));
        HashVolname(trans, blockindex, VlEntry);
     }
 
     if (updateentry->Mask & VLUPDATE_VOLNAMEHASH) {
-       if (errorcode = UnhashVolname(trans, blockindex, VlEntry)) {
+       if ((errorcode = UnhashVolname(trans, blockindex, VlEntry))) {
            if (errorcode != VL_NOENT)
                return errorcode;
        }
@@ -2728,30 +2716,30 @@ get_vldbupdateentry(trans, blockindex, updateentry, VlEntry)
        VlEntry->cloneId = updateentry->cloneId;
     }
     if (updateentry->Mask & VLUPDATE_RWID) {
-       if (errorcode = UnhashVolid(trans, RWVOL, blockindex, VlEntry)) {
+       if ((errorcode = UnhashVolid(trans, RWVOL, blockindex, VlEntry))) {
            if (errorcode != VL_NOENT)
                return errorcode;
        }
        VlEntry->volumeId[RWVOL] = updateentry->spares3;        /* rw id */
-       if (errorcode = HashVolid(trans, RWVOL, blockindex, VlEntry))
+       if ((errorcode = HashVolid(trans, RWVOL, blockindex, VlEntry)))
            return errorcode;
     }
     if (updateentry->Mask & VLUPDATE_READONLYID) {
-       if (errorcode = UnhashVolid(trans, ROVOL, blockindex, VlEntry)) {
+       if ((errorcode = UnhashVolid(trans, ROVOL, blockindex, VlEntry))) {
            if (errorcode != VL_NOENT)
                return errorcode;
        }
        VlEntry->volumeId[ROVOL] = updateentry->ReadOnlyId;
-       if (errorcode = HashVolid(trans, ROVOL, blockindex, VlEntry))
+       if ((errorcode = HashVolid(trans, ROVOL, blockindex, VlEntry)))
            return errorcode;
     }
     if (updateentry->Mask & VLUPDATE_BACKUPID) {
-       if (errorcode = UnhashVolid(trans, BACKVOL, blockindex, VlEntry)) {
+       if ((errorcode = UnhashVolid(trans, BACKVOL, blockindex, VlEntry))) {
            if (errorcode != VL_NOENT)
                return errorcode;
        }
        VlEntry->volumeId[BACKVOL] = updateentry->BackupId;
-       if (errorcode = HashVolid(trans, BACKVOL, blockindex, VlEntry))
+       if ((errorcode = HashVolid(trans, BACKVOL, blockindex, VlEntry)))
            return errorcode;
     }
     if (updateentry->Mask & VLUPDATE_REPSITES) {
@@ -2858,11 +2846,11 @@ get_vldbupdateentry(trans, blockindex, updateentry, VlEntry)
 }
 
 
-/* Check if the specified [server,partition] entry is found in the vldb entry's repsite table; it's offset in the table is returned, if it's present there. */
+/* Check if the specified [server,partition] entry is found in the vldb
+ * entry's repsite table; it's offset in the table is returned, if it's
+ * present there. */
 static int
-repsite_exists(VlEntry, server, partition)
-     struct nvlentry *VlEntry;
-     int server, partition;
+repsite_exists(struct nvlentry *VlEntry, int server, int partition)
 {
     int i;
 
@@ -2877,11 +2865,10 @@ repsite_exists(VlEntry, server, partition)
 
 
 
-/* Repsite table compression: used when deleting a repsite entry so that all active repsite entries are on the top of the table. */
+/* Repsite table compression: used when deleting a repsite entry so that
+ * all active repsite entries are on the top of the table. */
 static void
-repsite_compress(VlEntry, offset)
-     struct nvlentry *VlEntry;
-     int offset;
+repsite_compress(struct nvlentry *VlEntry, int offset)
 {
     int repsite_offset = offset;
     for (;
@@ -2898,11 +2885,10 @@ repsite_compress(VlEntry, offset)
 }
 
 
-/* Convert from the internal (compacted) vldb entry to the external representation used by the interface. */
+/* Convert from the internal (compacted) vldb entry to the external
+ * representation used by the interface. */
 static void
-vlentry_to_vldbentry(VlEntry, VldbEntry)
-     struct nvlentry *VlEntry;
-     struct vldbentry *VldbEntry;
+vlentry_to_vldbentry(struct nvlentry *VlEntry, struct vldbentry *VldbEntry)
 {
     int i, j;
 
@@ -2940,11 +2926,10 @@ vlentry_to_vldbentry(VlEntry, VldbEntry)
 }
 
 
-/* Convert from the internal (compacted) vldb entry to the external representation used by the interface. */
+/* Convert from the internal (compacted) vldb entry to the external
+ * representation used by the interface. */
 static void
-vlentry_to_nvldbentry(VlEntry, VldbEntry)
-     struct nvlentry *VlEntry;
-     struct nvldbentry *VldbEntry;
+vlentry_to_nvldbentry(struct nvlentry *VlEntry, struct nvldbentry *VldbEntry)
 {
     int i, j;
 
@@ -2982,9 +2967,7 @@ vlentry_to_nvldbentry(VlEntry, VldbEntry)
 }
 
 static void
-vlentry_to_uvldbentry(VlEntry, VldbEntry)
-     struct nvlentry *VlEntry;
-     struct uvldbentry *VldbEntry;
+vlentry_to_uvldbentry(struct nvlentry *VlEntry, struct uvldbentry *VldbEntry)
 {
     int i, j;
 
@@ -3028,8 +3011,7 @@ vlentry_to_uvldbentry(VlEntry, VldbEntry)
 
 /* Verify that the volname is a valid volume name. */
 static int
-InvalidVolname(volname)
-     char *volname;
+InvalidVolname(char *volname)
 {
     char *map;
     int slen;
@@ -3044,8 +3026,7 @@ InvalidVolname(volname)
 
 /* Verify that the given volume type is valid. */
 static int
-InvalidVoltype(voltype)
-     afs_int32 voltype;
+InvalidVoltype(afs_int32 voltype)
 {
     if (voltype != RWVOL && voltype != ROVOL && voltype != BACKVOL)
        return 1;
@@ -3054,8 +3035,7 @@ InvalidVoltype(voltype)
 
 
 static int
-InvalidOperation(voloper)
-     afs_int32 voloper;
+InvalidOperation(afs_int32 voloper)
 {
     if (voloper != VLOP_MOVE && voloper != VLOP_RELEASE
        && voloper != VLOP_BACKUP && voloper != VLOP_DELETE
@@ -3065,8 +3045,7 @@ InvalidOperation(voloper)
 }
 
 static int
-InvalidReleasetype(releasetype)
-     afs_int32 releasetype;
+InvalidReleasetype(afs_int32 releasetype)
 {
     if ((releasetype & LOCKREL_TIMESTAMP) || (releasetype & LOCKREL_OPCODE)
        || (releasetype & LOCKREL_AFSID))
@@ -3075,9 +3054,7 @@ InvalidReleasetype(releasetype)
 }
 
 static int
-IpAddrToRelAddr(ipaddr, atrans)
-     struct ubik_trans *atrans;
-     register afs_uint32 ipaddr;
+IpAddrToRelAddr(register afs_uint32 ipaddr, struct ubik_trans *atrans)
 {
     register int i, j;
     register afs_int32 code, base, index;
@@ -3137,9 +3114,7 @@ IpAddrToRelAddr(ipaddr, atrans)
 }
 
 static int
-ChangeIPAddr(ipaddr1, ipaddr2, atrans)
-     struct ubik_trans *atrans;
-     register afs_uint32 ipaddr1, ipaddr2;
+ChangeIPAddr(afs_uint32 ipaddr1, afs_uint32 ipaddr2, struct ubik_trans *atrans)
 {
     int i, j;
     afs_int32 code;
@@ -3276,8 +3251,7 @@ ChangeIPAddr(ipaddr1, ipaddr2, atrans)
 
 /* see if the vlserver is back yet */
 afs_int32
-SVL_ProbeServer(rxcall)
-     struct rx_call *rxcall;
+SVL_ProbeServer(struct rx_call *rxcall)
 {
     return 0;
 }
index ebe769b..19f80f7 100644 (file)
 #include <rx/xdr.h>
 #include <rx/rx.h>
 #include <rx/rx_globals.h>
+#include <rx/rxstat.h>
+#include <rx/rxstat_prototypes.h>
 #include <afs/cellconfig.h>
 #include <afs/keys.h>
 #include <afs/auth.h>
+#include <afs/audit.h>
 #include <lock.h>
 #include <ubik.h>
 #include <afs/afsutil.h>
 #include "vlserver.h"
-
+#include "vlserver_internal.h"
 
 #define MAXLWP 16
 const char *vl_dbaseName;
@@ -55,8 +58,6 @@ int lwps = 9;
 struct vldstats dynamic_statistics;
 struct ubik_dbase *VL_dbase;
 afs_uint32 HostAddress[MAXSERVERID + 1];
-extern int afsconf_CheckAuth();
-extern int afsconf_ServerAuth();
 
 static void *CheckSignal(void*);
 int LogLevel = 0;
@@ -71,7 +72,7 @@ int debuglevel = 0;
 afs_uint32 SHostAddrs[ADDRSPERSITE];
 
 static void
-CheckSignal_Signal()
+CheckSignal_Signal(int unused)
 {
 #if defined(AFS_PTHREAD_ENV)
     CheckSignal(0);
@@ -86,8 +87,8 @@ CheckSignal(void *unused)
     register int i, errorcode;
     struct ubik_trans *trans;
 
-    if (errorcode =
-       Init_VLdbase(&trans, LOCKREAD, VLGETSTATS - VL_LOWEST_OPCODE))
+    if ((errorcode =
+       Init_VLdbase(&trans, LOCKREAD, VLGETSTATS - VL_LOWEST_OPCODE)))
        return (void *)errorcode;
     VLog(0, ("Dump name hash table out\n"));
     for (i = 0; i < HASHSIZE; i++) {
@@ -103,7 +104,7 @@ CheckSignal(void *unused)
 
 /* Initialize the stats for the opcodes */
 void
-initialize_dstats()
+initialize_dstats(void)
 {
     int i;
 
@@ -116,8 +117,7 @@ initialize_dstats()
 
 /* check whether caller is authorized to manage RX statistics */
 int
-vldb_rxstat_userok(call)
-     struct rx_call *call;
+vldb_rxstat_userok(struct rx_call *call)
 {
     return afsconf_SuperUser(vldb_confdir, call, NULL);
 }
@@ -126,23 +126,19 @@ vldb_rxstat_userok(call)
 
 #include "AFS_component_version_number.c"
 
-main(argc, argv)
-     int argc;
-     char **argv;
+int
+main(int argc, char **argv)
 {
     register afs_int32 code;
     afs_int32 myHost;
     struct rx_service *tservice;
     struct rx_securityClass *sc[3];
-    extern int VL_ExecuteRequest();
-    extern int RXSTATS_ExecuteRequest();
     struct afsconf_dir *tdir;
     struct ktc_encryptionKey tkey;
     struct afsconf_cell info;
     struct hostent *th;
     char hostname[VL_MAXNAMELEN];
     int noAuth = 0, index, i;
-    extern int rx_extraPackets;
     char commandLine[150];
     char clones[MAXHOSTSPERCELL];
     afs_uint32 host = ntohl(INADDR_ANY);
diff --git a/src/vlserver/vlserver_internal.h b/src/vlserver/vlserver_internal.h
new file mode 100644 (file)
index 0000000..f5dc823
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2000, International Business Machines Corporation and others.
+ * All Rights Reserved.
+ *
+ * This software has been released under the terms of the IBM Public
+ * License.  For details, see the LICENSE file in the top-level source
+ * directory or online at http://www.openafs.org/dl/license10.html
+ */
+
+#ifndef _VLSERVER_INTERNAL_H
+#define _VLSERVER_INTERNAL_H
+
+/* vldbinit.ss.c */
+extern int VL_ExecuteRequest(struct rx_call *z_call);
+
+/* vlprocs.c */
+extern int Init_VLdbase(struct ubik_trans **trans, int locktype, int this_op);
+
+/* vlutils.c */
+extern afs_int32 vlwrite(struct ubik_trans *trans, afs_int32 offset,
+                        void *buffer, afs_int32 length);
+extern afs_int32 vlentrywrite(struct ubik_trans *trans, afs_int32 offset,
+                             void *buffer, afs_int32 length);
+extern int write_vital_vlheader(register struct ubik_trans *trans);
+extern afs_int32 readExtents(struct ubik_trans *trans);
+extern afs_int32 CheckInit(struct ubik_trans *trans, int builddb);
+extern afs_int32 AllocBlock(register struct ubik_trans *trans,
+                           struct nvlentry *tentry);
+extern afs_int32 FindExtentBlock(struct ubik_trans *trans, afsUUID *uuidp,
+                                afs_int32 createit, afs_int32 hostslot,
+                                struct extentaddr **expp, afs_int32 *basep);
+extern afs_int32 FindByID(struct ubik_trans *trans, afs_uint32 volid,
+                         afs_int32 voltype, struct nvlentry *tentry,
+                         afs_int32 *error);
+extern afs_int32 FindByName(struct ubik_trans *trans, char *volname,
+                           struct nvlentry *tentry, afs_int32 *error);
+extern int HashNDump(struct ubik_trans *trans, int hashindex);
+extern int HashIdDump(struct ubik_trans *trans, int hashindex);
+extern int ThreadVLentry(struct ubik_trans *trans, afs_int32 blockindex,
+                         struct nvlentry *tentry);
+extern int UnthreadVLentry(struct ubik_trans *trans, afs_int32 blockindex,
+                        struct nvlentry *aentry);
+extern int HashVolid(struct ubik_trans *trans, afs_int32 voltype,
+                    afs_int32 blockindex, struct nvlentry *tentry);
+extern int UnhashVolid(struct ubik_trans *trans, afs_int32 voltype,
+                      afs_int32 blockindex, struct nvlentry *aentry);
+extern int HashVolname(struct ubik_trans *trans, afs_int32 blockindex,
+                      struct nvlentry *aentry);
+extern int UnhashVolname(struct ubik_trans *trans, afs_int32 blockindex,
+                        struct nvlentry *aentry);
+extern afs_int32 NextEntry(struct ubik_trans *trans, afs_int32 blockindex,
+                          struct nvlentry *tentry, afs_int32 *remaining);
+#endif
index fdfea34..5373140 100644 (file)
@@ -23,6 +23,7 @@
 #include <rx/xdr.h>
 #include <ubik.h>
 #include "vlserver.h"
+#include "vlserver_internal.h"
 
 extern struct vlheader cheader;
 struct vlheader xheader;
@@ -32,14 +33,13 @@ struct extentaddr extentaddr;
 extern struct extentaddr *ex_addr[];
 int vldbversion = 0;
 
-static int index_OK();
+static int index_OK(struct ubik_trans *trans, afs_int32 blockindex);
 
 #define ERROR_EXIT(code) {error=(code); goto error_exit;}
 
 /* Hashing algorithm based on the volume id; HASHSIZE must be prime */
 afs_int32
-IDHash(volumeid)
-     afs_int32 volumeid;
+IDHash(afs_int32 volumeid)
 {
     return ((abs(volumeid)) % HASHSIZE);
 }
@@ -47,8 +47,7 @@ IDHash(volumeid)
 
 /* Hashing algorithm based on the volume name; name's size is implicit (64 chars) and if changed it should be reflected here. */
 afs_int32
-NameHash(volumename)
-     register char *volumename;
+NameHash(register char *volumename)
 {
     register unsigned int hash;
     register int i;
@@ -62,15 +61,12 @@ NameHash(volumename)
 
 /* package up seek and write into one procedure for ease of use */
 afs_int32
-vlwrite(trans, offset, buffer, length)
-     struct ubik_trans *trans;
-     afs_int32 offset;
-     char *buffer;
-     afs_int32 length;
+vlwrite(struct ubik_trans *trans, afs_int32 offset, void *buffer,
+       afs_int32 length)
 {
     afs_int32 errorcode;
 
-    if (errorcode = ubik_Seek(trans, 0, offset))
+    if ((errorcode = ubik_Seek(trans, 0, offset)))
        return errorcode;
     return (ubik_Write(trans, buffer, length));
 }
@@ -78,15 +74,12 @@ vlwrite(trans, offset, buffer, length)
 
 /* Package up seek and read into one procedure for ease of use */
 afs_int32
-vlread(trans, offset, buffer, length)
-     struct ubik_trans *trans;
-     afs_int32 offset;
-     char *buffer;
-     afs_int32 length;
+vlread(struct ubik_trans *trans, afs_int32 offset, char *buffer,
+       afs_int32 length)
 {
     afs_int32 errorcode;
 
-    if (errorcode = ubik_Seek(trans, 0, offset))
+    if ((errorcode = ubik_Seek(trans, 0, offset)))
        return errorcode;
     return (ubik_Read(trans, buffer, length));
 }
@@ -94,11 +87,8 @@ vlread(trans, offset, buffer, length)
 
 /* take entry and convert to network order and write to disk */
 afs_int32
-vlentrywrite(trans, offset, buffer, length)
-     struct ubik_trans *trans;
-     afs_int32 offset;
-     char *buffer;
-     afs_int32 length;
+vlentrywrite(struct ubik_trans *trans, afs_int32 offset, void *buffer,
+            afs_int32 length)
 {
     struct vlentry oentry;
     struct nvlentry nentry, *nep;
@@ -146,11 +136,8 @@ vlentrywrite(trans, offset, buffer, length)
 
 /* read entry and convert to host order and write to disk */
 afs_int32
-vlentryread(trans, offset, buffer, length)
-     struct ubik_trans *trans;
-     afs_int32 offset;
-     char *buffer;
-     afs_int32 length;
+vlentryread(struct ubik_trans *trans, afs_int32 offset, char *buffer,
+           afs_int32 length)
 {
     struct vlentry *oep, tentry;
     struct nvlentry *nep, *nbufp;
@@ -201,8 +188,7 @@ vlentryread(trans, offset, buffer, length)
 
 /* Convenient write of small critical vldb header info to the database. */
 int
-write_vital_vlheader(trans)
-     register struct ubik_trans *trans;
+write_vital_vlheader(register struct ubik_trans *trans)
 {
     if (vlwrite
        (trans, 0, (char *)&cheader.vital_header, sizeof(vital_vlheader)))
@@ -222,8 +208,7 @@ int extent_mod = 0;
  * (extent_mod tells us the on-disk copy is bad).
  */
 afs_int32
-readExtents(trans)
-     struct ubik_trans *trans;
+readExtents(struct ubik_trans *trans)
 {
     afs_uint32 extentAddr;
     afs_int32 error = 0, code;
@@ -306,9 +291,7 @@ readExtents(trans)
 /* Check that the database has been initialized.  Be careful to fail in a safe
    manner, to avoid bogusly reinitializing the db.  */
 afs_int32
-CheckInit(trans, builddb)
-     struct ubik_trans *trans;
-     int builddb;
+CheckInit(struct ubik_trans *trans, int builddb)
 {
     afs_int32 error = 0, i, code, ubcode = 0;
 
@@ -379,9 +362,7 @@ CheckInit(trans, builddb)
 
 
 afs_int32
-GetExtentBlock(trans, base)
-     register struct ubik_trans *trans;
-     register afs_int32 base;
+GetExtentBlock(register struct ubik_trans *trans, register afs_int32 base)
 {
     afs_int32 blockindex, code, error = 0;
 
@@ -439,11 +420,9 @@ GetExtentBlock(trans, base)
 
 
 afs_int32
-FindExtentBlock(trans, uuidp, createit, hostslot, expp, basep)
-     register struct ubik_trans *trans;
-     afsUUID *uuidp;
-     afs_int32 createit, hostslot, *basep;
-     struct extentaddr **expp;
+FindExtentBlock(register struct ubik_trans *trans, afsUUID *uuidp,
+               afs_int32 createit, afs_int32 hostslot,
+               struct extentaddr **expp, afs_int32 *basep)
 {
     afsUUID tuuid;
     struct extentaddr *exp;
@@ -545,9 +524,7 @@ FindExtentBlock(trans, uuidp, createit, hostslot, expp, basep)
 /* Allocate a free block of storage for entry, returning address of a new
    zeroed entry (or zero if something is wrong).  */
 afs_int32
-AllocBlock(trans, tentry)
-     register struct ubik_trans *trans;
-     struct nvlentry *tentry;
+AllocBlock(register struct ubik_trans *trans, struct nvlentry *tentry)
 {
     register afs_int32 blockindex;
 
@@ -572,9 +549,7 @@ AllocBlock(trans, tentry)
 
 /* Free a block given its index.  It must already have been unthreaded. Returns zero for success or an error code on failure. */
 int
-FreeBlock(trans, blockindex)
-     struct ubik_trans *trans;
-     afs_int32 blockindex;
+FreeBlock(struct ubik_trans *trans, afs_int32 blockindex)
 {
     struct nvlentry tentry;
 
@@ -594,14 +569,14 @@ FreeBlock(trans, blockindex)
 }
 
 
-/* Look for a block by volid and voltype (if not known use -1 which searches all 3 volid hash lists. Note that the linked lists are read in first from the database header.  If found read the block's contents into the area pointed to by tentry and return the block's index.  If not found return 0. */
+/* Look for a block by volid and voltype (if not known use -1 which searches
+ * all 3 volid hash lists. Note that the linked lists are read in first from
+ * the database header.  If found read the block's contents into the area
+ * pointed to by tentry and return the block's index.  If not found return 0.
+ */
 afs_int32
-FindByID(trans, volid, voltype, tentry, error)
-     struct ubik_trans *trans;
-     afs_uint32 volid;
-     afs_int32 voltype;
-     struct nvlentry *tentry;
-     afs_int32 *error;
+FindByID(struct ubik_trans *trans, afs_uint32 volid, afs_int32 voltype,
+        struct nvlentry *tentry, afs_int32 *error)
 {
     register afs_int32 typeindex, hashindex, blockindex;
 
@@ -638,19 +613,21 @@ FindByID(trans, volid, voltype, tentry, error)
 }
 
 
-/* Look for a block by volume name. If found read the block's contents into the area pointed to by tentry and return the block's index.  If not found return 0. */
+/* Look for a block by volume name. If found read the block's contents into
+ * the area pointed to by tentry and return the block's index.  If not
+ * found return 0.
+ */
 afs_int32
-FindByName(trans, volname, tentry, error)
-     struct ubik_trans *trans;
-     char *volname;
-     struct nvlentry *tentry;
-     afs_int32 *error;
+FindByName(struct ubik_trans *trans, char *volname, struct nvlentry *tentry,
+          afs_int32 *error)
 {
     register afs_int32 hashindex;
     register afs_int32 blockindex;
     char tname[VL_MAXNAMELEN];
 
-    /* remove .backup or .readonly extensions for stupid backwards compatibility */
+    /* remove .backup or .readonly extensions for stupid backwards
+     * compatibility
+     */
     hashindex = strlen(volname);       /* really string length */
     if (hashindex >= 8 && strcmp(volname + hashindex - 7, ".backup") == 0) {
        /* this is a backup volume */
@@ -679,10 +656,7 @@ FindByName(trans, volname, tentry, error)
 }
 
 int
-HashNDump(trans, hashindex)
-     struct ubik_trans *trans;
-     int hashindex;
-
+HashNDump(struct ubik_trans *trans, int hashindex)
 {
     register int i = 0;
     register int blockindex;
@@ -702,10 +676,7 @@ HashNDump(trans, hashindex)
 
 
 int
-HashIdDump(trans, hashindex)
-     struct ubik_trans *trans;
-     int hashindex;
-
+HashIdDump(struct ubik_trans *trans, int hashindex)
 {
     register int i = 0;
     register int blockindex;
@@ -724,28 +695,31 @@ HashIdDump(trans, hashindex)
 }
 
 
-/* Add a block to the hash table given a pointer to the block and its index. The block is threaded onto both hash tables and written to disk.  The routine returns zero if there were no errors. */
+/* Add a block to the hash table given a pointer to the block and its index.
+ * The block is threaded onto both hash tables and written to disk.  The
+ * routine returns zero if there were no errors.
+ */
 int
-ThreadVLentry(trans, blockindex, tentry)
-     struct ubik_trans *trans;
-     afs_int32 blockindex;
-     struct nvlentry *tentry;
+ThreadVLentry(struct ubik_trans *trans, afs_int32 blockindex,
+             struct nvlentry *tentry)
 {
     int errorcode;
 
     if (!index_OK(trans, blockindex))
        return VL_BADINDEX;
     /* Insert into volid's hash linked list */
-    if (errorcode = HashVolid(trans, RWVOL, blockindex, tentry))
+    if ((errorcode = HashVolid(trans, RWVOL, blockindex, tentry)))
        return errorcode;
 
-    /* For rw entries we also enter the RO and BACK volume ids (if they exist) in the hash tables; note all there volids (RW, RO, BACK) should not be hashed yet! */
+    /* For rw entries we also enter the RO and BACK volume ids (if they
+     * exist) in the hash tables; note all there volids (RW, RO, BACK)
+     * should not be hashed yet! */
     if (tentry->volumeId[ROVOL]) {
-       if (errorcode = HashVolid(trans, ROVOL, blockindex, tentry))
+       if ((errorcode = HashVolid(trans, ROVOL, blockindex, tentry)))
            return errorcode;
     }
     if (tentry->volumeId[BACKVOL]) {
-       if (errorcode = HashVolid(trans, BACKVOL, blockindex, tentry))
+       if ((errorcode = HashVolid(trans, BACKVOL, blockindex, tentry)))
            return errorcode;
     }
 
@@ -763,28 +737,27 @@ ThreadVLentry(trans, blockindex, tentry)
 }
 
 
-/* Remove a block from both the hash tables.  If success return 0, else return an error code. */
+/* Remove a block from both the hash tables.  If success return 0, else
+ * return an error code. */
 int
-UnthreadVLentry(trans, blockindex, aentry)
-     struct ubik_trans *trans;
-     afs_int32 blockindex;
-     struct nvlentry *aentry;
+UnthreadVLentry(struct ubik_trans *trans, afs_int32 blockindex,
+               struct nvlentry *aentry)
 {
     register afs_int32 errorcode, typeindex;
 
     if (!index_OK(trans, blockindex))
        return VL_BADINDEX;
-    if (errorcode = UnhashVolid(trans, RWVOL, blockindex, aentry))
+    if ((errorcode = UnhashVolid(trans, RWVOL, blockindex, aentry)))
        return errorcode;
 
     /* Take the RO/RW entries of their respective hash linked lists. */
     for (typeindex = ROVOL; typeindex <= BACKVOL; typeindex++) {
-       if (errorcode = UnhashVolid(trans, typeindex, blockindex, aentry))
+       if ((errorcode = UnhashVolid(trans, typeindex, blockindex, aentry)))
            return errorcode;
     }
 
     /* Take it out of the Volname hash list */
-    if (errorcode = UnhashVolname(trans, blockindex, aentry))
+    if ((errorcode = UnhashVolname(trans, blockindex, aentry)))
        return errorcode;
 
     /* Update cheader entry */
@@ -795,14 +768,11 @@ UnthreadVLentry(trans, blockindex, aentry)
 
 /* cheader must have be read before this routine is called. */
 int
-HashVolid(trans, voltype, blockindex, tentry)
-     struct ubik_trans *trans;
-     afs_int32 voltype;
-     afs_int32 blockindex;
-     struct nvlentry *tentry;
+HashVolid(struct ubik_trans *trans, afs_int32 voltype, afs_int32 blockindex,
+          struct nvlentry *tentry)
 {
     afs_int32 hashindex, errorcode;
-    struct vlentry ventry;
+    struct nvlentry ventry;
 
     if (FindByID
        (trans, tentry->volumeId[voltype], voltype, &ventry, &errorcode))
@@ -823,11 +793,8 @@ HashVolid(trans, voltype, blockindex, tentry)
 
 /* cheader must have be read before this routine is called. */
 int
-UnhashVolid(trans, voltype, blockindex, aentry)
-     struct ubik_trans *trans;
-     afs_int32 voltype;
-     afs_int32 blockindex;
-     struct nvlentry *aentry;
+UnhashVolid(struct ubik_trans *trans, afs_int32 voltype, afs_int32 blockindex,
+           struct nvlentry *aentry)
 {
     int hashindex, nextblockindex, prevblockindex;
     struct nvlentry tentry;
@@ -874,10 +841,8 @@ UnhashVolid(trans, voltype, blockindex, aentry)
 
 
 int
-HashVolname(trans, blockindex, aentry)
-     struct ubik_trans *trans;
-     afs_int32 blockindex;
-     struct nvlentry *aentry;
+HashVolname(struct ubik_trans *trans, afs_int32 blockindex,
+           struct nvlentry *aentry)
 {
     register afs_int32 hashindex;
     register afs_int32 code;
@@ -896,10 +861,8 @@ HashVolname(trans, blockindex, aentry)
 
 
 int
-UnhashVolname(trans, blockindex, aentry)
-     struct ubik_trans *trans;
-     afs_int32 blockindex;
-     struct nvlentry *aentry;
+UnhashVolname(struct ubik_trans *trans, afs_int32 blockindex,
+             struct nvlentry *aentry)
 {
     register afs_int32 hashindex, nextblockindex, prevblockindex;
     struct nvlentry tentry;
@@ -936,14 +899,14 @@ UnhashVolname(trans, blockindex, aentry)
 }
 
 
-/* Returns the vldb entry tentry at offset index; remaining is the number of entries left; the routine also returns the index of the next sequential entry in the vldb */
+/* Returns the vldb entry tentry at offset index; remaining is the number of
+ * entries left; the routine also returns the index of the next sequential
+ * entry in the vldb
+ */
 
 afs_int32
-NextEntry(trans, blockindex, tentry, remaining)
-     struct ubik_trans *trans;
-     afs_int32 blockindex;
-     struct nvlentry *tentry;
-     afs_int32 *remaining;
+NextEntry(struct ubik_trans *trans, afs_int32 blockindex,
+         struct nvlentry *tentry, afs_int32 *remaining)
 {
     register afs_int32 lastblockindex;
 
@@ -983,11 +946,11 @@ NextEntry(trans, blockindex, tentry, remaining)
 }
 
 
-/* Routine to verify that index is a legal offset to a vldb entry in the table */
+/* Routine to verify that index is a legal offset to a vldb entry in the
+ * table
+ */
 static int
-index_OK(trans, blockindex)
-     struct ubik_trans *trans;
-     afs_int32 blockindex;
+index_OK(struct ubik_trans *trans, afs_int32 blockindex)
 {
     if ((blockindex < sizeof(cheader))
        || (blockindex >= ntohl(cheader.vital_header.eofPtr)))