Use unsigned IP addresses in bu*
[openafs.git] / src / bucoord / restore.c
index f4d743e..34a3c24 100644 (file)
@@ -14,8 +14,6 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID
-    ("$Header$");
 
 #include <afs/stds.h>
 #include <sys/types.h>
@@ -36,6 +34,8 @@ RCSID
 #include <afs/budb.h>
 #include <afs/vlserver.h>
 #include "error_macros.h"
+#include "bucoord_internal.h"
+#include "bucoord_prototypes.h"
 
 extern struct bc_dumpTask bc_dumpTasks[BC_MAXSIMDUMPS];
 extern char *whoami;
@@ -58,9 +58,9 @@ struct dumpinfo {
 };
 
 struct volinfo {
-    struct voli *next;
+    struct volinfo *next;
     char *volname;
-    afs_int32 server;
+    afs_uint32 server;
     afs_int32 partition;
 };
 
@@ -92,13 +92,12 @@ struct bc_tapeItem {
 };
 
 /* strip .backup from the end of a name */
-static
-StripBackup(aname)
-     register char *aname;
+static int
+StripBackup(char *aname)
 {
     int j;
 
-    if (j = BackupName(aname)) {
+    if ((j = BackupName(aname))) {
        aname[j] = 0;
        return 0;
     }
@@ -106,8 +105,7 @@ StripBackup(aname)
 }
 
 int
-BackupName(aname)
-     char *aname;
+BackupName(char *aname)
 {
     int j;
 
@@ -119,8 +117,8 @@ BackupName(aname)
     return 0;
 }
 
-extractTapeSeq(tapename)
-     char *tapename;
+int
+extractTapeSeq(char *tapename)
 {
     char *sptr;
 
@@ -131,8 +129,8 @@ extractTapeSeq(tapename)
     return (atol(sptr));
 }
 
-viceName(value)
-     long value;
+void
+viceName(long value)
 {
     char *alph;
     int r;
@@ -150,8 +148,8 @@ viceName(value)
  * entry:
  *     aindex - index into bc_dumpTasks that describes this dump.
  */
-bc_Restorer(aindex)
-     afs_int32 aindex;
+int
+bc_Restorer(afs_int32 aindex)
 {
     struct bc_dumpTask *dumpTaskPtr;
 
@@ -163,7 +161,8 @@ bc_Restorer(aindex)
     afs_int32 tapedumpid, parent;
 
     afs_int32 nentries = 0;
-    afs_int32 last, next, ve, vecount;
+    afs_int32 last = 0;
+    afs_int32 next, ve, vecount;
     struct bc_tapeItem *ti, *pti, *nti;
     struct bc_tapeList *tapeList = (struct bc_tapeList *)0;
     struct bc_tapeList *tle, *ptle, *ntle;
@@ -182,20 +181,17 @@ bc_Restorer(aindex)
 
     struct dumpinfo *dumpinfolist = NULL;
     struct dumpinfo *pdi, *ndi, *di, *dlevels;
-    struct volinfo *pvi, *nvi, *vi;
+    struct volinfo *nvi, *vi;
     afs_int32 lvl, lv;
     int num_dlevels = 20;
 
-    afs_int32 serverAll;       /* The server to which all volumes are to be restore to */
+    afs_uint32 serverAll;      /* The server to which all volumes are to be restore to */
     afs_int32 partitionAll;    /* Likewise for partition */
     struct hostent *hostPtr;
     long haddr;
     time_t did;
     int foundtape, c;
 
-    extern statusP createStatusNode();
-    extern statusP findStatus();
-
     dlevels = (struct dumpinfo *) malloc(num_dlevels * sizeof(*dlevels));
 
     dumpTaskPtr = &bc_dumpTasks[aindex];
@@ -205,7 +201,7 @@ bc_Restorer(aindex)
     volumeEntries = (struct budb_volumeEntry *)
        malloc(MAXTAPESATONCE * sizeof(struct budb_volumeEntry));
     if (!volumeEntries) {
-       afs_com_err(whoami, BC_NOMEM, "");
+       afs_com_err(whoami, BC_NOMEM, NULL);
        ERROR(BC_NOMEM);
     }
 
@@ -283,7 +279,7 @@ bc_Restorer(aindex)
        if (!di) {
            di = (struct dumpinfo *)malloc(sizeof(struct dumpinfo));
            if (!di) {
-               afs_com_err(whoami, BC_NOMEM, "");
+               afs_com_err(whoami, BC_NOMEM, NULL);
                ERROR(BC_NOMEM);
            }
            memset(di, 0, sizeof(struct dumpinfo));
@@ -305,7 +301,7 @@ bc_Restorer(aindex)
        /* Create one and thread into list */
        vi = (struct volinfo *)malloc(sizeof(struct volinfo));
        if (!vi) {
-           afs_com_err(whoami, BC_NOMEM, "");
+           afs_com_err(whoami, BC_NOMEM, NULL);
            ERROR(BC_NOMEM);
        }
        memset(vi, 0, sizeof(struct volinfo));
@@ -313,7 +309,7 @@ bc_Restorer(aindex)
        vi->volname = (char *)malloc(strlen(vname) + 1);
        if (!vi->volname) {
            free(vi);
-           afs_com_err(whoami, BC_NOMEM, "");
+           afs_com_err(whoami, BC_NOMEM, NULL);
            ERROR(BC_NOMEM);
        }
 
@@ -486,7 +482,7 @@ bc_Restorer(aindex)
                            tle = (struct bc_tapeList *)
                                malloc(sizeof(struct bc_tapeList));
                            if (!tle) {
-                               afs_com_err(whoami, BC_NOMEM, "");
+                               afs_com_err(whoami, BC_NOMEM, NULL);
                                return (BC_NOMEM);
                            }
                            memset(tle, 0, sizeof(struct bc_tapeList));
@@ -496,7 +492,7 @@ bc_Restorer(aindex)
                                               + 1);
                            if (!tle->tapeName) {
                                free(tle);
-                               afs_com_err(whoami, BC_NOMEM, "");
+                               afs_com_err(whoami, BC_NOMEM, NULL);
                                return (BC_NOMEM);
                            }
 
@@ -541,7 +537,7 @@ bc_Restorer(aindex)
                            ti = (struct bc_tapeItem *)
                                malloc(sizeof(struct bc_tapeItem));
                            if (!ti) {
-                               afs_com_err(whoami, BC_NOMEM, "");
+                               afs_com_err(whoami, BC_NOMEM, NULL);
                                return (BC_NOMEM);
                            }
                            memset(ti, 0, sizeof(struct bc_tapeItem));
@@ -551,7 +547,7 @@ bc_Restorer(aindex)
                                               + 1);
                            if (!ti->volumeName) {
                                free(ti);
-                               afs_com_err(whoami, BC_NOMEM, "");
+                               afs_com_err(whoami, BC_NOMEM, NULL);
                                return (BC_NOMEM);
                            }
 
@@ -641,7 +637,7 @@ bc_Restorer(aindex)
        (struct tc_restoreDesc *)malloc(nentries *
                                        sizeof(struct tc_restoreDesc));
     if (!tcarray) {
-       afs_com_err(whoami, BC_NOMEM, "");
+       afs_com_err(whoami, BC_NOMEM, NULL);
        ERROR(BC_NOMEM);
     }
     memset(tcarray, 0, nentries * sizeof(struct tc_restoreDesc));