vmod/vmodttl: fixed bug related to luns not ordered and/or not starting from zero.
[ht-drivers.git] / include / drvr_dbg_prnt.h
blob021ca196de718645a384f1aa3383bd88ed8b052d
1 /**
2 * @file drvr_dbg_prnt.h
4 * @brief Debug printout macroses for the driver.
6 * @author Yury Georgievskiy. CERN AB/CO.
8 * @date April, 2008
10 * @version 1.0 ygeorgie 09/04/2008 Creation date.
12 #ifndef _DRIVER_DBG_PRINTOUT_H_INCLUDE_
13 #define _DRIVER_DBG_PRINTOUT_H_INCLUDE_
15 /* If driver wants to use these utils - it should provide this function
16 CDCM is providing this function in cdcmDrvr.c */
17 extern char* __drvrnm(void);
19 //!< DeBuG Information Printout Level (IPL)
20 typedef enum _dbgipl {
21 IPL_NONE = 0, //!< silent mode
22 IPL_OPEN = 1 << 0,
23 IPL_CLOSE = 1 << 1,
24 IPL_READ = 1 << 2,
25 IPL_WRITE = 1 << 3,
26 IPL_SELECT = 1 << 4,
27 IPL_IOCTL = 1 << 5,
28 IPL_INSTALL = 1 << 6,
29 IPL_UNINST = 1 << 7,
30 IPL_DBG = 1 << 8, //!< printout debug messages
31 IPL_ERROR = 1 << 9, //!< printout error messages
32 IPL_INFO = 1 << 10, //!< printout information messages
33 IPL_WARN = 1 << 11, //!< printout warning messages
34 IPL_ALL = (~0) //!< verbose
35 } dbgipl_t;
37 //!< indisputable info printout
38 #define PRNT_ABS_INFO(format...) \
39 do { \
40 printk("%s [%s_INFO] %s(): ", KERN_INFO, __drvrnm(), __func__ ); \
41 printk(format); \
42 printk("\n"); \
43 } while(0)
45 //!< indisputable error printout
46 #define PRNT_ABS_ERR(format...) \
47 do { \
48 printk("%s [%s_ERR] %s(): ", KERN_ERR, __drvrnm(), __func__ ); \
49 printk(format); \
50 printk("\n"); \
51 } while(0)
53 //!< indisputable warning printout
54 #define PRNT_ABS_WARN(format...) \
55 do { \
56 printk("%s [%s_WARN] %s(): ", KERN_WARNING, __drvrnm(), __func__ ); \
57 printk(format); \
58 printk("\n"); \
59 } while(0)
61 //!< indisputable debugging printout
62 #define PRNT_ABS_DBG_MSG(format...) \
63 do { \
64 printk("%s [%s_DBG] %s()@%d: ", KERN_DEBUG, __drvrnm(), \
65 __func__ , __LINE__ ); \
66 printk(format); \
67 printk("\n"); \
68 } while(0)
71 /*! @name Driver debug printing.
73 * Driver statics table should be named @e drvrStatT and have a member
74 * @e d_ipl of type \ref dbgipl_t
76 //@{
77 #define PRNT_OPEN(dflg, format, arg...) \
78 do { \
79 if (dflg & IPL_OPEN) { PRNT_ABS_INFO(format, ##arg); } \
80 } while (0)
82 #define PRNT_CLOSE(dflg, format, arg...) \
83 do { \
84 if (dflg & IPL_CLOSE) { PRNT_ABS_INFO(format, ##arg); } \
85 } while (0)
87 #define PRNT_READ(dflg, format, arg...) \
88 do { \
89 if (dflg & IPL_READ) {PRNT_ABS_INFO(format, ##arg); } \
90 } while (0)
92 #define PRNT_WRITE(dflg, format, arg...) \
93 do { \
94 if (dflg & IPL_WRITE) { PRNT_ABS_INFO(format, ##arg); } \
95 } while (0)
97 #define PRNT_SELECT(dflg, format, arg...) \
98 do { \
99 if (dflg & IPL_SELECT) { PRNT_ABS_INFO(format, ##arg); } \
100 } while (0)
102 #define PRNT_IOCTL(dflg, format, arg...) \
103 do { \
104 if (dflg & IPL_IOCTL) { PRNT_ABS_INFO(format, ##arg); } \
105 } while (0)
107 #define PRNT_INSTALL(dflg, format, arg...) \
108 do { \
109 if (dflg & IPL_INSTALL) { PRNT_ABS_INFO(format, ##arg); } \
110 } while (0)
112 #define PRNT_UNINST(dflg, format, arg...) \
113 do { \
114 if (dflg & IPL_UNINST) { PRNT_ABS_INFO(format, ##arg); } \
115 } while (0)
117 #define PRNT_DBG(dflg, format, arg...) \
118 do { \
119 if (dflg & IPL_DBG) { PRNT_ABS_DBG_MSG(format, ##arg); } \
120 } while (0)
122 #define PRNT_ERR(dflg, format, arg...) \
123 do { \
124 if (dflg & IPL_ERROR) { PRNT_ABS_ERR(format, ##arg); } \
125 } while (0)
127 #define PRNT_INFO(dflg, format, arg...) \
128 do { \
129 if (dflg & IPL_INFO) { PRNT_ABS_INFO(format, ##arg); } \
130 } while (0)
132 #define PRNT_WARN(dflg, format, arg...) \
133 do { \
134 if (dflg & IPL_WARN) { PRNT_ABS_WARN(format, ##arg); } \
135 } while (0)
136 //@}
138 #endif /* _DRIVER_DBG_PRINTOUT_H_INCLUDE_ */