Further cleanup of the butc directory
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Fri, 10 Jul 2009 22:36:39 +0000 (23:36 +0100)
committerRuss Allbery <rra@stanford.edu>
Fri, 10 Jul 2009 23:31:03 +0000 (17:31 -0600)
Now that butm is sharing its prototype, further cleanup, ansification
and warnings reduction for butc.

Reviewed-on: http://gerrit.openafs.org/46
Verified-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Russ Allbery <rra@stanford.edu>

src/butc/butc_internal.h
src/butc/dbentries.c
src/butc/dump.c
src/butc/list.c
src/butc/recoverDb.c
src/butc/tcmain.c
src/butc/tcprocs.c
src/butc/tcudbprocs.c

index aebb212..46c4a17 100644 (file)
@@ -19,6 +19,7 @@ extern afs_int32 finishTape(struct budb_tapeEntry *, afs_int32);
 extern afs_int32 flushSavedEntries(afs_int32);
 extern void waitDbWatcher(void);
 extern afs_int32 finishDump(struct budb_dumpEntry *);
+extern afs_int32 threadEntryDir(void *, afs_int32, afs_int32);
 
 /* list.c */
 extern afs_int32 allocTaskId(void);
@@ -31,6 +32,13 @@ extern afs_int32 PromptForTape(int, char *, afs_uint32, afs_uint32, int);
 extern void GetNewLabel(struct butm_tapeInfo *, char *, char *,
                        struct butm_tapeLabel *);
 extern void FFlushInput(void);
+extern afs_int32 ReadVolHeader(afs_int32, struct butm_tapeInfo *,
+                              struct volumeHeader *);
+extern int FindVolTrailer(char *, afs_int32, afs_int32 *,
+                         struct volumeHeader *);
+extern int FindVolTrailer2(char *, afs_int32, afs_int32 *, char *, afs_int32,
+                          afs_int32 *, struct volumeHeader *);
+
 
 /* recoverDb.c */
 extern afs_int32 Ask(char *);
index 5ab88b4..27af35a 100644 (file)
@@ -36,6 +36,9 @@
 #include <afs/volser.h>
 #include <afs/volint.h>
 #include <afs/cellconfig.h>
+#include <afs/bucoord_prototypes.h>
+
+#include "butc_internal.h"
 
 #include "error_macros.h"
 
@@ -45,10 +48,10 @@ dlqlinkT entries_to_flush;
 int dbWatcherinprogress;
 
 afs_int32
-threadEntryDir(char *anEntry, afs_int32 size, afs_int32 type)
+threadEntryDir(void *anEntry, afs_int32 size, afs_int32 type)
 {
     dlqlinkP entryPtr;
-    char *entry = NULL;
+    void *entry = NULL;
     int tried;
 
     for (tried = 0; tried < 5; tried++) {
@@ -88,10 +91,10 @@ threadEntryDir(char *anEntry, afs_int32 size, afs_int32 type)
  */
 
 afs_int32
-threadEntry(char *anEntry, afs_int32 size, afs_int32 type)
+threadEntry(void *anEntry, afs_int32 size, afs_int32 type)
 {
     dlqlinkP entryPtr;
-    char *entry = NULL;
+    void *entry = NULL;
     int tried;
 
     for (tried = 0; tried < 5; tried++) {
@@ -156,7 +159,9 @@ finishDump(struct budb_dumpEntry *aDumpEntryPtr)
  *     Creates a tape entry and puts it onto the savedEntries list.
  */
 afs_int32
-useTape(struct budb_tapeEntry *aTapeEntryPtr, afs_int32 dumpID, char *tapename, afs_int32 tapeSeq, afs_int32 useCount, Date written, Date expiration, afs_int32 tapepos)
+useTape(struct budb_tapeEntry *aTapeEntryPtr, afs_int32 dumpID,
+       char *tapename, afs_int32 tapeSeq, afs_int32 useCount,
+       Date written, Date expiration, afs_int32 tapepos)
 {
     afs_int32 code = 0;
 
@@ -199,7 +204,10 @@ finishTape(struct budb_tapeEntry *aTapeEntryPtr, afs_int32 useKBytes)
  *     Creates a volume entry and puts it onto the savedEntries list.
  */
 afs_int32
-addVolume(struct budb_volumeEntry *aVolEntryPtr, afs_int32 dumpID, char *tapename, char *volname, afs_int32 volid, Date cloneDate, afs_int32 startPos, afs_int32 volBytes, int fragment, afs_int32 flags)
+addVolume(struct budb_volumeEntry *aVolEntryPtr, afs_int32 dumpID,
+         char *tapename, char *volname, afs_int32 volid,
+         Date cloneDate, afs_int32 startPos, afs_int32 volBytes,
+         int fragment, afs_int32 flags)
 {
     afs_int32 code = 0;
     int allo = 0;
@@ -233,6 +241,13 @@ addVolume(struct budb_volumeEntry *aVolEntryPtr, afs_int32 dumpID, char *tapenam
     return (code);
 }
 
+static_inline int
+freeEntry(void *e)
+{
+    free(e);
+    return 0;
+}
+
 /*
  * flushSavedEntries
  *     Runs through the list of savedEntries and adds the volumes and 
@@ -270,7 +285,7 @@ flushSavedEntries(afs_int32 status)
      * Add dump, tape, and volume entries to the list for the dbWatcher to 
      * flush. Volume entries are not added if the volume failed to dump.
      */
-    while (entryPtr = dlqUnlinkf(&savedEntries)) {
+    while ((entryPtr = dlqUnlinkf(&savedEntries))) {
        if ((entryPtr->dlq_type == DLQ_VOLENTRY) && (status != DUMP_SUCCESS)) {
            volPtr = (struct budb_volumeEntry *)entryPtr->dlq_structPtr;
            if (volPtr)
@@ -284,12 +299,12 @@ flushSavedEntries(afs_int32 status)
 
   error_exit:
     /* Free anything that remains on dlq */
-    dlqTraverseQueue(&savedEntries, free, free);
+    dlqTraverseQueue(&savedEntries, freeEntry, freeEntry);
     return (code);
 }
 
 void
-waitDbWatcher()
+waitDbWatcher(void)
 {
     int message = 0;
 
@@ -333,7 +348,7 @@ dbWatcher(void *unused)
     while (1) {
        /*while */
        /* Add tape and volume enties to the backup database */
-       while (entryPtr = dlqUnlinkf(&entries_to_flush)) {
+       while ((entryPtr = dlqUnlinkf(&entries_to_flush))) {
            dbWatcherinprogress = 1;
 
            if (!entryPtr->dlq_structPtr) {
@@ -391,7 +406,7 @@ dbWatcher(void *unused)
                    tapePtr =
                        (struct budb_tapeEntry *)entryPtr->dlq_structPtr;
                    if (addedDump) {
-                       code = bcdb_FinishTape(tapePtr, &new);
+                       code = bcdb_FinishTape(tapePtr);
                        if (code) {
                            ErrorLog(0, 0, code, 0,
                                     "Warning: Can't finish tape %s of DumpID %u in backup database\n",
index be1dcb2..437c989 100644 (file)
 #include <afs/tcdata.h>
 #include <afs/bubasics.h>
 #include <afs/budb_client.h>
+#include <afs/butm_prototypes.h>
 #include <afs/vldbint.h>
 #include <afs/ktime.h>
 #include <afs/vlserver.h>
 #include <afs/volser.h>
 #include <afs/volint.h>
 #include <afs/cellconfig.h>
+#include <afs/bucoord_prototypes.h>
 
+#include "butc_internal.h"
 #include "error_macros.h"
 #include "butc_xbsa.h"
 #include "afs/butx.h"
@@ -53,9 +56,6 @@ extern struct ubik_client *cstruct;
 dlqlinkT savedEntries;
 dlqlinkT entries_to_flush;
 
-afs_int32 flushSavedEntries(), finishDump(), finishTape(), useTape(),
-addVolume();
-
 extern struct rx_connection *UV_Bind();
 
 extern afs_int32 groupId;
@@ -136,6 +136,15 @@ struct dumpRock {
     struct dumpNode *node;
 };
 
+/* Forward declarations */
+
+int makeVolumeHeader(struct volumeHeader *, struct dumpRock *, int);
+int volumeHeader_hton(struct volumeHeader *, struct volumeHeader *);
+char retryPrompt(char *, afs_int32, afs_uint32);
+int getDumpTape(struct dumpRock *, int, afs_int32);
+int getXBSATape(struct dumpRock *);
+afs_int32 createDump(struct dumpRock *);
+
 /* configuration variables */
 #define HITEOT(code) ((code == BUTM_IO) || (code == BUTM_EOT) || (code == BUTM_IOCTL))
 extern int autoQuery;
@@ -150,7 +159,6 @@ afs_int32
 calcExpirationDate(afs_int32 expType, afs_int32 expDate, afs_int32 createTime)
 {
     struct ktime_date kd;
-    afs_int32 Add_RelDate_to_Time();
 
     switch (expType) {
     case BC_REL_EXPDATE:
@@ -854,7 +862,6 @@ dumpPass(struct dumpRock * dparamsPtr, int passNumber)
     int action, e;
     afs_int32 code = 0, tcode, dvcode;
     char ch;
-    char retryPrompt();
     struct vldbentry vldbEntry;
     struct sockaddr_in server;
     afs_int32 tapepos;
@@ -1148,7 +1155,6 @@ Dumper(void *param)
 
     extern struct deviceSyncNode *deviceLatch;
     extern struct tapeConfig globalTapeConfig;
-    extern afs_int32 createDump();
 
     taskId = nodePtr->taskID;  /* Get task Id */
     setStatus(taskId, DRIVE_WAIT);
@@ -1410,7 +1416,7 @@ retryPrompt(char *volumeName, afs_int32 volumeId, afs_uint32 taskId)
     printf("a - abort, the entire dump\n");
 
     while (1) {
-       FFlushInput(stdin);
+       FFlushInput();
        putchar(BELLCHAR);
        fflush(stdout);
 
@@ -1533,7 +1539,6 @@ getDumpTape(struct dumpRock *dparamsPtr, int interactiveFlag,
     afs_int32 tapepos, lastpos;
 
     extern struct tapeConfig globalTapeConfig;
-    extern struct udbHandleS udbHandle;
 
     askForTape = interactiveFlag;
     dparamsPtr->wroteLabel = 0;
index ca4be73..a78b4c3 100644 (file)
@@ -32,7 +32,7 @@ static afs_int32 maxTaskID;   /* the largest task Id allotted so far, this is neve
  *     allocate a dump (task) id
  */
 afs_int32
-allocTaskId()
+allocTaskId(void)
 {
     return (maxTaskID++);
 }
index 9451f24..ac9768c 100644 (file)
 #include <afs/tcdata.h>
 #include <afs/bubasics.h>
 #include <afs/budb.h>
+#include <afs/budb_client.h>
+#include <afs/budb_prototypes.h>
+#include <afs/butm_prototypes.h>
+#include <afs/bucoord_prototypes.h>
 #include "error_macros.h"
 #include "butc_internal.h"
 
@@ -51,7 +55,13 @@ struct tapeScanInfo {
 extern struct tapeConfig globalTapeConfig;
 extern struct deviceSyncNode *deviceLatch;
 
-static readDump();
+static int readDump(afs_uint32, struct butm_tapeInfo *,
+                   struct tapeScanInfo *);
+afs_int32 getScanTape(afs_int32, struct butm_tapeInfo *, char *,
+                     afs_int32, int prompt, struct butm_tapeLabel *);
+afs_int32 RcreateDump(struct tapeScanInfo *, struct volumeHeader *);
+void copy_ktcPrincipal_to_budbPrincipal(struct ktc_principal *,
+                                       struct budb_principal *);
 
 /* PrintDumpLabel
  *     print out the tape (dump) label.
@@ -152,7 +162,9 @@ Ask(char *st)
 #define BIGCHUNK 102400
 
 static int
-scanVolData(afs_int32 taskId, struct butm_tapeInfo *curTapePtr, afs_int32 tapeVersion, struct volumeHeader *volumeHeader, struct volumeHeader *volumeTrailer, afs_uint32 *bytesRead)
+scanVolData(afs_int32 taskId, struct butm_tapeInfo *curTapePtr,
+           afs_int32 tapeVersion, struct volumeHeader *volumeHeader,
+           struct volumeHeader *volumeTrailer, afs_uint32 *bytesRead)
 {
     afs_int32 headBytes, tailBytes;
     char *block = NULL;
@@ -321,10 +333,9 @@ nextTapeLabel(char *prevTapeName)
  *                      -1 don't know if last tape or not.
  */
 
-afs_int32 RcreateDump();
-
 static int
-readDump(afs_uint32 taskId, struct butm_tapeInfo *tapeInfoPtr, struct tapeScanInfo *scanInfoPtr)
+readDump(afs_uint32 taskId, struct butm_tapeInfo *tapeInfoPtr,
+        struct tapeScanInfo *scanInfoPtr)
 {
     int moreTapes = 1;
     afs_int32 nbytes, flags, seq;
@@ -567,7 +578,8 @@ readDump(afs_uint32 taskId, struct butm_tapeInfo *tapeInfoPtr, struct tapeScanIn
  * The first tape label is the first dumpLabel.
  */
 int
-readDumps(afs_uint32 taskId, struct butm_tapeInfo *tapeInfoPtr, struct tapeScanInfo *scanInfoPtr)
+readDumps(afs_uint32 taskId, struct butm_tapeInfo *tapeInfoPtr,
+         struct tapeScanInfo *scanInfoPtr)
 {
     afs_int32 code, c;
 
@@ -598,7 +610,8 @@ readDumps(afs_uint32 taskId, struct butm_tapeInfo *tapeInfoPtr, struct tapeScanI
 }
 
 afs_int32
-getScanTape(afs_int32 taskId, struct butm_tapeInfo *tapeInfoPtr, char *tname, afs_int32 tapeId, int prompt, struct butm_tapeLabel *tapeLabelPtr)
+getScanTape(afs_int32 taskId, struct butm_tapeInfo *tapeInfoPtr, char *tname,
+           afs_int32 tapeId, int prompt, struct butm_tapeLabel *tapeLabelPtr)
 {
     afs_int32 code = 0;
     int tapecount = 1;
@@ -896,7 +909,8 @@ databaseTape(char *tapeName)
 }
 
 afs_int32
-RcreateDump(struct tapeScanInfo *tapeScanInfoPtr, struct volumeHeader *volHeaderPtr)
+RcreateDump(struct tapeScanInfo *tapeScanInfoPtr,
+           struct volumeHeader *volHeaderPtr)
 {
     afs_int32 code;
     struct butm_tapeLabel *dumpLabelPtr = &tapeScanInfoPtr->dumpLabel;
index 61913a2..bb18131 100644 (file)
@@ -51,6 +51,8 @@
 #include <ctype.h>
 #include "error_macros.h"
 #include <afs/budb_errs.h>
+#include <afs/budb_client.h>
+#include <afs/bucoord_prototypes.h>
 #include "afs/butx.h"
 #define XBSA_TCMAIN
 #include "butc_xbsa.h"
@@ -64,7 +66,7 @@
 #define CFG_PREFIX "CFG"
 
 struct ubik_client *cstruct;
-extern void TC_ExecuteRequest();
+extern void TC_ExecuteRequest(struct rx_call *);
 FILE *logIO, *ErrorlogIO, *centralLogIO, *lastLogIO;
 char lFile[AFSDIR_PATH_MAX];
 char logFile[256];
@@ -110,7 +112,8 @@ afs_uint32 SHostAddrs[ADDRSPERSITE];
 
 /* dummy routine for the audit work.  It should do nothing since audits */
 /* occur at the server level and bos is not a server. */
-osi_audit()
+int
+osi_audit(void)
 {
     return 0;
 }
@@ -122,7 +125,7 @@ SafeATOL(register char *anum)
     register int tc;
 
     total = 0;
-    while (tc = *anum) {
+    while ((tc = *anum)) {
        if (tc < '0' || tc > '9')
            return -1;
        total *= 10;
@@ -248,7 +251,8 @@ atocl(char *numstring, char crunit, afs_int32 *number)
 }
 
 /* replace last two ocurrences of / by _ */
-static
+#if 0
+static int
 stringReplace(char *name)
 {
     char *pos;
@@ -262,8 +266,9 @@ stringReplace(char *name)
     strcat(name, buffer);
     return 0;
 }
+#endif
 
-static
+static int
 stringNowReplace(char *logFile, char *deviceName)
 {
     char *pos = 0;
@@ -281,7 +286,7 @@ stringNowReplace(char *logFile, char *deviceName)
        deviceName += devPrefLen;
        mvFlag++;
     }
-    while (pos = strchr(deviceName, devPrefix[0]))     /* look for / or \ */
+    while ((pos = strchr(deviceName, devPrefix[0])))   /* look for / or \ */
        *pos = '_';
     strcat(logFile, deviceName);
     /* now put back deviceName to the way it was */
index 57e57c5..e0b51de 100644 (file)
@@ -636,10 +636,10 @@ STC_TCInfo(struct rx_call *acid, struct tc_tcInfo *tciptr)
 afs_int32
 STC_DeleteDump(struct rx_call *acid, afs_uint32 dumpID, afs_uint32 *taskId)
 {
-    struct deleteDumpIf *ptr = 0;
-    statusP statusPtr = 0;
     afs_int32 code = TC_BADTASK;       /* If not compiled -Dxbsa then fail */
 #ifdef xbsa
+    struct deleteDumpIf *ptr = 0;
+    statusP statusPtr = 0;
 #ifdef AFS_PTHREAD_ENV
     pthread_t pid;
     pthread_attr_t tattr;
index cf677a0..16494a6 100644 (file)
 #include <afs/keys.h>
 #include <ubik.h>
 #include <afs/acl.h>
+#include <afs/volser.h>
+#include <afs/vlserver.h>
 #include <afs/tcdata.h>
 #include <afs/budb.h>
 #include <afs/budb_client.h>
 #include <afs/bubasics.h>
+#include <afs/bucoord_prototypes.h>
+#include <afs/butm_prototypes.h>
+#include <afs/budb_prototypes.h>
+#include <afs/afsutil.h>
+#include "butc_internal.h"
 #include "error_macros.h"
 
 /* GLOBAL CONFIGURATION PARAMETERS */
 extern int dump_namecheck;
 extern int autoQuery;
 
-static void initTapeBuffering();
-static writeDbDump();
-static restoreDbEntries();
+struct rstTapeInfo {
+    afs_int32 taskId;
+    afs_int32 tapeSeq;
+    afs_uint32 dumpid;
+};
+
+static void initTapeBuffering(void);
+static int writeDbDump(struct butm_tapeInfo *, afs_uint32, Date, afs_uint32);
+static int restoreDbEntries(struct butm_tapeInfo *, struct rstTapeInfo *);
+
+int getTapeData(struct butm_tapeInfo *, struct rstTapeInfo *, void *,
+               afs_int32);
+int restoreDbHeader(struct butm_tapeInfo *, struct rstTapeInfo *,
+                   struct structDumpHeader *);
+int restoreDbDump(struct butm_tapeInfo *, struct rstTapeInfo *,
+                 struct structDumpHeader *);
+int restoreText(struct butm_tapeInfo *, struct rstTapeInfo *,
+               struct structDumpHeader *);
+
+
 
 void * KeepAlive(void *);
 /* CreateDBDump
@@ -60,8 +84,7 @@ void * KeepAlive(void *);
  */
 
 afs_int32
-CreateDBDump(dumpEntryPtr)
-     struct budb_dumpEntry *dumpEntryPtr;
+CreateDBDump(struct budb_dumpEntry *dumpEntryPtr)
 {
     afs_int32 code = 0;
 
@@ -101,15 +124,9 @@ struct budb_dumpEntry lastDump;    /* the last dump of this volset */
  *      Leave the tape mounted.
  */
 afs_int32
-GetDBTape(taskId, expires, tapeInfoPtr, dumpid, sequence, queryFlag,
-         wroteLabel)
-     afs_int32 taskId;
-     Date expires;
-     struct butm_tapeInfo *tapeInfoPtr;
-     afs_uint32 dumpid;
-     afs_int32 sequence;
-     int queryFlag;
-     int *wroteLabel;
+GetDBTape(afs_int32 taskId, Date expires, struct butm_tapeInfo *tapeInfoPtr,
+         afs_uint32 dumpid, afs_int32 sequence, int queryFlag,
+         int *wroteLabel)
 {
     afs_int32 code = 0;
     int interactiveFlag;
@@ -122,7 +139,6 @@ GetDBTape(taskId, expires, tapeInfoPtr, dumpid, sequence, queryFlag,
 
     struct butm_tapeLabel oldTapeLabel, newLabel;
     struct tapeEntryList *endList;
-    extern struct tapeConfig globalTapeConfig;
 
     /* construct the name of the tape */
     sprintf(tapeName, "%s.%-d", DUMP_TAPE_NAME, sequence);
@@ -306,7 +322,7 @@ GetDBTape(taskId, expires, tapeInfoPtr, dumpid, sequence, queryFlag,
  */
 
 afs_int32
-freeTapeList()
+freeTapeList(void)
 {
     struct tapeEntryList *next;
 
@@ -327,8 +343,7 @@ freeTapeList()
  */
 
 afs_int32
-addTapesToDb(taskId)
-     afs_int32 taskId;
+addTapesToDb(afs_int32 taskId)
 {
     afs_int32 code = 0;
     afs_int32 i, new;
@@ -376,12 +391,9 @@ addTapesToDb(taskId)
  *     the blocksize on writes
  */
 
-static
-writeDbDump(tapeInfoPtr, taskId, expires, dumpid)
-     struct butm_tapeInfo *tapeInfoPtr;
-     afs_uint32 taskId;
-     Date expires;
-     afs_uint32 dumpid;
+static int
+writeDbDump(struct butm_tapeInfo *tapeInfoPtr, afs_uint32 taskId,
+           Date expires, afs_uint32 dumpid)
 {
     afs_int32 blockSize;
     afs_int32 writeBufNbytes = 0;
@@ -745,20 +757,14 @@ saveDbToTape(void *param)
     return (void *)(code);
 }
 
-struct rstTapeInfo {
-    afs_int32 taskId;
-    afs_int32 tapeSeq;
-    afs_uint32 dumpid;
-};
 
 /* makeDbDumpEntry()
  *      Make a database dump entry given a tape label.
  */
 
 afs_int32
-makeDbDumpEntry(tapeEntPtr, dumpEntryPtr)
-     struct budb_tapeEntry *tapeEntPtr;
-     struct budb_dumpEntry *dumpEntryPtr;
+makeDbDumpEntry(struct budb_tapeEntry *tapeEntPtr,
+               struct budb_dumpEntry *dumpEntryPtr)
 {
     memset(dumpEntryPtr, 0, sizeof(struct budb_dumpEntry));
 
@@ -788,10 +794,8 @@ makeDbDumpEntry(tapeEntPtr, dumpEntryPtr)
  */
 
 afs_int32
-readDbTape(tapeInfoPtr, rstTapeInfoPtr, query)
-     struct butm_tapeInfo *tapeInfoPtr;
-     struct rstTapeInfo *rstTapeInfoPtr;
-     int query;
+readDbTape(struct butm_tapeInfo *tapeInfoPtr,
+          struct rstTapeInfo *rstTapeInfoPtr, int query)
 {
     afs_int32 code = 0;
     int interactiveFlag;
@@ -907,7 +911,7 @@ readDbTape(tapeInfoPtr, rstTapeInfoPtr, query)
 
 static afs_int32 nbytes = 0;   /* # bytes left in buffer */
 static void
-initTapeBuffering()
+initTapeBuffering(void)
 {
     nbytes = 0;
 }
@@ -919,10 +923,9 @@ initTapeBuffering()
  *     tape positioned after tape label
  */
 
-static
-restoreDbEntries(tapeInfoPtr, rstTapeInfoPtr)
-     struct butm_tapeInfo *tapeInfoPtr;
-     struct rstTapeInfo *rstTapeInfoPtr;
+static int
+restoreDbEntries(struct butm_tapeInfo *tapeInfoPtr,
+                struct rstTapeInfo *rstTapeInfoPtr)
 {
     struct structDumpHeader netItemHeader, hostItemHeader;
     afs_int32 more = 1;
@@ -1147,10 +1150,10 @@ KeepAlive(void *unused)
  *     restore special items in the header
  */
 
-restoreDbHeader(tapeInfo, rstTapeInfoPtr, nextHeader)
-     struct butm_tapeInfo *tapeInfo;
-     struct rstTapeInfo *rstTapeInfoPtr;
-     struct structDumpHeader *nextHeader;
+int
+restoreDbHeader(struct butm_tapeInfo *tapeInfo,
+               struct rstTapeInfo *rstTapeInfoPtr,
+               struct structDumpHeader *nextHeader)
 {
     struct structDumpHeader netItemHeader;
     struct DbHeader netDbHeader, hostDbHeader;
@@ -1203,10 +1206,10 @@ restoreDbHeader(tapeInfo, rstTapeInfoPtr, nextHeader)
  *     a database dump tree exists on the tape
  */
 
-restoreDbDump(tapeInfo, rstTapeInfoPtr, nextHeader)
-     struct butm_tapeInfo *tapeInfo;
-     struct rstTapeInfo *rstTapeInfoPtr;
-     struct structDumpHeader *nextHeader;
+int
+restoreDbDump(struct butm_tapeInfo *tapeInfo,
+             struct rstTapeInfo *rstTapeInfoPtr,
+             struct structDumpHeader *nextHeader)
 {
     struct budb_dumpEntry netDumpEntry, hostDumpEntry;
     struct budb_tapeEntry netTapeEntry, hostTapeEntry;
@@ -1348,10 +1351,7 @@ restoreDbDump(tapeInfo, rstTapeInfoPtr, nextHeader)
  */
 
 afs_int32
-saveTextFile(taskId, textType, fileName)
-     afs_int32 taskId;
-     afs_int32 textType;
-     char *fileName;
+saveTextFile(afs_int32 taskId, afs_int32 textType, char *fileName)
 {
     udbClientTextP ctPtr = 0;
     afs_int32 code = 0;
@@ -1405,10 +1405,10 @@ saveTextFile(taskId, textType, fileName)
  *     nextHeader - struct header for next item on the tape
  */
 
-restoreText(tapeInfo, rstTapeInfoPtr, nextHeader)
-     struct butm_tapeInfo *tapeInfo;
-     struct rstTapeInfo *rstTapeInfoPtr;
-     struct structDumpHeader *nextHeader;
+int
+restoreText(struct butm_tapeInfo *tapeInfo,
+           struct rstTapeInfo *rstTapeInfoPtr,
+           struct structDumpHeader *nextHeader)
 {
     char filename[64];
     afs_int32 nbytes;
@@ -1536,15 +1536,14 @@ static char *tapeReadBufferPtr = 0;     /* position in buffer */
  *     fn retn - 0, ok, n, error
  */
 
-getTapeData(tapeInfoPtr, rstTapeInfoPtr, buffer, requestedBytes)
-     struct butm_tapeInfo *tapeInfoPtr;
-     struct rstTapeInfo *rstTapeInfoPtr;
-     char *buffer;
-     afs_int32 requestedBytes;
+int
+getTapeData(struct butm_tapeInfo *tapeInfoPtr,
+           struct rstTapeInfo *rstTapeInfoPtr,
+           void *out, afs_int32 requestedBytes)
 {
-    afs_int32 taskId, transferBytes, new;
+    char *buffer = (char *) out;
+    afs_int32 taskId, transferBytes;
     afs_int32 code = 0;
-    afs_uint32 dumpid;
 
     taskId = rstTapeInfoPtr->taskId;