blob: fa78d4c14935664feba4f669c91ff00451a992dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#include <sys/rwlock.h>
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;
}
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);
#ifdef CONFIG_RWSEM_GENERIC_SPINLOCK
if (rwlp->rw_sem.activity != 0) {
#else
if (rwlp->rw_sem.count != 0) {
#endif
return 1;
}
return 0;
}
EXPORT_SYMBOL(__rw_lock_held);
|