Commit | Line | Data |
---|---|---|
ab057781 HJ |
1 | /* |
2 | * | |
3 | * Copyright (c) 2009, Microsoft Corporation. | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify it | |
6 | * under the terms and conditions of the GNU General Public License, | |
7 | * version 2, as published by the Free Software Foundation. | |
8 | * | |
9 | * This program is distributed in the hope it will be useful, but WITHOUT | |
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
12 | * more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License along with | |
15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |
16 | * Place - Suite 330, Boston, MA 02111-1307 USA. | |
17 | * | |
18 | * Authors: | |
19 | * Haiyang Zhang <haiyangz@microsoft.com> | |
20 | * Hank Janssen <hjanssen@microsoft.com> | |
21 | * | |
22 | */ | |
23 | ||
24 | ||
25 | #ifndef _LOGGING_H_ | |
26 | #define _LOGGING_H_ | |
27 | ||
454f18a9 BP |
28 | /* #include <linux/init.h> */ |
29 | /* #include <linux/module.h> */ | |
ab057781 | 30 | |
ab057781 HJ |
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 | ||
454f18a9 | 54 | /* Logging Level */ |
a14bd58c GKH |
55 | #define ERROR_LVL 3 |
56 | #define WARNING_LVL 4 | |
57 | #define INFO_LVL 6 | |
58 | #define DEBUG_LVL 7 | |
ab057781 HJ |
59 | #define DEBUG_LVL_ENTEREXIT 8 |
60 | #define DEBUG_RING_LVL 9 | |
61 | ||
62 | extern unsigned int vmbus_loglevel; | |
63 | ||
ab057781 | 64 | #define DPRINT(mod, lvl, fmt, args...) do {\ |
a14bd58c GKH |
65 | if ((mod & (HIWORD(vmbus_loglevel))) && \ |
66 | (lvl <= LOWORD(vmbus_loglevel))) \ | |
67 | printk(KERN_DEBUG #mod": %s() " fmt "\n", __func__, ## args);\ | |
ab057781 HJ |
68 | } while (0) |
69 | ||
70 | #define DPRINT_DBG(mod, fmt, args...) do {\ | |
a14bd58c GKH |
71 | if ((mod & (HIWORD(vmbus_loglevel))) && \ |
72 | (DEBUG_LVL <= LOWORD(vmbus_loglevel))) \ | |
73 | printk(KERN_DEBUG #mod": %s() " fmt "\n", __func__, ## args);\ | |
ab057781 HJ |
74 | } while (0) |
75 | ||
76 | #define DPRINT_INFO(mod, fmt, args...) do {\ | |
a14bd58c GKH |
77 | if ((mod & (HIWORD(vmbus_loglevel))) && \ |
78 | (INFO_LVL <= LOWORD(vmbus_loglevel))) \ | |
79 | printk(KERN_INFO #mod": " fmt "\n", ## args);\ | |
ab057781 HJ |
80 | } while (0) |
81 | ||
82 | #define DPRINT_WARN(mod, fmt, args...) do {\ | |
a14bd58c GKH |
83 | if ((mod & (HIWORD(vmbus_loglevel))) && \ |
84 | (WARNING_LVL <= LOWORD(vmbus_loglevel))) \ | |
0b8ffe07 | 85 | printk(KERN_WARNING #mod": WARNING! " fmt "\n", ## args);\ |
ab057781 HJ |
86 | } while (0) |
87 | ||
88 | #define DPRINT_ERR(mod, fmt, args...) do {\ | |
a14bd58c GKH |
89 | if ((mod & (HIWORD(vmbus_loglevel))) && \ |
90 | (ERROR_LVL <= LOWORD(vmbus_loglevel))) \ | |
91 | printk(KERN_ERR #mod": %s() ERROR!! " fmt "\n", \ | |
92 | __func__, ## args);\ | |
ab057781 HJ |
93 | } while (0) |
94 | ||
454f18a9 | 95 | #endif /* _LOGGING_H_ */ |