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#ifndef _LOGGING_H_
26#define _LOGGING_H_
27
28
29
30
31
32#define VMBUS 0x0001
33#define STORVSC 0x0002
34#define NETVSC 0x0004
35#define INPUTVSC 0x0008
36#define BLKVSC 0x0010
37#define VMBUS_DRV 0x0100
38#define STORVSC_DRV 0x0200
39#define NETVSC_DRV 0x0400
40#define INPUTVSC_DRV 0x0800
41#define BLKVSC_DRV 0x1000
42
43#define ALL_MODULES (VMBUS |\
44 STORVSC |\
45 NETVSC |\
46 INPUTVSC |\
47 BLKVSC |\
48 VMBUS_DRV |\
49 STORVSC_DRV |\
50 NETVSC_DRV |\
51 INPUTVSC_DRV|\
52 BLKVSC_DRV)
53
54
55#define ERROR_LVL 3
56#define WARNING_LVL 4
57#define INFO_LVL 6
58#define DEBUG_LVL 7
59#define DEBUG_LVL_ENTEREXIT 8
60#define DEBUG_RING_LVL 9
61
62extern unsigned int vmbus_loglevel;
63
64#define DPRINT(mod, lvl, fmt, args...) do {\
65 if ((mod & (HIWORD(vmbus_loglevel))) && \
66 (lvl <= LOWORD(vmbus_loglevel))) \
67 printk(KERN_DEBUG #mod": %s() " fmt "\n", __func__, ## args);\
68 } while (0)
69
70#define DPRINT_DBG(mod, fmt, args...) do {\
71 if ((mod & (HIWORD(vmbus_loglevel))) && \
72 (DEBUG_LVL <= LOWORD(vmbus_loglevel))) \
73 printk(KERN_DEBUG #mod": %s() " fmt "\n", __func__, ## args);\
74 } while (0)
75
76#define DPRINT_INFO(mod, fmt, args...) do {\
77 if ((mod & (HIWORD(vmbus_loglevel))) && \
78 (INFO_LVL <= LOWORD(vmbus_loglevel))) \
79 printk(KERN_INFO #mod": " fmt "\n", ## args);\
80 } while (0)
81
82#define DPRINT_WARN(mod, fmt, args...) do {\
83 if ((mod & (HIWORD(vmbus_loglevel))) && \
84 (WARNING_LVL <= LOWORD(vmbus_loglevel))) \
85 printk(KERN_WARNING #mod": WARNING! " fmt "\n", ## args);\
86 } while (0)
87
88#define DPRINT_ERR(mod, fmt, args...) do {\
89 if ((mod & (HIWORD(vmbus_loglevel))) && \
90 (ERROR_LVL <= LOWORD(vmbus_loglevel))) \
91 printk(KERN_ERR #mod": %s() ERROR!! " fmt "\n", \
92 __func__, ## args);\
93 } while (0)
94
95#endif
96