]> git.proxmox.com Git - mirror_spl-debian.git/blob - include/linux-callb.h
More build fixes, I have the kernel module almost building and its
[mirror_spl-debian.git] / include / linux-callb.h
1 #ifndef _LINUX_CALLB_H
2 #define _LINUX_CALLB_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #include <linux-mutex.h>
9
10 #define DEBUG_CALLB
11
12 #ifndef DEBUG_CALLB
13 #define CALLB_CPR_ASSERT(cp) BUG_ON(!(MUTEX_HELD((cp)->cc_lockp)));
14 #else
15 #define CALLB_CPR_ASSERT(cp)
16 #endif
17
18
19 typedef struct callb_cpr {
20 kmutex_t *cc_lockp;
21 } callb_cpr_t;
22
23 #define CALLB_CPR_INIT(cp, lockp, func, name) { \
24 (cp)->cc_lockp = lockp; \
25 }
26
27 #define CALLB_CPR_SAFE_BEGIN(cp) { \
28 CALLB_CPR_ASSERT(cp); \
29 }
30
31 #define CALLB_CPR_SAFE_END(cp, lockp) { \
32 CALLB_CPR_ASSERT(cp); \
33 }
34
35 #define CALLB_CPR_EXIT(cp) { \
36 ASSERT(MUTEX_HELD((cp)->cc_lockp)); \
37 mutex_exit((cp)->cc_lockp); \
38 }
39
40 #ifdef __cplusplus
41 }
42 #endif
43
44 #endif /* _LINUX_CALLB_H */
45