hfsprogs: fix compilation under glibc

Seems sys/sysctl.h was removed.

Refresh patches.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev
2020-12-30 17:41:58 -08:00
parent 34fb6fa5c2
commit 899b7aae50
19 changed files with 186 additions and 311 deletions
@@ -15,11 +15,9 @@ Subject: Rename custom macro nil with NULL
fsck_hfs.tproj/dfalib/SVerify2.c | 4 +-
10 files changed, 177 insertions(+), 177 deletions(-)
diff --git a/fsck_hfs.tproj/dfalib/BTree.c b/fsck_hfs.tproj/dfalib/BTree.c
index 7ad9fe0..c0c8744 100644
--- a/fsck_hfs.tproj/dfalib/BTree.c
+++ b/fsck_hfs.tproj/dfalib/BTree.c
@@ -163,21 +163,21 @@ OSStatus BTInitialize (FCB *filePtr,
@@ -163,21 +163,21 @@ OSStatus BTInitialize (FCB *filePtr
////////////////////// Preliminary Error Checking ///////////////////////////
@@ -48,7 +46,7 @@ index 7ad9fe0..c0c8744 100644
if ((maxKeyLength == 0) ||
(maxKeyLength > kMaxKeyLength)) return fsBTInvalidKeyLengthErr;
@@ -209,7 +209,7 @@ OSStatus BTInitialize (FCB *filePtr,
@@ -209,7 +209,7 @@ OSStatus BTInitialize (FCB *filePtr
//////////////////////// Allocate Control Block /////////////////////////////
M_RESIDENT_ALLOCATE_FIXED_CLEAR( &btreePtr, sizeof( BTreeControlBlock ), kFSBTreeControlBlockType );
@@ -57,7 +55,7 @@ index 7ad9fe0..c0c8744 100644
{
err = memFullErr;
goto ErrorExit;
@@ -220,7 +220,7 @@ OSStatus BTInitialize (FCB *filePtr,
@@ -220,7 +220,7 @@ OSStatus BTInitialize (FCB *filePtr
btreePtr->flags = 0;
btreePtr->attributes = 0;
btreePtr->forkPtr = forkPtr;
@@ -66,7 +64,7 @@ index 7ad9fe0..c0c8744 100644
btreePtr->keyDescPtr = keyDescPtr;
btreePtr->btreeType = btreeType;
btreePtr->treeDepth = 0;
@@ -282,7 +282,7 @@ OSStatus BTInitialize (FCB *filePtr,
@@ -282,7 +282,7 @@ OSStatus BTInitialize (FCB *filePtr
///////////////////// Copy Key Descriptor To Header /////////////////////////
#if SupportsKeyDescriptors
@@ -75,7 +73,7 @@ index 7ad9fe0..c0c8744 100644
{
err = CheckKeyDescriptor (keyDescPtr, maxKeyLength);
M_ExitOnError (err);
@@ -309,7 +309,7 @@ OSStatus BTInitialize (FCB *filePtr,
@@ -309,7 +309,7 @@ OSStatus BTInitialize (FCB *filePtr
err = UpdateHeader (btreePtr);
M_ExitOnError (err);
@@ -84,7 +82,7 @@ index 7ad9fe0..c0c8744 100644
M_RESIDENT_DEALLOCATE_FIXED( btreePtr, sizeof( BTreeControlBlock ), kFSBTreeControlBlockType );
return noErr;
@@ -320,7 +320,7 @@ OSStatus BTInitialize (FCB *filePtr,
@@ -320,7 +320,7 @@ OSStatus BTInitialize (FCB *filePtr
ErrorExit:
(void) ReleaseNode (btreePtr, &headerNode);
@@ -93,7 +91,7 @@ index 7ad9fe0..c0c8744 100644
M_RESIDENT_DEALLOCATE_FIXED( btreePtr, sizeof( BTreeControlBlock ), kFSBTreeControlBlockType );
return err;
@@ -342,7 +342,7 @@ Input: filePtr - pointer to file to open as a B-tree
@@ -342,7 +342,7 @@ Input: filePtr - pointer to file to
setEndOfForkProc - pointer to client's SetEOF function
Result: noErr - success
@@ -102,7 +100,7 @@ index 7ad9fe0..c0c8744 100644
fsBTInvalidFileErr -
memFullErr -
!= noErr - failure
@@ -364,16 +364,16 @@ OSStatus BTOpenPath (SFCB *filePtr,
@@ -364,16 +364,16 @@ OSStatus BTOpenPath (SFCB *filePtr
////////////////////// Preliminary Error Checking ///////////////////////////
@@ -125,7 +123,7 @@ index 7ad9fe0..c0c8744 100644
return noErr;
// is file large enough to contain header node?
@@ -384,7 +384,7 @@ OSStatus BTOpenPath (SFCB *filePtr,
@@ -384,7 +384,7 @@ OSStatus BTOpenPath (SFCB *filePtr
//////////////////////// Allocate Control Block /////////////////////////////
btreePtr = (BTreeControlBlock*) AllocateClearMemory( sizeof( BTreeControlBlock ) );
@@ -134,7 +132,7 @@ index 7ad9fe0..c0c8744 100644
{
Panic ("\pBTOpen: no memory for btreePtr.");
return memFullErr;
@@ -397,7 +397,7 @@ OSStatus BTOpenPath (SFCB *filePtr,
@@ -397,7 +397,7 @@ OSStatus BTOpenPath (SFCB *filePtr
/////////////////////////// Read Header Node ////////////////////////////////
@@ -143,7 +141,7 @@ index 7ad9fe0..c0c8744 100644
btreePtr->fcbPtr = filePtr;
filePtr->fcbBtree = (void *) btreePtr; // attach btree cb to file
@@ -487,7 +487,7 @@ OSStatus BTOpenPath (SFCB *filePtr,
@@ -487,7 +487,7 @@ OSStatus BTOpenPath (SFCB *filePtr
////////////////////////// Get Key Descriptor ///////////////////////////////
#if SupportsKeyDescriptors
@@ -152,7 +150,7 @@ index 7ad9fe0..c0c8744 100644
{
err = GetKeyDescriptor (btreePtr, nodeRec.buffer); //¥¥ it should check amount of memory allocated...
M_ExitOnError (err);
@@ -499,7 +499,7 @@ OSStatus BTOpenPath (SFCB *filePtr,
@@ -499,7 +499,7 @@ OSStatus BTOpenPath (SFCB *filePtr
else
#endif
{
@@ -161,7 +159,7 @@ index 7ad9fe0..c0c8744 100644
}
err = ReleaseNode (btreePtr, &nodeRec);
@@ -528,7 +528,7 @@ OSStatus BTOpenPath (SFCB *filePtr,
@@ -528,7 +528,7 @@ OSStatus BTOpenPath (SFCB *filePtr
ErrorExit:
@@ -170,7 +168,7 @@ index 7ad9fe0..c0c8744 100644
(void) ReleaseNode (btreePtr, &nodeRec);
DisposeMemory( btreePtr );
@@ -567,7 +567,7 @@ OSStatus BTClosePath (SFCB *filePtr)
@@ -567,7 +567,7 @@ OSStatus BTClosePath (SFCB *filePt
btreePtr = (BTreeControlBlockPtr) filePtr->fcbBtree;
@@ -179,7 +177,7 @@ index 7ad9fe0..c0c8744 100644
return fsBTInvalidFileErr;
////////////////////// Check for other BTree Paths //////////////////////////
@@ -603,14 +603,14 @@ OSStatus BTClosePath (SFCB *filePtr)
@@ -603,14 +603,14 @@ OSStatus BTClosePath (SFCB *filePt
M_ExitOnError (err);
#if SupportsKeyDescriptors
@@ -196,7 +194,7 @@ index 7ad9fe0..c0c8744 100644
// LogEndTime(kTraceCloseBTree, noErr);
@@ -643,7 +643,7 @@ Function: Search for position in B*Tree indicated by searchKey. If a valid node
@@ -643,7 +643,7 @@ Function: Search for position in B*Tree
Input: pathPtr - pointer to path for BTree file.
searchKey - pointer to search key to match.
@@ -205,7 +203,7 @@ index 7ad9fe0..c0c8744 100644
Output: record - pointer to BufferDescriptor containing record
recordLen - length of data at recordPtr
@@ -678,14 +678,14 @@ OSStatus BTSearchRecord (SFCB *filePtr,
@@ -678,14 +678,14 @@ OSStatus BTSearchRecord (SFCB *fil
// LogStartTime(kTraceSearchBTree);
@@ -224,7 +222,7 @@ index 7ad9fe0..c0c8744 100644
{
err = CheckKey (&searchIterator->key, btreePtr->keyDescPtr, btreePtr->maxKeyLength);
M_ExitOnError (err);
@@ -775,9 +775,9 @@ OSStatus BTSearchRecord (SFCB *filePtr,
@@ -775,9 +775,9 @@ OSStatus BTSearchRecord (SFCB *fil
//¥¥ Should check for errors! Or BlockMove could choke on recordPtr!!!
GetRecordByIndex (btreePtr, node.buffer, index, &keyPtr, &recordPtr, &len);
@@ -236,7 +234,7 @@ index 7ad9fe0..c0c8744 100644
{
ByteCount recordSize;
@@ -794,7 +794,7 @@ OSStatus BTSearchRecord (SFCB *filePtr,
@@ -794,7 +794,7 @@ OSStatus BTSearchRecord (SFCB *fil
/////////////////////// Success - Update Iterator ///////////////////////////
@@ -245,7 +243,7 @@ index 7ad9fe0..c0c8744 100644
{
resultIterator->hint.writeCount = btreePtr->writeCount;
resultIterator->hint.nodeNum = nodeNum;
@@ -825,10 +825,10 @@ OSStatus BTSearchRecord (SFCB *filePtr,
@@ -825,10 +825,10 @@ OSStatus BTSearchRecord (SFCB *fil
ErrorExit:
@@ -258,7 +256,7 @@ index 7ad9fe0..c0c8744 100644
{
resultIterator->hint.writeCount = 0;
resultIterator->hint.nodeNum = 0;
@@ -892,18 +892,18 @@ OSStatus BTIterateRecord (SFCB *filePtr,
@@ -892,18 +892,18 @@ OSStatus BTIterateRecord (SFCB *fi
////////////////////////// Priliminary Checks ///////////////////////////////
@@ -282,7 +280,7 @@ index 7ad9fe0..c0c8744 100644
{
return fsBTInvalidFileErr; //¥¥ handle properly
}
@@ -968,7 +968,7 @@ OSStatus BTIterateRecord (SFCB *filePtr,
@@ -968,7 +968,7 @@ OSStatus BTIterateRecord (SFCB *fi
}
else
{
@@ -291,7 +289,7 @@ index 7ad9fe0..c0c8744 100644
{
nodeNum = ((NodeDescPtr) node.buffer)->bLink;
if ( nodeNum > 0)
@@ -981,13 +981,13 @@ OSStatus BTIterateRecord (SFCB *filePtr,
@@ -981,13 +981,13 @@ OSStatus BTIterateRecord (SFCB *fi
}
}
// Before we stomp on "right", we'd better release it if needed
@@ -307,7 +305,7 @@ index 7ad9fe0..c0c8744 100644
index = ((NodeDescPtr) node.buffer)->numRecords -1;
}
}
@@ -1012,7 +1012,7 @@ OSStatus BTIterateRecord (SFCB *filePtr,
@@ -1012,7 +1012,7 @@ OSStatus BTIterateRecord (SFCB *fi
}
else
{
@@ -316,7 +314,7 @@ index 7ad9fe0..c0c8744 100644
{
nodeNum = ((NodeDescPtr) node.buffer)->fLink;
if ( nodeNum > 0)
@@ -1025,13 +1025,13 @@ OSStatus BTIterateRecord (SFCB *filePtr,
@@ -1025,13 +1025,13 @@ OSStatus BTIterateRecord (SFCB *fi
}
}
// Before we stomp on "left", we'd better release it if needed
@@ -382,7 +380,7 @@ index 7ad9fe0..c0c8744 100644
{
iterator->hint.writeCount = 0;
iterator->hint.nodeNum = 0;
@@ -1157,7 +1157,7 @@ OSStatus BTInsertRecord (SFCB *filePtr,
@@ -1157,7 +1157,7 @@ OSStatus BTInsertRecord (SFCB *fil
////////////////////////// Priliminary Checks ///////////////////////////////
@@ -391,7 +389,7 @@ index 7ad9fe0..c0c8744 100644
err = CheckInsertParams (filePtr, iterator, record, recordLen);
if (err != noErr)
@@ -1317,7 +1317,7 @@ OSStatus BTSetRecord (SFCB *filePtr,
@@ -1317,7 +1317,7 @@ OSStatus BTSetRecord (SFCB *fileP
////////////////////////// Priliminary Checks ///////////////////////////////
@@ -400,7 +398,7 @@ index 7ad9fe0..c0c8744 100644
err = CheckInsertParams (filePtr, iterator, record, recordLen);
if (err != noErr)
@@ -1506,7 +1506,7 @@ OSStatus BTReplaceRecord (SFCB *filePtr,
@@ -1506,7 +1506,7 @@ OSStatus BTReplaceRecord (SFCB *fi
////////////////////////// Priliminary Checks ///////////////////////////////
@@ -409,7 +407,7 @@ index 7ad9fe0..c0c8744 100644
err = CheckInsertParams (filePtr, iterator, record, recordLen);
if (err != noErr)
@@ -1645,20 +1645,20 @@ OSStatus BTDeleteRecord (SFCB *filePtr,
@@ -1645,20 +1645,20 @@ OSStatus BTDeleteRecord (SFCB *fil
////////////////////////// Priliminary Checks ///////////////////////////////
@@ -435,7 +433,7 @@ index 7ad9fe0..c0c8744 100644
{
err = CheckKey (&iterator->key, btreePtr->keyDescPtr, btreePtr->maxKeyLength);
M_ExitOnError (err);
@@ -1712,12 +1712,12 @@ OSStatus BTGetInformation (SFCB *filePtr,
@@ -1712,12 +1712,12 @@ OSStatus BTGetInformation (SFCB *fil
BTreeControlBlockPtr btreePtr;
@@ -451,7 +449,7 @@ index 7ad9fe0..c0c8744 100644
//¥¥ check version?
@@ -1730,7 +1730,7 @@ OSStatus BTGetInformation (SFCB *filePtr,
@@ -1730,7 +1730,7 @@ OSStatus BTGetInformation (SFCB *fil
info->keyDescriptor = btreePtr->keyDescPtr; //¥¥ this won't do at all...
info->reserved = 0;
@@ -460,7 +458,7 @@ index 7ad9fe0..c0c8744 100644
info->keyDescLength = 0;
else
info->keyDescLength = (UInt32) btreePtr->keyDescPtr->length;
@@ -1762,11 +1762,11 @@ OSStatus BTFlushPath (SFCB *filePtr)
@@ -1762,11 +1762,11 @@ OSStatus BTFlushPath (SFCB *fileP
// LogStartTime(kTraceFlushBTree);
@@ -474,7 +472,7 @@ index 7ad9fe0..c0c8744 100644
err = UpdateHeader (btreePtr);
@@ -1788,13 +1788,13 @@ Input: iterator - pointer to BTreeIterator
@@ -1788,13 +1788,13 @@ Input: iterator - pointer to BTreeItera
Output: iterator - iterator with the hint.nodeNum cleared
Result: noErr - success
@@ -490,11 +488,9 @@ index 7ad9fe0..c0c8744 100644
return paramErr;
iterator->hint.nodeNum = 0;
diff --git a/fsck_hfs.tproj/dfalib/BTreeAllocate.c b/fsck_hfs.tproj/dfalib/BTreeAllocate.c
index 485d867..02bdd8d 100644
--- a/fsck_hfs.tproj/dfalib/BTreeAllocate.c
+++ b/fsck_hfs.tproj/dfalib/BTreeAllocate.c
@@ -83,7 +83,7 @@ OSStatus AllocateNode (BTreeControlBlockPtr btreePtr, UInt32 *nodeNum)
@@ -83,7 +83,7 @@ OSStatus AllocateNode (BTreeControlBlock
nodeNumber = 0; // first node number of header map record
@@ -503,7 +499,7 @@ index 485d867..02bdd8d 100644
// - and for ErrorExit
while (true)
@@ -192,7 +192,7 @@ OSStatus FreeNode (BTreeControlBlockPtr btreePtr, UInt32 nodeNum)
@@ -192,7 +192,7 @@ OSStatus FreeNode (BTreeControlBlockPtr
//////////////////////////// Find Map Record ////////////////////////////////
nodeIndex = 0; // first node number of header map record
@@ -512,7 +508,7 @@ index 485d867..02bdd8d 100644
while (nodeNum >= nodeIndex)
{
@@ -278,8 +278,8 @@ OSStatus ExtendBTree (BTreeControlBlockPtr btreePtr,
@@ -278,8 +278,8 @@ OSStatus ExtendBTree (BTreeControlBlockP
nodeSize = btreePtr->nodeSize;
filePtr = btreePtr->fcbPtr;
@@ -532,7 +528,7 @@ index 485d867..02bdd8d 100644
node is retrieved.
@@ -474,7 +474,7 @@ OSStatus GetMapNode (BTreeControlBlockPtr btreePtr,
@@ -474,7 +474,7 @@ OSStatus GetMapNode (BTreeControlBlockPt
UInt16 mapIndex;
UInt32 nextNodeNum;
@@ -550,11 +546,9 @@ index 485d867..02bdd8d 100644
*mapSize = 0;
return err;
diff --git a/fsck_hfs.tproj/dfalib/BTreeMiscOps.c b/fsck_hfs.tproj/dfalib/BTreeMiscOps.c
index 7c9edca..997f34b 100644
--- a/fsck_hfs.tproj/dfalib/BTreeMiscOps.c
+++ b/fsck_hfs.tproj/dfalib/BTreeMiscOps.c
@@ -236,13 +236,13 @@ OSStatus FindIteratorPosition (BTreeControlBlockPtr btreePtr,
@@ -236,13 +236,13 @@ OSStatus FindIteratorPosition (BTreeCont
// assume index points to UInt16
// assume foundRecord points to Boolean
@@ -572,7 +566,7 @@ index 7c9edca..997f34b 100644
{
err = fsBTInvalidIteratorErr;
goto ErrorExit;
@@ -250,7 +250,7 @@ OSStatus FindIteratorPosition (BTreeControlBlockPtr btreePtr,
@@ -250,7 +250,7 @@ OSStatus FindIteratorPosition (BTreeCont
#if SupportsKeyDescriptors
//¥¥ verify iterator key (change CheckKey to take btreePtr instead of keyDescPtr?)
@@ -581,7 +575,7 @@ index 7c9edca..997f34b 100644
{
err = CheckKey (&iterator->key, btreePtr->keyDescPtr, btreePtr->maxKeyLength );
M_ExitOnError (err);
@@ -309,7 +309,7 @@ OSStatus FindIteratorPosition (BTreeControlBlockPtr btreePtr,
@@ -309,7 +309,7 @@ OSStatus FindIteratorPosition (BTreeCont
{
*right = *middle;
*middle = *left;
@@ -590,7 +584,7 @@ index 7c9edca..997f34b 100644
index = leftIndex;
goto SuccessfulExit;
@@ -330,7 +330,7 @@ OSStatus FindIteratorPosition (BTreeControlBlockPtr btreePtr,
@@ -330,7 +330,7 @@ OSStatus FindIteratorPosition (BTreeCont
{
*right = *middle;
*middle = *left;
@@ -599,7 +593,7 @@ index 7c9edca..997f34b 100644
index = leftIndex;
goto SuccessfulExit;
@@ -363,7 +363,7 @@ OSStatus FindIteratorPosition (BTreeControlBlockPtr btreePtr,
@@ -363,7 +363,7 @@ OSStatus FindIteratorPosition (BTreeCont
{
*left = *middle;
*middle = *right;
@@ -608,7 +602,7 @@ index 7c9edca..997f34b 100644
index = rightIndex;
goto SuccessfulExit;
@@ -427,15 +427,15 @@ OSStatus CheckInsertParams (SFCB *filePtr,
@@ -427,15 +427,15 @@ OSStatus CheckInsertParams (SFCB *
{
BTreeControlBlockPtr btreePtr;
@@ -629,11 +623,9 @@ index 7c9edca..997f34b 100644
{
OSStatus err;
diff --git a/fsck_hfs.tproj/dfalib/BTreeNodeOps.c b/fsck_hfs.tproj/dfalib/BTreeNodeOps.c
index da07cc7..ef2bd7b 100644
--- a/fsck_hfs.tproj/dfalib/BTreeNodeOps.c
+++ b/fsck_hfs.tproj/dfalib/BTreeNodeOps.c
@@ -105,7 +105,7 @@ Function: Gets an existing BTree node from FS Agent and verifies it.
@@ -105,7 +105,7 @@ Function: Gets an existing BTree node fr
Input: btreePtr - pointer to BTree control block
nodeNum - number of node to request
@@ -642,7 +634,7 @@ index da07cc7..ef2bd7b 100644
Result:
noErr - success
@@ -139,7 +139,7 @@ OSStatus GetNode (BTreeControlBlockPtr btreePtr,
@@ -139,7 +139,7 @@ OSStatus GetNode (BTreeControlBlockPtr
if (err != noErr)
{
Panic ("\pGetNode: getNodeProc returned error.");
@@ -651,7 +643,7 @@ index da07cc7..ef2bd7b 100644
goto ErrorExit;
}
++btreePtr->numGetNodes;
@@ -156,8 +156,8 @@ OSStatus GetNode (BTreeControlBlockPtr btreePtr,
@@ -156,8 +156,8 @@ OSStatus GetNode (BTreeControlBlockPtr
return noErr;
ErrorExit:
@@ -662,7 +654,7 @@ index da07cc7..ef2bd7b 100644
// LogEndTime(kTraceGetNode, err);
@@ -176,7 +176,7 @@ Function: Gets a new BTree node from FS Agent and initializes it to an empty
@@ -176,7 +176,7 @@ Function: Gets a new BTree node from FS
Input: btreePtr - pointer to BTree control block
nodeNum - number of node to request
@@ -671,7 +663,7 @@ index da07cc7..ef2bd7b 100644
Result: noErr - success
!= noErr - failure
@@ -203,7 +203,7 @@ OSStatus GetNewNode (BTreeControlBlockPtr btreePtr,
@@ -203,7 +203,7 @@ OSStatus GetNewNode (BTreeControlBlockPt
if (err != noErr)
{
Panic ("\pGetNewNode: getNodeProc returned error.");
@@ -680,7 +672,7 @@ index da07cc7..ef2bd7b 100644
return err;
}
++btreePtr->numGetNewNodes;
@@ -248,7 +248,7 @@ OSStatus ReleaseNode (BTreeControlBlockPtr btreePtr,
@@ -248,7 +248,7 @@ OSStatus ReleaseNode (BTreeControlBlockP
err = noErr;
@@ -689,7 +681,7 @@ index da07cc7..ef2bd7b 100644
{
/*
* The nodes must remain in the cache as big endian!
@@ -267,8 +267,8 @@ OSStatus ReleaseNode (BTreeControlBlockPtr btreePtr,
@@ -267,8 +267,8 @@ OSStatus ReleaseNode (BTreeControlBlockP
++btreePtr->numReleaseNodes;
}
@@ -700,7 +692,7 @@ index da07cc7..ef2bd7b 100644
// LogEndTime(kTraceReleaseNode, err);
@@ -299,7 +299,7 @@ OSStatus TrashNode (BTreeControlBlockPtr btreePtr,
@@ -299,7 +299,7 @@ OSStatus TrashNode (BTreeControlBlockPtr
err = noErr;
@@ -709,7 +701,7 @@ index da07cc7..ef2bd7b 100644
{
releaseNodeProc = btreePtr->releaseBlockProc;
err = releaseNodeProc (btreePtr->fcbPtr,
@@ -309,8 +309,8 @@ OSStatus TrashNode (BTreeControlBlockPtr btreePtr,
@@ -309,8 +309,8 @@ OSStatus TrashNode (BTreeControlBlockPtr
++btreePtr->numReleaseNodes;
}
@@ -720,7 +712,7 @@ index da07cc7..ef2bd7b 100644
return err;
}
@@ -338,7 +338,7 @@ OSStatus UpdateNode (BTreeControlBlockPtr btreePtr,
@@ -338,7 +338,7 @@ OSStatus UpdateNode (BTreeControlBlockPt
err = noErr;
@@ -729,7 +721,7 @@ index da07cc7..ef2bd7b 100644
{
// LogStartTime(kTraceReleaseNode);
err = hfs_swap_BTNode(nodePtr, btreePtr->fcbPtr, kSwapBTNodeHostToBig);
@@ -358,8 +358,8 @@ OSStatus UpdateNode (BTreeControlBlockPtr btreePtr,
@@ -358,8 +358,8 @@ OSStatus UpdateNode (BTreeControlBlockPt
++btreePtr->numUpdateNodes;
}
@@ -740,11 +732,9 @@ index da07cc7..ef2bd7b 100644
return noErr;
diff --git a/fsck_hfs.tproj/dfalib/BTreeTreeOps.c b/fsck_hfs.tproj/dfalib/BTreeTreeOps.c
index 37fb170..73e1fda 100644
--- a/fsck_hfs.tproj/dfalib/BTreeTreeOps.c
+++ b/fsck_hfs.tproj/dfalib/BTreeTreeOps.c
@@ -177,7 +177,7 @@ Output: nodeNum - number of the node containing the key position
@@ -177,7 +177,7 @@ Output: nodeNum - number of the node
Result: noErr - key found, index is record index
fsBTRecordNotFoundErr - key not found, index is insert index
@@ -764,7 +754,7 @@ index 37fb170..73e1fda 100644
*returnIndex = 0;
return err;
@@ -354,7 +354,7 @@ OSStatus InsertTree ( BTreeControlBlockPtr btreePtr,
@@ -354,7 +354,7 @@ OSStatus InsertTree ( BTreeControlBlockP
primaryKey.replacingKey = replacingKey;
primaryKey.skipRotate = false;
@@ -773,7 +763,7 @@ index 37fb170..73e1fda 100644
targetNode, index, level, insertNode );
return err;
@@ -385,7 +385,7 @@ OSStatus InsertLevel (BTreeControlBlockPtr btreePtr,
@@ -385,7 +385,7 @@ OSStatus InsertLevel (BTreeControlBlockP
#if defined(applec) && !defined(__SC__)
PanicIf ((level == 1) && (((NodeDescPtr)targetNode->buffer)->kind != kBTLeafNode), "\P InsertLevel: non-leaf at level 1! ");
#endif
@@ -782,7 +772,7 @@ index 37fb170..73e1fda 100644
targetNodeNum = treePathTable [level].node;
insertParent = false;
@@ -420,7 +420,7 @@ OSStatus InsertLevel (BTreeControlBlockPtr btreePtr,
@@ -420,7 +420,7 @@ OSStatus InsertLevel (BTreeControlBlockP
////// process second insert (if any) //////
@@ -791,7 +781,7 @@ index 37fb170..73e1fda 100644
{
Boolean temp;
@@ -446,7 +446,7 @@ OSStatus InsertLevel (BTreeControlBlockPtr btreePtr,
@@ -446,7 +446,7 @@ OSStatus InsertLevel (BTreeControlBlockP
UInt8 * recPtr;
UInt16 recSize;
@@ -800,7 +790,7 @@ index 37fb170..73e1fda 100644
PanicIf ( (level == btreePtr->treeDepth), "InsertLevel: unfinished insert!?");
@@ -606,9 +606,9 @@ static OSErr InsertNode (BTreeControlBlockPtr btreePtr,
@@ -606,9 +606,9 @@ static OSErr InsertNode (BTreeControlBlo
if ( leftNodeNum > 0 )
{
@@ -812,7 +802,7 @@ index 37fb170..73e1fda 100644
{
err = GetNode (btreePtr, leftNodeNum, siblingNode); // will be released by caller or a split below
M_ExitOnError (err);
@@ -703,7 +703,7 @@ OSStatus DeleteTree (BTreeControlBlockPtr btreePtr,
@@ -703,7 +703,7 @@ OSStatus DeleteTree (BTreeControlBlock
targetNodeNum = treePathTable[level].node;
targetNodePtr = targetNode->buffer;
@@ -821,7 +811,7 @@ index 37fb170..73e1fda 100644
DeleteRecord (btreePtr, targetNodePtr, index);
@@ -766,7 +766,7 @@ OSStatus DeleteTree (BTreeControlBlockPtr btreePtr,
@@ -766,7 +766,7 @@ OSStatus DeleteTree (BTreeControlBlock
deleteRequired = false;
updateRequired = false;
@@ -830,7 +820,7 @@ index 37fb170..73e1fda 100644
{
btreePtr->rootNode = 0;
btreePtr->treeDepth = 0;
@@ -1124,7 +1124,7 @@ static OSStatus SplitLeft (BTreeControlBlockPtr btreePtr,
@@ -1124,7 +1124,7 @@ static OSStatus SplitLeft (BTreeControl
if ( (right->height == 1) && (right->kind != kBTLeafNode) )
return fsBTInvalidNodeErr;
@@ -839,7 +829,7 @@ index 37fb170..73e1fda 100644
{
if ( left->fLink != rightNodeNum )
return fsBTInvalidNodeErr; //¥¥ E_BadSibling ?
@@ -1145,7 +1145,7 @@ static OSStatus SplitLeft (BTreeControlBlockPtr btreePtr,
@@ -1145,7 +1145,7 @@ static OSStatus SplitLeft (BTreeControl
/////////////// Update Forward Link In Original Left Node ///////////////////
@@ -848,7 +838,7 @@ index 37fb170..73e1fda 100644
{
left->fLink = newNodeNum;
err = UpdateNode (btreePtr, leftNode);
@@ -1240,8 +1240,8 @@ static OSStatus AddNewRootNode (BTreeControlBlockPtr btreePtr,
@@ -1240,8 +1240,8 @@ static OSStatus AddNewRootNode (BTreeCon
Boolean didItFit;
UInt16 keyLength;
@@ -859,7 +849,7 @@ index 37fb170..73e1fda 100644
/////////////////////// Initialize New Root Node ////////////////////////////
@@ -1362,7 +1362,7 @@ static OSStatus SplitRight (BTreeControlBlockPtr btreePtr,
@@ -1362,7 +1362,7 @@ static OSStatus SplitRight (BTreeContro
if ( (leftPtr->height == 1) && (leftPtr->kind != kBTLeafNode) )
return fsBTInvalidNodeErr;
@@ -868,7 +858,7 @@ index 37fb170..73e1fda 100644
{
if ( rightPtr->bLink != nodeNum )
return fsBTInvalidNodeErr; //¥¥ E_BadSibling ?
@@ -1382,7 +1382,7 @@ static OSStatus SplitRight (BTreeControlBlockPtr btreePtr,
@@ -1382,7 +1382,7 @@ static OSStatus SplitRight (BTreeContro
/////////////// Update backward Link In Original Right Node ///////////////////
@@ -877,7 +867,7 @@ index 37fb170..73e1fda 100644
{
rightPtr->bLink = newNodeNum;
err = UpdateNode (btreePtr, rightNodePtr);
@@ -1739,7 +1739,7 @@ static int DoKeyCheck( NodeDescPtr nodeP, BTreeControlBlock *btcb )
@@ -1739,7 +1739,7 @@ static int DoKeyCheck( NodeDescPtr nodeP
UInt16 keyLength;
KeyPtr keyPtr;
UInt8 *dataPtr;
@@ -886,7 +876,7 @@ index 37fb170..73e1fda 100644
if ( nodeP->numRecords == 0 )
@@ -1766,7 +1766,7 @@ static int DoKeyCheck( NodeDescPtr nodeP, BTreeControlBlock *btcb )
@@ -1766,7 +1766,7 @@ static int DoKeyCheck( NodeDescPtr nodeP
return( -1 );
}
@@ -895,11 +885,9 @@ index 37fb170..73e1fda 100644
{
if ( CompareKeys( (BTreeControlBlockPtr)btcb, prevkeyP, keyPtr ) >= 0 )
{
diff --git a/fsck_hfs.tproj/dfalib/SControl.c b/fsck_hfs.tproj/dfalib/SControl.c
index 8b03ece..d3145e0 100644
--- a/fsck_hfs.tproj/dfalib/SControl.c
+++ b/fsck_hfs.tproj/dfalib/SControl.c
@@ -82,7 +82,7 @@ CheckHFS( int fsReadRef, int fsWriteRef, int checkLevel, int repairLevel,
@@ -82,7 +82,7 @@ CheckHFS( int fsReadRef, int fsWriteRef
{
SGlob dataArea; // Allocate the scav globals
short temp;
@@ -1056,7 +1044,7 @@ index 8b03ece..d3145e0 100644
return( noErr );
}
@@ -1113,7 +1113,7 @@ Boolean IsBlueBoxSharedDrive ( DrvQElPtr dqPtr )
@@ -1113,7 +1113,7 @@ Boolean IsBlueBoxSharedDrive ( DrvQElPtr
// Now look at the name of the Driver name. If it is .BlueBoxShared keep it out of the list of available disks.
driverDCtlHandle = GetDCtlEntry(dqPtr->dQRefNum);
driverDCtlPtr = *driverDCtlHandle;
@@ -1065,7 +1053,7 @@ index 8b03ece..d3145e0 100644
{
if (((driverDCtlPtr->dCtlFlags) & Is_Ram_Based_Mask) == 0)
{
@@ -1127,19 +1127,19 @@ Boolean IsBlueBoxSharedDrive ( DrvQElPtr dqPtr )
@@ -1127,19 +1127,19 @@ Boolean IsBlueBoxSharedDrive ( DrvQElPtr
}
driverName = (StringPtr)&(drvrHeaderPtr->drvrName);
@@ -1089,7 +1077,7 @@ index 8b03ece..d3145e0 100644
paramBlock.ioVRefNum = dqPtr->dQDrive;
paramBlock.ioCRefNum = dqPtr->dQRefNum;
paramBlock.csCode = kDriveIcon; // return physical icon
@@ -1152,7 +1152,7 @@ Boolean IsBlueBoxSharedDrive ( DrvQElPtr dqPtr )
@@ -1152,7 +1152,7 @@ Boolean IsBlueBoxSharedDrive ( DrvQElPtr
iconAndStringRecPtr = * (IconAndStringRecPtr*) & paramBlock.csParam;
whereStringPtr = (StringPtr) & iconAndStringRecPtr->string;
@@ -1098,11 +1086,9 @@ index 8b03ece..d3145e0 100644
{
return( true );
}
diff --git a/fsck_hfs.tproj/dfalib/SRepair.c b/fsck_hfs.tproj/dfalib/SRepair.c
index 89c12d6..b261c37 100644
--- a/fsck_hfs.tproj/dfalib/SRepair.c
+++ b/fsck_hfs.tproj/dfalib/SRepair.c
@@ -844,7 +844,7 @@ static int DelFThd( SGlobPtr GPtr, UInt32 fid ) // the file ID
@@ -844,7 +844,7 @@ static int DelFThd( SGlobPtr GPtr, UInt3
isHFSPlus = VolumeObjectIsHFSPlus( );
@@ -1111,7 +1097,7 @@ index 89c12d6..b261c37 100644
result = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint, &foundKey, &record, &recSize, &hint );
if ( result ) return ( IntError( GPtr, result ) );
@@ -910,7 +910,7 @@ static OSErr FixDirThread( SGlobPtr GPtr, UInt32 did ) // the dir ID
@@ -910,7 +910,7 @@ static OSErr FixDirThread( SGlobPtr GPtr
isHFSPlus = VolumeObjectIsHFSPlus( );
@@ -1120,7 +1106,7 @@ index 89c12d6..b261c37 100644
result = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint, &foundKey, &record, &recSize, &hint );
if ( result )
@@ -2171,7 +2171,7 @@ static OSErr FixOrphanedFiles ( SGlobPtr GPtr )
@@ -2171,7 +2171,7 @@ static OSErr FixOrphanedFiles ( SGlobPtr
}
//-- Build the key for the file thread
@@ -1129,8 +1115,6 @@ index 89c12d6..b261c37 100644
err = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint,
&tempKey, &threadRecord, &recordSize, &hint2 );
diff --git a/fsck_hfs.tproj/dfalib/SUtils.c b/fsck_hfs.tproj/dfalib/SUtils.c
index 6e9253e..491afbf 100644
--- a/fsck_hfs.tproj/dfalib/SUtils.c
+++ b/fsck_hfs.tproj/dfalib/SUtils.c
@@ -395,11 +395,11 @@ OSErr GetVolumeFeatures( SGlobPtr GPtr )
@@ -1147,7 +1131,7 @@ index 6e9253e..491afbf 100644
pb.ioParam.ioVRefNum = GPtr->realVCB->vcbVRefNum;
pb.ioParam.ioBuffer = (Ptr) &buffer;
pb.ioParam.ioReqCount = sizeof( buffer );
@@ -2282,7 +2282,7 @@ void print_prime_buckets(PrimeBuckets *cur);
@@ -2282,7 +2282,7 @@ void print_prime_buckets(PrimeBuckets *c
* 4. btreetye - can be kHFSPlusCatalogRecord or kHFSPlusAttributeRecord
* indicates which btree prime number bucket should be incremented
*
@@ -1156,11 +1140,9 @@ index 6e9253e..491afbf 100644
*/
void RecordXAttrBits(SGlobPtr GPtr, UInt16 flags, HFSCatalogNodeID fileid, UInt16 btreetype)
{
diff --git a/fsck_hfs.tproj/dfalib/SVerify1.c b/fsck_hfs.tproj/dfalib/SVerify1.c
index 39bda5c..c33155f 100644
--- a/fsck_hfs.tproj/dfalib/SVerify1.c
+++ b/fsck_hfs.tproj/dfalib/SVerify1.c
@@ -790,13 +790,13 @@ OSErr CreateExtentsBTreeControlBlock( SGlobPtr GPtr )
@@ -790,13 +790,13 @@ OSErr CreateExtentsBTreeControlBlock( SG
// set up our DFA extended BTCB area. Will we have enough memory on all HFS+ volumes.
//
btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions
@@ -1176,7 +1158,7 @@ index 39bda5c..c33155f 100644
{
err = R_NoMem;
goto exit;
@@ -1145,13 +1145,13 @@ OSErr CreateCatalogBTreeControlBlock( SGlobPtr GPtr )
@@ -1145,13 +1145,13 @@ OSErr CreateCatalogBTreeControlBlock( SG
//
btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions
@@ -1210,7 +1192,7 @@ index 39bda5c..c33155f 100644
result = SearchBTreeRecord( GPtr->calculatedCatalogFCB, &key, kNoHint, &foundKey, &threadRecord, &recSize, &hint );
if ( result != noErr ) {
char idStr[16];
@@ -1780,26 +1780,26 @@ OSErr CreateAttributesBTreeControlBlock( SGlobPtr GPtr )
@@ -1780,26 +1780,26 @@ OSErr CreateAttributesBTreeControlBlock(
// set up our DFA extended BTCB area. Will we have enough memory on all HFS+ volumes.
//
btcb->refCon = AllocateClearMemory( sizeof(BTreeExtensionsRec) ); // allocate space for our BTCB extensions
@@ -1241,7 +1223,7 @@ index 39bda5c..c33155f 100644
{
err = R_NoMem;
goto exit;
@@ -2358,7 +2358,7 @@ static OSErr RcdMDBEmbededVolDescriptionErr( SGlobPtr GPtr, OSErr type, HFSMaste
@@ -2358,7 +2358,7 @@ static OSErr RcdMDBEmbededVolDescription
RcdError( GPtr, type ); // first, record the error
p = AllocMinorRepairOrder( GPtr, sizeof(EmbededVolDescription) ); // get the node
@@ -1250,7 +1232,7 @@ index 39bda5c..c33155f 100644
p->type = type; // save error info
desc = (EmbededVolDescription *) &(p->name);
@@ -2397,7 +2397,7 @@ static OSErr RcdInvalidWrapperExtents( SGlobPtr GPtr, OSErr type )
@@ -2397,7 +2397,7 @@ static OSErr RcdInvalidWrapperExtents( S
RcdError( GPtr, type ); // first, record the error
p = AllocMinorRepairOrder( GPtr, 0 ); // get the node
@@ -1259,7 +1241,7 @@ index 39bda5c..c33155f 100644
p->type = type; // save error info
@@ -3029,7 +3029,7 @@ OSErr CheckFileExtents( SGlobPtr GPtr, UInt32 fileNumber, UInt8 forkType,
@@ -3029,7 +3029,7 @@ OSErr CheckFileExtents( SGlobPtr GPtr, U
foundBadExtent = false;
lastExtentIndex = GPtr->numExtents;
@@ -1268,7 +1250,7 @@ index 39bda5c..c33155f 100644
{
// checkout the extent record first
err = ChkExtRec( GPtr, extents, &lastExtentIndex );
@@ -3105,7 +3105,7 @@ OSErr CheckFileExtents( SGlobPtr GPtr, UInt32 fileNumber, UInt8 forkType,
@@ -3105,7 +3105,7 @@ OSErr CheckFileExtents( SGlobPtr GPtr, U
if ( err == btNotFound )
{
err = noErr; // no more extent records
@@ -1277,7 +1259,7 @@ index 39bda5c..c33155f 100644
break;
}
else if ( err != noErr )
@@ -3121,7 +3121,7 @@ OSErr CheckFileExtents( SGlobPtr GPtr, UInt32 fileNumber, UInt8 forkType,
@@ -3121,7 +3121,7 @@ OSErr CheckFileExtents( SGlobPtr GPtr, U
if ( err == btNotFound )
{
err = noErr; // no more extent records
@@ -1286,7 +1268,7 @@ index 39bda5c..c33155f 100644
break;
}
else if ( err != noErr )
@@ -3205,7 +3205,7 @@ static OSErr AddExtentToOverlapList( SGlobPtr GPtr, HFSCatalogNodeID fileNumber,
@@ -3205,7 +3205,7 @@ static OSErr AddExtentToOverlapList( SGl
}
// If it's uninitialized
@@ -1295,11 +1277,9 @@ index 39bda5c..c33155f 100644
{
GPtr->overlappedExtents = (ExtentsTable **) NewHandleClear( sizeof(ExtentsTable) );
extentsTableH = GPtr->overlappedExtents;
diff --git a/fsck_hfs.tproj/dfalib/SVerify2.c b/fsck_hfs.tproj/dfalib/SVerify2.c
index c68f3d8..da1a982 100644
--- a/fsck_hfs.tproj/dfalib/SVerify2.c
+++ b/fsck_hfs.tproj/dfalib/SVerify2.c
@@ -1013,7 +1013,7 @@ static int BTKeyChk( SGlobPtr GPtr, NodeDescPtr nodeP, BTreeControlBlock *btcb )
@@ -1013,7 +1013,7 @@ static int BTKeyChk( SGlobPtr GPtr, Node
UInt16 keyLength;
KeyPtr keyPtr;
UInt8 *dataPtr;
@@ -1308,7 +1288,7 @@ index c68f3d8..da1a982 100644
if ( nodeP->numRecords == 0 )
@@ -1044,7 +1044,7 @@ static int BTKeyChk( SGlobPtr GPtr, NodeDescPtr nodeP, BTreeControlBlock *btcb )
@@ -1044,7 +1044,7 @@ static int BTKeyChk( SGlobPtr GPtr, Node
return( E_KeyLen );
}