From: Nathan Neulinger Date: Tue, 12 Jun 2001 20:46:21 +0000 (+0000) Subject: rx-warning-cleanup-and-afsconfig-20010612 X-Git-Tag: openafs-stable-1_1_0~103 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=c569e9535821cac3c12df45fef72dd3bbd3c03cd rx-warning-cleanup-and-afsconfig-20010612 get rid of warnings and afsconfigize more of rx --- diff --git a/src/rx/rx.c b/src/rx/rx.c index 8f96aa0..f87a06c 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -11,6 +11,7 @@ #ifdef KERNEL #include "../afs/param.h" +#include #include "../afs/sysincludes.h" #include "../afs/afsincludes.h" #ifndef UKERNEL @@ -67,6 +68,7 @@ extern afs_int32 afs_termState; # include "../afsint/rxgen_consts.h" #else /* KERNEL */ # include +# include # include # include #ifdef AFS_NT40_ENV @@ -90,10 +92,12 @@ extern afs_int32 afs_termState; # include "rx_internal.h" # include #endif /* KERNEL */ - -#ifdef RXDEBUG -extern afs_uint32 LWP_ThreadId(); -#endif /* RXDEBUG */ +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_STRINGS_H +#include +#endif int (*registerProgram)() = 0; int (*swapNameProgram)() = 0; @@ -625,7 +629,7 @@ void rxi_StartServerProcs(nExistingProcs) void rx_StartServer(donateMe) { register struct rx_service *service; - register int i, nProcs; + register int i, nProcs=0; SPLVAR; clock_NewTime(); @@ -1081,7 +1085,7 @@ register struct rx_connection *aconn; { NETPRI; for(i=0; icall[i]) { + if ((tcall = aconn->call[i])) { if ((tcall->state == RX_STATE_ACTIVE) || (tcall->state == RX_STATE_PRECALL)) { USERPRI; @@ -1532,14 +1536,14 @@ rx_GetCall(tno, cur_service, socketp) { struct rx_serverQueueEntry *sq; register struct rx_call *call = (struct rx_call *) 0, *choice2; - struct rx_service *service; + struct rx_service *service = NULL; SPLVAR; NETPRI; AFS_RXGLOCK(); MUTEX_ENTER(&freeSQEList_lock); - if (sq = rx_FreeSQEList) { + if ((sq = rx_FreeSQEList)) { rx_FreeSQEList = *(struct rx_serverQueueEntry **)sq; MUTEX_EXIT(&freeSQEList_lock); } else { /* otherwise allocate a new one and return that */ @@ -3223,7 +3227,6 @@ struct rx_packet *rxi_ReceiveAckPacket(call, np, istack) afs_uint32 serial; /* because there are CM's that are bogus, sending weird values for this. */ afs_uint32 skew = 0; - int needRxStart = 0; int nbytes; int missing; int acked; @@ -6248,7 +6251,6 @@ afs_int32 rx_GetServerPeers( { struct rx_debugIn in; afs_int32 rc = 0; - int i; /* * supportedValues is currently unused, but added to allow future @@ -6406,7 +6408,7 @@ void shutdown_rx(void) MUTEX_ENTER(&freeSQEList_lock); - while (np = rx_FreeSQEList) { + while ((np = rx_FreeSQEList)) { rx_FreeSQEList = *(struct rx_serverQueueEntry **)np; MUTEX_DESTROY(&np->lock); rxi_Free(np, sizeof(*np)); @@ -6905,9 +6907,6 @@ int rx_RetrieveProcessRPCStats( ptr = *stats = (afs_uint32 *) rxi_Alloc(space); if (ptr != NULL) { - register struct rx_peer *pp; - int i; - int num_copied = 0; rx_interface_stat_p rpc_stat, nrpc_stat; @@ -7010,8 +7009,6 @@ int rx_RetrievePeerRPCStats( ptr = *stats = (afs_uint32 *) rxi_Alloc(space); if (ptr != NULL) { - int i; - int num_copied = 0; rx_interface_stat_p rpc_stat, nrpc_stat; char *fix_offset; diff --git a/src/rx/rx.h b/src/rx/rx.h index 03be43d..e44f2d5 100644 --- a/src/rx/rx.h +++ b/src/rx/rx.h @@ -97,6 +97,27 @@ int rxi_ReadProc(); int rxi_ReadvProc(); int rxi_FillReadVec(); void rxi_FlushWrite(); +int rxi_getAllAddrMaskMtu(); +int rx_getAllAddr(); +void rxi_FreePacket(); +int rxi_AllocDataBuf(); +void rxi_RestoreDataBufs(); +void rxi_Sleep(); +void rxi_InitializeThreadSupport(); +int rxi_Recvmsg(); +int rxi_Sendmsg(); +int rxi_IsConnInteresting(); +afs_int32 rx_SlowReadPacket(); +afs_int32 rx_SlowWritePacket(); +afs_int32 rx_SlowGetInt32(); +void rxi_StopListener(); +void rxi_InitPeerParams(); +void rxi_FreeAllPackets(); +void rxi_SendPacketList(); +void rxi_SendPacket(); +void rxi_MorePackets(); +void rx_CheckPackets(); +void rxi_Wakeup(); void rx_PrintStats(); void rx_PrintPeerStats(); void rx_SetArrivalProc(); @@ -107,6 +128,7 @@ typedef void (*rx_destructor_t)(void *); int rx_KeyCreate(rx_destructor_t); void *rx_GetSpecific(struct rx_connection *conn, int key); void rx_SetSpecific(struct rx_connection *conn, int key, void *ptr); +osi_socket rxi_GetUDPSocket(u_short port); #endif /* KERNEL */ int ntoh_syserr_conv(int error); diff --git a/src/rx/rx_clock.c b/src/rx/rx_clock.c index 546ae0f..5972e20 100644 --- a/src/rx/rx_clock.c +++ b/src/rx/rx_clock.c @@ -72,9 +72,11 @@ void clock_Init(void) { #ifndef KERNEL /* Make clock uninitialized. */ +int clock_UnInit() { clockInitialized = 0; + return 0; } #endif diff --git a/src/rx/rx_clock.h b/src/rx/rx_clock.h index 65a6663..e7d9e66 100644 --- a/src/rx/rx_clock.h +++ b/src/rx/rx_clock.h @@ -104,11 +104,11 @@ extern void clock_UpdateTime(); #endif /* AFS_PTHREAD_ENV */ /* Some comparison operators for clock values */ -#define clock_Gt(a, b) ((a)->sec>(b)->sec || (a)->sec==(b)->sec && (a)->usec>(b)->usec) -#define clock_Ge(a, b) ((a)->sec>(b)->sec || (a)->sec==(b)->sec && (a)->usec>=(b)->usec) +#define clock_Gt(a, b) ((a)->sec>(b)->sec || ((a)->sec==(b)->sec && (a)->usec>(b)->usec)) +#define clock_Ge(a, b) ((a)->sec>(b)->sec || ((a)->sec==(b)->sec && (a)->usec>=(b)->usec)) #define clock_Eq(a, b) ((a)->sec==(b)->sec && (a)->usec==(b)->usec) -#define clock_Le(a, b) ((a)->sec<(b)->sec || (a)->sec==(b)->sec && (a)->usec<=(b)->usec) -#define clock_Lt(a, b) ((a)->sec<(b)->sec || (a)->sec==(b)->sec && (a)->usec<(b)->usec) +#define clock_Le(a, b) ((a)->sec<(b)->sec || ((a)->sec==(b)->sec && (a)->usec<=(b)->usec)) +#define clock_Lt(a, b) ((a)->sec<(b)->sec || ((a)->sec==(b)->sec && (a)->usec<(b)->usec)) /* Is the clock value zero? */ #define clock_IsZero(c) ((c)->sec == 0 && (c)->usec == 0) diff --git a/src/rx/rx_conncache.c b/src/rx/rx_conncache.c index 2fc2784..685a9c6 100644 --- a/src/rx/rx_conncache.c +++ b/src/rx/rx_conncache.c @@ -133,7 +133,7 @@ static void rxi_AddCachedConnection(rx_connParts_p parts, struct rx_connection **conn) { cache_entry_p new_entry; - if(new_entry = (cache_entry_p) malloc(sizeof(cache_entry_t))) { + if((new_entry = (cache_entry_p) malloc(sizeof(cache_entry_t)))) { new_entry->conn = *conn; new_entry->parts = *parts; new_entry->inUse = 1; diff --git a/src/rx/rx_event.c b/src/rx/rx_event.c index b527a7a..c5a7ed8 100644 --- a/src/rx/rx_event.c +++ b/src/rx/rx_event.c @@ -170,7 +170,6 @@ struct rxevent *rxevent_Post(struct clock *when, void (*func)(), { register struct rxevent *ev, *evqe, *evqpr; register struct rxepoch *ep, *epqe, *epqpr; - struct clock ept; int isEarliest = 0; MUTEX_ENTER(&rxevent_lock); diff --git a/src/rx/rx_getaddr.c b/src/rx/rx_getaddr.c index 01633f8..7ada196 100644 --- a/src/rx/rx_getaddr.c +++ b/src/rx/rx_getaddr.c @@ -327,7 +327,9 @@ int maxSize; /* sizeof of buffer in afs_int32 units */ struct ifconf ifc; struct ifreq ifs[NIFS], *ifr; struct sockaddr_in *a; +#if defined(AFS_AIX41_ENV) || defined(AFS_USR_AIX_ENV) char *cp, *cplim; /* used only for AIX 41 */ +#endif s = socket(AF_INET, SOCK_DGRAM, 0); if (s < 0) @@ -392,9 +394,11 @@ int rxi_getAllAddrMaskMtu (addrBuffer, maskBuffer, mtuBuffer, maxSize) int s; int i, len, count=0; struct ifconf ifc; - struct ifreq ifs[NIFS], *ifr, tempIfr; + struct ifreq ifs[NIFS], *ifr; struct sockaddr_in *a; +#if defined(AFS_AIX41_ENV) || defined(AFS_USR_AIX_ENV) char *cp, *cplim; /* used only for AIX 41 */ +#endif #if !defined(AFS_USERSPACE_IP_ADDR) count = rx_getAllAddr(addrBuffer, 1024); diff --git a/src/rx/rx_lwp.c b/src/rx/rx_lwp.c index 973e902..f018c10 100644 --- a/src/rx/rx_lwp.c +++ b/src/rx/rx_lwp.c @@ -58,7 +58,7 @@ void rxi_Wakeup(void *addr) } PROCESS rx_listenerPid = 0; /* LWP process id of socket listener process */ -void rx_ListenerProc(void *dummy); +static void rx_ListenerProc(void *dummy); /* * Delay the current thread the specified number of seconds. @@ -149,7 +149,10 @@ void rxi_ListenerProc(rfds, tnop, newcallp) afs_int32 nextPollTime; /* time to next poll FD before sleeping */ int lastPollWorked, doingPoll; /* true iff last poll was useful */ struct timeval tv, *tvp; - int i, code; + int code; +#ifdef AFS_NT40_ENV + int i; +#endif PROCESS pid; char name[MAXTHREADNAMELENGTH] = "srv_0"; @@ -440,4 +443,5 @@ int rxi_Sendmsg(osi_socket socket, struct msghdr *msg_p, int flags) } if (sfds) IOMGR_FreeFDSet(sfds); + return 0; } diff --git a/src/rx/rx_misc.c b/src/rx/rx_misc.c index 589fb97..c469d9c 100644 --- a/src/rx/rx_misc.c +++ b/src/rx/rx_misc.c @@ -8,6 +8,7 @@ */ #include +#include #ifdef KERNEL #include #include @@ -24,7 +25,18 @@ #ifdef AFS_PTHREAD_ENV #include "rx.h" #endif /* AFS_PTHREAD_ENV */ +#include #endif +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_STRINGS_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + /* * We currently only include below the errors that @@ -36,6 +48,7 @@ * Convert from the local (host) to the standard * (network) system error code. */ +int hton_syserr_conv(code) register afs_int32 code; { @@ -58,6 +71,7 @@ hton_syserr_conv(code) * Convert from the standard (Network) format to the * local (host) system error code. */ +int ntoh_syserr_conv(int code) { register afs_int32 err; @@ -114,15 +128,17 @@ char * osi_alloc(x) return (char *)(mem_alloc(x)); } +int osi_free(x, size) char *x; afs_int32 size; { - if ((x == &memZero) || !x) return; + if ((x == &memZero) || !x) return 0; LOCK_MALLOC_STATS osi_alloccnt--; osi_allocsize -= size; UNLOCK_MALLOC_STATS mem_free(x, size); + return 0; } #endif #endif /* KERNEL */ diff --git a/src/rx/rx_packet.c b/src/rx/rx_packet.c index b430447..8c89d3b 100644 --- a/src/rx/rx_packet.c +++ b/src/rx/rx_packet.c @@ -9,6 +9,7 @@ #ifdef KERNEL #include "../afs/param.h" +#include #if defined(UKERNEL) #include "../afs/sysincludes.h" #include "../afs/afsincludes.h" @@ -44,6 +45,7 @@ #include "../rx/rx_globals.h" #else /* KERNEL */ #include +#include #include "sys/types.h" #include #include @@ -71,6 +73,15 @@ #include #include "rx_internal.h" #endif /* KERNEL */ +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_STRINGS_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif #ifdef RX_LOCKS_DB @@ -264,7 +275,9 @@ static struct rx_packet * allocCBuf(int class) osi_Panic("rxi_AllocPacket: packet not free\n"); c->header.flags = 0; +#ifdef KERNEL done: +#endif MUTEX_EXIT(&rx_freePktQ_lock); USERPRI; @@ -330,7 +343,7 @@ int rxi_AllocDataBuf(struct rx_packet *p, int nb, int class) for (i=p->niovecs; nb>0 && iwirevec[i].iov_base = (caddr_t) cb->localdata; p->wirevec[i].iov_len = RX_CBUFFERSIZE; nb -= RX_CBUFFERSIZE; @@ -670,7 +683,7 @@ int want; while (!(call->error)) { MUTEX_ENTER(&rx_freePktQ_lock); /* if an error occurred, or we get the packet we want, we're done */ - if (p = rxi_AllocPacketNoLock(RX_PACKET_CLASS_SEND)) { + if ((p = rxi_AllocPacketNoLock(RX_PACKET_CLASS_SEND))) { MUTEX_EXIT(&rx_freePktQ_lock); want += delta; @@ -1184,7 +1197,7 @@ struct rx_packet *rxi_ReceiveDebugPacket(ap, asocket, ahost, aport, istack) tconn.serial = htonl(tc->serial); for(j=0;jcallNumber[j]); - if (tcall=tc->call[j]) { + if ((tcall=tc->call[j])) { tconn.callState[j] = tcall->state; tconn.callMode[j] = tcall->mode; tconn.callFlags[j] = tcall->flags; @@ -1248,7 +1261,7 @@ struct rx_packet *rxi_ReceiveDebugPacket(ap, asocket, ahost, aport, istack) */ case RX_DEBUGI_GETPEER: { - int i, j; + int i; register struct rx_peer *tp; struct rx_debugPeer tpeer; @@ -1395,7 +1408,7 @@ static void rxi_SendDebugPacket(struct rx_packet *apacket, osi_socket asocket, int i; int nbytes; int saven = 0; - size_t savelen; + size_t savelen = 0; #ifdef KERNEL int waslocked = ISAFS_GLOCK(); #endif @@ -1440,7 +1453,9 @@ static void rxi_SendDebugPacket(struct rx_packet *apacket, osi_socket asocket, void rxi_SendPacket(struct rx_connection * conn, struct rx_packet *p, int istack) { +#if defined(KERNEL) int waslocked; +#endif struct sockaddr_in addr; register struct rx_peer *peer = conn->peer; osi_socket socket; @@ -1549,11 +1564,13 @@ void rxi_SendPacketList(struct rx_connection * conn, int len, int istack) { +#if defined(AFS_SUN5_ENV) && defined(KERNEL) int waslocked; +#endif struct sockaddr_in addr; register struct rx_peer *peer = conn->peer; osi_socket socket; - struct rx_packet *p; + struct rx_packet *p = NULL; struct iovec wirevec[RX_MAXIOVECS]; int i, length; afs_uint32 serial; @@ -1729,7 +1746,7 @@ rxi_SendSpecial(call, conn, optionalPacket, type, data, nbytes, istack) * packet sends (it's repeated elsewhere) */ register struct rx_packet *p; unsigned int i = 0; - int savelen, saven = 0; + int savelen = 0, saven = 0; int channel, callNumber; if (call) { channel = call->channel; diff --git a/src/rx/rx_rdwr.c b/src/rx/rx_rdwr.c index 0b40990..cd54781 100644 --- a/src/rx/rx_rdwr.c +++ b/src/rx/rx_rdwr.c @@ -9,6 +9,7 @@ #ifdef KERNEL #include "../afs/param.h" +#include #ifndef UKERNEL #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV) #include "../afs/sysincludes.h" @@ -56,6 +57,7 @@ #endif /* AFS_ALPHA_ENV */ #else /* KERNEL */ # include +# include # include #ifndef AFS_NT40_ENV # include @@ -72,6 +74,15 @@ # include "rx_globals.h" # include "rx_internal.h" #endif /* KERNEL */ +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_STRINGS_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif #ifdef RX_LOCKS_DB @@ -128,7 +139,7 @@ int rxi_ReadProc(call, buf, nbytes) * work. It may reduce the length of the packet by up * to conn->maxTrailerSize, to reflect the length of the * data + the header. */ - if (error = RXS_CheckPacket(conn->securityObject, call, rp)) { + if ((error = RXS_CheckPacket(conn->securityObject, call, rp))) { /* Used to merely shut down the call, but now we * shut down the whole connection since this may * indicate an attempt to hijack it */ @@ -401,7 +412,7 @@ int rxi_FillReadVec(call, seq, serial, flags) struct rx_packet *rp; struct rx_packet *curp; struct iovec *call_iov; - struct iovec *cur_iov; + struct iovec *cur_iov = NULL; curp = call->currentPacket; if (curp) { @@ -424,7 +435,7 @@ int rxi_FillReadVec(call, seq, serial, flags) * work. It may reduce the length of the packet by up * to conn->maxTrailerSize, to reflect the length of the * data + the header. */ - if (error = RXS_CheckPacket(conn->securityObject, call, rp)) { + if ((error = RXS_CheckPacket(conn->securityObject, call, rp))) { /* Used to merely shut down the call, but now we * shut down the whole connection since this may * indicate an attempt to hijack it */ @@ -732,7 +743,7 @@ int rxi_WriteProc(call, buf, nbytes) } #endif /* RX_ENABLE_LOCKS */ } - if (cp = rxi_AllocSendPacket(call, nbytes)) { + if ((cp = rxi_AllocSendPacket(call, nbytes))) { call->currentPacket = cp; call->nFree = cp->length; call->curvec = 1; /* 0th vec is always header */ @@ -1106,7 +1117,6 @@ int rxi_WritevProc(call, iov, nio, nbytes) int nio; int nbytes; { - struct rx_connection *conn = call->conn; struct rx_packet *cp = call->currentPacket; register struct rx_packet *tp; /* Temporary packet pointer */ register struct rx_packet *nxp; /* Next packet pointer, for queue_Scan */ @@ -1154,8 +1164,6 @@ int rxi_WritevProc(call, iov, nio, nbytes) nextio = 0; queue_Init(&tmpq); do { - unsigned int t; - if (call->nFree == 0 && cp) { clock_NewTime(); /* Bogus: need new time package */ /* The 0, below, specifies that it is not the last packet: diff --git a/src/rx/rxdebug.c b/src/rx/rxdebug.c index 1ec3eb2..627912b 100644 --- a/src/rx/rxdebug.c +++ b/src/rx/rxdebug.c @@ -9,6 +9,7 @@ #include #include +#include #include #ifdef AFS_NT40_ENV #include @@ -16,11 +17,22 @@ #include #include #include +#endif +#ifdef HAVE_NETINET_IN_H #include +#endif +#ifdef HAVE_SYS_TIME_H #include +#endif +#ifdef HAVE_UNISTD_H #include #endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_STRINGS_H +#include +#endif #include #include #include