Lines Matching defs:btreePtr
220 OSStatus TreeIsDirty(BTreeControlBlockPtr btreePtr)
222 return (btreePtr->flags & kBTHeaderDirty);
233 Input: btreePtr - pointer to BTreeInfoRec
240 OSStatus UpdateHeader(BTreeControlBlockPtr btreePtr, Boolean forceWrite)
247 if ((btreePtr->flags & kBTHeaderDirty) == 0) // btree info already flushed
251 err = GetNode (btreePtr, kHeaderNodeNum, 0, &node );
257 ModifyBlockStart(btreePtr->fileRefNum, &node);
261 header->treeDepth = btreePtr->treeDepth;
262 header->rootNode = btreePtr->rootNode;
263 header->leafRecords = btreePtr->leafRecords;
264 header->firstLeafNode = btreePtr->firstLeafNode;
265 header->lastLeafNode = btreePtr->lastLeafNode;
266 header->nodeSize = btreePtr->nodeSize; //�� this shouldn't change
267 header->maxKeyLength = btreePtr->maxKeyLength; //�� neither should this
268 header->totalNodes = btreePtr->totalNodes;
269 header->freeNodes = btreePtr->freeNodes;
270 header->btreeType = btreePtr->btreeType;
279 err = UpdateNode (btreePtr, &node, 0, options);
281 btreePtr->flags &= (~kBTHeaderDirty);
297 Input: btreePtr - description
314 OSStatus FindIteratorPosition (BTreeControlBlockPtr btreePtr,
329 // assume btreePtr valid
350 err = IsItAHint (btreePtr, iterator, &validHint);
359 err = GetNode (btreePtr, nodeNum, kGetNodeHint, middle);
371 foundIt = SearchNode (btreePtr, middle->buffer, &iterator->key, &index);
374 ++btreePtr->numValidHints;
391 err = ReleaseNode(btreePtr, middle);
395 err = GetNode (btreePtr, nodeNum, 0, left);
399 err = GetRightSiblingNode (btreePtr, left->buffer, middle);
408 foundIt = SearchNode (btreePtr, left->buffer, &iterator->key, &leftIndex);
449 err = GetRightSiblingNode (btreePtr, middle->buffer, right);
458 foundIt = SearchNode (btreePtr, right->buffer, &iterator->key, &rightIndex);
481 err = ReleaseNode (btreePtr, left); M_ExitOnError (err);
482 err = ReleaseNode (btreePtr, middle); M_ExitOnError (err);
483 err = ReleaseNode (btreePtr, right); M_ExitOnError (err);
485 err = SearchTree ( btreePtr, &iterator->key, treePathTable, &nodeNum, middle, &index);
509 (void) ReleaseNode (btreePtr, left);
510 (void) ReleaseNode (btreePtr, middle);
511 (void) ReleaseNode (btreePtr, right);
529 BTreeControlBlockPtr btreePtr;
533 btreePtr = (BTreeControlBlockPtr) filePtr->fcbBTCBPtr;
534 if (btreePtr == nil) return fsBTInvalidFileErr;
539 if ( CalcKeyRecordSize (CalcKeySize(btreePtr, &iterator->key), recordLen) > (btreePtr->nodeSize >> 1))
562 Input: btreePtr - description
577 OSStatus TrySimpleReplace (BTreeControlBlockPtr btreePtr,
597 foundIt = SearchNode (btreePtr, nodePtr, &iterator->key, &index);
602 keySize = CalcKeySize(btreePtr, &iterator->key); // includes length field
606 oldSpace = GetRecordSize (btreePtr, nodePtr, index);
612 dst = GetRecordAddress (btreePtr, nodePtr, index);
623 else if ( (GetNodeFreeSize(btreePtr, nodePtr) + oldSpace) >= spaceNeeded)
625 DeleteRecord (btreePtr, nodePtr, index);
627 didItFit = InsertKeyRecord (btreePtr, nodePtr, index,
628 &iterator->key, KeyLength(btreePtr, &iterator->key),
646 Input: btreePtr - pointer to control block for BTree file
656 OSStatus IsItAHint (BTreeControlBlockPtr btreePtr, BTreeIterator *iterator, Boolean *answer)
658 ++btreePtr->numHintChecks;
661 if (iterator->hint.nodeNum >= btreePtr->totalNodes)
674 ++btreePtr->numPossibleHints;