diff --git a/src/afs/afs_osi.h b/src/afs/afs_osi.h index 771c12214e..36b4c579cc 100644 --- a/src/afs/afs_osi.h +++ b/src/afs/afs_osi.h @@ -220,7 +220,7 @@ typedef struct timeval osi_timeval_t; #ifdef AFS_GLOBAL_SUNLOCK #define AFS_ASSERT_GLOCK() \ - (ISAFS_GLOCK() || (osi_Panic("afs global lock not held at %s:%d\n", __FILE__, __LINE__), 0)) + do { if (!ISAFS_GLOCK()) osi_Panic("afs global lock not held at %s:%d\n", __FILE__, __LINE__); } while (0) #endif /* AFS_GLOBAL_SUNLOCK */ #ifdef RX_ENABLE_LOCKS diff --git a/src/rx/rx_kcommon.c b/src/rx/rx_kcommon.c index aa0e87a4ad..8a3da04b88 100644 --- a/src/rx/rx_kcommon.c +++ b/src/rx/rx_kcommon.c @@ -133,6 +133,7 @@ rxi_GetUDPSocket(u_short port) return rxi_GetHostUDPSocket(&saddr, sizeof(struct sockaddr_in)); } +#if !defined(AFS_LINUX26_ENV) void osi_Panic(msg, a1, a2, a3) char *msg; @@ -141,7 +142,7 @@ osi_Panic(msg, a1, a2, a3) msg = "Unknown AFS panic"; printf(msg, a1, a2, a3); -#ifdef AFS_LINUX24_ENV +#ifdef AFS_LINUX20_ENV * ((char *) 0) = 0; #else panic(msg); @@ -270,6 +271,13 @@ osi_AssertFailK(const char *expr, const char *file, int line) osi_Panic(buf); } +#else +void +osi_AssertFailK(const char *expr, const char *file, int line) +{ + printk(KERN_CRIT "assertion failed: %s, file: %s, line: %d\n", expr, file, line); +} +#endif #ifndef UKERNEL /* This is the server process request loop. Kernel server diff --git a/src/rx/rx_prototypes.h b/src/rx/rx_prototypes.h index ecb94cc469..2b7088660d 100644 --- a/src/rx/rx_prototypes.h +++ b/src/rx/rx_prototypes.h @@ -346,7 +346,14 @@ extern void rxk_shutdownPorts(void); extern osi_socket rxi_GetUDPSocket(u_short port); extern osi_socket rxi_GetHostUDPSocket(struct sockaddr_storage *saddr, int salen); -extern void osi_Panic(); +#if defined(KERNEL) && defined(AFS_LINUX26_ENV) +#define osi_Panic(msg...) do { printk(KERN_CRIT "openafs: " msg); BUG(); } while (0) +#undef osi_Assert +#define osi_Assert(expr) \ + do { if (!(expr)) { osi_AssertFailK(#expr, __FILE__, __LINE__); BUG(); } } while (0) +#else +extern void osi_Panic(); /* leave without args till stdarg rewrite */ +#endif extern int osi_utoa(char *buf, size_t len, unsigned long val); extern void rxi_InitPeerParams(register struct rx_peer *pp); extern void shutdown_rxkernel(void); @@ -578,7 +585,6 @@ extern pthread_mutex_t rx_if_mutex; extern osi_socket rxi_GetUDPSocket(u_short port); extern void osi_AssertFailU(const char *expr, const char *file, int line); extern int rx_getAllAddr(afs_int32 * buffer, int maxSize); -extern void osi_Panic(); /* leave without args till stdarg rewrite */ extern void rxi_InitPeerParams(struct rx_peer *pp); #if defined(AFS_AIX32_ENV) && !defined(KERNEL)