From 4bc8d82d9a204b76fcf5208ded3a9a6ea917b734 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Thu, 25 Oct 2012 11:57:22 +0100 Subject: [PATCH] rx: MUTEX_* are no-ops when !RX_ENABLE_LOCKS Remove any occurences of # ifdef RX_ENABLE_LOCKS MUTEX_ENTER(&mutex) # endif and similar for MUTEX_INIT, MUTEX_DESTROY and MUTEX_EXIT, as all of these operations are no-ops when RX_ENABLE_LOCKS isn't defined. Change-Id: Ic0f27b42d56ae4362ff095f1f08a06575c4ca2c1 Reviewed-on: http://gerrit.openafs.org/8293 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/rx/rx.c | 2 -- src/rx/rx_multi.c | 16 +--------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/rx/rx.c b/src/rx/rx.c index c9c6117..e976ec3 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -1781,9 +1781,7 @@ rx_NewServiceHost(afs_uint32 host, u_short port, u_short serviceId, tservice = rxi_AllocService(); NETPRI; -#ifdef RX_ENABLE_LOCKS MUTEX_INIT(&tservice->svc_data_lock, "svc data lock", MUTEX_DEFAULT, 0); -#endif for (i = 0; i < RX_MAX_SERVICES; i++) { struct rx_service *service = rx_services[i]; diff --git a/src/rx/rx_multi.c b/src/rx/rx_multi.c index ee858d5..65a347e 100644 --- a/src/rx/rx_multi.c +++ b/src/rx/rx_multi.c @@ -49,10 +49,8 @@ multi_Init(struct rx_connection **conns, int nConns) mh->nReady = 0; mh->nConns = nConns; -#ifdef RX_ENABLE_LOCKS MUTEX_INIT(&mh->lock, "rx_multi_lock", MUTEX_DEFAULT, 0); CV_INIT(&mh->cv, "rx_multi_cv", CV_DEFAULT, 0); -#endif /* RX_ENABLE_LOCKS */ for (i = 0; i < nConns; i++) { struct rx_call *call; call = mh->calls[i] = rx_NewCall(conns[i]); @@ -68,14 +66,10 @@ multi_Select(struct multi_handle *mh) int index; SPLVAR; NETPRI; -#ifdef RX_ENABLE_LOCKS MUTEX_ENTER(&mh->lock); -#endif /* RX_ENABLE_LOCKS */ while (mh->nextReady == mh->firstNotReady) { if (mh->nReady == mh->nConns) { -#ifdef RX_ENABLE_LOCKS MUTEX_EXIT(&mh->lock); -#endif /* RX_ENABLE_LOCKS */ USERPRI; return -1; } @@ -87,9 +81,7 @@ multi_Select(struct multi_handle *mh) } index = *(mh->nextReady); (mh->nextReady) += 1; -#ifdef RX_ENABLE_LOCKS MUTEX_EXIT(&mh->lock); -#endif /* RX_ENABLE_LOCKS */ USERPRI; return index; } @@ -100,17 +92,15 @@ multi_Ready(struct rx_call *call, void *amh, int index) { struct multi_handle *mh = (struct multi_handle *)amh; -#ifdef RX_ENABLE_LOCKS MUTEX_ENTER(&mh->lock); -#endif /* RX_ENABLE_LOCKS */ *mh->firstNotReady++ = index; mh->nReady++; #ifdef RX_ENABLE_LOCKS CV_SIGNAL(&mh->cv); - MUTEX_EXIT(&mh->lock); #else /* RX_ENABLE_LOCKS */ osi_rxWakeup(mh); #endif /* RX_ENABLE_LOCKS */ + MUTEX_EXIT(&mh->lock); } /* Called when the multi rx call is over, or when the user aborts it (by using the macro multi_Abort) */ @@ -124,10 +114,8 @@ multi_Finalize(struct multi_handle *mh) if (call) rx_EndCall(call, RX_USER_ABORT); } -#ifdef RX_ENABLE_LOCKS MUTEX_DESTROY(&mh->lock); CV_DESTROY(&mh->cv); -#endif /* RX_ENABLE_LOCKS */ osi_Free(mh->calls, sizeof(struct rx_call *) * nCalls); osi_Free(mh->ready, sizeof(short *) * nCalls); osi_Free(mh, sizeof(struct multi_handle)); @@ -144,10 +132,8 @@ multi_Finalize_Ignore(struct multi_handle *mh) if (call) rx_EndCall(call, 0); } -#ifdef RX_ENABLE_LOCKS MUTEX_DESTROY(&mh->lock); CV_DESTROY(&mh->cv); -#endif /* RX_ENABLE_LOCKS */ osi_Free(mh->calls, sizeof(struct rx_call *) * nCalls); osi_Free(mh->ready, sizeof(short *) * nCalls); osi_Free(mh, sizeof(struct multi_handle)); -- 1.9.4