PageRenderTime 38ms CodeModel.GetById 21ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/packages/sysutils/diskdev_cmds/patches/diskdev_cmds-332.14-main.patch

http://github.com/OpenELEC/OpenELEC.tv
Patch | 2713 lines | 2554 code | 159 blank | 0 comment | 0 complexity | 26a2fbca3cb0cb14e8109b25084f81d1 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/cache.c diskdev_cmds-332.14-patched/fsck_hfs.tproj/cache.c
   2--- diskdev_cmds-332.14/fsck_hfs.tproj/cache.c	2006-02-20 22:45:15.000000000 +0100
   3+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/cache.c	2008-07-01 22:30:11.000000000 +0200
   4@@ -26,7 +26,11 @@
   5 #include <stdlib.h>
   6 #include <sys/mman.h>
   7 #include <sys/stat.h>
   8+#if LINUX
   9+#include "missing.h"
  10+#else
  11 #include <sys/types.h>
  12+#endif /* __LINUX__ */
  13 #include <sys/uio.h>
  14 #include <unistd.h>
  15 #include <string.h>
  16Files diskdev_cmds-332.14/fsck_hfs.tproj/cache.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/cache.o differ
  17diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/BlockCache.c diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/BlockCache.c
  18--- diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/BlockCache.c	2006-02-20 22:45:15.000000000 +0100
  19+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/BlockCache.c	2008-07-01 22:30:11.000000000 +0200
  20@@ -20,6 +20,9 @@
  21  * @APPLE_LICENSE_HEADER_END@
  22  */
  23 
  24+#if LINUX
  25+#include "missing.h"
  26+#endif
  27 #include "SRuntime.h"
  28 #include "Scavenger.h"
  29 #include "../cache.h"
  30Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/BlockCache.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/BlockCache.o differ
  31Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/BTreeAllocate.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/BTreeAllocate.o differ
  32diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/BTree.c diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/BTree.c
  33--- diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/BTree.c	2006-02-20 22:45:15.000000000 +0100
  34+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/BTree.c	2008-07-01 22:30:11.000000000 +0200
  35@@ -1705,7 +1705,9 @@
  36 								 UInt16					 version,
  37 								 BTreeInfoRec			*info )
  38 {
  39+#if !LINUX
  40 #pragma unused (version)
  41+#endif
  42 
  43 	BTreeControlBlockPtr	btreePtr;
  44 
  45Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/BTreeMiscOps.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/BTreeMiscOps.o differ
  46Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/BTreeNodeOps.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/BTreeNodeOps.o differ
  47Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/BTree.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/BTree.o differ
  48Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/BTreeScanner.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/BTreeScanner.o differ
  49diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/BTreeTreeOps.c diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/BTreeTreeOps.c
  50--- diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/BTreeTreeOps.c	2006-02-20 22:45:15.000000000 +0100
  51+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/BTreeTreeOps.c	2008-07-01 22:30:11.000000000 +0200
  52@@ -223,7 +223,7 @@
  53         //
  54         if (curNodeNum == 0)
  55         {
  56-//          Panic("\pSearchTree: curNodeNum is zero!");
  57+            Panic("SearchTree: curNodeNum is zero!");
  58             err = fsBTInvalidNodeErr;
  59             goto ErrorExit;
  60         }
  61@@ -433,7 +433,7 @@
  62 		M_ExitOnError (err);
  63 		
  64 		if ( DEBUG_BUILD && updateParent && newRoot )
  65-			DebugStr("\p InsertLevel: New root from primary key, update from secondary key...");
  66+			DebugStr("InsertLevel: New root from primary key, update from secondary key...");
  67 	}
  68 
  69 	//////////////////////// Update Parent(s) ///////////////////////////////
  70@@ -448,7 +448,7 @@
  71 		
  72 		secondaryKey = nil;
  73 		
  74-		PanicIf ( (level == btreePtr->treeDepth), "\p InsertLevel: unfinished insert!?");
  75+		PanicIf ( (level == btreePtr->treeDepth), "InsertLevel: unfinished insert!?");
  76 
  77 		++level;
  78 
  79@@ -456,7 +456,7 @@
  80 		index = treePathTable [level].index;
  81 		parentNodeNum = treePathTable [level].node;
  82 
  83-		PanicIf ( parentNodeNum == 0, "\p InsertLevel: parent node is zero!?");
  84+		PanicIf ( parentNodeNum == 0, "InsertLevel: parent node is zero!?");
  85 
  86 		err = GetNode (btreePtr, parentNodeNum, &parentNode);	// released as target node in next level up
  87 		M_ExitOnError (err);
  88@@ -470,7 +470,7 @@
  89 		{
  90 			//ее╩debug: check if ptr == targetNodeNum
  91 			GetRecordByIndex (btreePtr, parentNode.buffer, index, &keyPtr, &recPtr, &recSize);
  92-			PanicIf( (*(UInt32 *) recPtr) != targetNodeNum, "\p InsertLevel: parent ptr doesn't match target node!");
  93+			PanicIf( (*(UInt32 *) recPtr) != targetNodeNum, "InsertLevel: parent ptr doesn't match target node!");
  94 			
  95 			// need to delete and re-insert this parent key/ptr
  96 			// we delete it here and it gets re-inserted in the
  97@@ -532,7 +532,7 @@
  98 	(void) ReleaseNode (btreePtr, targetNode);
  99 	(void) ReleaseNode (btreePtr, &siblingNode);
 100 
 101-	Panic ("\p InsertLevel: an error occured!");
 102+	Panic ("InsertLevel: an error occured!");
 103 
 104 	return	err;
 105 
 106@@ -566,7 +566,7 @@
 107 
 108 	*rootSplit = false;
 109 	
 110-	PanicIf ( targetNode->buffer == siblingNode->buffer, "\p InsertNode: targetNode == siblingNode, huh?");
 111+	PanicIf ( targetNode->buffer == siblingNode->buffer, "InsertNode: targetNode == siblingNode, huh?");
 112 	
 113 	leftNodeNum = ((NodeDescPtr) targetNode->buffer)->bLink;
 114 	rightNodeNum = ((NodeDescPtr) targetNode->buffer)->fLink;
 115@@ -606,7 +606,7 @@
 116 	
 117 	if ( leftNodeNum > 0 )
 118 	{
 119-		PanicIf ( siblingNode->buffer != nil, "\p InsertNode: siblingNode already aquired!");
 120+		PanicIf ( siblingNode->buffer != nil, "InsertNode: siblingNode already aquired!");
 121 
 122 		if ( siblingNode->buffer == nil )
 123 		{
 124@@ -614,7 +614,7 @@
 125 			M_ExitOnError (err);
 126 		}
 127 
 128-		PanicIf ( ((NodeDescPtr) siblingNode->buffer)->fLink != nodeNum, "\p InsertNode, RotateLeft: invalid sibling link!" );
 129+		PanicIf ( ((NodeDescPtr) siblingNode->buffer)->fLink != nodeNum, "InsertNode, RotateLeft: invalid sibling link!" );
 130 
 131 		if ( !key->skipRotate )		// are rotates allowed?
 132 		{
 133@@ -703,7 +703,7 @@
 134 
 135 	targetNodeNum = treePathTable[level].node;
 136 	targetNodePtr = targetNode->buffer;
 137-	PanicIf (targetNodePtr == nil, "\pDeleteTree: targetNode has nil buffer!");
 138+	PanicIf (targetNodePtr == nil, "DeleteTree: targetNode has nil buffer!");
 139 
 140 	DeleteRecord (btreePtr, targetNodePtr, index);
 141 		
 142@@ -797,7 +797,7 @@
 143 			 
 144 			//ее╩debug: check if ptr == targetNodeNum
 145 			GetRecordByIndex (btreePtr, parentNode.buffer, index, &keyPtr, &recPtr, &recSize);
 146-			PanicIf( (*(UInt32 *) recPtr) != targetNodeNum, "\p DeleteTree: parent ptr doesn't match targetNodeNum!!");
 147+			PanicIf( (*(UInt32 *) recPtr) != targetNodeNum, " DeleteTree: parent ptr doesn't match targetNodeNum!!");
 148 			
 149 			// need to delete and re-insert this parent key/ptr
 150 			DeleteRecord (btreePtr, parentNode.buffer, index);
 151@@ -1018,7 +1018,7 @@
 152 										keyPtr, keyLength, recPtr, recSize);
 153 			if ( !didItFit )
 154 			{
 155-				Panic ("\pRotateLeft: InsertKeyRecord (left) returned false!");
 156+				Panic ("RotateLeft: InsertKeyRecord (left) returned false!");
 157 				err = fsBTBadRotateErr;
 158 				goto ErrorExit;
 159 			}
 160@@ -1031,7 +1031,7 @@
 161 			didItFit = RotateRecordLeft (btreePtr, leftNode, rightNode);
 162 			if ( !didItFit )
 163 			{
 164-				Panic ("\pRotateLeft: RotateRecordLeft returned false!");
 165+				Panic ("RotateLeft: RotateRecordLeft returned false!");
 166 				err = fsBTBadRotateErr;
 167 				goto ErrorExit;
 168 			}
 169@@ -1048,7 +1048,7 @@
 170 									keyPtr, keyLength, recPtr, recSize);
 171 		if ( !didItFit )
 172 		{
 173-			Panic ("\pRotateLeft: InsertKeyRecord (right) returned false!");
 174+			Panic ("RotateLeft: InsertKeyRecord (right) returned false!");
 175 			err = fsBTBadRotateErr;
 176 			goto ErrorExit;
 177 		}
 178@@ -1117,7 +1117,7 @@
 179 	right = rightNode->buffer;
 180 	left  = leftNode->buffer;
 181 	
 182-	PanicIf ( right->bLink != 0 && left == 0, "\p SplitLeft: left sibling missing!?" );
 183+	PanicIf ( right->bLink != 0 && left == 0, " SplitLeft: left sibling missing!?" );
 184 	
 185 	//ее type should be kLeafNode or kIndexNode
 186 	
 187@@ -1240,8 +1240,8 @@
 188 	Boolean				didItFit;
 189 	UInt16				keyLength;	
 190 	
 191-	PanicIf (leftNode == nil, "\pAddNewRootNode: leftNode == nil");
 192-	PanicIf (rightNode == nil, "\pAddNewRootNode: rightNode == nil");
 193+	PanicIf (leftNode == nil, "AddNewRootNode: leftNode == nil");
 194+	PanicIf (rightNode == nil, "AddNewRootNode: rightNode == nil");
 195 	
 196 	
 197 	/////////////////////// Initialize New Root Node ////////////////////////////
 198@@ -1264,7 +1264,7 @@
 199 	didItFit = InsertKeyRecord ( btreePtr, rootNode.buffer, 0, keyPtr, keyLength,
 200 								 (UInt8 *) &rightNode->bLink, 4 );
 201 
 202-	PanicIf ( !didItFit, "\pAddNewRootNode:InsertKeyRecord failed for left index record");
 203+	PanicIf ( !didItFit, "AddNewRootNode:InsertKeyRecord failed for left index record");
 204 
 205 
 206 	//////////////////// Insert Right Node Index Record /////////////////////////
 207@@ -1275,7 +1275,7 @@
 208 	didItFit = InsertKeyRecord ( btreePtr, rootNode.buffer, 1, keyPtr, keyLength,
 209 								 (UInt8 *) &leftNode->fLink, 4 );
 210 
 211-	PanicIf ( !didItFit, "\pAddNewRootNode:InsertKeyRecord failed for right index record");
 212+	PanicIf ( !didItFit, "AddNewRootNode:InsertKeyRecord failed for right index record");
 213 
 214 
 215 #if DEBUG_TREEOPS
 216@@ -1355,7 +1355,7 @@
 217 	}
 218 	rightPtr = rightNodePtr->buffer;
 219 	
 220-	PanicIf ( leftPtr->fLink != 0 && rightPtr == 0, "\p SplitRight: right sibling missing!?" );
 221+	PanicIf ( leftPtr->fLink != 0 && rightPtr == 0, "SplitRight: right sibling missing!?" );
 222 	
 223 	//ее type should be kLeafNode or kIndexNode
 224 	
 225@@ -1557,7 +1557,7 @@
 226 									keyPtr, keyLength, recPtr, recSize);
 227 		if ( !didItFit )
 228 		{
 229-			Panic ("\pRotateRight: InsertKeyRecord (left) returned false!");
 230+			Panic ("RotateRight: InsertKeyRecord (left) returned false!");
 231 			err = fsBTBadRotateErr;
 232 			goto ErrorExit;
 233 		}
 234@@ -1572,7 +1572,7 @@
 235 		didItFit = RotateRecordRight( btreePtr, leftNodePtr, rightNodePtr );
 236 		if ( !didItFit )
 237 		{
 238-			Panic ("\pRotateRight: RotateRecordRight returned false!");
 239+			Panic ("RotateRight: RotateRecordRight returned false!");
 240 			err = fsBTBadRotateErr;
 241 			goto ErrorExit;
 242 		}
 243@@ -1583,7 +1583,7 @@
 244 										keyPtr, keyLength, recPtr, recSize);
 245 			if ( !didItFit )
 246 			{
 247-				Panic ("\pRotateRight: InsertKeyRecord (left) returned false!");
 248+				Panic ("RotateRight: InsertKeyRecord (left) returned false!");
 249 				err = fsBTBadRotateErr;
 250 				goto ErrorExit;
 251 			}
 252@@ -1607,7 +1607,7 @@
 253 									keyPtr, keyLength, recPtr, recSize);
 254 		if ( !didItFit )
 255 		{
 256-			Panic ("\pRotateRight: InsertKeyRecord (right) returned false!");
 257+			Panic ("RotateRight: InsertKeyRecord (right) returned false!");
 258 			err = fsBTBadRotateErr;
 259 			goto ErrorExit;
 260 		}
 261Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/BTreeTreeOps.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/BTreeTreeOps.o differ
 262Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/CatalogCheck.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/CatalogCheck.o differ
 263Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/HardLinkCheck.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/HardLinkCheck.o differ
 264diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/hfs_endian.c diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/hfs_endian.c
 265--- diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/hfs_endian.c	2006-02-20 22:45:15.000000000 +0100
 266+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/hfs_endian.c	2008-07-02 00:10:48.000000000 +0200
 267@@ -31,7 +31,11 @@
 268 #include <sys/types.h>
 269 #include <sys/stat.h>
 270 
 271+#if LINUX
 272+#include "missing.h"
 273+#else
 274 #include <architecture/byte_order.h>
 275+#endif
 276 #include <hfs/hfs_format.h>
 277 
 278 #include "Scavenger.h"
 279@@ -194,7 +198,7 @@
 280     BTNodeDescriptor *srcDesc = src->buffer;
 281     BTreeControlBlockPtr btcb = fcb->fcbBtree;
 282     UInt16 *srcOffs = NULL;
 283-    UInt32 i;
 284+    int i;
 285     int error = 0;
 286 
 287 //			WriteError(fcb->fcbVolume->vcbGPtr, E_BadNode, fcb->fcbFileID, src->blockNum);
 288@@ -433,7 +437,7 @@
 289     BTNodeDescriptor *srcDesc = src->buffer;
 290     UInt16 *srcOffs = (UInt16 *)((char *)src->buffer + (src->blockSize - (srcDesc->numRecords * sizeof (UInt16))));
 291 	char *nextRecord;	/*  Points to start of record following current one */
 292-    UInt32 i;
 293+    int i;
 294     UInt32 j;
 295 
 296     if (fileID == kHFSExtentsFileID) {
 297@@ -559,7 +563,7 @@
 298             /* Make sure name length is consistent with key length */
 299             if (keyLength < sizeof(srcKey->parentID) + sizeof(srcKey->nodeName.length) +
 300                 srcKey->nodeName.length*sizeof(srcKey->nodeName.unicode[0])) {
 301-				if (debug) printf("hfs_swap_HFSPlusBTInternalNode: catalog record #%d keyLength=%d expected=%lu\n",
 302+				if (debug) printf("hfs_swap_HFSPlusBTInternalNode: catalog record #%d keyLength=%d expected=%i\n",
 303 					srcDesc->numRecords-i, keyLength, sizeof(srcKey->parentID) + sizeof(srcKey->nodeName.length) +
 304                     srcKey->nodeName.length*sizeof(srcKey->nodeName.unicode[0]));
 305 				WriteError(fcb->fcbVolume->vcbGPtr, E_KeyLen, fcb->fcbFileID, src->blockNum);
 306@@ -854,7 +858,7 @@
 307     UInt16 *srcOffs = (UInt16 *)((char *)src->buffer + (src->blockSize - (srcDesc->numRecords * sizeof (UInt16))));
 308 	char *nextRecord;	/*  Points to start of record following current one */
 309 
 310-    UInt32 i;
 311+    int i;
 312     UInt32 j;
 313 
 314     if (fileID == kHFSExtentsFileID) {
 315diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/hfs_endian.h diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/hfs_endian.h
 316--- diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/hfs_endian.h	2006-02-20 22:45:15.000000000 +0100
 317+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/hfs_endian.h	2008-07-01 22:30:11.000000000 +0200
 318@@ -27,9 +27,14 @@
 319  *
 320  * This file prototypes endian swapping routines for the HFS/HFS Plus
 321  * volume format.
 322- */
 323+*/
 324 #include <hfs/hfs_format.h>
 325+#if LINUX
 326+#include <endian.h>
 327+#include <byteswap.h>
 328+#else
 329 #include <architecture/byte_order.h>
 330+#endif
 331 #include "SRuntime.h"
 332 
 333 /*********************/
 334Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/hfs_endian.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/hfs_endian.o differ
 335Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/libdfa.a and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/libdfa.a differ
 336diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/Makefile.lnx diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/Makefile.lnx
 337--- diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/Makefile.lnx	1970-01-01 01:00:00.000000000 +0100
 338+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/Makefile.lnx	2008-07-01 22:30:11.000000000 +0200
 339@@ -0,0 +1,15 @@
 340+CFILES = hfs_endian.c BlockCache.c\
 341+         BTree.c BTreeAllocate.c BTreeMiscOps.c \
 342+         BTreeNodeOps.c BTreeScanner.c BTreeTreeOps.c\
 343+         CatalogCheck.c HardLinkCheck.c\
 344+         SBTree.c SControl.c SVerify1.c SVerify2.c\
 345+         SRepair.c SRebuildCatalogBTree.c\
 346+         SUtils.c SKeyCompare.c SDevice.c SExtents.c SAllocate.c\
 347+         SCatalog.c SStubs.c VolumeBitmapCheck.c
 348+OFILES = $(CFILES:.c=.o)
 349+
 350+libdfa.a: $(OFILES)
 351+	$(AR) rc $@ $?
 352+
 353+clean:
 354+	$(RM) $(OFILES) libdfa.a
 355Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SAllocate.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SAllocate.o differ
 356diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SBTree.c diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SBTree.c
 357--- diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SBTree.c	2006-02-20 22:45:15.000000000 +0100
 358+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SBTree.c	2008-07-01 22:30:11.000000000 +0200
 359@@ -93,7 +93,7 @@
 360 			CopyMemory(&resultIterator->key, foundKey, CalcKeySize(btcb, &resultIterator->key));	//ее warning, this could overflow user's buffer!!!
 361 
 362 		if ( DEBUG_BUILD && !ValidHFSRecord(data, btcb, *dataSize) )
 363-			DebugStr("\pSearchBTreeRecord: bad record?");
 364+			DebugStr("SearchBTreeRecord: bad record?");
 365 	}
 366 
 367 ErrorExit:
 368@@ -190,7 +190,7 @@
 369 		CopyMemory(&iterator->key, key, CalcKeySize(btcb, &iterator->key));	//ее warning, this could overflow user's buffer!!!
 370 		
 371 		if ( DEBUG_BUILD && !ValidHFSRecord(data, btcb, *dataSize) )
 372-			DebugStr("\pGetBTreeRecord: bad record?");
 373+			DebugStr("GetBTreeRecord: bad record?");
 374 
 375 	}
 376 	
 377@@ -222,7 +222,7 @@
 378 	CopyMemory(key, &iterator.key, CalcKeySize(btcb, (BTreeKey *) key));	//ее should we range check against maxkeylen?
 379 
 380 	if ( DEBUG_BUILD && !ValidHFSRecord(data, btcb, dataSize) )
 381-		DebugStr("\pInsertBTreeRecord: bad record?");
 382+		DebugStr("InsertBTreeRecord: bad record?");
 383 
 384 	result = BTInsertRecord( fcb, &iterator, &btRecord, dataSize );
 385 
 386@@ -284,7 +284,7 @@
 387 	CopyMemory(key, &iterator.key, CalcKeySize(btcb, (BTreeKey *) key));		//ее should we range check against maxkeylen?
 388 
 389 	if ( DEBUG_BUILD && !ValidHFSRecord(newData, btcb, dataSize) )
 390-		DebugStr("\pReplaceBTreeRecord: bad record?");
 391+		DebugStr("ReplaceBTreeRecord: bad record?");
 392 
 393 	result = BTReplaceRecord( fcb, &iterator, &btRecord, dataSize );
 394 
 395@@ -301,7 +301,9 @@
 396 OSStatus
 397 SetEndOfForkProc ( SFCB *filePtr, FSSize minEOF, FSSize maxEOF )
 398 {
 399+#if !LINUX
 400 #pragma unused (maxEOF)
 401+#endif
 402 
 403 	OSStatus	result;
 404 	UInt32		actualSectorsAdded;
 405@@ -321,7 +323,7 @@
 406 	else
 407 	{
 408 		if ( DEBUG_BUILD )
 409-			DebugStr("\pSetEndOfForkProc: minEOF is smaller than current size!");
 410+			DebugStr("SetEndOfForkProc: minEOF is smaller than current size!");
 411 		return -1;
 412 	}
 413 
 414@@ -347,7 +349,7 @@
 415 	//	Make sure we got at least as much space as we needed
 416 	//
 417 	if (filePtr->fcbLogicalSize < minEOF) {
 418-		Panic("\pSetEndOfForkProc: disk too full to extend B-tree file");
 419+		Panic("SetEndOfForkProc: disk too full to extend B-tree file");
 420 		return dskFulErr;
 421 	}
 422 	
 423@@ -419,7 +421,7 @@
 424 	if ( (keyLen < 6) || (keyLen > btcb->maxKeyLength) )
 425 	{
 426 		if ( DEBUG_BUILD )
 427-			DebugStr("\pCheckBTreeKey: bad key length!");
 428+			DebugStr("CheckBTreeKey: bad key length!");
 429 		return fsBTInvalidKeyLengthErr;
 430 	}
 431 	
 432Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SBTree.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SBTree.o differ
 433Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SCatalog.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SCatalog.o differ
 434diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/Scavenger.h diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/Scavenger.h
 435--- diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/Scavenger.h	2006-02-20 22:45:15.000000000 +0100
 436+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/Scavenger.h	2008-07-01 22:30:11.000000000 +0200
 437@@ -35,11 +35,16 @@
 438 #include "BTreeScanner.h"
 439 #include "hfs_endian.h"
 440 
 441+#if LINUX
 442+#define XATTR_MAXNAMELEN 127
 443+#include <limits.h>
 444+#else
 445 #include <sys/xattr.h>
 446 #include <sys/acl.h>
 447 #include <sys/kauth.h>
 448-#include <sys/errno.h>
 449 #include <sys/syslimits.h>
 450+#endif
 451+#include <sys/errno.h>
 452 
 453 #ifdef __cplusplus
 454 extern	"C" {
 455@@ -1434,4 +1439,8 @@
 456 };
 457 #endif
 458 
 459+#if LINUX
 460+#undef XATTR_MAXNAMELEN
 461+#endif
 462+
 463 #endif /* __SCAVENGER__ */
 464diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SControl.c diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SControl.c
 465--- diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SControl.c	2006-02-20 22:45:15.000000000 +0100
 466+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SControl.c	2008-07-01 22:30:11.000000000 +0200
 467@@ -739,7 +739,7 @@
 468 		pointer = (ScavStaticStructures *) AllocateClearMemory( sizeof(ScavStaticStructures) );
 469 		if ( pointer == nil ) {
 470 			if ( GPtr->logLevel >= kDebugLog ) {
 471-				printf( "\t error %d - could not allocate %ld bytes of memory \n",
 472+				printf( "\t error %d - could not allocate %i bytes of memory \n",
 473 					R_NoMem, sizeof(ScavStaticStructures) );
 474 			}
 475 			return( R_NoMem );
 476Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SControl.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SControl.o differ
 477diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SDevice.c diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SDevice.c
 478--- diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SDevice.c	2006-02-20 22:45:15.000000000 +0100
 479+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SDevice.c	2008-07-01 22:30:11.000000000 +0200
 480@@ -28,24 +28,61 @@
 481 #include <unistd.h>
 482 #include <errno.h>
 483 #include <sys/ioctl.h>
 484-
 485+#if LINUX
 486+#include <fcntl.h>
 487+#include <sys/stat.h>
 488+#else
 489 #include <IOKit/storage/IOMediaBSDClient.h>
 490-
 491+#endif /* LINUX */
 492 #else
 493-
 494 #include <Files.h>
 495 #include <Device.h>
 496 #include <Disks.h>
 497 
 498-#endif
 499-
 500+#endif 
 501 
 502 OSErr GetDeviceSize(int driveRefNum, UInt64 *numBlocks, UInt32 *blockSize)
 503 {
 504 #if BSD
 505 	UInt64 devBlockCount = 0;
 506 	int devBlockSize = 0;
 507+#if LINUX
 508+	struct stat stbuf;
 509+
 510+	devBlockSize = 512;
 511 
 512+#ifndef BLKGETSIZE
 513+#define BLKGETSIZE              _IO(0x12,96)
 514+#endif
 515+#ifndef BLKGETSIZE64
 516+#define BLKGETSIZE64            _IOR(0x12,114,size_t)
 517+#endif
 518+	if (fstat(driveRefNum, &stbuf) < 0){
 519+		printf("Error: %s\n", strerror(errno));
 520+		return(-1);
 521+	}
 522+        
 523+        if (S_ISREG(stbuf.st_mode)) {
 524+                devBlockCount = stbuf.st_size / 512;
 525+        } 
 526+        else if (S_ISBLK(stbuf.st_mode)) {
 527+                unsigned long size;
 528+                u_int64_t size64;
 529+                if (!ioctl(driveRefNum, BLKGETSIZE64, &size64))
 530+                        devBlockCount = size64 / 512;
 531+                else if (!ioctl(driveRefNum, BLKGETSIZE, &size))
 532+                        devBlockCount = size;
 533+                else{
 534+                        printf("Error: %s\n", strerror(errno));
 535+			return(-1);
 536+		}
 537+			
 538+        }
 539+        else{
 540+                printf("Device is not a block device");
 541+		return(-1);
 542+	}
 543+#elif BSD
 544 	if (ioctl(driveRefNum, DKIOCGETBLOCKCOUNT, &devBlockCount) < 0) {
 545 		printf("ioctl(DKIOCGETBLOCKCOUNT) for fd %d: %s\n", driveRefNum, strerror(errno));
 546 		return (-1);
 547@@ -55,6 +92,7 @@
 548 		printf("ioctl(DKIOCGETBLOCKSIZE) for fd %d: %s\n", driveRefNum, strerror(errno));
 549 		return (-1);
 550 	}
 551+#endif /* BSD */
 552 
 553 	if (devBlockSize != 512) {
 554 		*numBlocks = (devBlockCount * (UInt64)devBlockSize) / 512;
 555Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SDevice.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SDevice.o differ
 556Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SExtents.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SExtents.o differ
 557diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SKeyCompare.c diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SKeyCompare.c
 558--- diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SKeyCompare.c	2006-02-20 22:45:15.000000000 +0100
 559+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SKeyCompare.c	2008-07-01 22:30:11.000000000 +0200
 560@@ -454,7 +454,9 @@
 561  * The name portion of the key is compared using a 16-bit binary comparison. 
 562  * This is called from the b-tree code.
 563  */
 564+#if !LINUX
 565 __private_extern__
 566+#endif
 567 SInt32
 568 CompareAttributeKeys(const AttributeKey *searchKey, const AttributeKey *trialKey)
 569 {
 570Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SKeyCompare.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SKeyCompare.o differ
 571Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SRebuildCatalogBTree.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SRebuildCatalogBTree.o differ
 572diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SRepair.c diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SRepair.c
 573--- diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SRepair.c	2006-02-20 22:45:15.000000000 +0100
 574+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SRepair.c	2008-07-01 22:30:11.000000000 +0200
 575@@ -1593,7 +1593,9 @@
 576 
 577 static	OSErr	FixWrapperExtents( SGlobPtr GPtr, RepairOrderPtr p )
 578 {
 579+#if !LINUX
 580 #pragma unused (p)
 581+#endif
 582 
 583 	OSErr						err;
 584 	HFSMasterDirectoryBlock		*mdb;
 585Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SRepair.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SRepair.o differ
 586diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SRuntime.h diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SRuntime.h
 587--- diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SRuntime.h	2006-02-20 22:45:15.000000000 +0100
 588+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SRuntime.h	2008-07-01 22:30:11.000000000 +0200
 589@@ -27,8 +27,11 @@
 590 #define __SRUNTIME__
 591 
 592 #if BSD
 593-
 594+#if LINUX
 595+#include "missing.h"
 596+#else
 597 #include <sys/types.h>
 598+#endif
 599 #include <stdlib.h>
 600 #include <string.h>
 601 #include <stdio.h>
 602@@ -91,10 +94,12 @@
 603 
 604 typedef u_int32_t	HFSCatalogNodeID;
 605 
 606+#if !LINUX
 607 enum {
 608 	false		= 0,
 609 	true		= 1
 610 };
 611+#endif
 612 
 613 /* OS error codes */
 614 enum {
 615Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SStubs.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SStubs.o differ
 616diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SUtils.c diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SUtils.c
 617--- diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SUtils.c	2006-02-20 22:45:15.000000000 +0100
 618+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SUtils.c	2008-07-01 22:30:11.000000000 +0200
 619@@ -380,7 +380,8 @@
 620 //				GPtr->realVCB			Real in-memory vcb
 621 //------------------------------------------------------------------------------
 622 
 623-#if !BSD	
 624+#if BSD
 625+#if !LINUX
 626 OSErr GetVolumeFeatures( SGlobPtr GPtr )
 627 {
 628 	OSErr					err;
 629@@ -418,7 +419,7 @@
 630 	return( noErr );
 631 }
 632 #endif
 633-
 634+#endif
 635 
 636 
 637 /*-------------------------------------------------------------------------------
 638Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SUtils.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SUtils.o differ
 639Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SVerify1.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SVerify1.o differ
 640diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SVerify2.c diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SVerify2.c
 641--- diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SVerify2.c	2006-02-20 22:45:15.000000000 +0100
 642+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SVerify2.c	2008-07-01 22:30:11.000000000 +0200
 643@@ -32,7 +32,9 @@
 644 */
 645 
 646 #include <sys/ioctl.h>
 647+#if !LINUX
 648 #include <sys/disk.h>
 649+#endif
 650 
 651 #include "BTree.h"
 652 #include "BTreePrivate.h"
 653@@ -1240,8 +1242,13 @@
 654 	 * clump size for read-only media is irrelevant we skip the clump size 
 655 	 * check to avoid non useful warnings. 
 656 	 */
 657+#if LINUX
 658+	// FIXME
 659+	isWriteable = 1;
 660+#else
 661 	isWriteable = 0;
 662 	ioctl( GPtr->DrvNum, DKIOCISWRITABLE, &isWriteable );
 663+#endif
 664 	if ( isWriteable != 0 && 
 665 		 volumeHeader->catalogFile.clumpSize != vcb->vcbCatalogFile->fcbClumpSize ) {
 666 		PrintError(GPtr, E_InvalidClumpSize, 0);
 667Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/SVerify2.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/SVerify2.o differ
 668Files diskdev_cmds-332.14/fsck_hfs.tproj/dfalib/VolumeBitmapCheck.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/dfalib/VolumeBitmapCheck.o differ
 669Files diskdev_cmds-332.14/fsck_hfs.tproj/fsck_hfs and diskdev_cmds-332.14-patched/fsck_hfs.tproj/fsck_hfs differ
 670diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/fsck_hfs.c diskdev_cmds-332.14-patched/fsck_hfs.tproj/fsck_hfs.c
 671--- diskdev_cmds-332.14/fsck_hfs.tproj/fsck_hfs.c	2006-02-20 22:45:15.000000000 +0100
 672+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/fsck_hfs.c	2008-07-01 22:36:12.000000000 +0200
 673@@ -24,10 +24,14 @@
 674 #include <sys/types.h>
 675 #include <sys/stat.h>
 676 #include <sys/param.h>
 677+#if !LINUX
 678 #include <sys/ucred.h>
 679+#endif
 680 #include <sys/mount.h>
 681 #include <sys/ioctl.h>
 682+#if !LINUX
 683 #include <sys/disk.h>
 684+#endif
 685 
 686 #include <hfs/hfs_mount.h>
 687 
 688@@ -105,7 +109,7 @@
 689 	else
 690 		progname = *argv;
 691 
 692-	while ((ch = getopt(argc, argv, "dfglm:npqruy")) != EOF) {
 693+	while ((ch = getopt(argc, argv, "dfglm:napqruy")) != EOF) {
 694 		switch (ch) {
 695 		case 'd':
 696 			debug++;
 697@@ -141,6 +145,7 @@
 698 			yflag = 0;
 699 			break;
 700 
 701+		case 'a':
 702 		case 'p':
 703 			preen++;
 704 			break;
 705@@ -170,10 +175,12 @@
 706 	
 707 	if (guiControl)
 708 		debug = 0; /* debugging is for command line only */
 709-
 710+#if LINUX
 711+// FIXME
 712+#else
 713 	if (signal(SIGINT, SIG_IGN) != SIG_IGN)
 714 		(void)signal(SIGINT, catch);
 715-
 716+#endif
 717 	if (argc < 1) {
 718 		(void) fprintf(stderr, "%s: missing special-device\n", progname);
 719 		usage();
 720@@ -194,7 +201,9 @@
 721 	int chkLev, repLev, logLev;
 722 	int blockDevice_fd, canWrite;
 723 	char *unraw, *mntonname;
 724+#if !LINUX
 725 	struct statfs *fsinfo;
 726+#endif
 727 	int fs_fd=-1;  // fd to the root-dir of the fs we're checking (only w/lfag == 1)
 728 
 729 	flags = 0;
 730@@ -203,7 +212,9 @@
 731 	canWrite = 0;
 732 	unraw = NULL;
 733 	mntonname = NULL;
 734-
 735+#if LINUX
 736+	// FIXME
 737+#else
 738 	if (lflag) {
 739 		result = getmntinfo(&fsinfo, MNT_NOWAIT);
 740 
 741@@ -233,7 +244,7 @@
 742 		    }
 743 		}
 744 	}
 745-
 746+#endif
 747 	if (debug && preen)
 748 		pwarn("starting\n");
 749 	
 750@@ -306,6 +317,9 @@
 751 			}
 752 		}
 753 	} else {
 754+#if LINUX
 755+	// FIXME
 756+#else
 757 		struct statfs stfs_buf;
 758 		/*
 759 		 * Check to see if root is mounted read-write.
 760@@ -315,18 +329,24 @@
 761 		else
 762 			flags = 0;
 763 		ckfini(flags & MNT_RDONLY);
 764+#endif
 765 	}
 766 
 767 	/* XXX free any allocated memory here */
 768 
 769 	if (hotroot && fsmodified) {
 770+#if !LINUX
 771 		struct hfs_mount_args args;
 772+#endif
 773 		/*
 774 		 * We modified the root.  Do a mount update on
 775 		 * it, unless it is read-write, so we can continue.
 776 		 */
 777 		if (!preen)
 778 			printf("\n***** FILE SYSTEM WAS MODIFIED *****\n");
 779+#if LINUX
 780+		// FIXME
 781+#else
 782 		if (flags & MNT_RDONLY) {		
 783 			bzero(&args, sizeof(args));
 784 			flags |= MNT_UPDATE | MNT_RELOAD;
 785@@ -335,6 +355,7 @@
 786 				goto ExitThisRoutine;
 787 			}
 788 		}
 789+#endif
 790 		if (!preen)
 791 			printf("\n***** REBOOT NOW *****\n");
 792 		sync();
 793@@ -380,11 +401,13 @@
 794 		printf("Can't stat %s: %s\n", dev, strerror(errno));
 795 		return (0);
 796 	}
 797+#if !LINUX
 798 	if ((statb.st_mode & S_IFMT) != S_IFCHR) {
 799 		pfatal("%s is not a character device", dev);
 800 		if (reply("CONTINUE") == 0)
 801 			return (0);
 802 	}
 803+#endif
 804 	if ((fsreadfd = open(dev, O_RDONLY)) < 0) {
 805 		printf("Can't open %s: %s\n", dev, strerror(errno));
 806 		return (0);
 807@@ -407,10 +430,14 @@
 808 		printf("\n");
 809 
 810 	/* Get device block size to initialize cache */
 811+#if LINUX
 812+	devBlockSize = 512;
 813+#else
 814 	if (ioctl(fsreadfd, DKIOCGETBLOCKSIZE, &devBlockSize) < 0) {
 815 		pfatal ("Can't get device block size\n");
 816 		return (0);
 817 	}
 818+#endif
 819 	/* Initialize the cache */
 820 	if (CacheInit (&fscache, fsreadfd, fswritefd, devBlockSize,
 821 			CACHE_IOSIZE, CACHE_BLOCKS, CACHE_HASHSIZE) != EOK) {
 822@@ -431,11 +458,15 @@
 823 
 824 static void getWriteAccess( char *dev, int *blockDevice_fdPtr, int *canWritePtr )
 825 {
 826+#if !LINUX
 827 	int					i;
 828 	int					myMountsCount;
 829+#endif
 830 	void *				myPtr;
 831 	char *				myCharPtr;
 832+#if !LINUX
 833 	struct statfs *		myBufPtr;
 834+#endif
 835 	void *				myNamePtr;
 836 
 837 	myPtr = NULL;
 838@@ -456,18 +487,19 @@
 839 		*canWritePtr = 1;
 840 		goto ExitThisRoutine;
 841 	}
 842-	
 843 	// get count of mounts then get the info for each 
 844+#if LINUX
 845+	// FIXME
 846+#else
 847 	myMountsCount = getfsstat( NULL, 0, MNT_NOWAIT );
 848 	if ( myMountsCount < 0 )
 849 		goto ExitThisRoutine;
 850-
 851 	myPtr = (void *) malloc( sizeof(struct statfs) * myMountsCount );
 852 	if ( myPtr == NULL ) 
 853 		goto ExitThisRoutine;
 854 	myMountsCount = getfsstat( 	myPtr, 
 855-								(sizeof(struct statfs) * myMountsCount), 
 856-								MNT_NOWAIT );
 857+							(sizeof(struct statfs) * myMountsCount), 
 858+							MNT_NOWAIT );
 859 	if ( myMountsCount < 0 )
 860 		goto ExitThisRoutine;
 861 
 862@@ -481,8 +513,8 @@
 863 		}
 864 		myBufPtr++;
 865 	}
 866+#endif
 867 	*canWritePtr = 1;  // single user will get us here, f_mntfromname is not /dev/diskXXXX 
 868-	
 869 ExitThisRoutine:
 870 	if ( myPtr != NULL )
 871 		free( myPtr );
 872@@ -504,7 +536,7 @@
 873 	(void) fprintf(stderr, "  l = live fsck (lock down and test-only)\n");
 874 	(void) fprintf(stderr, "  m arg = octal mode used when creating lost+found directory \n");
 875 	(void) fprintf(stderr, "  n = assume a no response \n");
 876-	(void) fprintf(stderr, "  p = just fix normal inconsistencies \n");
 877+	(void) fprintf(stderr, "  p, a = just fix normal inconsistencies \n");
 878 	(void) fprintf(stderr, "  q = quick check returns clean, dirty, or failure \n");
 879 	(void) fprintf(stderr, "  r = rebuild catalog btree \n");
 880 	(void) fprintf(stderr, "  u = usage \n");
 881Files diskdev_cmds-332.14/fsck_hfs.tproj/fsck_hfs.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/fsck_hfs.o differ
 882diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/Makefile.lnx diskdev_cmds-332.14-patched/fsck_hfs.tproj/Makefile.lnx
 883--- diskdev_cmds-332.14/fsck_hfs.tproj/Makefile.lnx	1970-01-01 01:00:00.000000000 +0100
 884+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/Makefile.lnx	2008-07-01 22:30:11.000000000 +0200
 885@@ -0,0 +1,15 @@
 886+CFILES = fsck_hfs.c strings.c utilities.c cache.c
 887+OFILES = $(CFILES:.c=.o)
 888+
 889+all: fsck_hfs
 890+
 891+fsck_hfs: $(OFILES) dfalib/libdfa.a
 892+
 893+dfalib/libdfa.a: FORCE
 894+	$(MAKE) -C dfalib -f Makefile.lnx libdfa.a
 895+
 896+clean:
 897+	$(RM) fsck_hfs $(OFILES)
 898+	$(MAKE) -C dfalib -f Makefile.lnx clean
 899+
 900+.PHONY : FORCE clean
 901Files diskdev_cmds-332.14/fsck_hfs.tproj/strings.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/strings.o differ
 902diff -druN diskdev_cmds-332.14/fsck_hfs.tproj/utilities.c diskdev_cmds-332.14-patched/fsck_hfs.tproj/utilities.c
 903--- diskdev_cmds-332.14/fsck_hfs.tproj/utilities.c	2006-02-20 22:45:15.000000000 +0100
 904+++ diskdev_cmds-332.14-patched/fsck_hfs.tproj/utilities.c	2008-07-01 22:30:11.000000000 +0200
 905@@ -183,12 +183,14 @@
 906 			printf("Can't stat %s\n", raw);
 907 			return (origname);
 908 		}
 909+#if !LINUX
 910 		if ((stchar.st_mode & S_IFMT) == S_IFCHR) {
 911 			return (raw);
 912 		} else {
 913 			printf("%s is not a character device\n", raw);
 914 			return (origname);
 915 		}
 916+#endif
 917 	} else if ((stblock.st_mode & S_IFMT) == S_IFCHR && !retried) {
 918 		newname = unrawname(newname);
 919 		retried++;
 920@@ -214,7 +216,11 @@
 921 	*dp = 0;
 922 	(void)strcpy(rawbuf, name);
 923 	*dp = '/';
 924-	(void)strcat(rawbuf, "/r");
 925+#if LINUX
 926+	(void)strcat(rawbuf, "/");
 927+#else
 928+	(void)strcat(rawbuf,"/r");
 929+#endif
 930 	(void)strcat(rawbuf, &dp[1]);
 931 
 932 	return (rawbuf);
 933Files diskdev_cmds-332.14/fsck_hfs.tproj/utilities.o and diskdev_cmds-332.14-patched/fsck_hfs.tproj/utilities.o differ
 934diff -druN diskdev_cmds-332.14/include/bitstring.h diskdev_cmds-332.14-patched/include/bitstring.h
 935--- diskdev_cmds-332.14/include/bitstring.h	1970-01-01 01:00:00.000000000 +0100
 936+++ diskdev_cmds-332.14-patched/include/bitstring.h	2008-07-01 22:30:11.000000000 +0200
 937@@ -0,0 +1,164 @@
 938+/*
 939+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
 940+ *
 941+ * @APPLE_LICENSE_HEADER_START@
 942+ * 
 943+ * The contents of this file constitute Original Code as defined in and
 944+ * are subject to the Apple Public Source License Version 1.1 (the
 945+ * "License").  You may not use this file except in compliance with the
 946+ * License.  Please obtain a copy of the License at
 947+ * http://www.apple.com/publicsource and read it before using this file.
 948+ * 
 949+ * This Original Code and all software distributed under the License are
 950+ * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
 951+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
 952+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
 953+ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
 954+ * License for the specific language governing rights and limitations
 955+ * under the License.
 956+ * 
 957+ * @APPLE_LICENSE_HEADER_END@
 958+ */
 959+/*
 960+ * Copyright (c) 1989, 1993
 961+ *	The Regents of the University of California.  All rights reserved.
 962+ *
 963+ * This code is derived from software contributed to Berkeley by
 964+ * Paul Vixie.
 965+ *
 966+ * Redistribution and use in source and binary forms, with or without
 967+ * modification, are permitted provided that the following conditions
 968+ * are met:
 969+ * 1. Redistributions of source code must retain the above copyright
 970+ *    notice, this list of conditions and the following disclaimer.
 971+ * 2. Redistributions in binary form must reproduce the above copyright
 972+ *    notice, this list of conditions and the following disclaimer in the
 973+ *    documentation and/or other materials provided with the distribution.
 974+ * 3. All advertising materials mentioning features or use of this software
 975+ *    must display the following acknowledgement:
 976+ *	This product includes software developed by the University of
 977+ *	California, Berkeley and its contributors.
 978+ * 4. Neither the name of the University nor the names of its contributors
 979+ *    may be used to endorse or promote products derived from this software
 980+ *    without specific prior written permission.
 981+ *
 982+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 983+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 984+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 985+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 986+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 987+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 988+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 989+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 990+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 991+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 992+ * SUCH DAMAGE.
 993+ *
 994+ *	@(#)bitstring.h	8.1 (Berkeley) 7/19/93
 995+ */
 996+
 997+#ifndef _BITSTRING_H_
 998+#define	_BITSTRING_H_
 999+
1000+typedef	unsigned char bitstr_t;
1001+
1002+/* internal macros */
1003+				/* byte of the bitstring bit is in */
1004+#define	_bit_byte(bit) \
1005+	((bit) >> 3)
1006+
1007+				/* mask for the bit within its byte */
1008+#define	_bit_mask(bit) \
1009+	(1 << ((bit)&0x7))
1010+
1011+/* external macros */
1012+				/* bytes in a bitstring of nbits bits */
1013+#define	bitstr_size(nbits) \
1014+	((((nbits) - 1) >> 3) + 1)
1015+
1016+				/* allocate a bitstring */
1017+#define	bit_alloc(nbits) \
1018+	(bitstr_t *)calloc(1, \
1019+	    (unsigned int)bitstr_size(nbits) * sizeof(bitstr_t))
1020+
1021+				/* allocate a bitstring on the stack */
1022+#define	bit_decl(name, nbits) \
1023+	(name)[bitstr_size(nbits)]
1024+
1025+				/* is bit N of bitstring name set? */
1026+#define	bit_test(name, bit) \
1027+	((name)[_bit_byte(bit)] & _bit_mask(bit))
1028+
1029+				/* set bit N of bitstring name */
1030+#define	bit_set(name, bit) \
1031+	(name)[_bit_byte(bit)] |= _bit_mask(bit)
1032+
1033+				/* clear bit N of bitstring name */
1034+#define	bit_clear(name, bit) \
1035+	(name)[_bit_byte(bit)] &= ~_bit_mask(bit)
1036+
1037+				/* clear bits start ... stop in bitstring */
1038+#define	bit_nclear(name, start, stop) { \
1039+	register bitstr_t *_name = name; \
1040+	register int _start = start, _stop = stop; \
1041+	register int _startbyte = _bit_byte(_start); \
1042+	register int _stopbyte = _bit_byte(_stop); \
1043+	if (_startbyte == _stopbyte) { \
1044+		_name[_startbyte] &= ((0xff >> (8 - (_start&0x7))) | \
1045+				      (0xff << ((_stop&0x7) + 1))); \
1046+	} else { \
1047+		_name[_startbyte] &= 0xff >> (8 - (_start&0x7)); \
1048+		while (++_startbyte < _stopbyte) \
1049+			_name[_startbyte] = 0; \
1050+		_name[_stopbyte] &= 0xff << ((_stop&0x7) + 1); \
1051+	} \
1052+}
1053+
1054+				/* set bits start ... stop in bitstring */
1055+#define	bit_nset(name, start, stop) { \
1056+	register bitstr_t *_name = name; \
1057+	register int _start = start, _stop = stop; \
1058+	register int _startbyte = _bit_byte(_start); \
1059+	register int _stopbyte = _bit_byte(_stop); \
1060+	if (_startbyte == _stopbyte) { \
1061+		_name[_startbyte] |= ((0xff << (_start&0x7)) & \
1062+				    (0xff >> (7 - (_stop&0x7)))); \
1063+	} else { \
1064+		_name[_startbyte] |= 0xff << ((_start)&0x7); \
1065+		while (++_startbyte < _stopbyte) \
1066+	    		_name[_startbyte] = 0xff; \
1067+		_name[_stopbyte] |= 0xff >> (7 - (_stop&0x7)); \
1068+	} \
1069+}
1070+
1071+				/* find first bit clear in name */
1072+#define	bit_ffc(name, nbits, value) { \
1073+	register bitstr_t *_name = name; \
1074+	register int _byte, _nbits = nbits; \
1075+	register int _stopbyte = _bit_byte(_nbits), _value = -1; \
1076+	for (_byte = 0; _byte <= _stopbyte; ++_byte) \
1077+		if (_name[_byte] != 0xff) { \
1078+			_value = _byte << 3; \
1079+			for (_stopbyte = _name[_byte]; (_stopbyte&0x1); \
1080+			    ++_value, _stopbyte >>= 1); \
1081+			break; \
1082+		} \
1083+	*(value) = _value; \
1084+}
1085+
1086+				/* find first bit set in name */
1087+#define	bit_ffs(name, nbits, value) { \
1088+	register bitstr_t *_name = name; \
1089+	register int _byte, _nbits = nbits; \
1090+	register int _stopbyte = _bit_byte(_nbits), _value = -1; \
1091+	for (_byte = 0; _byte <= _stopbyte; ++_byte) \
1092+		if (_name[_byte]) { \
1093+			_value = _byte << 3; \
1094+			for (_stopbyte = _name[_byte]; !(_stopbyte&0x1); \
1095+			    ++_value, _stopbyte >>= 1); \
1096+			break; \
1097+		} \
1098+	*(value) = _value; \
1099+}
1100+
1101+#endif /* !_BITSTRING_H_ */
1102diff -druN diskdev_cmds-332.14/include/hfs/hfs_format.h diskdev_cmds-332.14-patched/include/hfs/hfs_format.h
1103--- diskdev_cmds-332.14/include/hfs/hfs_format.h	1970-01-01 01:00:00.000000000 +0100
1104+++ diskdev_cmds-332.14-patched/include/hfs/hfs_format.h	2008-07-01 22:30:11.000000000 +0200
1105@@ -0,0 +1,689 @@
1106+/*
1107+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
1108+ *
1109+ * @APPLE_LICENSE_HEADER_START@
1110+ * 
1111+ * The contents of this file constitute Original Code as defined in and
1112+ * are subject to the Apple Public Source License Version 1.1 (the
1113+ * "License").  You may not use this file except in compliance with the
1114+ * License.  Please obtain a copy of the License at
1115+ * http://www.apple.com/publicsource and read it before using this file.
1116+ * 
1117+ * This Original Code and all software distributed under the License are
1118+ * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1119+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1120+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1121+ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
1122+ * License for the specific language governing rights and limitations
1123+ * under the License.
1124+ * 
1125+ * @APPLE_LICENSE_HEADER_END@
1126+ */
1127+#ifndef __HFS_FORMAT__
1128+#define __HFS_FORMAT__
1129+
1130+#include "missing.h"
1131+
1132+#include <sys/appleapiopts.h>
1133+
1134+/*
1135+ * hfs_format.c
1136+ *
1137+ * This file describes the on-disk format for HFS and HFS Plus volumes.
1138+ * The HFS Plus volume format is desciibed in detail in Apple Technote 1150.
1139+ *
1140+ * http://developer.apple.com/technotes/tn/tn1150.html
1141+ *
1142+ */
1143+
1144+#ifdef __cplusplus
1145+extern "C" {
1146+#endif
1147+
1148+/* some on-disk hfs structures have 68K alignment (misaligned) */
1149+
1150+#define PACKED_S	__attribute__((packed))
1151+	
1152+/* Signatures used to differentiate between HFS and HFS Plus volumes */
1153+enum {
1154+	kHFSSigWord		= 0x4244,	/* 'BD' in ASCII */
1155+	kHFSPlusSigWord		= 0x482B,	/* 'H+' in ASCII */
1156+	kHFSXSigWord		= 0x4858,	/* 'HX' in ASCII */
1157+
1158+	kHFSPlusVersion		= 0x0004,	/* 'H+' volumes are version 4 only */
1159+	kHFSXVersion		= 0x0005,	/* 'HX' volumes start with version 5 */
1160+
1161+	kHFSPlusMountVersion	= 0x31302E30,	/* '10.0' for Mac OS X */
1162+	kHFSJMountVersion	= 0x4846534a,	/* 'HFSJ' for journaled HFS+ on OS X */
1163+	kFSKMountVersion	= 0x46534b21	/* 'FSK!' for failed journal replay */
1164+}PACKED_S;
1165+
1166+
1167+#ifdef __APPLE_API_PRIVATE
1168+/*
1169+ * Mac OS X has a special directory for linked and unlinked files (HFS Plus only).
1170+ * This directory and its contents are never exported from the filesystem under
1171+ * Mac OS X.
1172+ *
1173+ * To make this folder name sort last,  it has embedded null prefix.
1174+ * (0xC0, 0x80 in UTF-8)
1175+ */
1176+#define HFSPLUSMETADATAFOLDER  "\xC0\x80\xC0\x80\xC0\x80\xC0\x80HFS+ Private Data"
1177+
1178+/*
1179+ * Files in the HFS Private Data folder have one of the following prefixes
1180+ * followed by a decimal number (no leading zeros).  For indirect nodes this
1181+ * number is a 32 bit random number.  For unlinked (deleted) files that are
1182+ * still open, the number is the file ID for that file.
1183+ *
1184+ * e.g.  iNode7182000 and temp3296
1185+ */
1186+#define HFS_INODE_PREFIX	"iNode"
1187+#define HFS_DELETE_PREFIX	"temp"
1188+
1189+#endif /* __APPLE_API_PRIVATE */
1190+
1191+/*
1192+ * Indirect link files (hard links) have the following type/creator.
1193+ */
1194+enum {
1195+	kHardLinkFileType = 0x686C6E6B,  /* 'hlnk' */
1196+	kHFSPlusCreator   = 0x6866732B   /* 'hfs+' */
1197+}PACKED_S;
1198+
1199+
1200+#ifndef _HFSUNISTR255_DEFINED_
1201+#define _HFSUNISTR255_DEFINED_
1202+/* Unicode strings are used for HFS Plus file and folder names */
1203+struct HFSUniStr255 {
1204+	u_int16_t	length;		/* number of unicode characters */
1205+	u_int16_t	unicode[255];	/* unicode characters */
1206+} PACKED_S;
1207+typedef struct HFSUniStr255 HFSUniStr255;
1208+typedef const HFSUniStr255 *ConstHFSUniStr255Param;
1209+#endif /* _HFSUNISTR255_DEFINED_ */
1210+
1211+enum {
1212+	kHFSMaxVolumeNameChars		= 27,
1213+	kHFSMaxFileNameChars		= 31,
1214+	kHFSPlusMaxFileNameChars	= 255
1215+}PACKED_S;
1216+
1217+
1218+/* Extent overflow file data structures */
1219+
1220+/* HFS Extent key */
1221+struct HFSExtentKey {
1222+	u_int8_t 	keyLength;	/* length of key, excluding this field */
1223+	u_int8_t 	forkType;	/* 0 = data fork, FF = resource fork */
1224+	u_int32_t 	fileID;		/* file ID */
1225+	u_int16_t 	startBlock;	/* first file allocation block number in this extent */
1226+}PACKED_S;
1227+typedef struct HFSExtentKey HFSExtentKey;
1228+
1229+/* HFS Plus Extent key */
1230+struct HFSPlusExtentKey {
1231+	u_int16_t 	keyLength;		/* length of key, excluding this field */
1232+	u_int8_t 	forkType;		/* 0 = data fork, FF = resource fork */
1233+	u_int8_t 	pad;			/* make the other fields align on 32-bit boundary */
1234+	u_int32_t 	fileID;			/* file ID */
1235+	u_int32_t 	startBlock;		/* first file allocation block number in this extent */
1236+}PACKED_S;
1237+typedef struct HFSPlusExtentKey HFSPlusExtentKey;
1238+
1239+/* Number of extent descriptors per extent record */
1240+enum {
1241+	kHFSExtentDensity	= 3,
1242+	kHFSPlusExtentDensity	= 8
1243+}PACKED_S;
1244+
1245+/* HFS extent descriptor */
1246+struct HFSExtentDescriptor {
1247+	u_int16_t 	startBlock;		/* first allocation block */
1248+	u_int16_t 	blockCount;		/* number of allocation blocks */
1249+}PACKED_S;
1250+typedef struct HFSExtentDescriptor HFSExtentDescriptor;
1251+
1252+/* HFS Plus extent descriptor */
1253+struct HFSPlusExtentDescriptor {
1254+	u_int32_t 	startBlock;		/* first allocation block */
1255+	u_int32_t 	blockCount;		/* number of allocation blocks */
1256+}PACKED_S;
1257+typedef struct HFSPlusExtentDescriptor HFSPlusExtentDescriptor;
1258+
1259+/* HFS extent record */
1260+typedef HFSExtentDescriptor HFSExtentRecord[3];
1261+
1262+/* HFS Plus extent record */
1263+typedef HFSPlusExtentDescriptor HFSPlusExtentRecord[8];
1264+
1265+
1266+/* Finder information */
1267+struct FndrFileInfo {
1268+	u_int32_t 	fdType;		/* file type */
1269+	u_int32_t 	fdCreator;	/* file creator */
1270+	u_int16_t 	fdFlags;	/* Finder flags */
1271+	struct {
1272+	    int16_t	v;		/* file's location */
1273+	    int16_t	h;
1274+	} PACKED_S fdLocation;
1275+	int16_t 	opaque;
1276+}PACKED_S;
1277+typedef struct FndrFileInfo FndrFileInfo;
1278+
1279+struct FndrDirInfo {
1280+	struct {			/* folder's window rectangle */
1281+	    int16_t	top;
1282+	    int16_t	left;
1283+	    int16_t	bottom;
1284+	    int16_t	right;
1285+	}PACKED_S frRect;
1286+	unsigned short 	frFlags;	/* Finder flags */
1287+	struct {
1288+	    u_int16_t	v;		/* folder's location */
1289+	    u_int16_t	h;
1290+	}PACKED_S frLocation;
1291+	int16_t 	opaque;
1292+}PACKED_S;
1293+typedef struct FndrDirInfo FndrDirInfo;
1294+
1295+struct FndrOpaqueInfo {
1296+	int8_t opaque[16];
1297+}PACKED_S;
1298+typedef struct FndrOpaqueInfo FndrOpaqueInfo;
1299+
1300+
1301+/* HFS Plus Fork data info - 80 bytes */
1302+struct HFSPlusForkData {
1303+	u_int64_t 		logicalSize;	/* fork's logical size in bytes */
1304+	u_int32_t 		clumpSize;	/* fork's clump size in bytes */
1305+	u_int32_t 		totalBlocks;	/* total blocks used by this fork */
1306+	HFSPlusExtentRecord 	extents;	/* initial set of extents */
1307+}PACKED_S;
1308+typedef struct HFSPlusForkData HFSPlusForkData;
1309+
1310+
1311+/* Mac OS X has 16 bytes worth of "BSD" info.
1312+ *
1313+ * Note:  Mac OS 9 implementations and applications
1314+ * should preserve, but not change, this information.
1315+ */
1316+struct HFSPlusBSDInfo {
1317+	u_int32_t 	ownerID;	/* user or group ID of file/folder owner */
1318+	u_int32_t 	groupID;	/* additional user of group ID */
1319+	u_int8_t 	adminFlags;	/* super-user changeable flags */
1320+	u_int8_t 	ownerFlags;	/* owner changeable flags */
1321+	u_int16_t 	fileMode;	/* file type and permission bits */
1322+	union {
1323+	    u_int32_t	iNodeNum;	/* indirect node number (hard links only) */
1324+	    u_int32_t	linkCount;	/* links that refer to this indirect node */
1325+	    u_int32_t	rawDevice;	/* special file device (FBLK and FCHR only) */
1326+	}PACKED_S special;
1327+}PACKED_S;
1328+typedef struct HFSPlusBSDInfo HFSPlusBSDInfo;
1329+
1330+
1331+/* Catalog file data structures */
1332+
1333+enum {
1334+	kHFSRootParentID		= 1,	/* Parent ID of the root folder */
1335+	kHFSRootFolderID		= 2,	/* Folder ID of the root folder */
1336+	kHFSExtentsFileID		= 3,	/* File ID of the extents file */
1337+	kHFSCatalogFileID		= 4,	/* File ID of the catalog file */
1338+	kHFSBadBlockFileID		= 5,	/* File ID of the bad allocation block file */
1339+	kHFSAllocationFileID		= 6,	/* File ID of the allocation file (HFS Plus only) */
1340+	kHFSStartupFileID		= 7,	/* File ID of the startup file (HFS Plus only) */
1341+	kHFSAttributesFileID		= 8,	/* File ID of the attribute file (HFS Plus only) */
1342+	kHFSRepairCatalogFileID		= 14,	/* Used when rebuilding Catalog B-tree */
1343+	kHFSBogusExtentFileID		= 15,	/* Used for exchanging extents in extents file */
1344+	kHFSFirstUserCatalogNodeID	= 16
1345+}PACKED_S;
1346+
1347+/* HFS catalog key */
1348+struct HFSCatalogKey {
1349+	u_int8_t 	keyLength;		/* key length (in bytes) */
1350+	u_int8_t 	reserved;		/* reserved (set to zero) */
1351+	u_int32_t 	parentID;		/* parent folder ID */
1352+	u_int8_t 	nodeName[kHFSMaxFileNameChars + 1]; /* catalog node name */
1353+}PACKED_S;
1354+typedef struct HFSCatalogKey HFSCatalogKey;
1355+
1356+/* HFS Plus catalog key */
1357+struct HFSPlusCatalogKey {
1358+	u_int16_t 		keyLength;	/* key length (in bytes) */
1359+	u_int32_t 		parentID;	/* parent folder ID */
1360+	HFSUniStr255 		nodeName;	/* catalog node name */
1361+}PACKED_S;
1362+typedef struct HFSPlusCatalogKey HFSPlusCatalogKey;
1363+
1364+/* Catalog record types */
1365+enum {
1366+	/* HFS Catalog Records */
1367+	kHFSFolderRecord		= 0x0100,	/* Folder record */
1368+	kHFSFileRecord			= 0x0200,	/* File record */
1369+	kHFSFolderThreadRecord		= 0x0300,	/* Folder thread record */
1370+	kHFSFileThreadRecord		= 0x0400,	/* File thread record */
1371+
1372+	/* HFS Plus Catalog Records */
1373+	kHFSPlusFolderRecord		= 1,		/* Folder record */
1374+	kHFSPlusFileRecord		= 2,		/* File record */
1375+	kHFSPlusFolderThreadRecord	= 3,		/* Folder thread record */
1376+	kHFSPlusFileThreadRecord	= 4		/* File thread record */
1377+}PACKED_S;
1378+
1379+
1380+/* Catalog file record flags */
1381+enum {
1382+	kHFSFileLockedBit	= 0x0000,	/* file is locked and cannot be written to */
1383+	kHFSFileLockedMask	= 0x0001,
1384+
1385+	kHFSThreadExistsBit	= 0x0001,	/* a file thread record exists for this file */
1386+	kHFSThreadExistsMask	= 0x0002,
1387+
1388+	kHFSHasAttributesBit	= 0x0002,	/* object has extended attributes */
1389+	kHFSHasAttributesMask	= 0x0004,
1390+
1391+	kHFSHasSecurityBit	= 0x0003,	/* object has security data (ACLs) */
1392+	kHFSHasSecurityMask	= 0x0008
1393+}PACKED_S;
1394+
1395+
1396+/* HFS catalog folder record - 70 bytes */
1397+struct HFSCatalogFolder {
1398+	int16_t 		recordType;		/* == kHFSFolderRecord */
1399+	u_int16_t 		flags;			/* folder flags */
1400+	u_int16_t 		valence;		/* folder valence */
1401+	u_int32_t		folderID;		/* folder ID */
1402+	u_int32_t 		createDate;		/* date and time of creation */
1403+	u_int32_t 		modifyDate;		/*…

Large files files are truncated, but you can click here to view the full file