From 83f09b167b4fb1891d04768c89b5b529491f4a99 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Mon, 16 Mar 2009 13:41:34 +0000 Subject: [PATCH] DEVEL15-budb-prototypes-20090316 LICENSE IPL10 FIXES 124240 prototype the budb directory (cherry picked from commit bd00e10eb7caf66de33640bf06722d0169231703) --- src/budb/budb_prototypes.h | 97 ++++++ src/budb/database.c | 11 +- src/budb/database.h | 8 +- src/budb/db_alloc.c | 56 ++-- src/budb/db_dump.c | 59 ++-- src/budb/db_hash.c | 227 ++++++-------- src/budb/db_lock.c | 53 ++-- src/budb/db_text.c | 81 ++--- src/budb/dbs_dump.c | 34 +-- src/budb/ol_verify.c | 135 ++++----- src/budb/procs.c | 586 +++++++++++++++---------------------- src/budb/server.c | 80 +++-- src/budb/struct_ops.c | 126 ++++---- 13 files changed, 670 insertions(+), 883 deletions(-) create mode 100644 src/budb/budb_prototypes.h diff --git a/src/budb/budb_prototypes.h b/src/budb/budb_prototypes.h new file mode 100644 index 000000000..0953a4944 --- /dev/null +++ b/src/budb/budb_prototypes.h @@ -0,0 +1,97 @@ +/* + * 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 _BUDB_PROTOTYPES_H +#define _BUDB_PROTOTYPES_H + +/* budb.ss.c */ +int BUDB_ExecuteRequest(register struct rx_call *z_call); + +/* db_alloc.c */ +afs_int32 InitDBalloc(void); +afs_int32 AllocStructure(struct ubik_trans *ut, char type, dbadr related, + dbadr *saP, void *s); +afs_int32 FreeStructure(struct ubik_trans *ut, char type, dbadr sa); +afs_int32 AllocBlock(struct ubik_trans *, struct block *, dbadr *); +afs_int32 FreeBlock(struct ubik_trans *, struct blockHeader *, dbadr); + +/* db_dump.c */ +afs_int32 writeDatabase(struct ubik_trans *, int); + +/* db_hash.c */ + +afs_int32 InitDBhash(void); +void ht_DBInit(void); +afs_int32 ht_HashOut(struct ubik_trans *ut, struct memoryHashTable *mht, + dbadr ea, void *e); +afs_int32 RemoveFromList(struct ubik_trans *ut, dbadr ea, void *e, + dbadr *head, dbadr ta, void *t, dbadr *thread); +afs_int32 ht_LookupEntry(struct ubik_trans *ut, struct memoryHashTable *mht, + void *key, dbadr *eaP, void *e); +afs_int32 ht_HashIn(struct ubik_trans *ut, struct memoryHashTable *mht, + dbadr ea, void *e); +afs_int32 scanHashTable(struct ubik_trans *ut, struct memoryHashTable *mhtPtr, + int (*selectFn) (dbadr, void *, void *), + int (*operationFn) (dbadr, void *, void *), + void *rockPtr); + +/* db_lock.c */ +int checkLockHandle(struct ubik_trans *, afs_uint32); + +/* dbs_dump.c */ +afs_int32 badEntry(afs_uint32 dbAddr); + +/* ol_verify.c */ +afs_int32 checkDiskAddress(unsigned long, int, int *, int *); + +/* procs.c */ +afs_int32 InitProcs(void); +int callPermitted(struct rx_call *); +afs_int32 InitRPC(struct ubik_trans **, int lock, int this_op); + +/* server.c */ + +void Log(char *fmt, ... ); +void LogError(long code, char *fmt, ... ); +void LogDebug(int level, char *fmt, ... ); + +/* struct_ops.c */ + +void tape_ntoh(struct tape *, struct tape *); +void principal_hton(struct budb_principal *, struct budb_principal *); +void principal_ntoh(struct budb_principal *, struct budb_principal *); +void structDumpHeader_hton(struct structDumpHeader *, + struct structDumpHeader *); + +int tapeSet_ntoh(struct budb_tapeSet *, struct budb_tapeSet *); +int tapeSet_hton(struct budb_tapeSet *, struct budb_tapeSet *); +void volInfo_ntoh(struct volInfo *, struct volInfo *); +void volFragment_ntoh(struct volFragment *, struct volFragment *); +void dump_ntoh(struct dump *, struct dump *); + +int dumpToBudbDump(dbDumpP, struct budb_dumpEntry *); + +int tapeToBudbTape(struct tape *r, struct budb_tapeEntry *); +int volsToBudbVol(struct volFragment *, struct volInfo *, + struct budb_volumeEntry *); + + +void printDump(FILE *, struct dump *); +int printPrincipal(struct budb_principal *ptr); +int printTape(FILE *, struct tape *); +int printTapeSet(struct budb_tapeSet *, afs_int32); +int printVolInfo(FILE *, struct volInfo *); +int printVolFragment(FILE *, struct volFragment *); +int printMemoryHashTable(FILE *, struct memoryHashTable *); + +/* database.c */ +afs_int32 CheckInit(struct ubik_trans *, int (*db_init) (struct ubik_trans *)); +afs_int32 InitDB(void); + +#endif diff --git a/src/budb/database.c b/src/budb/database.c index ff1ddeffd..bdee9ebfa 100644 --- a/src/budb/database.c +++ b/src/budb/database.c @@ -25,6 +25,7 @@ RCSID #include "budb_errs.h" #include "database.h" #include "error_macros.h" +#include "budb_prototypes.h" #include "afs/audit.h" #include @@ -32,15 +33,14 @@ int pollCount; struct memoryDB db; /* really allocate it here */ void -db_panic(reason) - char *reason; +db_panic(char *reason) { LogError(0, "db_panic: %s\n", reason); BUDB_EXIT(-1); } afs_int32 -InitDB() +InitDB(void) { afs_int32 code; @@ -170,9 +170,8 @@ cdbread(struct ubik_trans *ut, int type, afs_int32 pos, void *buff, afs_int32 le manner, to avoid bogusly reinitializing the db. */ afs_int32 -CheckInit(ut, db_init) - struct ubik_trans *ut; - int (*db_init) (); /* procedure to call if rebuilding DB */ +CheckInit(struct ubik_trans *ut, + int (*db_init) (struct ubik_trans *ut)) /* call if rebuilding DB */ { register afs_int32 code; diff --git a/src/budb/database.h b/src/budb/database.h index b2dcbca29..3d3484d3c 100644 --- a/src/budb/database.h +++ b/src/budb/database.h @@ -311,9 +311,11 @@ extern struct memoryDB db; #define MAX(x,y) ((x) > (y) ? (x) : (y)) #endif /* notdef */ -struct memoryHashTable *ht_GetType(); -extern afs_uint32 ht_HashEntry(); -extern dbadr ht_LookupBucket(); +struct memoryHashTable *ht_GetType(int type, int *e_sizeP); +extern afs_uint32 ht_HashEntry(struct memoryHashTable *mht, char *e); +extern dbadr ht_LookupBucket(struct ubik_trans *ut, + struct memoryHashTable *mht, + afs_uint32 hash, int old); extern afs_int32 dbwrite(struct ubik_trans *ut, afs_int32 pos, void *buff, afs_int32 len); extern afs_int32 dbread(struct ubik_trans *ut, afs_int32 pos, void *buff, afs_int32 len); diff --git a/src/budb/db_alloc.c b/src/budb/db_alloc.c index 4ac984a42..87206f46e 100644 --- a/src/budb/db_alloc.c +++ b/src/budb/db_alloc.c @@ -25,7 +25,7 @@ RCSID #include #include "budb_errs.h" #include "database.h" - +#include "budb_prototypes.h" /* block and structure allocation routines */ @@ -33,7 +33,7 @@ static int nEntries[NBLOCKTYPES]; static int sizeEntries[NBLOCKTYPES]; afs_int32 -InitDBalloc() +InitDBalloc(void) { nEntries[0] = 0; sizeEntries[0] = 0; @@ -60,10 +60,9 @@ InitDBalloc() */ afs_int32 -AllocBlock(ut, block, aP) - struct ubik_trans *ut; - struct block *block; /* copy of data */ - dbadr *aP; /* db addr of block */ +AllocBlock(struct ubik_trans *ut, + struct block *block, /* copy of data */ + dbadr *aP) /* db addr of block */ { dbadr a; @@ -96,10 +95,9 @@ AllocBlock(ut, block, aP) */ afs_int32 -FreeBlock(ut, bh, a) - struct ubik_trans *ut; - struct blockHeader *bh; /* copy of data */ - dbadr a; /* db address of block */ +FreeBlock(struct ubik_trans *ut, + struct blockHeader *bh, /* copy of data */ + dbadr a) /* db address of block */ { if (a != BlockBase(a)) db_panic("Block addr no good"); @@ -121,12 +119,7 @@ FreeBlock(ut, bh, a) */ afs_int32 -AllocStructure(ut, type, related, saP, s) - struct ubik_trans *ut; - char type; - dbadr related; - dbadr *saP; - char *s; +AllocStructure(struct ubik_trans *ut, char type, dbadr related, dbadr *saP, void *s) { dbadr a; /* block addr */ struct block b; /* copy of data */ @@ -141,11 +134,11 @@ AllocStructure(ut, type, related, saP, s) } bs = (afs_int32 *) b.a; /* ptr to first structure of block */ - if (db.h.freePtrs[type] == 0) { + if (db.h.freePtrs[(int) type] == 0) { /* no free items of specified type */ if (AllocBlock(ut, &b, &a) - || set_header_word(ut, freePtrs[type], htonl(a)) + || set_header_word(ut, freePtrs[(int) type], htonl(a)) ) { return BUDB_IO; } @@ -153,7 +146,7 @@ AllocStructure(ut, type, related, saP, s) b.h.next = 0; b.h.type = type; b.h.flags = 0; - b.h.nFree = ntohs(nEntries[type] - 1); + b.h.nFree = ntohs(nEntries[(int) type] - 1); *bs = 1; /* not free anymore */ if (dbwrite(ut, a, (char *)&b, sizeof(b))) @@ -167,7 +160,7 @@ AllocStructure(ut, type, related, saP, s) */ while (1) { - a = ntohl(db.h.freePtrs[type]); + a = ntohl(db.h.freePtrs[(int) type]); if (dbread(ut, a, (char *)&b, sizeof(b))) return BUDB_IO; @@ -178,8 +171,8 @@ AllocStructure(ut, type, related, saP, s) /* Completely empty blocks go to generic free list if there are * more blocks on this free list */ - if (b.h.next && (nFree == nEntries[type]) && (count-- > 0)) { - if (set_header_word(ut, freePtrs[type], b.h.next) + if (b.h.next && (nFree == nEntries[(int) type]) && (count-- > 0)) { + if (set_header_word(ut, freePtrs[(int) type], b.h.next) || FreeBlock(ut, &b.h, a) ) { return BUDB_IO; @@ -189,7 +182,7 @@ AllocStructure(ut, type, related, saP, s) /* we found a free structure */ if (nFree == 1) { /* if last free one: unthread block */ - if (set_header_word(ut, freePtrs[type], b.h.next)) + if (set_header_word(ut, freePtrs[(int) type], b.h.next)) return BUDB_IO; } break; @@ -202,10 +195,10 @@ AllocStructure(ut, type, related, saP, s) i = 0; while (*bs) { i++; - bs = (afs_int32 *) ((char *)bs + sizeEntries[type]); + bs = (afs_int32 *) ((char *)bs + sizeEntries[(int) type]); } - if (i >= nEntries[type]) + if (i >= nEntries[(int) type]) db_panic("free count inconsistent with block"); b.h.nFree = htons(nFree - 1); @@ -224,10 +217,9 @@ AllocStructure(ut, type, related, saP, s) afs_int32 -FreeStructure(ut, type, sa) - struct ubik_trans *ut; - char type; /* type of structure to allocate */ - dbadr sa; /* db addr of structure */ +FreeStructure(struct ubik_trans *ut, + char type, /* type of structure to allocate */ + dbadr sa) /* db addr of structure */ { struct blockHeader bh; /* header of containing block */ dbadr a; /* db address of block */ @@ -244,11 +236,11 @@ FreeStructure(ut, type, sa) db_panic("block and structure of different types"); bh.nFree = htons(nFree = ntohs(bh.nFree) + 1); - if (nFree > nEntries[type]) + if (nFree > nEntries[(int) type]) db_panic("free count too large"); if (nFree == 1) { /* add to free list for type */ - bh.next = db.h.freePtrs[type]; - if (set_header_word(ut, freePtrs[type], htonl(a))) + bh.next = db.h.freePtrs[(int) type]; + if (set_header_word(ut, freePtrs[(int) type], htonl(a))) return BUDB_IO; } diff --git a/src/budb/db_dump.c b/src/budb/db_dump.c index 983b1d2d4..5fab87d4b 100644 --- a/src/budb/db_dump.c +++ b/src/budb/db_dump.c @@ -35,6 +35,7 @@ RCSID #include "globals.h" #include "error_macros.h" #include "budb_errs.h" +#include "budb_prototypes.h" #include "afs/audit.h" @@ -61,8 +62,7 @@ dumpSyncP dumpSyncPtr = &dumpSync; */ afs_int32 -canWrite(fid) - int fid; +canWrite(int fid) { afs_int32 code = 0; extern dumpSyncP dumpSyncPtr; @@ -104,8 +104,7 @@ canWrite(fid) */ void -haveWritten(nbytes) - afs_int32 nbytes; +haveWritten(afs_int32 nbytes) { afs_int32 code = 0; extern dumpSyncP dumpSyncPtr; @@ -130,8 +129,7 @@ haveWritten(nbytes) */ void -doneWriting(error) - afs_int32 error; +doneWriting(afs_int32 error) { afs_int32 code = 0; @@ -178,9 +176,7 @@ doneWriting(error) */ afs_int32 -writeStructHeader(fid, type) - int fid; - afs_int32 type; +writeStructHeader(int fid, afs_int32 type) { struct structDumpHeader hostDumpHeader, netDumpHeader; @@ -231,9 +227,7 @@ writeStructHeader(fid, type) */ afs_int32 -writeTextHeader(fid, type) - int fid; - afs_int32 type; +writeTextHeader(int fid, afs_int32 type) { struct structDumpHeader hostDumpHeader, netDumpHeader; @@ -273,8 +267,7 @@ writeTextHeader(fid, type) } afs_int32 -writeDbHeader(fid) - int fid; +writeDbHeader(int fid) { struct DbHeader header; afs_int32 curtime; @@ -317,9 +310,7 @@ writeDbHeader(fid) */ afs_int32 -writeDump(fid, dumpPtr) - int fid; - dbDumpP dumpPtr; +writeDump(int fid, dbDumpP dumpPtr) { struct budb_dumpEntry dumpEntry; afs_int32 code = 0, tcode; @@ -342,10 +333,7 @@ writeDump(fid, dumpPtr) } afs_int32 -writeTape(fid, tapePtr, dumpid) - int fid; - struct tape *tapePtr; - afs_int32 dumpid; +writeTape(int fid, struct tape *tapePtr, afs_int32 dumpid) { struct budb_tapeEntry tapeEntry; afs_int32 code = 0, tcode; @@ -373,13 +361,8 @@ writeTape(fid, tapePtr, dumpid) /* combines volFragment and volInfo */ afs_int32 -writeVolume(ut, fid, volFragmentPtr, volInfoPtr, dumpid, tapeName) - struct ubik_trans *ut; - int fid; - struct volFragment *volFragmentPtr; - struct volInfo *volInfoPtr; - afs_int32 dumpid; - char *tapeName; +writeVolume(struct ubik_trans *ut, int fid, struct volFragment *volFragmentPtr, + struct volInfo *volInfoPtr, afs_int32 dumpid, char *tapeName) { struct budb_volumeEntry budbVolume; afs_int32 code = 0; @@ -416,8 +399,7 @@ writeVolume(ut, fid, volFragmentPtr, volInfoPtr, dumpid, tapeName) */ afs_int32 -checkLock(textType) - afs_int32 textType; +checkLock(afs_int32 textType) { db_lockP lockPtr; @@ -435,9 +417,8 @@ checkLock(textType) * check the integrity of the specified text type */ -checkText(ut, textType) - struct ubik_trans *ut; - afs_int32 textType; +int +checkText(struct ubik_trans *ut, afs_int32 textType) { struct textBlock *tbPtr; afs_int32 nBytes = 0; /* accumulated actual size */ @@ -482,10 +463,7 @@ checkText(ut, textType) */ afs_int32 -writeText(ut, fid, textType) - struct ubik_trans *ut; - int fid; - int textType; +writeText(struct ubik_trans *ut, int fid, int textType) { struct textBlock *tbPtr; afs_int32 textSize, writeSize; @@ -542,9 +520,7 @@ writeText(ut, fid, textType) #define MAXAPPENDS 200 afs_int32 -writeDatabase(ut, fid) - struct ubik_trans *ut; - int fid; +writeDatabase(struct ubik_trans *ut, int fid) { dbadr dbAddr, dbAppAddr; struct dump diskDump, apDiskDump; @@ -798,8 +774,7 @@ writeDatabase(ut, fid) #ifdef notdef afs_int32 -canWrite(fid) - int fid; +canWrite(int fid) { afs_int32 in, out, except; struct timeval tp; diff --git a/src/budb/db_hash.c b/src/budb/db_hash.c index f8e08ede9..c488e73a7 100644 --- a/src/budb/db_hash.c +++ b/src/budb/db_hash.c @@ -25,19 +25,21 @@ RCSID #include #include "budb_errs.h" #include "database.h" +#include "budb_prototypes.h" #include "error_macros.h" int sizeFunctions[HT_MAX_FUNCTION + 1]; int nHTBuckets = NhtBucketS; /* testing: we need small HT blocks */ +int ht_minHBlocks(struct memoryHashTable *mht); + /* ht_TableSize - return the size of table necessary to represent a hashtable * of given length in memory. It basically rounds the length up by the number * of buckets per block. */ int -ht_TableSize(length) - int length; +ht_TableSize(int length) { int n; if (length == 0) @@ -50,10 +52,7 @@ ht_TableSize(length) * It also resets the global variable nHTBuckets. */ static void -ht_ResetT(blocksP, sizeP, length) - struct memoryHTBlock ***blocksP; - int *sizeP; - int length; +ht_ResetT(struct memoryHTBlock ***blocksP, int *sizeP, int length) { struct memoryHTBlock **b = *blocksP; int newsize; @@ -87,10 +86,9 @@ ht_ResetT(blocksP, sizeP, length) */ void -ht_Reset(mht) - struct memoryHashTable *mht; +ht_Reset(struct memoryHashTable *mht) { - struct hashTable *ht; + struct hashTable *ht = NULL; if (!(mht && (ht = mht->ht))) db_panic("some ht called with bad mht"); @@ -106,7 +104,7 @@ ht_Reset(mht) test - initialization parameters: bit 4 is small ht. */ afs_int32 -InitDBhash() +InitDBhash(void) { sizeFunctions[0] = 0; @@ -125,7 +123,7 @@ InitDBhash() /* ht_DBInit - When rebuilding database, this sets up the hash tables. */ void -ht_DBInit() +ht_DBInit(void) { db.h.nHTBuckets = htonl(nHTBuckets); @@ -158,11 +156,9 @@ ht_DBInit() } afs_int32 -ht_AllocTable(ut, mht) - struct ubik_trans *ut; - struct memoryHashTable *mht; +ht_AllocTable(struct ubik_trans *ut, struct memoryHashTable *mht) { - struct hashTable *ht; + struct hashTable *ht = NULL; afs_int32 code; int len; int nb, mnb; /* number of blocks for hashTable */ @@ -206,21 +202,19 @@ ht_AllocTable(ut, mht) if (code) return code; } - if (code = set_word_addr(ut, 0, &db.h, &ht->table, htonl(b[0]->a))) + if ((code = set_word_addr(ut, 0, &db.h, &ht->table, htonl(b[0]->a)))) return code; - if (code = set_word_addr(ut, 0, &db.h, &ht->length, htonl(len))) + if ((code = set_word_addr(ut, 0, &db.h, &ht->length, htonl(len)))) return code; mht->length = len; return 0; } afs_int32 -ht_FreeTable(ut, mht) - struct ubik_trans *ut; - struct memoryHashTable *mht; +ht_FreeTable(struct ubik_trans *ut, struct memoryHashTable *mht) { - struct hashTable *ht; + struct hashTable *ht = NULL; afs_int32 code; struct blockHeader bh; dbadr a, na; @@ -238,7 +232,7 @@ ht_FreeTable(ut, mht) return BUDB_IO; } na = ntohl(bh.next); - if (code = FreeBlock(ut, &bh, a)) + if ((code = FreeBlock(ut, &bh, a))) return code; } if (set_word_addr(ut, 0, &db.h, &ht->oldTable, 0) @@ -250,15 +244,11 @@ ht_FreeTable(ut, mht) } afs_int32 -ht_GetTableBlock(ut, mht, hash, old, blockP, boP) - struct ubik_trans *ut; - struct memoryHashTable *mht; - afs_uint32 hash; - int old; - struct memoryHTBlock **blockP; - int *boP; +ht_GetTableBlock(struct ubik_trans *ut, struct memoryHashTable *mht, + afs_uint32 hash, int old, struct memoryHTBlock **blockP, + int *boP) { - struct hashTable *ht; + struct hashTable *ht = NULL; struct memoryHTBlock **b; int hi, bi; struct memoryHTBlock ***blocksP; @@ -346,9 +336,7 @@ ht_GetTableBlock(ut, mht, hash, old, blockP, boP) */ static afs_int32 -ht_MaybeAdjust(ut, mht) - struct ubik_trans *ut; - struct memoryHashTable *mht; +ht_MaybeAdjust(struct ubik_trans *ut, struct memoryHashTable *mht) { struct hashTable *ht = mht->ht; int numberEntries = ntohl(ht->entries); @@ -391,11 +379,8 @@ ht_MaybeAdjust(ut, mht) } dbadr -ht_LookupBucket(ut, mht, hash, old) - struct ubik_trans *ut; - struct memoryHashTable *mht; - afs_uint32 hash; - int old; +ht_LookupBucket(struct ubik_trans *ut, struct memoryHashTable *mht, + afs_uint32 hash, int old) { struct memoryHTBlock *block; int bo; @@ -413,8 +398,7 @@ ht_LookupBucket(ut, mht, hash, old) * from insufficient mixing of the hash information. */ afs_uint32 -Old2StringHashFunction(str) - unsigned char *str; +Old2StringHashFunction(unsigned char *str) { afs_uint32 hash = 1000003; /* big prime to make "" hash nicely */ while (*str) @@ -426,8 +410,7 @@ Old2StringHashFunction(str) * problem is that the hash needs to be mixed up not the incoming character. */ afs_uint32 -Old3StringHashFunction(str) - unsigned char *str; +Old3StringHashFunction(unsigned char *str) { afs_uint32 hash = 1000003; /* big prime to make "" hash nicely */ while (*str) @@ -440,8 +423,7 @@ Old3StringHashFunction(str) * It behaves especially badly for hash tables whose size is a power of two. */ afs_uint32 -Old4StringHashFunction(str) - unsigned char *str; +Old4StringHashFunction(unsigned char *str) { afs_uint32 hash = 1000003; /* big prime to make "" hash nicely */ while (*str) @@ -453,8 +435,7 @@ Old4StringHashFunction(str) * #3 with a hash table as big as 8200. */ afs_uint32 -Old5StringHashFunction(str) - unsigned char *str; +Old5StringHashFunction(unsigned char *str) { afs_uint32 hash = 1000003; /* big prime to make "" hash nicely */ while (*str) @@ -468,8 +449,7 @@ Old5StringHashFunction(str) * better than the random hash function. */ afs_uint32 -Old6StringHashFunction(str) - unsigned char *str; +Old6StringHashFunction(unsigned char *str) { afs_uint32 hash = 1000003; /* big prime to make "" hash nicely */ while (*str) @@ -483,8 +463,7 @@ Old6StringHashFunction(str) * well. All these differences are fairly small, however. */ afs_uint32 -Old7StringHashFunction(str) - unsigned char *str; +Old7StringHashFunction(unsigned char *str) { afs_uint32 hash = 1000003; /* big prime to make "" hash nicely */ while (*str) @@ -497,8 +476,7 @@ Old7StringHashFunction(str) * multiplies, which may be faster on some architectures. */ afs_uint32 -Old8StringHashFunction(str) - unsigned char *str; +Old8StringHashFunction(unsigned char *str) { afs_uint32 hash = 1000003; /* big prime to make "" hash nicely */ while (*str) @@ -514,8 +492,7 @@ Old8StringHashFunction(str) * odd. It behaves beeter than the random hash function. */ afs_uint32 -StringHashFunction(str) - unsigned char *str; +StringHashFunction(unsigned char *str) { afs_uint32 hash = 1000003; /* big prime to make "" hash nicely */ /* The multiplicative constant should be odd and have a goodly number of @@ -526,8 +503,7 @@ StringHashFunction(str) } afs_uint32 -IdHashFunction(id) - afs_uint32 id; +IdHashFunction(afs_uint32 id) { afs_uint32 l, r; id *= 81847; @@ -541,8 +517,7 @@ IdHashFunction(id) * twice the number of buckets. */ int -ht_minHBlocks(mht) - struct memoryHashTable *mht; +ht_minHBlocks(struct memoryHashTable *mht) { int retval; @@ -562,14 +537,14 @@ ht_minHBlocks(mht) default: db_panic("Illegal hash function type"); + retval = -1; /* not reached */ } return (retval); } afs_uint32 -ht_HashEntry(mht, e) - struct memoryHashTable *mht; - char *e; /* entry's address (in b) */ +ht_HashEntry(struct memoryHashTable *mht, + char *e) /* entry's address (in b) */ { int type = ntohl(mht->ht->functionType); afs_uint32 retval; @@ -581,22 +556,23 @@ ht_HashEntry(mht, e) break; case HT_dumpName_FUNCTION: - retval = StringHashFunction(((struct dump *)e)->dumpName); + retval = StringHashFunction((unsigned char *)((struct dump *)e)->dumpName); LogDebug(5, "HashEntry: dumpname returns %d\n", retval); break; case HT_tapeName_FUNCTION: - retval = StringHashFunction(((struct tape *)e)->name); + retval = StringHashFunction((unsigned char *)((struct tape *)e)->name); LogDebug(5, "HashEntry: tapename returns %d\n", retval); break; case HT_volName_FUNCTION: - retval = StringHashFunction(((struct volInfo *)e)->name); + retval = StringHashFunction((unsigned char *)((struct volInfo *)e)->name); LogDebug(5, "HashEntry: volname returns %d\n", retval); break; default: db_panic("illegal hash function"); + retval = -1; /* not reached */ } return (retval); @@ -609,9 +585,7 @@ ht_HashEntry(mht, e) */ struct memoryHashTable * -ht_GetType(type, e_sizeP) - int type; - int *e_sizeP; +ht_GetType(int type, int *e_sizeP) { struct memoryHashTable *mht; @@ -646,10 +620,7 @@ ht_GetType(type, e_sizeP) } static int -ht_KeyMatch(type, key, e) - int type; - char *key; - char *e; +ht_KeyMatch(int type, char *key, char *e) { switch (type) { case HT_dumpIden_FUNCTION: @@ -679,14 +650,13 @@ ht_KeyMatch(type, key, e) */ afs_int32 -ht_LookupEntry(ut, mht, key, eaP, e) - struct ubik_trans *ut; - struct memoryHashTable *mht; - char *key; /* pointer to lookup key to match */ - dbadr *eaP; /* db addr of entry found or zero */ - char *e; /* contents of located entry */ +ht_LookupEntry(struct ubik_trans *ut, + struct memoryHashTable *mht, + void *key, /* pointer to lookup key to match */ + dbadr *eaP, /* db addr of entry found or zero */ + void *e) /* contents of located entry */ { - struct hashTable *ht; + struct hashTable *ht = NULL; int type; int e_size; int old; @@ -716,7 +686,7 @@ ht_LookupEntry(ut, mht, key, eaP, e) *eaP = a; return 0; } - a = ntohl(*(dbadr *) (e + mht->threadOffset)); + a = ntohl(*(dbadr *) ((char *)e + mht->threadOffset)); } if (old) return 0; @@ -731,12 +701,8 @@ ht_LookupEntry(ut, mht, key, eaP, e) */ static afs_int32 -ht_HashInList(ut, mht, opQuota, block, blockOffset) - struct ubik_trans *ut; - struct memoryHashTable *mht; - int *opQuota; - struct memoryHTBlock *block; - int blockOffset; +ht_HashInList(struct ubik_trans *ut, struct memoryHashTable *mht, + int *opQuota, struct memoryHTBlock *block, int blockOffset) { struct hashTable *ht = mht->ht; afs_int32 code; @@ -746,7 +712,7 @@ ht_HashInList(ut, mht, opQuota, block, blockOffset) int e_size = sizeFunctions[ntohl(ht->functionType)]; if (mht->length == 0) { - if (code = ht_AllocTable(ut, mht)) { + if ((code = ht_AllocTable(ut, mht))) { Log("ht_HashInList: ht_AllocTable failed\n"); return code; } @@ -825,9 +791,7 @@ ht_HashInList(ut, mht, opQuota, block, blockOffset) */ static afs_int32 -ht_MoveEntries(ut, mht) - struct ubik_trans *ut; - struct memoryHashTable *mht; +ht_MoveEntries(struct ubik_trans *ut, struct memoryHashTable *mht) { struct memoryHTBlock *block; afs_uint32 hash; @@ -887,9 +851,7 @@ ht_MoveEntries(ut, mht) #ifdef notdef static afs_int32 -ht_MoveEntries(ut, mht) - struct ubik_trans *ut; - struct memoryHashTable *mht; +ht_MoveEntries(struct ubik_trans *ut, struct memoryHashTable *mht) { afs_uint32 hash; int bo; @@ -944,13 +906,12 @@ ht_MoveEntries(ut, mht) #endif /* notdef */ afs_int32 -ht_HashIn(ut, mht, ea, e) - struct ubik_trans *ut; - struct memoryHashTable *mht; - dbadr ea; /* block db address */ - char *e; /* entry's address (in b) */ +ht_HashIn(struct ubik_trans *ut, + struct memoryHashTable *mht, + dbadr ea, /* block db address */ + void *e) /* entry's address (in b) */ { - struct hashTable *ht; + struct hashTable *ht = NULL; afs_uint32 hash; struct memoryHTBlock *block; int bo; @@ -959,10 +920,10 @@ ht_HashIn(ut, mht, ea, e) if (!(mht && (ht = mht->ht))) db_panic("some ht called with bad mht"); - if (code = ht_MaybeAdjust(ut, mht)) + if ((code = ht_MaybeAdjust(ut, mht))) return code; if (mht->length == 0) - if (code = ht_AllocTable(ut, mht)) + if ((code = ht_AllocTable(ut, mht))) return code; hash = ht_HashEntry(mht, e); @@ -1002,17 +963,16 @@ ht_HashIn(ut, mht, ea, e) * but is not otherwise used. */ afs_int32 -RemoveFromList(ut, ea, e, head, ta, t, thread) - struct ubik_trans *ut; - dbadr ea; /* db addr of head structure */ - char *e; /* head structure */ - dbadr *head; /* address of head pointer */ - dbadr ta; /* db addr of strucure to be removed */ - char *t; /* structure being removed */ - dbadr *thread; /* pointer to thread pointer */ +RemoveFromList(struct ubik_trans *ut, + dbadr ea, /* db addr of head structure */ + void *e, /* head structure */ + dbadr *head, /* address of head pointer */ + dbadr ta, /* db addr of strucure to be removed */ + void *t, /* structure being removed */ + dbadr *thread) /* pointer to thread pointer */ { afs_int32 code; - int threadOffset = ((char *)thread - t); + int threadOffset = ((char *)thread - (char *)t); dbadr next_a; /* db addr of next element in list */ dbadr loop_a; /* db addr of current list element */ @@ -1037,13 +997,8 @@ RemoveFromList(ut, ea, e, head, ta, t, thread) } afs_int32 -ht_HashOutT(ut, mht, hash, ea, e, old) - struct ubik_trans *ut; - struct memoryHashTable *mht; - afs_uint32 hash; - dbadr ea; - char *e; - int old; +ht_HashOutT(struct ubik_trans *ut, struct memoryHashTable *mht, + afs_uint32 hash, dbadr ea, char *e, int old) { struct memoryHTBlock *block; int bo; @@ -1097,11 +1052,8 @@ ht_HashOutT(ut, mht, hash, ea, e, old) } afs_int32 -ht_HashOut(ut, mht, ea, e) - struct ubik_trans *ut; - struct memoryHashTable *mht; - dbadr ea; - char *e; +ht_HashOut(struct ubik_trans *ut, struct memoryHashTable *mht, dbadr ea, + void *e) { afs_uint32 hash; afs_int32 code; @@ -1139,28 +1091,23 @@ ht_HashOut(ut, mht, ea, e) afs_int32 -scanHashTableBlock(ut, mhtPtr, htBlockPtr, old, length, index, selectFn, - operationFn, rockPtr) - struct ubik_trans *ut; - struct memoryHashTable *mhtPtr; - struct htBlock *htBlockPtr; - int old; - afs_int32 length; /* size of whole hash table */ - int index; /* base index of this block */ - int (*selectFn) (); - int (*operationFn) (); - char *rockPtr; +scanHashTableBlock(struct ubik_trans *ut, + struct memoryHashTable *mhtPtr, + struct htBlock *htBlockPtr, + int old, + afs_int32 length, /* size of whole hash table */ + int index, /* base index of this block */ + int (*selectFn) (dbadr, void *, void *), + int (*operationFn) (dbadr, void *, void *), + void *rockPtr) { int type; /* hash table type */ int entrySize; /* hashed entry size */ - afs_uint32 *mapEntryPtr = 0; /* for status checks */ - char entry[sizeof(struct block)]; dbadr entryAddr, nextEntryAddr; int i; - afs_int32 code = 0; type = ntohl(mhtPtr->ht->functionType); entrySize = sizeFunctions[type]; @@ -1200,12 +1147,10 @@ scanHashTableBlock(ut, mhtPtr, htBlockPtr, old, length, index, selectFn, } afs_int32 -scanHashTable(ut, mhtPtr, selectFn, operationFn, rockPtr) - struct ubik_trans *ut; - struct memoryHashTable *mhtPtr; - int (*selectFn) (); - int (*operationFn) (); - char *rockPtr; +scanHashTable(struct ubik_trans *ut, struct memoryHashTable *mhtPtr, + int (*selectFn) (dbadr, void *, void *), + int (*operationFn) (dbadr, void *, void *), + void *rockPtr) { struct htBlock hashTableBlock; dbadr tableAddr; /* disk addr of hash block */ diff --git a/src/budb/db_lock.c b/src/budb/db_lock.c index 949f5f959..4ebecb418 100644 --- a/src/budb/db_lock.c +++ b/src/budb/db_lock.c @@ -25,17 +25,20 @@ RCSID #include #include "budb_errs.h" #include "database.h" +#include "budb_prototypes.h" #include "error_macros.h" #include "afs/audit.h" #define DBH_POS(ptr) ( (char *) (ptr) - (char *) &db.h ) -afs_int32 FreeAllLocks(), FreeLock(), GetInstanceId(), GetLock(); +afs_int32 FreeAllLocks(struct rx_call *, afs_uint32); +afs_int32 FreeLock(struct rx_call *, afs_uint32); +afs_int32 GetInstanceId(struct rx_call *, afs_uint32 *); +afs_int32 GetLock(struct rx_call *, afs_uint32, afs_int32, afs_int32, + afs_uint32 *); afs_int32 -SBUDB_FreeAllLocks(call, instanceId) - struct rx_call *call; - afs_uint32 instanceId; +SBUDB_FreeAllLocks(struct rx_call *call, afs_uint32 instanceId) { afs_int32 code; @@ -45,9 +48,7 @@ SBUDB_FreeAllLocks(call, instanceId) } afs_int32 -FreeAllLocks(call, instanceId) - struct rx_call *call; - afs_uint32 instanceId; +FreeAllLocks(struct rx_call *call, afs_uint32 instanceId) { db_lockP startPtr, endPtr; struct ubik_trans *ut; @@ -81,9 +82,7 @@ FreeAllLocks(call, instanceId) } afs_int32 -SBUDB_FreeLock(call, lockHandle) - struct rx_call *call; - afs_uint32 lockHandle; +SBUDB_FreeLock(struct rx_call *call, afs_uint32 lockHandle) { afs_int32 code; @@ -93,9 +92,7 @@ SBUDB_FreeLock(call, lockHandle) } afs_int32 -FreeLock(call, lockHandle) - struct rx_call *call; - afs_uint32 lockHandle; +FreeLock(struct rx_call *call, afs_uint32 lockHandle) { db_lockP lockPtr = 0; struct ubik_trans *ut; @@ -128,9 +125,7 @@ FreeLock(call, lockHandle) } afs_int32 -SBUDB_GetInstanceId(call, instanceId) - struct rx_call *call; - afs_uint32 *instanceId; +SBUDB_GetInstanceId(struct rx_call *call, afs_uint32 *instanceId) { afs_int32 code; @@ -140,9 +135,7 @@ SBUDB_GetInstanceId(call, instanceId) } afs_int32 -GetInstanceId(call, instanceId) - struct rx_call *call; - afs_uint32 *instanceId; +GetInstanceId(struct rx_call *call, afs_uint32 *instanceId) { struct ubik_trans *ut; afs_int32 code; @@ -169,12 +162,8 @@ GetInstanceId(call, instanceId) afs_int32 -SBUDB_GetLock(call, instanceId, lockName, expiration, lockHandle) - struct rx_call *call; - afs_uint32 instanceId; - afs_int32 lockName; - afs_int32 expiration; - afs_uint32 *lockHandle; +SBUDB_GetLock(struct rx_call *call, afs_uint32 instanceId, afs_int32 lockName, + afs_int32 expiration, afs_uint32 *lockHandle) { afs_int32 code; @@ -184,12 +173,8 @@ SBUDB_GetLock(call, instanceId, lockName, expiration, lockHandle) } afs_int32 -GetLock(call, instanceId, lockName, expiration, lockHandle) - struct rx_call *call; - afs_uint32 instanceId; - afs_int32 lockName; - afs_int32 expiration; - afs_uint32 *lockHandle; +GetLock(struct rx_call *call, afs_uint32 instanceId, afs_int32 lockName, + afs_int32 expiration, afs_uint32 *lockHandle) { struct timeval tv; db_lockP lockPtr; @@ -245,10 +230,8 @@ GetLock(call, instanceId, lockName, expiration, lockHandle) * 0 - if invalid handle * 1 - if handle is valid */ - -checkLockHandle(ut, lockHandle) - struct ubik_trans *ut; - afs_uint32 lockHandle; +int +checkLockHandle(struct ubik_trans *ut, afs_uint32 lockHandle) { return (((lockHandle > 0) && (lockHandle <= TB_NUM)) ? 1 : 0); } diff --git a/src/budb/db_text.c b/src/budb/db_text.c index ab21aeaea..860a8ead5 100644 --- a/src/budb/db_text.c +++ b/src/budb/db_text.c @@ -29,6 +29,7 @@ RCSID #include "budb_errs.h" #include "database.h" #include "error_macros.h" +#include "budb_prototypes.h" #include "afs/audit.h" #include @@ -43,18 +44,16 @@ RCSID * routine mallocs storage for charListPtr, freed by stub */ -afs_int32 GetText(), GetTextVersion(), SaveText(); +afs_int32 GetText(struct rx_call *, afs_uint32, afs_int32, afs_int32, + afs_int32, afs_int32 *, charListT *); +afs_int32 GetTextVersion(struct rx_call *, afs_int32, afs_uint32 *); +afs_int32 SaveText(struct rx_call *, afs_uint32, afs_int32, afs_int32, + afs_int32, charListT *); afs_int32 -SBUDB_GetText(call, lockHandle, textType, maxLength, offset, nextOffset, - charListPtr) - struct rx_call *call; - afs_uint32 lockHandle; - afs_int32 textType; - afs_int32 maxLength; - afs_int32 offset; - afs_int32 *nextOffset; - charListT *charListPtr; +SBUDB_GetText(struct rx_call *call, afs_uint32 lockHandle, afs_int32 textType, + afs_int32 maxLength, afs_int32 offset, afs_int32 *nextOffset, + charListT *charListPtr) { afs_int32 code; @@ -66,15 +65,9 @@ SBUDB_GetText(call, lockHandle, textType, maxLength, offset, nextOffset, } afs_int32 -GetText(call, lockHandle, textType, maxLength, offset, nextOffset, - charListPtr) - struct rx_call *call; - afs_uint32 lockHandle; - afs_int32 textType; - afs_int32 maxLength; - afs_int32 offset; - afs_int32 *nextOffset; - charListT *charListPtr; +GetText(struct rx_call *call, afs_uint32 lockHandle, afs_int32 textType, + afs_int32 maxLength, afs_int32 offset, afs_int32 *nextOffset, + charListT *charListPtr) { struct ubik_trans *ut = 0; struct block block; @@ -188,7 +181,7 @@ GetText(call, lockHandle, textType, maxLength, offset, nextOffset, *nextOffset = -1; } - error_exit: + /* error_exit: */ code = ubik_EndTrans(ut); /* printf("in error exit, code=%ld\n", code); */ return (code); @@ -204,13 +197,12 @@ GetText(call, lockHandle, textType, maxLength, offset, nextOffset, return (code); } -freeOldBlockChain(ut, diskAddr) - struct ubik_trans *ut; - dbadr diskAddr; +int +freeOldBlockChain(struct ubik_trans *ut, dbadr diskAddr) { struct blockHeader blockHeader; dbadr nextDiskAddr; - afs_int32 code; + afs_int32 code = 0; while (diskAddr != 0) { /* read in the header */ @@ -233,10 +225,8 @@ freeOldBlockChain(ut, diskAddr) */ afs_int32 -SBUDB_GetTextVersion(call, textType, tversion) - struct rx_call *call; - afs_int32 textType; - afs_uint32 *tversion; +SBUDB_GetTextVersion(struct rx_call *call, afs_int32 textType, + afs_uint32 *tversion) { afs_int32 code; @@ -246,10 +236,8 @@ SBUDB_GetTextVersion(call, textType, tversion) } afs_int32 -GetTextVersion(call, textType, tversion) - struct rx_call *call; - afs_int32 textType; - afs_uint32 *tversion; +GetTextVersion(struct rx_call *call, afs_int32 textType, + afs_uint32 *tversion) { afs_int32 code; struct ubik_trans *ut; @@ -280,13 +268,9 @@ GetTextVersion(call, textType, tversion) */ afs_int32 -SBUDB_SaveText(call, lockHandle, textType, offset, flags, charListPtr) - struct rx_call *call; - afs_uint32 lockHandle; - afs_int32 textType; - afs_int32 offset; - afs_int32 flags; - charListT *charListPtr; +SBUDB_SaveText(struct rx_call *call, afs_uint32 lockHandle, + afs_int32 textType, afs_int32 offset, afs_int32 flags, + charListT *charListPtr) { afs_int32 code; @@ -296,13 +280,8 @@ SBUDB_SaveText(call, lockHandle, textType, offset, flags, charListPtr) } afs_int32 -SaveText(call, lockHandle, textType, offset, flags, charListPtr) - struct rx_call *call; - afs_uint32 lockHandle; - afs_int32 textType; - afs_int32 offset; - afs_int32 flags; - charListT *charListPtr; +SaveText(struct rx_call *call, afs_uint32 lockHandle, afs_int32 textType, + afs_int32 offset, afs_int32 flags, charListT *charListPtr) { struct ubik_trans *ut; struct block diskBlock; @@ -473,7 +452,7 @@ SaveText(call, lockHandle, textType, offset, flags, charListPtr) if (code) ABORT(code); - error_exit: +/*error_exit: */ code = ubik_EndTrans(ut); return (code); @@ -484,10 +463,7 @@ SaveText(call, lockHandle, textType, offset, flags, charListPtr) /* debug support */ void -saveTextToFile(ut, tbPtr) - struct ubik_trans *ut; - struct textBlock *tbPtr; - +saveTextToFile(struct ubik_trans *ut, struct textBlock *tbPtr) { afs_int32 blockAddr; struct block block; @@ -526,8 +502,7 @@ saveTextToFile(ut, tbPtr) */ int -mkstemp(st) - char *st; +mkstemp(char *st) { int retval = -1; diff --git a/src/budb/dbs_dump.c b/src/budb/dbs_dump.c index 2b943255e..2a7c68b30 100644 --- a/src/budb/dbs_dump.c +++ b/src/budb/dbs_dump.c @@ -40,10 +40,13 @@ RCSID #include "budb.h" #include "budb_errs.h" #include "database.h" +#include "budb_prototypes.h" #include "error_macros.h" #include "globals.h" #include "afs/audit.h" +afs_int32 DumpDB(struct rx_call *, int, afs_int32, charListT *, afs_int32 *); +afs_int32 RestoreDbHeader(struct rx_call *, struct DbHeader *); void *dumpWatcher(void *); /* dump ubik database - interface routines */ @@ -53,8 +56,7 @@ void *dumpWatcher(void *); */ afs_int32 -badEntry(dbAddr) - afs_uint32 dbAddr; +badEntry(afs_uint32 dbAddr) { /* return entry ok */ return (0); @@ -91,14 +93,9 @@ setupDbDump(void *param) } -afs_int32 DumpDB(), RestoreDbHeader(); afs_int32 -SBUDB_DumpDB(call, firstcall, maxLength, charListPtr, done) - struct rx_call *call; - int firstcall; - afs_int32 maxLength; - charListT *charListPtr; - afs_int32 *done; +SBUDB_DumpDB(struct rx_call *call, int firstcall, afs_int32 maxLength, + charListT *charListPtr, afs_int32 *done) { afs_int32 code; @@ -108,12 +105,11 @@ SBUDB_DumpDB(call, firstcall, maxLength, charListPtr, done) } afs_int32 -DumpDB(call, firstcall, maxLength, charListPtr, done) - struct rx_call *call; - int firstcall; /* 1 - init. 0 - no init */ - afs_int32 maxLength; - charListT *charListPtr; - afs_int32 *done; +DumpDB(struct rx_call *call, + int firstcall, /* 1 - init. 0 - no init */ + afs_int32 maxLength, + charListT *charListPtr, + afs_int32 *done) { #ifdef AFS_PTHREAD_ENV pthread_t dumperPid, watcherPid; @@ -275,9 +271,7 @@ DumpDB(call, firstcall, maxLength, charListPtr, done) } afs_int32 -SBUDB_RestoreDbHeader(call, header) - struct rx_call *call; - struct DbHeader *header; +SBUDB_RestoreDbHeader(struct rx_call *call, struct DbHeader *header) { afs_int32 code; @@ -287,9 +281,7 @@ SBUDB_RestoreDbHeader(call, header) } afs_int32 -RestoreDbHeader(call, header) - struct rx_call *call; - struct DbHeader *header; +RestoreDbHeader(struct rx_call *call, struct DbHeader *header) { struct ubik_trans *ut = 0; afs_int32 code = 0; diff --git a/src/budb/ol_verify.c b/src/budb/ol_verify.c index 0951ea8cb..02076c26e 100644 --- a/src/budb/ol_verify.c +++ b/src/budb/ol_verify.c @@ -30,6 +30,7 @@ RCSID #include "database.h" #include "error_macros.h" #include "budb_errs.h" +#include "budb_prototypes.h" #include #include "afs/audit.h" @@ -168,10 +169,10 @@ int hashBlockType[HT_MAX_FUNCTION + 1] = { struct mapCompatability { short trigger; /* these bits trigger this element */ } mapC[] = { -MAP_FREE, MAP_HTBLOCK, MAP_DUMPHASH | MAP_IDHASH, - MAP_TAPEHASH | MAP_TAPEONDUMP, MAP_VOLINFOONNAME, - MAP_VOLINFONAMEHEAD | MAP_VOLHASH, - MAP_VOLFRAGONTAPE | MAP_VOLFRAGONVOL, MAP_TEXTBLOCK}; + {MAP_FREE}, {MAP_HTBLOCK}, {MAP_DUMPHASH | MAP_IDHASH}, + {MAP_TAPEHASH | MAP_TAPEONDUMP}, {MAP_VOLINFOONNAME}, + {MAP_VOLINFONAMEHEAD | MAP_VOLHASH}, + {MAP_VOLFRAGONTAPE | MAP_VOLFRAGONVOL}, {MAP_TEXTBLOCK}}; /* no. of entries in the mapC array */ int NMAPCs = (sizeof(mapC) / sizeof(mapC[0])); @@ -187,6 +188,11 @@ char *textName[TB_NUM] = { extern int sizeFunctions[]; extern int nHTBuckets; +afs_int32 DbVerify(struct rx_call *call, afs_int32 *status, + afs_int32 *orphans, afs_int32 *host); +afs_int32 verifyTextChain(struct ubik_trans *ut, struct textBlock *tbPtr); + + #define DBBAD BUDB_DATABASEINCONSISTENT /* ------------------------------------ @@ -202,7 +208,7 @@ extern int nHTBuckets; */ afs_int32 -BumpErrors() +BumpErrors(void) { if (++miscData.errors >= miscData.maxErrors) return (1); @@ -221,11 +227,8 @@ BumpErrors() */ afs_int32 -checkDiskAddress(address, type, blockIndexPtr, entryIndexPtr) - unsigned long address; - int type; - int *blockIndexPtr; - int *entryIndexPtr; +checkDiskAddress(unsigned long address, int type, int *blockIndexPtr, + int *entryIndexPtr) { int index, offset; @@ -269,10 +272,7 @@ checkDiskAddress(address, type, blockIndexPtr, entryIndexPtr) */ afs_int32 -ConvertDiskAddress(address, blockIndexPtr, entryIndexPtr) - afs_uint32 address; - int *blockIndexPtr; - int *entryIndexPtr; +ConvertDiskAddress(afs_uint32 address, int *blockIndexPtr, int *entryIndexPtr) { int index, type; afs_int32 code; @@ -285,8 +285,7 @@ ConvertDiskAddress(address, blockIndexPtr, entryIndexPtr) } char * -TypeName(index) - int index; +TypeName(int index) { static char error[36]; @@ -322,12 +321,11 @@ getDumpID(struct ubik_trans *ut, * to the dump. */ afs_int32 -verifyDumpEntry(ut, dumpAddr, ai, ao, dumpPtr) - struct ubik_trans *ut; - afs_int32 dumpAddr; - int ai, ao; - struct dump *dumpPtr; +verifyDumpEntry(struct ubik_trans *ut, afs_int32 dumpAddr, int ai, int ao, + void *param) { + struct dump *dumpPtr = (struct dump *)param; + struct tape tape; afs_int32 tapeAddr, tapeCount = 0, volCount = 0, appDumpCount = 0; afs_int32 appDumpAddr, appDumpIndex, appDumpOffset; @@ -456,12 +454,10 @@ verifyDumpEntry(ut, dumpAddr, ai, ao, dumpPtr) * they belong to the tape. */ afs_int32 -verifyTapeEntry(ut, tapeAddr, ai, ao, tapePtr) - struct ubik_trans *ut; - afs_int32 tapeAddr; - int ai, ao; - struct tape *tapePtr; +verifyTapeEntry(struct ubik_trans *ut, afs_int32 tapeAddr, int ai, int ao, + void *param) { + struct tape *tapePtr = (struct tape *) param; int volCount = 0, ccheck = 1; afs_int32 volFragAddr; int blockIndex, entryIndex; @@ -535,12 +531,10 @@ verifyTapeEntry(ut, tapeAddr, ai, ao, tapePtr) * So no check is done agaist it. */ afs_int32 -verifyVolFragEntry(ut, va, ai, ao, v) - struct ubik_trans *ut; - afs_int32 va; - int ai, ao; - struct volFragment *v; +verifyVolFragEntry(struct ubik_trans *ut, afs_int32 va, int ai, int ao, + void *param) { + /* struct volFragment *v = (struct volFragment *)param; */ misc->nVolFrag++; return 0; } @@ -552,12 +546,11 @@ verifyVolFragEntry(ut, va, ai, ao, v) * also verify all entries are also on the chain. */ afs_int32 -verifyVolInfoEntry(ut, volInfoAddr, ai, ao, volInfo) - struct ubik_trans *ut; - afs_int32 volInfoAddr; - int ai, ao; - struct volInfo *volInfo; +verifyVolInfoEntry(struct ubik_trans *ut, afs_int32 volInfoAddr, int ai, + int ao, void *param) { + struct volInfo *volInfo = (struct volInfo *) param; + int volCount = 0, ccheck = 1; afs_int32 volFragAddr; int blockIndex, entryIndex; @@ -683,8 +676,7 @@ verifyVolInfoEntry(ut, volInfoAddr, ai, ao, volInfo) * blockMap array. Also check that the type of block is good. */ afs_int32 -verifyBlocks(ut) - struct ubik_trans *ut; +verifyBlocks(struct ubik_trans *ut) { struct block block; int blocktype; @@ -740,14 +732,13 @@ int minvols, maxvols, ttlvols; * entry and is not threaded on multiple lists. */ afs_int32 -verifyHashTableBlock(ut, mhtPtr, htBlockPtr, old, length, index, mapBit) - struct ubik_trans *ut; - struct memoryHashTable *mhtPtr; - struct htBlock *htBlockPtr; - int old; - afs_int32 length; /* size of whole hash table */ - int index; /* base index of this block */ - int mapBit; +verifyHashTableBlock(struct ubik_trans *ut, + struct memoryHashTable *mhtPtr, + struct htBlock *htBlockPtr, + int old, + afs_int32 length, /* size of whole hash table */ + int index, /* base index of this block */ + int mapBit) { int type; /* hash table type */ int entrySize; /* hashed entry size */ @@ -843,10 +834,8 @@ verifyHashTableBlock(ut, mhtPtr, htBlockPtr, old, length, index, mapBit) * the hash table. */ afs_int32 -verifyHashTable(ut, mhtPtr, mapBit) - struct ubik_trans *ut; - struct memoryHashTable *mhtPtr; - int mapBit; +verifyHashTable(struct ubik_trans *ut, struct memoryHashTable *mhtPtr, + int mapBit) { struct hashTable *htPtr = mhtPtr->ht; @@ -944,8 +933,7 @@ verifyHashTable(ut, mhtPtr, mapBit) * the integrity of each allocated structure. */ afs_int32 -verifyEntryChains(ut) - struct ubik_trans *ut; +verifyEntryChains(struct ubik_trans *ut) { afs_int32 code; afs_int32 offset; @@ -955,7 +943,8 @@ verifyEntryChains(ut) int type; int nFree; - static afs_int32(*checkEntry[NBLOCKTYPES]) () + static afs_int32(*checkEntry[NBLOCKTYPES]) (struct ubik_trans *, + afs_int32, int, int, void *) = { /* FIXME: this list does not match typeName[] and may be incorrect */ 0, /* free block */ @@ -1013,7 +1002,7 @@ verifyEntryChains(ut) afs_int32 -verifyFreeLists() +verifyFreeLists(void) { int i; afs_int32 addr; @@ -1078,7 +1067,7 @@ verifyFreeLists() * checking the bits for compatibility. */ afs_int32 -verifyMapBits() +verifyMapBits(void) { int blockIndex, entryIndex, i, entrySize, type, bits; afs_int32 offset; @@ -1178,12 +1167,10 @@ verifyMapBits() } afs_int32 -verifyText(ut) - struct ubik_trans *ut; +verifyText(struct ubik_trans *ut) { int i; afs_int32 code; - extern afs_int32 verifyTextChain(); /* check each of the text types in use */ for (i = 0; i < TB_NUM; i++) { @@ -1199,9 +1186,7 @@ verifyText(ut) * check the integrity of a text chain. Also checks the new chain. */ afs_int32 -verifyTextChain(ut, tbPtr) - struct ubik_trans *ut; - struct textBlock *tbPtr; +verifyTextChain(struct ubik_trans *ut, struct textBlock *tbPtr) { dbadr blockAddr; int blockIndex, entryIndex; @@ -1262,16 +1247,14 @@ verifyTextChain(ut, tbPtr) */ afs_int32 -verifyDatabase(ut, recreateFile) - struct ubik_trans *ut; - FILE *recreateFile; /* not used */ +verifyDatabase(struct ubik_trans *ut, + FILE *recreateFile) /* not used */ { afs_int32 eof; int bmsize; - afs_int32 code = 0, tcode; + afs_int32 code = 0, tcode = 0; extern int nBlocks; /* no. blocks in database */ - extern struct ubik_dbase *BU_dbase; /* clear verification statistics */ misc = &miscData; @@ -1426,13 +1409,9 @@ verifyDatabase(ut, recreateFile) * orphans - no. of orphan blocks * host - address of host that did verification */ -afs_int32 DbVerify(); afs_int32 -SBUDB_DbVerify(call, status, orphans, host) - struct rx_call *call; - afs_int32 *status; - afs_int32 *orphans; - afs_int32 *host; +SBUDB_DbVerify(struct rx_call *call, afs_int32 *status, afs_int32 *orphans, + afs_int32 *host) { afs_int32 code; @@ -1442,11 +1421,8 @@ SBUDB_DbVerify(call, status, orphans, host) } afs_int32 -DbVerify(call, status, orphans, host) - struct rx_call *call; - afs_int32 *status; - afs_int32 *orphans; - afs_int32 *host; +DbVerify(struct rx_call *call, afs_int32 *status, afs_int32 *orphans, + afs_int32 *host) { struct ubik_trans *ut = 0; afs_int32 code = 0, tcode; @@ -1495,9 +1471,8 @@ DbVerify(call, status, orphans, host) /* check_header * do a simple sanity check on the database header */ - -check_header(callerst) - char *callerst; +void +check_header(char *callerst) { static int iteration_count = 0; afs_int32 eof; diff --git a/src/budb/procs.c b/src/budb/procs.c index 8f5e47c08..22a84a0bd 100644 --- a/src/budb/procs.c +++ b/src/budb/procs.c @@ -47,6 +47,7 @@ RCSID #include "budb.h" #include "budb_errs.h" #include "database.h" +#include "budb_prototypes.h" #include "error_macros.h" #include "globals.h" #include "afs/audit.h" @@ -59,13 +60,43 @@ RCSID extern struct ubik_dbase *BU_dbase; extern struct afsconf_dir *BU_conf; /* for getting cell info */ -afs_int32 AddVolume(), AddVolumes(), CreateDump(), DoDeleteDump(), -DoDeleteTape(), ListDumps(); -afs_int32 DeleteVDP(), FindClone(), FindDump(), FindLatestDump(); -afs_int32 FinishDump(), FinishTape(), GetDumps(), getExpiration(), -T_DumpDatabase(); -afs_int32 makeAppended(), MakeDumpAppended(), FindLastTape(), GetTapes(); -afs_int32 GetVolumes(), UseTape(), T_DumpHashTable(), T_GetVersion(); +afs_int32 AddVolume(struct rx_call *, struct budb_volumeEntry *); +afs_int32 AddVolumes(struct rx_call *, struct budb_volumeList *); +afs_int32 CreateDump(struct rx_call *, struct budb_dumpEntry *); +afs_int32 DoDeleteDump(struct rx_call *, dumpId, Date, Date, budb_dumpsList *); +afs_int32 DoDeleteTape(struct rx_call *, struct budb_tapeEntry *); +afs_int32 ListDumps(struct rx_call *, afs_int32, afs_int32, Date, Date, + budb_dumpsList *, budb_dumpsList *); +afs_int32 DeleteVDP(struct rx_call *, char *, char *, afs_int32); +afs_int32 FindClone(struct rx_call *, afs_int32, char *, afs_int32 *); +afs_int32 FindDump(struct rx_call *, char *, afs_int32, + struct budb_dumpEntry *); +afs_int32 FindLatestDump(struct rx_call *, char *, char *, + struct budb_dumpEntry *); +afs_int32 FinishDump(struct rx_call *, struct budb_dumpEntry *); +afs_int32 FinishTape(struct rx_call *, struct budb_tapeEntry *); +afs_int32 GetDumps(struct rx_call *, afs_int32, afs_int32, char *, + afs_int32, afs_int32, afs_int32, afs_int32 *, + afs_int32 *, budb_dumpList *); +afs_int32 getExpiration(struct ubik_trans *ut, struct tape *); +afs_int32 makeAppended(struct ubik_trans *ut, afs_int32, afs_int32, + afs_int32); +afs_int32 MakeDumpAppended(struct rx_call *, afs_int32, afs_int32, + afs_int32); +afs_int32 FindLastTape(struct rx_call *, afs_int32, struct budb_dumpEntry *, + struct budb_tapeEntry *, struct budb_volumeEntry *); +afs_int32 GetTapes(struct rx_call *, afs_int32, afs_int32, char *, afs_int32, + afs_int32, afs_int32, afs_int32 *, afs_int32 *, + budb_tapeList *); +afs_int32 GetVolumes(struct rx_call *, afs_int32, afs_int32, char *, + afs_int32, afs_int32, afs_int32, afs_int32 *, + afs_int32 *, budb_volumeList *); +afs_int32 UseTape(struct rx_call *, struct budb_tapeEntry *, int *); +afs_int32 T_DumpHashTable(struct rx_call *, int, char *); +afs_int32 T_GetVersion(struct rx_call *, int *); +afs_int32 T_DumpDatabase(struct rx_call *, char *); + +int volFragsDump(struct ubik_trans *, FILE *, dbadr); /* Text block management */ @@ -94,14 +125,14 @@ static int procsInited = 0; /* This variable is protected by the procsInited flag. */ -static int (*rebuildDatabase) (); +static int (*rebuildDatabase) (struct ubik_trans *); /* AwaitInitialization * Wait unitl budb has initialized (InitProcs). If it hasn't * within 5 seconds, then return no quorum. */ afs_int32 -AwaitInitialization() +AwaitInitialization(void) { afs_int32 start = 0; @@ -125,8 +156,7 @@ AwaitInitialization() */ char * -tailCompPtr(pathNamePtr) - char *pathNamePtr; +tailCompPtr(char *pathNamePtr) { char *ptr; ptr = strrchr(pathNamePtr, '/'); @@ -148,8 +178,7 @@ tailCompPtr(pathNamePtr) */ int -callPermitted(call) - struct rx_call *call; +callPermitted(struct rx_call *call) { int permitted = 0; struct afsconf_dir *acdir; @@ -179,10 +208,9 @@ callPermitted(call) */ afs_int32 -InitRPC(ut, lock, this_op) - struct ubik_trans **ut; - int lock; /* indicate read/write transaction */ - int this_op; /* opcode of RCP, for COUNT_ABO */ +InitRPC(struct ubik_trans **ut, + int lock, /* indicate read/write transaction */ + int this_op) /* opcode of RCP, for COUNT_ABO */ { int code; float wait = 0.91; /* start waiting for 1 second */ @@ -190,7 +218,7 @@ InitRPC(ut, lock, this_op) start: /* wait for server initialization to finish if this is not InitProcs calling */ if (this_op) - if (code = AwaitInitialization()) + if ((code = AwaitInitialization())) return code; for (code = UNOQUORUM; code == UNOQUORUM;) { @@ -217,7 +245,7 @@ InitRPC(ut, lock, this_op) Log("Have established quorum\n"); /* set lock at posiion 1, for 1 byte of type lock */ - if (code = ubik_SetLock(*ut, 1, 1, lock)) { + if ((code = ubik_SetLock(*ut, 1, 1, lock))) { ubik_AbortTrans(*ut); return code; } @@ -225,20 +253,20 @@ InitRPC(ut, lock, this_op) /* check that dbase is initialized and setup cheader */ if (lock == LOCKREAD) { /* init but don't fix because this is read only */ - if (code = CheckInit(*ut, 0)) { + if ((code = CheckInit(*ut, 0))) { ubik_AbortTrans(*ut); - if (code = InitRPC(ut, LOCKWRITE, 0)) { /* Now fix the database */ + if ((code = InitRPC(ut, LOCKWRITE, 0))) { /* Now fix the database */ LogError(code, "InitRPC: InitRPC failed\n"); return code; } - if (code = ubik_EndTrans(*ut)) { + if ((code = ubik_EndTrans(*ut))) { LogError(code, "InitRPC: ubik_EndTrans failed\n"); return code; } goto start; /* now redo the read transaction */ } } else { - if (code = CheckInit(*ut, rebuildDatabase)) { + if ((code = CheckInit(*ut, rebuildDatabase))) { ubik_AbortTrans(*ut); return code; } @@ -249,8 +277,7 @@ InitRPC(ut, lock, this_op) /* This is called to initialize a newly created database */ static int -initialize_database(ut) - struct ubik_trans *ut; +initialize_database(struct ubik_trans *ut) { return 0; } @@ -259,7 +286,7 @@ static int noAuthenticationRequired; /* global state */ static int recheckNoAuth; /* global state */ afs_int32 -InitProcs() +InitProcs(void) { struct ubik_trans *ut; afs_int32 code = 0; @@ -287,7 +314,7 @@ InitProcs() rebuildDatabase = initialize_database; - if (code = InitRPC(&ut, LOCKREAD, 0)) { + if ((code = InitRPC(&ut, LOCKREAD, 0))) { LogError(code, "InitProcs: InitRPC failed\n"); return code; } @@ -311,8 +338,7 @@ struct returnList { }; static void -InitReturnList(list) - struct returnList *list; +InitReturnList(struct returnList *list) { list->nElements = 0; list->allocSize = 0; @@ -320,8 +346,7 @@ InitReturnList(list) } static void -FreeReturnList(list) - struct returnList *list; +FreeReturnList(struct returnList *list) { if (list->elements) free(list->elements); @@ -334,10 +359,7 @@ FreeReturnList(list) * with SendReturnList(). The first *to_skipP are not recorded. */ static afs_int32 -AddToReturnList(list, a, to_skipP) - struct returnList *list; - dbadr a; - afs_int32 *to_skipP; +AddToReturnList(struct returnList *list, dbadr a, afs_int32 *to_skipP) { char *tmp; afs_int32 size; @@ -375,10 +397,7 @@ AddToReturnList(list, a, to_skipP) } afs_int32 -FillVolEntry(ut, va, vol) - struct ubik_trans *ut; - dbadr va; - struct budb_volumeEntry *vol; +FillVolEntry(struct ubik_trans *ut, dbadr va, struct budb_volumeEntry *vol) { struct dump d; struct tape t; @@ -414,10 +433,7 @@ FillVolEntry(ut, va, vol) } afs_int32 -FillDumpEntry(ut, da, dump) - struct ubik_trans *ut; - dbadr da; - struct budb_dumpEntry *dump; +FillDumpEntry(struct ubik_trans *ut, dbadr da, struct budb_dumpEntry *dump) { struct dump d, ad; @@ -459,10 +475,7 @@ FillDumpEntry(ut, da, dump) } afs_int32 -FillTapeEntry(ut, ta, tape) - struct ubik_trans *ut; - dbadr ta; - struct budb_tapeEntry *tape; +FillTapeEntry(struct ubik_trans *ut, dbadr ta, struct budb_tapeEntry *tape) { struct tape t; struct dump d; @@ -472,7 +485,7 @@ FillTapeEntry(ut, ta, tape) return BUDB_IO; /* Get the tape's expiration date */ - if (code = getExpiration(ut, &t)) + if ((code = getExpiration(ut, &t))) return (code); strcpy(tape->name, t.name); @@ -503,20 +516,21 @@ FillTapeEntry(ut, ta, tape) * if there are more and how many to skip on the next request. */ static afs_int32 -SendReturnList(ut, list, FillProc, e_size, index, nextIndexP, dbTimeP, eList) - struct ubik_trans *ut; - struct returnList *list; /* list of elements to return */ -afs_int32(*FillProc) (); /* proc to fill entry */ - int e_size; /* size of each element */ - afs_int32 index; /* index from previous call */ - afs_int32 *nextIndexP; /* if more elements are available */ - afs_int32 *dbTimeP; /* time of last db update */ - budb_dumpList *eList; /* rxgen list structure (e.g.) */ +SendReturnList(struct ubik_trans *ut, + struct returnList *list, /* list of elements to return */ + afs_int32(*FillProc) (struct ubik_trans *, dbadr da, + budb_dumpEntry *), + /* proc to fill entry */ + int e_size, /* size of each element */ + afs_int32 index, /* index from previous call */ + afs_int32 *nextIndexP, /* if more elements are available */ + afs_int32 *dbTimeP, /* time of last db update */ + budb_dumpList *eList) /* rxgen list structure (e.g.) */ { afs_int32 code; int to_return; int i; - char *e; + void *e; *nextIndexP = -1; *dbTimeP = ntohl(db.h.lastUpdate); @@ -542,7 +556,7 @@ afs_int32(*FillProc) (); /* proc to fill entry */ e = (char *)(eList->budb_dumpList_val); for (i = 0; i < to_return; i++, e += e_size) { - code = (*FillProc) (ut, list->elements[i], e); + code = (*FillProc) (ut, list->elements[i], (budb_dumpEntry *) e); if (code) return code; } @@ -555,10 +569,7 @@ afs_int32(*FillProc) (); /* proc to fill entry */ /* Come here to delete a volInfo structure. */ static afs_int32 -DeleteVolInfo(ut, via, vi) - struct ubik_trans *ut; - dbadr via; - struct volInfo *vi; +DeleteVolInfo(struct ubik_trans *ut, dbadr via, struct volInfo *vi) { afs_int32 code; dbadr hvia; @@ -594,10 +605,7 @@ DeleteVolInfo(ut, via, vi) write it out. */ static afs_int32 -DeleteVolFragment(ut, va, v) - struct ubik_trans *ut; - dbadr va; - struct volFragment *v; +DeleteVolFragment(struct ubik_trans *ut, dbadr va, struct volFragment *v) { afs_int32 code; struct volInfo vi; @@ -614,9 +622,9 @@ DeleteVolFragment(ut, va, v) if (code) return code; if (vi.firstFragment == 0) - if (code = DeleteVolInfo(ut, via, &vi)) + if ((code = DeleteVolInfo(ut, via, &vi))) return code; - if (code = FreeStructure(ut, volFragment_BLOCK, va)) + if ((code = FreeStructure(ut, volFragment_BLOCK, va))) return code; /* decrement frag counter */ @@ -632,10 +640,7 @@ DeleteVolFragment(ut, va, v) * also responsible for writing the tape out if necessary. */ static afs_int32 -DeleteTape(ut, ta, t) - struct ubik_trans *ut; - dbadr ta; - struct tape *t; +DeleteTape(struct ubik_trans *ut, dbadr ta, struct tape *t) { afs_int32 code; struct dump d; @@ -664,10 +669,7 @@ DeleteTape(ut, ta, t) } static afs_int32 -DeleteDump(ut, da, d) - struct ubik_trans *ut; - dbadr da; - struct dump *d; +DeleteDump(struct ubik_trans *ut, dbadr da, struct dump *d) { afs_int32 code = 0; @@ -704,9 +706,7 @@ DeleteDump(ut, da, d) */ static int -VolInfoMatch(vol, vi) - struct budb_volumeEntry *vol; - struct volInfo *vi; +VolInfoMatch(struct budb_volumeEntry *vol, struct volInfo *vi) { return ((strcmp(vol->name, vi->name) == 0) && /* same volume name */ (vol->id == ntohl(vi->id)) && /* same volume id */ @@ -724,11 +724,8 @@ VolInfoMatch(vol, vi) */ static afs_int32 -GetVolInfo(ut, volP, viaP, viP) - struct ubik_trans *ut; - struct budb_volumeEntry *volP; - dbadr *viaP; - struct volInfo *viP; +GetVolInfo(struct ubik_trans *ut, struct budb_volumeEntry *volP, dbadr *viaP, + struct volInfo *viP) { dbadr hvia, via; struct volInfo hvi; @@ -818,11 +815,8 @@ GetVolInfo(ut, volP, viaP, viP) */ afs_int32 -deleteSomeVolumesFromTape(ut, tapeAddr, tapePtr, maxVolumesToDelete) - struct ubik_trans *ut; - dbadr tapeAddr; - struct tape *tapePtr; - int maxVolumesToDelete; +deleteSomeVolumesFromTape(struct ubik_trans *ut, dbadr tapeAddr, + struct tape *tapePtr, int maxVolumesToDelete) { dbadr volFragAddr, nextVolFragAddr, dumpAddr; struct volFragment volFrag; @@ -888,10 +882,7 @@ deleteSomeVolumesFromTape(ut, tapeAddr, tapePtr, maxVolumesToDelete) */ afs_int32 -deleteDump(call, id, dumps) - struct rx_call *call; - dumpId id; - budb_dumpsList *dumps; +deleteDump(struct rx_call *call, dumpId id, budb_dumpsList *dumps) { struct ubik_trans *ut; dbadr dumpAddr, tapeAddr, appendedDump; @@ -1032,16 +1023,11 @@ struct wantDumpRock { int -wantDump(dumpAddrParam, dumpParam, dumpListPtrParam) - char *dumpAddrParam; - char *dumpParam; - char *dumpListPtrParam; +wantDump(dbadr dumpAddr, void *dumpParam, void *dumpListPtrParam) { - dbadr dumpAddr; struct dump *dumpPtr; struct wantDumpRock *rockPtr; - dumpAddr = (dbadr) dumpAddrParam; dumpPtr = (struct dump *)dumpParam; rockPtr = (struct wantDumpRock *)dumpListPtrParam; @@ -1057,17 +1043,12 @@ wantDump(dumpAddrParam, dumpParam, dumpListPtrParam) } int -rememberDump(dumpAddrParam, dumpParam, dumpListPtrParam) - char *dumpAddrParam; - char *dumpParam; - char *dumpListPtrParam; +rememberDump(dbadr dumpAddr, void *dumpParam, void *dumpListPtrParam) { - dbadr dumpAddr; struct dump *dumpPtr; struct wantDumpRock *rockPtr; struct chosenDump *ptr, *deletedPtr, **nextPtr; - dumpAddr = (dbadr) dumpAddrParam; dumpPtr = (struct dump *)dumpParam; rockPtr = (struct wantDumpRock *)dumpListPtrParam; @@ -1106,9 +1087,7 @@ rememberDump(dumpAddrParam, dumpParam, dumpListPtrParam) */ afs_int32 -SBUDB_AddVolume(call, vol) - struct rx_call *call; - struct budb_volumeEntry *vol; +SBUDB_AddVolume(struct rx_call *call, struct budb_volumeEntry *vol) { afs_int32 code; @@ -1119,9 +1098,7 @@ SBUDB_AddVolume(call, vol) } afs_int32 -AddVolume(call, vol) - struct rx_call *call; - struct budb_volumeEntry *vol; +AddVolume(struct rx_call *call, struct budb_volumeEntry *vol) { struct ubik_trans *ut; dbadr da, ta, via, va; @@ -1235,9 +1212,7 @@ AddVolume(call, vol) afs_int32 -SBUDB_AddVolumes(call, vols) - struct rx_call *call; - struct budb_volumeList *vols; +SBUDB_AddVolumes(struct rx_call *call, struct budb_volumeList *vols) { afs_int32 code; @@ -1247,9 +1222,7 @@ SBUDB_AddVolumes(call, vols) } afs_int32 -AddVolumes(call, vols) - struct rx_call *call; - struct budb_volumeList *vols; +AddVolumes(struct rx_call *call, struct budb_volumeList *vols) { struct budb_volumeEntry *vol, *vol1; struct ubik_trans *ut; @@ -1387,9 +1360,7 @@ AddVolumes(call, vols) */ afs_int32 -SBUDB_CreateDump(call, dump) - struct rx_call *call; - struct budb_dumpEntry *dump; +SBUDB_CreateDump(struct rx_call *call, struct budb_dumpEntry *dump) { afs_int32 code; @@ -1404,9 +1375,7 @@ SBUDB_CreateDump(call, dump) } afs_int32 -CreateDump(call, dump) - struct rx_call *call; - struct budb_dumpEntry *dump; +CreateDump(struct rx_call *call, struct budb_dumpEntry *dump) { struct ubik_trans *ut; dbadr findDumpAddr, da; @@ -1553,12 +1522,8 @@ CreateDump(call, dump) } afs_int32 -SBUDB_DeleteDump(call, id, fromTime, toTime, dumps) - struct rx_call *call; - dumpId id; - Date fromTime; - Date toTime; - budb_dumpsList *dumps; +SBUDB_DeleteDump(struct rx_call *call, dumpId id, Date fromTime, Date toTime, + budb_dumpsList *dumps) { afs_int32 code; @@ -1570,12 +1535,8 @@ SBUDB_DeleteDump(call, id, fromTime, toTime, dumps) #define MAXOFFS 30 afs_int32 -DoDeleteDump(call, id, fromTime, toTime, dumps) - struct rx_call *call; - dumpId id; - Date fromTime; - Date toTime; - budb_dumpsList *dumps; +DoDeleteDump(struct rx_call *call, dumpId id, Date fromTime, Date toTime, + budb_dumpsList *dumps) { afs_int32 code = 0; @@ -1588,12 +1549,9 @@ DoDeleteDump(call, id, fromTime, toTime, dumps) } afs_int32 -SBUDB_ListDumps(call, sflags, name, groupid, fromTime, toTime, dumps, flags) - struct rx_call *call; - afs_int32 sflags, groupid; - char *name; - Date fromTime, toTime; - budb_dumpsList *dumps, *flags; +SBUDB_ListDumps(struct rx_call *call, afs_int32 sflags, char *name, + afs_int32 groupid, Date fromTime, Date toTime, + budb_dumpsList *dumps, budb_dumpsList *flags) { afs_int32 code; @@ -1603,11 +1561,9 @@ SBUDB_ListDumps(call, sflags, name, groupid, fromTime, toTime, dumps, flags) } afs_int32 -ListDumps(call, sflags, groupid, fromTime, toTime, dumps, flags) - struct rx_call *call; - afs_int32 sflags, groupid; - Date fromTime, toTime; - budb_dumpsList *dumps, *flags; +ListDumps(struct rx_call *call, afs_int32 sflags, afs_int32 groupid, + Date fromTime, Date toTime, budb_dumpsList *dumps, + budb_dumpsList *flags) { struct ubik_trans *ut; struct memoryHashTable *mht; @@ -1738,9 +1694,8 @@ ListDumps(call, sflags, groupid, fromTime, toTime, dumps, flags) } afs_int32 -SBUDB_DeleteTape(call, tape) - struct rx_call *call; - struct budb_tapeEntry *tape; /* tape info */ +SBUDB_DeleteTape(struct rx_call *call, + struct budb_tapeEntry *tape) /* tape info */ { afs_int32 code; @@ -1751,9 +1706,8 @@ SBUDB_DeleteTape(call, tape) } afs_int32 -DoDeleteTape(call, tape) - struct rx_call *call; - struct budb_tapeEntry *tape; /* tape info */ +DoDeleteTape(struct rx_call *call, + struct budb_tapeEntry *tape) /* tape info */ { struct ubik_trans *ut; struct tape t; @@ -1806,11 +1760,8 @@ DoDeleteTape(call, tape) */ afs_int32 -SBUDB_DeleteVDP(call, dsname, dumpPath, curDumpId) - struct rx_call *call; - char *dsname; - char *dumpPath; - afs_int32 curDumpId; +SBUDB_DeleteVDP(struct rx_call *call, char *dsname, char *dumpPath, + afs_int32 curDumpId) { afs_int32 code; @@ -1820,11 +1771,8 @@ SBUDB_DeleteVDP(call, dsname, dumpPath, curDumpId) } afs_int32 -DeleteVDP(call, dsname, dumpPath, curDumpId) - struct rx_call *call; - char *dsname; - char *dumpPath; - afs_int32 curDumpId; +DeleteVDP(struct rx_call *call, char *dsname, char *dumpPath, + afs_int32 curDumpId) { struct dump dump; dbadr dumpAddr; @@ -1894,11 +1842,8 @@ DeleteVDP(call, dsname, dumpPath, curDumpId) */ afs_int32 -SBUDB_FindClone(call, dumpID, volName, clonetime) - struct rx_call *call; - afs_int32 dumpID; - char *volName; - afs_int32 *clonetime; +SBUDB_FindClone(struct rx_call *call, afs_int32 dumpID, char *volName, + afs_int32 *clonetime) { afs_int32 code; @@ -1908,11 +1853,8 @@ SBUDB_FindClone(call, dumpID, volName, clonetime) } afs_int32 -FindClone(call, dumpID, volName, clonetime) - struct rx_call *call; - afs_int32 dumpID; - char *volName; - afs_int32 *clonetime; +FindClone(struct rx_call *call, afs_int32 dumpID, char *volName, + afs_int32 *clonetime) { struct ubik_trans *ut; dbadr da, hvia, via, vfa; @@ -1994,11 +1936,8 @@ FindClone(call, dumpID, volName, clonetime) * Re-write to do lookups by volume name. */ afs_int32 -FindClone(call, dumpID, volName, clonetime) - struct rx_call *call; - afs_int32 dumpID; - char *volName; - afs_int32 *clonetime; +FindClone(struct rx_call *call, afs_int32 dumpID, char *volName, + afs_int32 *clonetime) { struct ubik_trans *ut; dbadr diskAddr, tapeAddr, volFragmentAddr; @@ -2085,11 +2024,8 @@ FindClone(call, dumpID, volName, clonetime) */ afs_int32 -SBUDB_FindDump(call, volumeName, beforeDate, deptr) - struct rx_call *call; - char *volumeName; - afs_int32 beforeDate; - struct budb_dumpEntry *deptr; +SBUDB_FindDump(struct rx_call *call, char *volumeName, afs_int32 beforeDate, + struct budb_dumpEntry *deptr) { afs_int32 code; @@ -2099,11 +2035,8 @@ SBUDB_FindDump(call, volumeName, beforeDate, deptr) } afs_int32 -FindDump(call, volumeName, beforeDate, deptr) - struct rx_call *call; - char *volumeName; - afs_int32 beforeDate; - struct budb_dumpEntry *deptr; +FindDump(struct rx_call *call, char *volumeName, afs_int32 beforeDate, + struct budb_dumpEntry *deptr) { struct ubik_trans *ut; dbadr volInfoAddr, volFragmentAddr; @@ -2192,10 +2125,8 @@ FindDump(call, volumeName, beforeDate, deptr) */ afs_int32 -SBUDB_FindLatestDump(call, vsname, dumpPath, dumpentry) - struct rx_call *call; - char *vsname, *dumpPath; - struct budb_dumpEntry *dumpentry; +SBUDB_FindLatestDump(struct rx_call *call, char *vsname, char *dumpPath, + struct budb_dumpEntry *dumpentry) { afs_int32 code; @@ -2205,10 +2136,8 @@ SBUDB_FindLatestDump(call, vsname, dumpPath, dumpentry) } afs_int32 -FindLatestDump(call, vsname, dumpPath, dumpentry) - struct rx_call *call; - char *vsname, *dumpPath; - struct budb_dumpEntry *dumpentry; +FindLatestDump(struct rx_call *call, char *vsname, char *dumpPath, + struct budb_dumpEntry *dumpentry) { struct ubik_trans *ut; dbadr curdbaddr, retdbaddr, firstdbaddr; @@ -2328,9 +2257,7 @@ FindLatestDump(call, vsname, dumpPath, dumpentry) afs_int32 -SBUDB_FinishDump(call, dump) - struct rx_call *call; - struct budb_dumpEntry *dump; +SBUDB_FinishDump(struct rx_call *call, struct budb_dumpEntry *dump) { afs_int32 code; @@ -2341,9 +2268,7 @@ SBUDB_FinishDump(call, dump) } afs_int32 -FinishDump(call, dump) - struct rx_call *call; - struct budb_dumpEntry *dump; +FinishDump(struct rx_call *call, struct budb_dumpEntry *dump) { struct ubik_trans *ut; dbadr a; @@ -2391,9 +2316,7 @@ FinishDump(call, dump) } afs_int32 -SBUDB_FinishTape(call, tape) - struct rx_call *call; - struct budb_tapeEntry *tape; +SBUDB_FinishTape(struct rx_call *call, struct budb_tapeEntry *tape) { afs_int32 code; @@ -2404,9 +2327,7 @@ SBUDB_FinishTape(call, tape) } afs_int32 -FinishTape(call, tape) - struct rx_call *call; - struct budb_tapeEntry *tape; +FinishTape(struct rx_call *call, struct budb_tapeEntry *tape) { struct ubik_trans *ut; dbadr a; @@ -2498,18 +2419,16 @@ FinishTape(call, tape) */ afs_int32 -SBUDB_GetDumps(call, majorVersion, flags, name, start, end, index, nextIndexP, - dbTimeP, dumps) - struct rx_call *call; - afs_int32 majorVersion; /* version of interface structures */ - afs_int32 flags; /* search & select controls */ - char *name; /* s&s parameters */ - afs_int32 start; - afs_int32 end; - afs_int32 index; /* start index of returned entries */ - afs_int32 *nextIndexP; /* output index for next call */ - afs_int32 *dbTimeP; - budb_dumpList *dumps; /* pointer to buffer */ +SBUDB_GetDumps(struct rx_call *call, + afs_int32 majorVersion, /* version of interface structures */ + afs_int32 flags, /* search & select controls */ + char *name, /* s&s parameters */ + afs_int32 start, + afs_int32 end, + afs_int32 index, /* start index of returned entries */ + afs_int32 *nextIndexP, /* output index for next call */ + afs_int32 *dbTimeP, + budb_dumpList *dumps) /* pointer to buffer */ { afs_int32 code; @@ -2521,18 +2440,16 @@ SBUDB_GetDumps(call, majorVersion, flags, name, start, end, index, nextIndexP, } afs_int32 -GetDumps(call, majorVersion, flags, name, start, end, index, nextIndexP, - dbTimeP, dumps) - struct rx_call *call; - afs_int32 majorVersion; /* version of interface structures */ - afs_int32 flags; /* search & select controls */ - char *name; /* s&s parameters */ - afs_int32 start; - afs_int32 end; - afs_int32 index; /* start index of returned entries */ - afs_int32 *nextIndexP; /* output index for next call */ - afs_int32 *dbTimeP; - budb_dumpList *dumps; /* pointer to buffer */ +GetDumps(struct rx_call *call, + afs_int32 majorVersion, /* version of interface structures */ + afs_int32 flags, /* search & select controls */ + char *name, /* s&s parameters */ + afs_int32 start, + afs_int32 end, + afs_int32 index, /* start index of returned entries */ + afs_int32 *nextIndexP, /* output index for next call */ + afs_int32 *dbTimeP, + budb_dumpList *dumps) /* pointer to buffer */ { struct ubik_trans *ut; dbadr da; @@ -2666,8 +2583,6 @@ GetDumps(call, majorVersion, flags, name, start, end, index, nextIndexP, struct wantDumpRock rock; struct chosenDump *ptr, *nextPtr; - extern wantDump(), rememberDump(); - /* no other flags should be set */ /* end specifies how many dumps */ @@ -2712,9 +2627,7 @@ GetDumps(call, majorVersion, flags, name, start, end, index, nextIndexP, * expiration tape into the given tape structure. */ afs_int32 -getExpiration(ut, tapePtr) - struct ubik_trans *ut; - struct tape *tapePtr; +getExpiration(struct ubik_trans *ut, struct tape *tapePtr) { dbadr ad; struct dump d; @@ -2752,7 +2665,7 @@ getExpiration(ut, tapePtr) tapePtr->expires = t.expires; /* Step to and read the next appended dump */ - if (ad = ntohl(d.appendedDumpChain)) { + if ((ad = ntohl(d.appendedDumpChain))) { eval = dbread(ut, ad, &d, sizeof(d)); if (eval) ERROR(eval); @@ -2765,11 +2678,8 @@ getExpiration(ut, tapePtr) /* Mark the following dump as appended to another, intial dump */ afs_int32 -makeAppended(ut, appendedDumpID, initialDumpID, startTapeSeq) - struct ubik_trans *ut; - afs_int32 appendedDumpID; - afs_int32 initialDumpID; - afs_int32 startTapeSeq; +makeAppended(struct ubik_trans *ut, afs_int32 appendedDumpID, + afs_int32 initialDumpID, afs_int32 startTapeSeq) { dbadr ada, da, lastDumpAddr; struct dump ad, d; @@ -2843,11 +2753,8 @@ makeAppended(ut, appendedDumpID, initialDumpID, startTapeSeq) } afs_int32 -SBUDB_MakeDumpAppended(call, appendedDumpID, initialDumpID, startTapeSeq) - struct rx_call *call; - afs_int32 appendedDumpID; - afs_int32 initialDumpID; - afs_int32 startTapeSeq; +SBUDB_MakeDumpAppended(struct rx_call *call, afs_int32 appendedDumpID, + afs_int32 initialDumpID, afs_int32 startTapeSeq) { afs_int32 code; @@ -2859,11 +2766,8 @@ SBUDB_MakeDumpAppended(call, appendedDumpID, initialDumpID, startTapeSeq) } afs_int32 -MakeDumpAppended(call, appendedDumpID, initialDumpID, startTapeSeq) - struct rx_call *call; - afs_int32 appendedDumpID; - afs_int32 initialDumpID; - afs_int32 startTapeSeq; +MakeDumpAppended(struct rx_call *call, afs_int32 appendedDumpID, + afs_int32 initialDumpID, afs_int32 startTapeSeq) { struct ubik_trans *ut; afs_int32 eval, code = 0; @@ -2889,12 +2793,10 @@ MakeDumpAppended(call, appendedDumpID, initialDumpID, startTapeSeq) /* Find the last tape of a dump-set. This includes any appended dumps */ afs_int32 -SBUDB_FindLastTape(call, dumpID, dumpEntry, tapeEntry, volEntry) - struct rx_call *call; - afs_int32 dumpID; - struct budb_dumpEntry *dumpEntry; - struct budb_tapeEntry *tapeEntry; - struct budb_volumeEntry *volEntry; +SBUDB_FindLastTape(struct rx_call *call, afs_int32 dumpID, + struct budb_dumpEntry *dumpEntry, + struct budb_tapeEntry *tapeEntry, + struct budb_volumeEntry *volEntry) { afs_int32 code; @@ -2904,12 +2806,10 @@ SBUDB_FindLastTape(call, dumpID, dumpEntry, tapeEntry, volEntry) } afs_int32 -FindLastTape(call, dumpID, dumpEntry, tapeEntry, volEntry) - struct rx_call *call; - afs_int32 dumpID; - struct budb_dumpEntry *dumpEntry; - struct budb_tapeEntry *tapeEntry; - struct budb_volumeEntry *volEntry; +FindLastTape(struct rx_call *call, afs_int32 dumpID, + struct budb_dumpEntry *dumpEntry, + struct budb_tapeEntry *tapeEntry, + struct budb_volumeEntry *volEntry) { struct ubik_trans *ut; struct dump d; @@ -3027,18 +2927,16 @@ FindLastTape(call, dumpID, dumpEntry, tapeEntry, volEntry) afs_int32 -SBUDB_GetTapes(call, majorVersion, flags, name, start, end, index, nextIndexP, - dbTimeP, tapes) - struct rx_call *call; - afs_int32 majorVersion; /* version of interface structures */ - afs_int32 flags; /* search & select controls */ - char *name; /* s&s parameters */ - afs_int32 start; - afs_int32 end; /* reserved: MBZ */ - afs_int32 index; /* start index of returned entries */ - afs_int32 *nextIndexP; /* output index for next call */ - afs_int32 *dbTimeP; - budb_tapeList *tapes; /* pointer to buffer */ +SBUDB_GetTapes(struct rx_call *call, + afs_int32 majorVersion, /* version of interface structures */ + afs_int32 flags, /* search & select controls */ + char *name, /* s&s parameters */ + afs_int32 start, + afs_int32 end, /* reserved: MBZ */ + afs_int32 index, /* start index of returned entries */ + afs_int32 *nextIndexP, /* output index for next call */ + afs_int32 *dbTimeP, + budb_tapeList *tapes) /* pointer to buffer */ { afs_int32 code; @@ -3050,18 +2948,16 @@ SBUDB_GetTapes(call, majorVersion, flags, name, start, end, index, nextIndexP, } afs_int32 -GetTapes(call, majorVersion, flags, name, start, end, index, nextIndexP, - dbTimeP, tapes) - struct rx_call *call; - afs_int32 majorVersion; /* version of interface structures */ - afs_int32 flags; /* search & select controls */ - char *name; /* s&s parameters */ - afs_int32 start; - afs_int32 end; /* reserved: MBZ */ - afs_int32 index; /* start index of returned entries */ - afs_int32 *nextIndexP; /* output index for next call */ - afs_int32 *dbTimeP; - budb_tapeList *tapes; /* pointer to buffer */ +GetTapes(struct rx_call *call, + afs_int32 majorVersion, /* version of interface structures */ + afs_int32 flags, /* search & select controls */ + char *name, /* s&s parameters */ + afs_int32 start, + afs_int32 end, /* reserved: MBZ */ + afs_int32 index, /* start index of returned entries */ + afs_int32 *nextIndexP, /* output index for next call */ + afs_int32 *dbTimeP, + budb_tapeList *tapes) /* pointer to buffer */ { struct ubik_trans *ut; dbadr da, ta; @@ -3188,18 +3084,16 @@ GetTapes(call, majorVersion, flags, name, start, end, index, nextIndexP, */ afs_int32 -SBUDB_GetVolumes(call, majorVersion, flags, name, start, end, index, - nextIndexP, dbTimeP, volumes) - struct rx_call *call; - afs_int32 majorVersion; /* version of interface structures */ - afs_int32 flags; /* search & select controls */ - char *name; /* - parameters for search */ - afs_int32 start; /* - usage depends which BUDP_OP_* */ - afs_int32 end; /* - bits are set */ - afs_int32 index; /* start index of returned entries */ - afs_int32 *nextIndexP; /* output index for next call */ - afs_int32 *dbTimeP; - budb_volumeList *volumes; /* pointer to buffer */ +SBUDB_GetVolumes(struct rx_call *call, + afs_int32 majorVersion, /* version of interface structures */ + afs_int32 flags, /* search & select controls */ + char *name, /* - parameters for search */ + afs_int32 start, /* - usage depends which BUDP_OP */ + afs_int32 end, /* - bits are set */ + afs_int32 index, /* start index of returned entries */ + afs_int32 *nextIndexP, /* output index for next call */ + afs_int32 *dbTimeP, + budb_volumeList *volumes) /* pointer to buffer */ { afs_int32 code; @@ -3211,18 +3105,16 @@ SBUDB_GetVolumes(call, majorVersion, flags, name, start, end, index, } afs_int32 -GetVolumes(call, majorVersion, flags, name, start, end, index, nextIndexP, - dbTimeP, volumes) - struct rx_call *call; - afs_int32 majorVersion; /* version of interface structures */ - afs_int32 flags; /* search & select controls */ - char *name; /* - parameters for search */ - afs_int32 start; /* - usage depends which BUDP_OP_* */ - afs_int32 end; /* - bits are set */ - afs_int32 index; /* start index of returned entries */ - afs_int32 *nextIndexP; /* output index for next call */ - afs_int32 *dbTimeP; - budb_volumeList *volumes; /* pointer to buffer */ +GetVolumes(struct rx_call *call, + afs_int32 majorVersion, /* version of interface structures */ + afs_int32 flags, /* search & select controls */ + char *name, /* - parameters for search */ + afs_int32 start, /* - usage depends which BUDP_OP_* */ + afs_int32 end, /* - bits are set */ + afs_int32 index, /* start index of returned entries */ + afs_int32 *nextIndexP, /* output index for next call */ + afs_int32 *dbTimeP, + budb_volumeList *volumes) /* pointer to buffer */ { struct ubik_trans *ut; dbadr via; @@ -3373,7 +3265,7 @@ GetVolumes(call, majorVersion, flags, name, start, end, index, nextIndexP, if (eval) ABORT(eval); - error_exit: + /* error_exit: */ FreeReturnList(&vollist); code = ubik_EndTrans(ut); return code; @@ -3385,10 +3277,9 @@ GetVolumes(call, majorVersion, flags, name, start, end, index, nextIndexP, } afs_int32 -SBUDB_UseTape(call, tape, new) - struct rx_call *call; - struct budb_tapeEntry *tape; /* tape info */ - afs_int32 *new; /* set if tape is new */ +SBUDB_UseTape(struct rx_call *call, + struct budb_tapeEntry *tape, /* tape info */ + afs_int32 *new) /* set if tape is new */ { afs_int32 code; @@ -3399,10 +3290,9 @@ SBUDB_UseTape(call, tape, new) } afs_int32 -UseTape(call, tape, new) - struct rx_call *call; - struct budb_tapeEntry *tape; /* tape info */ - int *new; /* set if tape is new */ +UseTape(struct rx_call *call, + struct budb_tapeEntry *tape, /* tape info */ + int *new) /* set if tape is new */ { struct ubik_trans *ut; dbadr da, a; @@ -3491,10 +3381,7 @@ UseTape(call, tape, new) */ afs_int32 -SBUDB_T_DumpHashTable(call, type, filename) - struct rx_call *call; - afs_int32 type; - char *filename; +SBUDB_T_DumpHashTable(struct rx_call *call, afs_int32 type, char *filename) { afs_int32 code; @@ -3504,10 +3391,7 @@ SBUDB_T_DumpHashTable(call, type, filename) } afs_int32 -T_DumpHashTable(call, type, filename) - struct rx_call *call; - int type; - char *filename; +T_DumpHashTable(struct rx_call *call, int type, char *filename) { struct ubik_trans *ut; struct memoryHashTable *mht; @@ -3601,9 +3485,7 @@ T_DumpHashTable(call, type, filename) } afs_int32 -SBUDB_T_GetVersion(call, majorVersion) - struct rx_call *call; - afs_int32 *majorVersion; +SBUDB_T_GetVersion(struct rx_call *call, afs_int32 *majorVersion) { afs_int32 code; @@ -3613,9 +3495,7 @@ SBUDB_T_GetVersion(call, majorVersion) } afs_int32 -T_GetVersion(call, majorVersion) - struct rx_call *call; - int *majorVersion; +T_GetVersion(struct rx_call *call, int *majorVersion) { struct ubik_trans *ut; afs_int32 code; @@ -3635,9 +3515,7 @@ T_GetVersion(call, majorVersion) */ afs_int32 -SBUDB_T_DumpDatabase(call, filename) - struct rx_call *call; - char *filename; +SBUDB_T_DumpDatabase(struct rx_call *call, char *filename) { afs_int32 code; @@ -3647,9 +3525,7 @@ SBUDB_T_DumpDatabase(call, filename) } afs_int32 -T_DumpDatabase(call, filename) - struct rx_call *call; - char *filename; +T_DumpDatabase(struct rx_call *call, char *filename) { FILE *dumpfid; int entrySize; @@ -3802,10 +3678,7 @@ T_DumpDatabase(call, filename) } int -volFragsDump(ut, dumpfid, dbAddr) - struct ubik_trans *ut; - FILE *dumpfid; - dbadr dbAddr; +volFragsDump(struct ubik_trans *ut, FILE *dumpfid, dbadr dbAddr) { struct volFragment hostVolFragment, diskVolFragment; afs_int32 code; @@ -3833,8 +3706,9 @@ volFragsDump(ut, dumpfid, dbAddr) * currently used for debug only */ -volFragmentDiskToHost(diskVfPtr, hostVfPtr) - struct volFragment *diskVfPtr, *hostVfPtr; +void +volFragmentDiskToHost(struct volFragment *diskVfPtr, + struct volFragment *hostVfPtr) { hostVfPtr->vol = ntohl(diskVfPtr->vol); hostVfPtr->sameNameChain = ntohl(diskVfPtr->sameNameChain); @@ -3849,8 +3723,8 @@ volFragmentDiskToHost(diskVfPtr, hostVfPtr) hostVfPtr->sequence = ntohs(diskVfPtr->sequence); } -volInfoDiskToHost(diskViPtr, hostViPtr) - struct volInfo *diskViPtr, *hostViPtr; +void +volInfoDiskToHost(struct volInfo *diskViPtr, struct volInfo *hostViPtr) { strcpy(hostViPtr->name, diskViPtr->name); hostViPtr->nameHashChain = ntohl(diskViPtr->nameHashChain); @@ -3864,8 +3738,8 @@ volInfoDiskToHost(diskViPtr, hostViPtr) hostViPtr->nFrags = ntohl(diskViPtr->nFrags); } -tapeDiskToHost(diskTapePtr, hostTapePtr) - struct tape *diskTapePtr, *hostTapePtr; +void +tapeDiskToHost(struct tape *diskTapePtr, struct tape *hostTapePtr) { strcpy(hostTapePtr->name, diskTapePtr->name); hostTapePtr->nameHashChain = ntohl(diskTapePtr->nameHashChain); @@ -3883,8 +3757,8 @@ tapeDiskToHost(diskTapePtr, hostTapePtr) hostTapePtr->useCount = ntohl(diskTapePtr->useCount); } -dumpDiskToHost(diskDumpPtr, hostDumpPtr) - struct dump *diskDumpPtr, *hostDumpPtr; +void +dumpDiskToHost(struct dump *diskDumpPtr, struct dump *hostDumpPtr) { hostDumpPtr->id = ntohl(diskDumpPtr->id); hostDumpPtr->idHashChain = ntohl(diskDumpPtr->idHashChain); @@ -3908,9 +3782,7 @@ dumpDiskToHost(diskDumpPtr, hostDumpPtr) #endif /* notdef */ int -checkHash(ut, hashType) - struct ubik_trans *ut; - int hashType; +checkHash(struct ubik_trans *ut, int hashType) { struct memoryHashTable *mhtPtr; int entrySize, hashTableLength; diff --git a/src/budb/server.c b/src/budb/server.c index 57e34472d..207690d35 100644 --- a/src/budb/server.c +++ b/src/budb/server.c @@ -47,6 +47,7 @@ RCSID #include "budb_errs.h" #include "database.h" #include "error_macros.h" +#include "budb_prototypes.h" #include "globals.h" #include "afs/audit.h" @@ -54,6 +55,8 @@ struct ubik_dbase *BU_dbase; struct afsconf_dir *BU_conf; /* for getting cell info */ int argHandler(struct cmd_syndesc *, void *); +int truncateDatabase(void); +int parseServerList(struct cmd_item *); char lcell[MAXKTCREALMLEN]; afs_int32 myHost = 0; @@ -88,17 +91,14 @@ threadNum(void) /* check whether caller is authorized to manage RX statistics */ int -BU_rxstat_userok(call) - struct rx_call *call; +BU_rxstat_userok(struct rx_call *call) { return afsconf_SuperUser(BU_conf, call, NULL); } int -convert_cell_to_ubik(cellinfo, myHost, serverList) - struct afsconf_cell *cellinfo; - afs_int32 *myHost; - afs_int32 *serverList; +convert_cell_to_ubik(struct afsconf_cell *cellinfo, afs_int32 *myHost, + afs_int32 *serverList) { int i; char hostname[64]; @@ -139,7 +139,7 @@ MyBeforeProc(register struct cmd_syndesc *as, void *arock) */ void -initializeArgHandler() +initializeArgHandler(void) { struct cmd_syndesc *cptr; @@ -259,8 +259,8 @@ argHandler(struct cmd_syndesc *as, void *arock) /* --- */ -parseServerList(itemPtr) - struct cmd_item *itemPtr; +int +parseServerList(struct cmd_item *itemPtr) { struct cmd_item *save; char **serverArgs; @@ -311,7 +311,8 @@ parseServerList(itemPtr) * truncates just the database file. */ -truncateDatabase() +int +truncateDatabase(void) { char *path; afs_int32 code = 0; @@ -348,9 +349,8 @@ truncateDatabase() #include "AFS_component_version_number.c" -main(argc, argv) - int argc; - char *argv[]; +int +main(int argc, char **argv) { char *whoami = argv[0]; char *dbNamePtr = 0; @@ -364,11 +364,7 @@ main(argc, argv) struct rx_service *tservice; struct rx_securityClass *sca[3]; - extern int afsconf_ServerAuth(); - extern int afsconf_CheckAuth(); - extern int rx_stackSize; - extern int BUDB_ExecuteRequest(); #ifdef AFS_NT40_ENV /* initialize winsock */ @@ -491,13 +487,13 @@ main(argc, argv) /* initialize ubik */ ubik_CRXSecurityProc = afsconf_ClientAuth; - ubik_CRXSecurityRock = (char *)BU_conf; + ubik_CRXSecurityRock = BU_conf; ubik_SRXSecurityProc = afsconf_ServerAuth; - ubik_SRXSecurityRock = (char *)BU_conf; + ubik_SRXSecurityRock = BU_conf; ubik_CheckRXSecurityProc = afsconf_CheckAuth; - ubik_CheckRXSecurityRock = (char *)BU_conf; + ubik_CheckRXSecurityRock = BU_conf; if (ubik_nBuffers == 0) ubik_nBuffers = 400; @@ -596,7 +592,7 @@ main(argc, argv) } void -consistencyCheckDb() +consistencyCheckDb(void) { /* do consistency checks on structure sizes */ if ((sizeof(struct htBlock) > BLOCKSIZE) @@ -610,22 +606,23 @@ consistencyCheckDb() } } - /*VARARGS*/ -LogDebug(level, a, b, c, d, e, f, g, h, i) - int level; - char *a, *b, *c, *d, *e, *f, *g, *h, *i; +void +LogDebug(int level, char *fmt, ... ) { + va_list ap; + va_start(ap, fmt); + if (debugging >= level) { /* log normally closed so can remove it */ globalConfPtr->log = fopen(AFSDIR_SERVER_BUDBLOG_FILEPATH, "a"); if (globalConfPtr->log != NULL) { - fprintf(globalConfPtr->log, a, b, c, d, e, f, g, h, i); + vfprintf(globalConfPtr->log, fmt, ap); fflush(globalConfPtr->log); fclose(globalConfPtr->log); } } - return 0; + va_end(ap); } static char * @@ -639,31 +636,32 @@ TimeStamp(time_t t) return timestamp; } - /*VARARGS*/ -Log(a, b, c, d, e, f, g, h, i) - char *a, *b, *c, *d, *e, *f, *g, *h, *i; +void +Log(char *fmt, ...) { + va_list ap; time_t now; + va_start(ap, fmt); globalConfPtr->log = fopen(AFSDIR_SERVER_BUDBLOG_FILEPATH, "a"); if (globalConfPtr->log != NULL) { now = time(0); fprintf(globalConfPtr->log, "%s ", TimeStamp(now)); - fprintf(globalConfPtr->log, a, b, c, d, e, f, g, h, i); + vfprintf(globalConfPtr->log, fmt, ap); fflush(globalConfPtr->log); fclose(globalConfPtr->log); } - return 0; + va_end(ap); } - /*VARARGS*/ -LogError(code, a, b, c, d, e, f, g, h, i) - long code; - char *a, *b, *c, *d, *e, *f, *g, *h, *i; +void +LogError(long code, char *fmt, ... ) { + va_list ap; time_t now; + va_start(ap, fmt); globalConfPtr->log = fopen(AFSDIR_SERVER_BUDBLOG_FILEPATH, "a"); if (globalConfPtr->log != NULL) { @@ -673,11 +671,10 @@ LogError(code, a, b, c, d, e, f, g, h, i) if (code) fprintf(globalConfPtr->log, "%s: %s\n", afs_error_table_name(code), afs_error_message(code)); - fprintf(globalConfPtr->log, a, b, c, d, e, f, g, h, i); + vfprintf(globalConfPtr->log, fmt, ap ); fflush(globalConfPtr->log); fclose(globalConfPtr->log); } - return 0; } @@ -686,9 +683,8 @@ LogError(code, a, b, c, d, e, f, g, h, i) * ---------------- */ - -LogNetDump(dumpPtr) - struct dump *dumpPtr; +void +LogNetDump(struct dump *dumpPtr) { struct dump hostDump; extern buServerConfP globalConfPtr; @@ -700,5 +696,5 @@ LogNetDump(dumpPtr) printDump(globalConfPtr->log, &hostDump); fclose(globalConfPtr->log); } - return 0; } + diff --git a/src/budb/struct_ops.c b/src/budb/struct_ops.c index 49be35f69..4840fc34a 100644 --- a/src/budb/struct_ops.c +++ b/src/budb/struct_ops.c @@ -29,7 +29,7 @@ RCSID #include "budb.h" #include "budb_errs.h" #include "database.h" - +#include "budb_prototypes.h" /* ---------------------------------- * structure printing utilities @@ -108,9 +108,7 @@ printDumpEntry(struct budb_dumpEntry *deptr) */ void -printHashTable(fid, htptr) - FILE *fid; - struct hashTable *htptr; +printHashTable(FILE *fid, struct hashTable *htptr) { fprintf(fid, "functionType = %d\n", htptr->functionType); fprintf(fid, "threadOffset = %d\n", htptr->threadOffset); @@ -126,9 +124,7 @@ printHashTable(fid, htptr) * print the hash table structure, i.e. the header structure. */ int -printMemoryHashTable(fid, mhtptr) - FILE *fid; - struct memoryHashTable *mhtptr; +printMemoryHashTable(FILE *fid, struct memoryHashTable *mhtptr) { fprintf(fid, "threadOffset = %d\n", mhtptr->threadOffset); fprintf(fid, "length = %d\n", mhtptr->length); @@ -139,8 +135,7 @@ printMemoryHashTable(fid, mhtptr) } int -printPrincipal(ptr) - struct ktc_principal *ptr; +printPrincipal(struct budb_principal *ptr) { printf("name = %s\n", ptr->name); printf("instance = %s\n", ptr->instance); @@ -149,8 +144,7 @@ printPrincipal(ptr) } int -printStructDumpHeader(ptr) - struct structDumpHeader *ptr; +printStructDumpHeader(struct structDumpHeader *ptr) { printf("type = %d\n", ptr->type); printf("structure version = %d\n", ptr->structversion); @@ -215,9 +209,8 @@ printTapeEntry(struct budb_tapeEntry *teptr) } int -printTapeSet(tsptr, nss) - struct budb_tapeSet *tsptr; - afs_int32 nss; /* is the tapeserver name an accurate name */ +printTapeSet(struct budb_tapeSet *tsptr, + afs_int32 nss) /* is the tapeserver name an accurate name */ { printf("Group id = %d\n", tsptr->id); printf("tapeServer = %s%s\n", tsptr->tapeServer, @@ -285,9 +278,7 @@ printVolFragment(FILE *fid, struct volFragment *vfptr) } int -printVolInfo(fid, viptr) - FILE *fid; - struct volInfo *viptr; +printVolInfo(FILE *fid, struct volInfo *viptr) { fprintf(fid, "name = %s\n", viptr->name); fprintf(fid, "nameHashChain = %d\n", viptr->nameHashChain); @@ -313,8 +304,8 @@ printVolInfo(fid, viptr) */ void -volFragment_ntoh(netVfPtr, hostVfPtr) - struct volFragment *netVfPtr, *hostVfPtr; +volFragment_ntoh(struct volFragment *netVfPtr, + struct volFragment *hostVfPtr) { hostVfPtr->vol = ntohl(netVfPtr->vol); hostVfPtr->sameNameChain = ntohl(netVfPtr->sameNameChain); @@ -330,8 +321,8 @@ volFragment_ntoh(netVfPtr, hostVfPtr) } void -volInfo_ntoh(netViPtr, hostViPtr) - struct volInfo *netViPtr, *hostViPtr; +volInfo_ntoh(struct volInfo *netViPtr, + struct volInfo *hostViPtr) { strcpy(hostViPtr->name, netViPtr->name); hostViPtr->nameHashChain = ntohl(netViPtr->nameHashChain); @@ -346,8 +337,8 @@ volInfo_ntoh(netViPtr, hostViPtr) } void -tape_ntoh(netTapePtr, hostTapePtr) - struct tape *netTapePtr, *hostTapePtr; +tape_ntoh(struct tape *netTapePtr, + struct tape *hostTapePtr) { strcpy(hostTapePtr->name, netTapePtr->name); hostTapePtr->nameHashChain = ntohl(netTapePtr->nameHashChain); @@ -368,8 +359,8 @@ tape_ntoh(netTapePtr, hostTapePtr) } void -dump_ntoh(netDumpPtr, hostDumpPtr) - struct dump *netDumpPtr, *hostDumpPtr; +dump_ntoh(struct dump *netDumpPtr, + struct dump *hostDumpPtr) { hostDumpPtr->id = ntohl(netDumpPtr->id); hostDumpPtr->idHashChain = ntohl(netDumpPtr->idHashChain); @@ -391,8 +382,8 @@ dump_ntoh(netDumpPtr, hostDumpPtr) } void -DbHeader_ntoh(netptr, hostptr) - struct DbHeader *netptr, *hostptr; +DbHeader_ntoh(struct DbHeader *netptr, + struct DbHeader *hostptr) { hostptr->dbversion = ntohl(netptr->dbversion); hostptr->created = ntohl(netptr->created); @@ -403,8 +394,8 @@ DbHeader_ntoh(netptr, hostptr) } void -dumpEntry_ntoh(netptr, hostptr) - struct budb_dumpEntry *netptr, *hostptr; +dumpEntry_ntoh(struct budb_dumpEntry *netptr, + struct budb_dumpEntry *hostptr) { hostptr->id = ntohl(netptr->id); hostptr->initialDumpID = ntohl(netptr->initialDumpID); @@ -423,27 +414,27 @@ dumpEntry_ntoh(netptr, hostptr) principal_ntoh(&netptr->dumper, &hostptr->dumper); } -principal_hton(hostptr, netptr) - struct ktc_principal *hostptr, *netptr; +void +principal_hton(struct budb_principal *hostptr, + struct budb_principal *netptr) { strcpy(netptr->name, hostptr->name); strcpy(netptr->instance, hostptr->instance); strcpy(netptr->cell, hostptr->cell); - return 0; } -principal_ntoh(netptr, hostptr) - struct ktc_principal *netptr, *hostptr; +void +principal_ntoh(struct budb_principal *netptr, + struct budb_principal *hostptr) { strcpy(hostptr->name, netptr->name); strcpy(hostptr->instance, netptr->instance); strcpy(hostptr->cell, netptr->cell); - return 0; } void -structDumpHeader_hton(hostPtr, netPtr) - struct structDumpHeader *hostPtr, *netPtr; +structDumpHeader_hton(struct structDumpHeader *hostPtr, + struct structDumpHeader *netPtr) { netPtr->type = htonl(hostPtr->type); netPtr->structversion = htonl(hostPtr->structversion); @@ -451,8 +442,8 @@ structDumpHeader_hton(hostPtr, netPtr) } void -structDumpHeader_ntoh(netPtr, hostPtr) - struct structDumpHeader *hostPtr, *netPtr; +structDumpHeader_ntoh(struct structDumpHeader *netPtr, + struct structDumpHeader *hostPtr) { hostPtr->type = ntohl(netPtr->type); hostPtr->structversion = ntohl(netPtr->structversion); @@ -460,8 +451,8 @@ structDumpHeader_ntoh(netPtr, hostPtr) } void -tapeEntry_ntoh(netptr, hostptr) - struct budb_tapeEntry *netptr, *hostptr; +tapeEntry_ntoh(struct budb_tapeEntry *netptr, + struct budb_tapeEntry *hostptr) { strcpy(hostptr->name, netptr->name); hostptr->flags = ntohl(netptr->flags); @@ -479,8 +470,8 @@ tapeEntry_ntoh(netptr, hostptr) } int -tapeSet_hton(hostptr, netptr) - struct budb_tapeSet *hostptr, *netptr; +tapeSet_hton(struct budb_tapeSet *hostptr, + struct budb_tapeSet *netptr) { netptr->id = htonl(hostptr->id); strcpy(netptr->tapeServer, hostptr->tapeServer); @@ -492,8 +483,8 @@ tapeSet_hton(hostptr, netptr) } int -tapeSet_ntoh(netptr, hostptr) - struct budb_tapeSet *netptr, *hostptr; +tapeSet_ntoh(struct budb_tapeSet *netptr, + struct budb_tapeSet *hostptr) { hostptr->id = ntohl(netptr->id); strcpy(hostptr->tapeServer, netptr->tapeServer); @@ -505,8 +496,8 @@ tapeSet_ntoh(netptr, hostptr) } void -textBlock_hton(hostptr, netptr) - struct textBlock *hostptr, *netptr; +textBlock_hton(struct textBlock *hostptr, + struct textBlock *netptr) { netptr->version = htonl(hostptr->version); netptr->size = htonl(hostptr->size); @@ -516,8 +507,8 @@ textBlock_hton(hostptr, netptr) } void -textBlock_ntoh(netptr, hostptr) - struct textBlock *netptr, *hostptr; +textBlock_ntoh(struct textBlock *netptr, + struct textBlock *hostptr) { hostptr->version = ntohl(netptr->version); hostptr->size = ntohl(netptr->size); @@ -527,8 +518,7 @@ textBlock_ntoh(netptr, hostptr) } void -textLock_hton(hostptr, netptr) - db_lockP hostptr, netptr; +textLock_hton(db_lockP hostptr, db_lockP netptr) { netptr->type = htonl(hostptr->type); netptr->lockState = htonl(hostptr->lockState); @@ -539,8 +529,7 @@ textLock_hton(hostptr, netptr) } void -textLock_ntoh(netptr, hostptr) - db_lockP netptr, hostptr; +textLock_ntoh(db_lockP netptr, db_lockP hostptr) { hostptr->type = ntohl(netptr->type); hostptr->lockState = ntohl(netptr->lockState); @@ -551,8 +540,8 @@ textLock_ntoh(netptr, hostptr) } void -volumeEntry_ntoh(netptr, hostptr) - struct budb_volumeEntry *netptr, *hostptr; +volumeEntry_ntoh(struct budb_volumeEntry *netptr, + struct budb_volumeEntry *hostptr) { strcpy(hostptr->name, netptr->name); hostptr->flags = ntohl(netptr->flags); @@ -578,9 +567,8 @@ volumeEntry_ntoh(netptr, hostptr) */ void -copy_ktcPrincipal_to_budbPrincipal(ktcPtr, budbPtr) - struct ktc_principal *ktcPtr; - struct budb_principal *budbPtr; +copy_ktcPrincipal_to_budbPrincipal(struct ktc_principal *ktcPtr, + struct budb_principal *budbPtr) { strncpy(budbPtr->name, ktcPtr->name, sizeof(budbPtr->name)); strncpy(budbPtr->instance, ktcPtr->instance, sizeof(budbPtr->instance)); @@ -592,9 +580,8 @@ copy_ktcPrincipal_to_budbPrincipal(ktcPtr, budbPtr) * dumpPtr - host format */ -dumpToBudbDump(dumpPtr, budbDumpPtr) - dbDumpP dumpPtr; - struct budb_dumpEntry *budbDumpPtr; +int +dumpToBudbDump(dbDumpP dumpPtr, struct budb_dumpEntry *budbDumpPtr) { budbDumpPtr->id = dumpPtr->id; budbDumpPtr->initialDumpID = dumpPtr->initialDumpID; @@ -615,9 +602,8 @@ dumpToBudbDump(dumpPtr, budbDumpPtr) return (0); } -tapeToBudbTape(tapePtr, budbTapePtr) - struct tape *tapePtr; - struct budb_tapeEntry *budbTapePtr; +int +tapeToBudbTape(struct tape *tapePtr, struct budb_tapeEntry *budbTapePtr) { strcpy(budbTapePtr->name, tapePtr->name); budbTapePtr->flags = tapePtr->flags; @@ -634,10 +620,9 @@ tapeToBudbTape(tapePtr, budbTapePtr) return (0); } -volsToBudbVol(volFragPtr, volInfoPtr, budbVolPtr) - struct volFragment *volFragPtr; - struct volInfo *volInfoPtr; - struct budb_volumeEntry *budbVolPtr; +int +volsToBudbVol(struct volFragment *volFragPtr, struct volInfo *volInfoPtr, + struct budb_volumeEntry *budbVolPtr) { strcpy(budbVolPtr->name, volInfoPtr->name); budbVolPtr->flags = volInfoPtr->flags; @@ -670,9 +655,8 @@ volsToBudbVol(volFragPtr, volInfoPtr, budbVolPtr) * n - error */ -default_tapeset(tapesetPtr, dumpname) - struct budb_tapeSet *tapesetPtr; - char *dumpname; +int +default_tapeset(struct budb_tapeSet *tapesetPtr, char *dumpname) { memset(tapesetPtr, 0, sizeof(*tapesetPtr)); -- 2.39.5