From edd97cb225b714474de0a631cb36bb35af8c846b Mon Sep 17 00:00:00 2001 From: Jim Rees Date: Wed, 22 Feb 2006 20:29:01 +0000 Subject: [PATCH] viced-cleanup-20060222 Prototypes, dead code removal, and other minor cleanups --- src/viced/callback.c | 36 +++++++++--------------------------- src/viced/fsprobe.c | 9 +++++---- src/viced/host.c | 18 +++++++++--------- src/viced/host.h | 1 + src/viced/viced.c | 8 +++----- src/vol/vnode.h | 6 +++--- 6 files changed, 30 insertions(+), 48 deletions(-) diff --git a/src/viced/callback.c b/src/viced/callback.c index bb6b1fb..a4d3ded 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -300,8 +300,6 @@ static int MultiBreakVolumeCallBack(struct host *host, int isheld, struct VCBParams *parms); static int MultiBreakVolumeLaterCallBack(struct host *host, int isheld, struct VCBParams *parms); -static int lih_r(register struct host *host, register int held, - register struct host *hostp); static int GetSomeSpace_r(struct host *hostp, int locked); static int ClearHostCallbacks_r(struct host *hp, int locked); @@ -312,6 +310,7 @@ static int ClearHostCallbacks_r(struct host *hp, int locked); /* Other protos - move out sometime */ extern void ShutDown(); +void PrintCB(register struct CallBack *cb, afs_uint32 now); #define VHASH 512 /* Power of 2 */ static afs_uint32 HashTable[VHASH]; /* File entry hash table */ @@ -1371,7 +1370,7 @@ BreakVolumeCallBacksLater(afs_uint32 volume) ViceLog(25, ("Setting later on volume %u\n", volume)); H_LOCK; for (hash = 0; hash < VHASH; hash++) { - for (feip = &HashTable[hash]; fe = itofe(*feip);) { + for (feip = &HashTable[hash]; (fe = itofe(*feip)) != NULL; ) { if (fe->volid == volume) { register struct CallBack *cbnext; for (cb = itocb(fe->firstcb); cb; cb = cbnext) { @@ -1427,7 +1426,7 @@ BreakLaterCallBacks(void) fid.Volume = fid.Vnode = fid.Unique = 0; for (hash = 0; hash < VHASH; hash++) { - for (feip = &HashTable[hash]; fe = itofe(*feip);) { + for (feip = &HashTable[hash]; (fe = itofe(*feip)) != NULL; ) { if (fe && (fe->status & FE_LATER) && (fid.Volume == 0 || fid.Volume == fe->volid)) { /* Ugly, but used to avoid left side casting */ @@ -1558,23 +1557,6 @@ CleanupTimedOutCallBacks_r(void) static struct host *lih_host; static int lih_host_held; -static int -lih_r(register struct host *host, register int held, - register struct host *hostp) -{ - if (host->cblist - && ((hostp && host != hostp) || (!held && !h_OtherHolds_r(host))) - && (!lih_host || host->ActiveCall < lih_host->ActiveCall)) { - if (lih_host != NULL && lih_host_held) { - h_Release_r(lih_host); - } - lih_host = host; - lih_host_held = !held; - held = 1; - } - return held; -} - /* This version does not allow 'host' to be selected unless its ActiveCall * is newer than 'hostp' which is the host with the oldest ActiveCall from * the last pass (if it is provided). We filter out any hosts that are @@ -1945,10 +1927,10 @@ main(int argc, char **argv) PrintCallBackStats(); } if (all || vol) { - register hash; - register afs_uint32 *feip; - register struct CallBack *cb; - register struct FileEntry *fe; + int hash; + afs_uint32 *feip; + struct CallBack *cb; + struct FileEntry *fe; for (hash = 0; hash < VHASH; hash++) { for (feip = &HashTable[hash]; fe = itofe(*feip);) { @@ -1986,16 +1968,16 @@ main(int argc, char **argv) } } if (raw) { - struct FileEntry *fe; afs_int32 *p, i; for (i = 1; i < cbstuff.nblks; i++) { p = (afs_int32 *) & FE[i]; printf("%d:%12x%12x%12x%12x\n", i, p[0], p[1], p[2], p[3]); } } + exit(0); } -int +void PrintCB(register struct CallBack *cb, afs_uint32 now) { struct FileEntry *fe = itofe(cb->fhead); diff --git a/src/viced/fsprobe.c b/src/viced/fsprobe.c index 04a1c04..1f6f748 100644 --- a/src/viced/fsprobe.c +++ b/src/viced/fsprobe.c @@ -15,10 +15,11 @@ RCSID #include #include -#include -#include #include +#include #include +#include +#include #include #ifdef HAVE_STRING_H @@ -133,14 +134,14 @@ main(int argc, char **argv) exit(1); } } - if (code = pxclient_Initialize(noAuth, host.sin_addr.s_addr)) { + if ((code = pxclient_Initialize(noAuth, host.sin_addr.s_addr)) != 0) { printf("Couldn't initialize fs library (code=%d).\n", code); exit(1); } code = ubik_Call(RXAFS_GetTime, cstruct, 0, &tv.tv_sec, &tv.tv_usec); if (!code) - printf("AFS_GetTime on %s sec=%d, usec=%d\n", av[0], tv.tv_sec, + printf("AFS_GetTime on %s sec=%ld, usec=%ld\n", av[0], tv.tv_sec, tv.tv_usec); else printf("return code is %d\n", code); diff --git a/src/viced/host.c b/src/viced/host.c index cacd65c..82bdeaf 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -526,8 +526,8 @@ struct host * h_Alloc_r(register struct rx_connection *r_con) { struct servent *serverentry; - register index = h_HashIndex(rxr_HostOf(r_con)); - register struct host *host; + int index = h_HashIndex(rxr_HostOf(r_con)); + struct host *host; static struct rx_securityClass *sc = 0; afs_int32 now; struct h_hashChain *h_hashChain; @@ -606,10 +606,10 @@ h_Alloc_r(register struct rx_connection *r_con) struct host * h_Lookup_r(afs_uint32 haddr, afs_uint32 hport, int *heldp) { - register afs_int32 now; - register struct host *host = 0; - register struct h_hashChain *chain; - register index = h_HashIndex(haddr); + afs_int32 now; + struct host *host = 0; + struct h_hashChain *chain; + int index = h_HashIndex(haddr); extern int hostaclRefresh; restart: @@ -653,9 +653,9 @@ h_Lookup_r(afs_uint32 haddr, afs_uint32 hport, int *heldp) struct host * h_LookupUuid_r(afsUUID * uuidp) { - register struct host *host = 0; - register struct h_hashChain *chain; - register index = h_UuidHashIndex(uuidp); + struct host *host = 0; + struct h_hashChain *chain; + int index = h_UuidHashIndex(uuidp); for (chain = hostUuidHashTable[index]; chain; chain = chain->next) { host = chain->hostPtr; diff --git a/src/viced/host.h b/src/viced/host.h index af25a1f..1407d21 100644 --- a/src/viced/host.h +++ b/src/viced/host.h @@ -211,6 +211,7 @@ extern int MultiBreakCallBackAlternateAddress(struct host *host, struct AFSCBFid extern int MultiBreakCallBackAlternateAddress_r(struct host *host, struct AFSCBFids *afidp); extern int DumpCallBackState(void); +extern int PrintCallBackStats(void); extern void ShutDownAndCore(int dopanic); extern struct host *h_Alloc(register struct rx_connection *r_con); diff --git a/src/viced/viced.c b/src/viced/viced.c index 5747139..92f4570 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -476,7 +476,7 @@ HostCheckLWP() * other 5 minute activities because it may be delayed by timeouts when * it probes the workstations */ -static +static void FsyncCheckLWP() { afs_int32 code; @@ -1063,7 +1063,7 @@ ParseArgs(int argc, char *argv[]) rxMaxMTU = atoi(argv[++i]); if ((rxMaxMTU < RX_MIN_PACKET_SIZE) || (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) { - printf("rxMaxMTU %d% invalid; must be between %d-%d\n", + printf("rxMaxMTU %d%% invalid; must be between %d-%d\n", rxMaxMTU, RX_MIN_PACKET_SIZE, RX_MAX_PACKET_DATA_SIZE); return -1; @@ -1292,7 +1292,7 @@ Die(char *msg) afs_int32 InitPR() { - register code; + int code; /* * If this fails, it's because something major is wrong, and is not @@ -1568,8 +1568,6 @@ afs_int32 InitVL() { afs_int32 code; - extern int rxi_numNetAddrs; - extern afs_uint32 rxi_NetAddrs[]; /* * If this fails, it's because something major is wrong, and is not diff --git a/src/vol/vnode.h b/src/vol/vnode.h index 0bf7245..9446f79 100644 --- a/src/vol/vnode.h +++ b/src/vol/vnode.h @@ -202,7 +202,7 @@ typedef struct Vnode { #define VAclDiskSize(v) (SIZEOF_LARGEDISKVNODE - SIZEOF_SMALLDISKVNODE) /*extern int VolumeHashOffset(); */ extern int VolumeHashOffset_r(void); -extern VInitVnodes(VnodeClass class, int nVnodes); +extern int VInitVnodes(VnodeClass class, int nVnodes); /*extern VInitVnodes_r();*/ extern Vnode *VGetVnode(Error * ec, struct Volume *vp, VnodeId vnodeNumber, int locktype); @@ -210,8 +210,8 @@ extern Vnode *VGetVnode_r(Error * ec, struct Volume *vp, VnodeId vnodeNumber, int locktype); extern void VPutVnode(Error * ec, register Vnode * vnp); extern void VPutVnode_r(Error * ec, register Vnode * vnp); -extern VVnodeWriteToRead(Error * ec, register Vnode * vnp); -extern VVnodeWriteToRead_r(Error * ec, register Vnode * vnp); +extern int VVnodeWriteToRead(Error * ec, register Vnode * vnp); +extern int VVnodeWriteToRead_r(Error * ec, register Vnode * vnp); extern Vnode *VAllocVnode(Error * ec, struct Volume *vp, VnodeType type); extern Vnode *VAllocVnode_r(Error * ec, struct Volume *vp, VnodeType type); /*extern VFreeVnode();*/ -- 1.9.4