From ed61a7d05eb95ab453a95baf52d6af7b0c60a132 Mon Sep 17 00:00:00 2001 From: behlendo Date: Thu, 6 Mar 2008 23:42:37 +0000 Subject: [PATCH] Add some missing rw_lock symbols git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@27 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c --- include/sys/rwlock.h | 12 ++++++--- include/sys/sysmacros.h | 2 ++ modules/spl/spl-rwlock.c | 53 +++++++++++++++++++++------------------- 3 files changed, 38 insertions(+), 29 deletions(-) diff --git a/include/sys/rwlock.h b/include/sys/rwlock.h index 6c55ced98a..4498e95626 100644 --- a/include/sys/rwlock.h +++ b/include/sys/rwlock.h @@ -21,10 +21,10 @@ typedef enum { RW_READER } krw_t; -#define RW_READ_HELD(x) (rw_read_held((x))) -#define RW_WRITE_HELD(x) (rw_write_held((x))) -#define RW_LOCK_HELD(x) (rw_lock_held((x))) -#define RW_ISWRITER(x) (rw_iswriter(x)) +#define RW_READ_HELD(x) (__rw_read_held((x))) +#define RW_WRITE_HELD(x) (__rw_write_held((x))) +#define RW_LOCK_HELD(x) (__rw_lock_held((x))) +#define RW_ISWRITER(x) (__rw_iswriter(x)) #define RW_MAGIC 0x3423645a #define RW_POISON 0xa6 @@ -36,6 +36,10 @@ typedef struct { struct task_struct *rw_owner; /* holder of the write lock */ } krwlock_t; +extern int __rw_read_held(krwlock_t *rwlp); +extern int __rw_write_held(krwlock_t *rwlp); +extern int __rw_lock_held(krwlock_t *rwlp); + static __inline__ void rw_init(krwlock_t *rwlp, char *name, krw_type_t type, void *arg) { diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h index 1927a060db..2c3ec0e4e6 100644 --- a/include/sys/sysmacros.h +++ b/include/sys/sysmacros.h @@ -13,6 +13,8 @@ extern "C" { /* Missing defines. */ +#define FALSE 0 +#define TRUE 1 #define INT32_MAX INT_MAX #define UINT64_MAX (~0ULL) #define NBBY 8 diff --git a/modules/spl/spl-rwlock.c b/modules/spl/spl-rwlock.c index d74d89e24f..fa78d4c149 100644 --- a/modules/spl/spl-rwlock.c +++ b/modules/spl/spl-rwlock.c @@ -1,7 +1,33 @@ #include int -rw_lock_held(krwlock_t *rwlp) +__rw_read_held(krwlock_t *rwlp) +{ + BUG_ON(rwlp->rw_magic != RW_MAGIC); + + if (__rw_lock_held(rwlp) && rwlp->rw_owner == NULL) { + return 1; + } + + return 0; +} +EXPORT_SYMBOL(__rw_read_held); + +int +__rw_write_held(krwlock_t *rwlp) +{ + BUG_ON(rwlp->rw_magic != RW_MAGIC); + + if (rwlp->rw_owner == current) { + return 1; + } + + return 0; +} +EXPORT_SYMBOL(__rw_write_held); + +int +__rw_lock_held(krwlock_t *rwlp) { BUG_ON(rwlp->rw_magic != RW_MAGIC); @@ -15,27 +41,4 @@ rw_lock_held(krwlock_t *rwlp) return 0; } - -int -rw_read_held(krwlock_t *rwlp) -{ - BUG_ON(rwlp->rw_magic != RW_MAGIC); - - if (rw_lock_held(rwlp) && rwlp->rw_owner == NULL) { - return 1; - } - - return 0; -} - -int -rw_write_held(krwlock_t *rwlp) -{ - BUG_ON(rwlp->rw_magic != RW_MAGIC); - - if (rwlp->rw_owner == current) { - return 1; - } - - return 0; -} +EXPORT_SYMBOL(__rw_lock_held);