From ab977738b1542bee2dd780285ec90ebeebdc32c1 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Wed, 7 Sep 2011 14:59:17 +0100 Subject: [PATCH] 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 Reviewed-by: Jeffrey Altman Reviewed-by: Derrick Brashear --- src/WINNT/afsd/NTMakefile | 1 + src/afs/UKERNEL/sysincludes.h | 32 +++--- src/afsd/afsd_kernel.c | 2 +- src/aklog/klog.c | 1 - src/audit/audit.c | 3 +- src/auth/netrestrict.c | 34 +++--- src/bucoord/status.c | 1 + src/budb/db_dump.c | 1 + src/budb/dbs_dump.c | 22 ++-- src/butc/lwps.c | 2 +- src/comerr/error_msg.c | 8 +- src/crypto/hcrypto/kernel/config.h | 6 +- src/dir/buffer.c | 1 + src/libacl/aclprocs.c | 18 +-- src/libadmin/kas/NTMakefile | 1 + src/libadmin/pts/NTMakefile | 1 + src/libadmin/vos/NTMakefile | 1 + src/lwp/lock.c | 2 + src/lwp/lock.h | 1 + src/opr/opr.h | 12 ++ src/pam/afs_util.c | 1 - src/ptserver/utils.c | 13 ++- src/rx/rx.c | 2 + src/rx/rx_conncache.c | 1 + src/rx/rx_globals.h | 2 +- src/rx/rx_misc.c | 2 + src/rx/rx_multi.c | 1 + src/rx/rx_packet.c | 1 + src/rx/rx_prototypes.h | 1 - src/rx/rx_pthread.h | 19 ++-- src/rx/rx_rdwr.c | 1 + src/rx/rx_stats.c | 1 + src/rx/rx_user.h | 2 +- src/rxgen/rpc_main.c | 1 + src/rxkad/bg-fcrypt.c | 2 + src/rxkad/crypt_conn.c | 1 + src/rxkad/fcrypt.c | 1 + src/rxkad/rxkad_client.c | 1 + src/rxkad/rxkad_common.c | 2 +- src/rxkad/rxkad_server.c | 5 +- src/rxkad/stats.h | 14 +-- src/ubik/beacon.c | 2 +- src/ubik/disk.c | 2 +- src/ubik/lock.c | 2 +- src/ubik/recovery.c | 3 +- src/ubik/remote.c | 2 +- src/ubik/ubik.c | 9 +- src/ubik/ubikclient.c | 5 +- src/ubik/vote.c | 2 +- src/util/serverLog.c | 1 + src/util/thread_pool.c | 7 +- src/util/work_queue.c | 10 +- src/venus/afsio.c | 3 +- src/viced/afsfileprocs.c | 89 ++++++++------- src/viced/callback.c | 11 +- src/viced/fsstats.c | 1 + src/viced/host.c | 46 ++++---- src/viced/host.h | 2 +- src/viced/serialize_state.c | 2 +- src/viced/viced.c | 31 ++--- src/viced/viced.h | 8 +- src/vol/daemon_com.c | 2 +- src/vol/fssync-client.c | 2 +- src/vol/fssync-debug.c | 4 +- src/vol/fssync-server.c | 45 ++++---- src/vol/ihandle.c | 74 ++++++------ src/vol/ihandle.h | 6 +- src/vol/listinodes.c | 3 +- src/vol/namei_ops.c | 11 +- src/vol/nuke.c | 2 +- src/vol/partition.c | 34 +++--- src/vol/physio.c | 2 - src/vol/salvaged.c | 35 +++--- src/vol/salvsync-server.c | 22 ++-- src/vol/vg_cache.c | 7 +- src/vol/vg_scan.c | 3 +- src/vol/vnode.c | 34 +++--- src/vol/vnode_inline.h | 18 +-- src/vol/vol-salvage.c | 173 ++++++++++++++-------------- src/vol/volume.c | 227 ++++++++++++++++++++----------------- src/vol/volume.h | 4 +- src/vol/volume_inline.h | 12 +- src/vol/vutil.c | 13 ++- src/volser/dumpstuff.c | 26 ++--- src/volser/volmain.c | 9 +- src/volser/volprocs.c | 8 +- src/volser/voltrans.c | 2 + 87 files changed, 658 insertions(+), 582 deletions(-) diff --git a/src/WINNT/afsd/NTMakefile b/src/WINNT/afsd/NTMakefile index b9e4442..21c5e6e 100644 --- a/src/WINNT/afsd/NTMakefile +++ b/src/WINNT/afsd/NTMakefile @@ -492,6 +492,7 @@ AFSD_EXELIBS =\ $(DESTDIR)\lib\libafsconf.lib \ $(DESTDIR)\lib\afs\afsreg.lib \ $(DESTDIR)\lib\afspthread.lib \ + $(DESTDIR)\lib\opr.lib \ $(DESTDIR)\lib\afsroken.lib \ $(DESTDIR)\lib\afshcrypto.lib \ $(LANAHELPERLIB) diff --git a/src/afs/UKERNEL/sysincludes.h b/src/afs/UKERNEL/sysincludes.h index aa82526..b94eea5 100644 --- a/src/afs/UKERNEL/sysincludes.h +++ b/src/afs/UKERNEL/sysincludes.h @@ -11,6 +11,8 @@ #define __AFS_SYSINCLUDESH__ 1 #include +#include + #if !defined(AFS_USR_DARWIN_ENV) && !defined(AFS_USR_FBSD_ENV) && !defined(AFS_USR_DFBSD_ENV) /* must be included after KERNEL undef'd */ #include #endif @@ -935,29 +937,29 @@ extern pthread_cond_t usr_sleep_cond; #define usr_thread_t pthread_t #define usr_key_t pthread_key_t -#define usr_mutex_init(A) assert(pthread_mutex_init(A,NULL) == 0) -#define usr_mutex_destroy(A) assert(pthread_mutex_destroy(A) == 0) -#define usr_mutex_lock(A) assert(pthread_mutex_lock(A) == 0) +#define usr_mutex_init(A) opr_Verify(pthread_mutex_init(A,NULL) == 0) +#define usr_mutex_destroy(A) opr_Verify(pthread_mutex_destroy(A) == 0) +#define usr_mutex_lock(A) opr_Verify(pthread_mutex_lock(A) == 0) #define usr_mutex_trylock(A) ((pthread_mutex_trylock(A)==0)?1:0) -#define usr_mutex_unlock(A) assert(pthread_mutex_unlock(A) == 0) -#define usr_cond_init(A) assert(pthread_cond_init(A,NULL) == 0) -#define usr_cond_destroy(A) assert(pthread_cond_destroy(A) == 0) -#define usr_cond_signal(A) assert(pthread_cond_signal(A) == 0) -#define usr_cond_broadcast(A) assert(pthread_cond_broadcast(A) == 0) +#define usr_mutex_unlock(A) opr_Verify(pthread_mutex_unlock(A) == 0) +#define usr_cond_init(A) opr_Verify(pthread_cond_init(A,NULL) == 0) +#define usr_cond_destroy(A) opr_Verify(pthread_cond_destroy(A) == 0) +#define usr_cond_signal(A) opr_Verify(pthread_cond_signal(A) == 0) +#define usr_cond_broadcast(A) opr_Verify(pthread_cond_broadcast(A) == 0) #define usr_cond_wait(A,B) pthread_cond_wait(A,B) #define usr_cond_timedwait(A,B,C) pthread_cond_timedwait(A,B,C) #define usr_thread_create(A,B,C) \ do { \ pthread_attr_t attr; \ - assert(pthread_attr_init(&attr) == 0); \ - assert(pthread_attr_setstacksize(&attr, 122880) == 0); \ - assert(pthread_create((A), &attr, (B), (void *)(C)) == 0); \ - assert(pthread_attr_destroy(&attr) == 0); \ + opr_Verify(pthread_attr_init(&attr) == 0); \ + opr_Verify(pthread_attr_setstacksize(&attr, 122880) == 0); \ + opr_Verify(pthread_create((A), &attr, (B), (void *)(C)) == 0); \ + opr_Verify(pthread_attr_destroy(&attr) == 0); \ } while(0) #define usr_thread_join(A,B) pthread_join(A, B) #define usr_thread_detach(A) pthread_detach(A) -#define usr_keycreate(A,B) assert(pthread_key_create(A,B) == 0) +#define usr_keycreate(A,B) opr_Verify(pthread_key_create(A,B) == 0) #define usr_setspecific(A,B) pthread_setspecific(A,B) #define usr_getspecific(A,B) (*(B)=pthread_getspecific(A),0) #define usr_thread_self() pthread_self() @@ -973,9 +975,9 @@ extern pthread_cond_t usr_sleep_cond; _sleep_ts.tv_sec += 1; \ _sleep_ts.tv_nsec -= 1000000000; \ } \ - assert(pthread_mutex_lock(&usr_sleep_mutex) == 0); \ + opr_Verify(pthread_mutex_lock(&usr_sleep_mutex) == 0); \ pthread_cond_timedwait(&usr_sleep_cond, &usr_sleep_mutex, &_sleep_ts); \ - assert(pthread_mutex_unlock(&usr_sleep_mutex) == 0); \ + opr_Verify(pthread_mutex_unlock(&usr_sleep_mutex) == 0); \ } #define uprintf printf diff --git a/src/afsd/afsd_kernel.c b/src/afsd/afsd_kernel.c index 1024f6f..2346ee6 100644 --- a/src/afsd/afsd_kernel.c +++ b/src/afsd/afsd_kernel.c @@ -528,7 +528,7 @@ afsd_fork(int wait, afsd_callback_func cb, void *rock) } else { assert(code > 0); if (wait) { - assert(waitpid(code, NULL, 0) != -1); + opr_Verify(waitpid(code, NULL, 0) != -1); } } return 0; diff --git a/src/aklog/klog.c b/src/aklog/klog.c index 2f7949e..51e5411 100644 --- a/src/aklog/klog.c +++ b/src/aklog/klog.c @@ -33,7 +33,6 @@ #define USING_HEIMDAL 1 #endif -#include "assert.h" #include "skipwrap.h" /* This code borrowed heavily from the previous version of log. Here is the diff --git a/src/audit/audit.c b/src/audit/audit.c index a0a03b4..327b89c 100644 --- a/src/audit/audit.c +++ b/src/audit/audit.c @@ -22,6 +22,7 @@ #define AUDIT_FAIL_PRIV 4 #endif /* AFS_AIX32_ENV */ +#include #include "afs/afsint.h" #include #include @@ -322,7 +323,7 @@ osi_audit_internal(char *audEvent, /* Event name (15 chars or less) */ /* i'm pretty sure all the server apps now call osi_audit_init(), * but to be extra careful we'll leave this assert in here for a * while to make sure */ - osi_Assert(audit_lock_initialized); + opr_Assert(audit_lock_initialized); #endif /* AFS_PTHREAD_ENV */ if ((osi_audit_all < 0) || (osi_echo_trail < 0)) diff --git a/src/auth/netrestrict.c b/src/auth/netrestrict.c index 9c5675e..84b81b8 100644 --- a/src/auth/netrestrict.c +++ b/src/auth/netrestrict.c @@ -18,6 +18,8 @@ #include #include +#include + #include #include @@ -117,12 +119,12 @@ parseNetRestrictFile_int(afs_uint32 outAddrs[], afs_uint32 * mask, afs_uint32 i, neaddrs, nOutaddrs; afs_uint32 addr, eAddrs[MAXIPADDRS], eMask[MAXIPADDRS], eMtu[MAXIPADDRS]; - osi_Assert(outAddrs); - osi_Assert(reason); - osi_Assert(fileName); - osi_Assert(nAddrs); + opr_Assert(outAddrs); + opr_Assert(reason); + opr_Assert(fileName); + opr_Assert(nAddrs); if (mask) - osi_Assert(mtu); + opr_Assert(mtu); /* Initialize */ *nAddrs = 0; @@ -238,11 +240,11 @@ ParseNetInfoFile_int(afs_uint32 * final, afs_uint32 * mask, afs_uint32 * mtu, int lineNo = 0; int l; - osi_Assert(fileName); - osi_Assert(final); - osi_Assert(mask); - osi_Assert(mtu); - osi_Assert(reason); + opr_Assert(fileName); + opr_Assert(final); + opr_Assert(mask); + opr_Assert(mtu); + opr_Assert(reason); /* get all network interfaces from the kernel */ existNu = @@ -368,12 +370,12 @@ filterAddrs(afs_uint32 addr1[], afs_uint32 addr2[], afs_uint32 mask1[], afs_uint32 tmtu[MAXIPADDRS]; int count = 0, i = 0, j = 0, found = 0; - osi_Assert(addr1); - osi_Assert(addr2); - osi_Assert(mask1); - osi_Assert(mask2); - osi_Assert(mtu1); - osi_Assert(mtu2); + opr_Assert(addr1); + opr_Assert(addr2); + opr_Assert(mask1); + opr_Assert(mask2); + opr_Assert(mtu1); + opr_Assert(mtu2); for (i = 0; i < n1; i++) { found = 0; diff --git a/src/bucoord/status.c b/src/bucoord/status.c index a590dc5..60d5a23 100644 --- a/src/bucoord/status.c +++ b/src/bucoord/status.c @@ -13,6 +13,7 @@ #include +#include #include #include diff --git a/src/budb/db_dump.c b/src/budb/db_dump.c index 93e45e6..f44ef1e 100644 --- a/src/budb/db_dump.c +++ b/src/budb/db_dump.c @@ -18,6 +18,7 @@ #include +#include #include #include #include diff --git a/src/budb/dbs_dump.c b/src/budb/dbs_dump.c index d0a7ba8..280735f 100644 --- a/src/budb/dbs_dump.c +++ b/src/budb/dbs_dump.c @@ -13,10 +13,10 @@ #include +#include #include #include #include -#include #include #include #include @@ -154,9 +154,12 @@ DumpDB(struct rx_call *call, /* Initialize the thread attributes and launch the thread */ - osi_Assert(pthread_attr_init(&dumperPid_tattr) == 0); - osi_Assert(pthread_attr_setdetachstate(&dumperPid_tattr, PTHREAD_CREATE_DETACHED) == 0); - osi_Assert(pthread_create(&dumperPid, &dumperPid_tattr, (void *)setupDbDump, NULL) == 0); + opr_Verify(pthread_attr_init(&dumperPid_tattr) == 0); + opr_Verify(pthread_attr_setdetachstate(&dumperPid_tattr, + PTHREAD_CREATE_DETACHED) == 0); + opr_Verify(pthread_create(&dumperPid, + &dumperPid_tattr, + (void *)setupDbDump, NULL) == 0); #else code = @@ -173,9 +176,12 @@ DumpDB(struct rx_call *call, #ifdef AFS_PTHREAD_ENV /* Initialize the thread attributes and launch the thread */ - osi_Assert(pthread_attr_init(&watcherPid_tattr) == 0); - osi_Assert(pthread_attr_setdetachstate(&watcherPid_tattr, PTHREAD_CREATE_DETACHED) == 0); - osi_Assert(pthread_create(&watcherPid, &watcherPid_tattr, (void *)dumpWatcher, NULL) == 0); + opr_Verify(pthread_attr_init(&watcherPid_tattr) == 0); + opr_Verify(pthread_attr_setdetachstate(&watcherPid_tattr, + PTHREAD_CREATE_DETACHED) == 0); + opr_Verify(pthread_create(&watcherPid, + &watcherPid_tattr, + (void *)dumpWatcher, NULL) == 0); #else /* now create the watcher thread */ code = @@ -338,7 +344,7 @@ dumpWatcher(void *unused) close(dumpSyncPtr->pipeFid[0]); close(dumpSyncPtr->pipeFid[1]); #ifdef AFS_PTHREAD_ENV - osi_Assert(pthread_cancel(dumpSyncPtr->dumperPid) == 0); + opr_Verify(pthread_cancel(dumpSyncPtr->dumperPid) == 0); #else code = LWP_DestroyProcess(dumpSyncPtr->dumperPid); if (code) diff --git a/src/butc/lwps.c b/src/butc/lwps.c index 68f03e3..bb5e63e 100644 --- a/src/butc/lwps.c +++ b/src/butc/lwps.c @@ -17,7 +17,7 @@ #include #endif -#include +#include #include #include #include diff --git a/src/comerr/error_msg.c b/src/comerr/error_msg.c index 0714360..413a2e9 100644 --- a/src/comerr/error_msg.c +++ b/src/comerr/error_msg.c @@ -19,6 +19,7 @@ #include #endif +#include #include #include @@ -54,8 +55,7 @@ static pthread_once_t et_list_once = PTHREAD_ONCE_INIT; static void et_mutex_once(void) { - assert(!pthread_mutex_init - (&et_list_mutex, (const pthread_mutexattr_t *)0)); + opr_Verify(!pthread_mutex_init(&et_list_mutex, NULL)); et_list_done = 1; } @@ -63,9 +63,9 @@ et_mutex_once(void) do { \ if (!et_list_done) \ pthread_once(&et_list_once, et_mutex_once); \ - assert(pthread_mutex_lock(&et_list_mutex)==0); \ + opr_Verify(pthread_mutex_lock(&et_list_mutex)==0); \ } while (0) -#define UNLOCK_ET_LIST assert(pthread_mutex_unlock(&et_list_mutex)==0) +#define UNLOCK_ET_LIST opr_Verify(pthread_mutex_unlock(&et_list_mutex)==0) #else #define LOCK_ET_LIST #define UNLOCK_ET_LIST diff --git a/src/crypto/hcrypto/kernel/config.h b/src/crypto/hcrypto/kernel/config.h index 3475c64..7cae6ce 100644 --- a/src/crypto/hcrypto/kernel/config.h +++ b/src/crypto/hcrypto/kernel/config.h @@ -24,19 +24,17 @@ #include #include "afs/param.h" +#include "afs/opr.h" #include "afs/stds.h" #include "afs/sysincludes.h" #include "afs/afsincludes.h" #include "afs/afs_prototypes.h" -/* Asserting is a mess - we need the RX headers in order to get a definition - * for osi_Assert */ #if defined(assert) #undef assert #endif -#define assert osi_Assert -#include +#define assert opr_Assert /* hcrypto uses "static inline", which isn't supported by some of our * compilers */ diff --git a/src/dir/buffer.c b/src/dir/buffer.c index 82387f7..889f07e 100644 --- a/src/dir/buffer.c +++ b/src/dir/buffer.c @@ -11,6 +11,7 @@ #include #include +#include #include diff --git a/src/libacl/aclprocs.c b/src/libacl/aclprocs.c index 70c2573..fd4d877 100644 --- a/src/libacl/aclprocs.c +++ b/src/libacl/aclprocs.c @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -26,7 +27,6 @@ #include "acl.h" #ifdef AFS_PTHREAD_ENV -#include #include pthread_mutex_t acl_list_mutex; #endif /* AFS_PTHREAD_ENV */ @@ -413,7 +413,7 @@ acl_Initialize(char *version) ACL_VERSION, version); } #ifdef AFS_PTHREAD_ENV - assert(pthread_mutex_init(&acl_list_mutex, NULL) == 0); + opr_Verify(pthread_mutex_init(&acl_list_mutex, NULL) == 0); #endif /* AFS_PTHREAD_ENV */ return 0; } @@ -435,12 +435,12 @@ AddToList(struct freeListEntry **pflist, struct freeListEntry *elem) { /* Adds elem to the freelist flist; returns 0 */ #ifdef AFS_PTHREAD_ENV - assert(pthread_mutex_lock(&acl_list_mutex) == 0); + opr_Verify(pthread_mutex_lock(&acl_list_mutex) == 0); #endif /* AFS_PTHREAD_ENV */ elem->next = *pflist; *pflist = elem; #ifdef AFS_PTHREAD_ENV - assert(pthread_mutex_unlock(&acl_list_mutex) == 0); + opr_Verify(pthread_mutex_unlock(&acl_list_mutex) == 0); #endif /* AFS_PTHREAD_ENV */ return 0; } @@ -457,11 +457,11 @@ GetFromList(struct freeListEntry **pflist, struct freeListEntry **elem, struct freeListEntry *y, *z; #ifdef AFS_PTHREAD_ENV - assert(pthread_mutex_lock(&acl_list_mutex) == 0); + opr_Verify(pthread_mutex_lock(&acl_list_mutex) == 0); #endif /* AFS_PTHREAD_ENV */ if (*pflist == NULL) { #ifdef AFS_PTHREAD_ENV - assert(pthread_mutex_unlock(&acl_list_mutex) == 0); + opr_Verify(pthread_mutex_unlock(&acl_list_mutex) == 0); #endif /* AFS_PTHREAD_ENV */ return -1; } @@ -471,19 +471,19 @@ GetFromList(struct freeListEntry **pflist, struct freeListEntry **elem, if (z == NULL) { /* pulling off the head */ *pflist = y->next; #ifdef AFS_PTHREAD_ENV - assert(pthread_mutex_unlock(&acl_list_mutex) == 0); + opr_Verify(pthread_mutex_unlock(&acl_list_mutex) == 0); #endif /* AFS_PTHREAD_ENV */ return 0; } z->next = y->next; #ifdef AFS_PTHREAD_ENV - assert(pthread_mutex_unlock(&acl_list_mutex) == 0); + opr_Verify(pthread_mutex_unlock(&acl_list_mutex) == 0); #endif /* AFS_PTHREAD_ENV */ return 0; } } #ifdef AFS_PTHREAD_ENV - assert(pthread_mutex_unlock(&acl_list_mutex) == 0); + opr_Verify(pthread_mutex_unlock(&acl_list_mutex) == 0); #endif /* AFS_PTHREAD_ENV */ return -1; } diff --git a/src/libadmin/kas/NTMakefile b/src/libadmin/kas/NTMakefile index 2c3eed9..85d340b 100644 --- a/src/libadmin/kas/NTMakefile +++ b/src/libadmin/kas/NTMakefile @@ -37,6 +37,7 @@ DLLLIBS =\ $(DESTDIR)\lib\afsrpc.lib \ $(DESTDIR)\lib\afspthread.lib \ $(DESTDIR)\lib\afs\afsutil.lib \ + $(DESTDIR)\lib\opr.lib \ $(DESTDIR)\lib\afsroken.lib $(DLLFILE): $(DLLOBJS) $(DLLLIBS) diff --git a/src/libadmin/pts/NTMakefile b/src/libadmin/pts/NTMakefile index 0a75936..662b8b2 100644 --- a/src/libadmin/pts/NTMakefile +++ b/src/libadmin/pts/NTMakefile @@ -40,6 +40,7 @@ DLLLIBS =\ $(DESTDIR)\lib\afsrpc.lib \ $(DESTDIR)\lib\afspthread.lib \ $(DESTDIR)\lib\afs\afsutil.lib \ + $(DESTDIR)\lib\opr.lib \ $(DESTDIR)\lib\afsroken.lib $(DLLFILE): $(DLLOBJS) $(DLLLIBS) diff --git a/src/libadmin/vos/NTMakefile b/src/libadmin/vos/NTMakefile index 611f72c..2c6fb3f 100644 --- a/src/libadmin/vos/NTMakefile +++ b/src/libadmin/vos/NTMakefile @@ -61,6 +61,7 @@ DLLLIBS =\ $(DESTDIR)\lib\afsauthent.lib \ $(DESTDIR)\lib\afsrpc.lib \ $(DESTDIR)\lib\afs\afsutil.lib \ + $(DESTDIR)\lib\opr.lib \ $(DESTDIR)\lib\afsroken.lib $(DLLFILE): $(DLLOBJS) $(DLLLIBS) diff --git a/src/lwp/lock.c b/src/lwp/lock.c index 5f31d33..d24a83b 100644 --- a/src/lwp/lock.c +++ b/src/lwp/lock.c @@ -27,6 +27,8 @@ #include +#include + #ifdef AFS_PTHREAD_ENV #include #endif diff --git a/src/lwp/lock.h b/src/lwp/lock.h index aa10448..2f6805c 100644 --- a/src/lwp/lock.h +++ b/src/lwp/lock.h @@ -45,6 +45,7 @@ #ifdef AFS_PTHREAD_ENV #include /* can't include in non-lwp case; rx builds later */ +#include #include #define LOCK_LOCK(A) MUTEX_ENTER(&(A)->mutex); #define LOCK_UNLOCK(A) MUTEX_EXIT(&(A)->mutex); diff --git a/src/opr/opr.h b/src/opr/opr.h index 0d060da..45e037d 100644 --- a/src/opr/opr.h +++ b/src/opr/opr.h @@ -19,9 +19,21 @@ extern void opr_NTAbort(void); extern void opr_AssertionFailed(char *, int) AFS_NORETURN; extern void opr_AssertFailU(const char *, const char *, int) AFS_NORETURN; +/* opr_Assert is designed to work in a similar way to the operating + * system's assert function. This means that in future, it may compile + * to a no-op if NDEBUG is defined + */ + #define opr_Assert(ex) \ do {if (!(ex)) opr_AssertionFailed(__FILE__, __LINE__);} while(0) +/* opr_Verify is an assertion function which is guaranteed to always + * invoke its expression, regardless of the debugging level selected + * at compile time */ + +#define opr_Verify(ex) \ + do {if (!(ex)) opr_AssertionFailed(__FILE__, __LINE__);} while(0) + /* casestrcpy.c */ #define lcstring opr_lcstring #define ucstring opr_ucstring diff --git a/src/pam/afs_util.c b/src/pam/afs_util.c index df9a6f8..08cc0fd 100644 --- a/src/pam/afs_util.c +++ b/src/pam/afs_util.c @@ -16,7 +16,6 @@ #include #endif -#include #include #ifdef AFS_AIX51_ENV diff --git a/src/ptserver/utils.c b/src/ptserver/utils.c index 34dde85..732f585 100644 --- a/src/ptserver/utils.c +++ b/src/ptserver/utils.c @@ -12,6 +12,7 @@ #include +#include #include #include @@ -281,7 +282,7 @@ FindByID(struct ubik_trans *at, afs_int32 aid) return 0; if (aid == tentry.id) return entry; - osi_Assert(entry != tentry.nextID); + opr_Assert(entry != tentry.nextID); entry = tentry.nextID; while (entry != 0) { memset(&tentry, 0, sizeof(tentry)); @@ -290,7 +291,7 @@ FindByID(struct ubik_trans *at, afs_int32 aid) return 0; if (aid == tentry.id) return entry; - osi_Assert(entry != tentry.nextID); + opr_Assert(entry != tentry.nextID); entry = tentry.nextID; } return 0; @@ -314,7 +315,7 @@ FindByName(struct ubik_trans *at, char aname[PR_MAXNAMELEN], struct prentry *ten return 0; if ((strncmp(aname, tentryp->name, PR_MAXNAMELEN)) == 0) return entry; - osi_Assert(entry != tentryp->nextName); + opr_Assert(entry != tentryp->nextName); entry = tentryp->nextName; while (entry != 0) { memset(tentryp, 0, sizeof(struct prentry)); @@ -323,7 +324,7 @@ FindByName(struct ubik_trans *at, char aname[PR_MAXNAMELEN], struct prentry *ten return 0; if ((strncmp(aname, tentryp->name, PR_MAXNAMELEN)) == 0) return entry; - osi_Assert(entry != tentryp->nextName); + opr_Assert(entry != tentryp->nextName); entry = tentryp->nextName; } return 0; @@ -453,7 +454,7 @@ RemoveFromIDHash(struct ubik_trans *tt, afs_int32 aid, afs_int32 *loc) /* ??? i if (code) return PRDBFAIL; while (aid != tentry.id) { - osi_Assert(trail != current); + opr_Assert(trail != current); trail = current; current = tentry.nextID; if (current == 0) @@ -531,7 +532,7 @@ RemoveFromNameHash(struct ubik_trans *tt, char *aname, afs_int32 *loc) if (code) return PRDBFAIL; while (strcmp(aname, tentry.name)) { - osi_Assert(trail != current); + opr_Assert(trail != current); trail = current; current = tentry.nextName; if (current == 0) diff --git a/src/rx/rx.c b/src/rx/rx.c index b2226a3..0d6fd8f 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -67,6 +67,8 @@ extern afs_int32 afs_termState; # include # endif +# include + # include "rx_user.h" #endif /* KERNEL */ diff --git a/src/rx/rx_conncache.c b/src/rx/rx_conncache.c index 0fe1505..dc2c826 100644 --- a/src/rx/rx_conncache.c +++ b/src/rx/rx_conncache.c @@ -15,6 +15,7 @@ #include #include +#include #include "rx.h" diff --git a/src/rx/rx_globals.h b/src/rx/rx_globals.h index 2051a26..025e676 100644 --- a/src/rx/rx_globals.h +++ b/src/rx/rx_globals.h @@ -179,7 +179,7 @@ EXT struct rx_ts_info_t * rx_ts_info_init(void); /* init function for thread-s do { \ ts_info_p = (struct rx_ts_info_t*)pthread_getspecific(rx_ts_info_key); \ if (ts_info_p == NULL) { \ - osi_Assert((ts_info_p = rx_ts_info_init()) != NULL); \ + opr_Verify((ts_info_p = rx_ts_info_init()) != NULL); \ } \ } while(0) #endif /* AFS_PTHREAD_ENV */ diff --git a/src/rx/rx_misc.c b/src/rx/rx_misc.c index 9ad279b..ff132d9 100644 --- a/src/rx/rx_misc.c +++ b/src/rx/rx_misc.c @@ -15,6 +15,8 @@ # include #else # include +# include + # include # include "xdr.h" # ifdef AFS_PTHREAD_ENV diff --git a/src/rx/rx_multi.c b/src/rx/rx_multi.c index 20cd2a3..ee858d5 100644 --- a/src/rx/rx_multi.c +++ b/src/rx/rx_multi.c @@ -14,6 +14,7 @@ # include "afs/sysincludes.h" #else /* KERNEL */ # include +# include #endif /* KERNEL */ #include "rx.h" diff --git a/src/rx/rx_packet.c b/src/rx/rx_packet.c index 15af43d..d0cb5d3 100644 --- a/src/rx/rx_packet.c +++ b/src/rx/rx_packet.c @@ -43,6 +43,7 @@ #else /* KERNEL */ # include # include +# include # if defined(AFS_NT40_ENV) # ifndef EWOULDBLOCK # define EWOULDBLOCK WSAEWOULDBLOCK diff --git a/src/rx/rx_prototypes.h b/src/rx/rx_prototypes.h index e533cd1..223280e 100644 --- a/src/rx/rx_prototypes.h +++ b/src/rx/rx_prototypes.h @@ -519,7 +519,6 @@ extern afs_kmutex_t rx_if_init_mutex; extern afs_kmutex_t rx_if_mutex; #endif extern osi_socket rxi_GetUDPSocket(u_short port); -extern void osi_AssertFailU(const char *expr, const char *file, int line) AFS_NORETURN; extern void rxi_InitPeerParams(struct rx_peer *pp); extern int rxi_HandleSocketError(int socket); diff --git a/src/rx/rx_pthread.h b/src/rx/rx_pthread.h index 7192848..3bab408 100644 --- a/src/rx/rx_pthread.h +++ b/src/rx/rx_pthread.h @@ -25,6 +25,7 @@ /* Block signals to child threads. */ #include +#include #ifdef AFS_NT40_ENV #include @@ -77,17 +78,17 @@ extern void osirx_AssertMine(afs_kmutex_t * lockaddr, char *msg); #ifdef MUTEX_INIT #undef MUTEX_INIT #endif -#define MUTEX_INIT(a, b, c, d) osi_Assert(pthread_mutex_init(a, NULL) == 0) +#define MUTEX_INIT(a, b, c, d) opr_Verify(pthread_mutex_init(a, NULL) == 0) #ifdef MUTEX_DESTROY #undef MUTEX_DESTROY #endif -#define MUTEX_DESTROY(l) osi_Assert(pthread_mutex_destroy(l) == 0) +#define MUTEX_DESTROY(l) opr_Verify(pthread_mutex_destroy(l) == 0) #ifdef MUTEX_ENTER #undef MUTEX_ENTER #endif -#define MUTEX_ENTER(l) osi_Assert(pthread_mutex_lock(l) == 0) +#define MUTEX_ENTER(l) opr_Verify(pthread_mutex_lock(l) == 0) #ifdef MUTEX_TRYENTER #undef MUTEX_TRYENTER @@ -97,22 +98,22 @@ extern void osirx_AssertMine(afs_kmutex_t * lockaddr, char *msg); #ifdef MUTEX_EXIT #undef MUTEX_EXIT #endif -#define MUTEX_EXIT(l) osi_Assert(pthread_mutex_unlock(l) == 0) +#define MUTEX_EXIT(l) opr_Verify(pthread_mutex_unlock(l) == 0) #ifdef CV_INIT #undef CV_INIT #endif -#define CV_INIT(cv, a, b, c) osi_Assert(pthread_cond_init(cv, NULL) == 0) +#define CV_INIT(cv, a, b, c) opr_Verify(pthread_cond_init(cv, NULL) == 0) #ifdef CV_DESTROY #undef CV_DESTROY #endif -#define CV_DESTROY(cv) osi_Assert(pthread_cond_destroy(cv) == 0) +#define CV_DESTROY(cv) opr_Verify(pthread_cond_destroy(cv) == 0) #ifdef CV_WAIT #undef CV_WAIT #endif -#define CV_WAIT(cv, l) osi_Assert(pthread_cond_wait(cv, l) == 0) +#define CV_WAIT(cv, l) opr_Verify(pthread_cond_wait(cv, l) == 0) #ifdef CV_TIMEDWAIT #undef CV_TIMEDWAIT @@ -122,12 +123,12 @@ extern void osirx_AssertMine(afs_kmutex_t * lockaddr, char *msg); #ifdef CV_SIGNAL #undef CV_SIGNAL #endif -#define CV_SIGNAL(cv) osi_Assert(pthread_cond_signal(cv) == 0) +#define CV_SIGNAL(cv) opr_Verify(pthread_cond_signal(cv) == 0) #ifdef CV_BROADCAST #undef CV_BROADCAST #endif -#define CV_BROADCAST(cv) osi_Assert(pthread_cond_broadcast(cv) == 0) +#define CV_BROADCAST(cv) opr_Verify(pthread_cond_broadcast(cv) == 0) #endif /* AFS_PTHREAD_ENV */ diff --git a/src/rx/rx_rdwr.c b/src/rx/rx_rdwr.c index 344cbcc..b63b42f 100644 --- a/src/rx/rx_rdwr.c +++ b/src/rx/rx_rdwr.c @@ -53,6 +53,7 @@ # include "afs/lock.h" #else /* KERNEL */ # include +# include #endif /* KERNEL */ #include "rx.h" diff --git a/src/rx/rx_stats.c b/src/rx/rx_stats.c index d6325e1..2693137 100644 --- a/src/rx/rx_stats.c +++ b/src/rx/rx_stats.c @@ -33,6 +33,7 @@ #if !defined(KERNEL) #include +#include #endif #ifdef KERNEL diff --git a/src/rx/rx_user.h b/src/rx/rx_user.h index 8b2b986..ecc036f 100644 --- a/src/rx/rx_user.h +++ b/src/rx/rx_user.h @@ -63,7 +63,7 @@ typedef afs_int32 osi_socket; #define osi_QuickFree(ptr, size) osi_Free(ptr, size) #define osi_QuickAlloc(size) osi_Alloc(size) -#define osi_Assert(e) (void)((e) || (osi_AssertFailU(#e, __FILE__, __LINE__), 0)) +#define osi_Assert(e) opr_Assert(e) #define osi_Msg fprintf)(stderr, #define osi_VMsg vfprintf)(stderr, diff --git a/src/rxgen/rpc_main.c b/src/rxgen/rpc_main.c index 30e5d39..790d0e2 100644 --- a/src/rxgen/rpc_main.c +++ b/src/rxgen/rpc_main.c @@ -663,6 +663,7 @@ C_output(char *infile, char *define, int extend, char *outfile, int append) f_print(fout, "#include \n"); f_print(fout, "#include \n"); f_print(fout, "#include \n"); + f_print(fout, "#include \n"); f_print(fout, "#include \"%s\"\n\n", include); } free(include); diff --git a/src/rxkad/bg-fcrypt.c b/src/rxkad/bg-fcrypt.c index 936e352..9b69e58 100644 --- a/src/rxkad/bg-fcrypt.c +++ b/src/rxkad/bg-fcrypt.c @@ -50,6 +50,8 @@ #else /* KERNEL */ #include +#include + #include #include #endif /* KERNEL */ diff --git a/src/rxkad/crypt_conn.c b/src/rxkad/crypt_conn.c index 99f29bf..da708bc 100644 --- a/src/rxkad/crypt_conn.c +++ b/src/rxkad/crypt_conn.c @@ -27,6 +27,7 @@ #endif /* !UKERNEL */ #else /* !KERNEL */ #include +#include #endif /* KERNEL */ #include diff --git a/src/rxkad/fcrypt.c b/src/rxkad/fcrypt.c index 723f781..b1592ea 100644 --- a/src/rxkad/fcrypt.c +++ b/src/rxkad/fcrypt.c @@ -35,6 +35,7 @@ #else /* KERNEL */ # include +# include # include #endif /* KERNEL */ diff --git a/src/rxkad/rxkad_client.c b/src/rxkad/rxkad_client.c index a871349..71866b7 100644 --- a/src/rxkad/rxkad_client.c +++ b/src/rxkad/rxkad_client.c @@ -33,6 +33,7 @@ #endif /* !UKERNEL */ #else /* ! KERNEL */ #include +#include #endif /* KERNEL */ diff --git a/src/rxkad/rxkad_common.c b/src/rxkad/rxkad_common.c index 75a8b26..484909d 100644 --- a/src/rxkad/rxkad_common.c +++ b/src/rxkad/rxkad_common.c @@ -36,10 +36,10 @@ #endif /* !UKERNEL */ #else /* KERNEL */ #include +#include #if defined(AFS_NT40_ENV) && defined(AFS_PTHREAD_ENV) #define RXKAD_STATS_DECLSPEC __declspec(dllexport) #endif -#include #endif /* KERNEL */ #include diff --git a/src/rxkad/rxkad_server.c b/src/rxkad/rxkad_server.c index 3ee20ff..048458c 100644 --- a/src/rxkad/rxkad_server.c +++ b/src/rxkad/rxkad_server.c @@ -21,6 +21,7 @@ #include #endif +#include #include #include #include @@ -77,8 +78,8 @@ pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER #endif ; -#define LOCK_RM osi_Assert(pthread_mutex_lock(&rxkad_random_mutex)==0) -#define UNLOCK_RM osi_Assert(pthread_mutex_unlock(&rxkad_random_mutex)==0) +#define LOCK_RM opr_Verify(pthread_mutex_lock(&rxkad_random_mutex)==0) +#define UNLOCK_RM opr_Verify(pthread_mutex_unlock(&rxkad_random_mutex)==0) #else #define LOCK_RM #define UNLOCK_RM diff --git a/src/rxkad/stats.h b/src/rxkad/stats.h index 34ff09f..dd65f75 100644 --- a/src/rxkad/stats.h +++ b/src/rxkad/stats.h @@ -76,14 +76,14 @@ extern int rxkad_stats_agg(rxkad_stats_t *); #define BEGIN do { #define END } while(0) #endif -#define RXKAD_GLOBAL_STATS_LOCK osi_Assert(pthread_mutex_lock(&rxkad_global_stats_lock)==0) -#define RXKAD_GLOBAL_STATS_UNLOCK osi_Assert(pthread_mutex_unlock(&rxkad_global_stats_lock)==0) +#define RXKAD_GLOBAL_STATS_LOCK opr_Verify(pthread_mutex_lock(&rxkad_global_stats_lock)==0) +#define RXKAD_GLOBAL_STATS_UNLOCK opr_Verify(pthread_mutex_unlock(&rxkad_global_stats_lock)==0) #define GET_RXKAD_STATS(stats) rxkad_stats_agg(stats) #define GET_RXKAD_THR_STATS(rxkad_stats) \ BEGIN \ (rxkad_stats) = ((rxkad_stats_t*)pthread_getspecific(rxkad_stats_key)); \ if ((rxkad_stats) == NULL) { \ - osi_Assert(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \ + opr_Verify(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \ } \ END #define INC_RXKAD_STATS(stats_elem) \ @@ -91,7 +91,7 @@ extern int rxkad_stats_agg(rxkad_stats_t *); rxkad_stats_t * rxkad_stats; \ rxkad_stats = ((rxkad_stats_t*)pthread_getspecific(rxkad_stats_key)); \ if (rxkad_stats == NULL) { \ - osi_Assert(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \ + opr_Verify(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \ } \ rxkad_stats->stats_elem++; \ END @@ -100,7 +100,7 @@ extern int rxkad_stats_agg(rxkad_stats_t *); rxkad_stats_t * rxkad_stats; \ rxkad_stats = ((rxkad_stats_t*)pthread_getspecific(rxkad_stats_key)); \ if (rxkad_stats == NULL) { \ - osi_Assert(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \ + opr_Verify(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \ } \ rxkad_stats->stats_elem--; \ END @@ -110,7 +110,7 @@ extern int rxkad_stats_agg(rxkad_stats_t *); rxkad_stats_t * rxkad_stats; \ rxkad_stats = ((rxkad_stats_t*)pthread_getspecific(rxkad_stats_key)); \ if (rxkad_stats == NULL) { \ - osi_Assert(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \ + opr_Verify(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \ } \ rxkad_stats->stats_elem += inc_value; \ END @@ -119,7 +119,7 @@ extern int rxkad_stats_agg(rxkad_stats_t *); rxkad_stats_t * rxkad_stats; \ rxkad_stats = ((rxkad_stats_t*)pthread_getspecific(rxkad_stats_key)); \ if (rxkad_stats == NULL) { \ - osi_Assert(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \ + opr_Verify(((rxkad_stats) = rxkad_thr_stats_init()) != NULL); \ } \ rxkad_stats->stats_elem -= dec_value; \ END diff --git a/src/ubik/beacon.c b/src/ubik/beacon.c index 2c1db5e..186c307 100644 --- a/src/ubik/beacon.c +++ b/src/ubik/beacon.c @@ -12,8 +12,8 @@ #include +#include #include -#include #include #include #include diff --git a/src/ubik/disk.c b/src/ubik/disk.c index 86d43dd..e9c81e6 100644 --- a/src/ubik/disk.c +++ b/src/ubik/disk.c @@ -11,9 +11,9 @@ #include #include +#include #include -#include #define UBIK_INTERNALS #include "ubik.h" diff --git a/src/ubik/lock.c b/src/ubik/lock.c index dd808d3..91dbd27 100644 --- a/src/ubik/lock.c +++ b/src/ubik/lock.c @@ -12,8 +12,8 @@ #include +#include #include -#include #define UBIK_INTERNALS 1 #include "ubik.h" diff --git a/src/ubik/recovery.c b/src/ubik/recovery.c index c858728..41012fb 100644 --- a/src/ubik/recovery.c +++ b/src/ubik/recovery.c @@ -12,6 +12,7 @@ #include +#include #include #include #include @@ -888,7 +889,7 @@ DoProbe(struct ubik_server *server) } } UBIK_ADDR_UNLOCK; - osi_Assert(i); /* at least one interface address for this server */ + opr_Assert(i); /* at least one interface address for this server */ multi_Rx(conns, i) { multi_DISK_Probe(); diff --git a/src/ubik/remote.c b/src/ubik/remote.c index 339bf04..05611e9 100644 --- a/src/ubik/remote.c +++ b/src/ubik/remote.c @@ -560,7 +560,7 @@ SDISK_SendFile(struct rx_call *rxcall, afs_int32 file, memcpy(&ubik_dbase->version, avers, sizeof(struct ubik_version)); udisk_Invalidate(dbase, file); /* new dbase, flush disk buffers */ #ifdef AFS_PTHREAD_ENV - assert(pthread_cond_broadcast(&dbase->version_cond) == 0); + opr_Assert(pthread_cond_broadcast(&dbase->version_cond) == 0); #else LWP_NoYieldSignal(&dbase->version); #endif diff --git a/src/ubik/ubik.c b/src/ubik/ubik.c index 3199174..0c3cc2d 100644 --- a/src/ubik/ubik.c +++ b/src/ubik/ubik.c @@ -12,8 +12,8 @@ #include +#include #include -#include #include #include @@ -355,9 +355,10 @@ ContactQuorum_DISK_SetVersion(struct ubik_trans *atrans, int aflags, #if defined(AFS_PTHREAD_ENV) static int ubik_thread_create(pthread_attr_t *tattr, pthread_t *thread, void *proc) { - osi_Assert(pthread_attr_init(tattr) == 0); - osi_Assert(pthread_attr_setdetachstate(tattr, PTHREAD_CREATE_DETACHED) == 0); - osi_Assert(pthread_create(thread, tattr, proc, NULL) == 0); + opr_Verify(pthread_attr_init(tattr) == 0); + opr_Verify(pthread_attr_setdetachstate(tattr, + PTHREAD_CREATE_DETACHED) == 0); + opr_Verify(pthread_create(thread, tattr, proc, NULL) == 0); return 0; } #endif diff --git a/src/ubik/ubikclient.c b/src/ubik/ubikclient.c index dc1067f..7a607b4 100644 --- a/src/ubik/ubikclient.c +++ b/src/ubik/ubikclient.c @@ -12,6 +12,7 @@ #include #include +#include #ifdef IGNORE_SOME_GCC_WARNINGS # pragma GCC diagnostic warning "-Wstrict-prototypes" @@ -93,7 +94,7 @@ static pthread_key_t random_number_key; static void afs_random_once(void) { - osi_Assert(pthread_key_create(&random_number_key, NULL) == 0); + opr_Verify(pthread_key_create(&random_number_key, NULL) == 0); called_afs_random_once = 1; } @@ -322,7 +323,7 @@ ubik_RefreshConn(struct rx_connection *tc) pthread_once_t ubik_client_once = PTHREAD_ONCE_INIT; pthread_mutex_t ubik_client_mutex; #define LOCK_UCLNT_CACHE do { \ - osi_Assert(pthread_once(&ubik_client_once, ubik_client_init_mutex) == 0); \ + opr_Verify(pthread_once(&ubik_client_once, ubik_client_init_mutex) == 0); \ MUTEX_ENTER(&ubik_client_mutex); \ } while (0) #define UNLOCK_UCLNT_CACHE MUTEX_EXIT(&ubik_client_mutex) diff --git a/src/ubik/vote.c b/src/ubik/vote.c index dc313dd..b0a55bd 100644 --- a/src/ubik/vote.c +++ b/src/ubik/vote.c @@ -12,8 +12,8 @@ #include +#include #include -#include #include #include diff --git a/src/util/serverLog.c b/src/util/serverLog.c index 29df7d4..f7bbb5c 100644 --- a/src/util/serverLog.c +++ b/src/util/serverLog.c @@ -25,6 +25,7 @@ #include /* Must come after procmgmt.h */ #include +#include #include "afsutil.h" #include "fileutil.h" #include diff --git a/src/util/thread_pool.c b/src/util/thread_pool.c index deb430b..7138bcb 100644 --- a/src/util/thread_pool.c +++ b/src/util/thread_pool.c @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -148,7 +149,7 @@ _afs_tp_worker_run(void * rock) /* adjust pool live thread count */ MUTEX_ENTER(&pool->lock); - osi_Assert(pool->nthreads); + opr_Assert(pool->nthreads); queue_Remove(worker); pool->nthreads--; if (!pool->nthreads) { @@ -208,8 +209,8 @@ _afs_tp_worker_start(struct afs_thread_pool * pool, worker->pool = pool; worker->req_shutdown = 0; - osi_Assert(pthread_attr_init(&attrs) == 0); - osi_Assert(pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED) == 0); + opr_Verify(pthread_attr_init(&attrs) == 0); + opr_Verify(pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED) == 0); ret = pthread_create(&worker->tid, &attrs, &_afs_tp_worker_run, worker); diff --git a/src/util/work_queue.c b/src/util/work_queue.c index d1ffa6f..41343b1 100644 --- a/src/util/work_queue.c +++ b/src/util/work_queue.c @@ -11,6 +11,8 @@ #include #include +#include + #include #include @@ -392,7 +394,7 @@ _afs_wq_node_list_enqueue(struct afs_work_queue_node_list * list, MUTEX_ENTER(&node->lock); /* assert state of the world (we set busy, so this should never happen) */ - osi_Assert(queue_IsNotOnQueue(node)); + opr_Assert(queue_IsNotOnQueue(node)); } if (list->shutdown) { @@ -400,7 +402,7 @@ _afs_wq_node_list_enqueue(struct afs_work_queue_node_list * list, goto error_unlock; } - osi_Assert(node->qidx == AFS_WQ_NODE_LIST_NONE); + opr_Assert(node->qidx == AFS_WQ_NODE_LIST_NONE); if (queue_IsEmpty(&list->list)) { /* wakeup a dequeue thread */ CV_SIGNAL(&list->cv); @@ -1282,13 +1284,13 @@ _afs_wq_node_put_r(struct afs_work_queue_node * node, { afs_uint32 refc; - osi_Assert(node->refcount > 0); + opr_Assert(node->refcount > 0); refc = --node->refcount; if (drop) { MUTEX_EXIT(&node->lock); } if (!refc) { - osi_Assert(node->qidx == AFS_WQ_NODE_LIST_NONE); + opr_Assert(node->qidx == AFS_WQ_NODE_LIST_NONE); _afs_wq_node_free(node); } diff --git a/src/venus/afsio.c b/src/venus/afsio.c index 421f355..719aed7 100644 --- a/src/venus/afsio.c +++ b/src/venus/afsio.c @@ -62,7 +62,6 @@ #endif #include #ifdef AFS_PTHREAD_ENV -#include pthread_key_t uclient_key; #endif @@ -259,7 +258,7 @@ main(int argc, char **argv) strlcpy(pnp, argv[0], AFSPATHMAX); #ifdef AFS_PTHREAD_ENV - assert(pthread_key_create(&uclient_key, NULL) == 0); + opr_Verify(pthread_key_create(&uclient_key, NULL) == 0); #endif ts = cmd_CreateSyntax("lock", lockFile, (void *)LockWrite, diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 8cb791c..2cfb7c0 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -73,7 +73,7 @@ #endif #endif /* AFS_HPUX_ENV */ -#include +#include #include #include #include @@ -372,7 +372,8 @@ CallPreamble(struct rx_call *acall, int activecall, code = hpr_Initialize(&uclient); if (!code) - osi_Assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0); + opr_Verify(pthread_setspecific(viced_uclient_key, + (void *)uclient) == 0); H_LOCK; if (code) { @@ -521,7 +522,7 @@ CheckVnodeWithCall(AFSFid * fid, Volume ** volptr, struct VCallByVol *cbv, *volptr = VGetVolumeWithCall(&local_errorCode, &errorCode, fid->Volume, ts, cbv); if (!errorCode) { - osi_Assert(*volptr); + opr_Assert(*volptr); break; } if ((errorCode == VOFFLINE) && (VInit < 2)) { @@ -614,7 +615,7 @@ CheckVnodeWithCall(AFSFid * fid, Volume ** volptr, struct VCallByVol *cbv, return (errorCode); } } - osi_Assert(*volptr); + opr_Assert(*volptr); /* get the vnode */ *vptr = VGetVnode(&errorCode, *volptr, fid->Vnode, lock); @@ -622,7 +623,7 @@ CheckVnodeWithCall(AFSFid * fid, Volume ** volptr, struct VCallByVol *cbv, return (errorCode); if ((*vptr)->disk.uniquifier != fid->Unique) { VPutVnode(&fileCode, *vptr); - osi_Assert(fileCode == 0); + opr_Assert(fileCode == 0); *vptr = 0; return (VNOVNODE); /* return the right error code, at least */ } @@ -652,7 +653,7 @@ SetAccessList(Vnode ** targetptr, Volume ** volume, *ACLSize = VAclSize(*targetptr); return (0); } else { - osi_Assert(Fid != 0); + opr_Assert(Fid != 0); while (1) { VnodeId parentvnode; Error errorCode = 0; @@ -843,7 +844,7 @@ GetVolumePackageWithCall(struct rx_call *acall, struct VCallByVol *cbv, (chkforDir == MustBeDIR ? 0 : locktype))) != 0) goto gvpdone; if (chkforDir == MustBeDIR) - osi_Assert((*parent) == 0); + opr_Assert((*parent) == 0); if (!(*client)) { if ((errorCode = GetClient(tcon, client)) != 0) goto gvpdone; @@ -924,15 +925,15 @@ PutVolumePackageWithCall(struct rx_call *acall, Vnode * rx_KeepAliveOff(acall); if (parentwhentargetnotdir) { VPutVnode(&fileCode, parentwhentargetnotdir); - osi_Assert(!fileCode || (fileCode == VSALVAGE)); + opr_Assert(!fileCode || (fileCode == VSALVAGE)); } if (targetptr) { VPutVnode(&fileCode, targetptr); - osi_Assert(!fileCode || (fileCode == VSALVAGE)); + opr_Assert(!fileCode || (fileCode == VSALVAGE)); } if (parentptr) { VPutVnode(&fileCode, parentptr); - osi_Assert(!fileCode || (fileCode == VSALVAGE)); + opr_Assert(!fileCode || (fileCode == VSALVAGE)); } if (volptr) { VPutVolumeWithCall(volptr, cbv); @@ -1297,7 +1298,7 @@ CopyOnWrite(Vnode * targetptr, Volume * volptr, afs_foff_t off, afs_fsize_t len) } IH_INIT(newH, V_device(volptr), V_id(volptr), ino); newFdP = IH_OPEN(newH); - osi_Assert(newFdP != NULL); + opr_Assert(newFdP != NULL); done = off; while (size > 0) { @@ -1369,11 +1370,11 @@ CopyOnWrite(Vnode * targetptr, Volume * volptr, afs_foff_t off, afs_fsize_t len) FDH_REALLYCLOSE(targFdP); rc = IH_DEC(V_linkHandle(volptr), VN_GET_INO(targetptr), V_parentId(volptr)); - osi_Assert(!rc); + opr_Assert(!rc); IH_RELEASE(targetptr->handle); rc = FDH_SYNC(newFdP); - osi_Assert(rc == 0); + opr_Assert(rc == 0); FDH_CLOSE(newFdP); targetptr->handle = newH; VN_SET_INO(targetptr, ino); @@ -2264,7 +2265,7 @@ common_FetchData64(struct rx_call *acall, struct AFSFid *Fid, if (parentwhentargetnotdir != NULL) { tparentwhentargetnotdir = *parentwhentargetnotdir; VPutVnode(&fileCode, parentwhentargetnotdir); - osi_Assert(!fileCode || (fileCode == VSALVAGE)); + opr_Assert(!fileCode || (fileCode == VSALVAGE)); parentwhentargetnotdir = NULL; } @@ -2897,7 +2898,7 @@ common_StoreData64(struct rx_call *acall, struct AFSFid *Fid, rx_KeepAliveOff(acall); VPutVnode(&fileCode, parentwhentargetnotdir); rx_KeepAliveOn(acall); - osi_Assert(!fileCode || (fileCode == VSALVAGE)); + opr_Assert(!fileCode || (fileCode == VSALVAGE)); parentwhentargetnotdir = NULL; } @@ -3041,7 +3042,7 @@ SRXAFS_StoreACL(struct rx_call * acall, struct AFSFid * Fid, /* convert the write lock to a read lock before breaking callbacks */ VVnodeWriteToRead(&errorCode, targetptr); - osi_Assert(!errorCode || errorCode == VSALVAGE); + opr_Assert(!errorCode || errorCode == VSALVAGE); rx_KeepAliveOn(acall); @@ -3135,7 +3136,7 @@ SAFSS_StoreStatus(struct rx_call *acall, struct AFSFid *Fid, /* convert the write lock to a read lock before breaking callbacks */ VVnodeWriteToRead(&errorCode, targetptr); - osi_Assert(!errorCode || errorCode == VSALVAGE); + opr_Assert(!errorCode || errorCode == VSALVAGE); /* Break call backs on Fid */ BreakCallBack(client->host, Fid, 0); @@ -3261,14 +3262,14 @@ SAFSS_RemoveFile(struct rx_call *acall, struct AFSFid *DirFid, char *Name, DeleteFileCallBacks(&fileFid); /* convert the parent lock to a read lock before breaking callbacks */ VVnodeWriteToRead(&errorCode, parentptr); - osi_Assert(!errorCode || errorCode == VSALVAGE); + opr_Assert(!errorCode || errorCode == VSALVAGE); } else { /* convert the parent lock to a read lock before breaking callbacks */ VVnodeWriteToRead(&errorCode, parentptr); - osi_Assert(!errorCode || errorCode == VSALVAGE); + opr_Assert(!errorCode || errorCode == VSALVAGE); /* convert the target lock to a read lock before breaking callbacks */ VVnodeWriteToRead(&errorCode, targetptr); - osi_Assert(!errorCode || errorCode == VSALVAGE); + opr_Assert(!errorCode || errorCode == VSALVAGE); /* tell all the file has changed */ BreakCallBack(client->host, &fileFid, 1); } @@ -3402,7 +3403,7 @@ SAFSS_CreateFile(struct rx_call *acall, struct AFSFid *DirFid, char *Name, /* convert the write lock to a read lock before breaking callbacks */ VVnodeWriteToRead(&errorCode, parentptr); - osi_Assert(!errorCode || errorCode == VSALVAGE); + opr_Assert(!errorCode || errorCode == VSALVAGE); /* break call back on parent dir */ BreakCallBack(client->host, DirFid, 0); @@ -3729,7 +3730,7 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName, } if (testnode == 1) top = 1; testvptr = VGetVnode(&errorCode, volptr, testnode, READ_LOCK); - osi_Assert(errorCode == 0); + opr_Assert(errorCode == 0); testnode = testvptr->disk.parent; VPutVnode(&errorCode, testvptr); if ((top == 1) && (testnode != 0)) { @@ -3740,7 +3741,7 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName, errorCode = EIO; goto Bad_Rename; } - osi_Assert(errorCode == 0); + opr_Assert(errorCode == 0); } } @@ -3778,7 +3779,7 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName, if (newfileptr) { /* Delete NewName from its directory */ code = afs_dir_Delete(&newdir, NewName); - osi_Assert(code == 0); + opr_Assert(code == 0); /* Drop the link count */ newfileptr->disk.linkCount--; @@ -3825,7 +3826,7 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName, goto Bad_Rename; /* Delete the old name */ - osi_Assert(afs_dir_Delete(&olddir, OldName) == 0); + opr_Assert(afs_dir_Delete(&olddir, OldName) == 0); /* if the directory length changes, reflect it in the statistics */ Update_ParentVnodeStatus(oldvptr, volptr, &olddir, client->ViceId, @@ -3844,13 +3845,13 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName, /* if we are dealing with a rename of a directory, and we need to * update the .. entry of that directory */ if (updatefile) { - osi_Assert(!fileptr->disk.cloned); + opr_Assert(!fileptr->disk.cloned); fileptr->changed_newTime = 1; /* status change of moved file */ /* fix .. to point to the correct place */ afs_dir_Delete(&filedir, ".."); /* No assert--some directories may be bad */ - osi_Assert(afs_dir_Create(&filedir, "..", NewDirFid) == 0); + opr_Assert(afs_dir_Create(&filedir, "..", NewDirFid) == 0); fileptr->disk.dataVersion++; /* if the parent directories are different the link counts have to be */ @@ -3872,15 +3873,15 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName, /* convert the write locks to a read locks before breaking callbacks */ VVnodeWriteToRead(&errorCode, newvptr); - osi_Assert(!errorCode || errorCode == VSALVAGE); + opr_Assert(!errorCode || errorCode == VSALVAGE); if (oldvptr != newvptr) { VVnodeWriteToRead(&errorCode, oldvptr); - osi_Assert(!errorCode || errorCode == VSALVAGE); + opr_Assert(!errorCode || errorCode == VSALVAGE); } if (newfileptr && !doDelete) { /* convert the write lock to a read lock before breaking callbacks */ VVnodeWriteToRead(&errorCode, newfileptr); - osi_Assert(!errorCode || errorCode == VSALVAGE); + opr_Assert(!errorCode || errorCode == VSALVAGE); } rx_KeepAliveOn(acall); @@ -3913,7 +3914,7 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName, if (newfileptr) { rx_KeepAliveOff(acall); VPutVnode(&fileCode, newfileptr); - osi_Assert(fileCode == 0); + opr_Assert(fileCode == 0); } (void)PutVolumePackage(acall, fileptr, (newvptr && newvptr != oldvptr ? newvptr : 0), oldvptr, volptr, &client); @@ -4085,7 +4086,7 @@ SAFSS_Symlink(struct rx_call *acall, struct AFSFid *DirFid, char *Name, /* convert the write lock to a read lock before breaking callbacks */ VVnodeWriteToRead(&errorCode, parentptr); - osi_Assert(!errorCode || errorCode == VSALVAGE); + opr_Assert(!errorCode || errorCode == VSALVAGE); rx_KeepAliveOn(acall); @@ -4261,9 +4262,9 @@ SAFSS_Link(struct rx_call *acall, struct AFSFid *DirFid, char *Name, /* convert the write locks to read locks before breaking callbacks */ VVnodeWriteToRead(&errorCode, targetptr); - osi_Assert(!errorCode || errorCode == VSALVAGE); + opr_Assert(!errorCode || errorCode == VSALVAGE); VVnodeWriteToRead(&errorCode, parentptr); - osi_Assert(!errorCode || errorCode == VSALVAGE); + opr_Assert(!errorCode || errorCode == VSALVAGE); rx_KeepAliveOn(acall); @@ -4410,10 +4411,9 @@ SAFSS_MakeDir(struct rx_call *acall, struct AFSFid *DirFid, char *Name, client->InSameNetwork); /* Point to target's ACL buffer and copy the parent's ACL contents to it */ - osi_Assert((SetAccessList - (&targetptr, &volptr, &newACL, &newACLSize, - &parentwhentargetnotdir, (AFSFid *) 0, 0)) == 0); - osi_Assert(parentwhentargetnotdir == 0); + opr_Verify((SetAccessList(&targetptr, &volptr, &newACL, &newACLSize, + &parentwhentargetnotdir, NULL, 0)) == 0); + opr_Assert(parentwhentargetnotdir == 0); memcpy((char *)newACL, (char *)VVnodeACL(parentptr), VAclSize(parentptr)); /* update the status for the target vnode */ @@ -4422,7 +4422,8 @@ SAFSS_MakeDir(struct rx_call *acall, struct AFSFid *DirFid, char *Name, /* Actually create the New directory in the directory package */ SetDirHandle(&dir, targetptr); - osi_Assert(!(afs_dir_MakeDir(&dir, (afs_int32 *)OutFid, (afs_int32 *)DirFid))); + opr_Verify(!(afs_dir_MakeDir(&dir, (afs_int32 *)OutFid, + (afs_int32 *)DirFid))); DFlush(); VN_SET_LEN(targetptr, (afs_fsize_t) afs_dir_Length(&dir)); @@ -4432,7 +4433,7 @@ SAFSS_MakeDir(struct rx_call *acall, struct AFSFid *DirFid, char *Name, /* convert the write lock to a read lock before breaking callbacks */ VVnodeWriteToRead(&errorCode, parentptr); - osi_Assert(!errorCode || errorCode == VSALVAGE); + opr_Assert(!errorCode || errorCode == VSALVAGE); rx_KeepAliveOn(acall); @@ -4568,7 +4569,7 @@ SAFSS_RemoveDir(struct rx_call *acall, struct AFSFid *DirFid, char *Name, /* convert the write lock to a read lock before breaking callbacks */ VVnodeWriteToRead(&errorCode, parentptr); - osi_Assert(!errorCode || errorCode == VSALVAGE); + opr_Assert(!errorCode || errorCode == VSALVAGE); rx_KeepAliveOn(acall); @@ -4872,7 +4873,7 @@ SAFSS_ReleaseLock(struct rx_call *acall, struct AFSFid *Fid, rx_KeepAliveOn(acall); /* convert the write lock to a read lock before breaking callbacks */ VVnodeWriteToRead(&errorCode, targetptr); - osi_Assert(!errorCode || errorCode == VSALVAGE); + opr_Assert(!errorCode || errorCode == VSALVAGE); BreakCallBack(client->host, Fid, 0); } @@ -6182,7 +6183,7 @@ FetchData_RXStyle(Volume * volptr, Vnode * targetptr, { afs_int32 high, low; SplitOffsetOrSize(Len, high, low); - osi_Assert(Int64Mode || (Len >= 0 && high == 0) || Len < 0); + opr_Assert(Int64Mode || (Len >= 0 && high == 0) || Len < 0); if (Int64Mode) { high = htonl(high); rx_Write(Call, (char *)&high, sizeof(afs_int32)); /* High order bits */ @@ -6556,7 +6557,7 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid, if (errorCode) { Error tmp_errorCode = 0; afs_sfsize_t nfSize = FDH_SIZE(fdP); - osi_Assert(nfSize >= 0); + opr_Assert(nfSize >= 0); /* something went wrong: adjust size and return */ VN_SET_LEN(targetptr, nfSize); /* set new file size. */ /* changed_newTime is tested in StoreData to detemine if we diff --git a/src/viced/callback.c b/src/viced/callback.c index 99fdead..f58ce5f 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -91,6 +91,7 @@ #include #endif +#include #include /* yuck. This is an abomination. */ #include #include @@ -410,7 +411,7 @@ FDel(struct FileEntry *fe) while (*p && *p != fei) p = &itofe(*p)->fnext; - osi_Assert(*p); + opr_Assert(*p); *p = fe->fnext; FreeFE(fe); return 0; @@ -677,7 +678,7 @@ MultiBreakCallBack_r(struct cbstruct cba[], int ncbas, static struct AFSCBs tc = { 0, 0 }; int multi_to_cba_map[MAX_CB_HOSTS]; - osi_Assert(ncbas <= MAX_CB_HOSTS); + opr_Assert(ncbas <= MAX_CB_HOSTS); /* sort cba list to avoid makecall issues */ qsort(cba, ncbas, sizeof(struct cbstruct), CompareCBA); @@ -1139,7 +1140,7 @@ MultiBreakVolumeCallBack_r(struct host *host, h_Unlock_r(host); return 0; } - osi_Assert(parms->ncbas <= MAX_CB_HOSTS); + opr_Assert(parms->ncbas <= MAX_CB_HOSTS); /* Do not call MultiBreakCallBack on the current host structure ** because it would prematurely release the hold on the host @@ -2987,7 +2988,7 @@ MultiBreakCallBackAlternateAddress_r(struct host *host, j++; } - osi_Assert(j); /* at least one alternate address */ + opr_Assert(j); /* at least one alternate address */ ViceLog(125, ("Starting multibreakcall back on all addr for host %p (%s:%d)\n", host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port))); @@ -3084,7 +3085,7 @@ MultiProbeAlternateAddress_r(struct host *host) j++; } - osi_Assert(j); /* at least one alternate address */ + opr_Assert(j); /* at least one alternate address */ ViceLog(125, ("Starting multiprobe on all addr for host %p (%s:%d)\n", host, afs_inet_ntoa_r(host->host, hoststr), diff --git a/src/viced/fsstats.c b/src/viced/fsstats.c index 3c2c552..97532fa 100644 --- a/src/viced/fsstats.c +++ b/src/viced/fsstats.c @@ -15,6 +15,7 @@ #include #include +#include #include #include #include diff --git a/src/viced/host.c b/src/viced/host.c index 7b4d772..68d8901 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -354,7 +354,7 @@ getThreadClient(struct ubik_client **client) if (code) return code; - osi_Assert(pthread_setspecific(viced_uclient_key, *client) == 0); + opr_Verify(pthread_setspecific(viced_uclient_key, *client) == 0); return 0; } @@ -743,7 +743,7 @@ h_Lookup_r(afs_uint32 haddr, afs_uint16 hport, struct host **hostp) restart: for (chain = hostAddrHashTable[index]; chain; chain = chain->next) { host = chain->hostPtr; - osi_Assert(host); + opr_Assert(host); if (!(host->hostFlags & HOSTDELETED) && chain->addr == haddr && chain->port == hport) { if ((host->hostFlags & HWHO_INPROGRESS) && @@ -790,7 +790,7 @@ h_LookupUuid_r(afsUUID * uuidp) for (chain = hostUuidHashTable[index]; chain; chain = chain->next) { host = chain->hostPtr; - osi_Assert(host); + opr_Assert(host); if (!(host->hostFlags & HOSTDELETED) && host->interface && afs_uuid_equal(&host->interface->uuid, uuidp)) { return host; @@ -1173,7 +1173,7 @@ h_DeleteHostFromUuidHashTable_r(struct host *host) if (LogLevel >= 125) afsUUID_to_string(&host->interface->uuid, uuid1, 127); for (uhp = &hostUuidHashTable[index]; (uth = *uhp); uhp = &uth->next) { - osi_Assert(uth->hostPtr); + opr_Assert(uth->hostPtr); if (uth->hostPtr == host) { ViceLog(125, ("h_DeleteHostFromUuidHashTable_r: host %" AFS_PTR_FMT " (uuid %s %s:%d)\n", @@ -1204,8 +1204,8 @@ invalidateInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port) struct Interface *interface; char hoststr[16], hoststr2[16]; - osi_Assert(host); - osi_Assert(host->interface); + opr_Assert(host); + opr_Assert(host->interface); ViceLog(125, ("invalidateInterfaceAddr : host %" AFS_PTR_FMT " (%s:%d) addr %s:%d\n", host, afs_inet_ntoa_r(host->host, hoststr), @@ -1358,7 +1358,7 @@ reconcileHosts_r(afs_uint32 addr, afs_uint16 port, struct host *newHost, AFS_PTR_FMT, afs_inet_ntoa_r(addr, hoststr), ntohs(port), newHost, oldHost)); - osi_Assert(oldHost != newHost); + opr_Assert(oldHost != newHost); caps.Capabilities_val = NULL; if (!sc) { @@ -1508,8 +1508,8 @@ addInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port) struct Interface *interface; char hoststr[16], hoststr2[16]; - osi_Assert(host); - osi_Assert(host->interface); + opr_Assert(host); + opr_Assert(host->interface); /* * Make sure this address is on the list of known addresses @@ -1574,8 +1574,8 @@ removeInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port) struct Interface *interface; char hoststr[16], hoststr2[16]; - osi_Assert(host); - osi_Assert(host->interface); + opr_Assert(host); + opr_Assert(host->interface); ViceLog(125, ("removeInterfaceAddr : host %" AFS_PTR_FMT " (%s:%d) addr %s:%d\n", host, afs_inet_ntoa_r(host->host, hoststr), @@ -2146,7 +2146,7 @@ h_GetHost_r(struct rx_connection *tcon) ("InitCallBackState3 success on host %" AFS_PTR_FMT " (%s:%d)\n", host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port))); - osi_Assert(interfValid == 1); + opr_Assert(interfValid == 1); initInterfaceAddr_r(host, &interf); } } @@ -2618,7 +2618,7 @@ h_FindClient_r(struct rx_connection *tcon) int h_ReleaseClient_r(struct client *client) { - osi_Assert(client->refCount > 0); + opr_Assert(client->refCount > 0); client->refCount--; return 0; } @@ -3287,7 +3287,7 @@ h_stateSaveHost(struct host * host, void* rock) if_len = sizeof(struct Interface) + ((host->interface->numberOfInterfaces-1) * sizeof(struct AddrPort)); ifp = malloc(if_len); - osi_Assert(ifp != NULL); + opr_Assert(ifp != NULL); memcpy(ifp, host->interface, if_len); hdr.interfaces = host->interface->numberOfInterfaces; iov[iovcnt].iov_base = (char *) ifp; @@ -3298,7 +3298,7 @@ h_stateSaveHost(struct host * host, void* rock) hdr.hcps = host->hcps.prlist_len; hcps_len = hdr.hcps * sizeof(afs_int32); hcps = malloc(hcps_len); - osi_Assert(hcps != NULL); + opr_Assert(hcps != NULL); memcpy(hcps, host->hcps.prlist_val, hcps_len); iov[iovcnt].iov_base = (char *) hcps; iov[iovcnt].iov_len = hcps_len; @@ -3370,7 +3370,7 @@ h_stateRestoreHost(struct fs_dump_state * state) ifp_len = sizeof(struct Interface) + ((hdr.interfaces-1) * sizeof(struct AddrPort)); ifp = malloc(ifp_len); - osi_Assert(ifp != NULL); + opr_Assert(ifp != NULL); iov[iovcnt].iov_base = (char *) ifp; iov[iovcnt].iov_len = ifp_len; iovcnt++; @@ -3378,7 +3378,7 @@ h_stateRestoreHost(struct fs_dump_state * state) if (hdr.hcps) { hcps_len = hdr.hcps * sizeof(afs_int32); hcps = malloc(hcps_len); - osi_Assert(hcps != NULL); + opr_Assert(hcps != NULL); iov[iovcnt].iov_base = (char *) hcps; iov[iovcnt].iov_len = hcps_len; iovcnt++; @@ -3399,7 +3399,7 @@ h_stateRestoreHost(struct fs_dump_state * state) if (!hdr.hcps && hdsk.hcps_valid) { /* valid, zero-length host cps ; does this ever happen? */ hcps = malloc(sizeof(afs_int32)); - osi_Assert(hcps != NULL); + opr_Assert(hcps != NULL); } if ((hdsk.hostFlags & HWHO_INPROGRESS) || !(hdsk.hostFlags & ALTADDR)) { @@ -3414,7 +3414,7 @@ h_stateRestoreHost(struct fs_dump_state * state) /* for restoring state, we better be able to get a host! */ host = GetHT(); - osi_Assert(host != NULL); + opr_Assert(host != NULL); if (ifp) { host->interface = ifp; @@ -4017,8 +4017,8 @@ initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf) char uuidstr[128]; afs_uint16 port7001 = htons(7001); - osi_Assert(host); - osi_Assert(interf); + opr_Assert(host); + opr_Assert(interf); number = interf->numberOfInterfaces; myAddr = host->host; /* current interface address */ @@ -4124,7 +4124,7 @@ initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf) interface->uuid = interf->uuid; - osi_Assert(!host->interface); + opr_Assert(!host->interface); host->interface = interface; if (LogLevel >= 125) { @@ -4155,7 +4155,7 @@ h_DeleteHostFromAddrHashTable_r(afs_uint32 addr, afs_uint16 port, for (hp = &hostAddrHashTable[h_HashIndex(addr)]; (th = *hp); hp = &th->next) { - osi_Assert(th->hostPtr); + opr_Assert(th->hostPtr); if (th->hostPtr == host && th->addr == addr && th->port == port) { ViceLog(125, ("h_DeleteHostFromAddrHashTable_r: host %" AFS_PTR_FMT " (%s:%d)\n", host, afs_inet_ntoa_r(host->host, hoststr), diff --git a/src/viced/host.h b/src/viced/host.h index e59c672..5b81078 100644 --- a/src/viced/host.h +++ b/src/viced/host.h @@ -177,7 +177,7 @@ do { \ hostList ? (hostList->prev = (h)):0; \ hostList = (h); \ hostCount++; -#define h_DeleteList_r(h) osi_Assert(hostCount>0); \ +#define h_DeleteList_r(h) opr_Assert(hostCount>0); \ hostCount--; \ (h)->next ? ((h)->next->prev = (h)->prev):0;\ (h)->prev ? ((h)->prev->next = (h)->next):0;\ diff --git a/src/viced/serialize_state.c b/src/viced/serialize_state.c index efbb394..460ebf5 100644 --- a/src/viced/serialize_state.c +++ b/src/viced/serialize_state.c @@ -19,7 +19,7 @@ #include -#include +#include #include #include #include diff --git a/src/viced/viced.c b/src/viced/viced.c index fd4b3ef..1d4f0e6 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -40,7 +40,7 @@ #undef SHARED -#include +#include #include #include #include @@ -228,7 +228,7 @@ static int fs_stateInit(void) fs_state.options.fs_state_verify_after_restore = 1; CV_INIT(&fs_state.worker_done_cv, "worker done", CV_DEFAULT, 0); - osi_Assert(pthread_rwlock_init(&fs_state.state_lock, NULL) == 0); + opr_Verify(pthread_rwlock_init(&fs_state.state_lock, NULL) == 0); } # endif /* AFS_NT40_ENV */ #endif /* AFS_DEMAND_ATTACH_FS */ @@ -728,8 +728,9 @@ ShutDownAndCore(int dopanic) if (dopanic) { pthread_t watchdogPid; pthread_attr_t tattr; - osi_Assert(pthread_attr_init(&tattr) == 0); - osi_Assert(pthread_create(&watchdogPid, &tattr, ShutdownWatchdogLWP, NULL) == 0); + opr_Verify(pthread_attr_init(&tattr) == 0); + opr_Verify(pthread_create(&watchdogPid, &tattr, + ShutdownWatchdogLWP, NULL) == 0); } /* do not allows new reqests to be served from now on, all new requests @@ -1456,7 +1457,7 @@ InitPR(void) return code; } - osi_Assert(pthread_key_create(&viced_uclient_key, NULL) == 0); + opr_Verify(pthread_key_create(&viced_uclient_key, NULL) == 0); SystemId = SYSADMINID; SystemAnyUser = ANYUSERID; @@ -2150,16 +2151,16 @@ main(int argc, char *argv[]) ih_UseLargeCache(); ViceLog(5, ("Starting pthreads\n")); - osi_Assert(pthread_attr_init(&tattr) == 0); - osi_Assert(pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) == 0); - - osi_Assert(pthread_create - (&serverPid, &tattr, FiveMinuteCheckLWP, - &fiveminutes) == 0); - osi_Assert(pthread_create - (&serverPid, &tattr, HostCheckLWP, &fiveminutes) == 0); - osi_Assert(pthread_create - (&serverPid, &tattr, FsyncCheckLWP, &fiveminutes) == 0); + opr_Verify(pthread_attr_init(&tattr) == 0); + opr_Verify(pthread_attr_setdetachstate(&tattr, + PTHREAD_CREATE_DETACHED) == 0); + + opr_Verify(pthread_create(&serverPid, &tattr, FiveMinuteCheckLWP, + &fiveminutes) == 0); + opr_Verify(pthread_create(&serverPid, &tattr, HostCheckLWP, + &fiveminutes) == 0); + opr_Verify(pthread_create(&serverPid, &tattr, FsyncCheckLWP, + &fiveminutes) == 0); gettimeofday(&tp, 0); diff --git a/src/viced/viced.h b/src/viced/viced.h index d65575f..29e8bda 100644 --- a/src/viced/viced.h +++ b/src/viced/viced.h @@ -236,11 +236,11 @@ extern struct fs_state fs_state; #ifdef AFS_NT40_ENV #define FS_STATE_INIT fs_stateInit() #else -#define FS_STATE_INIT osi_Assert(pthread_rwlock_init(&fs_state.state_lock, NULL) == 0) +#define FS_STATE_INIT opr_Verify(pthread_rwlock_init(&fs_state.state_lock, NULL) == 0) #endif -#define FS_STATE_RDLOCK osi_Assert(pthread_rwlock_rdlock(&fs_state.state_lock) == 0) -#define FS_STATE_WRLOCK osi_Assert(pthread_rwlock_wrlock(&fs_state.state_lock) == 0) -#define FS_STATE_UNLOCK osi_Assert(pthread_rwlock_unlock(&fs_state.state_lock) == 0) +#define FS_STATE_RDLOCK opr_Verify(pthread_rwlock_rdlock(&fs_state.state_lock) == 0) +#define FS_STATE_WRLOCK opr_Verify(pthread_rwlock_wrlock(&fs_state.state_lock) == 0) +#define FS_STATE_UNLOCK opr_Verify(pthread_rwlock_unlock(&fs_state.state_lock) == 0) #define FS_MODE_NORMAL 0 #define FS_MODE_SHUTDOWN 1 diff --git a/src/vol/daemon_com.c b/src/vol/daemon_com.c index 60fc7d9..d2e1207 100644 --- a/src/vol/daemon_com.c +++ b/src/vol/daemon_com.c @@ -115,7 +115,7 @@ osi_socket SYNC_getSock(SYNC_endpoint_t * endpoint) { osi_socket sd; - osi_Assert((sd = socket(endpoint->domain, SOCK_STREAM, 0)) >= 0); + opr_Verify((sd = socket(endpoint->domain, SOCK_STREAM, 0)) >= 0); return sd; } diff --git a/src/vol/fssync-client.c b/src/vol/fssync-client.c index d605797..666162d 100644 --- a/src/vol/fssync-client.c +++ b/src/vol/fssync-client.c @@ -37,7 +37,7 @@ #include -#include +#include #include #include #include diff --git a/src/vol/fssync-debug.c b/src/vol/fssync-debug.c index beddeb6..ce63df9 100644 --- a/src/vol/fssync-debug.c +++ b/src/vol/fssync-debug.c @@ -24,7 +24,7 @@ #include #endif -#include +#include #include #ifndef AFS_NT40_ENV @@ -351,7 +351,7 @@ common_volop_prolog(struct cmd_syndesc * as, struct fssync_state * state) struct cmd_item *ti; state->vop = (struct volop_state *) calloc(1, sizeof(struct volop_state)); - osi_Assert(state->vop != NULL); + opr_Assert(state->vop != NULL); if ((ti = as->parms[COMMON_VOLOP_PARMS_OFFSET].items)) { /* -volumeid */ state->vop->volume = atoi(ti->data); diff --git a/src/vol/fssync-server.c b/src/vol/fssync-server.c index c90d86e..5d20c77 100644 --- a/src/vol/fssync-server.c +++ b/src/vol/fssync-server.c @@ -45,7 +45,7 @@ #include -#include +#include #include #include "nfs.h" #include @@ -198,19 +198,20 @@ FSYNC_fsInit(void) Lock_Init(&FSYNC_handler_lock); #ifdef AFS_PTHREAD_ENV - osi_Assert(pthread_attr_init(&tattr) == 0); - osi_Assert(pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) == 0); - osi_Assert(pthread_create(&tid, &tattr, FSYNC_sync, NULL) == 0); + opr_Verify(pthread_attr_init(&tattr) == 0); + opr_Verify(pthread_attr_setdetachstate(&tattr, + PTHREAD_CREATE_DETACHED) == 0); + opr_Verify(pthread_create(&tid, &tattr, FSYNC_sync, NULL) == 0); #else /* AFS_PTHREAD_ENV */ - osi_Assert(LWP_CreateProcess - (FSYNC_sync, USUAL_STACK_SIZE, USUAL_PRIORITY, (void *)0, - "FSYNC_sync", &pid) == LWP_SUCCESS); + opr_Verify(LWP_CreateProcess(FSYNC_sync, USUAL_STACK_SIZE, + USUAL_PRIORITY, NULL, + "FSYNC_sync", &pid) == LWP_SUCCESS); #endif /* AFS_PTHREAD_ENV */ #ifdef AFS_DEMAND_ATTACH_FS queue_Init(&fsync_salv.head); CV_INIT(&fsync_salv.cv, "fsync salv", CV_DEFAULT, 0); - osi_Assert(pthread_create(&tid, &tattr, FSYNC_salvageThread, NULL) == 0); + opr_Verify(pthread_create(&tid, &tattr, FSYNC_salvageThread, NULL) == 0); #endif /* AFS_DEMAND_ATTACH_FS */ } @@ -244,7 +245,7 @@ FSYNC_sync(void * args) /* we must not be called before vol package initialization, since we use * vol package mutexes and conds etc */ - osi_Assert(VInit); + opr_Assert(VInit); SYNC_getAddr(&state->endpoint, &state->addr); SYNC_cleanupSock(state); @@ -278,7 +279,7 @@ FSYNC_sync(void * args) state->fd = SYNC_getSock(&state->endpoint); code = SYNC_bindSock(state); - osi_Assert(!code); + opr_Assert(!code); #ifdef AFS_DEMAND_ATTACH_FS /* @@ -293,10 +294,10 @@ FSYNC_sync(void * args) } memcpy(thread_opts, &VThread_defaults, sizeof(VThread_defaults)); thread_opts->disallow_salvsync = 1; - osi_Assert(pthread_setspecific(VThread_key, thread_opts) == 0); + opr_Verify(pthread_setspecific(VThread_key, thread_opts) == 0); code = VVGCache_PkgInit(); - osi_Assert(code == 0); + opr_Assert(code == 0); #endif InitHandler(); @@ -429,10 +430,10 @@ FSYNC_newconnection(osi_socket afd) fd = accept(afd, (struct sockaddr *)&other, &junk); if (fd == OSI_NULLSOCKET) { Log("FSYNC_newconnection: accept failed, errno==%d\n", errno); - osi_Assert(1 == 2); + opr_abort(); } else if (!AddHandler(fd, FSYNC_com)) { AcceptOff(); - osi_Assert(AddHandler(fd, FSYNC_com)); + opr_Verify(AddHandler(fd, FSYNC_com)); } } @@ -1087,7 +1088,7 @@ FSYNC_com_VolOff(FSSYNC_VolOp_command * vcom, SYNC_response * res) VCreateReservation_r(vp); VOfflineForVolOp_r(&error, vp, "A volume utility is running."); if (error==0) { - osi_Assert(vp->nUsers==0); + opr_Assert(vp->nUsers==0); vp->pending_vol_op->vol_op_state = FSSYNC_VolOpRunningOffline; } else { @@ -1569,7 +1570,7 @@ FSYNC_com_VolOpQuery(FSSYNC_VolOp_command * vcom, SYNC_response * res) res->hdr.reason = FSYNC_WRONG_PART; code = SYNC_FAILED; } else { - osi_Assert(sizeof(FSSYNC_VolOp_info) <= res->payload.len); + opr_Assert(sizeof(FSSYNC_VolOp_info) <= res->payload.len); memcpy(res->payload.buf, vp->pending_vol_op, sizeof(FSSYNC_VolOp_info)); res->hdr.response_len += sizeof(FSSYNC_VolOp_info); } @@ -1608,7 +1609,7 @@ FSYNC_com_VGQuery(FSSYNC_VolOp_command * vcom, SYNC_response * res) goto done; } - osi_Assert(sizeof(FSSYNC_VGQry_response_t) <= res->payload.len); + opr_Assert(sizeof(FSSYNC_VGQry_response_t) <= res->payload.len); rc = VVGCache_query_r(dp, vcom->vop->volume, res->payload.buf); switch (rc) { @@ -2027,7 +2028,7 @@ static void AcceptOn(void) { if (AcceptHandler == -1) { - osi_Assert(AddHandler(fssync_server_state.fd, FSYNC_newconnection)); + opr_Verify(AddHandler(fssync_server_state.fd, FSYNC_newconnection)); AcceptHandler = FindHandler(fssync_server_state.fd); } } @@ -2036,7 +2037,7 @@ static void AcceptOff(void) { if (AcceptHandler != -1) { - osi_Assert(RemoveHandler(fssync_server_state.fd)); + opr_Verify(RemoveHandler(fssync_server_state.fd)); AcceptHandler = -1; } } @@ -2121,7 +2122,7 @@ FindHandler(osi_socket afd) return i; } ReleaseReadLock(&FSYNC_handler_lock); /* just in case */ - osi_Assert(1 == 2); + opr_abort(); return -1; /* satisfy compiler */ } @@ -2133,7 +2134,7 @@ FindHandler_r(osi_socket afd) if (HandlerFD[i] == afd) { return i; } - osi_Assert(1 == 2); + opr_abort(); return -1; /* satisfy compiler */ } @@ -2155,7 +2156,7 @@ GetHandler(struct pollfd *fds, int maxfds, int events, int *nfds) ObtainReadLock(&FSYNC_handler_lock); for (i = 0; i < MAXHANDLERS; i++) if (HandlerFD[i] != OSI_NULLSOCKET) { - osi_Assert(fdi #endif -#include +#include #include #include #include @@ -111,7 +111,7 @@ void ih_Initialize(void) { int i; - osi_Assert(!ih_Inited); + opr_Assert(!ih_Inited); ih_Inited = 1; DLL_INIT_LIST(ihAvailHead, ihAvailTail); DLL_INIT_LIST(fdAvailHead, fdAvailTail); @@ -124,9 +124,9 @@ ih_Initialize(void) #elif defined(AFS_SUN5_ENV) || defined(AFS_NBSD_ENV) { struct rlimit rlim; - osi_Assert(getrlimit(RLIMIT_NOFILE, &rlim) == 0); + opr_Verify(getrlimit(RLIMIT_NOFILE, &rlim) == 0); rlim.rlim_cur = rlim.rlim_max; - osi_Assert(setrlimit(RLIMIT_NOFILE, &rlim) == 0); + opr_Verify(setrlimit(RLIMIT_NOFILE, &rlim) == 0); fdMaxCacheSize = rlim.rlim_cur - vol_io_params.fd_handle_setaside; #ifdef AFS_NBSD_ENV /* XXX this is to avoid using up all system fd netbsd is @@ -140,7 +140,7 @@ ih_Initialize(void) fdMaxCacheSize /= 4; #endif fdMaxCacheSize = min(fdMaxCacheSize, vol_io_params.fd_max_cachesize); - osi_Assert(fdMaxCacheSize > 0); + opr_Assert(fdMaxCacheSize > 0); } #elif defined(AFS_HPUX_ENV) /* Avoid problems with "UFSOpen: igetinode failed" panics on HPUX 11.0 */ @@ -202,9 +202,9 @@ iHandleAllocateChunk(void) int i; IHandle_t *ihP; - osi_Assert(ihAvailHead == NULL); + opr_Assert(ihAvailHead == NULL); ihP = malloc(I_HANDLE_MALLOCSIZE * sizeof(IHandle_t)); - osi_Assert(ihP != NULL); + opr_Assert(ihP != NULL); for (i = 0; i < I_HANDLE_MALLOCSIZE; i++) { ihP[i].ih_refcnt = 0; DLL_INSERT_TAIL(&ihP[i], ihAvailHead, ihAvailTail, ih_next, ih_prev); @@ -241,7 +241,7 @@ ih_init(int dev, int vid, Inode ino) iHandleAllocateChunk(); } ihP = ihAvailHead; - osi_Assert(ihP->ih_refcnt == 0); + opr_Assert(ihP->ih_refcnt == 0); DLL_DELETE(ihP, ihAvailHead, ihAvailTail, ih_next, ih_prev); ihP->ih_dev = dev; ihP->ih_vid = vid; @@ -261,8 +261,8 @@ IHandle_t * ih_copy(IHandle_t * ihP) { IH_LOCK; - osi_Assert(ih_Inited); - osi_Assert(ihP->ih_refcnt > 0); + opr_Assert(ih_Inited); + opr_Assert(ihP->ih_refcnt > 0); ihP->ih_refcnt++; IH_UNLOCK; return ihP; @@ -275,9 +275,9 @@ fdHandleAllocateChunk(void) int i; FdHandle_t *fdP; - osi_Assert(fdAvailHead == NULL); + opr_Assert(fdAvailHead == NULL); fdP = malloc(FD_HANDLE_MALLOCSIZE * sizeof(FdHandle_t)); - osi_Assert(fdP != NULL); + opr_Assert(fdP != NULL); for (i = 0; i < FD_HANDLE_MALLOCSIZE; i++) { fdP[i].fd_status = FD_HANDLE_AVAIL; fdP[i].fd_refcnt = 0; @@ -296,10 +296,10 @@ streamHandleAllocateChunk(void) int i; StreamHandle_t *streamP; - osi_Assert(streamAvailHead == NULL); + opr_Assert(streamAvailHead == NULL); streamP = (StreamHandle_t *) malloc(STREAM_HANDLE_MALLOCSIZE * sizeof(StreamHandle_t)); - osi_Assert(streamP != NULL); + opr_Assert(streamP != NULL); for (i = 0; i < STREAM_HANDLE_MALLOCSIZE; i++) { streamP[i].str_fd = INVALID_FD; DLL_INSERT_TAIL(&streamP[i], streamAvailHead, streamAvailTail, @@ -337,9 +337,9 @@ ih_open(IHandle_t * ihP) if (fdP->fd_status == FD_HANDLE_INUSE) { continue; } - osi_Assert(fdP->fd_status == FD_HANDLE_OPEN); + opr_Assert(fdP->fd_status == FD_HANDLE_OPEN); #else /* HAVE_PIO */ - osi_Assert(fdP->fd_status != FD_HANDLE_AVAIL); + opr_Assert(fdP->fd_status != FD_HANDLE_AVAIL); #endif /* HAVE_PIO */ fdP->fd_refcnt++; @@ -372,7 +372,7 @@ ih_open_retry: * of open files reaches the size of the cache */ if ((fdInUseCount > fdCacheSize || fd == INVALID_FD) && fdLruHead != NULL) { fdP = fdLruHead; - osi_Assert(fdP->fd_status == FD_HANDLE_OPEN); + opr_Assert(fdP->fd_status == FD_HANDLE_OPEN); DLL_DELETE(fdP, fdLruHead, fdLruTail, fd_next, fd_prev); DLL_DELETE(fdP, fdP->fd_ih->ih_fdhead, fdP->fd_ih->ih_fdtail, fd_ihnext, fd_ihprev); @@ -392,7 +392,7 @@ ih_open_retry: fdHandleAllocateChunk(); } fdP = fdAvailHead; - osi_Assert(fdP->fd_status == FD_HANDLE_AVAIL); + opr_Assert(fdP->fd_status == FD_HANDLE_AVAIL); DLL_DELETE(fdP, fdAvailHead, fdAvailTail, fd_next, fd_prev); closeFd = INVALID_FD; } @@ -431,9 +431,9 @@ fd_close(FdHandle_t * fdP) return 0; IH_LOCK; - osi_Assert(ih_Inited); - osi_Assert(fdInUseCount > 0); - osi_Assert(fdP->fd_status == FD_HANDLE_INUSE || + opr_Assert(ih_Inited); + opr_Assert(fdInUseCount > 0); + opr_Assert(fdP->fd_status == FD_HANDLE_INUSE || fdP->fd_status == FD_HANDLE_CLOSING); ihP = fdP->fd_ih; @@ -483,9 +483,9 @@ fd_reallyclose(FdHandle_t * fdP) return 0; IH_LOCK; - osi_Assert(ih_Inited); - osi_Assert(fdInUseCount > 0); - osi_Assert(fdP->fd_status == FD_HANDLE_INUSE || + opr_Assert(ih_Inited); + opr_Assert(fdInUseCount > 0); + opr_Assert(fdP->fd_status == FD_HANDLE_INUSE || fdP->fd_status == FD_HANDLE_CLOSING); ihP = fdP->fd_ih; @@ -585,7 +585,7 @@ stream_open(const char *filename, const char *mode) } else if (strcmp(mode, "a+") == 0) { fd = OS_OPEN(filename, O_RDWR | O_APPEND | O_CREAT, 0); } else { - osi_Assert(FALSE); /* not implemented */ + opr_abort(); /* not implemented */ } if (fd == INVALID_FD) { @@ -608,7 +608,7 @@ stream_read(void *ptr, afs_fsize_t size, afs_fsize_t nitems, streamP->str_bufoff = 0; streamP->str_buflen = 0; } else { - osi_Assert(streamP->str_direction == STREAM_DIRECTION_READ); + opr_Assert(streamP->str_direction == STREAM_DIRECTION_READ); } bytesRead = 0; @@ -662,7 +662,7 @@ stream_write(void *ptr, afs_fsize_t size, afs_fsize_t nitems, streamP->str_bufoff = 0; streamP->str_buflen = STREAM_HANDLE_BUFSIZE; } else { - osi_Assert(streamP->str_direction == STREAM_DIRECTION_WRITE); + opr_Assert(streamP->str_direction == STREAM_DIRECTION_WRITE); } nbytes = size * nitems; @@ -752,7 +752,7 @@ stream_close(StreamHandle_t * streamP, int reallyClose) ssize_t rc; int retval = 0; - osi_Assert(streamP != NULL); + opr_Assert(streamP != NULL); if (streamP->str_direction == STREAM_DIRECTION_WRITE && streamP->str_bufoff > 0) { rc = OS_PWRITE(streamP->str_fd, streamP->str_buffer, @@ -789,7 +789,7 @@ ih_fdclose(IHandle_t * ihP) int closeCount, closedAll; FdHandle_t *fdP, *head, *tail, *next; - osi_Assert(ihP->ih_refcnt > 0); + opr_Assert(ihP->ih_refcnt > 0); closedAll = 1; DLL_INIT_LIST(head, tail); @@ -802,8 +802,8 @@ ih_fdclose(IHandle_t * ihP) */ for (fdP = ihP->ih_fdhead; fdP != NULL; fdP = next) { next = fdP->fd_ihnext; - osi_Assert(fdP->fd_ih == ihP); - osi_Assert(fdP->fd_status == FD_HANDLE_OPEN + opr_Assert(fdP->fd_ih == ihP); + opr_Assert(fdP->fd_status == FD_HANDLE_OPEN || fdP->fd_status == FD_HANDLE_INUSE || fdP->fd_status == FD_HANDLE_CLOSING); if (fdP->fd_status == FD_HANDLE_OPEN) { @@ -826,9 +826,9 @@ ih_fdclose(IHandle_t * ihP) * closed all file descriptors. */ if (ihP->ih_refcnt == 1 || closedAll) { - osi_Assert(closedAll); - osi_Assert(!ihP->ih_fdhead); - osi_Assert(!ihP->ih_fdtail); + opr_Assert(closedAll); + opr_Assert(!ihP->ih_fdhead); + opr_Assert(!ihP->ih_fdtail); } if (head == NULL) { @@ -850,7 +850,7 @@ ih_fdclose(IHandle_t * ihP) } IH_LOCK; - osi_Assert(fdInUseCount >= closeCount); + opr_Assert(fdInUseCount >= closeCount); fdInUseCount -= closeCount; /* @@ -891,7 +891,7 @@ ih_reallyclose(IHandle_t * ihP) IH_LOCK; } - osi_Assert(ihP->ih_refcnt > 0); + opr_Assert(ihP->ih_refcnt > 0); ih_fdclose(ihP); @@ -915,7 +915,7 @@ _ih_release_r(IHandle_t * ihP) if (!ihP) return 0; - osi_Assert(ihP->ih_refcnt > 0); + opr_Assert(ihP->ih_refcnt > 0); if (ihP->ih_refcnt > 1) { ihP->ih_refcnt--; diff --git a/src/vol/ihandle.h b/src/vol/ihandle.h index 8652f88..bfec30b 100644 --- a/src/vol/ihandle.h +++ b/src/vol/ihandle.h @@ -76,7 +76,7 @@ extern pthread_once_t ih_glock_once; extern pthread_mutex_t ih_glock_mutex; extern void ih_glock_init(void); #define IH_LOCK \ - do { osi_Assert(pthread_once(&ih_glock_once, ih_glock_init) == 0); \ + do { opr_Verify(pthread_once(&ih_glock_once, ih_glock_init) == 0); \ MUTEX_ENTER(&ih_glock_mutex); \ } while (0) #define IH_UNLOCK MUTEX_EXIT(&ih_glock_mutex) @@ -109,7 +109,7 @@ extern void ih_glock_init(void); else \ (head) = (ptr)->next; \ (ptr)->next = (ptr)->prev = NULL; \ - osi_Assert(!(head) || !((head)->prev)); \ + opr_Assert(!(head) || !((head)->prev)); \ } while(0) /* @@ -124,7 +124,7 @@ extern void ih_glock_init(void); (ptr)->prev->next = (ptr); \ else \ (head) = (ptr); \ - osi_Assert((head) && ((head)->prev == NULL)); \ + opr_Assert((head) && ((head)->prev == NULL)); \ } while(0) #endif /* DLL_INIT_LIST */ diff --git a/src/vol/listinodes.c b/src/vol/listinodes.c index 140e8c3..b05776e 100644 --- a/src/vol/listinodes.c +++ b/src/vol/listinodes.c @@ -21,6 +21,7 @@ #include #include +#include #include @@ -265,7 +266,7 @@ ListViceInodes(char *devname, char *mountedOn, FD_t inodeFile, * LAST_RSVD_I is a vice inode, with dead beef, and * di_nlink == 2 to indicate the FORCE. */ - osi_Assert(p = ginode(LAST_RSVD_I)); + opr_Verify(p = ginode(LAST_RSVD_I)); if (p->di_vicemagic == VICEMAGIC && p->di_vicep1 == 0xdeadbeef && p->di_nlink == 2) { diff --git a/src/vol/namei_ops.c b/src/vol/namei_ops.c index 7274af5..3f765ac 100644 --- a/src/vol/namei_ops.c +++ b/src/vol/namei_ops.c @@ -29,6 +29,7 @@ #include #endif +#include #include #include #include @@ -2248,7 +2249,7 @@ static pthread_key_t wq_key; static void _namei_wq_keycreate(void) { - osi_Assert(pthread_key_create(&wq_key, NULL) == 0); + opr_Verify(pthread_key_create(&wq_key, NULL) == 0); } /** @@ -2262,9 +2263,9 @@ _namei_wq_keycreate(void) void namei_SetWorkQueue(struct afs_work_queue *wq) { - osi_Assert(pthread_once(&wq_once, _namei_wq_keycreate) == 0); + opr_Verify(pthread_once(&wq_once, _namei_wq_keycreate) == 0); - osi_Assert(pthread_setspecific(wq_key, wq) == 0); + opr_Verify(pthread_setspecific(wq_key, wq) == 0); } /** @@ -2440,7 +2441,7 @@ namei_ListAFSSubDirs(IHandle_t * dirIH, linkHandle.fd_fd = INVALID_FD; #ifdef AFS_SALSRV_ENV - osi_Assert(pthread_once(&wq_once, _namei_wq_keycreate) == 0); + opr_Verify(pthread_once(&wq_once, _namei_wq_keycreate) == 0); wq = pthread_getspecific(wq_key); if (!wq) { @@ -3154,7 +3155,7 @@ static zlcList_t *zlcCur = NULL; static void AddToZLCDeleteList(char dir, char *name) { - osi_Assert(strlen(name) <= MAX_ZLC_NAMELEN - 3); + opr_Assert(strlen(name) <= MAX_ZLC_NAMELEN - 3); if (!zlcCur || zlcCur->zlc_n >= MAX_ZLC_NAMES) { if (zlcCur && zlcCur->zlc_next) diff --git a/src/vol/nuke.c b/src/vol/nuke.c index c8c2ed8..99df0d5 100644 --- a/src/vol/nuke.c +++ b/src/vol/nuke.c @@ -12,7 +12,7 @@ #include -#include +#include #include #include diff --git a/src/vol/partition.c b/src/vol/partition.c index 738fcc1..7bc6f3d 100644 --- a/src/vol/partition.c +++ b/src/vol/partition.c @@ -96,7 +96,7 @@ #include #endif -#include +#include #include #include "nfs.h" #include @@ -319,7 +319,7 @@ VCheckPartition(char *part, char *devname, int logging) struct dirent *dp; dirp = opendir(part); - osi_Assert(dirp); + opr_Assert(dirp); while ((dp = readdir(dirp))) { if (dp->d_name[0] == 'V') { Log("This program is compiled with AFS_NAMEI_ENV, but partition %s seems to contain volumes which don't use the namei-interface; aborting\n", part); @@ -916,7 +916,7 @@ VGetPartition_r(char *name, int abortp) } #endif /* AFS_DEMAND_ATTACH_FS */ if (abortp) - osi_Assert(dp != NULL); + opr_Assert(dp != NULL); return dp; } @@ -1164,12 +1164,12 @@ VLockPartition_r(char *name) (FD_t)CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_HIDDEN, NULL); - osi_Assert(dp->lock_fd != INVALID_FD); + opr_Assert(dp->lock_fd != INVALID_FD); memset(&lap, 0, sizeof(lap)); rc = LockFileEx((HANDLE) dp->lock_fd, LOCKFILE_EXCLUSIVE_LOCK, 0, 1, 0, &lap); - osi_Assert(rc); + opr_Assert(rc); } } @@ -1254,11 +1254,11 @@ VLockPartition_r(char *name) pausing.tv_usec = 500000; select(0, NULL, NULL, NULL, &pausing); } - osi_Assert(retries != 0); + opr_Assert(retries != 0); #if defined (AFS_HPUX_ENV) - osi_Assert(getprivgrp(privGrpList) == 0); + opr_Verify(getprivgrp(privGrpList) == 0); /* * In general, it will difficult and time-consuming ,if not impossible, @@ -1279,26 +1279,26 @@ VLockPartition_r(char *name) if (((*globalMask) & privmask(PRIV_LOCKRDONLY)) == 0) { /* allow everybody to set a lock on a read-only file descriptor */ (*globalMask) |= privmask(PRIV_LOCKRDONLY); - osi_Assert(setprivgrp(PRIV_GLOBAL, privGrpList[globalMaskIndex].priv_mask) - == 0); + opr_Verify(setprivgrp(PRIV_GLOBAL, + privGrpList[globalMaskIndex].priv_mask) == 0); lockfRtn = lockf(dp->lock_fd, F_LOCK, 0); /* remove the privilege granted to everybody to lock a read-only fd */ (*globalMask) &= ~(privmask(PRIV_LOCKRDONLY)); - osi_Assert(setprivgrp(PRIV_GLOBAL, privGrpList[globalMaskIndex].priv_mask) - == 0); + opr_Verify(setprivgrp(PRIV_GLOBAL, + privGrpList[globalMaskIndex].priv_mask) == 0); } else { /* in this case, we should be able to do this with impunity, anyway */ lockfRtn = lockf(dp->lock_fd, F_LOCK, 0); } - osi_Assert(lockfRtn != -1); + opr_Assert(lockfRtn != -1); #else #if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) - osi_Assert(lockf(dp->lock_fd, F_LOCK, 0) != -1); + opr_Verify(lockf(dp->lock_fd, F_LOCK, 0) != -1); #else - osi_Assert(flock(dp->lock_fd, LOCK_EX) == 0); + opr_Verify(flock(dp->lock_fd, LOCK_EX) == 0); #endif /* defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) */ #endif } @@ -1405,7 +1405,7 @@ VGetPartitionById_r(afs_int32 id, int abortp) } if (abortp) { - osi_Assert(dp != NULL); + opr_Assert(dp != NULL); } return dp; } @@ -1449,7 +1449,7 @@ VLookupPartition_r(char * path) static void AddPartitionToTable_r(struct DiskPartition64 *dp) { - osi_Assert(dp->index >= 0 && dp->index <= VOLMAXPARTS); + opr_Assert(dp->index >= 0 && dp->index <= VOLMAXPARTS); DiskPartitionTable[dp->index] = dp; } @@ -1457,7 +1457,7 @@ AddPartitionToTable_r(struct DiskPartition64 *dp) static void DeletePartitionFromTable_r(struct DiskPartition64 *dp) { - osi_Assert(dp->index >= 0 && dp->index <= VOLMAXPARTS); + opr_Assert(dp->index >= 0 && dp->index <= VOLMAXPARTS); DiskPartitionTable[dp->index] = NULL; } #endif diff --git a/src/vol/physio.c b/src/vol/physio.c index 674b00c..bf9c1b5 100644 --- a/src/vol/physio.c +++ b/src/vol/physio.c @@ -19,8 +19,6 @@ #include -#include - #ifdef HAVE_SYS_FILE_H #include #endif diff --git a/src/vol/salvaged.c b/src/vol/salvaged.c index a2c6cc2..25c18b5 100644 --- a/src/vol/salvaged.c +++ b/src/vol/salvaged.c @@ -32,7 +32,7 @@ #define WCOREDUMP(x) ((x) & 0200) #endif -#include +#include #include #if !defined(AFS_SGI_ENV) && !defined(AFS_NT40_ENV) @@ -504,7 +504,7 @@ SalvageServer(int argc, char **argv) ObtainSharedSalvageLock(); child_slot = calloc(Parallel, sizeof(int)); - osi_Assert(child_slot != NULL); + opr_Assert(child_slot != NULL); /* initialize things */ VOptDefaults(salvageServer, &opts); @@ -518,27 +518,22 @@ SalvageServer(int argc, char **argv) MUTEX_INIT(&worker_lock, "worker", MUTEX_DEFAULT, 0); CV_INIT(&worker_cv, "worker", CV_DEFAULT, 0); CV_INIT(&log_cleanup_queue.queue_change_cv, "queuechange", CV_DEFAULT, 0); - osi_Assert(pthread_attr_init(&attrs) == 0); + opr_Verify(pthread_attr_init(&attrs) == 0); /* start up the reaper and log cleaner threads */ - osi_Assert(pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED) == 0); - osi_Assert(pthread_create(&tid, - &attrs, - &SalvageChildReaperThread, - NULL) == 0); - osi_Assert(pthread_create(&tid, - &attrs, - &SalvageLogCleanupThread, - NULL) == 0); - osi_Assert(pthread_create(&tid, - &attrs, - &SalvageLogScanningThread, - NULL) == 0); + opr_Verify(pthread_attr_setdetachstate(&attrs, + PTHREAD_CREATE_DETACHED) == 0); + opr_Verify(pthread_create(&tid, &attrs, + &SalvageChildReaperThread, NULL) == 0); + opr_Verify(pthread_create(&tid, &attrs, + &SalvageLogCleanupThread, NULL) == 0); + opr_Verify(pthread_create(&tid, &attrs, + &SalvageLogScanningThread, NULL) == 0); /* loop forever serving requests */ while (1) { node = SALVSYNC_getWork(); - osi_Assert(node != NULL); + opr_Assert(node != NULL); Log("dispatching child to salvage volume %u...\n", node->command.sop.parent); @@ -549,7 +544,7 @@ SalvageServer(int argc, char **argv) if (!child_slot[slot]) break; } - osi_Assert (slot < Parallel); + opr_Assert (slot < Parallel); do_fork: pid = Fork(); @@ -658,7 +653,7 @@ SalvageChildReaperThread(void * args) if (child_slot[slot] == pid) break; } - osi_Assert(slot < Parallel); + opr_Assert(slot < Parallel); child_slot[slot] = 0; VOL_UNLOCK; @@ -788,7 +783,7 @@ SalvageLogScanningThread(void * arg) prefix_len = strlen(prefix); dp = opendir(AFSDIR_LOGS_DIR); - osi_Assert(dp); + opr_Assert(dp); while ((dirp = readdir(dp)) != NULL) { pid_t pid; diff --git a/src/vol/salvsync-server.c b/src/vol/salvsync-server.c index d9343bc..f4becd0 100644 --- a/src/vol/salvsync-server.c +++ b/src/vol/salvsync-server.c @@ -273,9 +273,10 @@ SALVSYNC_salvInit(void) } /* start the salvsync thread */ - osi_Assert(pthread_attr_init(&tattr) == 0); - osi_Assert(pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) == 0); - osi_Assert(pthread_create(&tid, &tattr, SALVSYNC_syncThread, NULL) == 0); + opr_Verify(pthread_attr_init(&tattr) == 0); + opr_Verify(pthread_attr_setdetachstate(&tattr, + PTHREAD_CREATE_DETACHED) == 0); + opr_Verify(pthread_create(&tid, &tattr, SALVSYNC_syncThread, NULL) == 0); } static void @@ -305,7 +306,7 @@ SALVSYNC_syncThread(void * args) /* when we fork, the child needs to close the salvsync server sockets, * otherwise, it may get salvsync requests, instead of the parent * salvageserver */ - osi_Assert(pthread_atfork(NULL, NULL, CleanFDs) == 0); + opr_Verify(pthread_atfork(NULL, NULL, CleanFDs) == 0); SYNC_getAddr(&state->endpoint, &state->addr); SYNC_cleanupSock(state); @@ -316,7 +317,7 @@ SALVSYNC_syncThread(void * args) state->fd = SYNC_getSock(&state->endpoint); code = SYNC_bindSock(state); - osi_Assert(!code); + opr_Assert(!code); InitHandler(); AcceptOn(); @@ -354,7 +355,7 @@ SALVSYNC_newconnection(int afd) osi_Panic("SALVSYNC_newconnection: accept failed, errno==%d\n", errno); } else if (!AddHandler(fd, SALVSYNC_com)) { AcceptOff(); - osi_Assert(AddHandler(fd, SALVSYNC_com)); + opr_Verify(AddHandler(fd, SALVSYNC_com)); } } @@ -756,7 +757,8 @@ static void AcceptOn(void) { if (AcceptHandler == -1) { - osi_Assert(AddHandler(salvsync_server_state.fd, SALVSYNC_newconnection)); + opr_Verify(AddHandler(salvsync_server_state.fd, + SALVSYNC_newconnection)); AcceptHandler = FindHandler(salvsync_server_state.fd); } } @@ -765,7 +767,7 @@ static void AcceptOff(void) { if (AcceptHandler != -1) { - osi_Assert(RemoveHandler(salvsync_server_state.fd)); + opr_Verify(RemoveHandler(salvsync_server_state.fd)); AcceptHandler = -1; } } @@ -1125,7 +1127,7 @@ UpdateCommandPrio(struct SalvageQueueNode * node) afs_int32 id; afs_uint32 prio; - osi_Assert(queue_IsOnQueue(node)); + opr_Assert(queue_IsOnQueue(node)); prio = node->command.sop.prio; id = node->partition_id; @@ -1217,7 +1219,7 @@ SALVSYNC_getWork(void) osi_Panic("Node not found\n"); have_node: - osi_Assert(node != NULL); + opr_Assert(node != NULL); node->pid = 0; partition_salvaging[node->partition_id]++; DeleteFromSalvageQueue(node); diff --git a/src/vol/vg_cache.c b/src/vol/vg_cache.c index 708bd3d..224971b 100644 --- a/src/vol/vg_cache.c +++ b/src/vol/vg_cache.c @@ -23,6 +23,7 @@ #ifdef AFS_DEMAND_ATTACH_FS +#include #include #include #include @@ -173,7 +174,7 @@ _VVGC_entry_free(VVGCache_entry_t * entry) { int code = 0; - osi_Assert(entry->refcnt == 0); + opr_Assert(entry->refcnt == 0); free(entry); return code; @@ -362,7 +363,7 @@ _VVGC_entry_put(struct DiskPartition64 * dp, VVGCache_entry_t * entry) { int code = 0; - osi_Assert(entry->refcnt > 0); + opr_Assert(entry->refcnt > 0); if (--entry->refcnt == 0) { VVGCache_entry_t *nentry; @@ -754,7 +755,7 @@ VVGCache_entry_add_r(struct DiskPartition64 * dp, } } - osi_Assert(!child_ent); + opr_Assert(!child_ent); child_ent = parent_ent; code = _VVGC_hash_entry_add(dp, child, diff --git a/src/vol/vg_scan.c b/src/vol/vg_scan.c index 44b7278..c94384c 100644 --- a/src/vol/vg_scan.c +++ b/src/vol/vg_scan.c @@ -24,6 +24,7 @@ #ifdef AFS_DEMAND_ATTACH_FS +#include #include #include #include @@ -414,7 +415,7 @@ _VVGC_scan_start(struct DiskPartition64 * dp) ViceLog(0, ("_VVGC_scan_start: pthread_create failed with %d\n", code)); old_state = _VVGC_state_change(dp, VVGC_PART_STATE_INVALID); - osi_Assert(old_state == VVGC_PART_STATE_UPDATING); + opr_Assert(old_state == VVGC_PART_STATE_UPDATING); } error: diff --git a/src/vol/vnode.c b/src/vol/vnode.c index 2d0f517..53eba88 100644 --- a/src/vol/vnode.c +++ b/src/vol/vnode.c @@ -26,7 +26,7 @@ #include #endif -#include +#include #include "rx/rx_queue.h" #include #include "nfs.h" @@ -358,7 +358,7 @@ VInitVnodes(VnodeClass class, int nVnodes) vcp->cacheSize = nVnodes; switch (class) { case vSmall: - osi_Assert(CHECKSIZE_SMALLVNODE); + opr_Assert(CHECKSIZE_SMALLVNODE); vcp->lruHead = NULL; vcp->residentSize = SIZEOF_SMALLVNODE; vcp->diskSize = SIZEOF_SMALLDISKVNODE; @@ -383,7 +383,7 @@ VInitVnodes(VnodeClass class, int nVnodes) return 0; va = (byte *) calloc(nVnodes, vcp->residentSize); - osi_Assert(va != NULL); + opr_Assert(va != NULL); while (nVnodes--) { Vnode *vnp = (Vnode *) va; Vn_refcount(vnp) = 0; /* no context switches */ @@ -1133,7 +1133,7 @@ VnStore(Error * ec, Volume * vp, Vnode * vnp, VnChangeState_r(vnp, VN_STATE_ERROR); VRequestSalvage_r(ec, vp, SALVSYNC_ERROR, 0); #else - osi_Assert(1 == 2); + opr_abort(); #endif } @@ -1375,10 +1375,10 @@ VPutVnode_r(Error * ec, Vnode * vnp) struct VnodeClassInfo *vcp; *ec = 0; - osi_Assert(Vn_refcount(vnp) != 0); + opr_Assert(Vn_refcount(vnp) != 0); class = vnodeIdToClass(Vn_id(vnp)); vcp = &VnodeClassInfo[class]; - osi_Assert(vnp->disk.vnodeMagic == vcp->magic); + opr_Assert(vnp->disk.vnodeMagic == vcp->magic); VNLog(200, 2, Vn_id(vnp), (intptr_t) vnp, 0, 0); #ifdef AFS_DEMAND_ATTACH_FS @@ -1407,7 +1407,7 @@ VPutVnode_r(Error * ec, Vnode * vnp) if (vnp->changed_oldTime || vnp->changed_newTime || vnp->delete) { Volume *vp = Vn_volume(vnp); afs_uint32 now = FT_ApproxTime(); - osi_Assert(Vn_cacheCheck(vnp) == vp->cacheCheck); + opr_Assert(Vn_cacheCheck(vnp) == vp->cacheCheck); if (vnp->delete) { /* No longer any directory entries for this vnode. Free the Vnode */ @@ -1429,7 +1429,7 @@ VPutVnode_r(Error * ec, Vnode * vnp) #ifdef AFS_DEMAND_ATTACH_FS VRequestSalvage_r(ec, vp, SALVSYNC_ERROR, 0); #else - osi_Assert(V_needsSalvaged(vp)); + opr_Assert(V_needsSalvaged(vp)); *ec = VSALVAGE; #endif } else { @@ -1517,10 +1517,10 @@ VVnodeWriteToRead_r(Error * ec, Vnode * vnp) #endif /* AFS_PTHREAD_ENV */ *ec = 0; - osi_Assert(Vn_refcount(vnp) != 0); + opr_Assert(Vn_refcount(vnp) != 0); class = vnodeIdToClass(Vn_id(vnp)); vcp = &VnodeClassInfo[class]; - osi_Assert(vnp->disk.vnodeMagic == vcp->magic); + opr_Assert(vnp->disk.vnodeMagic == vcp->magic); VNLog(300, 2, Vn_id(vnp), (intptr_t) vnp, 0, 0); #ifdef AFS_DEMAND_ATTACH_FS @@ -1554,7 +1554,7 @@ VVnodeWriteToRead_r(Error * ec, Vnode * vnp) if (vnp->changed_oldTime || vnp->changed_newTime) { Volume *vp = Vn_volume(vnp); afs_uint32 now = FT_ApproxTime(); - osi_Assert(Vn_cacheCheck(vnp) == vp->cacheCheck); + opr_Assert(Vn_cacheCheck(vnp) == vp->cacheCheck); if (vnp->changed_newTime) vnp->disk.serverModifyTime = now; if (vnp->changed_newTime) @@ -1565,7 +1565,7 @@ VVnodeWriteToRead_r(Error * ec, Vnode * vnp) #ifdef AFS_DEMAND_ATTACH_FS VRequestSalvage_r(ec, vp, SALVSYNC_ERROR, 0); #else - osi_Assert(V_needsSalvaged(vp)); + opr_Assert(V_needsSalvaged(vp)); *ec = VSALVAGE; #endif } else { @@ -1709,9 +1709,8 @@ VCloseVnodeFiles_r(Volume * vp) #endif /* AFS_DEMAND_ATTACH_FS */ /* XXX need better error handling here */ - osi_Assert(VInvalidateVnodesByVolume_r(vp, - &ih_vec, - &vec_len) == 0); + opr_Verify(VInvalidateVnodesByVolume_r(vp, &ih_vec, + &vec_len) == 0); /* * DAFS: @@ -1774,9 +1773,8 @@ VReleaseVnodeFiles_r(Volume * vp) #endif /* AFS_DEMAND_ATTACH_FS */ /* XXX need better error handling here */ - osi_Assert(VInvalidateVnodesByVolume_r(vp, - &ih_vec, - &vec_len) == 0); + opr_Verify(VInvalidateVnodesByVolume_r(vp, &ih_vec, + &vec_len) == 0); /* * DAFS: diff --git a/src/vol/vnode_inline.h b/src/vol/vnode_inline.h index f31c5ca..31fc4f5 100644 --- a/src/vol/vnode_inline.h +++ b/src/vol/vnode_inline.h @@ -259,11 +259,11 @@ VnWaitStateChange_r(Vnode * vnp) { VnState state_save = Vn_state(vnp); - osi_Assert(Vn_refcount(vnp)); + opr_Assert(Vn_refcount(vnp)); do { VOL_CV_WAIT(&Vn_stateCV(vnp)); } while (Vn_state(vnp) == state_save); - osi_Assert(!(Vn_stateFlags(vnp) & VN_ON_LRU)); + opr_Assert(!(Vn_stateFlags(vnp) & VN_ON_LRU)); } /** @@ -280,11 +280,11 @@ VnWaitStateChange_r(Vnode * vnp) static_inline void VnWaitExclusiveState_r(Vnode * vnp) { - osi_Assert(Vn_refcount(vnp)); + opr_Assert(Vn_refcount(vnp)); while (VnIsExclusiveState(Vn_state(vnp))) { VOL_CV_WAIT(&Vn_stateCV(vnp)); } - osi_Assert(!(Vn_stateFlags(vnp) & VN_ON_LRU)); + opr_Assert(!(Vn_stateFlags(vnp) & VN_ON_LRU)); } /** @@ -301,12 +301,12 @@ VnWaitExclusiveState_r(Vnode * vnp) static_inline void VnWaitQuiescent_r(Vnode * vnp) { - osi_Assert(Vn_refcount(vnp)); + opr_Assert(Vn_refcount(vnp)); while (VnIsExclusiveState(Vn_state(vnp)) || Vn_readers(vnp)) { VOL_CV_WAIT(&Vn_stateCV(vnp)); } - osi_Assert(!(Vn_stateFlags(vnp) & VN_ON_LRU)); + opr_Assert(!(Vn_stateFlags(vnp) & VN_ON_LRU)); } /** @@ -329,11 +329,11 @@ static_inline void VnBeginRead_r(Vnode * vnp) { if (!Vn_readers(vnp)) { - osi_Assert(Vn_state(vnp) == VN_STATE_ONLINE); + opr_Assert(Vn_state(vnp) == VN_STATE_ONLINE); VnChangeState_r(vnp, VN_STATE_READ); } Vn_readers(vnp)++; - osi_Assert(Vn_state(vnp) == VN_STATE_READ); + opr_Assert(Vn_state(vnp) == VN_STATE_READ); } /** @@ -356,7 +356,7 @@ VnBeginRead_r(Vnode * vnp) static_inline void VnEndRead_r(Vnode * vnp) { - osi_Assert(Vn_readers(vnp) > 0); + opr_Assert(Vn_readers(vnp) > 0); Vn_readers(vnp)--; if (!Vn_readers(vnp)) { CV_BROADCAST(&Vn_stateCV(vnp)); diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index c1bf1ce..601da80 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -99,7 +99,7 @@ Vnodes with 0 inode pointers in RW volumes are now deleted. #ifndef WCOREDUMP #define WCOREDUMP(x) ((x) & 0200) #endif -#include +#include #include #if !defined(AFS_SGI_ENV) && !defined(AFS_NT40_ENV) #if defined(AFS_VFSINCL_ENV) @@ -367,7 +367,7 @@ IsPartitionMounted(char *part) FILE *mntfp; struct mntent *mntent; - osi_Assert(mntfp = setmntent(MOUNTED, "r")); + opr_Verify(mntfp = setmntent(MOUNTED, "r")); while (mntent = getmntent(mntfp)) { if (!strcmp(part, mntent->mnt_dir)) break; @@ -541,12 +541,12 @@ SalvageFileSysParallel(struct DiskPartition64 *partP) * job to finish. When it's done, clean up after it. */ pid = wait(&wstatus); - osi_Assert(pid != -1); + opr_Assert(pid != -1); for (j = 0; j < numjobs; j++) { /* Find which job it is */ if (pid == jobs[j]->pid) break; } - osi_Assert(j < numjobs); + opr_Assert(j < numjobs); if (WCOREDUMP(wstatus)) { /* Say if the job core dumped */ Log("Salvage of %s core dumped!\n", jobs[j]->partP->name); } @@ -781,7 +781,7 @@ SalvageFileSys1(struct DiskPartition64 *partP, VolumeId singleVolumeNumber) DIR *dirp; struct dirent *dp; - osi_Assert((dirp = opendir(salvinfo->fileSysPath)) != NULL); + opr_Verify((dirp = opendir(salvinfo->fileSysPath)) != NULL); while ((dp = readdir(dirp))) { if (!strncmp(dp->d_name, "salvage.inodes.", 15) || !strncmp(dp->d_name, "salvage.temp.", 13)) { @@ -1310,15 +1310,15 @@ GetInodeSummary(struct SalvInfo *salvinfo, FD_t inodeFile, VolumeId singleVolume } st_size = OS_SIZE(summaryFile); - osi_Assert(st_size >= 0); + opr_Assert(st_size >= 0); if (st_size != 0) { int ret; salvinfo->inodeSummary = malloc(st_size); - osi_Assert(salvinfo->inodeSummary != NULL); + opr_Assert(salvinfo->inodeSummary != NULL); /* For GNU we need to do lseek to get the file pointer moved. */ - osi_Assert(OS_SEEK(summaryFile, 0, SEEK_SET) == 0); + opr_Assert(OS_SEEK(summaryFile, 0, SEEK_SET) == 0); ret = OS_READ(summaryFile, salvinfo->inodeSummary, st_size); - osi_Assert(ret == st_size); + opr_Assert(ret == st_size); } salvinfo->nVolumesInInodeFile = st_size / sizeof(struct InodeSummary); for (i = 0; i < salvinfo->nVolumesInInodeFile; i++) { @@ -1449,7 +1449,7 @@ AskVolumeSummary(struct SalvInfo *salvinfo, VolumeId singleVolumeNumber) } salvinfo->volumeSummaryp = calloc(VOL_VG_MAX_VOLS, sizeof(struct VolumeSummary)); - osi_Assert(salvinfo->volumeSummaryp != NULL); + opr_Assert(salvinfo->volumeSummaryp != NULL); salvinfo->nVolumes = 0; vsp = salvinfo->volumeSummaryp; @@ -1767,7 +1767,7 @@ GetVolumeSummary(struct SalvInfo *salvinfo, VolumeId singleVolumeNumber) } salvinfo->volumeSummaryp = calloc(nvols, sizeof(struct VolumeSummary)); - osi_Assert(salvinfo->volumeSummaryp != NULL); + opr_Assert(salvinfo->volumeSummaryp != NULL); params.singleVolumeNumber = singleVolumeNumber; params.vsp = salvinfo->volumeSummaryp; @@ -1937,10 +1937,10 @@ DoSalvageVolumeGroup(struct SalvInfo *salvinfo, struct InodeSummary *isp, int nV allInodes = inodes - isp->index; /* this would the base of all the inodes * for the partition, if all the inodes * had been read into memory */ - osi_Assert(OS_SEEK + opr_Verify(OS_SEEK (salvinfo->inodeFd, isp->index * sizeof(struct ViceInodeInfo), SEEK_SET) != -1); - osi_Assert(OS_READ(salvinfo->inodeFd, inodes, size) == size); + opr_Verify(OS_READ(salvinfo->inodeFd, inodes, size) == size); /* Don't try to salvage a read write volume if there isn't one on this * partition */ @@ -2608,16 +2608,16 @@ SalvageIndex(struct SalvInfo *salvinfo, Inode ino, VnodeClass class, int RW, IH_INIT(handle, salvinfo->fileSysDevice, volSummary->header.parent, ino); fdP = IH_OPEN(handle); - osi_Assert(fdP != NULL); + opr_Assert(fdP != NULL); file = FDH_FDOPEN(fdP, "r+"); - osi_Assert(file != NULL); + opr_Assert(file != NULL); vcp = &VnodeClassInfo[class]; size = OS_SIZE(fdP->fd_fd); - osi_Assert(size != -1); + opr_Assert(size != -1); nVnodes = (size / vcp->diskSize) - 1; if (nVnodes > 0) { - osi_Assert((nVnodes + 1) * vcp->diskSize == size); - osi_Assert(STREAM_ASEEK(file, vcp->diskSize) == 0); + opr_Assert((nVnodes + 1) * vcp->diskSize == size); + opr_Verify(STREAM_ASEEK(file, vcp->diskSize) == 0); } else { nVnodes = 0; } @@ -2833,12 +2833,12 @@ SalvageIndex(struct SalvInfo *salvinfo, Inode ino, VnodeClass class, int RW, } } /* VNDISK_GET_INO(vnode) != 0 */ vnodeDone: - osi_Assert(!(vnodeChanged && check)); + opr_Assert(!(vnodeChanged && check)); if (vnodeChanged && !Testing) { - osi_Assert(IH_IWRITE - (handle, vnodeIndexOffset(vcp, vnodeNumber), - (char *)vnode, vcp->diskSize) - == vcp->diskSize); + opr_Verify(IH_IWRITE(handle, + vnodeIndexOffset(vcp, vnodeNumber), + (char *)vnode, vcp->diskSize) + == vcp->diskSize); salvinfo->VolumeChanged = 1; /* For break call back */ } } @@ -2882,7 +2882,7 @@ CopyOnWrite(struct SalvInfo *salvinfo, struct DirSummary *dir) IH_IREAD(salvinfo->vnodeInfo[vLarge].handle, vnodeIndexOffset(vcp, dir->vnodeNumber), (char *)&vnode, sizeof(vnode)); - osi_Assert(code == sizeof(vnode)); + opr_Assert(code == sizeof(vnode)); oldinode = VNDISK_GET_INO(&vnode); /* Increment the version number by a whole lot to avoid problems with * clients that were promised new version numbers--but the file server @@ -2892,15 +2892,16 @@ CopyOnWrite(struct SalvInfo *salvinfo, struct DirSummary *dir) IH_CREATE(dir->ds_linkH, salvinfo->fileSysDevice, salvinfo->fileSysPath, 0, dir->rwVid, dir->vnodeNumber, vnode.uniquifier, vnode.dataVersion += 200); - osi_Assert(VALID_INO(newinode)); - osi_Assert(CopyInode(salvinfo->fileSysDevice, oldinode, newinode, dir->rwVid) == 0); + opr_Assert(VALID_INO(newinode)); + opr_Verify(CopyInode(salvinfo->fileSysDevice, oldinode, newinode, + dir->rwVid) == 0); vnode.cloned = 0; VNDISK_SET_INO(&vnode, newinode); code = IH_IWRITE(salvinfo->vnodeInfo[vLarge].handle, vnodeIndexOffset(vcp, dir->vnodeNumber), (char *)&vnode, sizeof(vnode)); - osi_Assert(code == sizeof(vnode)); + opr_Assert(code == sizeof(vnode)); SetSalvageDirHandle(&dir->dirHandle, dir->dirHandle.dirh_handle->ih_vid, salvinfo->fileSysDevice, newinode, @@ -2938,7 +2939,7 @@ CopyAndSalvage(struct SalvInfo *salvinfo, struct DirSummary *dir) IH_IREAD(salvinfo->vnodeInfo[vLarge].handle, vnodeIndexOffset(vcp, dir->vnodeNumber), (char *)&vnode, sizeof(vnode)); - osi_Assert(lcode == sizeof(vnode)); + opr_Assert(lcode == sizeof(vnode)); oldinode = VNDISK_GET_INO(&vnode); /* Increment the version number by a whole lot to avoid problems with * clients that were promised new version numbers--but the file server @@ -2948,7 +2949,7 @@ CopyAndSalvage(struct SalvInfo *salvinfo, struct DirSummary *dir) IH_CREATE(dir->ds_linkH, salvinfo->fileSysDevice, salvinfo->fileSysPath, 0, dir->rwVid, dir->vnodeNumber, vnode.uniquifier, vnode.dataVersion += 200); - osi_Assert(VALID_INO(newinode)); + opr_Assert(VALID_INO(newinode)); SetSalvageDirHandle(&newdir, dir->rwVid, salvinfo->fileSysDevice, newinode, &salvinfo->VolumeChanged); @@ -2974,14 +2975,14 @@ CopyAndSalvage(struct SalvInfo *salvinfo, struct DirSummary *dir) if (code) { Log("also failed to decrement link count on new inode"); } - osi_Assert(1 == 2); + opr_Assert(0); } Log("Checking the results of the directory salvage...\n"); if (!DirOK(&newdir)) { Log("Directory salvage failed!!!; restoring old version of the directory.\n"); code = IH_DEC(dir->ds_linkH, newinode, dir->rwVid); - osi_Assert(code == 0); - osi_Assert(1 == 2); + opr_Assert(code == 0); + opr_Assert(0); } vnode.cloned = 0; VNDISK_SET_INO(&vnode, newinode); @@ -2991,7 +2992,7 @@ CopyAndSalvage(struct SalvInfo *salvinfo, struct DirSummary *dir) IH_IWRITE(salvinfo->vnodeInfo[vLarge].handle, vnodeIndexOffset(vcp, dir->vnodeNumber), (char *)&vnode, sizeof(vnode)); - osi_Assert(lcode == sizeof(vnode)); + opr_Assert(lcode == sizeof(vnode)); #if 0 #ifdef AFS_NT40_ENV nt_sync(salvinfo->fileSysDevice); @@ -3008,7 +3009,7 @@ CopyAndSalvage(struct SalvInfo *salvinfo, struct DirSummary *dir) FDH_REALLYCLOSE(fdP); code = IH_DEC(dir->ds_linkH, oldinode, dir->rwVid); - osi_Assert(code == 0); + opr_Assert(code == 0); dir->dirHandle = newdir; } @@ -3039,7 +3040,7 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber, } if (!Testing) { CopyOnWrite(salvinfo, dir); - osi_Assert(afs_dir_Delete(&dir->dirHandle, name) == 0); + opr_Verify(afs_dir_Delete(&dir->dirHandle, name) == 0); } return 0; } @@ -3053,7 +3054,7 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber, Log("dir vnode %d: invalid entry: %s" OS_DIRSEP "%s has no inode (vnode %d, unique %d)%s\n", dir->vnodeNumber, (dir->name ? dir->name : "??"), name, vnodeNumber, unique, (Testing ? "-- would have deleted" : " -- deleted")); if (!Testing) { CopyOnWrite(salvinfo, dir); - osi_Assert(Delete(&dir->dirHandle, name) == 0); + opr_Verify(afs_dir_Delete(&dir->dirHandle, name) == 0); } return 0; } @@ -3071,7 +3072,7 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber, if (!unique) { if (!Testing) { CopyOnWrite(salvinfo, dir); - osi_Assert(afs_dir_Delete(&dir->dirHandle, name) == 0); + opr_Verify(afs_dir_Delete(&dir->dirHandle, name) == 0); } return 0; } @@ -3101,9 +3102,9 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber, fid.Vnode = vnodeNumber; fid.Unique = vnodeEssence->unique; CopyOnWrite(salvinfo, dir); - osi_Assert(afs_dir_Delete(&dir->dirHandle, name) == 0); + opr_Verify(afs_dir_Delete(&dir->dirHandle, name) == 0); if (!todelete) - osi_Assert(afs_dir_Create(&dir->dirHandle, name, &fid) == 0); + opr_Verify(afs_dir_Create(&dir->dirHandle, name, &fid) == 0); } if (todelete) return 0; /* no need to continue */ @@ -3116,10 +3117,10 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber, if (!Testing) { AFSFid fid; CopyOnWrite(salvinfo, dir); - osi_Assert(afs_dir_Delete(&dir->dirHandle, ".") == 0); + opr_Verify(afs_dir_Delete(&dir->dirHandle, ".") == 0); fid.Vnode = dir->vnodeNumber; fid.Unique = dir->unique; - osi_Assert(afs_dir_Create(&dir->dirHandle, ".", &fid) == 0); + opr_Verify(afs_dir_Create(&dir->dirHandle, ".", &fid) == 0); vnodeNumber = fid.Vnode; /* Get the new Essence */ unique = fid.Unique; vnodeEssence = CheckVnodeNumber(salvinfo, vnodeNumber); @@ -3132,7 +3133,7 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber, struct VnodeEssence *dotdot; pa.Vnode = dir->parent; dotdot = CheckVnodeNumber(salvinfo, pa.Vnode); - osi_Assert(dotdot != NULL); /* XXX Should not be assert */ + opr_Assert(dotdot != NULL); /* XXX Should not be assert */ pa.Unique = dotdot->unique; } else { pa.Vnode = dir->vnodeNumber; @@ -3143,8 +3144,8 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber, Log("directory vnode %u.%u: bad '..' entry (was %u.%u); fixed\n", dir->vnodeNumber, dir->unique, vnodeNumber, unique); if (!Testing) { CopyOnWrite(salvinfo, dir); - osi_Assert(afs_dir_Delete(&dir->dirHandle, "..") == 0); - osi_Assert(afs_dir_Create(&dir->dirHandle, "..", &pa) == 0); + opr_Verify(afs_dir_Delete(&dir->dirHandle, "..") == 0); + opr_Verify(afs_dir_Create(&dir->dirHandle, "..", &pa) == 0); } vnodeNumber = pa.Vnode; /* Get the new Essence */ @@ -3158,7 +3159,7 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber, } if (!Testing) { CopyOnWrite(salvinfo, dir); - osi_Assert(afs_dir_Delete(&dir->dirHandle, name) == 0); + opr_Verify(afs_dir_Delete(&dir->dirHandle, name) == 0); } vnodeEssence->claimed = 0; /* Not claimed: Orphaned */ vnodeEssence->todelete = 1; /* Will later delete vnode and decr inode */ @@ -3249,7 +3250,7 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber, } if (!Testing) { CopyOnWrite(salvinfo, dir); - osi_Assert(afs_dir_Delete(&dir->dirHandle, name) == 0); + opr_Verify(afs_dir_Delete(&dir->dirHandle, name) == 0); } return 0; } @@ -3277,20 +3278,21 @@ DistilVnodeEssence(struct SalvInfo *salvinfo, VolumeId rwVId, IH_INIT(vip->handle, salvinfo->fileSysDevice, rwVId, ino); fdP = IH_OPEN(vip->handle); - osi_Assert(fdP != NULL); + opr_Assert(fdP != NULL); file = FDH_FDOPEN(fdP, "r+"); - osi_Assert(file != NULL); + opr_Assert(file != NULL); size = OS_SIZE(fdP->fd_fd); - osi_Assert(size != -1); + opr_Assert(size != -1); vip->nVnodes = (size / vcp->diskSize) - 1; if (vip->nVnodes > 0) { - osi_Assert((vip->nVnodes + 1) * vcp->diskSize == size); - osi_Assert(STREAM_ASEEK(file, vcp->diskSize) == 0); - osi_Assert((vip->vnodes = (struct VnodeEssence *) - calloc(vip->nVnodes, sizeof(struct VnodeEssence))) != NULL); + opr_Assert((vip->nVnodes + 1) * vcp->diskSize == size); + opr_Verify(STREAM_ASEEK(file, vcp->diskSize) == 0); + opr_Verify((vip->vnodes = calloc(vip->nVnodes, + sizeof(struct VnodeEssence))) + != NULL); if (class == vLarge) { - osi_Assert((vip->inodes = (Inode *) - calloc(vip->nVnodes, sizeof(Inode))) != NULL); + opr_Verify((vip->inodes = calloc(vip->nVnodes, sizeof(Inode))) + != NULL); } else { vip->inodes = NULL; } @@ -3448,7 +3450,7 @@ SalvageDir(struct SalvInfo *salvinfo, char *name, VolumeId rwVid, judge_params.salvinfo = salvinfo; judge_params.dir = &dir; - osi_Assert(afs_dir_EnumerateDir(&dirHandle, JudgeEntry, + opr_Verify(afs_dir_EnumerateDir(&dirHandle, JudgeEntry, &judge_params) == 0); } @@ -3460,7 +3462,7 @@ SalvageDir(struct SalvInfo *salvinfo, char *name, VolumeId rwVid, DFlush(); if (dir.copied && !Testing) { code = IH_DEC(dir.ds_linkH, dirHandle.dirh_handle->ih_ino, rwVid); - osi_Assert(code == 0); + opr_Assert(code == 0); dirVnodeInfo->inodes[i] = dir.dirHandle.dirh_inode; } @@ -3702,8 +3704,8 @@ CreateRootDir(struct SalvInfo *salvinfo, VolumeDiskData *volHeader, salvinfo->vnodeInfo[vLarge].vnodes = calloc(1, sizeof(struct VnodeEssence)); salvinfo->vnodeInfo[vLarge].inodes = calloc(1, sizeof(Inode)); - osi_Assert(salvinfo->vnodeInfo[vLarge].vnodes); - osi_Assert(salvinfo->vnodeInfo[vLarge].inodes); + opr_Assert(salvinfo->vnodeInfo[vLarge].vnodes); + opr_Assert(salvinfo->vnodeInfo[vLarge].inodes); } vep = &salvinfo->vnodeInfo[vLarge].vnodes[vnodeIdToBitNumber(1)]; @@ -3885,9 +3887,9 @@ SalvageVolume(struct SalvInfo *salvinfo, struct InodeSummary *rwIsp, IHandle_t * vid = rwIsp->volSummary->header.id; IH_INIT(h, salvinfo->fileSysDevice, vid, rwIsp->volSummary->header.volumeInfo); nBytes = IH_IREAD(h, 0, (char *)&volHeader, sizeof(volHeader)); - osi_Assert(nBytes == sizeof(volHeader)); - osi_Assert(volHeader.stamp.magic == VOLUMEINFOMAGIC); - osi_Assert(volHeader.destroyMe != DESTROY_ME); + opr_Assert(nBytes == sizeof(volHeader)); + opr_Assert(volHeader.stamp.magic == VOLUMEINFOMAGIC); + opr_Assert(volHeader.destroyMe != DESTROY_ME); /* (should not have gotten this far with DESTROY_ME flag still set!) */ DistilVnodeEssence(salvinfo, vid, vLarge, @@ -3996,8 +3998,8 @@ SalvageVolume(struct SalvInfo *salvinfo, struct InodeSummary *rwIsp, IHandle_t * &salvinfo->VolumeChanged); pa.Vnode = LFVnode; pa.Unique = LFUnique; - osi_Assert(afs_dir_Delete(&dh, "..") == 0); - osi_Assert(afs_dir_Create(&dh, "..", &pa) == 0); + opr_Verify(afs_dir_Delete(&dh, "..") == 0); + opr_Verify(afs_dir_Create(&dh, "..", &pa) == 0); /* The original parent's link count was decremented above. * Here we increment the new parent's link count. @@ -4026,7 +4028,7 @@ SalvageVolume(struct SalvInfo *salvinfo, struct InodeSummary *rwIsp, IHandle_t * ThisUnique += 50; /* Try creating a different file */ } - osi_Assert(code == 0); + opr_Assert(code == 0); Log("Attaching orphaned %s to volume's root dir as %s\n", ((class == vLarge) ? "directory" : "file"), npath); } @@ -4039,7 +4041,7 @@ SalvageVolume(struct SalvInfo *salvinfo, struct InodeSummary *rwIsp, IHandle_t * code = IH_DEC(oldrootdir.ds_linkH, oldrootdir.dirHandle.dirh_inode, oldrootdir.rwVid); - osi_Assert(code == 0); + opr_Assert(code == 0); /* dirVnodeInfo->inodes[?] is not updated with new inode number */ } @@ -4077,7 +4079,7 @@ SalvageVolume(struct SalvInfo *salvinfo, struct InodeSummary *rwIsp, IHandle_t * IH_IREAD(salvinfo->vnodeInfo[class].handle, vnodeIndexOffset(vcp, vnodeNumber), (char *)&vnode, sizeof(vnode)); - osi_Assert(nBytes == sizeof(vnode)); + opr_Assert(nBytes == sizeof(vnode)); vnode.parent = vnp->parent; oldCount = vnode.linkCount; @@ -4088,7 +4090,7 @@ SalvageVolume(struct SalvInfo *salvinfo, struct InodeSummary *rwIsp, IHandle_t * if (orphaned) { if (!vnp->todelete) { /* Orphans should have already been attached (if requested) */ - osi_Assert(orphans != ORPH_ATTACH); + opr_Assert(orphans != ORPH_ATTACH); oblocks += vnp->blockCount; ofiles++; } @@ -4099,7 +4101,7 @@ SalvageVolume(struct SalvInfo *salvinfo, struct InodeSummary *rwIsp, IHandle_t * if (VNDISK_GET_INO(&vnode)) { code = IH_DEC(alinkH, VNDISK_GET_INO(&vnode), vid); - osi_Assert(code == 0); + opr_Assert(code == 0); } memset(&vnode, 0, sizeof(vnode)); } @@ -4117,7 +4119,7 @@ SalvageVolume(struct SalvInfo *salvinfo, struct InodeSummary *rwIsp, IHandle_t * IH_IWRITE(salvinfo->vnodeInfo[class].handle, vnodeIndexOffset(vcp, vnodeNumber), (char *)&vnode, sizeof(vnode)); - osi_Assert(nBytes == sizeof(vnode)); + opr_Assert(nBytes == sizeof(vnode)); } salvinfo->VolumeChanged = 1; } @@ -4206,7 +4208,7 @@ SalvageVolume(struct SalvInfo *salvinfo, struct InodeSummary *rwIsp, IHandle_t * salvinfo->VolumeChanged = 0; if (!Testing) { nBytes = IH_IWRITE(h, 0, (char *)&volHeader, sizeof(volHeader)); - osi_Assert(nBytes == sizeof(volHeader)); + opr_Assert(nBytes == sizeof(volHeader)); } if (!Showmode) { Log("%sSalvaged %s (%u): %d files, %d blocks\n", @@ -4229,15 +4231,15 @@ ClearROInUseBit(struct VolumeSummary *summary) VolumeDiskData volHeader; nBytes = IH_IREAD(h, 0, (char *)&volHeader, sizeof(volHeader)); - osi_Assert(nBytes == sizeof(volHeader)); - osi_Assert(volHeader.stamp.magic == VOLUMEINFOMAGIC); + opr_Assert(nBytes == sizeof(volHeader)); + opr_Assert(volHeader.stamp.magic == VOLUMEINFOMAGIC); volHeader.inUse = 0; volHeader.needsSalvaged = 0; volHeader.inService = 1; volHeader.dontSalvage = DONT_SALVAGE; if (!Testing) { nBytes = IH_IWRITE(h, 0, (char *)&volHeader, sizeof(volHeader)); - osi_Assert(nBytes == sizeof(volHeader)); + opr_Assert(nBytes == sizeof(volHeader)); } } @@ -4375,7 +4377,8 @@ LockVolume(struct SalvInfo *salvinfo, VolumeId volumeId) * case). But if it's there enough that we can read it, but * somehow we cannot write to it to signify we're salvaging it, * we've got a big problem and we cannot continue. */ - osi_Assert(IH_IWRITE(h, 0, (char*)&volHeader, sizeof(volHeader)) == sizeof(volHeader)); + opr_Verify(IH_IWRITE(h, 0, (char*)&volHeader, sizeof(volHeader)) + == sizeof(volHeader)); IH_RELEASE(h); } @@ -4588,14 +4591,14 @@ CopyInode(Device device, Inode inode1, Inode inode2, int rwvolume) IH_INIT(srcH, device, rwvolume, inode1); srcFdP = IH_OPEN(srcH); - osi_Assert(srcFdP != NULL); + opr_Assert(srcFdP != NULL); IH_INIT(destH, device, rwvolume, inode2); destFdP = IH_OPEN(destH); while ((nBytes = FDH_PREAD(srcFdP, buf, sizeof(buf), size)) > 0) { - osi_Assert(FDH_PWRITE(destFdP, buf, nBytes, size) == nBytes); + opr_Verify(FDH_PWRITE(destFdP, buf, nBytes, size) == nBytes); size += nBytes; } - osi_Assert(nBytes == 0); + opr_Assert(nBytes == 0); FDH_REALLYCLOSE(srcFdP); FDH_REALLYCLOSE(destFdP); IH_RELEASE(srcH); @@ -4613,11 +4616,11 @@ PrintInodeList(struct SalvInfo *salvinfo) afs_sfsize_t st_size; st_size = OS_SIZE(salvinfo->inodeFd); - osi_Assert(st_size >= 0); + opr_Assert(st_size >= 0); buf = malloc(st_size); - osi_Assert(buf != NULL); + opr_Assert(buf != NULL); nInodes = st_size / sizeof(struct ViceInodeInfo); - osi_Assert(OS_READ(salvinfo->inodeFd, buf, st_size) == st_size); + opr_Verify(OS_READ(salvinfo->inodeFd, buf, st_size) == st_size); for (ip = buf; nInodes--; ip++) { Log("Inode:%s, linkCount=%d, size=%#llx, p=(%u,%u,%u,%u)\n", PrintInode(stmp, ip->inodeNumber), ip->linkCount, @@ -4645,10 +4648,10 @@ Fork(void) int f; #ifdef AFS_NT40_ENV f = 0; - osi_Assert(0); /* Fork is never executed in the NT code path */ + opr_Assert(0); /* Fork is never executed in the NT code path */ #else f = fork(); - osi_Assert(f >= 0); + opr_Assert(f >= 0); #ifdef AFS_DEMAND_ATTACH_FS if ((f == 0) && (programType == salvageServer)) { /* we are a salvageserver child */ @@ -4709,7 +4712,7 @@ Wait(char *prog) int status; int pid; pid = wait(&status); - osi_Assert(pid != -1); + opr_Assert(pid != -1); if (WCOREDUMP(status)) Log("\"%s\" core dumped!\n", prog); if (WIFSIGNALED(status) != 0 || WEXITSTATUS(status) != 0) @@ -4862,7 +4865,7 @@ ToString(const char *s) { char *p; p = strdup(s); - osi_Assert(p != NULL); + opr_Assert(p != NULL); return p; } diff --git a/src/vol/volume.c b/src/vol/volume.c index 0ef7f81..21376e4 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -31,7 +31,7 @@ #include #endif -#include +#include #include #ifndef AFS_NT40_ENV @@ -576,7 +576,7 @@ VInitVolumePackage2(ProgramType pt, VolumePackageOptions * opts) } else { VLRU_SetOptions(VLRU_SET_ENABLED, 0); } - osi_Assert(pthread_key_create(&VThread_key, NULL) == 0); + opr_Verify(pthread_key_create(&VThread_key, NULL) == 0); #endif MUTEX_INIT(&vol_glock_mutex, "vol glock", MUTEX_DEFAULT, 0); @@ -615,7 +615,7 @@ VInitVolumePackage2(ProgramType pt, VolumePackageOptions * opts) #if defined(AFS_DEMAND_ATTACH_FS) && defined(SALVSYNC_BUILD_CLIENT) if (VCanUseSALVSYNC()) { /* establish a connection to the salvager at this point */ - osi_Assert(VConnectSALV() != 0); + opr_Verify(VConnectSALV() != 0); } #endif /* AFS_DEMAND_ATTACH_FS */ @@ -669,13 +669,15 @@ VInitVolumePackage2(ProgramType pt, VolumePackageOptions * opts) int VInitAttachVolumes(ProgramType pt) { - osi_Assert(VInit==1); + opr_Assert(VInit==1); if (pt == fileServer) { struct DiskPartition64 *diskP; /* Attach all the volumes in this partition */ for (diskP = DiskPartitionList; diskP; diskP = diskP->next) { int nAttached = 0, nUnattached = 0; - osi_Assert(VAttachVolumesByPartition(diskP, &nAttached, &nUnattached) == 0); + opr_Verify(VAttachVolumesByPartition(diskP, + &nAttached, &nUnattached) + == 0); } } VOL_LOCK; @@ -700,7 +702,7 @@ VInitAttachVolumes(ProgramType pt) int VInitAttachVolumes(ProgramType pt) { - osi_Assert(VInit==1); + opr_Assert(VInit==1); if (pt == fileServer) { struct DiskPartition64 *diskP; struct vinitvolumepackage_thread_t params; @@ -716,7 +718,7 @@ VInitAttachVolumes(ProgramType pt) /* create partition work queue */ for (parts=0, diskP = DiskPartitionList; diskP; diskP = diskP->next, parts++) { dpq = malloc(sizeof(struct diskpartition_queue_t)); - osi_Assert(dpq != NULL); + opr_Assert(dpq != NULL); dpq->diskP = diskP; queue_Append(¶ms,dpq); } @@ -725,8 +727,10 @@ VInitAttachVolumes(ProgramType pt) if (threads > 1) { /* spawn off a bunch of initialization threads */ - osi_Assert(pthread_attr_init(&attrs) == 0); - osi_Assert(pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED) == 0); + opr_Verify(pthread_attr_init(&attrs) == 0); + opr_Verify(pthread_attr_setdetachstate(&attrs, + PTHREAD_CREATE_DETACHED) + == 0); Log("VInitVolumePackage: beginning parallel fileserver startup\n"); Log("VInitVolumePackage: using %d threads to attach volumes on %d partitions\n", @@ -736,9 +740,9 @@ VInitAttachVolumes(ProgramType pt) for (i=0; i < threads; i++) { AFS_SIGSET_DECL; AFS_SIGSET_CLEAR(); - osi_Assert(pthread_create - (&tid, &attrs, &VInitVolumePackageThread, - ¶ms) == 0); + opr_Verify(pthread_create(&tid, &attrs, + &VInitVolumePackageThread, + ¶ms) == 0); AFS_SIGSET_RESTORE(); } @@ -747,7 +751,7 @@ VInitAttachVolumes(ProgramType pt) } VOL_UNLOCK; - osi_Assert(pthread_attr_destroy(&attrs) == 0); + opr_Verify(pthread_attr_destroy(&attrs) == 0); } else { /* if we're only going to run one init thread, don't bother creating * another LWP */ @@ -793,7 +797,8 @@ VInitVolumePackageThread(void * args) { diskP = dpq->diskP; free(dpq); - osi_Assert(VAttachVolumesByPartition(diskP, &nAttached, &nUnattached) == 0); + opr_Verify(VAttachVolumesByPartition(diskP, &nAttached, + &nUnattached) == 0); VOL_LOCK; } @@ -820,7 +825,7 @@ done: int VInitAttachVolumes(ProgramType pt) { - osi_Assert(VInit==1); + opr_Assert(VInit==1); if (pt == fileServer) { struct DiskPartition64 *diskP; @@ -838,7 +843,7 @@ VInitAttachVolumes(ProgramType pt) for (parts = 0, diskP = DiskPartitionList; diskP; diskP = diskP->next, parts++) { struct diskpartition_queue_t *dp; dp = malloc(sizeof(struct diskpartition_queue_t)); - osi_Assert(dp != NULL); + opr_Assert(dp != NULL); dp->diskP = diskP; queue_Append(&pq, dp); } @@ -851,8 +856,9 @@ VInitAttachVolumes(ProgramType pt) CV_INIT(&(vq.cv), "volq", CV_DEFAULT, 0); MUTEX_INIT(&(vq.mutex), "volq", MUTEX_DEFAULT, 0); - osi_Assert(pthread_attr_init(&attrs) == 0); - osi_Assert(pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED) == 0); + opr_Verify(pthread_attr_init(&attrs) == 0); + opr_Verify(pthread_attr_setdetachstate(&attrs, + PTHREAD_CREATE_DETACHED) == 0); Log("VInitVolumePackage: beginning parallel fileserver startup\n"); Log("VInitVolumePackage: using %d threads to pre-attach volumes on %d partitions\n", @@ -864,20 +870,22 @@ VInitAttachVolumes(ProgramType pt) AFS_SIGSET_DECL; params = malloc(sizeof(struct vinitvolumepackage_thread_param)); - osi_Assert(params); + opr_Assert(params); params->pq = &pq; params->vq = &vq; params->nthreads = threads; params->thread = i+1; AFS_SIGSET_CLEAR(); - osi_Assert(pthread_create (&tid, &attrs, &VInitVolumePackageThread, (void*)params) == 0); + opr_Verify(pthread_create(&tid, &attrs, + &VInitVolumePackageThread, + (void*)params) == 0); AFS_SIGSET_RESTORE(); } VInitPreAttachVolumes(threads, &vq); - osi_Assert(pthread_attr_destroy(&attrs) == 0); + opr_Verify(pthread_attr_destroy(&attrs) == 0); CV_DESTROY(&pq.cv); MUTEX_DESTROY(&pq.mutex); CV_DESTROY(&vq.cv); @@ -907,15 +915,15 @@ VInitVolumePackageThread(void *args) struct volume_init_queue *vq; struct volume_init_batch *vb; - osi_Assert(args); + opr_Assert(args); params = (struct vinitvolumepackage_thread_param *)args; pq = params->pq; vq = params->vq; - osi_Assert(pq); - osi_Assert(vq); + opr_Assert(pq); + opr_Assert(vq); vb = malloc(sizeof(struct volume_init_batch)); - osi_Assert(vb); + opr_Assert(vb); vb->thread = params->thread; vb->last = 0; vb->size = 0; @@ -933,7 +941,7 @@ VInitVolumePackageThread(void *args) } while ((vid = VInitNextVolumeId(dirp))) { Volume *vp = calloc(1, sizeof(Volume)); - osi_Assert(vp); + opr_Assert(vp); vp->device = partition->device; vp->partition = partition; vp->hashid = vid; @@ -949,7 +957,7 @@ VInitVolumePackageThread(void *args) MUTEX_EXIT(&vq->mutex); vb = malloc(sizeof(struct volume_init_batch)); - osi_Assert(vb); + opr_Assert(vb); vb->thread = params->thread; vb->size = 0; vb->last = 0; @@ -993,8 +1001,8 @@ VInitNextPartition(struct partition_queue *pq) queue_Remove(dp); MUTEX_EXIT(&pq->mutex); - osi_Assert(dp); - osi_Assert(dp->diskP); + opr_Assert(dp); + opr_Assert(dp->diskP); partition = dp->diskP; free(dp); @@ -1227,8 +1235,9 @@ VShutdown_r(void) MUTEX_INIT(¶ms.lock, "params", MUTEX_DEFAULT, 0); CV_INIT(¶ms.cv, "params", CV_DEFAULT, 0); CV_INIT(¶ms.master_cv, "params master", CV_DEFAULT, 0); - osi_Assert(pthread_attr_init(&attrs) == 0); - osi_Assert(pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED) == 0); + opr_Verify(pthread_attr_init(&attrs) == 0); + opr_Verify(pthread_attr_setdetachstate(&attrs, + PTHREAD_CREATE_DETACHED) == 0); queue_Init(¶ms); /* setup the basic partition information structures for @@ -1254,7 +1263,7 @@ VShutdown_r(void) /* build up the pass 0 shutdown work queue */ dpq = malloc(sizeof(struct diskpartition_queue_t)); - osi_Assert(dpq != NULL); + opr_Assert(dpq != NULL); dpq->diskP = diskP; queue_Prepend(¶ms, dpq); @@ -1268,9 +1277,8 @@ VShutdown_r(void) /* do pass 0 shutdown */ MUTEX_ENTER(¶ms.lock); for (i=0; i < params.n_threads; i++) { - osi_Assert(pthread_create - (&tid, &attrs, &VShutdownThread, - ¶ms) == 0); + opr_Verify(pthread_create(&tid, &attrs, &VShutdownThread, + ¶ms) == 0); } /* wait for all the pass 0 shutdowns to complete */ @@ -1293,7 +1301,7 @@ VShutdown_r(void) VOL_CV_WAIT(¶ms.cv); } - osi_Assert(pthread_attr_destroy(&attrs) == 0); + opr_Verify(pthread_attr_destroy(&attrs) == 0); CV_DESTROY(¶ms.cv); CV_DESTROY(¶ms.master_cv); MUTEX_DESTROY(¶ms.lock); @@ -1366,7 +1374,7 @@ VShutdown_r(void) void VShutdown(void) { - osi_Assert(VInit>0); + opr_Assert(VInit>0); VOL_LOCK; VShutdown_r(); VOL_UNLOCK; @@ -1606,7 +1614,7 @@ VShutdownThread(void * args) VOL_LOCK; pass = params->pass; - osi_Assert(pass > 0); + opr_Assert(pass > 0); /* now escalate through the more complicated shutdowns */ while (pass <= 3) { @@ -1840,7 +1848,7 @@ VShutdownVolume_r(Volume * vp) /* wait for other blocking ops to finish */ VWaitExclusiveState_r(vp); - osi_Assert(VIsValidState(V_attachState(vp))); + opr_Assert(VIsValidState(V_attachState(vp))); switch(V_attachState(vp)) { case VOL_STATE_SALVAGING: @@ -2137,7 +2145,7 @@ VPreAttachVolumeById_r(Error * ec, *ec = 0; - osi_Assert(programType == fileServer); + opr_Assert(programType == fileServer); if (!(partp = VGetPartition_r(partition, 0))) { *ec = VNOVOL; @@ -2222,7 +2230,7 @@ VPreAttachVolumeByVp_r(Error * ec, /* allocate the volume structure */ vp = nvp = calloc(1, sizeof(Volume)); - osi_Assert(vp != NULL); + opr_Assert(vp != NULL); queue_Init(&vp->vnode_list); queue_Init(&vp->rx_call_list); CV_INIT(&V_attachCV(vp), "vp attach", CV_DEFAULT, 0); @@ -2313,7 +2321,7 @@ VAttachVolumeByName_r(Error * ec, char *partition, char *name, int mode) } if (VRequiresPartLock()) { - osi_Assert(VInit == 3); + opr_Assert(VInit == 3); VLockPartition_r(partition); } else if (programType == fileServer) { #ifdef AFS_DEMAND_ATTACH_FS @@ -2388,7 +2396,7 @@ VAttachVolumeByName_r(Error * ec, char *partition, char *name, int mode) } } - osi_Assert(vp != NULL); + opr_Assert(vp != NULL); /* handle pre-attach races * @@ -2449,7 +2457,7 @@ VAttachVolumeByName_r(Error * ec, char *partition, char *name, int mode) if (!vp) { vp = (Volume *) calloc(1, sizeof(Volume)); - osi_Assert(vp != NULL); + opr_Assert(vp != NULL); vp->hashid = volumeId; vp->device = partp->device; vp->partition = partp; @@ -2586,7 +2594,7 @@ VAttachVolumeByVp_r(Error * ec, Volume * vp, int mode) *ec = 0; /* volume utility should never call AttachByVp */ - osi_Assert(programType == fileServer); + opr_Assert(programType == fileServer); volumeId = vp->hashid; partp = vp->partition; @@ -2630,7 +2638,7 @@ VAttachVolumeByVp_r(Error * ec, Volume * vp, int mode) } } - osi_Assert(vp != NULL); + opr_Assert(vp != NULL); VChangeState_r(vp, VOL_STATE_ATTACHING); /* restore monotonically increasing stats */ @@ -2728,8 +2736,9 @@ VLockVolumeNB(Volume *vp, int locktype) { int code; - osi_Assert(programType != fileServer || VIsExclusiveState(V_attachState(vp))); - osi_Assert(!(V_attachFlags(vp) & VOL_LOCKED)); + opr_Assert(programType != fileServer + || VIsExclusiveState(V_attachState(vp))); + opr_Assert(!(V_attachFlags(vp) & VOL_LOCKED)); code = VLockVolumeByIdNB(vp->hashid, vp->partition, locktype); if (code == 0) { @@ -2751,8 +2760,9 @@ VLockVolumeNB(Volume *vp, int locktype) static void VUnlockVolume(Volume *vp) { - osi_Assert(programType != fileServer || VIsExclusiveState(V_attachState(vp))); - osi_Assert((V_attachFlags(vp) & VOL_LOCKED)); + opr_Assert(programType != fileServer + || VIsExclusiveState(V_attachState(vp))); + opr_Assert((V_attachFlags(vp) & VOL_LOCKED)); VUnlockVolumeById(vp->hashid, vp->partition); @@ -3068,12 +3078,14 @@ attach_check_vop(Error *ec, VolumeId volid, struct DiskPartition64 *partp, switch (vp->pending_vol_op->vol_op_state) { case FSSYNC_VolOpPending: /* this should never happen */ - osi_Assert(vp->pending_vol_op->vol_op_state != FSSYNC_VolOpPending); + opr_Assert(vp->pending_vol_op->vol_op_state + != FSSYNC_VolOpPending); break; case FSSYNC_VolOpRunningUnknown: /* this should never happen; we resolved 'unknown' above */ - osi_Assert(vp->pending_vol_op->vol_op_state != FSSYNC_VolOpRunningUnknown); + opr_Assert(vp->pending_vol_op->vol_op_state + != FSSYNC_VolOpRunningUnknown); break; case FSSYNC_VolOpRunningOffline: @@ -3528,7 +3540,7 @@ VAttachVolume_r(Error * ec, VolumeId volumeId, int mode) Error error; vp = VGetVolume_r(&error, volumeId); if (vp) { - osi_Assert(V_inUse(vp) == 0); + opr_Assert(V_inUse(vp) == 0); VDetachVolume_r(ec, vp); } return NULL; @@ -3687,7 +3699,8 @@ static const struct timespec * VOfflineTimeout(struct timespec *ats) { if (vol_shutting_down) { - osi_Assert(pthread_once(&shutdown_timeout_once, VShutdownTimeoutInit) == 0); + opr_Verify(pthread_once(&shutdown_timeout_once, + VShutdownTimeoutInit) == 0); return shutdown_timeout; } else { return VCalcTimeout(ats, vol_opts.offline_timeout); @@ -3843,7 +3856,7 @@ VDeregisterCall_r(Volume *vp, struct VCallByVol *cbv) void VPutVolume_r(Volume * vp) { - osi_Assert(--vp->nUsers >= 0); + opr_Verify(--vp->nUsers >= 0); if (vp->nUsers == 0) { VCheckOffline(vp); ReleaseVolumeHeader(vp->header); @@ -4171,7 +4184,7 @@ GetVolume(Error * ec, Error * client_ec, VolId volumeId, Volume * hint, * conflicting vol op. (attach2 would have errored out if we had one; * specifically attach_check_vop must have detected a conflicting vop) */ - osi_Assert(!vp->pending_vol_op || vp->pending_vol_op->vol_op_state == FSSYNC_VolOpRunningOnline); + opr_Assert(!vp->pending_vol_op || vp->pending_vol_op->vol_op_state == FSSYNC_VolOpRunningOnline); #endif /* AFS_DEMAND_ATTACH_FS */ @@ -4222,7 +4235,7 @@ GetVolume(Error * ec, Error * client_ec, VolId volumeId, Volume * hint, #else /* AFS_PTHREAD_ENV */ /* LWP has no timed wait, so the caller better not be * expecting one */ - osi_Assert(!timeout); + opr_Assert(!timeout); LWP_WaitProcess(VPutVolume); #endif /* AFS_PTHREAD_ENV */ continue; @@ -4269,7 +4282,7 @@ GetVolume(Error * ec, Error * client_ec, VolId volumeId, Volume * hint, #endif /* AFS_DEMAND_ATTACH_FS */ not_inited: - osi_Assert(vp || *ec); + opr_Assert(vp || *ec); return vp; } @@ -4285,8 +4298,8 @@ VTakeOffline_r(Volume * vp) { Error error; - osi_Assert(vp->nUsers > 0); - osi_Assert(programType == fileServer); + opr_Assert(vp->nUsers > 0); + opr_Assert(programType == fileServer); VCreateReservation_r(vp); VWaitExclusiveState_r(vp); @@ -4301,8 +4314,8 @@ VTakeOffline_r(Volume * vp) void VTakeOffline_r(Volume * vp) { - osi_Assert(vp->nUsers > 0); - osi_Assert(programType == fileServer); + opr_Assert(vp->nUsers > 0); + opr_Assert(programType == fileServer); vp->goingOffline = 1; V_needsSalvaged(vp) = 1; @@ -4563,7 +4576,7 @@ VOffline_r(Volume * vp, char *message) VolumeId vid = V_id(vp); #endif - osi_Assert(programType != volumeUtility && programType != volumeServer); + opr_Assert(programType != volumeUtility && programType != volumeServer); if (!V_inUse(vp)) { VPutVolume_r(vp); return; @@ -4617,7 +4630,7 @@ void VOfflineForVolOp_r(Error *ec, Volume *vp, char *message) { int salvok = 1; - osi_Assert(vp->pending_vol_op); + opr_Assert(vp->pending_vol_op); if (!V_inUse(vp)) { VPutVolume_r(vp); *ec = 1; @@ -4932,9 +4945,9 @@ VSyncVolume_r(Error * ec, Volume * vp, int flags) VOL_UNLOCK; #endif fdP = IH_OPEN(V_diskDataHandle(vp)); - osi_Assert(fdP != NULL); + opr_Assert(fdP != NULL); code = FDH_SYNC(fdP); - osi_Assert(code == 0); + opr_Assert(code == 0); FDH_CLOSE(fdP); #ifdef AFS_DEMAND_ATTACH_FS VOL_LOCK; @@ -5080,8 +5093,8 @@ VCheckOffline(Volume * vp) if (vp->goingOffline && !vp->nUsers) { Error error; - osi_Assert(programType == fileServer); - osi_Assert((V_attachState(vp) != VOL_STATE_ATTACHED) && + opr_Assert(programType == fileServer); + opr_Assert((V_attachState(vp) != VOL_STATE_ATTACHED) && (V_attachState(vp) != VOL_STATE_FREED) && (V_attachState(vp) != VOL_STATE_PREATTACHED) && (V_attachState(vp) != VOL_STATE_UNATTACHED) && @@ -5141,7 +5154,7 @@ VCheckOffline(Volume * vp) if (vp->goingOffline && !vp->nUsers) { Error error; - osi_Assert(programType == fileServer); + opr_Assert(programType == fileServer); ret = 1; vp->goingOffline = 0; @@ -5211,7 +5224,7 @@ VCheckOffline(Volume * vp) void VCancelReservation_r(Volume * vp) { - osi_Assert(--vp->nWaiters >= 0); + opr_Verify(--vp->nWaiters >= 0); if (vp->nWaiters == 0) { VCheckOffline(vp); if (!VCheckDetach(vp)) { @@ -5268,7 +5281,7 @@ VRegisterVolOp_r(Volume * vp, FSSYNC_VolOp_info * vopinfo) /* attach a vol op info node to the volume struct */ info = malloc(sizeof(FSSYNC_VolOp_info)); - osi_Assert(info != NULL); + opr_Assert(info != NULL); memcpy(info, vopinfo, sizeof(FSSYNC_VolOp_info)); vp->pending_vol_op = info; @@ -5771,7 +5784,7 @@ VScheduleSalvage_r(Volume * vp) VThreadOptions_t * thread_opts; char partName[16]; - osi_Assert(VCanUseSALVSYNC() || VCanUseFSSYNC()); + opr_Verify(VCanUseSALVSYNC() || VCanUseFSSYNC()); if (vp->nWaiters || vp->nUsers) { return VCHECK_SALVAGE_ASYNC; @@ -5816,8 +5829,8 @@ VScheduleSalvage_r(Volume * vp) state_save = VChangeState_r(vp, VOL_STATE_SALVSYNC_REQ); VOL_UNLOCK; - osi_Assert(try_SALVSYNC(vp, partName, &code) || - try_FSSYNC(vp, partName, &code)); + opr_Verify(try_SALVSYNC(vp, partName, &code) + || try_FSSYNC(vp, partName, &code)); VOL_LOCK; VChangeState_r(vp, state_save); @@ -5868,7 +5881,7 @@ VScheduleSalvage_r(Volume * vp) * this, as the caller may reference vp without any refs. Instead, it * is the duty of the caller to inspect 'vp' after we return to see if * needs to be freed. */ - osi_Assert(--vp->nWaiters >= 0); + opr_Verify(--vp->nWaiters >= 0); return ret; } #endif /* SALVSYNC_BUILD_CLIENT || FSSYNC_BUILD_CLIENT */ @@ -6084,7 +6097,7 @@ int VConnectFS_r(void) { int rc; - osi_Assert((VInit == 2) && + opr_Assert((VInit == 2) && (programType != fileServer) && (programType != salvager)); rc = FSYNC_clientInit(); @@ -6113,7 +6126,7 @@ VConnectFS_r(void) void VDisconnectFS_r(void) { - osi_Assert((programType != fileServer) && + opr_Assert((programType != fileServer) && (programType != salvager)); FSYNC_clientFinis(); VSetVInit_r(2); @@ -6444,13 +6457,13 @@ VGetBitmap_r(Error * ec, Volume * vp, VnodeClass class) VOL_UNLOCK; fdP = IH_OPEN(vip->handle); - osi_Assert(fdP != NULL); + opr_Assert(fdP != NULL); file = FDH_FDOPEN(fdP, "r"); - osi_Assert(file != NULL); + opr_Assert(file != NULL); vnode = malloc(vcp->diskSize); - osi_Assert(vnode != NULL); + opr_Assert(vnode != NULL); size = OS_SIZE(fdP->fd_fd); - osi_Assert(size != -1); + opr_Assert(size != -1); nVnodes = (size <= vcp->diskSize ? 0 : size - vcp->diskSize) >> vcp->logSize; vip->bitmapSize = ((nVnodes / 8) + 10) / 4 * 4; /* The 10 is a little extra so @@ -6460,10 +6473,10 @@ VGetBitmap_r(Error * ec, Volume * vp, VnodeClass class) * it that way */ #ifdef BITMAP_LATER BitMap = (byte *) calloc(1, vip->bitmapSize); - osi_Assert(BitMap != NULL); + opr_Assert(BitMap != NULL); #else /* BITMAP_LATER */ vip->bitmap = (byte *) calloc(1, vip->bitmapSize); - osi_Assert(vip->bitmap != NULL); + opr_Assert(vip->bitmap != NULL); vip->bitmapOffset = 0; #endif /* BITMAP_LATER */ if (STREAM_ASEEK(file, vcp->diskSize) != -1) { @@ -6860,7 +6873,7 @@ VAddToVolumeUpdateList_r(Error * ec, Volume * vp) sizeof(VolumeId) * updateSize); } } - osi_Assert(UpdateList != NULL); + opr_Assert(UpdateList != NULL); UpdateList[nUpdatedVolumes++] = V_id(vp); #endif /* !AFS_DEMAND_ATTACH_FS */ } @@ -7135,9 +7148,11 @@ VInitVLRU(void) volume_LRU.scanner_state = VLRU_SCANNER_STATE_OFFLINE; if (programType == fileServer) { CV_INIT(&volume_LRU.cv, "vol lru", CV_DEFAULT, 0); - osi_Assert(pthread_attr_init(&attrs) == 0); - osi_Assert(pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED) == 0); - osi_Assert(pthread_create(&tid, &attrs, &VLRU_ScannerThread, NULL) == 0); + opr_Verify(pthread_attr_init(&attrs) == 0); + opr_Verify(pthread_attr_setdetachstate(&attrs, + PTHREAD_CREATE_DETACHED) == 0); + opr_Verify(pthread_create(&tid, &attrs, + &VLRU_ScannerThread, NULL) == 0); } } @@ -7163,7 +7178,7 @@ VLRU_Init_Node_r(Volume * vp) if (!VLRU_enabled) return; - osi_Assert(queue_IsNotOnQueue(&vp->vlru)); + opr_Assert(queue_IsNotOnQueue(&vp->vlru)); vp->vlru.idx = VLRU_QUEUE_INVALID; } @@ -7307,7 +7322,7 @@ VLRU_UpdateAccess_r(Volume * vp) if (queue_IsNotOnQueue(&vp->vlru)) return; - osi_Assert(V_attachFlags(vp) & VOL_ON_VLRU); + opr_Assert(V_attachFlags(vp) & VOL_ON_VLRU); /* update the access timestamp */ vp->stats.last_get = FT_ApproxTime(); @@ -7619,7 +7634,7 @@ VLRU_Demote_r(int idx) Volume ** salv_flag_vec = NULL; int salv_vec_offset = 0; - osi_Assert(idx == VLRU_QUEUE_MID || idx == VLRU_QUEUE_OLD); + opr_Assert(idx == VLRU_QUEUE_MID || idx == VLRU_QUEUE_OLD); /* get exclusive access to two chains, and drop the glock */ VLRU_Wait_r(&volume_LRU.q[idx-1]); @@ -7718,7 +7733,7 @@ VLRU_Scan_r(int idx) Volume * vp; int i, locked = 1; - osi_Assert(idx == VLRU_QUEUE_NEW || idx == VLRU_QUEUE_CANDIDATE); + opr_Assert(idx == VLRU_QUEUE_NEW || idx == VLRU_QUEUE_CANDIDATE); /* gain exclusive access to the idx VLRU */ VLRU_Wait_r(&volume_LRU.q[idx]); @@ -7809,7 +7824,7 @@ VCheckSoftDetachCandidate(Volume * vp, afs_uint32 thresh) idx = vp->vlru.idx; - osi_Assert(idx == VLRU_QUEUE_NEW); + opr_Assert(idx == VLRU_QUEUE_NEW); if (vp->stats.last_get <= thresh) { /* move to candidate pool */ @@ -7829,7 +7844,7 @@ VCheckSoftDetachCandidate(Volume * vp, afs_uint32 thresh) static void VLRU_BeginExclusive_r(struct VLRU_q * q) { - osi_Assert(q->busy == 0); + opr_Assert(q->busy == 0); q->busy = 1; } @@ -7837,7 +7852,7 @@ VLRU_BeginExclusive_r(struct VLRU_q * q) static void VLRU_EndExclusive_r(struct VLRU_q * q) { - osi_Assert(q->busy); + opr_Assert(q->busy); q->busy = 0; CV_BROADCAST(&q->cv); } @@ -7861,7 +7876,7 @@ VSoftDetachVolume_r(Volume * vp, afs_uint32 thresh) afs_uint32 ts_save; int ret = 0; - osi_Assert(vp->vlru.idx == VLRU_QUEUE_CANDIDATE); + opr_Assert(vp->vlru.idx == VLRU_QUEUE_CANDIDATE); ts_save = vp->stats.last_get; if (ts_save > thresh) @@ -7916,7 +7931,7 @@ VSoftDetachVolume_r(Volume * vp, afs_uint32 thresh) vp = NULL; } else { /* pull it off the VLRU */ - osi_Assert(vp->vlru.idx == VLRU_QUEUE_CANDIDATE); + opr_Assert(vp->vlru.idx == VLRU_QUEUE_CANDIDATE); volume_LRU.q[VLRU_QUEUE_CANDIDATE].len--; queue_Remove(&vp->vlru); vp->vlru.idx = VLRU_QUEUE_INVALID; @@ -7978,7 +7993,7 @@ VInitVolumeHeaderCache(afs_uint32 howMany) volume_hdr_LRU.stats.used = howMany; volume_hdr_LRU.stats.attached = 0; hp = (struct volHeader *)(calloc(howMany, sizeof(struct volHeader))); - osi_Assert(hp != NULL); + opr_Assert(hp != NULL); while (howMany--) /* We are using ReleaseVolumeHeader to initialize the values on the header list @@ -8081,7 +8096,7 @@ GetVolumeHeader(Volume * vp) /* for volume utilities, we allocate volHeaders as needed */ if (!vp->header) { hd = calloc(1, sizeof(*vp->header)); - osi_Assert(hd != NULL); + opr_Assert(hd != NULL); vp->header = hd; hd->back = vp; #ifdef AFS_DEMAND_ATTACH_FS @@ -8095,7 +8110,7 @@ GetVolumeHeader(Volume * vp) * still available. pull it off the lru and return */ hd = vp->header; queue_Remove(hd); - osi_Assert(hd->back == vp); + opr_Assert(hd->back == vp); #ifdef AFS_DEMAND_ATTACH_FS V_attachFlags(vp) &= ~(VOL_HDR_IN_LRU); #endif @@ -8105,7 +8120,7 @@ GetVolumeHeader(Volume * vp) /* LRU is empty, so allocate a new volHeader * this is probably indicative of a leak, so let the user know */ hd = calloc(1, sizeof(struct volHeader)); - osi_Assert(hd != NULL); + opr_Assert(hd != NULL); if (!everLogged) { Log("****Allocated more volume headers, probably leak****\n"); everLogged = 1; @@ -8120,7 +8135,7 @@ GetVolumeHeader(Volume * vp) #ifdef AFS_DEMAND_ATTACH_FS /* GetVolHeaderFromLRU had better not give us back a header * with a volume in exclusive state... */ - osi_Assert(!VIsExclusiveState(V_attachState(hd->back))); + opr_Assert(!VIsExclusiveState(V_attachState(hd->back))); #endif if (hd->diskstuff.inUse) { @@ -8350,7 +8365,7 @@ VInitVolumeHash(void) VolumeHashTable.Table = (VolumeHashChainHead *) calloc(VolumeHashTable.Size, sizeof(VolumeHashChainHead)); - osi_Assert(VolumeHashTable.Table != NULL); + opr_Assert(VolumeHashTable.Table != NULL); for (i=0; i < VolumeHashTable.Size; i++) { queue_Init(&VolumeHashTable.Table[i]); @@ -8624,7 +8639,7 @@ VReorderHash_r(VolumeHashChainHead * head, Volume * pp, Volume * vp) static void VHashBeginExclusive_r(VolumeHashChainHead * head) { - osi_Assert(head->busy == 0); + opr_Assert(head->busy == 0); head->busy = 1; } @@ -8648,7 +8663,7 @@ VHashBeginExclusive_r(VolumeHashChainHead * head) static void VHashEndExclusive_r(VolumeHashChainHead * head) { - osi_Assert(head->busy); + opr_Assert(head->busy); head->busy = 0; CV_BROADCAST(&head->chain_busy_cv); } @@ -8788,7 +8803,7 @@ DeleteVolumeFromVByPList_r(Volume * vp) static void VVByPListBeginExclusive_r(struct DiskPartition64 * dp) { - osi_Assert(dp->vol_list.busy == 0); + opr_Assert(dp->vol_list.busy == 0); dp->vol_list.busy = 1; } @@ -8812,7 +8827,7 @@ VVByPListBeginExclusive_r(struct DiskPartition64 * dp) static void VVByPListEndExclusive_r(struct DiskPartition64 * dp) { - osi_Assert(dp->vol_list.busy); + opr_Assert(dp->vol_list.busy); dp->vol_list.busy = 0; CV_BROADCAST(&dp->vol_list.cv); } diff --git a/src/vol/volume.h b/src/vol/volume.h index f5f24e5..3072318 100644 --- a/src/vol/volume.h +++ b/src/vol/volume.h @@ -36,9 +36,9 @@ typedef bit32 FileOffset; /* Offset in this file */ #ifdef VOL_LOCK_DEBUG #define VOL_LOCK_ASSERT_HELD \ - osi_Assert(vol_glock_holder == pthread_self()) + opr_Assert(vol_glock_holder == pthread_self()) #define VOL_LOCK_ASSERT_UNHELD \ - osi_Assert(vol_glock_holder == 0) + opr_Assert(vol_glock_holder == 0) #define _VOL_LOCK_SET_HELD \ vol_glock_holder = pthread_self() #define _VOL_LOCK_SET_UNHELD \ diff --git a/src/vol/volume_inline.h b/src/vol/volume_inline.h index 4890582..58ac91b 100644 --- a/src/vol/volume_inline.h +++ b/src/vol/volume_inline.h @@ -48,7 +48,7 @@ VOL_CV_TIMEDWAIT(pthread_cond_t *cv, const struct timespec *ts, int *timedout) *timedout = 1; } } - osi_Assert(code == 0); + opr_Assert(code == 0); } #endif /* AFS_PTHREAD_ENV */ @@ -268,7 +268,7 @@ VVolLockType(int mode, int writable) return 0; default: - osi_Assert(0 /* unknown checkout mode */); + opr_Assert(0 /* unknown checkout mode */); return 0; } } @@ -453,11 +453,11 @@ VWaitStateChange_r(Volume * vp) { VolState state_save = V_attachState(vp); - osi_Assert(vp->nWaiters || vp->nUsers); + opr_Assert(vp->nWaiters || vp->nUsers); do { VOL_CV_WAIT(&V_attachCV(vp)); } while (V_attachState(vp) == state_save); - osi_Assert(V_attachState(vp) != VOL_STATE_FREED); + opr_Assert(V_attachState(vp) != VOL_STATE_FREED); } /** @@ -515,11 +515,11 @@ VTimedWaitStateChange_r(Volume * vp, const struct timespec *ts, int *atimedout) static_inline void VWaitExclusiveState_r(Volume * vp) { - osi_Assert(vp->nWaiters || vp->nUsers); + opr_Assert(vp->nWaiters || vp->nUsers); while (VIsExclusiveState(V_attachState(vp))) { VOL_CV_WAIT(&V_attachCV(vp)); } - osi_Assert(V_attachState(vp) != VOL_STATE_FREED); + opr_Assert(V_attachState(vp) != VOL_STATE_FREED); } /** diff --git a/src/vol/vutil.c b/src/vol/vutil.c index 3407d5a..6715d88 100644 --- a/src/vol/vutil.c +++ b/src/vol/vutil.c @@ -27,6 +27,7 @@ #include #endif +#include #include #include #include "nfs.h" @@ -1129,7 +1130,7 @@ VLockFileLock(struct VLockFile *lf, afs_uint32 offset, int locktype, int nonbloc { int code; - osi_Assert(locktype == READ_LOCK || locktype == WRITE_LOCK); + opr_Assert(locktype == READ_LOCK || locktype == WRITE_LOCK); MUTEX_ENTER(&lf->mutex); @@ -1164,7 +1165,7 @@ VLockFileUnlock(struct VLockFile *lf, afs_uint32 offset) { MUTEX_ENTER(&lf->mutex); - osi_Assert(lf->fd != INVALID_FD); + opr_Assert(lf->fd != INVALID_FD); if (--lf->refcount < 1) { _VCloseFd(lf->fd); @@ -1187,7 +1188,7 @@ VLockFileUnlock(struct VLockFile *lf, afs_uint32 offset) void VDiskLockInit(struct VDiskLock *dl, struct VLockFile *lf, afs_uint32 offset) { - osi_Assert(lf); + opr_Assert(lf); memset(dl, 0, sizeof(*dl)); Lock_Init(&dl->rwlock); MUTEX_INIT(&dl->mutex, "disklock", MUTEX_DEFAULT, 0); @@ -1222,7 +1223,7 @@ int VGetDiskLock(struct VDiskLock *dl, int locktype, int nonblock) { int code = 0; - osi_Assert(locktype == READ_LOCK || locktype == WRITE_LOCK); + opr_Assert(locktype == READ_LOCK || locktype == WRITE_LOCK); if (nonblock) { if (locktype == READ_LOCK) { @@ -1313,10 +1314,10 @@ VGetDiskLock(struct VDiskLock *dl, int locktype, int nonblock) void VReleaseDiskLock(struct VDiskLock *dl, int locktype) { - osi_Assert(locktype == READ_LOCK || locktype == WRITE_LOCK); + opr_Assert(locktype == READ_LOCK || locktype == WRITE_LOCK); MUTEX_ENTER(&dl->mutex); - osi_Assert(dl->lockers > 0); + opr_Assert(dl->lockers > 0); if (--dl->lockers < 1) { /* no threads are holding this lock anymore, so we can release the diff --git a/src/volser/dumpstuff.c b/src/volser/dumpstuff.c index 601fecc..9c12487 100644 --- a/src/volser/dumpstuff.c +++ b/src/volser/dumpstuff.c @@ -14,7 +14,7 @@ #include -#include +#include #include #include #include @@ -162,7 +162,7 @@ iod_Write(struct iod *iodp, char *buf, int nbytes) int code, i; int one_success = 0; - osi_Assert((iodp->call && iodp->ncalls == 1 && !iodp->calls) + opr_Assert((iodp->call && iodp->ncalls == 1 && !iodp->calls) || (!iodp->call && iodp->ncalls >= 1 && iodp->calls)); if (iodp->call) { @@ -980,15 +980,15 @@ DumpVnodeIndex(struct iod *iodp, Volume * vp, VnodeClass class, int vnodeIndex; fdP = IH_OPEN(vp->vnodeIndex[class].handle); - osi_Assert(fdP != NULL); + opr_Assert(fdP != NULL); file = FDH_FDOPEN(fdP, "r+"); - osi_Assert(file != NULL); + opr_Assert(file != NULL); size = OS_SIZE(fdP->fd_fd); - osi_Assert(size != -1); + opr_Assert(size != -1); nVnodes = (size / vcp->diskSize) - 1; if (nVnodes > 0) { - osi_Assert((nVnodes + 1) * vcp->diskSize == size); - osi_Assert(STREAM_ASEEK(file, vcp->diskSize) == 0); + opr_Assert((nVnodes + 1) * vcp->diskSize == size); + opr_Assert(STREAM_ASEEK(file, vcp->diskSize) == 0); } else nVnodes = 0; for (vnodeIndex = 0; @@ -1148,7 +1148,7 @@ ProcessIndex(Volume * vp, VnodeClass class, afs_foff_t ** Bufp, int *sizep, OS_SYNC(afile->str_fd); } else { size = OS_SIZE(fdP->fd_fd); - osi_Assert(size != -1); + opr_Assert(size != -1); nVnodes = (size <= vcp->diskSize ? 0 : size - vcp->diskSize) >> vcp->logSize; @@ -1858,15 +1858,15 @@ SizeDumpVnodeIndex(struct iod *iodp, Volume * vp, VnodeClass class, int vnodeIndex; fdP = IH_OPEN(vp->vnodeIndex[class].handle); - osi_Assert(fdP != NULL); + opr_Assert(fdP != NULL); file = FDH_FDOPEN(fdP, "r+"); - osi_Assert(file != NULL); + opr_Assert(file != NULL); size = OS_SIZE(fdP->fd_fd); - osi_Assert(size != -1); + opr_Assert(size != -1); nVnodes = (size / vcp->diskSize) - 1; if (nVnodes > 0) { - osi_Assert((nVnodes + 1) * vcp->diskSize == size); - osi_Assert(STREAM_ASEEK(file, vcp->diskSize) == 0); + opr_Assert((nVnodes + 1) * vcp->diskSize == size); + opr_Assert(STREAM_ASEEK(file, vcp->diskSize) == 0); } else nVnodes = 0; for (vnodeIndex = 0; diff --git a/src/volser/volmain.c b/src/volser/volmain.c index 7f5eeff..14bb2c0 100644 --- a/src/volser/volmain.c +++ b/src/volser/volmain.c @@ -11,6 +11,7 @@ #include #include +#include #ifdef AFS_NT40_ENV #include @@ -484,10 +485,10 @@ main(int argc, char **argv) #ifdef AFS_PTHREAD_ENV pthread_t tid; pthread_attr_t tattr; - osi_Assert(pthread_attr_init(&tattr) == 0); - osi_Assert(pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) == 0); - - osi_Assert(pthread_create(&tid, &tattr, BKGLoop, NULL) == 0); + opr_Verify(pthread_attr_init(&tattr) == 0); + opr_Verify(pthread_attr_setdetachstate(&tattr, + PTHREAD_CREATE_DETACHED) == 0); + opr_Verify(pthread_create(&tid, &tattr, BKGLoop, NULL) == 0); #else PROCESS pid; LWP_CreateProcess(BKGLoop, 16*1024, 3, 0, "vol bkg daemon", &pid); diff --git a/src/volser/volprocs.c b/src/volser/volprocs.c index c78a737..d622f71 100644 --- a/src/volser/volprocs.c +++ b/src/volser/volprocs.c @@ -14,7 +14,7 @@ #include -#include +#include #include #include #include @@ -354,7 +354,7 @@ ViceCreateRoot(Volume *vp) did.Vnode = (VnodeId) 1; did.Unique = 1; - osi_Assert(!(afs_dir_MakeDir(&dir, (afs_int32 *)&did, (afs_int32 *)&did))); + opr_Verify(!(afs_dir_MakeDir(&dir, (afs_int32 *)&did, (afs_int32 *)&did))); DFlush(); /* flush all modified dir buffers out */ DZap(&dir); /* Remove all buffers for this dir */ length = afs_dir_Length(&dir); /* Remember size of this directory */ @@ -394,9 +394,9 @@ ViceCreateRoot(Volume *vp) IH_INIT(h, vp->device, V_parentId(vp), vp->vnodeIndex[vLarge].handle->ih_ino); fdP = IH_OPEN(h); - osi_Assert(fdP != NULL); + opr_Assert(fdP != NULL); nBytes = FDH_PWRITE(fdP, vnode, SIZEOF_LARGEDISKVNODE, vnodeIndexOffset(vcp, 1)); - osi_Assert(nBytes == SIZEOF_LARGEDISKVNODE); + opr_Assert(nBytes == SIZEOF_LARGEDISKVNODE); FDH_REALLYCLOSE(fdP); IH_RELEASE(h); VNDISK_GET_LEN(length, vnode); diff --git a/src/volser/voltrans.c b/src/volser/voltrans.c index 6cd9361..d341a2b 100644 --- a/src/volser/voltrans.c +++ b/src/volser/voltrans.c @@ -19,6 +19,8 @@ #include +#include + #ifdef AFS_NT40_ENV #include #endif -- 1.9.4