diff options
author | behlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c> | 2008-04-21 17:29:47 +0000 |
---|---|---|
committer | behlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c> | 2008-04-21 17:29:47 +0000 |
commit | 937879f11db15a4842306f9da4b4a3e60cf073b7 (patch) | |
tree | 3a72837d2323df2f844951229ecbbdb22925ac6a /include/sys/mutex.h | |
parent | 2fae1b3d0af1caa2aaa77552a0c96f121016381d (diff) |
Update SPL to use new debug infrastructure. This means:
- Replacing all BUG_ON()'s with proper ASSERT()'s
- Using ENTRY,EXIT,GOTO, and RETURN macro to instument call paths
git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@78 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
Diffstat (limited to 'include/sys/mutex.h')
-rw-r--r-- | include/sys/mutex.h | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/include/sys/mutex.h b/include/sys/mutex.h index ae8b81a7f..1f99c4d0d 100644 --- a/include/sys/mutex.h +++ b/include/sys/mutex.h @@ -36,9 +36,9 @@ typedef struct { static __inline__ void mutex_init(kmutex_t *mp, char *name, int type, void *ibc) { - BUG_ON(mp == NULL); - BUG_ON(ibc != NULL); /* XXX - Spin mutexes not needed? */ - BUG_ON(type != MUTEX_DEFAULT); /* XXX - Only default type supported? */ + ASSERT(mp); + ASSERT(ibc == NULL); /* XXX - Spin mutexes not needed */ + ASSERT(type == MUTEX_DEFAULT); /* XXX - Only default type supported */ mp->km_magic = KM_MAGIC; spin_lock_init(&mp->km_lock); @@ -57,9 +57,9 @@ mutex_init(kmutex_t *mp, char *name, int type, void *ibc) static __inline__ void mutex_destroy(kmutex_t *mp) { - BUG_ON(mp == NULL); + ASSERT(mp); + ASSERT(mp->km_magic == KM_MAGIC); spin_lock(&mp->km_lock); - BUG_ON(mp->km_magic != KM_MAGIC); if (mp->km_name) kfree(mp->km_name); @@ -71,9 +71,9 @@ mutex_destroy(kmutex_t *mp) static __inline__ void mutex_enter(kmutex_t *mp) { - BUG_ON(mp == NULL); + ASSERT(mp); + ASSERT(mp->km_magic == KM_MAGIC); spin_lock(&mp->km_lock); - BUG_ON(mp->km_magic != KM_MAGIC); if (unlikely(in_atomic() && !current->exit_state)) { printk("May schedule while atomic: %s/0x%08x/%d\n", @@ -87,7 +87,7 @@ mutex_enter(kmutex_t *mp) down(&mp->km_sem); spin_lock(&mp->km_lock); - BUG_ON(mp->km_owner != NULL); + ASSERT(mp->km_owner == NULL); mp->km_owner = current; spin_unlock(&mp->km_lock); } @@ -98,9 +98,9 @@ mutex_tryenter(kmutex_t *mp) { int rc; - BUG_ON(mp == NULL); + ASSERT(mp); + ASSERT(mp->km_magic == KM_MAGIC); spin_lock(&mp->km_lock); - BUG_ON(mp->km_magic != KM_MAGIC); if (unlikely(in_atomic() && !current->exit_state)) { printk("May schedule while atomic: %s/0x%08x/%d\n", @@ -113,7 +113,7 @@ mutex_tryenter(kmutex_t *mp) rc = down_trylock(&mp->km_sem); /* returns 0 if acquired */ if (rc == 0) { spin_lock(&mp->km_lock); - BUG_ON(mp->km_owner != NULL); + ASSERT(mp->km_owner == NULL); mp->km_owner = current; spin_unlock(&mp->km_lock); return 1; @@ -124,10 +124,11 @@ mutex_tryenter(kmutex_t *mp) static __inline__ void mutex_exit(kmutex_t *mp) { - BUG_ON(mp == NULL); + ASSERT(mp); + ASSERT(mp->km_magic == KM_MAGIC); spin_lock(&mp->km_lock); - BUG_ON(mp->km_magic != KM_MAGIC); - BUG_ON(mp->km_owner != current); + + ASSERT(mp->km_owner == current); mp->km_owner = NULL; spin_unlock(&mp->km_lock); up(&mp->km_sem); @@ -139,9 +140,9 @@ mutex_owned(kmutex_t *mp) { int rc; - BUG_ON(mp == NULL); + ASSERT(mp); + ASSERT(mp->km_magic == KM_MAGIC); spin_lock(&mp->km_lock); - BUG_ON(mp->km_magic != KM_MAGIC); rc = (mp->km_owner == current); spin_unlock(&mp->km_lock); @@ -154,9 +155,9 @@ mutex_owner(kmutex_t *mp) { kthread_t *thr; - BUG_ON(mp == NULL); + ASSERT(mp); + ASSERT(mp->km_magic == KM_MAGIC); spin_lock(&mp->km_lock); - BUG_ON(mp->km_magic != KM_MAGIC); thr = mp->km_owner; spin_unlock(&mp->km_lock); |