2008-03-01 00:45:59 +00:00
|
|
|
#include <sys/rwlock.h>
|
2008-02-26 20:36:04 +00:00
|
|
|
|
|
|
|
int
|
2008-03-06 23:42:37 +00:00
|
|
|
__rw_read_held(krwlock_t *rwlp)
|
2008-02-26 20:36:04 +00:00
|
|
|
{
|
|
|
|
BUG_ON(rwlp->rw_magic != RW_MAGIC);
|
|
|
|
|
2008-03-06 23:42:37 +00:00
|
|
|
if (__rw_lock_held(rwlp) && rwlp->rw_owner == NULL) {
|
2008-02-26 20:36:04 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2008-02-27 19:09:51 +00:00
|
|
|
|
2008-02-26 20:36:04 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2008-03-06 23:42:37 +00:00
|
|
|
EXPORT_SYMBOL(__rw_read_held);
|
2008-02-26 20:36:04 +00:00
|
|
|
|
|
|
|
int
|
2008-03-06 23:42:37 +00:00
|
|
|
__rw_write_held(krwlock_t *rwlp)
|
2008-02-26 20:36:04 +00:00
|
|
|
{
|
|
|
|
BUG_ON(rwlp->rw_magic != RW_MAGIC);
|
|
|
|
|
2008-03-06 23:42:37 +00:00
|
|
|
if (rwlp->rw_owner == current) {
|
2008-02-26 20:36:04 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2008-03-06 23:42:37 +00:00
|
|
|
EXPORT_SYMBOL(__rw_write_held);
|
2008-02-26 20:36:04 +00:00
|
|
|
|
|
|
|
int
|
2008-03-06 23:42:37 +00:00
|
|
|
__rw_lock_held(krwlock_t *rwlp)
|
2008-02-26 20:36:04 +00:00
|
|
|
{
|
|
|
|
BUG_ON(rwlp->rw_magic != RW_MAGIC);
|
|
|
|
|
2008-03-06 23:42:37 +00:00
|
|
|
#ifdef CONFIG_RWSEM_GENERIC_SPINLOCK
|
|
|
|
if (rwlp->rw_sem.activity != 0) {
|
|
|
|
#else
|
|
|
|
if (rwlp->rw_sem.count != 0) {
|
|
|
|
#endif
|
2008-02-26 20:36:04 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2008-03-06 23:42:37 +00:00
|
|
|
EXPORT_SYMBOL(__rw_lock_held);
|