]>
git.saurik.com Git - apple/hfs.git/blob - fsck_hfs/dfalib/BTreeScanner.h
2 * Copyright (c) 1996-2002 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
26 #ifndef _BTREESCANNER_H_
27 #define _BTREESCANNER_H_
29 #include "BTreePrivate.h"
31 // btree node scanner buffer size. Joe Sokol suggests 128K as a max (2002 WWDC)
32 enum { kCatScanBufferSize
= (128 * 1024) };
36 BTScanState - This structure is used to keep track of the current state
37 of a BTree scan. It contains both the dynamic state information (like
38 the current node number and record number) and information that is static
39 for the duration of a scan (such as buffer pointers).
41 NOTE: recordNum may equal or exceed the number of records in the node
42 number nodeNum. If so, then the next attempt to get a record will move
47 // The following fields are set up once at initialization time.
48 // They are not changed during a scan.
51 BTreeControlBlock
* btcb
;
53 // The following fields are the dynamic state of the current scan.
54 u_int32_t nodeNum
; // zero is first node
55 u_int32_t recordNum
; // zero is first record
56 BTNodeDescriptor
* currentNodePtr
; // points to current node within buffer
57 int32_t nodesLeftInBuffer
; // number of valid nodes still in the buffer
58 int64_t recordsFound
; // number of leaf records seen so far
60 typedef struct BTScanState BTScanState
;
63 /* *********************** PROTOTYPES *********************** */
65 int BTScanInitialize( const SFCB
* btreeFile
,
66 BTScanState
* scanState
);
68 int BTScanNextRecord( BTScanState
* scanState
,
71 u_int32_t
* dataSize
);
73 int BTScanTerminate( BTScanState
* scanState
);
75 #endif /* !_BTREESCANNER_H_ */