Lines Matching refs:btreePtr
88 static OSStatus GetMapNode (BTreeControlBlockPtr btreePtr,
110 Input: btreePtr - pointer to control block for BTree file
120 OSStatus AllocateNode (BTreeControlBlockPtr btreePtr, u_int32_t *nodeNum)
139 err = GetMapNode (btreePtr, &node, &mapPtr, &mapSize);
143 ModifyBlockStart(btreePtr->fileRefNum, &node);
185 if (nodeNumber >= btreePtr->totalNodes)
195 err = UpdateNode (btreePtr, &node, 0, kLockTransaction);
198 --btreePtr->freeNodes;
199 btreePtr->flags |= kBTHeaderDirty;
202 BTUpdateReserve(btreePtr, 1);
212 (void) ReleaseNode (btreePtr, &node);
228 Input: btreePtr - pointer to control block for BTree file
238 OSStatus FreeNode (BTreeControlBlockPtr btreePtr, u_int32_t nodeNum)
255 err = GetMapNode (btreePtr, &node, &mapPos, &mapSize);
264 ModifyBlockStart(btreePtr->fileRefNum, &node);
272 err = UpdateNode (btreePtr, &node, 0, kLockTransaction);
275 ++btreePtr->freeNodes;
276 btreePtr->flags |= kBTHeaderDirty; // how about a macro for this
282 (void) ReleaseNode (btreePtr, &node);
302 Input: btreePtr - pointer to control block for BTree file
311 OSStatus ExtendBTree (BTreeControlBlockPtr btreePtr,
333 oldTotalNodes = btreePtr->totalNodes;
337 nodeSize = btreePtr->nodeSize;
338 filePtr = GetFileControlBlock(btreePtr->fileRefNum);
352 err = GetMapNode (btreePtr, &mapNode, &mapStart, &mapSize);
361 if (DEBUG_BUILD && totalMapBits != CalcMapBits (btreePtr))
371 err = btreePtr->setEndOfForkProc (btreePtr->fileRefNum, minEOF, maxEOF);
381 btreePtr->totalNodes = newTotalNodes; // do we need to update freeNodes here too?
395 err = ReleaseNode (btreePtr, &mapNode);
404 ModifyBlockStart(btreePtr->fileRefNum, &mapNode);
411 err = GetNewNode (btreePtr, nodeNum, &newNode);
415 ModifyBlockStart(btreePtr->fileRefNum, &newNode);
428 err = UpdateNode (btreePtr, &newNode, 0, kLockTransaction);
432 err = UpdateNode (btreePtr, &newNode, 0, kLockTransaction);
451 err = UpdateNode (btreePtr, &mapNode, 0, kLockTransaction);
454 err = GetNode (btreePtr, nextNodeNum, 0, &mapNode);
458 ModifyBlockStart(btreePtr->fileRefNum, &mapNode);
462 mapStart = (u_int16_t *) GetRecordAddress (btreePtr, mapNode.buffer, mapIndex);
463 mapSize = GetRecordSize (btreePtr, mapNode.buffer, mapIndex);
465 if (DEBUG_BUILD && mapSize != M_MapRecordSize (btreePtr->nodeSize) )
486 err = UpdateNode (btreePtr, &mapNode, 0, kLockTransaction);
494 btreePtr->totalNodes = newTotalNodes;
495 btreePtr->freeNodes += (newTotalNodes - oldTotalNodes) - newMapNodes;
497 btreePtr->flags |= kBTHeaderDirty; //�� how about a macro for this
500 (void) UpdateHeader (btreePtr, true);
509 (void) ReleaseNode (btreePtr, &mapNode);
510 (void) ReleaseNode (btreePtr, &newNode);
526 Input: btreePtr - pointer to control block for BTree file
540 OSStatus GetMapNode (BTreeControlBlockPtr btreePtr,
558 err = ReleaseNode (btreePtr, nodePtr);
561 err = GetNode (btreePtr, nextNodeNum, 0, nodePtr);
570 ++btreePtr->numMapNodesRead;
573 err = GetNode (btreePtr, kHeaderNodeNum, 0, nodePtr);
586 *mapPtr = (u_int16_t *) GetRecordAddress (btreePtr, nodePtr->buffer, mapIndex);
587 *mapSize = GetRecordSize (btreePtr, nodePtr->buffer, mapIndex);
594 (void) ReleaseNode (btreePtr, nodePtr);
606 u_int32_t CalcMapBits (BTreeControlBlockPtr btreePtr)
610 mapBits = M_HeaderMapRecordSize (btreePtr->nodeSize) << 3;
612 while (mapBits < btreePtr->totalNodes)
613 mapBits += M_MapRecordSize (btreePtr->nodeSize) << 3;