4 #include <KernelExport.h>
10 #define INIT_BEN(x, prefix) (mutex_init_etc(x, prefix, MUTEX_FLAG_CLONE_NAME), \
12 #define DELETE_BEN(x) mutex_destroy(x)
13 #define ACQUIRE_BEN(x) mutex_lock(x)
14 #define RELEASE_BEN(x) mutex_unlock(x)
18 #ifdef DEBUG_WAIT_ON_MSG
19 # define DEBUG_WAIT snooze( DEBUG_WAIT_ON_MSG );
24 #ifdef DEBUG_WAIT_ON_ERROR
25 # define DEBUG_WAIT_ERROR snooze( DEBUG_WAIT_ON_ERROR );
27 # define DEBUG_WAIT_ERROR
30 #ifndef DEBUG_MAX_LEVEL_FLOW
31 # define DEBUG_MAX_LEVEL_FLOW 4
34 #ifndef DEBUG_MAX_LEVEL_INFO
35 # define DEBUG_MAX_LEVEL_INFO 4
38 #ifndef DEBUG_MAX_LEVEL_ERROR
39 # define DEBUG_MAX_LEVEL_ERROR 4
42 #ifndef DEBUG_MSG_PREFIX
43 # define DEBUG_MSG_PREFIX ""
46 #ifndef debug_level_flow
47 # define debug_level_flow 4
50 #ifndef debug_level_info
51 # define debug_level_info 4
54 #ifndef debug_level_error
55 # define debug_level_error 4
58 #define FUNC_NAME DEBUG_MSG_PREFIX, __FUNCTION__
60 #define SHOW_FLOW(seriousness, format, param...) \
61 do { if( seriousness <= debug_level_flow && seriousness <= DEBUG_MAX_LEVEL_FLOW ) { \
62 dprintf( "%s%s: "format"\n", FUNC_NAME, param ); DEBUG_WAIT \
65 #define SHOW_FLOW0(seriousness, format) \
66 do { if( seriousness <= debug_level_flow && seriousness <= DEBUG_MAX_LEVEL_FLOW ) { \
67 dprintf( "%s%s: "format"\n", FUNC_NAME); DEBUG_WAIT \
70 #define SHOW_INFO(seriousness, format, param...) \
71 do { if( seriousness <= debug_level_info && seriousness <= DEBUG_MAX_LEVEL_INFO ) { \
72 dprintf( "%s%s: "format"\n", FUNC_NAME, param ); DEBUG_WAIT \
75 #define SHOW_INFO0(seriousness, format) \
76 do { if( seriousness <= debug_level_info && seriousness <= DEBUG_MAX_LEVEL_INFO ) { \
77 dprintf( "%s%s: "format"\n", FUNC_NAME); DEBUG_WAIT \
80 #define SHOW_ERROR(seriousness, format, param...) \
81 do { if( seriousness <= debug_level_error && seriousness <= DEBUG_MAX_LEVEL_ERROR ) { \
82 dprintf( "%s%s: "format"\n", FUNC_NAME, param ); DEBUG_WAIT_ERROR \
85 #define SHOW_ERROR0(seriousness, format) \
86 do { if( seriousness <= debug_level_error && seriousness <= DEBUG_MAX_LEVEL_ERROR ) { \
87 dprintf( "%s%s: "format"\n", FUNC_NAME); DEBUG_WAIT_ERROR \
90 #endif /* _BENAPHORE_H */