2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
14 #if !defined(TRANSARC_DEBUG_H)
15 #define TRANSARC_DEBUG_H
18 * Define debugging levels, from 1 being lowest priority and 7 being
19 * highest priority. DEBUG_LEVEL_0 and DEBUG_FORCE_PRINT mean to
20 * print the message regardless of the current setting.
22 #define DEBUG_LEVEL_0 0
23 #define DEBUG_LEVEL_1 01
24 #define DEBUG_LEVEL_2 03
25 #define DEBUG_LEVEL_3 07
26 #define DEBUG_LEVEL_4 017
27 #define DEBUG_LEVEL_5 037
28 #define DEBUG_LEVEL_6 077
29 #define DEBUG_LEVEL_7 0177
31 #define DEBUG_FORCE_PRINT DEBUG_LEVEL_0
33 #if defined(AFS_DEBUG)
39 * In user space call abort();
44 if(!(x)) { printf("assertion failed: line %d, file %s\n",\
45 __LINE__,__FILE__); osi_Panic("assert"); }
50 #define CM_DEBUG 0 /* Cache Manager */
51 #define EX_DEBUG 1 /* Protocol Exporter */
52 #define HS_DEBUG 2 /* Host Module */
53 #define VL_DEBUG 3 /* Volume Module */
55 #define AG_DEBUG 4 /* Aggregate Module */
56 #define VR_DEBUG 5 /* Volume Registry Module */
57 #define RX_DEBUG 6 /* RPC/Rx Module */
58 #define XVFS_DEBUG 7 /* Xvnode Module */
60 #define NFSTR_DEBUG 8 /* NFS/AFS Translator Module */
61 #define XCRED_DEBUG 9 /* Extended Credential Module */
62 #define FP_DEBUG 10 /* Free Pool Module */
63 #define ACL_DEBUG 11 /* ACL Module */
64 #define FSHS_DEBUG 12 /* File server host module */
66 #define MAXMODS_DEBUG 20
68 #ifdef AFSDEBUG_DECLARE
70 * Should get here only once per kernel instance!
72 char afsdebug[MAXMODS_DEBUG] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
77 * Compare the given debugging level against the setting of the particular
78 * index into the afsdebug char array. If there are bits in common, or else
79 * if if the level is DEBUG_FORCE_PRINT, then produce debugging output with
80 * the rest of the arguments provided.
82 * NOTE: This should become a macro!
84 AFSLOG(index,level,a,b,c,d,e,f,g,h,i,j,k,l,m,n)
85 char index,level,*a,*b,*c,*d,*e,*f,*g,*h,*i,*j,*k,*l,*m,*n;
87 if ((afsdebug[index] & level) || !level)
88 osi_dp(a,b,c,d,e,f,g,h,i,j,k,l,m,n);
91 extern char afsdebug[20];
92 #endif /* AFSDEBUG_DECLARE */
96 if(!(x)) { fprintf(stderr, "assertion failed: line %d, file %s\n",\
97 __LINE__,__FILE__); fflush(stderr); abort(); }
100 #else /* AFS_DEBUG */
104 #endif /* AFS_DEBUG */
107 * Debugging macro package. The actual variables should be declared in
111 #if defined(AFS_DEBUG)
113 #define dprintf(flag, str) printf str
114 #define dlprintf(flag, level, str) printf str
115 #define dmprintf(flag, bit, str) printf str
117 #define dprintf(flag, str) \
119 ( osi_dp str, osi_dp("\t%s, %d\n", __FILE__, __LINE__)):0)
120 #define dlprintf(flag, level, str) dprintf(((flag) >= (level)), str)
121 #define dmprintf(flag, bit, str) dprintf(((flag)&(1<<((bit)-1))), str)
125 #else /* AFS_DEBUG */
127 #define dprintf(flag, str)
128 #define dlprintf(flag, level,str)
129 #define dmprintf(flag, bit, str)
131 #endif /* AFS_DEBUG */
133 #endif /* TRANSARC_DEBUG_H */