Fix some of the fallout from having rxgen-fabricated prototypes.
[openafs.git] / src / vlserver / vlprocs.c
index 605e48c..bcd35bf 100644 (file)
@@ -7,8 +7,8 @@
  * directory or online at http://www.openafs.org/dl/license10.html
  */
 
-#include <afs/param.h>
 #include <afsconfig.h>
+#include <afs/param.h>
 
 RCSID("$Header$");
 
@@ -148,7 +148,7 @@ int Init_VLdbase (trans, locktype, this_op)
 
 /* Create a new vldb entry; both new volume id and name must be unique (non-existant in vldb). */
 
-VL_CreateEntry(rxcall, newentry)
+SVL_CreateEntry(rxcall, newentry)
   struct rx_call       *rxcall;
   struct vldbentry     *newentry;
 {   struct ubik_trans  *trans;
@@ -192,7 +192,7 @@ VL_CreateEntry(rxcall, newentry)
       goto abort;
     }
 
-    bzero(&tentry, sizeof(struct nvlentry));
+    memset(&tentry, 0, sizeof(struct nvlentry));
     /* Convert to its internal representation; both in host byte order */
     if (errorcode = vldbentry_to_vlentry(trans, newentry, &tentry))    {  
        FreeBlock(trans, blockindex);
@@ -221,7 +221,7 @@ VL_CreateEntry(rxcall, newentry)
 }
 
 
-VL_CreateEntryN(rxcall, newentry)
+SVL_CreateEntryN(rxcall, newentry)
   struct rx_call       *rxcall;
   struct nvldbentry    *newentry;
 {   struct ubik_trans  *trans;
@@ -265,7 +265,7 @@ VL_CreateEntryN(rxcall, newentry)
       goto abort;
     }
 
-    bzero(&tentry, sizeof(struct nvlentry));
+    memset(&tentry, 0, sizeof(struct nvlentry));
     /* Convert to its internal representation; both in host byte order */
     if (errorcode = nvldbentry_to_vlentry(trans, newentry, &tentry))   {  
        FreeBlock(trans, blockindex);
@@ -294,12 +294,11 @@ VL_CreateEntryN(rxcall, newentry)
 }
 
 
-VL_ChangeAddr(rxcall, ip1, ip2)
+SVL_ChangeAddr(rxcall, ip1, ip2)
   struct rx_call       *rxcall;
   afs_int32 ip1, ip2;
 {   struct ubik_trans  *trans;
-    afs_int32          errorcode, blockindex;
-    struct nvlentry    tentry;
+    afs_int32          errorcode;
 
     COUNT_REQ (VLCHANGEADDR);
     if (!afsconf_SuperUser(vldb_confdir, rxcall, (char *)0)) {
@@ -329,7 +328,7 @@ VL_ChangeAddr(rxcall, ip1, ip2)
 }
 
 /* Delete a vldb entry given the volume id. */
-VL_DeleteEntry(rxcall, volid, voltype)
+SVL_DeleteEntry(rxcall, volid, voltype)
   struct rx_call       *rxcall;
   afs_int32                    volid;
   afs_int32                    voltype;
@@ -411,7 +410,7 @@ GetEntryByID (rxcall, volid, voltype, aentry, new, this_op)
     return(ubik_EndTrans(trans));
 }
 
-VL_GetEntryByID (rxcall, volid, voltype, aentry)
+SVL_GetEntryByID (rxcall, volid, voltype, aentry)
   struct rx_call       *rxcall;
   afs_int32                    volid, voltype;
   vldbentry            *aentry;                /* entry data copied here */
@@ -420,7 +419,7 @@ VL_GetEntryByID (rxcall, volid, voltype, aentry)
     return (GetEntryByID(rxcall, volid, voltype, (char *)aentry, 0, this_op));
 }
 
-VL_GetEntryByIDN (rxcall, volid, voltype, aentry)
+SVL_GetEntryByIDN (rxcall, volid, voltype, aentry)
   struct rx_call       *rxcall;
   afs_int32                    volid, voltype;
   nvldbentry           *aentry;                /* entry data copied here */
@@ -429,7 +428,7 @@ VL_GetEntryByIDN (rxcall, volid, voltype, aentry)
     return (GetEntryByID(rxcall, volid, voltype, (char *)aentry, 1, this_op));
 }
 
-VL_GetEntryByIDU (rxcall, volid, voltype, aentry)
+SVL_GetEntryByIDU (rxcall, volid, voltype, aentry)
   struct rx_call       *rxcall;
   afs_int32                    volid, voltype;
   uvldbentry           *aentry;                /* entry data copied here */
@@ -491,7 +490,7 @@ GetEntryByName (rxcall, volname, aentry, new, this_op)
     return(ubik_EndTrans(trans));
 }
 
-VL_GetEntryByNameO (rxcall, volname, aentry)
+SVL_GetEntryByNameO (rxcall, volname, aentry)
   struct rx_call       *rxcall;
   char                 *volname;
   struct vldbentry     *aentry;                /* entry data copied here */
@@ -501,7 +500,7 @@ VL_GetEntryByNameO (rxcall, volname, aentry)
 }
 
 
-VL_GetEntryByNameN (rxcall, volname, aentry)
+SVL_GetEntryByNameN (rxcall, volname, aentry)
   struct rx_call       *rxcall;
   char                 *volname;
   struct nvldbentry    *aentry;                /* entry data copied here */
@@ -510,7 +509,7 @@ VL_GetEntryByNameN (rxcall, volname, aentry)
     return (GetEntryByName(rxcall, volname, (char *)aentry, 1, this_op));
 }
 
-VL_GetEntryByNameU (rxcall, volname, aentry)
+SVL_GetEntryByNameU (rxcall, volname, aentry)
   struct rx_call       *rxcall;
   char                 *volname;
   struct uvldbentry    *aentry;                /* entry data copied here */
@@ -522,7 +521,7 @@ VL_GetEntryByNameU (rxcall, volname, aentry)
 
 
 /* Get the current value of the maximum volume id and bump the volume id counter by Maxvolidbump. */
-VL_GetNewVolumeId (rxcall, Maxvolidbump, newvolumeid)
+SVL_GetNewVolumeId (rxcall, Maxvolidbump, newvolumeid)
 struct rx_call         *rxcall;
 afs_int32                      Maxvolidbump;
 afs_int32                      *newvolumeid;
@@ -563,7 +562,7 @@ afs_int32                   *newvolumeid;
  * newentry. No individual checking/updating per field (alike
  * VLUpdateEntry) is done. */
 
-VL_ReplaceEntry (rxcall, volid, voltype, newentry, releasetype)
+SVL_ReplaceEntry (rxcall, volid, voltype, newentry, releasetype)
 struct rx_call         *rxcall;
 afs_int32                      volid;
 afs_int32                      voltype;
@@ -663,7 +662,7 @@ afs_int32                   releasetype;
     return errorcode;
 }
 
-VL_ReplaceEntryN (rxcall, volid, voltype, newentry, releasetype)
+SVL_ReplaceEntryN (rxcall, volid, voltype, newentry, releasetype)
 struct rx_call         *rxcall;
 afs_int32                      volid;
 afs_int32                      voltype;
@@ -766,7 +765,7 @@ afs_int32                   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 */
-VL_UpdateEntry (rxcall, volid, voltype, updateentry, releasetype)
+SVL_UpdateEntry (rxcall, volid, voltype, updateentry, releasetype)
   struct rx_call           *rxcall;
   afs_int32                        volid;
   afs_int32                        voltype;
@@ -814,7 +813,7 @@ VL_UpdateEntry (rxcall, volid, voltype, updateentry, releasetype)
 }
 
 
-VL_UpdateEntryByName (rxcall, volname, updateentry, releasetype)
+SVL_UpdateEntryByName (rxcall, volname, updateentry, releasetype)
   struct rx_call           *rxcall;
   char                     *volname;
   afs_int32                        releasetype;
@@ -859,7 +858,7 @@ VL_UpdateEntryByName (rxcall, volname, updateentry, releasetype)
 
 
 /* Set a lock to the vldb entry for volid (of type voltype if not -1). */
-VL_SetLock (rxcall, volid, voltype, voloper)
+SVL_SetLock (rxcall, volid, voltype, voloper)
 struct rx_call         *rxcall;
 afs_int32                      volid;
 afs_int32                      voltype;
@@ -925,7 +924,7 @@ afs_int32                   voloper;
  * fields (afsid and/or volume operation) will be cleared along with
  * the lock time stamp. */
 
-VL_ReleaseLock (rxcall, volid, voltype, releasetype)
+SVL_ReleaseLock (rxcall, volid, voltype, releasetype)
 struct rx_call         *rxcall;
 afs_int32                      volid;
 afs_int32                      voltype;
@@ -971,7 +970,7 @@ afs_int32                   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. */
-VL_ListEntry (rxcall, previous_index, count, next_index, aentry)
+SVL_ListEntry (rxcall, previous_index, count, next_index, aentry)
 struct rx_call         *rxcall;
 afs_int32                      previous_index;
 afs_int32                      *count;
@@ -992,7 +991,7 @@ struct vldbentry    *aentry;
 }
 
 /* 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. */
-VL_ListEntryN (rxcall, previous_index, count, next_index, aentry)
+SVL_ListEntryN (rxcall, previous_index, count, next_index, aentry)
 struct rx_call         *rxcall;
 afs_int32                      previous_index;
 afs_int32                      *count;
@@ -1014,7 +1013,7 @@ struct nvldbentry *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. */
-VL_ListAttributes(rxcall, attributes, nentries, vldbentries)
+SVL_ListAttributes(rxcall, attributes, nentries, vldbentries)
 struct rx_call             *rxcall;
 struct VldbListByAttributes *attributes;
 afs_int32                          *nentries;
@@ -1040,8 +1039,7 @@ bulkentries                   *vldbentries;
     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!) */
     if (attributes->Mask & VLLIST_VOLUMEID) {
-       afs_int32       blockindex, chain;
-       struct nvlentry tempentry;
+       afs_int32       blockindex;
 
        blockindex = FindByID(trans, attributes->volumeid, -1, &tentry, &errorcode);
        if (blockindex == 0) {
@@ -1122,7 +1120,7 @@ bulkentries                   *vldbentries;
     return(ubik_EndTrans(trans));
 }
 
-VL_ListAttributesN(rxcall, attributes, nentries, vldbentries)
+SVL_ListAttributesN(rxcall, attributes, nentries, vldbentries)
 struct rx_call             *rxcall;
 struct VldbListByAttributes *attributes;
 afs_int32                          *nentries;
@@ -1148,8 +1146,7 @@ nbulkentries                  *vldbentries;
     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!) */
     if (attributes->Mask & VLLIST_VOLUMEID) {
-       afs_int32       blockindex, chain;
-       struct nvlentry tempentry;
+       afs_int32       blockindex;
 
        blockindex = FindByID(trans, attributes->volumeid, -1, &tentry, &errorcode);
        if (blockindex == 0) {
@@ -1235,7 +1232,7 @@ nbulkentries                  *vldbentries;
 }
 
 
-VL_ListAttributesN2(rxcall, attributes, name, startindex, nentries, vldbentries, nextstartindex)
+SVL_ListAttributesN2(rxcall, attributes, name, startindex, nentries, vldbentries, nextstartindex)
   struct rx_call             *rxcall;
   struct VldbListByAttributes *attributes;
   char *                      name;              /* Wildcarded volume name */
@@ -1247,7 +1244,7 @@ VL_ListAttributesN2(rxcall, attributes, name, startindex, nentries, vldbentries,
   int                  errorcode=0, maxCount=VLDBALLOCCOUNT;
   struct ubik_trans    *trans;
   struct nvlentry      tentry;
-  struct nvldbentry    *Vldbentry=0, *VldbentryFirst=0, *VldbentryLast=0, tVldbentry;
+  struct nvldbentry    *Vldbentry=0, *VldbentryFirst=0, *VldbentryLast=0;
   afs_int32                    blockindex=0, count=0, k, match, matchindex;
   int                   serverindex=-1; /* no server found */
   int                   findserver=0, findpartition=0, findflag=0, findname=0;
@@ -1450,7 +1447,7 @@ VL_ListAttributesN2(rxcall, attributes, name, startindex, nentries, vldbentries,
  * returned. CAUTION: This could be a very expensive call since in most
  * cases sequential search of all vldb entries is performed.
  */
-VL_LinkedList(rxcall, attributes, nentries, vldbentries)
+SVL_LinkedList(rxcall, attributes, nentries, vldbentries)
     struct rx_call             *rxcall;
     struct VldbListByAttributes *attributes;
     afs_int32                  *nentries;
@@ -1567,7 +1564,7 @@ VL_LinkedList(rxcall, attributes, nentries, vldbentries)
     return(ubik_EndTrans(trans));
 }
 
-VL_LinkedListN(rxcall, attributes, nentries, vldbentries)
+SVL_LinkedListN(rxcall, attributes, nentries, vldbentries)
     struct rx_call                 *rxcall;
     struct VldbListByAttributes *attributes;
     afs_int32                      *nentries;
@@ -1685,7 +1682,7 @@ VL_LinkedListN(rxcall, attributes, nentries, vldbentries)
 }
 
 /* Get back vldb header statistics (allocs, frees, maxvolumeid, totalentries, etc) and dynamic statistics (number of requests and/or aborts per remote procedure call, etc) */
-VL_GetStats(rxcall, stats, vital_header)
+SVL_GetStats(rxcall, stats, vital_header)
 struct rx_call *rxcall;
 vldstats       *stats;
 vital_vlheader *vital_header;
@@ -1701,8 +1698,8 @@ vital_vlheader    *vital_header;
     if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
        return errorcode;
     VLog(5, ("GetStats %\n", rxinfo(rxcall)));
-    bcopy((char *)&cheader.vital_header, (char *) vital_header, sizeof(vital_vlheader));
-    bcopy((char *)&dynamic_statistics, (char *) stats, sizeof(vldstats));
+    memcpy((char *) vital_header, (char *)&cheader.vital_header, sizeof(vital_vlheader));
+    memcpy((char *) stats, (char *)&dynamic_statistics, sizeof(vldstats));
     return(ubik_EndTrans(trans));
 }
 
@@ -1710,7 +1707,7 @@ vital_vlheader    *vital_header;
  * easy to do.  In the future, it might require a little bit of grunging
  * through the VLDB, but that's life.
  */
-VL_GetAddrs(rxcall, Handle, spare2, spare3, nentries, addrsp)
+SVL_GetAddrs(rxcall, Handle, spare2, spare3, nentries, addrsp)
 struct rx_call *rxcall;
 afs_int32 Handle, spare2;
 struct VLCallBack  *spare3;
@@ -1724,7 +1721,7 @@ bulkaddrs             *addrsp;
     COUNT_REQ(VLGETADDRS);
     addrsp->bulkaddrs_len = *nentries = 0;
     addrsp->bulkaddrs_val = 0;
-    bzero (spare3, sizeof (struct VLCallBack));
+    memset(spare3, 0, sizeof (struct VLCallBack));
 
     if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
        return errorcode;
@@ -1752,7 +1749,7 @@ bulkaddrs             *addrsp;
 
 #define PADDR(addr) printf("%d.%d.%d.%d", (addr>>24)&0xff, (addr>>16)&0xff, (addr>>8) &0xff, addr&0xff);
 
-VL_RegisterAddrs(rxcall, uuidp, spare1, addrsp)
+SVL_RegisterAddrs(rxcall, uuidp, spare1, addrsp)
   struct rx_call       *rxcall;
   afsUUID *uuidp;
   afs_int32 spare1;
@@ -1760,11 +1757,11 @@ VL_RegisterAddrs(rxcall, uuidp, spare1, addrsp)
 {
   afs_int32 code;
   struct ubik_trans *trans;
-  int cnt, h, i, j, k, m, hostslot, base, index;
+  int cnt, h, i, j, k, m, base, index;
   struct extentaddr *exp = 0, *tex;
   afsUUID tuuid;
   afs_uint32 addrs[VL_MAXIPADDRS_PERMH];
-  afs_int32 fbase, findex;
+  afs_int32 fbase;
   int count, willChangeEntry, foundUuidEntry, willReplaceCnt;
   int WillReplaceEntry, WillChange[MAXSERVERID+1], FoundUuid, ReplaceEntry;
   int srvidx, mhidx;
@@ -2096,15 +2093,15 @@ VL_RegisterAddrs(rxcall, uuidp, spare1, addrsp)
   return(ubik_EndTrans(trans));
 }
 
-VL_GetAddrsU(rxcall, attributes, uuidpo, uniquifier, nentries, addrsp)
+SVL_GetAddrsU(rxcall, attributes, uuidpo, uniquifier, nentries, addrsp)
 struct rx_call *rxcall;
 struct ListAddrByAttributes *attributes;
 afsUUID *uuidpo;
 afs_int32  *uniquifier, *nentries;
 bulkaddrs                  *addrsp;
-{   register afs_int32   errorcode, index=-1, op, offset;
+{   register afs_int32   errorcode, index=-1, offset;
     struct ubik_trans  *trans;
-    int nservers, i, j, k, base=0;
+    int nservers, i, j, base=0;
     struct extentaddr *exp=0;
     afsUUID tuuid;
     afs_uint32 *taddrp, taddr;
@@ -2579,7 +2576,7 @@ struct vldbentry    *VldbEntry;
 {
     int i, j;
     
-    bzero(VldbEntry, sizeof(struct vldbentry));
+    memset(VldbEntry, 0, sizeof(struct vldbentry));
     strncpy(VldbEntry->name, VlEntry->name, sizeof(VldbEntry->name));
     for (i=0; i < OMAXNSERVERS; i++) {
        if (VlEntry->serverNumber[i] == BADSERVERID) break;
@@ -2617,7 +2614,7 @@ struct nvldbentry    *VldbEntry;
 {
     int i, j;
     
-    bzero(VldbEntry, sizeof(struct vldbentry));
+    memset(VldbEntry, 0, sizeof(struct vldbentry));
     strncpy(VldbEntry->name, VlEntry->name, sizeof(VldbEntry->name));
     for (i=0; i < NMAXNSERVERS; i++) {
        if (VlEntry->serverNumber[i] == BADSERVERID) break;
@@ -2653,7 +2650,7 @@ struct uvldbentry    *VldbEntry;
 {
     int i, j;
     
-    bzero(VldbEntry, sizeof(struct vldbentry));
+    memset(VldbEntry, 0, sizeof(struct vldbentry));
     strncpy(VldbEntry->name, VlEntry->name, sizeof(VldbEntry->name));
     for (i=0; i < NMAXNSERVERS; i++) {
        if (VlEntry->serverNumber[i] == BADSERVERID) break;
@@ -2794,7 +2791,7 @@ register afs_uint32       ipaddr1, ipaddr2;
     int base, index, mhidx;
     afsUUID tuuid;
     afs_int32 blockindex, count;
-    int   pollcount;
+    int   pollcount = 0;
     struct nvlentry tentry;
 
     if (!atrans)
@@ -2889,7 +2886,7 @@ register afs_uint32       ipaddr1, ipaddr2;
 
     /* Change the registered uuuid addresses */
     if (exp) {
-       bzero(&tuuid, sizeof(afsUUID));
+       memset(&tuuid, 0, sizeof(afsUUID));
        afs_htonuuid(&tuuid);
        exp->ex_hostuuid = tuuid;
        code = vlwrite(atrans, DOFFSET(ntohl(ex_addr[0]->ex_contaddrs[base]),
@@ -2911,7 +2908,7 @@ register afs_uint32       ipaddr1, ipaddr2;
 }
 
 /* see if the vlserver is back yet */
-VL_ProbeServer(rxcall)
+SVL_ProbeServer(rxcall)
 struct rx_call *rxcall; {
     return 0;
 }