]>
git.saurik.com Git - apple/xnu.git/blob - bsd/hfs/hfs_dbg.h
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
27 * (c) 1997 Apple Computer, Inc. All Rights Reserved
29 * hfs_dbg.h -- debugging macros for HFS file system.
32 * 10-Nov-1998 Pat Dirks Cleaned up definition of DBG_ASSERT to handle embedded '%' correctly.
33 * 28-Apr-1998 Scott Roberts Reorganized and added HFS_DEBUG_STAGE
34 * 17-Nov-1997 Pat Dirks Pat Dirks at Apple Computer
35 * Derived from old hfs version.
40 /* Define the debugging stage...
41 4 -> Do all, aggresive, call_kdp
42 3 -> debug asserts and debug err, panic instead of call_kdp
43 2 -> debug error, no kdb
44 1 -> very little, panic only
46 #ifndef HFS_DIAGNOSTIC
47 #define HFS_DIAGNOSTIC 0
48 #endif /* HFS_DIAGNOSTIC */
50 #ifndef HFS_DEBUG_STAGE
52 #define HFS_DEBUG_STAGE 4
54 #define HFS_DEBUG_STAGE 1
56 #endif /* HFS_DEBUG_STAGE */
59 #define PRINTIT kprintf
61 #define PRINTIT printf
64 #if (HFS_DEBUG_STAGE > 3)
65 #define DEBUG_BREAK Debugger("");
70 #if (HFS_DEBUG_STAGE == 4)
71 #define DEBUG_BREAK_MSG(PRINTF_ARGS) { PRINTIT PRINTF_ARGS; DEBUG_BREAK };
72 #elif (HFS_DEBUG_STAGE == 3)
73 #define DEBUG_BREAK_MSG(PRINTF_ARGS) { panic PRINTF_ARGS;};
75 #define DEBUG_BREAK_MSG(PRINTF_ARGS) { PRINTIT PRINTF_ARGS; };
79 //#define PRINT_DELAY (void) tsleep((caddr_t)&lbolt, PPAUSE, "hfs kprintf", 0)
86 extern int hfs_dbg_all
;
87 extern int hfs_dbg_err
;
90 #if (HFS_DEBUG_STAGE == 4)
91 char gDebugAssertStr
[255];
92 #define DBG_ASSERT(a) { if (!(a)) { \
93 sprintf(gDebugAssertStr,"Oops - File "__FILE__", line %d: assertion '%s' failed.\n", __LINE__, #a); \
94 Debugger(gDebugAssertStr); } }
96 #define DBG_ASSERT(a) { if (!(a)) { panic("File "__FILE__", line %d: assertion '%s' failed.\n", __LINE__, #a); } }
97 #endif /* HFS_DEBUG_STAGE */
99 #define DBG_ASSERT(a) assert(a)
102 #define DBG_ERR(x) { \
103 if(hfs_dbg_all || hfs_dbg_err) { \
104 PRINTIT("%X: ", current_proc()->p_pid); \
105 PRINTIT("HFS ERROR: "); \
111 #else /* HFS_DIAGNOSTIC */
113 #define DBG_ASSERT(a)
116 #endif /* HFS_DIAGNOSTIC */