2 * Copyright IBM Corp. 2012
3 * Author(s): Holger Dengler (hd@linux.vnet.ibm.com)
9 #include "zcrypt_api.h"
11 /* that gives us 15 characters in the text event views */
12 #define ZCRYPT_DBF_LEN 16
14 /* sort out low debug levels early to avoid wasted sprints */
15 static inline int zcrypt_dbf_passes(debug_info_t
*dbf_grp
, int level
)
17 return (level
<= dbf_grp
->level
);
20 #define DBF_ERR 3 /* error conditions */
21 #define DBF_WARN 4 /* warning conditions */
22 #define DBF_INFO 6 /* informational */
24 #define RC2WARN(rc) ((rc) ? DBF_WARN : DBF_INFO)
26 #define ZCRYPT_DBF_COMMON(level, text...) \
28 if (zcrypt_dbf_passes(zcrypt_dbf_common, level)) { \
29 char debug_buffer[ZCRYPT_DBF_LEN]; \
30 snprintf(debug_buffer, ZCRYPT_DBF_LEN, text); \
31 debug_text_event(zcrypt_dbf_common, level, \
36 #define ZCRYPT_DBF_DEVICES(level, text...) \
38 if (zcrypt_dbf_passes(zcrypt_dbf_devices, level)) { \
39 char debug_buffer[ZCRYPT_DBF_LEN]; \
40 snprintf(debug_buffer, ZCRYPT_DBF_LEN, text); \
41 debug_text_event(zcrypt_dbf_devices, level, \
46 #define ZCRYPT_DBF_DEV(level, device, text...) \
48 if (zcrypt_dbf_passes(device->dbf_area, level)) { \
49 char debug_buffer[ZCRYPT_DBF_LEN]; \
50 snprintf(debug_buffer, ZCRYPT_DBF_LEN, text); \
51 debug_text_event(device->dbf_area, level, \
56 int zcrypt_debug_init(void);
57 void zcrypt_debug_exit(void);
59 #endif /* ZCRYPT_DEBUG_H */