X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/d52fe63fc81f7e44faaae711812a211a78434976..9bccf70c0258c7cac2dcb80011b2a964d884c552:/bsd/hfs/hfscommon/BTree/BTreeAllocate.c diff --git a/bsd/hfs/hfscommon/BTree/BTreeAllocate.c b/bsd/hfs/hfscommon/BTree/BTreeAllocate.c index 46d23cecb..60cfa0635 100644 --- a/bsd/hfs/hfscommon/BTree/BTreeAllocate.c +++ b/bsd/hfs/hfscommon/BTree/BTreeAllocate.c @@ -323,8 +323,6 @@ OSStatus ExtendBTree (BTreeControlBlockPtr btreePtr, mapNodeRecSize = nodeSize - sizeof(BTNodeDescriptor) - 6; // 2 bytes of free space (see note) - // update for proper 64 bit arithmetic!! - //////////////////////// Count Bits In Node Map ///////////////////////////// @@ -344,13 +342,10 @@ OSStatus ExtendBTree (BTreeControlBlockPtr btreePtr, /////////////////////// Extend LEOF If Necessary //////////////////////////// - minEOF = newTotalNodes * nodeSize; + minEOF = (UInt64)newTotalNodes * (UInt64)nodeSize; if ( filePtr->fcbEOF < minEOF ) { - // - // ???? Does this B*Tree pack stop working when LEOF > 2^32-1? - // - maxEOF = ((UInt32)0xFFFFFFFFL); + maxEOF = (UInt64)0x7fffffffLL * (UInt64)nodeSize; err = btreePtr->setEndOfForkProc (btreePtr->fileRefNum, minEOF, maxEOF); M_ExitOnError (err); @@ -471,6 +466,9 @@ Success: btreePtr->freeNodes += (newTotalNodes - oldTotalNodes) - newMapNodes; btreePtr->flags |= kBTHeaderDirty; //€€ how about a macro for this + + /* Force the b-tree header changes to disk */ + (void) UpdateHeader (btreePtr, true); return noErr;