]>
Commit | Line | Data |
---|---|---|
51e135ce A |
1 | /* |
2 | * Copyright (c) 2008-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 | #include "fsck_messages.h" | |
24 | #include "fsck_hfs_msgnums.h" | |
25 | ||
26 | /* | |
27 | * HFS-specific status messages -- just indicating what phase fsck_hfs is in. | |
28 | * The structure is explained in fsck_strings.c | |
29 | */ | |
30 | fsck_message_t | |
31 | hfs_messages[] = { | |
32 | /* Message Number Message Type Verbosity Arguments */ | |
33 | /* 201 - 210 */ | |
34 | { hfsExtBTCheck, "Checking extents overflow file.", fsckMsgVerify, fsckLevel0, 0, }, | |
35 | { hfsCatBTCheck, "Checking catalog file.", fsckMsgVerify, fsckLevel0, 0, }, | |
36 | { hfsCatHierCheck, "Checking catalog hierarchy.", fsckMsgVerify, fsckLevel0, 0, }, | |
37 | { hfsExtAttrBTCheck, "Checking extended attributes file.", fsckMsgVerify, fsckLevel0, 0, }, | |
38 | { hfsVolBitmapCheck, "Checking volume bitmap.", fsckMsgVerify, fsckLevel0, 0, }, | |
39 | { hfsVolInfoCheck, "Checking volume information.", fsckMsgVerify, fsckLevel0, 0, }, | |
40 | { hfsHardLinkCheck, "Checking multi-linked files.", fsckMsgVerify, fsckLevel0, 0, }, | |
41 | { hfsRebuildExtentBTree, "Rebuilding extents overflow B-tree.", fsckMsgVerify, fsckLevel0, 0, }, | |
42 | { hfsRebuildCatalogBTree, "Rebuilding catalog B-tree.", fsckMsgVerify, fsckLevel0, 0, }, | |
43 | { hfsRebuildAttrBTree, "Rebuilding extended attributes B-tree.", fsckMsgVerify, fsckLevel0, 0, }, | |
44 | ||
45 | /* 211 - 217 */ | |
46 | { hfsCaseSensitive, "Detected a case-sensitive volume.", fsckMsgVerify, fsckLevel0, 0, }, | |
47 | { hfsMultiLinkDirCheck, "Checking multi-linked directories.", fsckMsgVerify, fsckLevel0, 0, }, | |
48 | { hfsJournalVolCheck, "Checking Journaled HFS Plus volume.", fsckMsgVerify, fsckLevel0, 0, }, | |
49 | { hfsLiveVerifyCheck, "Performing live verification.", fsckMsgVerify, fsckLevel0, 0, }, | |
50 | { hfsVerifyVolWithWrite, "Verifying volume when it is mounted with write access.", fsckMsgVerify, fsckLevel0, 0, }, | |
51 | { hfsCheckHFS, "Checking HFS volume.", fsckMsgVerify, fsckLevel0, 0, }, | |
52 | { hfsCheckNoJnl, "Checking non-journaled HFS Plus Volume.", fsckMsgVerify, fsckLevel0, 0, }, | |
53 | ||
54 | /* End of the array */ | |
55 | { 0, }, | |
56 | }; | |
57 | ||
58 | /* | |
59 | * HFS-specific error messages. Most are repairable; some are not, but there's no indication of | |
60 | * which is which here (see fsck_hfs_msgnums.h; negative values are non-repairable). | |
61 | * Messages need not be in any particular order, as fsckAddMessages will sort everything. | |
62 | */ | |
63 | fsck_message_t | |
64 | hfs_errors[] = { | |
65 | /* Message Number Message Type Verbosity Arguments */ | |
66 | /* 500 - 509 */ | |
67 | { E_PEOF, "Incorrect block count for file %s", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeFile } }, | |
68 | { E_LEOF, "Incorrect size for file %s", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeFile } }, | |
69 | { E_DirVal, "Invalid directory item count", fsckMsgError, fsckLevel1, 0, } , | |
70 | { E_CName, "Invalid length for file name", fsckMsgError, fsckLevel1, 0, } , | |
71 | { E_NHeight, "Invalid node height", fsckMsgError, fsckLevel1, 0, } , | |
72 | { E_NoFile, "Missing file record for file thread", fsckMsgError, fsckLevel1, 0, } , | |
73 | { E_ABlkSz, "Invalid allocation block size", fsckMsgError, fsckLevel1, 0, } , | |
74 | { E_NABlks, "Invalid number of allocation blocks", fsckMsgError, fsckLevel1, 0, }, | |
75 | { E_VBMSt, "Invalid VBM start block", fsckMsgError, fsckLevel1, 0, }, | |
76 | { E_ABlkSt, "Invalid allocation block start", fsckMsgError, fsckLevel1, 0, }, | |
77 | ||
78 | /* 510 - 519 */ | |
79 | { E_ExtEnt, "Invalid extent entry", fsckMsgError, fsckLevel1, 0, }, | |
80 | { E_OvlExt, "Overlapped extent allocation (id = %u, %s)", fsckMsgError, fsckLevel1, 2, (const int[]){ fsckTypeInt, fsckTypePath } }, | |
81 | { E_LenBTH, "Invalid BTH length", fsckMsgError, fsckLevel1, 0, } , | |
82 | { E_ShortBTM, "BT map too short during repair", fsckMsgError, fsckLevel1, 0, } , | |
83 | { E_BTRoot, "Invalid root node number", fsckMsgError, fsckLevel1, 0, }, | |
84 | { E_NType, "Invalid node type", fsckMsgError, fsckLevel1, 0, }, | |
85 | { E_NRecs, "Invalid record count", fsckMsgError, fsckLevel1, 0, }, | |
86 | { E_IKey, "Invalid index key", fsckMsgError, fsckLevel1, 0, }, | |
87 | { E_IndxLk, "Invalid index link", fsckMsgError, fsckLevel1, 0, }, | |
88 | { E_SibLk, "Invalid sibling link", fsckMsgError, fsckLevel1, 0, }, | |
89 | ||
90 | /* 520 - 529 */ | |
91 | { E_BadNode, "Invalid node structure", fsckMsgError, fsckLevel1, 0, }, | |
92 | { E_OvlNode, "Overlapped node allocation", fsckMsgError, fsckLevel1, 0, }, | |
93 | { E_MapLk, "Invalid map node linkage", fsckMsgError, fsckLevel1, 0, }, | |
94 | { E_KeyLen, "Invalid key length", fsckMsgError, fsckLevel1, 0, }, | |
95 | { E_KeyOrd, "Keys out of order", fsckMsgError, fsckLevel1, 0, }, | |
96 | { E_BadMapN, "Invalid map node", fsckMsgError, fsckLevel1, 0, }, | |
97 | { E_BadHdrN, "Invalid header node", fsckMsgError, fsckLevel1, 0, }, | |
98 | { E_BTDepth, "Exceeded maximum B-tree depth", fsckMsgError, fsckLevel1, 0, }, | |
99 | { E_CatRec, "Invalid catalog record type", fsckMsgError, fsckLevel1, 0, }, | |
100 | { E_LenDir, "Invalid directory record length", fsckMsgError, fsckLevel1, 0, }, | |
101 | ||
102 | /* 530 - 539 */ | |
103 | { E_LenThd, "Invalid thread record length", fsckMsgError, fsckLevel1, 0, }, | |
104 | { E_LenFil, "Invalid file record length", fsckMsgError, fsckLevel1, 0, }, | |
105 | { E_NoRtThd, "Missing thread record for root dir", fsckMsgError, fsckLevel1, 0, }, | |
106 | { E_NoThd, "Missing thread record (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt } }, | |
107 | { E_NoDir, "Missing directory record (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt } }, | |
108 | { E_ThdKey, "Invalid key for thread record", fsckMsgError, fsckLevel1, 0, }, | |
109 | { E_ThdCN, "Invalid parent CName in thread record", fsckMsgError, fsckLevel1, 0, }, | |
110 | { E_LenCDR, "Invalid catalog record length", fsckMsgError, fsckLevel1, 0, }, | |
111 | { E_DirLoop, "Loop in directory hierarchy", fsckMsgError, fsckLevel1, 0, }, | |
112 | { E_RtDirCnt, "Invalid root directory count", fsckMsgError, fsckLevel1, 0, }, | |
113 | ||
114 | /* 540 - 549 */ | |
115 | { E_RtFilCnt, "Invalid root file count", fsckMsgError, fsckLevel1, 0, }, | |
116 | { E_DirCnt, "Invalid volume directory count", fsckMsgError, fsckLevel1, 0, }, | |
117 | { E_FilCnt, "Invalid volume file count", fsckMsgError, fsckLevel1, 0, }, | |
118 | { E_CatPEOF, "Invalid catalog PEOF", fsckMsgError, fsckLevel1, 0, }, | |
119 | { E_ExtPEOF, "Invalid extent file PEOF", fsckMsgError, fsckLevel1, 0, }, | |
120 | { E_CatDepth, "Nesting of folders has exceeded %d folders", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt } }, | |
121 | { E_NoFThdFlg, "File thread flag not set in file record", fsckMsgError, fsckLevel1, 0, }, | |
122 | { E_CatalogFlagsNotZero, "Reserved fields in the catalog record have incorrect data", fsckMsgError, fsckLevel1, 0, }, | |
123 | { E_BadFileName, "Invalid file name", fsckMsgError, fsckLevel1, 0, }, | |
124 | { E_InvalidClumpSize, "Invalid file clump size", fsckMsgError, fsckLevel1, 0, }, | |
125 | ||
126 | /* 550 - 559 */ | |
127 | { E_InvalidBTreeHeader, "Invalid B-tree header", fsckMsgError, fsckLevel1, 0, }, | |
128 | { E_LockedDirName, "Directory name locked", fsckMsgError, fsckLevel1, 0, }, | |
129 | { E_EntryNotFound, "Catalog file entry not found for extent", fsckMsgError, fsckLevel1, 0, }, | |
130 | { E_FreeBlocks, "Invalid volume free block count", fsckMsgError, fsckLevel1, 0, }, | |
131 | { E_MDBDamaged, "Master Directory Block needs minor repair", fsckMsgError, fsckLevel1, 0, }, | |
132 | { E_VolumeHeaderDamaged, "Volume header needs minor repair", fsckMsgError, fsckLevel1, 0, }, | |
133 | { E_VBMDamaged, "Volume bitmap needs minor repair for under-allocation", fsckMsgError, fsckLevel1, 0, }, | |
134 | { E_InvalidNodeSize, "Invalid B-tree node size", fsckMsgError, fsckLevel1, 0, }, | |
135 | { E_LeafCnt, "Invalid leaf record count", fsckMsgError, fsckLevel1, 0, }, | |
136 | { E_BadValue, "(It should be %s instead of %s)", fsckMsgDamageInfo,fsckLevel1, 2, (const int[]){ fsckTypeString, fsckTypeString } }, | |
137 | ||
138 | /* 560 - 569 */ | |
139 | { E_InvalidID, "Invalid file or directory ID found", fsckMsgError, fsckLevel1, 0, }, | |
140 | { E_VolumeHeaderTooNew, "I can't understand this version of HFS Plus", fsckMsgError, fsckLevel1, 0, }, | |
141 | { E_DiskFull, "Disk full error", fsckMsgError, fsckLevel1, 0, }, | |
142 | { E_InternalFileOverlap, "Internal files overlap (file %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt } }, | |
143 | { E_InvalidVolumeHeader, "Invalid volume header", fsckMsgError, fsckLevel1, 0, }, | |
144 | { E_InvalidMDBdrAlBlSt, "HFS wrapper volume needs repair", fsckMsgError, fsckLevel1, 0, }, | |
145 | { E_InvalidWrapperExtents, "Wrapper catalog file location needs repair", fsckMsgError, fsckLevel1, 0, }, | |
146 | { E_InvalidLinkCount, "Indirect node %d needs link count adjustment", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt } }, | |
147 | { E_UnlinkedFile, "Orphaned open unlinked file %s", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeFile } }, | |
148 | { E_InvalidPermissions, "Invalid BSD file type", fsckMsgError, fsckLevel1, 0, }, | |
149 | ||
150 | /* 570 - 579 */ | |
151 | { E_InvalidUID_Unused, "Invalid BSD User ID", fsckMsgError, fsckLevel1, 0, }, | |
152 | { E_IllegalName, "Illegal name", fsckMsgError, fsckLevel1, 0, }, | |
153 | { E_IncorrectNumThdRcd, "Incorrect number of thread records", fsckMsgError, fsckLevel1, 0, }, | |
154 | { E_SymlinkCreate, "Cannot create links to all corrupt files", fsckMsgError, fsckLevel1, 0, }, | |
155 | { E_BadJournal, "Invalid content in journal", fsckMsgError, fsckLevel1, 0, }, | |
156 | { E_IncorrectAttrCount, "Incorrect number of extended attributes", fsckMsgError, fsckLevel1, 0, }, | |
157 | { E_IncorrectSecurityCount, "Incorrect number of Access Control Lists", fsckMsgError, fsckLevel1, 0, }, | |
158 | { E_PEOAttr, "Incorrect block count for attribute %s of file %s", fsckMsgError, fsckLevel1, 2, (const int[]){ fsckTypeString, fsckTypeFile } }, | |
159 | { E_LEOAttr, "Incorrect size for attribute %s of file %s", fsckMsgError, fsckLevel1, 2, (const int[]){ fsckTypeString, fsckTypeFile } }, | |
160 | { E_AttrRec, "Invalid attribute record", fsckMsgError, fsckLevel1, 0, }, | |
161 | ||
162 | /* 580 - 589 */ | |
163 | { E_FldCount, "Incorrect folder count in a directory (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt } }, | |
164 | { E_HsFldCount, "HasFolderCount flag needs to be set (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt } }, | |
165 | { E_BadPermPrivDir, "Incorrect permissions for private directory", fsckMsgError, fsckLevel1, 0, }, | |
166 | { E_DirInodeBadFlags, "Incorrect flags for directory inode (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
167 | { E_DirInodeBadParent, "Invalid parent for directory inode (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
168 | { E_DirInodeBadName, "Invalid name for directory inode (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
169 | { E_DirHardLinkChain, "Incorrect number of directory hard links", fsckMsgError, fsckLevel1, 0, }, | |
170 | { E_DirHardLinkOwnerFlags, "Incorrect owner flags for directory hard link (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt } }, | |
171 | { E_DirHardLinkFinderInfo, "Invalid finder info for directory hard link (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt } }, | |
172 | { E_DirLinkAncestorFlags, "Incorrect flags for directory hard link ancestor (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt } }, | |
173 | ||
174 | /* 590 - 599 */ | |
175 | { E_BadParentHierarchy, "Bad parent directory hierarchy (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt } }, | |
176 | { E_DirHardLinkNesting, "Maximum nesting of folders and directory hard links reached", fsckMsgError, fsckLevel1, 0, }, | |
177 | { E_MissingPrivDir, "Missing private directory for directory hard links", fsckMsgError, fsckLevel1, 0, }, | |
178 | { E_InvalidLinkChainPrev, "Previous ID in a hard link chain is incorrect (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
179 | { E_InvalidLinkChainNext, "Next ID in a hard link chain is incorrect (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
180 | { E_FileInodeBadFlags, "Incorrect flags for file inode (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
181 | { E_FileInodeBadParent, "Invalid parent for file inode (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
182 | { E_FileInodeBadName, "Invalid name for file inode (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
183 | { E_FileHardLinkChain, "Incorrect number of file hard links", fsckMsgError, fsckLevel1, 0, }, | |
184 | { E_FileHardLinkFinderInfo, "Invalid finder info for file hard link (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
185 | ||
186 | /* 600 - 609 */ | |
187 | { E_InvalidLinkChainFirst, "Invalid first link in hard link chain (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
188 | { E_FileLinkBadFlags, "Incorrect flags for file hard link (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
189 | { E_DirLinkBadFlags, "Incorrect flags for directory hard link (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
190 | { E_OrphanFileLink, "Orphaned file hard link (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
191 | { E_OrphanDirLink, "Orphaned directory hard link (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
192 | { E_OrphanFileInode, "Orphaned file inode (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
193 | { E_OrphanDirInode, "Orphaned directory inode (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
194 | { E_OvlExtID, "Overlapped extent allocation (id = %d)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
195 | { E_UnusedNodeNotZeroed, "Unused node is not erased (node = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
196 | { E_VBMDamagedOverAlloc, "Volume bitmap needs minor repair for orphaned blocks", fsckMsgError, fsckLevel1, 0, }, | |
197 | ||
198 | /* 610 - 619 */ | |
199 | { E_BadHardLinkDate, "Bad hard link creation date", fsckMsgError, fsckLevel1, 0, }, | |
200 | { E_DirtyJournal, "Journal need to be replayed but volume is read-only", fsckMsgError, fsckLevel1, 0, }, | |
201 | { E_LinkChainNonLink, "File record has hard link chain flag (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
202 | { E_LinkHasData, "Hard link record has data extents (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
203 | { E_FileLinkCountError, "File has incorrect number of links (id = %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
204 | { E_BTreeSplitNode, "B-tree node is split across extents (file id %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
205 | { E_BadSymLink, "Bad information for symbolic link (file id %u)", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypeInt, } }, | |
206 | { E_BadSymLinkLength, "Symbolic link (file id %u) has bad length (is %u, should be %u)", | |
207 | fsckMsgError, fsckLevel1, 3, (const int[]){ fsckTypeInt, fsckTypeInt, fsckTypeInt} }, | |
208 | { E_BadSymLinkName, "Bad symbolic link is `%s'", fsckMsgError, fsckLevel1, 1, (const int[]){ fsckTypePath, } }, | |
209 | ||
210 | /* And all-zeroes to indicate the end */ | |
211 | { 0, }, | |
212 | }; | |
213 |