2 * Copyright (c) 2000, 2002 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 File: CatalogPrivate.h
25 Contains: Private Catalog Manager interfaces.
29 Copyright: © 1997-1998 by Apple Computer, Inc., all rights reserved.
35 Other Contact: xxx put other contact here xxx
37 Technology: xxx put technology here xxx
46 Change History (most recent first):
47 <MacOSX> 11/10/98 djb Remove obsolete PrepareInputName prototype;
48 <MacOSX> 4/6/98 djb Added lock data stuctures and ReleaseCatalogIterator prototype;
49 <MacOSX> 4/6/98 djb Removed CatalogDataCache since its no longer used.
50 <MacOSX> 4/2/98 djb InvalidateCatalogNodeCache does nothing under MacOS X.
51 <MacOSX> 3/31/98 djb Sync up with final HFSVolumes.h header file.
53 <CS10> 11/20/97 djb Radar #2002357. Fixing retry mechanism.
54 <CS9> 11/17/97 djb PrepareInputName routine now returns an error.
55 <CS8> 11/13/97 djb Radar #1683572. Move CatalogIterator to this file from
56 FileMgrInternal.i. Double size of short unicode name.
57 <CS7> 10/31/97 JL #2000184 - Changed prototypes for CreateFileThreadID and
59 <CS6> 10/17/97 msd In CatalogCacheGlobals, add room for a single UniStr255 so
60 catalog iterators can step over long Unicode names.
61 <CS5> 10/17/97 djb Add ConvertInputNameToUnicode for Catalog Create/Rename.
62 <CS4> 10/1/97 djb Change catalog iterator implementation.
63 <CS3> 7/16/97 DSH FilesInternal.i renamed FileMgrInternal.i to avoid name
65 <CS2> 6/24/97 djb Add LocateCatalogNodeByMangledName routine.
66 <CS1> 6/24/97 djb first checked in
69 #ifndef __CATALOGPRIVATE__
70 #define __CATALOGPRIVATE__
72 #include <sys/appleapiopts.h>
75 #ifdef __APPLE_API_PRIVATE
77 #include "../../hfs_format.h"
79 #include "FileMgrInternal.h"
80 #include "BTreesInternal.h"
84 // private catalog data cache
89 kCatalogIteratorCount
= 16 // total number of Catalog iterators (shared by all HFS/HFS Plus volumes)
93 // Catalog Iterator Name Types
97 kLongUnicodeName
// non-local name
101 // short unicode name (used by CatalogIterator)
103 UInt16 length
; /* number of unicode characters */
104 UniChar unicode
[63]; /* unicode characters */
106 typedef struct UniStr63 UniStr63
;
109 struct CatalogIterator
111 struct CatalogIterator
*nextMRU
; // next iterator in MRU order
112 struct CatalogIterator
*nextLRU
; // next iterator in LRU order
117 UInt32 currentOffset
;
119 HFSCatalogNodeID folderID
;
121 UInt32 btreeNodeHint
; // node the key was last seen in
122 UInt16 btreeIndexHint
; // index the key was last seen at
123 UInt16 nameType
; // { 0 = Pascal, 1 = Unicode, 3 = long name}
124 HFSCatalogNodeID parentID
; // parent folder ID
128 UniStr63 unicodeName
;
129 HFSUniStr255
* longNamePtr
;
132 struct lock__bsd__ iterator_lock
;
134 typedef struct CatalogIterator CatalogIterator
;
137 struct CatalogCacheGlobals
{
138 UInt32 iteratorCount
; // Number of iterators in cache
139 CatalogIterator
* mru
;
140 CatalogIterator
* lru
;
142 HFSUniStr255 longName
; // used by a single kLongUnicodeName iterator
144 simple_lock_data_t simplelock
;
146 typedef struct CatalogCacheGlobals CatalogCacheGlobals
;
150 // Private Catalog Manager Routines (for use only by Catalog Manager, CatSearch and FileID Services)
154 extern OSErr
LocateCatalogNode( const ExtendedVCB
*volume
, HFSCatalogNodeID folderID
, const CatalogName
*name
,
155 UInt32 hint
, CatalogKey
*key
, CatalogRecord
*data
, UInt32
*newHint
);
157 extern OSErr
LocateCatalogNodeByKey ( const ExtendedVCB
*volume
, UInt32 hint
, CatalogKey
*keyPtr
,
158 CatalogRecord
*dataPtr
, UInt32
*newHint
);
160 extern OSErr
LocateCatalogRecord( const ExtendedVCB
*volume
, HFSCatalogNodeID folderID
, const CatalogName
*name
,
161 UInt32 hint
, CatalogKey
*keyPtr
, CatalogRecord
*dataPtr
, UInt32
*newHint
);
163 extern OSErr
LocateCatalogNodeWithRetry ( const ExtendedVCB
*volume
, HFSCatalogNodeID folderID
, ConstStr31Param pascalName
,
164 CatalogName
*unicodeName
, UInt32 hint
, CatalogKey
*keyPtr
, CatalogRecord
*dataPtr
,
166 extern OSErr
FlushCatalog( ExtendedVCB
*volume
);
169 extern void ConvertInputNameToUnicode(ConstStr31Param name
, TextEncoding encodingHint
,
170 TextEncoding
*actualEncoding
, CatalogName
*catalogName
);
172 extern void BuildCatalogKey( HFSCatalogNodeID parentID
, const CatalogName
*name
, Boolean isHFSPlus
,
175 extern OSErr
BuildCatalogKeyUTF8(ExtendedVCB
*volume
, HFSCatalogNodeID parentID
, const char *name
,
176 UInt32 length
, CatalogKey
*key
, UInt32
*textEncoding
);
178 extern void CopyCatalogName( const CatalogName
*srcName
, CatalogName
*dstName
, Boolean isHFSPLus
);
180 extern OSErr
ResolveFileID( ExtendedVCB
*vcb
, HFSCatalogNodeID fileID
, HFSCatalogNodeID
*parentID
, Str31 name
);
183 extern OSErr
CreateFileThreadID( FIDParam
*filePB
, WDCBRecPtr
*wdcbPtr
);
185 extern OSErr
ExchangeFiles( FIDParam
*filePB
, WDCBRecPtr
*wdcbPtr
);
189 // Catalog Iterator Routines
191 extern CatalogIterator
* GetCatalogIterator(ExtendedVCB
*volume
, HFSCatalogNodeID folderID
, UInt32 offset
);
193 extern OSErr
ReleaseCatalogIterator( CatalogIterator
*catalogIterator
);
195 extern void TrashCatalogIterator( const ExtendedVCB
*volume
, HFSCatalogNodeID folderID
);
197 void AgeCatalogIterator( CatalogIterator
*catalogIterator
);
199 extern void UpdateBtreeIterator( const CatalogIterator
*catalogIterator
, BTreeIterator
*btreeIterator
);
201 extern void UpdateCatalogIterator( const BTreeIterator
*btreeIterator
, CatalogIterator
*catalogIterator
);
204 #endif /* __APPLE_API_PRIVATE */
206 #endif //__CATALOGPRIVATE__