diff --git a/src/fsprobe/fsprobe.c b/src/fsprobe/fsprobe.c index 89d685a192..52de90480d 100644 --- a/src/fsprobe/fsprobe.c +++ b/src/fsprobe/fsprobe.c @@ -26,21 +26,22 @@ RCSID #include /*Lightweight process package */ #include #include - +#include + #define LWP_STACK_SIZE (16 * 1024) /* * Routines we need that don't have explicit include file definitions. */ -extern int RXAFSCB_ExecuteRequest(); /*AFS callback dispatcher */ -extern char *hostutil_GetNameByINet(); /*Host parsing utility */ +extern int RXAFSCB_ExecuteRequest(struct rx_call *); /*AFS callback dispatcher */ /* * Help out the linker by explicitly importing the callback routines. */ -extern afs_int32 SRXAFSCB_CallBack(); -extern afs_int32 SRXAFSCB_InitCallBackState2(); -extern afs_int32 SRXAFSCB_Probe(); +extern afs_int32 SRXAFSCB_CallBack(struct rx_call *, AFSCBFids *, AFSCBs *); +extern afs_int32 SRXAFSCB_InitCallBackState2(struct rx_call *, + struct interfaceAddr *); +extern afs_int32 SRXAFSCB_Probe(struct rx_call *); /* * Exported variables. @@ -55,7 +56,7 @@ int fsprobe_ProbeFreqInSecs; /*Probe freq. in seconds */ */ static int fsprobe_initflag = 0; /*Was init routine called? */ static int fsprobe_debug = 0; /*Debugging output enabled? */ -static int (*fsprobe_Handler) (); /*Probe handler routine */ +static int (*fsprobe_Handler) (void); /*Probe handler routine */ static PROCESS probeLWP_ID; /*Probe LWP process ID */ static int fsprobe_statsBytes; /*Num bytes in stats block */ static int fsprobe_probeOKBytes; /*Num bytes in probeOK block */ @@ -90,7 +91,7 @@ static int fsprobe_probeOKBytes; /*Num bytes in probeOK block */ *------------------------------------------------------------------------*/ static int -fsprobe_CleanupInit() +fsprobe_CleanupInit(void) { /*fsprobe_CleanupInit */ afs_int32 code; /*Return code from callback stubs */ @@ -143,9 +144,7 @@ fsprobe_CleanupInit() *------------------------------------------------------------------------*/ int -fsprobe_Cleanup(a_releaseMem) - int a_releaseMem; - +fsprobe_Cleanup(int a_releaseMem) { /*fsprobe_Cleanup */ static char rn[] = "fsprobe_Cleanup"; /*Routine name */ @@ -395,10 +394,10 @@ fsprobe_LWP(void *unused) /*list all the partitions on */ static int newvolserver = 0; -XListPartitions(aconn, ptrPartList, cntp) - struct rx_connection *aconn; - struct partList *ptrPartList; - afs_int32 *cntp; + +int +XListPartitions(struct rx_connection *aconn, struct partList *ptrPartList, + afs_int32 *cntp) { struct pIDs partIds; struct partEntries partEnts; @@ -487,14 +486,9 @@ XListPartitions(aconn, ptrPartList, cntp) *------------------------------------------------------------------------*/ int -fsprobe_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler, - a_debug) - int a_numServers; - struct sockaddr_in *a_socketArray; - int a_ProbeFreqInSecs; - int (*a_ProbeHandler) (); - int a_debug; - +fsprobe_Init(int a_numServers, struct sockaddr_in *a_socketArray, + int a_ProbeFreqInSecs, int (*a_ProbeHandler)(void), + int a_debug) { /*fsprobe_Init */ static char rn[] = "fsprobe_Init"; /*Routine name */ @@ -566,7 +560,7 @@ fsprobe_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler, malloc(a_numServers * sizeof(struct fsprobe_ConnectionInfo)); if (fsprobe_ConnInfo == (struct fsprobe_ConnectionInfo *)0) { fprintf(stderr, - "[%s] Can't allocate %d connection info structs (%d bytes)\n", + "[%s] Can't allocate %d connection info structs (%lu bytes)\n", rn, a_numServers, (a_numServers * sizeof(struct fsprobe_ConnectionInfo))); return (-1); /*No cleanup needs to be done yet */ @@ -672,7 +666,7 @@ fsprobe_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler, if (fsprobe_debug) { fprintf(stderr, "[%s] Copying in the following socket info:\n", rn); - fprintf(stderr, "[%s] IP addr 0x%lx, port %d\n", rn, + fprintf(stderr, "[%s] IP addr 0x%x, port %d\n", rn, (a_socketArray + curr_srv)->sin_addr.s_addr, (a_socketArray + curr_srv)->sin_port); } @@ -683,7 +677,7 @@ fsprobe_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler, hostutil_GetNameByINet(curr_conn->skt.sin_addr.s_addr); if (hostNameFound == NULL) { fprintf(stderr, - "[%s] Can't map Internet address %lu to a string name\n", + "[%s] Can't map Internet address %u to a string name\n", rn, curr_conn->skt.sin_addr.s_addr); curr_conn->hostName[0] = '\0'; } else { @@ -698,7 +692,7 @@ fsprobe_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler, */ if (fsprobe_debug) fprintf(stderr, - "[%s] Connecting to srv idx %d, IP addr 0x%lx, port %d, service 1\n", + "[%s] Connecting to srv idx %d, IP addr 0x%x, port %d, service 1\n", rn, curr_srv, curr_conn->skt.sin_addr.s_addr, curr_conn->skt.sin_port); curr_conn->rxconn = rx_NewConnection(curr_conn->skt.sin_addr.s_addr, /*Server addr */ @@ -708,12 +702,12 @@ fsprobe_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler, 0); /*Number of above */ if (curr_conn->rxconn == (struct rx_connection *)0) { fprintf(stderr, - "[%s] Can't create Rx connection to server %s (%lu)\n", + "[%s] Can't create Rx connection to server %s (%u)\n", rn, curr_conn->hostName, curr_conn->skt.sin_addr.s_addr); conn_err = 1; } if (fsprobe_debug) - fprintf(stderr, "[%s] New connection at 0x%lx\n", rn, + fprintf(stderr, "[%s] New connection at %p\n", rn, curr_conn->rxconn); /* @@ -721,7 +715,7 @@ fsprobe_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler, */ if (fsprobe_debug) fprintf(stderr, - "[%s] Connecting to srv idx %d, IP addr 0x%lx, port %d, service 1\n", + "[%s] Connecting to srv idx %d, IP addr 0x%x, port %d, service 1\n", rn, curr_srv, curr_conn->skt.sin_addr.s_addr, htons(7005)); curr_conn->rxVolconn = rx_NewConnection(curr_conn->skt.sin_addr.s_addr, /*Server addr */ @@ -731,7 +725,7 @@ fsprobe_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler, 0); /*Number of above */ if (curr_conn->rxVolconn == (struct rx_connection *)0) { fprintf(stderr, - "[%s] Can't create Rx connection to volume server %s (%lu)\n", + "[%s] Can't create Rx connection to volume server %s (%u)\n", rn, curr_conn->hostName, curr_conn->skt.sin_addr.s_addr); conn_err = 1; } else { @@ -746,7 +740,7 @@ fsprobe_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler, } } if (fsprobe_debug) - fprintf(stderr, "[%s] New connection at 0x%lx\n", rn, + fprintf(stderr, "[%s] New connection at %p\n", rn, curr_conn->rxVolconn); @@ -802,7 +796,7 @@ fsprobe_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler, return (code); } if (fsprobe_debug) - fprintf(stderr, "[%s] Probe LWP process structure located at 0x%x\n", + fprintf(stderr, "[%s] Probe LWP process structure located at %p\n", rn, probeLWP_ID); #if 0 @@ -846,7 +840,7 @@ fsprobe_Init(a_numServers, a_socketArray, a_ProbeFreqInSecs, a_ProbeHandler, *------------------------------------------------------------------------*/ int -fsprobe_ForceProbeNow() +fsprobe_ForceProbeNow(void) { /*fsprobe_ForceProbeNow */ static char rn[] = "fsprobe_ForceProbeNow"; /*Routine name */ diff --git a/src/fsprobe/fsprobe.h b/src/fsprobe/fsprobe.h index 539597c2c1..33221fc910 100644 --- a/src/fsprobe/fsprobe.h +++ b/src/fsprobe/fsprobe.h @@ -106,7 +106,7 @@ extern struct fsprobe_ConnectionInfo *fsprobe_ConnInfo; /*Ptr to connections */ extern int numCollections; /*Num data collections */ extern struct fsprobe_ProbeResults fsprobe_Results; /*Latest probe results */ -extern int fsprobe_Init(); +extern int fsprobe_Init(int, struct sockaddr_in *, int, int (*)(void), int ); /* * Summary: * Initialize the fsprobe module: set up Rx connections to the @@ -125,7 +125,7 @@ extern int fsprobe_Init(); * Error value otherwise. */ -extern int fsprobe_ForceProbeNow(); +extern int fsprobe_ForceProbeNow(void); /* * Summary: * Force an immediate probe to the connected FileServers. @@ -138,7 +138,7 @@ extern int fsprobe_ForceProbeNow(); * Error value otherwise. */ -extern int fsprobe_Cleanup(); +extern int fsprobe_Cleanup(int); /* * Summary: * Clean up our memory and connection state. diff --git a/src/fsprobe/fsprobe_callback.c b/src/fsprobe/fsprobe_callback.c index 13f3d792c4..e18ef1902b 100644 --- a/src/fsprobe/fsprobe_callback.c +++ b/src/fsprobe/fsprobe_callback.c @@ -30,24 +30,18 @@ RCSID #include #include /*Standard I/O stuff */ #include /*Callback interface defs */ +#include #define FSPROBE_CALLBACK_VERBOSE 0 int afs_cb_inited = 0; struct interfaceAddr afs_cb_interface; -/* - * Routines we need that don't have explicit include file definitions. - */ -extern char *hostutil_GetNameByINet(); /*Host parsing utility */ - -static char mn[] = "fsprobe_callback"; /*Module name */ - /* * Initialize the callback interface structure */ static int -init_afs_cb() +init_afs_cb(void) { int count; @@ -476,9 +470,6 @@ SRXAFSCB_InitCallBackState2(struct rx_call * rxcall, afs_int32 SRXAFSCB_WhoAreYou(struct rx_call * rxcall, struct interfaceAddr * addr) { - int i; - int code = 0; - int count; #if FSPROBE_CALLBACK_VERBOSE static char rn[] = "SRXAFSCB_WhoAreYou"; /*Routine name */ @@ -732,10 +723,6 @@ SRXAFSCB_TellMeAboutYourself(struct rx_call * rxcall, struct interfaceAddr * addr, Capabilities * capabilities) { - int i; - int code = 0; - int count; - #if FSPROBE_CALLBACK_VERBOSE static char rn[] = "SRXAFSCB_TellMeAboutYourself"; /*Routine name */ char hostName[256]; /*Host name buffer */ diff --git a/src/fsprobe/fsprobe_test.c b/src/fsprobe/fsprobe_test.c index 5951e04125..ddaf0cb257 100644 --- a/src/fsprobe/fsprobe_test.c +++ b/src/fsprobe/fsprobe_test.c @@ -21,12 +21,8 @@ RCSID #include #include /*Interface for fsprobe module */ - -/* - * External routines that don't have explicit include file definitions. - */ -extern struct hostent *hostutil_GetHostByName(); - +#include + /*------------------------------------------------------------------------ * FS_Handler * @@ -51,7 +47,7 @@ extern struct hostent *hostutil_GetHostByName(); *------------------------------------------------------------------------*/ int -FS_Handler() +FS_Handler(void) { /*FS_Handler */ static char rn[] = "FS_Handler"; /*Routine name */ @@ -146,10 +142,8 @@ FS_Handler() #include "AFS_component_version_number.c" -main(argc, argv) - int argc; - char **argv; - +int +main(int argc, char **argv) { /*Main routine */ static char rn[] = "fsprobe_test"; /*Routine name */ @@ -204,11 +198,11 @@ main(argc, argv) memcpy(&(FSSktArray[2].sin_addr.s_addr), he->h_addr, 4); printf("Sockets for the 3 AFS FileServers to be probed:\n"); - printf("\t Host servername1: IP addr 0x%lx, port %d\n", + printf("\t Host servername1: IP addr 0x%x, port %d\n", FSSktArray[0].sin_addr.s_addr, FSSktArray[0].sin_port); - printf("\t Host servername2: IP addr 0x%lx, port %d\n", + printf("\t Host servername2: IP addr 0x%x, port %d\n", FSSktArray[1].sin_addr.s_addr, FSSktArray[1].sin_port); - printf("\t Host servername3: IP addr 0x%lx, port %d\n", + printf("\t Host servername3: IP addr 0x%x, port %d\n", FSSktArray[2].sin_addr.s_addr, FSSktArray[2].sin_port); /*