2 * Copyright (c) 2000, 2002 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 File: CatalogPrivate.h
28 Contains: Private Catalog Manager interfaces.
32 Copyright: © 1997-1998 by Apple Computer, Inc., all rights reserved.
38 Other Contact: xxx put other contact here xxx
40 Technology: xxx put technology here xxx
49 Change History (most recent first):
50 <MacOSX> 11/10/98 djb Remove obsolete PrepareInputName prototype;
51 <MacOSX> 4/6/98 djb Added lock data stuctures and ReleaseCatalogIterator prototype;
52 <MacOSX> 4/6/98 djb Removed CatalogDataCache since its no longer used.
53 <MacOSX> 4/2/98 djb InvalidateCatalogNodeCache does nothing under MacOS X.
54 <MacOSX> 3/31/98 djb Sync up with final HFSVolumes.h header file.
56 <CS10> 11/20/97 djb Radar #2002357. Fixing retry mechanism.
57 <CS9> 11/17/97 djb PrepareInputName routine now returns an error.
58 <CS8> 11/13/97 djb Radar #1683572. Move CatalogIterator to this file from
59 FileMgrInternal.i. Double size of short unicode name.
60 <CS7> 10/31/97 JL #2000184 - Changed prototypes for CreateFileThreadID and
62 <CS6> 10/17/97 msd In CatalogCacheGlobals, add room for a single UniStr255 so
63 catalog iterators can step over long Unicode names.
64 <CS5> 10/17/97 djb Add ConvertInputNameToUnicode for Catalog Create/Rename.
65 <CS4> 10/1/97 djb Change catalog iterator implementation.
66 <CS3> 7/16/97 DSH FilesInternal.i renamed FileMgrInternal.i to avoid name
68 <CS2> 6/24/97 djb Add LocateCatalogNodeByMangledName routine.
69 <CS1> 6/24/97 djb first checked in
72 #ifndef __CATALOGPRIVATE__
73 #define __CATALOGPRIVATE__
75 #include <sys/appleapiopts.h>
78 #ifdef __APPLE_API_PRIVATE
80 #include "../../hfs_format.h"
82 #include "FileMgrInternal.h"
83 #include "BTreesInternal.h"
87 // private catalog data cache
92 kCatalogIteratorCount
= 16 // total number of Catalog iterators (shared by all HFS/HFS Plus volumes)
96 // Catalog Iterator Name Types
100 kLongUnicodeName
// non-local name
104 // short unicode name (used by CatalogIterator)
106 UInt16 length
; /* number of unicode characters */
107 UniChar unicode
[63]; /* unicode characters */
109 typedef struct UniStr63 UniStr63
;
112 struct CatalogIterator
114 struct CatalogIterator
*nextMRU
; // next iterator in MRU order
115 struct CatalogIterator
*nextLRU
; // next iterator in LRU order
120 UInt32 currentOffset
;
122 HFSCatalogNodeID folderID
;
124 UInt32 btreeNodeHint
; // node the key was last seen in
125 UInt16 btreeIndexHint
; // index the key was last seen at
126 UInt16 nameType
; // { 0 = Pascal, 1 = Unicode, 3 = long name}
127 HFSCatalogNodeID parentID
; // parent folder ID
131 UniStr63 unicodeName
;
132 HFSUniStr255
* longNamePtr
;
135 struct lock__bsd__ iterator_lock
;
137 typedef struct CatalogIterator CatalogIterator
;
140 struct CatalogCacheGlobals
{
141 UInt32 iteratorCount
; // Number of iterators in cache
142 CatalogIterator
* mru
;
143 CatalogIterator
* lru
;
145 HFSUniStr255 longName
; // used by a single kLongUnicodeName iterator
147 simple_lock_data_t simplelock
;
149 typedef struct CatalogCacheGlobals CatalogCacheGlobals
;
153 // Private Catalog Manager Routines (for use only by Catalog Manager, CatSearch and FileID Services)
157 extern OSErr
LocateCatalogNode( const ExtendedVCB
*volume
, HFSCatalogNodeID folderID
, const CatalogName
*name
,
158 UInt32 hint
, CatalogKey
*key
, CatalogRecord
*data
, UInt32
*newHint
);
160 extern OSErr
LocateCatalogNodeByKey ( const ExtendedVCB
*volume
, UInt32 hint
, CatalogKey
*keyPtr
,
161 CatalogRecord
*dataPtr
, UInt32
*newHint
);
163 extern OSErr
LocateCatalogRecord( const ExtendedVCB
*volume
, HFSCatalogNodeID folderID
, const CatalogName
*name
,
164 UInt32 hint
, CatalogKey
*keyPtr
, CatalogRecord
*dataPtr
, UInt32
*newHint
);
166 extern OSErr
LocateCatalogNodeWithRetry ( const ExtendedVCB
*volume
, HFSCatalogNodeID folderID
, ConstStr31Param pascalName
,
167 CatalogName
*unicodeName
, UInt32 hint
, CatalogKey
*keyPtr
, CatalogRecord
*dataPtr
,
169 extern OSErr
FlushCatalog( ExtendedVCB
*volume
);
172 extern void ConvertInputNameToUnicode(ConstStr31Param name
, TextEncoding encodingHint
,
173 TextEncoding
*actualEncoding
, CatalogName
*catalogName
);
175 extern void BuildCatalogKey( HFSCatalogNodeID parentID
, const CatalogName
*name
, Boolean isHFSPlus
,
178 extern OSErr
BuildCatalogKeyUTF8(ExtendedVCB
*volume
, HFSCatalogNodeID parentID
, const char *name
,
179 UInt32 length
, CatalogKey
*key
, UInt32
*textEncoding
);
181 extern void CopyCatalogName( const CatalogName
*srcName
, CatalogName
*dstName
, Boolean isHFSPLus
);
183 extern OSErr
ResolveFileID( ExtendedVCB
*vcb
, HFSCatalogNodeID fileID
, HFSCatalogNodeID
*parentID
, Str31 name
);
186 extern OSErr
CreateFileThreadID( FIDParam
*filePB
, WDCBRecPtr
*wdcbPtr
);
188 extern OSErr
ExchangeFiles( FIDParam
*filePB
, WDCBRecPtr
*wdcbPtr
);
191 extern void UpdateCatalogName( ConstStr31Param srcName
, Str31 destName
);
194 // Catalog Iterator Routines
196 extern CatalogIterator
* GetCatalogIterator(ExtendedVCB
*volume
, HFSCatalogNodeID folderID
, UInt32 offset
);
198 extern OSErr
ReleaseCatalogIterator( CatalogIterator
*catalogIterator
);
200 extern void TrashCatalogIterator( const ExtendedVCB
*volume
, HFSCatalogNodeID folderID
);
202 void AgeCatalogIterator( CatalogIterator
*catalogIterator
);
204 extern void UpdateBtreeIterator( const CatalogIterator
*catalogIterator
, BTreeIterator
*btreeIterator
);
206 extern void UpdateCatalogIterator( const BTreeIterator
*btreeIterator
, CatalogIterator
*catalogIterator
);
209 #endif /* __APPLE_API_PRIVATE */
211 #endif //__CATALOGPRIVATE__