Further rationalise our usage of assert()
authorSimon Wilkinson <sxw@your-file-system.com>
Wed, 7 Sep 2011 13:59:17 +0000 (14:59 +0100)
committerDerrick Brashear <shadow@dementix.org>
Tue, 4 Sep 2012 13:53:16 +0000 (06:53 -0700)
commitab977738b1542bee2dd780285ec90ebeebdc32c1
tree3cce2e2a8adaa0630bd73cd9173bf491261baa2c
parent04c750b2fe3879126054f92804b37ad3b1b6340c
Further rationalise our usage of assert()

This patch futher improves our usage of assert() and friends. The
intention is to bring clarity to which forms of assert are used in
which situations, and to solve the problem of assert(X), or
osi_Assert(X) being used in a situation where X has side-effects.

It introduces two new assertion macros opr_Assert() and opr_Verify(),
and clarifies the usage of osi_Assert() and assert().

*) opr_Assert is a direct equivalent of assert(), with the exception
   that its output can be redirected to a log file when used in server
   code. It is the preferred version of assert for libraries, and server
   side code. Note that whilst opr_Assert doesn't currently become a
   no-op when NDEBUG is defined, the intention is that it will do so at
   some point in the future.
*) opr_Verify(X) asserts if the value of X is false. Unlike assert()
   it will always run X, regardless of whether the value is checked or
   not. The eventual intention is that when NDEBUG is defined,
   opr_Verify(X) => X
*) osi_Assert is an assertion macro intended for use in kernel code,
   or in mixed kernel/userland code. When code is built for userspace,
   osi_Assert(X) => opr_Assert(X)
*) assert is the system's own assert macro. It should only be used
   in client code. Whilst a header (opr_assert.h) is provided to map
   assert() to opr_Assert(), its use is discouraged

Change-Id: Ie6d61305686bdc7193cc8690e6f4fbe363211faf
Reviewed-on: http://gerrit.openafs.org/5395
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
87 files changed:
src/WINNT/afsd/NTMakefile
src/afs/UKERNEL/sysincludes.h
src/afsd/afsd_kernel.c
src/aklog/klog.c
src/audit/audit.c
src/auth/netrestrict.c
src/bucoord/status.c
src/budb/db_dump.c
src/budb/dbs_dump.c
src/butc/lwps.c
src/comerr/error_msg.c
src/crypto/hcrypto/kernel/config.h
src/dir/buffer.c
src/libacl/aclprocs.c
src/libadmin/kas/NTMakefile
src/libadmin/pts/NTMakefile
src/libadmin/vos/NTMakefile
src/lwp/lock.c
src/lwp/lock.h
src/opr/opr.h
src/pam/afs_util.c
src/ptserver/utils.c
src/rx/rx.c
src/rx/rx_conncache.c
src/rx/rx_globals.h
src/rx/rx_misc.c
src/rx/rx_multi.c
src/rx/rx_packet.c
src/rx/rx_prototypes.h
src/rx/rx_pthread.h
src/rx/rx_rdwr.c
src/rx/rx_stats.c
src/rx/rx_user.h
src/rxgen/rpc_main.c
src/rxkad/bg-fcrypt.c
src/rxkad/crypt_conn.c
src/rxkad/fcrypt.c
src/rxkad/rxkad_client.c
src/rxkad/rxkad_common.c
src/rxkad/rxkad_server.c
src/rxkad/stats.h
src/ubik/beacon.c
src/ubik/disk.c
src/ubik/lock.c
src/ubik/recovery.c
src/ubik/remote.c
src/ubik/ubik.c
src/ubik/ubikclient.c
src/ubik/vote.c
src/util/serverLog.c
src/util/thread_pool.c
src/util/work_queue.c
src/venus/afsio.c
src/viced/afsfileprocs.c
src/viced/callback.c
src/viced/fsstats.c
src/viced/host.c
src/viced/host.h
src/viced/serialize_state.c
src/viced/viced.c
src/viced/viced.h
src/vol/daemon_com.c
src/vol/fssync-client.c
src/vol/fssync-debug.c
src/vol/fssync-server.c
src/vol/ihandle.c
src/vol/ihandle.h
src/vol/listinodes.c
src/vol/namei_ops.c
src/vol/nuke.c
src/vol/partition.c
src/vol/physio.c
src/vol/salvaged.c
src/vol/salvsync-server.c
src/vol/vg_cache.c
src/vol/vg_scan.c
src/vol/vnode.c
src/vol/vnode_inline.h
src/vol/vol-salvage.c
src/vol/volume.c
src/vol/volume.h
src/vol/volume_inline.h
src/vol/vutil.c
src/volser/dumpstuff.c
src/volser/volmain.c
src/volser/volprocs.c
src/volser/voltrans.c