|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: * Reserved. This file contains Original Code and/or Modifications of ! 8: * Original Code as defined in and that are subject to the Apple Public ! 9: * Source License Version 1.1 (the "License"). You may not use this file ! 10: * except in compliance with the License. Please obtain a copy of the ! 11: * License at http://www.apple.com/publicsource and read it before using ! 12: * this file. ! 13: * ! 14: * The Original Code and all software distributed under the License are ! 15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 19: * License for the specific language governing rights and limitations ! 20: * under the License. ! 21: * ! 22: * @APPLE_LICENSE_HEADER_END@ ! 23: */ ! 24: ! 25: /* ! 26: File: CatalogPrivate.h ! 27: ! 28: Contains: Private Catalog Manager interfaces. ! 29: ! 30: Version: HFS Plus 1.0 ! 31: ! 32: Copyright: � 1997-1998 by Apple Computer, Inc., all rights reserved. ! 33: ! 34: File Ownership: ! 35: ! 36: DRI: Don Brady ! 37: ! 38: Other Contact: xxx put other contact here xxx ! 39: ! 40: Technology: xxx put technology here xxx ! 41: ! 42: Writers: ! 43: ! 44: (JL) Jim Luther ! 45: (msd) Mark Day ! 46: (DSH) Deric Horn ! 47: (djb) Don Brady ! 48: ! 49: Change History (most recent first): ! 50: <Rhap> 11/10/98 djb Remove obsolete PrepareInputName prototype; ! 51: <Rhap> 4/6/98 djb Added lock data stuctures and ReleaseCatalogIterator prototype; ! 52: <Rhap> 4/6/98 djb Removed CatalogDataCache since its no longer used. ! 53: <Rhap> 4/2/98 djb InvalidateCatalogNodeCache does nothing under Rhapsody. ! 54: <Rhap> 3/31/98 djb Sync up with final HFSVolumes.h header file. ! 55: ! 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 ! 61: ExchangeFiles. ! 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 ! 67: collision ! 68: <CS2> 6/24/97 djb Add LocateCatalogNodeByMangledName routine. ! 69: <CS1> 6/24/97 djb first checked in ! 70: */ ! 71: ! 72: #ifndef __CATALOGPRIVATE__ ! 73: #define __CATALOGPRIVATE__ ! 74: ! 75: #include "FileMgrInternal.h" ! 76: #include "BTreesInternal.h" ! 77: #include "HFSVolumes.h" ! 78: ! 79: #if TARGET_OS_RHAPSODY ! 80: #include <sys/lock.h> ! 81: #endif ! 82: ! 83: // private catalog data cache ! 84: ! 85: ! 86: ! 87: enum { ! 88: kCatalogIteratorCount = 16 // total number of Catalog iterators (shared by all HFS/HFS Plus volumes) ! 89: }; ! 90: ! 91: ! 92: // Catalog Iterator Types ! 93: enum { ! 94: kIterateAll, // from GetCatInfo call ! 95: kIterateFilesOnly // from GetFileInfo call ! 96: }; ! 97: ! 98: ! 99: // Catalog Iterator Name Types ! 100: enum { ! 101: kShortPascalName, ! 102: kShortUnicodeName, ! 103: kLongUnicodeName // non-local name ! 104: }; ! 105: ! 106: ! 107: // short unicode name (used by CatalogIterator) ! 108: struct UniStr63 { ! 109: UInt16 length; /* number of unicode characters */ ! 110: UniChar unicode[63]; /* unicode characters */ ! 111: }; ! 112: typedef struct UniStr63 UniStr63; ! 113: ! 114: ! 115: struct CatalogIterator ! 116: { ! 117: struct CatalogIterator * nextMRU; // next iterator in MRU order ! 118: struct CatalogIterator * nextLRU; // next iterator in LRU order ! 119: ! 120: UInt16 iteratorType; // {0 = GetCatInfo, 1 = GetFileInfo} ! 121: SInt16 volRefNum; ! 122: HFSCatalogNodeID folderID; ! 123: ! 124: SInt16 currentIndex; ! 125: SInt16 fileIndex; // for GetFileInfo (to skip folders) ! 126: UInt32 btreeNodeHint; // node the key was last seen in ! 127: UInt16 btreeIndexHint; // index the key was last seen at ! 128: UInt16 nameType; // { 0 = Pascal, 1 = Unicode, 3 = long name} ! 129: HFSCatalogNodeID parentID; // parent folder ID ! 130: union ! 131: { ! 132: Str31 pascalName; ! 133: UniStr63 unicodeName; ! 134: HFSUniStr255 * longNamePtr; ! 135: } folderName; ! 136: ! 137: #if TARGET_OS_RHAPSODY ! 138: struct lock__bsd__ iterator_lock; ! 139: #endif ! 140: }; ! 141: typedef struct CatalogIterator CatalogIterator; ! 142: ! 143: ! 144: struct CatalogCacheGlobals { ! 145: UInt32 iteratorCount; // Number of iterators in cache ! 146: CatalogIterator * mru; ! 147: CatalogIterator * lru; ! 148: UInt32 reserved; ! 149: HFSUniStr255 longName; // used by a single kLongUnicodeName iterator ! 150: ! 151: #if TARGET_OS_RHAPSODY ! 152: simple_lock_data_t simplelock; ! 153: #endif ! 154: }; ! 155: typedef struct CatalogCacheGlobals CatalogCacheGlobals; ! 156: ! 157: ! 158: #if TARGET_OS_MAC ! 159: // Private Catalog Macros ! 160: ! 161: // We keep a copy of the text encoding in the upper byte of the catalog hint (yuck!). ! 162: // This overloading was done in the first release since the client is in 68K assembly ! 163: // and it saves information (like the hint) in registers. ! 164: // ! 165: // The lower 24 bits is the b-tree node hint which allows for 16 million nodes (or a ! 166: // 67 GB Catalog B-tree). ! 167: // ! 168: // The text encoding needs to be a formal parameter in future releases!! ! 169: // ! 170: extern TextEncoding GetTextEncodingFromHint(UInt32 hint); ! 171: #define GetTextEncodingFromHint(hint) ((hint)>>24) ! 172: ! 173: extern void SetTextEncodingInHint(TextEncoding encoding, UInt32 *hint); ! 174: #define SetTextEncodingInHint(encoding, hint) (*(hint) += ((encoding)<<24)) ! 175: ! 176: extern UInt32 GetBTreeNodeFromHint(UInt32 hint); ! 177: #define GetBTreeNodeFromHint(hint) ((hint) & 0x00FFFFFF) ! 178: ! 179: #endif ! 180: ! 181: // ! 182: // Private Catalog Manager Routines (for use only by Catalog Manager, CatSearch and FileID Services) ! 183: // ! 184: ! 185: extern OSErr LocateCatalogThread( const ExtendedVCB *volume, HFSCatalogNodeID nodeID, CatalogRecord *threadData, ! 186: UInt16 *threadSize, UInt32 *threadHint); ! 187: ! 188: extern OSErr LocateCatalogNode( const ExtendedVCB *volume, HFSCatalogNodeID folderID, const CatalogName *name, ! 189: UInt32 hint, CatalogKey *key, CatalogRecord *data, UInt32 *newHint); ! 190: ! 191: extern OSErr LocateCatalogNodeByKey ( const ExtendedVCB *volume, UInt32 hint, CatalogKey *keyPtr, ! 192: CatalogRecord *dataPtr, UInt32 *newHint ); ! 193: ! 194: extern OSErr LocateCatalogRecord( const ExtendedVCB *volume, HFSCatalogNodeID folderID, const CatalogName *name, ! 195: UInt32 hint, CatalogKey *keyPtr, CatalogRecord *dataPtr, UInt32 *newHint); ! 196: ! 197: extern OSErr LocateCatalogNodeWithRetry ( const ExtendedVCB *volume, HFSCatalogNodeID folderID, ConstStr31Param pascalName, ! 198: CatalogName *unicodeName, UInt32 hint, CatalogKey *keyPtr, CatalogRecord *dataPtr, ! 199: UInt32 *newHint ); ! 200: ! 201: extern OSErr LocateCatalogNodeByMangledName( const ExtendedVCB *volume, HFSCatalogNodeID folderID, ConstStr31Param name, ! 202: CatalogKey *keyPtr, CatalogRecord *dataPtr, UInt32 *hintPtr ); ! 203: ! 204: extern OSErr FlushCatalog( ExtendedVCB *volume); ! 205: ! 206: #if TARGET_OS_MAC ! 207: extern void InvalidateCatalogNodeCache( ExtendedVCB *volume, HFSCatalogNodeID parentID ); ! 208: #else ! 209: #define InvalidateCatalogNodeCache(v, pid) ! 210: #endif ! 211: ! 212: extern OSErr UpdateFolderCount( ExtendedVCB *volume, HFSCatalogNodeID parentID, const CatalogName *name, SInt16 newType, ! 213: UInt32 hint, SInt16 valenceDelta); ! 214: ! 215: extern UInt16 GetCatalogRecordSize( const CatalogRecord *dataRecord); ! 216: ! 217: extern void ConvertInputNameToUnicode(ConstStr31Param name, TextEncoding encodingHint, ! 218: TextEncoding *actualEncoding, CatalogName *catalogName); ! 219: ! 220: extern void BuildCatalogKey( HFSCatalogNodeID parentID, const CatalogName *name, Boolean isHFSPlus, ! 221: CatalogKey *key); ! 222: ! 223: extern OSErr BuildCatalogKeyUTF8( HFSCatalogNodeID parentID, const char *name, Boolean isHFSPlus, ! 224: CatalogKey *key, UInt32 *textEncoding); ! 225: ! 226: extern void UpdateCatalogName( ConstStr31Param srcName, Str31 destName); ! 227: ! 228: extern UInt32 CatalogNameLength( const CatalogName *name, Boolean isHFSPlus); ! 229: ! 230: extern void CopyCatalogName( const CatalogName *srcName, CatalogName *dstName, Boolean isHFSPLus); ! 231: ! 232: extern OSErr ResolveFileID( ExtendedVCB *vcb, HFSCatalogNodeID fileID, HFSCatalogNodeID *parentID, Str31 name ); ! 233: ! 234: extern OSErr CreateFileThreadID( FIDParam *filePB, WDCBRecPtr *wdcbPtr ); ! 235: ! 236: extern OSErr ExchangeFiles( FIDParam *filePB, WDCBRecPtr *wdcbPtr ); ! 237: ! 238: extern void CopyCatalogNodeData( const ExtendedVCB *volume, const CatalogRecord *dataPtr, CatalogNodeData *nodeData); ! 239: ! 240: extern void UpdateVolumeEncodings( ExtendedVCB *volume, TextEncoding encoding); ! 241: ! 242: extern void AdjustVolumeCounts( ExtendedVCB *volume, SInt16 type, SInt16 delta ); ! 243: ! 244: ! 245: // Catalog Iterator Routines ! 246: ! 247: extern CatalogIterator* GetCatalogIterator( const ExtendedVCB *volume, HFSCatalogNodeID folderID, UInt16 index, UInt16 iterationType ); ! 248: ! 249: extern OSErr ReleaseCatalogIterator( CatalogIterator *catalogIterator ); ! 250: ! 251: extern void TrashCatalogIterator( const ExtendedVCB *volume, HFSCatalogNodeID folderID ); ! 252: ! 253: void AgeCatalogIterator( CatalogIterator *catalogIterator ); ! 254: ! 255: extern void UpdateBtreeIterator( const CatalogIterator *catalogIterator, BTreeIterator *btreeIterator ); ! 256: ! 257: extern void UpdateCatalogIterator( const BTreeIterator *btreeIterator, CatalogIterator *catalogIterator ); ! 258: ! 259: ! 260: #endif //__CATALOGPRIVATE__
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.