]>
Commit | Line | Data |
---|---|---|
51e135ce A |
1 | /* |
2 | * Copyright (c) 2005-2006, 2008, 2010-2011 Apple Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * This file contains Original Code and/or Modifications of Original Code | |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
12 | * | |
13 | * The Original Code and all software distributed under the License are | |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
20 | * | |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
23 | #ifndef __FSCK_DEBUG__ | |
24 | #define __FSCK_DEBUG__ | |
25 | ||
26 | #include <sys/types.h> | |
27 | ||
28 | enum debug_message_type { | |
29 | /* Type of information */ | |
30 | d_info = 0x0001, /* Normal information messages during execution */ | |
31 | d_error = 0x0002, /* Error messages */ | |
32 | ||
33 | /* Category of verify/repair operation */ | |
34 | d_xattr = 0x0010, /* Extended attributes related messages */ | |
35 | d_overlap = 0x0020, /* Overlap extents related messages */ | |
36 | d_trim = 0x0040, /* TRIM (discard/unmap) related messages */ | |
37 | ||
38 | d_dump_record = 0x0400, /* Dump corrupt keys and records */ | |
39 | d_dump_node = 0x0800, /* In hfs_swap_BTNode or BTCheck, dump out damaged nodes */ | |
40 | d_check_slink = 0x1000, /* Read the contents of a symlink and check length */ | |
41 | }; | |
42 | ||
43 | /* Current debug level of fsck_hfs for printing messages via DPRINTF */ | |
44 | extern unsigned long cur_debug_level; | |
45 | ||
46 | /* Function: DPRINTF | |
47 | * | |
48 | * Description: Debug function similar to printf except the first parameter | |
49 | * which indicates the type of message to be printed by DPRINTF. Based on | |
50 | * current debug level and the type of message, the function decides | |
51 | * whether to print the message or not. | |
52 | * | |
53 | * Each unique message type has a bit assigned to it. The message type | |
54 | * passed to DPRINTF can be one or combination (OR-ed value) of pre-defined | |
55 | * debug message types. Only the messages whose type have one or more similar | |
56 | * bits set in comparison with current global debug level are printed. | |
57 | * | |
58 | * For example, if cur_debug_level = 0x11 (d_info|d_xattr) | |
59 | * ---------------------------------------- | |
60 | * message type - printed/not printed | |
61 | * ---------------------------------------- | |
62 | * d_info - printed | |
63 | * d_error|d_xattr - printed | |
64 | * d_error - not printed | |
65 | * d_overlap - not printed | |
66 | * | |
67 | * Input: | |
68 | * message_type - type of message, to determine when to print the message | |
69 | * variable arguments - similar to printfs | |
70 | * | |
71 | * Output: | |
72 | * Nothing | |
73 | */ | |
74 | extern void DPRINTF (unsigned long message_type, char *format, ...); | |
75 | ||
76 | void HexDump(const void *p_arg, unsigned length, int showOffsets); | |
77 | ||
78 | #endif /* __FSCK_DEBUG__ */ |