From ab1169f6e0a67af254564fd00f4632b50c5b1ad3 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Mon, 16 Mar 2009 03:10:31 +0000 Subject: [PATCH] DEVEL15-viced-prototypes-20090315 LICENSE IPL10 FIXES 124251 prototype the viced directory (cherry picked from commit 596614dd76aa5107f6cd30c67a79b371be48f504) --- src/viced/callback.c | 32 +++++++++++++++++++++----------- src/viced/host.c | 36 +++++++++++++++++++----------------- src/viced/host.h | 14 +++++++------- src/viced/viced.c | 2 +- 4 files changed, 48 insertions(+), 36 deletions(-) diff --git a/src/viced/callback.c b/src/viced/callback.c index da9d38527..cfdd47926 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -124,7 +124,10 @@ RCSID extern afsUUID FS_HostUUID; extern int hostCount; + +#ifndef INTERPRET_DUMP static int ShowProblems = 1; +#endif struct cbcounters cbstuff; @@ -153,7 +156,9 @@ static int TimeOuts[] = { }; /* Anything more: MinTimeOut */ /* minimum time given for a call back */ +#ifndef INTERPRET_DUMP static int MinTimeOut = (7 * 60); +#endif /* Heads of CB queues; a timeout index is 1+index into this array */ static afs_uint32 timeout[CB_NUM_TIMEOUT_QUEUES]; @@ -168,6 +173,8 @@ struct object { /* Prototypes for static routines */ static struct FileEntry *FindFE(register AFSFid * fid); + +#ifndef INTERPRET_DUMP static struct CallBack *iGetCB(register int *nused); static int iFreeCB(register struct CallBack *cb, register int *nused); static struct FileEntry *iGetFE(register int *nused); @@ -188,11 +195,12 @@ static void MultiBreakCallBack_r(struct cbstruct cba[], int ncbas, static int MultiBreakVolumeCallBack_r(struct host *host, int isheld, struct VCBParams *parms, int deletefe); static int MultiBreakVolumeCallBack(struct host *host, int isheld, - struct VCBParams *parms); + void *rock); static int MultiBreakVolumeLaterCallBack(struct host *host, int isheld, - struct VCBParams *parms); + void *rock); static int GetSomeSpace_r(struct host *hostp, int locked); static int ClearHostCallbacks_r(struct host *hp, int locked); +#endif #define GetCB() ((struct CallBack *)iGetCB(&cbstuff.nCBs)) #define GetFE() ((struct FileEntry *)iGetFE(&cbstuff.nFEs)) @@ -1157,9 +1165,10 @@ MultiBreakVolumeCallBack_r(struct host *host, int isheld, ** isheld is 1 if the host is held in BreakVolumeCallBacks */ static int -MultiBreakVolumeCallBack(struct host *host, int isheld, - struct VCBParams *parms) +MultiBreakVolumeCallBack(struct host *host, int isheld, void *rock) { + struct VCBParams *parms = (struct VCBParams *) rock; + int retval; H_LOCK; retval = MultiBreakVolumeCallBack_r(host, isheld, parms, 1); @@ -1172,9 +1181,9 @@ MultiBreakVolumeCallBack(struct host *host, int isheld, ** isheld is 1 if the host is held in BreakVolumeCallBacks */ static int -MultiBreakVolumeLaterCallBack(struct host *host, int isheld, - struct VCBParams *parms) +MultiBreakVolumeLaterCallBack(struct host *host, int isheld, void *rock) { + struct VCBParams *parms = (struct VCBParams *)rock; int retval; H_LOCK; retval = MultiBreakVolumeCallBack_r(host, isheld, parms, 0); @@ -1243,7 +1252,7 @@ BreakVolumeCallBacks(afs_uint32 volume) henumParms.fid = &fid; henumParms.thead = tthead; H_UNLOCK; - h_Enumerate(MultiBreakVolumeCallBack, (char *)&henumParms); + h_Enumerate(MultiBreakVolumeCallBack, &henumParms); H_LOCK; if (henumParms.ncbas) { /* do left-overs */ struct AFSCBFids tf; @@ -1472,9 +1481,9 @@ static int lih_host_held; * are held by other threads. */ static int -lih0_r(register struct host *host, register int held, - register struct host *hostp) +lih0_r(register struct host *host, register int held, void *rock) { + struct host *hostp = (struct host *) rock; if (host->cblist && (hostp && host != hostp) && (!held && !h_OtherHolds_r(host)) @@ -1496,9 +1505,10 @@ lih0_r(register struct host *host, register int held, * prevent held hosts from being selected. */ static int -lih1_r(register struct host *host, register int held, - register struct host *hostp) +lih1_r(register struct host *host, register int held, void *rock) { + struct host *hostp = (struct host *) rock; + if (host->cblist && (hostp && host != hostp) && (!lih_host || host->ActiveCall < lih_host->ActiveCall) diff --git a/src/viced/host.c b/src/viced/host.c index 3b8daa0ae..da751896f 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -117,7 +117,7 @@ static void h_TossStuff_r(register struct host *host); /* get a new block of CEs and chain it on CEFree */ static void -GetCEBlock() +GetCEBlock(void) { register struct CEBlock *block; register int i; @@ -142,7 +142,7 @@ GetCEBlock() /* get the next available CE */ static struct client * -GetCE() +GetCE(void) { register struct client *entry; @@ -199,7 +199,7 @@ struct HTBlock { /* block of HTSPERBLOCK file entries */ /* get a new block of HTs and chain it on HTFree */ static void -GetHTBlock() +GetHTBlock(void) { register struct HTBlock *block; register int i; @@ -234,7 +234,7 @@ GetHTBlock() /* get the next available HT */ static struct host * -GetHT() +GetHT(void) { register struct host *entry; @@ -267,8 +267,6 @@ hpr_Initialize(struct ubik_client **uclient) struct rx_connection *serverconns[MAXSERVERS]; struct rx_securityClass *sc[3]; struct afsconf_dir *tdir; - char tconfDir[100] = ""; - char tcell[64] = ""; struct ktc_token ttoken; afs_int32 scIndex; struct afsconf_cell info; @@ -1065,7 +1063,7 @@ h_TossStuff_r(register struct host *host) * released, 1 if it should be held after enumeration. */ void -h_Enumerate(int (*proc) (), char *param) +h_Enumerate(int (*proc) (struct host*, int, void *), void *param) { register struct host *host, **list; register int *held; @@ -1119,7 +1117,8 @@ h_Enumerate(int (*proc) (), char *param) * be held after enumeration. */ void -h_Enumerate_r(int (*proc) (), struct host *enumstart, char *param) +h_Enumerate_r(int (*proc) (struct host *, int, void *), + struct host *enumstart, void *param) { register struct host *host, *next; int held = 0; @@ -1974,7 +1973,7 @@ int num_lrealms = -1; /* not reentrant */ void -h_InitHostPackage() +h_InitHostPackage(void) { memset(&nulluuid, 0, sizeof(afsUUID)); afsconf_GetLocalCell(confDir, localcellname, PR_MAXNAMELEN); @@ -2458,7 +2457,7 @@ h_UserName(struct client *client) void -h_PrintStats() +h_PrintStats(void) { ViceLog(0, ("Total Client entries = %d, blocks = %d; Host entries = %d, blocks = %d\n", @@ -2468,8 +2467,9 @@ h_PrintStats() static int -h_PrintClient(register struct host *host, int held, StreamHandle_t * file) +h_PrintClient(register struct host *host, int held, void *rock) { + StreamHandle_t *file = (StreamHandle_t *)rock; register struct client *client; int i; char tmpStr[256]; @@ -2530,7 +2530,7 @@ h_PrintClient(register struct host *host, int held, StreamHandle_t * file) * if known */ void -h_PrintClients() +h_PrintClients(void) { time_t now; char tmpStr[256]; @@ -2557,8 +2557,10 @@ h_PrintClients() static int -h_DumpHost(register struct host *host, int held, StreamHandle_t * file) +h_DumpHost(register struct host *host, int held, void *rock) { + StreamHandle_t *file = (StreamHandle_t *)rock; + int i; char tmpStr[256]; char hoststr[16]; @@ -2606,7 +2608,7 @@ h_DumpHost(register struct host *host, int held, StreamHandle_t * file) void -h_DumpHosts() +h_DumpHosts(void) { time_t now; StreamHandle_t *file = STREAM_OPEN(AFSDIR_SERVER_HOSTDUMP_FILEPATH, "w"); @@ -3375,7 +3377,7 @@ static struct AFSFid zerofid; * from other events. */ static int -CheckHost(register struct host *host, int held) +CheckHost(register struct host *host, int held, void *rock) { register struct client *client; struct rx_connection *cb_conn = NULL; @@ -3786,9 +3788,9 @@ printInterfaceAddr(struct host *host, int level) if (host->interface) { /* check alternate addresses */ number = host->interface->numberOfInterfaces; - if (number == 0) + if (number == 0) { ViceLog(level, ("no-addresses ")); - else { + } else { for (i = 0; i < number; i++) ViceLog(level, ("%s:%d ", afs_inet_ntoa_r(host->interface->interface[i].addr, hoststr), ntohs(host->interface->interface[i].port))); diff --git a/src/viced/host.h b/src/viced/host.h index 60c6bb3c2..87e7642c8 100644 --- a/src/viced/host.h +++ b/src/viced/host.h @@ -232,24 +232,24 @@ extern struct host *h_Alloc_r(register struct rx_connection *r_con); extern int h_Lookup_r(afs_uint32 hostaddr, afs_uint16 hport, int *heldp, struct host **hostp); extern struct host *h_LookupUuid_r(afsUUID * uuidp); -extern void h_Enumerate(int (*proc) (), char *param); -extern void h_Enumerate_r(int (*proc) (), struct host *enumstart, char *param); +extern void h_Enumerate(int (*proc) (struct host *, int, void *), void *param); +extern void h_Enumerate_r(int (*proc) (struct host *, int, void *), struct host *enumstart, void *param); extern struct host *h_GetHost_r(struct rx_connection *tcon); extern struct client *h_FindClient_r(struct rx_connection *tcon); extern int h_ReleaseClient_r(struct client *client); extern struct client *h_ID2Client(afs_int32 vid); extern int GetClient(struct rx_connection *tcon, struct client **cp); extern int PutClient(struct client **cp); -extern void h_PrintStats(); -extern void h_PrintClients(); -extern void h_GetWorkStats(); +extern void h_PrintStats(void); +extern void h_PrintClients(void); +extern void h_GetWorkStats(int *, int *, int *, afs_int32); extern void h_flushhostcps(register afs_uint32 hostaddr, register afs_uint16 hport); extern void h_GetHostNetStats(afs_int32 * a_numHostsP, afs_int32 * a_sameNetOrSubnetP, afs_int32 * a_diffSubnetP, afs_int32 * a_diffNetworkP); extern int h_NBLock_r(register struct host *host); -extern void h_DumpHosts(); -extern void h_InitHostPackage(); +extern void h_DumpHosts(void); +extern void h_InitHostPackage(void); extern void h_CheckHosts(); struct Interface *MultiVerifyInterface_r(); extern int initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf); diff --git a/src/viced/viced.c b/src/viced/viced.c index ceffdbc58..7c2ba92bd 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -1298,7 +1298,7 @@ ParseArgs(int argc, char *argv[]) rxMaxMTU, RX_MIN_PACKET_SIZE, RX_MAX_PACKET_DATA_SIZE); return -1; - } + } } else if (!strcmp(argv[i], "-realm")) { extern char local_realms[AFS_NUM_LREALMS][AFS_REALM_SZ]; extern int num_lrealms; -- 2.39.5