staging: hv: remove ASSERT()s in RndisFilter.c
[safe/jmp/linux-2.6] / drivers / staging / hv / logging.h
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
28 /* #include <linux/init.h> */
29 /* #include <linux/module.h> */
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 /* Logging Level */
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
62 extern unsigned int vmbus_loglevel;
63
64 #define ASSERT(expr)    \
65         if (!(expr)) {  \
66                 printk(KERN_CRIT "Assertion failed! %s,%s,%s,line=%d\n", \
67                        #expr, __FILE__, __func__, __LINE__);    \
68                 __asm__ __volatile__("int3");   \
69         }
70
71 #define DPRINT(mod, lvl, fmt, args...) do {\
72         if ((mod & (HIWORD(vmbus_loglevel))) && \
73             (lvl <= LOWORD(vmbus_loglevel)))    \
74                 printk(KERN_DEBUG #mod": %s() " fmt "\n", __func__, ## args);\
75         } while (0)
76
77 #define DPRINT_DBG(mod, fmt, args...) do {\
78         if ((mod & (HIWORD(vmbus_loglevel))) &&         \
79             (DEBUG_LVL <= LOWORD(vmbus_loglevel)))      \
80                 printk(KERN_DEBUG #mod": %s() " fmt "\n", __func__, ## args);\
81         } while (0)
82
83 #define DPRINT_INFO(mod, fmt, args...) do {\
84         if ((mod & (HIWORD(vmbus_loglevel))) &&         \
85             (INFO_LVL <= LOWORD(vmbus_loglevel)))       \
86                 printk(KERN_INFO #mod": " fmt "\n", ## args);\
87         } while (0)
88
89 #define DPRINT_WARN(mod, fmt, args...) do {\
90         if ((mod & (HIWORD(vmbus_loglevel))) &&         \
91             (WARNING_LVL <= LOWORD(vmbus_loglevel)))    \
92                 printk(KERN_WARNING #mod": WARNING! " fmt "\n", ## args);\
93         } while (0)
94
95 #define DPRINT_ERR(mod, fmt, args...) do {\
96         if ((mod & (HIWORD(vmbus_loglevel))) &&         \
97             (ERROR_LVL <= LOWORD(vmbus_loglevel)))      \
98                 printk(KERN_ERR #mod": %s() ERROR!! " fmt "\n", \
99                        __func__, ## args);\
100         } while (0)
101
102 #ifdef DEBUG
103 #define DPRINT_ENTER(mod) do {\
104         if ((mod & (HIWORD(vmbus_loglevel))) && \
105             (DEBUG_LVL_ENTEREXIT <= LOWORD(vmbus_loglevel)))    \
106                 printk(KERN_DEBUG "["#mod"]: %s() enter\n", __func__);\
107         } while (0)
108
109 #define DPRINT_EXIT(mod) do {\
110         if ((mod & (HIWORD(vmbus_loglevel))) && \
111             (DEBUG_LVL_ENTEREXIT <= LOWORD(vmbus_loglevel)))    \
112                 printk(KERN_DEBUG "["#mod"]: %s() exit\n", __func__);\
113         } while (0)
114 #else
115 #define DPRINT_ENTER(mod)
116 #define DPRINT_EXIT(mod)
117 #endif
118
119 #endif /* _LOGGING_H_ */