Unused variable warning fixes
[openafs.git] / src / libadmin / vos / vsprocs.c
index 490ae8e..5a857f0 100644 (file)
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID
-    ("$Header$");
+#include <roken.h>
+
+#include <afs/afs_AdminErrors.h>
 
 #include "vsprocs.h"
 #include "vosutils.h"
 #include "lockprocs.h"
 #include "../adminutil/afs_AdminInternal.h"
-#include <afs/afs_AdminErrors.h>
 #include "afs_vosAdmin.h"
-#include <string.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef AFS_NT40_ENV
-#include <io.h>
-#endif
 
-static afs_int32 GroupEntries();
+static afs_int32 GroupEntries(struct rx_connection *server, volintInfo * pntr, afs_int32 count,
+             struct qHead *myQueue, afs_int32 apart);
 
 struct release {
     afs_int32 time;
@@ -60,7 +54,7 @@ UV_Bind(afs_cell_handle_p cellHandle, afs_int32 aserver, afs_int32 port)
  * start a transaction, delete the <delvol> */
 static afs_int32
 CheckAndDeleteVolume(struct rx_connection *aconn, afs_int32 apart,
-                    afs_int32 okvol, afs_int32 delvol)
+                    afs_uint32 okvol, afs_uint32 delvol)
 {
     afs_int32 error, code, tid, rcode;
 
@@ -108,7 +102,7 @@ CheckAndDeleteVolume(struct rx_connection *aconn, afs_int32 apart,
 /* forcibly remove a volume.  Very dangerous call */
 int
 UV_NukeVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
-             unsigned int partition, unsigned int volumeId, afs_status_p st)
+             unsigned int partition, afs_uint32 volumeId, afs_status_p st)
 {
     int rc = 0;
     afs_status_t tst = 0;
@@ -129,8 +123,8 @@ UV_NukeVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
 * back new vol id in <anewid>*/
 int
 UV_CreateVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
-               unsigned int partition, const char *volumeName,
-               unsigned int quota, unsigned int *volumeId, afs_status_p st)
+               unsigned int partition, char *volumeName,
+               unsigned int quota, afs_uint32 *volumeId, afs_status_p st)
 {
     int rc = 0;
     afs_status_t tst = 0;
@@ -206,7 +200,7 @@ UV_CreateVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
  */
 int
 UV_DeleteVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
-               unsigned int partition, unsigned int volumeId,
+               unsigned int partition, afs_uint32 volumeId,
                afs_status_p st)
 {
     int rc = 0;
@@ -379,7 +373,7 @@ UV_DeleteVolume(afs_cell_handle_p cellHandle, struct rx_connection *server,
  */
 
 int
-UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
+UV_MoveVolume(afs_cell_handle_p cellHandle, afs_uint32 afromvol,
              afs_int32 afromserver, afs_int32 afrompart, afs_int32 atoserver,
              afs_int32 atopart, afs_status_p st)
 {
@@ -394,12 +388,12 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
     afs_int32 rcode;
     afs_int32 fromDate;
     struct restoreCookie cookie;
-    afs_int32 newVol, volid, backupId;
+    afs_uint32 newVol, volid, backupId;
     struct volser_status tstatus;
     struct destServer destination;
 
     struct nvldbentry entry;
-    int islocked, pntg;
+    int islocked;
     afs_int32 error;
     int same;
     afs_int32 store_flags;
@@ -417,7 +411,6 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
     clonetid = 0;
     error = 0;
     volid = 0;
-    pntg = 0;
     backupId = 0;
     newVol = 0;
 
@@ -465,7 +458,6 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
         */
        fromconn = UV_Bind(cellHandle, afromserver, AFSCONF_VOLUMEPORT);
        fromtid = 0;
-       pntg = 1;
 
        tst =
            AFSVolTransCreate(fromconn, afromvol, afrompart, ITOffline,
@@ -539,7 +531,6 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
        }
     }
 
-    pntg = 1;
     toconn = UV_Bind(cellHandle, atoserver, AFSCONF_VOLUMEPORT);       /* get connections to the servers */
     fromconn = UV_Bind(cellHandle, afromserver, AFSCONF_VOLUMEPORT);
     fromtid = totid = 0;       /* initialize to uncreated */
@@ -983,12 +974,12 @@ UV_MoveVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
 
 int
 UV_BackupVolume(afs_cell_handle_p cellHandle, afs_int32 aserver,
-               afs_int32 apart, afs_int32 avolid, afs_status_p st)
+               afs_int32 apart, afs_uint32 avolid, afs_status_p st)
 {
     int rc = 0;
     afs_status_t tst = 0, temp = 0;
     afs_int32 ttid = 0, btid = 0;
-    afs_int32 backupID;
+    afs_uint32 backupID;
     afs_int32 rcode = 0;
     char vname[VOLSER_MAXVOLNAME + 1];
     struct nvldbentry entry;
@@ -1176,7 +1167,7 @@ UV_BackupVolume(afs_cell_handle_p cellHandle, afs_int32 aserver,
 }
 
 static int
-DelVol(struct rx_connection *conn, afs_int32 vid, afs_int32 part,
+DelVol(struct rx_connection *conn, afs_uint32 vid, afs_int32 part,
        afs_int32 flags)
 {
     afs_int32 acode, ccode, rcode, tid;
@@ -1199,7 +1190,7 @@ DelVol(struct rx_connection *conn, afs_int32 vid, afs_int32 part,
 #if 0                          /* doesn't appear to be used, why compile it */
 static int
 CloneVol(afs_cell_handle_p cellHandle, struct rx_connection *conn,
-        afs_int32 rwvid, afs_int32 part, afs_int32 * rovidp, int nottemp,
+        afs_uint32 rwvid, afs_int32 part, afs_uint32 * rovidp, int nottemp,
         struct nvldbentry *entry, afs_int32 * vidCreateDate, afs_status_p st)
 {
     int rc = 0;
@@ -1310,7 +1301,7 @@ GetTrans(afs_cell_handle_p cellHandle, struct nvldbentry *vldbEntryPtr,
 {
     int rc = 0;
     afs_status_t tst = 0, etst = 0;
-    afs_int32 volid;
+    afs_uint32 volid;
     struct volser_status tstatus;
     int rcode;
 
@@ -1450,7 +1441,7 @@ VolumeExists(afs_cell_handle_p cellHandle, afs_int32 server,
  * sites if forceflag is 1.If its 0 complete the release if the previous
  * release aborted else start a new release */
 int
-UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
+UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_uint32 afromvol,
                 afs_int32 afromserver, afs_int32 afrompart, int forceflag,
                 afs_status_p st)
 {
@@ -1459,7 +1450,7 @@ UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
 
     char vname[64];
     afs_int32 rcode;
-    afs_int32 cloneVolId, roVolId;
+    afs_uint32 cloneVolId, roVolId;
     struct replica *replicas = 0;
     struct nvldbentry entry;
     int i, volcount, m, fullrelease, vldbindex;
@@ -1485,8 +1476,8 @@ UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
     int releasecount = 0;
     struct volser_status volstatus;
 
-    memset((char *)remembertime, 0, sizeof(remembertime));
-    memset((char *)&results, 0, sizeof(results));
+    memset(remembertime, 0, sizeof(remembertime));
+    memset(&results, 0, sizeof(results));
 
     tst =
        ubik_VL_SetLock(cellHandle->vos, 0, afromvol, RWVOL,
@@ -1988,11 +1979,11 @@ UV_ReleaseVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
 }
 
 static int
-ReceiveFile(register int fd, register struct rx_call *call,
-           register struct stat *status)
+ReceiveFile(int fd, struct rx_call *call,
+           struct stat *status)
 {
-    register char *buffer = (char *)0;
-    register int blockSize;
+    char *buffer = (char *)0;
+    int blockSize;
     afs_int32 bytesread, nbytes, bytesleft, w;
     fd_set out;
     afs_int32 error = 0;
@@ -2086,7 +2077,7 @@ DumpFunction(struct rx_call *call, const char *filename)
 * DumpFunction does the real work behind the scenes after
 * extracting parameters from the rock  */
 int
-UV_DumpVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
+UV_DumpVolume(afs_cell_handle_p cellHandle, afs_uint32 afromvol,
              afs_int32 afromserver, afs_int32 afrompart, afs_int32 fromdate,
              const char *filename, afs_status_p st)
 {
@@ -2185,8 +2176,8 @@ UV_DumpVolume(afs_cell_handle_p cellHandle, afs_int32 afromvol,
 }
 
 int
-SendFile(register int fd, register struct rx_call *call,
-        register struct stat *status)
+SendFile(int fd, struct rx_call *call,
+        struct stat *status)
 {
     char *buffer = (char *)0;
     int blockSize;
@@ -2285,7 +2276,7 @@ WriteData(struct rx_call *call, const char *filename)
  */
 int
 UV_RestoreVolume(afs_cell_handle_p cellHandle, afs_int32 toserver,
-                afs_int32 topart, afs_int32 tovolid, const char *tovolname,
+                afs_int32 topart, afs_uint32 tovolid, char *tovolname,
                 int flags, const char *dumpFile, afs_status_p st)
 {
     int rc = 0;
@@ -2297,7 +2288,7 @@ UV_RestoreVolume(afs_cell_handle_p cellHandle, afs_int32 toserver,
     afs_int32 rxError = 0;
     struct volser_status tstatus;
     char partName[10];
-    afs_int32 pvolid;
+    afs_uint32 pvolid;
     afs_int32 temptid;
     int success;
     struct nvldbentry entry;
@@ -2592,7 +2583,7 @@ UV_RestoreVolume(afs_cell_handle_p cellHandle, afs_int32 toserver,
 *in vldb */
 int
 UV_AddSite(afs_cell_handle_p cellHandle, afs_int32 server, afs_int32 part,
-          afs_int32 volid, afs_status_p st)
+          afs_uint32 volid, afs_status_p st)
 {
     int rc = 0;
     afs_status_t tst = 0;
@@ -2672,7 +2663,7 @@ UV_AddSite(afs_cell_handle_p cellHandle, afs_int32 server, afs_int32 part,
 /*removes <server> <part> as read only site for <volid> from the vldb */
 int
 UV_RemoveSite(afs_cell_handle_p cellHandle, afs_int32 server, afs_int32 part,
-             afs_int32 volid, afs_status_p st)
+             afs_uint32 volid, afs_status_p st)
 {
     int rc = 0;
     afs_status_t tst = 0;
@@ -2737,7 +2728,7 @@ UV_ListPartitions(struct rx_connection *server, struct partList *ptrPartList,
     afs_status_t tst = 0;
     struct pIDs partIds;
     struct partEntries partEnts;
-    register int i, j = 0;
+    int i, j = 0;
 
     *cntp = 0;
 
@@ -2895,7 +2886,7 @@ UV_XListVolumes(struct rx_connection *server, afs_int32 a_partID, int a_all,
 
 int
 UV_XListOneVolume(struct rx_connection *server, afs_int32 a_partID,
-                 afs_int32 a_volID, struct volintXInfo **a_resultPP,
+                 afs_uint32 a_volID, struct volintXInfo **a_resultPP,
                  afs_status_p st)
 {
     int rc = 0;
@@ -2956,10 +2947,10 @@ UV_XListOneVolume(struct rx_connection *server, afs_int32 a_partID,
  *------------------------------------------------------------------------*/
 
 int UV_ListOneVolume(struct rx_connection *server, afs_int32 a_partID,
-                 afs_int32 a_volID, struct volintInfo **a_resultPP,
+                 afs_uint32 a_volID, struct volintInfo **a_resultPP,
                  afs_status_p st)
 {
-       int rc = 0;
+    int rc = 0;
     afs_status_t tst = 0;
     volEntries volumeInfo;     /*Area for returned info */
 
@@ -2998,8 +2989,10 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
               struct rx_connection *server, afs_int32 apart, afs_int32 force)
 {
     struct aqueue elem;
-    int success, temp, temp1, temp2;
-    afs_int32 vcode, maxVolid = 0;
+    int success, temp;
+    afs_uint32 temp1, temp2;
+    afs_int32 vcode;
+    afs_uint32 maxVolid = 0;
     struct nvldbentry entry;
     int noError = 1, error, same;
     int totalC, totalU, totalCE, totalUE, totalG;
@@ -3036,11 +3029,8 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
                ubik_VL_GetNewVolumeId(cellHandle->vos, 0, temp2,
                          &maxVolid);
            maxVolid += temp2;
-
-
        }
        if (maxVolid <= elem.ids[ROVOL]) {
-
            temp1 = maxVolid;
            temp2 = elem.ids[ROVOL] - maxVolid + 1;
            maxVolid = 0;
@@ -3048,7 +3038,6 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
                ubik_VL_GetNewVolumeId(cellHandle->vos, 0, temp2,
                          &maxVolid);
            maxVolid += temp2;
-
        }
        if (maxVolid <= elem.ids[BACKVOL]) {
            temp1 = maxVolid;
@@ -3058,7 +3047,6 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
                ubik_VL_GetNewVolumeId(cellHandle->vos, 0, temp2,
                          &maxVolid);
            maxVolid += temp2;
-
        }
        aVLDB_GetEntryByID(cellHandle, elem.ids[RWVOL], RWVOL, &entry, &tst);
        if (tst && (tst != VL_NOENT)) {
@@ -3523,7 +3511,6 @@ CheckVldb(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
     int islocked = 0;
     int pass = 0;
     afs_int32 modentry = 0;
-    afs_int32 delentry = 0;
 
     if (modified) {
        *modified = 0;
@@ -3587,7 +3574,6 @@ CheckVldb(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
            if (tst) {
                goto fail_CheckVldb;
            }
-           delentry = 1;
        } else {
            /* Replace old entry with our new one */
            if (!VLDB_ReplaceEntry
@@ -3636,8 +3622,8 @@ UV_SyncServer(afs_cell_handle_p cellHandle, struct rx_connection *server,
     struct VldbListByAttributes attributes;
     nbulkentries arrayEntries;
     int totalF;
-    register struct nvldbentry *vllist;
-    register int j;
+    struct nvldbentry *vllist;
+    int j;
     afs_int32 si, nsi;
     afs_int32 modified = 0;
 
@@ -3691,13 +3677,16 @@ UV_SyncServer(afs_cell_handle_p cellHandle, struct rx_connection *server,
     return rc;
 }
 
-/*rename volume <oldname> to <newname>, changing the names of the related 
- *readonly and backup volumes. This operation is also idempotent.
- *salvager is capable of recovering from rename operation stopping halfway.
- *to recover run syncserver on the affected machines,it will force renaming to completion. name clashes should have been detected before calling this proc */
+/* rename volume <oldname> to <newname>, changing the names of the related
+ * readonly and backup volumes. This operation is also idempotent.
+ * salvager is capable of recovering from rename operation stopping halfway.
+ * to recover run syncserver on the affected machines,it will force
+ * renaming to completion. name clashes should have been detected before
+ * calling this proc
+ */
 int
 UV_RenameVolume(afs_cell_handle_p cellHandle, struct nvldbentry *entry,
-               const char *newname, afs_status_p st)
+               char *newname, afs_status_p st)
 {
     int rc = 0;
     afs_status_t tst = 0;
@@ -4064,7 +4053,7 @@ UV_VolserStatus(struct rx_connection *server, transDebugInfo ** rpntr,
 /*delete the volume without interacting with the vldb */
 int
 UV_VolumeZap(afs_cell_handle_p cellHandle, struct rx_connection *server,
-            unsigned int partition, unsigned int volumeId, afs_status_p st)
+            unsigned int partition, afs_uint32 volumeId, afs_status_p st)
 {
     afs_int32 rcode, ttid, error, code;
     int rc = 0;
@@ -4102,7 +4091,7 @@ UV_VolumeZap(afs_cell_handle_p cellHandle, struct rx_connection *server,
 
 int
 UV_SetVolume(struct rx_connection *server, afs_int32 partition,
-            afs_int32 volid, afs_int32 transflag, afs_int32 setflag,
+            afs_uint32 volid, afs_int32 transflag, afs_int32 setflag,
             unsigned int sleepTime, afs_status_p st)
 {
     int rc = 0;