diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-08-19 18:18:54 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-08-19 18:18:54 +0000 |
commit | 14d1db6cdb844d77581a7a98bafba912df5bd2c1 (patch) | |
tree | ea6070e14c42c1d85ba356d3c739807362b094f7 /cpukit | |
parent | 2008-08-19 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-14d1db6cdb844d77581a7a98bafba912df5bd2c1.tar.bz2 |
2008-08-19 Joel Sherrill <joel.sherrill@OARcorp.com>
* libfs/src/nfsclient/src/nfs.c, libfs/src/nfsclient/src/rpcio.c:
Remove some warnings. Using ASSERT/assert macros confuses gcc who is
unsure actions take place. More importantly if you ever compiled with
NDEBUG set wrong, intended actions would not occur. Likely I did not
catch all of these.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/ChangeLog | 8 | ||||
-rw-r--r-- | cpukit/libfs/src/nfsclient/src/nfs.c | 74 | ||||
-rw-r--r-- | cpukit/libfs/src/nfsclient/src/rpcio.c | 86 |
3 files changed, 97 insertions, 71 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 6af17a2d68..5500af2cb7 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,5 +1,13 @@ 2008-08-19 Joel Sherrill <joel.sherrill@OARcorp.com> + * libfs/src/nfsclient/src/nfs.c, libfs/src/nfsclient/src/rpcio.c: + Remove some warnings. Using ASSERT/assert macros confuses gcc who is + unsure actions take place. More importantly if you ever compiled with + NDEBUG set wrong, intended actions would not occur. Likely I did not + catch all of these. + +2008-08-19 Joel Sherrill <joel.sherrill@OARcorp.com> + * httpd/uemf.h: Add empty braces to macro. 2008-08-19 Tim FitzGeorge <tim.fitzgeorge@astrium.eads.net> diff --git a/cpukit/libfs/src/nfsclient/src/nfs.c b/cpukit/libfs/src/nfsclient/src/nfs.c index 2efc148e20..164efa108a 100644 --- a/cpukit/libfs/src/nfsclient/src/nfs.c +++ b/cpukit/libfs/src/nfsclient/src/nfs.c @@ -961,6 +961,7 @@ nfsInit(int smallPoolDepth, int bigPoolDepth) { static int initialised = 0; entry dummy; +rtems_status_code status; if (initialised) return; @@ -997,37 +998,40 @@ entry dummy; dummy.name = "somename"; /* guess average length of a filename */ dirres_entry_size = xdr_sizeof((xdrproc_t)xdr_entry, &dummy); - assert( smallPool = rpcUdpXactPoolCreate( - NFS_PROGRAM, - NFS_VERSION_2, - CONFIG_NFS_SMALL_XACT_SIZE, - smallPoolDepth) ); - - assert( bigPool = rpcUdpXactPoolCreate( - NFS_PROGRAM, - NFS_VERSION_2, - CONFIG_NFS_BIG_XACT_SIZE, - bigPoolDepth) ); - - assert( RTEMS_SUCCESSFUL == rtems_semaphore_create( - rtems_build_name('N','F','S','l'), - 1, - MUTEX_ATTRIBUTES, - 0, - &nfsGlob.llock) ); - - assert( RTEMS_SUCCESSFUL == rtems_semaphore_create( - rtems_build_name('N','F','S','m'), - 1, - MUTEX_ATTRIBUTES, - 0, - &nfsGlob.lock) ); + smallPool = rpcUdpXactPoolCreate( + NFS_PROGRAM, + NFS_VERSION_2, + CONFIG_NFS_SMALL_XACT_SIZE, + smallPoolDepth); + assert( smallPool ); + + bigPool = rpcUdpXactPoolCreate( + NFS_PROGRAM, + NFS_VERSION_2, + CONFIG_NFS_BIG_XACT_SIZE, + bigPoolDepth); + assert( bigPool ); + + status = rtems_semaphore_create( + rtems_build_name('N','F','S','l'), + 1, + MUTEX_ATTRIBUTES, + 0, + &nfsGlob.llock); + assert( status == RTEMS_SUCCESSFUL ); + status = rtems_semaphore_create( + rtems_build_name('N','F','S','m'), + 1, + MUTEX_ATTRIBUTES, + 0, + &nfsGlob.lock); + assert( status == RTEMS_SUCCESSFUL ); if (sizeof(ino_t) < sizeof(u_int)) { fprintf(stderr, - "WARNING: Using 'short st_ino' hits performance and may fail to access/find correct files\n"); + "WARNING: Using 'short st_ino' hits performance and may fail to access/find correct files\n"); fprintf(stderr, - "you should fix newlib's sys/stat.h - for now I'll enable a hack...\n"); + "you should fix newlib's sys/stat.h - for now I'll enable a hack...\n"); } } @@ -1981,7 +1985,8 @@ char *path = mt_entry->dev; goto cleanup; } - assert( nfs = nfsCreate(nfsServer) ); + nfs = nfsCreate(nfsServer); + assert( nfs ); nfsServer = 0; nfs->uid = uid; @@ -1990,7 +1995,8 @@ char *path = mt_entry->dev; /* that seemed to work - we now create the root node * and we also must obtain the root node attributes */ - assert( rootNode = nfsNodeCreate(nfs, &fhstat.fhstatus_u.fhs_fhandle) ); + rootNode = nfsNodeCreate(nfs, &fhstat.fhstatus_u.fhs_fhandle); + assert( rootNode ); if ( updateAttr(rootNode, 1 /* force */) ) { e = errno; @@ -2039,9 +2045,10 @@ STATIC int nfs_fsunmount_me( { enum clnt_stat stat; struct sockaddr_in saddr; -char *path = mt_entry->dev; -int nodesInUse; -u_long uid,gid; +char *path = mt_entry->dev; +int nodesInUse; +u_long uid,gid; +int status; LOCK(nfsGlob.llock); nodesInUse = ((Nfs)mt_entry->fs_info)->nodesInUse; @@ -2054,7 +2061,8 @@ LOCK(nfsGlob.llock); rtems_set_errno_and_return_minus_one(EBUSY); } - assert( 0 == buildIpAddr(&uid, &gid, 0, &saddr, &path) ); + status = buildIpAddr(&uid, &gid, 0, &saddr, &path); + assert( !status ); stat = mntcall( &saddr, MOUNTPROC_UMNT, diff --git a/cpukit/libfs/src/nfsclient/src/rpcio.c b/cpukit/libfs/src/nfsclient/src/rpcio.c index 65ec1d33c5..020ebf99af 100644 --- a/cpukit/libfs/src/nfsclient/src/rpcio.c +++ b/cpukit/libfs/src/nfsclient/src/rpcio.c @@ -828,8 +828,9 @@ enum clnt_stat rpcUdpRcv(RpcUdpXact xact) { int refresh; -XDR reply_xdrs; +XDR reply_xdrs; struct rpc_msg reply_msg; +rtems_status_code status; rtems_event_set gotEvents; refresh = 0; @@ -837,12 +838,12 @@ rtems_event_set gotEvents; do { /* block for the reply */ - ASSERT( RTEMS_SUCCESSFUL == - rtems_event_receive( - RTEMS_RPC_EVENT, - RTEMS_WAIT | RTEMS_EVENT_ANY, - RTEMS_NO_TIMEOUT, - &gotEvents) ); + status = rtems_event_receive( + RTEMS_RPC_EVENT, + RTEMS_WAIT | RTEMS_EVENT_ANY, + RTEMS_NO_TIMEOUT, + &gotEvents); + ASSERT( status == RTEMS_SUCCESSFUL ); if (xact->status.re_status) { #ifdef MBUF_RX @@ -924,7 +925,9 @@ rtems_event_send((rtems_id)arg, RPCIOD_RX_EVENT); int rpcUdpInit(void) { -int noblock = 1; +int s; +rtems_status_code status; +int noblock = 1; struct sockwakeup wkup; if (ourSock < 0) { @@ -935,11 +938,11 @@ struct sockwakeup wkup; ourSock=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (ourSock>=0) { bindresvport(ourSock,(struct sockaddr_in*)0); - assert( 0==ioctl(ourSock, FIONBIO, (char*)&noblock) ); + s = ioctl(ourSock, FIONBIO, (char*)&noblock); + assert( s == 0 ); /* assume nobody tampers with the clock !! */ - assert( RTEMS_SUCCESSFUL == rtems_clock_get( - RTEMS_CLOCK_GET_TICKS_PER_SECOND, - &ticksPerSec)); + status = rtems_clock_get(RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticksPerSec); + assert( status == RTEMS_SUCCESSFUL ); MU_CREAT( &hlock ); MU_CREAT( &llock ); @@ -949,27 +952,28 @@ struct sockwakeup wkup; rpciodPriority = RPCIOD_PRIO; /* fallback value */ } - assert( RTEMS_SUCCESSFUL == rtems_task_create( + status = rtems_task_create( rtems_build_name('R','P','C','d'), rpciodPriority, RPCIOD_STACK, RTEMS_DEFAULT_MODES, /* fprintf saves/restores FP registers on PPC :-( */ RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, - &rpciod) ); + &rpciod); + assert( status = RTEMS_SUCCESSFUL ); + wkup.sw_pfn = rxWakeupCB; wkup.sw_arg = (caddr_t)rpciod; assert( 0==setsockopt(ourSock, SOL_SOCKET, SO_RCVWAKEUP, &wkup, sizeof(wkup)) ); - assert( RTEMS_SUCCESSFUL == rtems_message_queue_create( + status = rtems_message_queue_create( rtems_build_name('R','P','C','q'), RPCIOD_QDEPTH, sizeof(RpcUdpXact), RTEMS_DEFAULT_ATTRIBUTES, - &msgQ) ); - assert( RTEMS_SUCCESSFUL == rtems_task_start( - rpciod, - rpcio_daemon, - 0 ) ); + &msgQ); + assert( status = RTEMS_SUCCESSFUL ); + status = rtems_task_start( rpciod, rpcio_daemon, 0 ); + assert( status = RTEMS_SUCCESSFUL ); } else { return -1; @@ -1140,18 +1144,19 @@ rtems_status_code stat; RpcUdpXact xact; RpcUdpServer srv; rtems_interval next_retrans, then, unow; -long now; /* need to do signed comparison with age! */ +long now; /* need to do signed comparison with age! */ rtems_event_set events; ListNode newList; size_t size; rtems_id q = 0; ListNodeRec listHead = {0}; unsigned long epoch = RPCIOD_EPOCH_SECS * ticksPerSec; -unsigned long max_period = RPCIOD_RETX_CAP_S * ticksPerSec; +unsigned long max_period = RPCIOD_RETX_CAP_S * ticksPerSec; +rtems_status_code status; + - assert( RTEMS_SUCCESSFUL == rtems_clock_get( - RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, - &then) ); + status = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &then ); + assert( status == RTEMS_SUCCESSFUL ); for (next_retrans = epoch;;) { @@ -1194,9 +1199,8 @@ unsigned long max_period = RPCIOD_RETX_CAP_S * ticksPerSec; } } - ASSERT( RTEMS_SUCCESSFUL == rtems_clock_get( - RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, - &unow ) ); + status = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &unow ); + assert( status == RTEMS_SUCCESSFUL ); /* measure everything relative to then to protect against * rollover @@ -1344,8 +1348,8 @@ unsigned long max_period = RPCIOD_RETX_CAP_S * ticksPerSec; /* wakeup requestor */ fprintf(stderr,"RPCIO: SEND failure\n"); - ASSERT( RTEMS_SUCCESSFUL == - rtems_event_send(xact->requestor, RTEMS_RPC_EVENT) ); + status = rtems_event_send(xact->requestor, RTEMS_RPC_EVENT); + assert( status == RTEMS_SUCCESSFUL ); } else { /* send successful; calculate retransmission time @@ -1511,14 +1515,17 @@ rpcUdpXactPoolCreate( int xactsize, int poolsize) { RpcUdpXactPool rval = MY_MALLOC(sizeof(*rval)); +rtems_status_code status; + + ASSERT( rval ); + status = rtems_message_queue_create( + rtems_build_name('R','P','C','p'), + poolsize, + sizeof(RpcUdpXact), + RTEMS_DEFAULT_ATTRIBUTES, + &rval->box); + assert( status == RTEMS_SUCCESSFUL ); - ASSERT( rval && - RTEMS_SUCCESSFUL == rtems_message_queue_create( - rtems_build_name('R','P','C','p'), - poolsize, - sizeof(RpcUdpXact), - RTEMS_DEFAULT_ATTRIBUTES, - &rval->box) ); rval->prog = prog; rval->version = version; rval->xactSize = xactsize; @@ -1569,7 +1576,10 @@ void rpcUdpXactPoolPut(RpcUdpXact xact) { RpcUdpXactPool pool; - ASSERT( pool=xact->pool ); + + pool = xact->pool; + ASSERT( pool ); + if (RTEMS_SUCCESSFUL != rtems_message_queue_send( pool->box, &xact, |