X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/3a60a9f5b85abb8c2cf24e1926c5c7b3f608a5e2..0b4c1975fb5e4eccf1012a35081f7e7799b81046:/bsd/hfs/hfscommon/headers/BTreesInternal.h?ds=sidebyside diff --git a/bsd/hfs/hfscommon/headers/BTreesInternal.h b/bsd/hfs/hfscommon/headers/BTreesInternal.h index 5747e31aa..c683d0b74 100644 --- a/bsd/hfs/hfscommon/headers/BTreesInternal.h +++ b/bsd/hfs/hfscommon/headers/BTreesInternal.h @@ -1,23 +1,29 @@ /* - * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2009 Apple Inc. All rights reserved. * - * @APPLE_LICENSE_HEADER_START@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * - * The contents of this file constitute Original Code as defined in and - * are subject to the Apple Public Source License Version 1.1 (the - * "License"). You may not use this file except in compliance with the - * License. Please obtain a copy of the License at - * http://www.apple.com/publicsource and read it before using this file. + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. * - * This Original Code and all software distributed under the License are - * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the - * License for the specific language governing rights and limitations - * under the License. + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. * - * @APPLE_LICENSE_HEADER_END@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* File: BTreesInternal.h @@ -138,6 +144,7 @@ typedef FSBufferDescriptor *FSBufferDescriptorPtr; */ enum { kGetBlock = 0x00000000, + kGetBlockHint = 0x00000001, // if set, the block is being looked up using hint kForceReadBlock = 0x00000002, //€€ how does this relate to Read/Verify? Do we need this? kGetEmptyBlock = 0x00000008 }; @@ -155,15 +162,15 @@ enum { }; typedef OptionBits ReleaseBlockOptions; -typedef UInt64 FSSize; -typedef UInt32 ForkBlockNumber; +typedef u_int64_t FSSize; +typedef u_int32_t ForkBlockNumber; /*============================================================================ Fork Level Buffered I/O Access Method ============================================================================*/ typedef OSStatus (* GetBlockProcPtr) (FileReference fileRefNum, - UInt32 blockNum, + u_int32_t blockNum, GetBlockOptions options, BlockDescriptor *block ); @@ -202,7 +209,7 @@ enum BTreeIterationOperations{ kBTreeLastRecord, kBTreeCurrentRecord }; -typedef UInt16 BTreeIterationOperation; +typedef u_int16_t BTreeIterationOperation; /* @@ -228,30 +235,30 @@ typedef BTreeKey *BTreeKeyPtr; BTreeInfoRec Structure - for BTGetInformation */ struct BTreeInfoRec{ - UInt16 version; - UInt16 nodeSize; - UInt16 maxKeyLength; - UInt16 treeDepth; - UInt32 lastfsync; /* Last time that this was fsynced */ + u_int16_t version; + u_int16_t nodeSize; + u_int16_t maxKeyLength; + u_int16_t treeDepth; + u_int32_t lastfsync; /* Last time that this was fsynced */ ItemCount numRecords; ItemCount numNodes; ItemCount numFreeNodes; - UInt8 keyCompareType; - UInt8 reserved[3]; + u_int8_t keyCompareType; + u_int8_t reserved[3]; }; typedef struct BTreeInfoRec BTreeInfoRec; typedef BTreeInfoRec *BTreeInfoPtr; /* - BTreeHint can never be exported to the outside. Use UInt32 BTreeHint[4], - UInt8 BTreeHint[16], etc. + BTreeHint can never be exported to the outside. Use u_int32_t BTreeHint[4], + u_int8_t BTreeHint[16], etc. */ struct BTreeHint{ ItemCount writeCount; - UInt32 nodeNum; // node the key was last seen in - UInt16 index; // index then key was last seen at - UInt16 reserved1; - UInt32 reserved2; + u_int32_t nodeNum; // node the key was last seen in + u_int16_t index; // index then key was last seen at + u_int16_t reserved1; + u_int32_t reserved2; }; typedef struct BTreeHint BTreeHint; typedef BTreeHint *BTreeHintPtr; @@ -261,10 +268,10 @@ typedef BTreeHint *BTreeHintPtr; */ struct BTreeIterator{ BTreeHint hint; - UInt16 version; - UInt16 reserved; - UInt32 hitCount; // Total number of leaf records hit - UInt32 maxLeafRecs; // Max leaf records over iteration + u_int16_t version; + u_int16_t reserved; + u_int32_t hitCount; // Total number of leaf records hit + u_int32_t maxLeafRecs; // Max leaf records over iteration BTreeKey key; }; typedef struct BTreeIterator BTreeIterator; @@ -278,10 +285,10 @@ typedef BTreeIterator *BTreeIteratorPtr; /* Key Comparison Function ProcPtr Type - for BTOpenPath */ -//typedef SInt32 (* KeyCompareProcPtr)(BTreeKeyPtr a, BTreeKeyPtr b); +//typedef int32_t (* KeyCompareProcPtr)(BTreeKeyPtr a, BTreeKeyPtr b); -typedef SInt32 (* IterateCallBackProcPtr)(BTreeKeyPtr key, void * record, void * state); +typedef int32_t (* IterateCallBackProcPtr)(BTreeKeyPtr key, void * record, void * state); extern OSStatus BTOpenPath(FCB *filePtr, KeyCompareProcPtr keyCompareProc); @@ -292,14 +299,14 @@ extern OSStatus BTClosePath (FCB *filePtr ); extern OSStatus BTSearchRecord (FCB *filePtr, BTreeIterator *searchIterator, FSBufferDescriptor *btRecord, - UInt16 *recordLen, + u_int16_t *recordLen, BTreeIterator *resultIterator ); extern OSStatus BTIterateRecord (FCB *filePtr, BTreeIterationOperation operation, BTreeIterator *iterator, FSBufferDescriptor *btRecord, - UInt16 *recordLen ); + u_int16_t *recordLen ); extern OSStatus BTIterateRecords(FCB *filePtr, BTreeIterationOperation operation, BTreeIterator *iterator, @@ -308,12 +315,12 @@ extern OSStatus BTIterateRecords(FCB *filePtr, BTreeIterationOperation operation extern OSStatus BTInsertRecord (FCB *filePtr, BTreeIterator *iterator, FSBufferDescriptor *btrecord, - UInt16 recordLen ); + u_int16_t recordLen ); extern OSStatus BTReplaceRecord (FCB *filePtr, BTreeIterator *iterator, FSBufferDescriptor *btRecord, - UInt16 recordLen ); + u_int16_t recordLen ); extern OSStatus BTUpdateRecord (FCB *filePtr, BTreeIterator *iterator, @@ -324,9 +331,11 @@ extern OSStatus BTDeleteRecord (FCB *filePtr, BTreeIterator *iterator ); extern OSStatus BTGetInformation (FCB *filePtr, - UInt16 vers, + u_int16_t vers, BTreeInfoRec *info ); +extern OSStatus BTIsDirty(FCB *filePtr); + extern OSStatus BTFlushPath (FCB *filePtr ); extern OSStatus BTReloadData (FCB *filePtr); @@ -334,10 +343,10 @@ extern OSStatus BTReloadData (FCB *filePtr); extern OSStatus BTInvalidateHint (BTreeIterator *iterator ); extern OSStatus BTGetLastSync (FCB *filePtr, - UInt32 *lastfsync ); + u_int32_t *lastfsync ); extern OSStatus BTSetLastSync (FCB *filePtr, - UInt32 lastfsync ); + u_int32_t lastfsync ); extern OSStatus BTHasContiguousNodes(FCB *filePtr); @@ -352,6 +361,7 @@ extern int BTReserveSpace(FCB *file, int operations, void * data); extern int BTReleaseReserve(FCB *file, void * data); +extern int BTZeroUnusedNodes(FCB *file); #endif /* __APPLE_API_PRIVATE */ #endif /* KERNEL */