$(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)
#define __AFS_SYSINCLUDESH__ 1
#include <stdio.h>
+#include <afs/opr.h>
+
#if !defined(AFS_USR_DARWIN_ENV) && !defined(AFS_USR_FBSD_ENV) && !defined(AFS_USR_DFBSD_ENV) /* must be included after KERNEL undef'd */
#include <errno.h>
#endif
#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()
_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
} else {
assert(code > 0);
if (wait) {
- assert(waitpid(code, NULL, 0) != -1);
+ opr_Verify(waitpid(code, NULL, 0) != -1);
}
}
return 0;
#define USING_HEIMDAL 1
#endif
-#include "assert.h"
#include "skipwrap.h"
/* This code borrowed heavily from the previous version of log. Here is the
#define AUDIT_FAIL_PRIV 4
#endif /* AFS_AIX32_ENV */
+#include <afs/opr.h>
#include "afs/afsint.h"
#include <rx/rx.h>
#include <rx/rxkad.h>
/* 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))
#include <roken.h>
#include <ctype.h>
+#include <afs/opr.h>
+
#include <rx/rx.h>
#include <afs/dirpath.h>
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;
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 =
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;
#include <roken.h>
+#include <afs/opr.h>
#include <afs/com_err.h>
#include <afs/bubasics.h>
#include <roken.h>
+#include <afs/opr.h>
#include <ubik.h>
#include <lock.h>
#include <afs/audit.h>
#include <roken.h>
+#include <afs/opr.h>
#include <lock.h>
#include <ubik.h>
#include <lwp.h>
-#include <rx/xdr.h>
#include <rx/rx.h>
#include <rx/rxkad.h>
#include <afs/cellconfig.h>
/* 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 =
#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 =
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)
#include <conio.h>
#endif
-#include <rx/xdr.h>
+#include <afs/opr.h>
#include <rx/rx.h>
#include <lwp.h>
#include <lock.h>
#include <CoreFoundation/CoreFoundation.h>
#endif
+#include <afs/opr.h>
#include <afs/errors.h>
#include <afs/afsutil.h>
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;
}
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
#include <afsconfig.h>
#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 <rx/rx.h>
+#define assert opr_Assert
/* hcrypto uses "static inline", which isn't supported by some of our
* compilers */
#include <afs/param.h>
#include <roken.h>
+#include <afs/opr.h>
#include <lock.h>
#include <afs/param.h>
#include <roken.h>
+#include <afs/opr.h>
#include <rx/xdr.h>
#include <rx/rx.h>
#include "acl.h"
#ifdef AFS_PTHREAD_ENV
-#include <assert.h>
#include <pthread.h>
pthread_mutex_t acl_list_mutex;
#endif /* AFS_PTHREAD_ENV */
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;
}
{
/* 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;
}
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;
}
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;
}
$(DESTDIR)\lib\afsrpc.lib \
$(DESTDIR)\lib\afspthread.lib \
$(DESTDIR)\lib\afs\afsutil.lib \
+ $(DESTDIR)\lib\opr.lib \
$(DESTDIR)\lib\afsroken.lib
$(DLLFILE): $(DLLOBJS) $(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)
$(DESTDIR)\lib\afsauthent.lib \
$(DESTDIR)\lib\afsrpc.lib \
$(DESTDIR)\lib\afs\afsutil.lib \
+ $(DESTDIR)\lib\opr.lib \
$(DESTDIR)\lib\afsroken.lib
$(DLLFILE): $(DLLOBJS) $(DLLLIBS)
#include <roken.h>
+#include <afs/opr.h>
+
#ifdef AFS_PTHREAD_ENV
#include <rx/rx.h>
#endif
#ifdef AFS_PTHREAD_ENV
#include <pthread.h>
/* can't include in non-lwp case; rx builds later */
+#include <afs/opr.h>
#include <rx/rx.h>
#define LOCK_LOCK(A) MUTEX_ENTER(&(A)->mutex);
#define LOCK_UNLOCK(A) MUTEX_EXIT(&(A)->mutex);
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
#include <sys/wait.h>
#endif
-#include <assert.h>
#include <limits.h>
#ifdef AFS_AIX51_ENV
#include <roken.h>
+#include <afs/opr.h>
#include <lock.h>
#include <ubik.h>
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));
return 0;
if (aid == tentry.id)
return entry;
- osi_Assert(entry != tentry.nextID);
+ opr_Assert(entry != tentry.nextID);
entry = tentry.nextID;
}
return 0;
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));
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;
if (code)
return PRDBFAIL;
while (aid != tentry.id) {
- osi_Assert(trail != current);
+ opr_Assert(trail != current);
trail = current;
current = tentry.nextID;
if (current == 0)
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)
# include <WINNT\afsreg.h>
# endif
+# include <afs/opr.h>
+
# include "rx_user.h"
#endif /* KERNEL */
#include <afs/param.h>
#include <roken.h>
+#include <afs/opr.h>
#include "rx.h"
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 */
# include <afsincludes.h>
#else
# include <roken.h>
+# include <afs/opr.h>
+
# include <afs/errors.h>
# include "xdr.h"
# ifdef AFS_PTHREAD_ENV
# include "afs/sysincludes.h"
#else /* KERNEL */
# include <roken.h>
+# include <afs/opr.h>
#endif /* KERNEL */
#include "rx.h"
#else /* KERNEL */
# include <roken.h>
# include <assert.h>
+# include <afs/opr.h>
# if defined(AFS_NT40_ENV)
# ifndef EWOULDBLOCK
# define EWOULDBLOCK WSAEWOULDBLOCK
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);
/* Block signals to child threads. */
#include <afs/pthread_nosigs.h>
+#include <afs/opr.h>
#ifdef AFS_NT40_ENV
#include <wtypes.h>
#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
#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
#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 */
# include "afs/lock.h"
#else /* KERNEL */
# include <roken.h>
+# include <afs/opr.h>
#endif /* KERNEL */
#include "rx.h"
#if !defined(KERNEL)
#include <roken.h>
+#include <afs/opr.h>
#endif
#ifdef KERNEL
#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,
f_print(fout, "#include <afsconfig.h>\n");
f_print(fout, "#include <afs/param.h>\n");
f_print(fout, "#include <roken.h>\n");
+ f_print(fout, "#include <afs/opr.h>\n");
f_print(fout, "#include \"%s\"\n\n", include);
}
free(include);
#else /* KERNEL */
#include <roken.h>
+#include <afs/opr.h>
+
#include <rx/rx.h>
#include <rx/rx_packet.h>
#endif /* KERNEL */
#endif /* !UKERNEL */
#else /* !KERNEL */
#include <roken.h>
+#include <afs/opr.h>
#endif /* KERNEL */
#include <rx/rx.h>
#else /* KERNEL */
# include <roken.h>
+# include <afs/opr.h>
# include <rx/rx.h>
#endif /* KERNEL */
#endif /* !UKERNEL */
#else /* ! KERNEL */
#include <roken.h>
+#include <afs/opr.h>
#endif /* KERNEL */
#endif /* !UKERNEL */
#else /* KERNEL */
#include <roken.h>
+#include <afs/opr.h>
#if defined(AFS_NT40_ENV) && defined(AFS_PTHREAD_ENV)
#define RXKAD_STATS_DECLSPEC __declspec(dllexport)
#endif
-#include <afs/afsutil.h>
#endif /* KERNEL */
#include <rx/rx.h>
#include <sys/systm.h>
#endif
+#include <afs/opr.h>
#include <rx/rx.h>
#include <rx/xdr.h>
#include <rx/rx_packet.h>
= 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
#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) \
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
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
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
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
#include <roken.h>
+#include <afs/opr.h>
#include <lock.h>
-#include <rx/xdr.h>
#include <rx/rx.h>
#include <rx/rxkad.h>
#include <rx/rx_multi.h>
#include <afs/param.h>
#include <roken.h>
+#include <afs/opr.h>
#include <lock.h>
-#include <rx/xdr.h>
#define UBIK_INTERNALS
#include "ubik.h"
#include <roken.h>
+#include <afs/opr.h>
#include <lock.h>
-#include <rx/xdr.h>
#define UBIK_INTERNALS 1
#include "ubik.h"
#include <roken.h>
+#include <afs/opr.h>
#include <lock.h>
#include <rx/xdr.h>
#include <rx/rx.h>
}
}
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();
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
#include <roken.h>
+#include <afs/opr.h>
#include <lock.h>
-#include <rx/xdr.h>
#include <rx/rx.h>
#include <afs/cellconfig.h>
#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
#include <afs/stds.h>
#include <roken.h>
+#include <afs/opr.h>
#ifdef IGNORE_SOME_GCC_WARNINGS
# pragma GCC diagnostic warning "-Wstrict-prototypes"
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;
}
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)
#include <roken.h>
+#include <afs/opr.h>
#include <lock.h>
-#include <rx/xdr.h>
#include <rx/rx.h>
#include <afs/afsutil.h>
#include <roken.h> /* Must come after procmgmt.h */
#include <afs/opr.h>
+#include <afs/opr.h>
#include "afsutil.h"
#include "fileutil.h"
#include <lwp.h>
#include <afs/param.h>
#include <roken.h>
+#include <afs/opr.h>
#include <lock.h>
#include <afs/afsutil.h>
/* 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) {
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);
#include <afs/param.h>
#include <roken.h>
+#include <afs/opr.h>
+
#include <sys/file.h>
#include <lock.h>
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) {
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);
{
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);
}
#endif
#include <hcrypto/md5.h>
#ifdef AFS_PTHREAD_ENV
-#include <assert.h>
pthread_key_t uclient_key;
#endif
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,
#endif
#endif /* AFS_HPUX_ENV */
-#include <rx/xdr.h>
+#include <afs/opr.h>
#include <afs/nfs.h>
#include <lwp.h>
#include <lock.h>
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) {
*volptr = VGetVolumeWithCall(&local_errorCode, &errorCode,
fid->Volume, ts, cbv);
if (!errorCode) {
- osi_Assert(*volptr);
+ opr_Assert(*volptr);
break;
}
if ((errorCode == VOFFLINE) && (VInit < 2)) {
return (errorCode);
}
}
- osi_Assert(*volptr);
+ opr_Assert(*volptr);
/* get the vnode */
*vptr = VGetVnode(&errorCode, *volptr, fid->Vnode, lock);
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 */
}
*ACLSize = VAclSize(*targetptr);
return (0);
} else {
- osi_Assert(Fid != 0);
+ opr_Assert(Fid != 0);
while (1) {
VnodeId parentvnode;
Error errorCode = 0;
(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;
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);
}
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) {
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);
if (parentwhentargetnotdir != NULL) {
tparentwhentargetnotdir = *parentwhentargetnotdir;
VPutVnode(&fileCode, parentwhentargetnotdir);
- osi_Assert(!fileCode || (fileCode == VSALVAGE));
+ opr_Assert(!fileCode || (fileCode == VSALVAGE));
parentwhentargetnotdir = NULL;
}
rx_KeepAliveOff(acall);
VPutVnode(&fileCode, parentwhentargetnotdir);
rx_KeepAliveOn(acall);
- osi_Assert(!fileCode || (fileCode == VSALVAGE));
+ opr_Assert(!fileCode || (fileCode == VSALVAGE));
parentwhentargetnotdir = NULL;
}
/* 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);
/* 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);
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);
}
/* 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);
}
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)) {
errorCode = EIO;
goto Bad_Rename;
}
- osi_Assert(errorCode == 0);
+ opr_Assert(errorCode == 0);
}
}
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--;
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,
/* 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 */
/* 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);
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);
/* 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);
/* 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);
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 */
/* 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));
/* 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);
/* 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);
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);
}
{
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 */
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
#include <sys/file.h>
#endif
+#include <afs/opr.h>
#include <afs/nfs.h> /* yuck. This is an abomination. */
#include <lwp.h>
#include <rx/rx.h>
while (*p && *p != fei)
p = &itofe(*p)->fnext;
- osi_Assert(*p);
+ opr_Assert(*p);
*p = fe->fnext;
FreeFE(fe);
return 0;
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);
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
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)));
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),
#include <assert.h>
#include <roken.h>
+#include <afs/opr.h>
#include <afs/afsint.h>
#include <afs/ihandle.h>
#include <afs/nfs.h>
if (code)
return code;
- osi_Assert(pthread_setspecific(viced_uclient_key, *client) == 0);
+ opr_Verify(pthread_setspecific(viced_uclient_key, *client) == 0);
return 0;
}
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) &&
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;
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",
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),
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) {
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
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),
("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);
}
}
int
h_ReleaseClient_r(struct client *client)
{
- osi_Assert(client->refCount > 0);
+ opr_Assert(client->refCount > 0);
client->refCount--;
return 0;
}
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;
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;
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++;
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++;
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)) {
/* 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;
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 */
interface->uuid = interf->uuid;
- osi_Assert(!host->interface);
+ opr_Assert(!host->interface);
host->interface = interface;
if (LogLevel >= 125) {
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),
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;\
#include <afs/stds.h>
-#include <rx/xdr.h>
+#include <afs/opr.h>
#include <lwp.h>
#include <lock.h>
#include <afs/afsint.h>
#undef SHARED
-#include <rx/xdr.h>
+#include <afs/opr.h>
#include <afs/nfs.h>
#include <lwp.h>
#include <lock.h>
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 */
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
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;
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);
#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
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;
}
#include <roken.h>
-#include <rx/xdr.h>
+#include <afs/opr.h>
#include <afs/afsint.h>
#include <afs/errors.h>
#include <afs/afssyscalls.h>
#include <WINNT/afsevent.h>
#endif
-#include <rx/xdr.h>
+#include <afs/opr.h>
#include <afs/afsint.h>
#ifndef AFS_NT40_ENV
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);
#include <roken.h>
-#include <rx/xdr.h>
+#include <afs/opr.h>
#include <afs/afsint.h>
#include "nfs.h"
#include <afs/errors.h>
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 */
}
/* 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);
state->fd = SYNC_getSock(&state->endpoint);
code = SYNC_bindSock(state);
- osi_Assert(!code);
+ opr_Assert(!code);
#ifdef AFS_DEMAND_ATTACH_FS
/*
}
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();
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));
}
}
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 {
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);
}
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) {
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);
}
}
AcceptOff(void)
{
if (AcceptHandler != -1) {
- osi_Assert(RemoveHandler(fssync_server_state.fd));
+ opr_Verify(RemoveHandler(fssync_server_state.fd));
AcceptHandler = -1;
}
}
return i;
}
ReleaseReadLock(&FSYNC_handler_lock); /* just in case */
- osi_Assert(1 == 2);
+ opr_abort();
return -1; /* satisfy compiler */
}
if (HandlerFD[i] == afd) {
return i;
}
- osi_Assert(1 == 2);
+ opr_abort();
return -1; /* satisfy compiler */
}
ObtainReadLock(&FSYNC_handler_lock);
for (i = 0; i < MAXHANDLERS; i++)
if (HandlerFD[i] != OSI_NULLSOCKET) {
- osi_Assert(fdi<maxfds);
+ opr_Assert(fdi<maxfds);
fds[fdi].fd = HandlerFD[i];
fds[fdi].events = events;
fds[fdi].revents = 0;
#include <sys/resource.h>
#endif
-#include <rx/xdr.h>
+#include <afs/opr.h>
#include <afs/afsint.h>
#include <afs/afssyscalls.h>
#include <afs/afsutil.h>
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);
#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
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 */
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);
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;
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;
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;
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,
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++;
* 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);
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;
}
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;
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;
} 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) {
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;
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;
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,
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);
*/
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) {
* 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) {
}
IH_LOCK;
- osi_Assert(fdInUseCount >= closeCount);
+ opr_Assert(fdInUseCount >= closeCount);
fdInUseCount -= closeCount;
/*
IH_LOCK;
}
- osi_Assert(ihP->ih_refcnt > 0);
+ opr_Assert(ihP->ih_refcnt > 0);
ih_fdclose(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--;
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)
else \
(head) = (ptr)->next; \
(ptr)->next = (ptr)->prev = NULL; \
- osi_Assert(!(head) || !((head)->prev)); \
+ opr_Assert(!(head) || !((head)->prev)); \
} while(0)
/*
(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 */
#include <afs/param.h>
#include <roken.h>
+#include <afs/opr.h>
#include <ctype.h>
* 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) {
#include <direct.h>
#endif
+#include <afs/opr.h>
#include <lock.h>
#include <afs/afsutil.h>
#include <lwp.h>
static void
_namei_wq_keycreate(void)
{
- osi_Assert(pthread_key_create(&wq_key, NULL) == 0);
+ opr_Verify(pthread_key_create(&wq_key, NULL) == 0);
}
/**
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);
}
/**
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) {
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)
#include <roken.h>
-#include <rx/xdr.h>
+#include <afs/opr.h>
#include <afs/afsint.h>
#include <afs/afsutil.h>
#include <mntent.h>
#endif
-#include <rx/xdr.h>
+#include <afs/opr.h>
#include <afs/afsint.h>
#include "nfs.h"
#include <afs/errors.h>
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);
}
#endif /* AFS_DEMAND_ATTACH_FS */
if (abortp)
- osi_Assert(dp != NULL);
+ opr_Assert(dp != NULL);
return dp;
}
(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);
}
}
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,
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
}
}
if (abortp) {
- osi_Assert(dp != NULL);
+ opr_Assert(dp != NULL);
}
return dp;
}
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;
}
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
#include <roken.h>
-#include <assert.h>
-
#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
#endif
#define WCOREDUMP(x) ((x) & 0200)
#endif
-#include <rx/xdr.h>
+#include <afs/opr.h>
#include <afs/afsint.h>
#if !defined(AFS_SGI_ENV) && !defined(AFS_NT40_ENV)
ObtainSharedSalvageLock();
child_slot = calloc(Parallel, sizeof(int));
- osi_Assert(child_slot != NULL);
+ opr_Assert(child_slot != NULL);
/* initialize things */
VOptDefaults(salvageServer, &opts);
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);
if (!child_slot[slot])
break;
}
- osi_Assert (slot < Parallel);
+ opr_Assert (slot < Parallel);
do_fork:
pid = Fork();
if (child_slot[slot] == pid)
break;
}
- osi_Assert(slot < Parallel);
+ opr_Assert(slot < Parallel);
child_slot[slot] = 0;
VOL_UNLOCK;
prefix_len = strlen(prefix);
dp = opendir(AFSDIR_LOGS_DIR);
- osi_Assert(dp);
+ opr_Assert(dp);
while ((dirp = readdir(dp)) != NULL) {
pid_t pid;
}
/* 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
/* 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);
state->fd = SYNC_getSock(&state->endpoint);
code = SYNC_bindSock(state);
- osi_Assert(!code);
+ opr_Assert(!code);
InitHandler();
AcceptOn();
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));
}
}
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);
}
}
AcceptOff(void)
{
if (AcceptHandler != -1) {
- osi_Assert(RemoveHandler(salvsync_server_state.fd));
+ opr_Verify(RemoveHandler(salvsync_server_state.fd));
AcceptHandler = -1;
}
}
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;
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);
#ifdef AFS_DEMAND_ATTACH_FS
+#include <afs/opr.h>
#include <lock.h>
#include <afs/afsutil.h>
#include <lwp.h>
{
int code = 0;
- osi_Assert(entry->refcnt == 0);
+ opr_Assert(entry->refcnt == 0);
free(entry);
return code;
{
int code = 0;
- osi_Assert(entry->refcnt > 0);
+ opr_Assert(entry->refcnt > 0);
if (--entry->refcnt == 0) {
VVGCache_entry_t *nentry;
}
}
- osi_Assert(!child_ent);
+ opr_Assert(!child_ent);
child_ent = parent_ent;
code = _VVGC_hash_entry_add(dp,
child,
#ifdef AFS_DEMAND_ATTACH_FS
+#include <afs/opr.h>
#include <lock.h>
#include <afs/afsutil.h>
#include <lwp.h>
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:
#include <sys/file.h>
#endif
-#include <rx/xdr.h>
+#include <afs/opr.h>
#include "rx/rx_queue.h"
#include <afs/afsint.h>
#include "nfs.h"
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;
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 */
VnChangeState_r(vnp, VN_STATE_ERROR);
VRequestSalvage_r(ec, vp, SALVSYNC_ERROR, 0);
#else
- osi_Assert(1 == 2);
+ opr_abort();
#endif
}
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
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 */
#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 {
#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
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)
#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 {
#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:
#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:
{
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));
}
/**
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));
}
/**
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));
}
/**
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);
}
/**
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));
#ifndef WCOREDUMP
#define WCOREDUMP(x) ((x) & 0200)
#endif
-#include <rx/xdr.h>
+#include <afs/opr.h>
#include <afs/afsint.h>
#if !defined(AFS_SGI_ENV) && !defined(AFS_NT40_ENV)
#if defined(AFS_VFSINCL_ENV)
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;
* 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);
}
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)) {
}
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++) {
}
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;
}
salvinfo->volumeSummaryp = calloc(nvols, sizeof(struct VolumeSummary));
- osi_Assert(salvinfo->volumeSummaryp != NULL);
+ opr_Assert(salvinfo->volumeSummaryp != NULL);
params.singleVolumeNumber = singleVolumeNumber;
params.vsp = salvinfo->volumeSummaryp;
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 */
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;
}
}
} /* 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 */
}
}
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
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,
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
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);
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);
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);
FDH_REALLYCLOSE(fdP);
code = IH_DEC(dir->ds_linkH, oldinode, dir->rwVid);
- osi_Assert(code == 0);
+ opr_Assert(code == 0);
dir->dirHandle = newdir;
}
}
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;
}
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;
}
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;
}
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 */
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);
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;
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 */
}
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 */
}
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;
}
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;
}
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);
}
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;
}
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)];
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,
&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.
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);
}
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 */
}
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;
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++;
}
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));
}
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;
}
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",
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));
}
}
* 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);
}
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);
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,
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 */
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)
{
char *p;
p = strdup(s);
- osi_Assert(p != NULL);
+ opr_Assert(p != NULL);
return p;
}
#include <sys/file.h>
#endif
-#include <rx/xdr.h>
+#include <afs/opr.h>
#include <afs/afsint.h>
#ifndef AFS_NT40_ENV
} 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);
#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 */
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;
int
VInitAttachVolumes(ProgramType pt)
{
- osi_Assert(VInit==1);
+ opr_Assert(VInit==1);
if (pt == fileServer) {
struct DiskPartition64 *diskP;
struct vinitvolumepackage_thread_t params;
/* 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);
}
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",
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();
}
}
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 */
diskP = dpq->diskP;
free(dpq);
- osi_Assert(VAttachVolumesByPartition(diskP, &nAttached, &nUnattached) == 0);
+ opr_Verify(VAttachVolumesByPartition(diskP, &nAttached,
+ &nUnattached) == 0);
VOL_LOCK;
}
int
VInitAttachVolumes(ProgramType pt)
{
- osi_Assert(VInit==1);
+ opr_Assert(VInit==1);
if (pt == fileServer) {
struct DiskPartition64 *diskP;
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);
}
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",
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);
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;
}
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;
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;
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);
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
/* 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);
/* 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 */
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);
void
VShutdown(void)
{
- osi_Assert(VInit>0);
+ opr_Assert(VInit>0);
VOL_LOCK;
VShutdown_r();
VOL_UNLOCK;
VOL_LOCK;
pass = params->pass;
- osi_Assert(pass > 0);
+ opr_Assert(pass > 0);
/* now escalate through the more complicated shutdowns */
while (pass <= 3) {
/* 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:
*ec = 0;
- osi_Assert(programType == fileServer);
+ opr_Assert(programType == fileServer);
if (!(partp = VGetPartition_r(partition, 0))) {
*ec = VNOVOL;
/* 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);
}
if (VRequiresPartLock()) {
- osi_Assert(VInit == 3);
+ opr_Assert(VInit == 3);
VLockPartition_r(partition);
} else if (programType == fileServer) {
#ifdef AFS_DEMAND_ATTACH_FS
}
}
- osi_Assert(vp != NULL);
+ opr_Assert(vp != NULL);
/* handle pre-attach races
*
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;
*ec = 0;
/* volume utility should never call AttachByVp */
- osi_Assert(programType == fileServer);
+ opr_Assert(programType == fileServer);
volumeId = vp->hashid;
partp = vp->partition;
}
}
- osi_Assert(vp != NULL);
+ opr_Assert(vp != NULL);
VChangeState_r(vp, VOL_STATE_ATTACHING);
/* restore monotonically increasing stats */
{
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) {
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);
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:
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;
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);
void
VPutVolume_r(Volume * vp)
{
- osi_Assert(--vp->nUsers >= 0);
+ opr_Verify(--vp->nUsers >= 0);
if (vp->nUsers == 0) {
VCheckOffline(vp);
ReleaseVolumeHeader(vp->header);
* 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 */
#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;
#endif /* AFS_DEMAND_ATTACH_FS */
not_inited:
- osi_Assert(vp || *ec);
+ opr_Assert(vp || *ec);
return 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);
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;
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;
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;
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;
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) &&
if (vp->goingOffline && !vp->nUsers) {
Error error;
- osi_Assert(programType == fileServer);
+ opr_Assert(programType == fileServer);
ret = 1;
vp->goingOffline = 0;
void
VCancelReservation_r(Volume * vp)
{
- osi_Assert(--vp->nWaiters >= 0);
+ opr_Verify(--vp->nWaiters >= 0);
if (vp->nWaiters == 0) {
VCheckOffline(vp);
if (!VCheckDetach(vp)) {
/* 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;
VThreadOptions_t * thread_opts;
char partName[16];
- osi_Assert(VCanUseSALVSYNC() || VCanUseFSSYNC());
+ opr_Verify(VCanUseSALVSYNC() || VCanUseFSSYNC());
if (vp->nWaiters || vp->nUsers) {
return VCHECK_SALVAGE_ASYNC;
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);
* 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 */
VConnectFS_r(void)
{
int rc;
- osi_Assert((VInit == 2) &&
+ opr_Assert((VInit == 2) &&
(programType != fileServer) &&
(programType != salvager));
rc = FSYNC_clientInit();
void
VDisconnectFS_r(void)
{
- osi_Assert((programType != fileServer) &&
+ opr_Assert((programType != fileServer) &&
(programType != salvager));
FSYNC_clientFinis();
VSetVInit_r(2);
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
* 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) {
sizeof(VolumeId) * updateSize);
}
}
- osi_Assert(UpdateList != NULL);
+ opr_Assert(UpdateList != NULL);
UpdateList[nUpdatedVolumes++] = V_id(vp);
#endif /* !AFS_DEMAND_ATTACH_FS */
}
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);
}
}
if (!VLRU_enabled)
return;
- osi_Assert(queue_IsNotOnQueue(&vp->vlru));
+ opr_Assert(queue_IsNotOnQueue(&vp->vlru));
vp->vlru.idx = VLRU_QUEUE_INVALID;
}
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();
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]);
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]);
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 */
static void
VLRU_BeginExclusive_r(struct VLRU_q * q)
{
- osi_Assert(q->busy == 0);
+ opr_Assert(q->busy == 0);
q->busy = 1;
}
static void
VLRU_EndExclusive_r(struct VLRU_q * q)
{
- osi_Assert(q->busy);
+ opr_Assert(q->busy);
q->busy = 0;
CV_BROADCAST(&q->cv);
}
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)
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;
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
/* 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
* 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
/* 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;
#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) {
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]);
static void
VHashBeginExclusive_r(VolumeHashChainHead * head)
{
- osi_Assert(head->busy == 0);
+ opr_Assert(head->busy == 0);
head->busy = 1;
}
static void
VHashEndExclusive_r(VolumeHashChainHead * head)
{
- osi_Assert(head->busy);
+ opr_Assert(head->busy);
head->busy = 0;
CV_BROADCAST(&head->chain_busy_cv);
}
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;
}
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);
}
#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 \
*timedout = 1;
}
}
- osi_Assert(code == 0);
+ opr_Assert(code == 0);
}
#endif /* AFS_PTHREAD_ENV */
return 0;
default:
- osi_Assert(0 /* unknown checkout mode */);
+ opr_Assert(0 /* unknown checkout mode */);
return 0;
}
}
{
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);
}
/**
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);
}
/**
#include <sys/lockf.h>
#endif
+#include <afs/opr.h>
#include <rx/xdr.h>
#include <afs/afsint.h>
#include "nfs.h"
{
int code;
- osi_Assert(locktype == READ_LOCK || locktype == WRITE_LOCK);
+ opr_Assert(locktype == READ_LOCK || locktype == WRITE_LOCK);
MUTEX_ENTER(&lf->mutex);
{
MUTEX_ENTER(&lf->mutex);
- osi_Assert(lf->fd != INVALID_FD);
+ opr_Assert(lf->fd != INVALID_FD);
if (--lf->refcount < 1) {
_VCloseFd(lf->fd);
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);
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) {
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
#include <ctype.h>
-#include <rx/xdr.h>
+#include <afs/opr.h>
#include <rx/rx.h>
#include <afs/afsint.h>
#include <afs/nfs.h>
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) {
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;
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;
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;
#include <afs/param.h>
#include <roken.h>
+#include <afs/opr.h>
#ifdef AFS_NT40_ENV
#include <windows.h>
#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);
#include <roken.h>
-#include <rx/xdr.h>
+#include <afs/opr.h>
#include <rx/rx.h>
#include <rx/rxkad.h>
#include <afs/afsint.h>
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 */
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);
#include <roken.h>
+#include <afs/opr.h>
+
#ifdef AFS_NT40_ENV
#include <afs/afsutil.h>
#endif