Merge remote-tracking branch 'cleancache/linux-next'
[linux-2.6/next.git] / drivers / staging / hv / logging.h
blob17999515ce08795bf528a8fd5821ff909a288b5b
1 /*
3 * Copyright (c) 2009, Microsoft Corporation.
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.
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.
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.
18 * Authors:
19 * Haiyang Zhang <haiyangz@microsoft.com>
20 * Hank Janssen <hjanssen@microsoft.com>
25 #ifndef _LOGGING_H_
26 #define _LOGGING_H_
28 #define LOWORD(dw) ((unsigned short)(dw))
29 #define HIWORD(dw) ((unsigned short)(((unsigned int) (dw) >> 16) & 0xFFFF))
31 /* #include <linux/init.h> */
32 /* #include <linux/module.h> */
35 #define VMBUS 0x0001
36 #define STORVSC 0x0002
37 #define NETVSC 0x0004
38 #define INPUTVSC 0x0008
39 #define BLKVSC 0x0010
40 #define VMBUS_DRV 0x0100
41 #define STORVSC_DRV 0x0200
42 #define NETVSC_DRV 0x0400
43 #define INPUTVSC_DRV 0x0800
44 #define BLKVSC_DRV 0x1000
46 #define ALL_MODULES (VMBUS |\
47 STORVSC |\
48 NETVSC |\
49 INPUTVSC |\
50 BLKVSC |\
51 VMBUS_DRV |\
52 STORVSC_DRV |\
53 NETVSC_DRV |\
54 INPUTVSC_DRV|\
55 BLKVSC_DRV)
57 /* Logging Level */
58 #define ERROR_LVL 3
59 #define WARNING_LVL 4
60 #define INFO_LVL 6
61 #define DEBUG_LVL 7
62 #define DEBUG_LVL_ENTEREXIT 8
63 #define DEBUG_RING_LVL 9
65 extern unsigned int vmbus_loglevel;
67 #define DPRINT(mod, lvl, fmt, args...) do {\
68 if ((mod & (HIWORD(vmbus_loglevel))) && \
69 (lvl <= LOWORD(vmbus_loglevel))) \
70 printk(KERN_DEBUG #mod": %s() " fmt "\n", __func__, ## args);\
71 } while (0)
73 #define DPRINT_DBG(mod, fmt, args...) do {\
74 if ((mod & (HIWORD(vmbus_loglevel))) && \
75 (DEBUG_LVL <= LOWORD(vmbus_loglevel))) \
76 printk(KERN_DEBUG #mod": %s() " fmt "\n", __func__, ## args);\
77 } while (0)
79 #define DPRINT_INFO(mod, fmt, args...) do {\
80 if ((mod & (HIWORD(vmbus_loglevel))) && \
81 (INFO_LVL <= LOWORD(vmbus_loglevel))) \
82 printk(KERN_INFO #mod": " fmt "\n", ## args);\
83 } while (0)
85 #define DPRINT_WARN(mod, fmt, args...) do {\
86 if ((mod & (HIWORD(vmbus_loglevel))) && \
87 (WARNING_LVL <= LOWORD(vmbus_loglevel))) \
88 printk(KERN_WARNING #mod": WARNING! " fmt "\n", ## args);\
89 } while (0)
91 #define DPRINT_ERR(mod, fmt, args...) do {\
92 if ((mod & (HIWORD(vmbus_loglevel))) && \
93 (ERROR_LVL <= LOWORD(vmbus_loglevel))) \
94 printk(KERN_ERR #mod": %s() ERROR!! " fmt "\n", \
95 __func__, ## args);\
96 } while (0)
98 #endif /* _LOGGING_H_ */