Annotation of XNU/bsd/hfs/hfscommon/headers/CatalogPrivate.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      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.
                     11:  * 
                     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
                     18:  * under the License.
                     19:  * 
                     20:  * @APPLE_LICENSE_HEADER_END@
                     21:  */
                     22: /*
                     23:        File:           CatalogPrivate.h
                     24: 
                     25:        Contains:       Private Catalog Manager interfaces.
                     26: 
                     27:        Version:        HFS Plus 1.0
                     28: 
                     29:        Copyright:      � 1997-1998 by Apple Computer, Inc., all rights reserved.
                     30: 
                     31:        File Ownership:
                     32: 
                     33:                DRI:                            Don Brady
                     34: 
                     35:                Other Contact:          xxx put other contact here xxx
                     36: 
                     37:                Technology:                     xxx put technology here xxx
                     38: 
                     39:        Writers:
                     40: 
                     41:                (JL)    Jim Luther
                     42:                (msd)   Mark Day
                     43:                (DSH)   Deric Horn
                     44:                (djb)   Don Brady
                     45: 
                     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.
                     52: 
                     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
                     58:                                                                        ExchangeFiles.
                     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
                     64:                                                                        collision
                     65:           <CS2>         6/24/97        djb             Add LocateCatalogNodeByMangledName routine.
                     66:           <CS1>         6/24/97        djb             first checked in
                     67: */
                     68: 
                     69: #ifndef        __CATALOGPRIVATE__
                     70: #define __CATALOGPRIVATE__
                     71: 
                     72: #include "../../hfs_format.h"
                     73: 
                     74: #include       "FileMgrInternal.h"
                     75: #include       "BTreesInternal.h"
                     76: 
                     77:        #include <sys/lock.h>
                     78: 
                     79: // private catalog data cache
                     80: 
                     81: 
                     82: 
                     83: enum {
                     84:        kCatalogIteratorCount = 16              // total number of Catalog iterators (shared by all HFS/HFS Plus volumes)
                     85: };
                     86: 
                     87: 
                     88: // Catalog Iterator Name Types
                     89: enum {
                     90:        kShortPascalName,
                     91:        kShortUnicodeName,
                     92:        kLongUnicodeName        // non-local name
                     93: };
                     94: 
                     95: 
                     96: // short unicode name (used by CatalogIterator)
                     97: struct UniStr63 {
                     98:        UInt16          length;                 /* number of unicode characters */
                     99:        UniChar         unicode[63];            /* unicode characters */
                    100: };
                    101: typedef struct UniStr63 UniStr63;
                    102: 
                    103: 
                    104: struct CatalogIterator
                    105: {
                    106:        struct CatalogIterator *nextMRU;        // next iterator in MRU order
                    107:        struct CatalogIterator *nextLRU;        // next iterator in LRU order
                    108: 
                    109:        ExtendedVCB             *volume;
                    110:        SInt16                  currentIndex;
                    111:        SInt16                  reserved;
                    112:        UInt32                  currentOffset;
                    113:        UInt32                  nextOffset;
                    114:        HFSCatalogNodeID        folderID;
                    115: 
                    116:        UInt32                  btreeNodeHint;  // node the key was last seen in
                    117:        UInt16                  btreeIndexHint; // index the key was last seen at
                    118:        UInt16                  nameType;       // { 0 = Pascal, 1 = Unicode, 3 = long name}
                    119:        HFSCatalogNodeID        parentID;       // parent folder ID
                    120:        union
                    121:        {
                    122:                Str31           pascalName;
                    123:                UniStr63        unicodeName;
                    124:                HFSUniStr255 *  longNamePtr;
                    125:        } folderName;
                    126: 
                    127:        struct lock__bsd__      iterator_lock;
                    128: };
                    129: typedef struct CatalogIterator CatalogIterator;
                    130: 
                    131: 
                    132: struct CatalogCacheGlobals {
                    133:        UInt32                  iteratorCount;  // Number of iterators in cache
                    134:        CatalogIterator *       mru;
                    135:        CatalogIterator *       lru;
                    136:        UInt32                  reserved;
                    137:        HFSUniStr255            longName;       // used by a single kLongUnicodeName iterator
                    138: 
                    139:        simple_lock_data_t      simplelock;
                    140: };
                    141: typedef struct CatalogCacheGlobals CatalogCacheGlobals;
                    142: 
                    143: 
                    144: //
                    145: // Private Catalog Manager Routines (for use only by Catalog Manager, CatSearch and FileID Services)
                    146: //
                    147: 
                    148: extern OSErr   LocateCatalogThread( const ExtendedVCB *volume, HFSCatalogNodeID nodeID, CatalogRecord *threadData,
                    149:                                                                         UInt16 *threadSize, UInt32 *threadHint);
                    150: 
                    151: extern OSErr   LocateCatalogNode(      const ExtendedVCB *volume, HFSCatalogNodeID folderID, const CatalogName *name,
                    152:                                                                        UInt32 hint, CatalogKey *key, CatalogRecord *data, UInt32 *newHint);
                    153: 
                    154: extern OSErr   LocateCatalogNodeByKey ( const ExtendedVCB *volume, UInt32 hint, CatalogKey *keyPtr,
                    155:                                                                                 CatalogRecord *dataPtr, UInt32 *newHint );
                    156: 
                    157: extern OSErr   LocateCatalogRecord( const ExtendedVCB *volume, HFSCatalogNodeID folderID, const CatalogName *name,
                    158:                                                                         UInt32 hint, CatalogKey *keyPtr, CatalogRecord *dataPtr, UInt32 *newHint);
                    159: 
                    160: extern OSErr   LocateCatalogNodeWithRetry ( const ExtendedVCB *volume, HFSCatalogNodeID folderID, ConstStr31Param pascalName,
                    161:                                                                                         CatalogName *unicodeName, UInt32 hint, CatalogKey *keyPtr, CatalogRecord *dataPtr,
                    162:                                                                                         UInt32 *newHint );
                    163: 
                    164: extern OSErr   LocateCatalogNodeByMangledName( const ExtendedVCB *volume, HFSCatalogNodeID folderID, 
                    165:                                ConstStr31Param name, UInt32 length,
                    166:                                CatalogKey *keyPtr, CatalogRecord *dataPtr, UInt32 *hintPtr );
                    167: 
                    168: extern OSErr   FlushCatalog( ExtendedVCB *volume);
                    169: 
                    170: #define                        InvalidateCatalogNodeCache(v, pid)
                    171: 
                    172: extern OSErr   UpdateFolderCount( ExtendedVCB *volume, HFSCatalogNodeID parentID, const CatalogName *name, SInt16 newType,
                    173:                                                                   UInt32 hint, SInt16 valenceDelta);
                    174: 
                    175: extern UInt16  GetCatalogRecordSize( const CatalogRecord *dataRecord);
                    176: 
                    177: extern void            ConvertInputNameToUnicode(ConstStr31Param name, TextEncoding encodingHint,
                    178:                                                                                  TextEncoding *actualEncoding, CatalogName *catalogName);
                    179: 
                    180: extern void    BuildCatalogKey( HFSCatalogNodeID parentID, const CatalogName *name, Boolean isHFSPlus,
                    181:                                                                 CatalogKey *key);
                    182: 
                    183: extern OSErr   BuildCatalogKeyUTF8(ExtendedVCB *volume, HFSCatalogNodeID parentID, const char *name,
                    184:                                    UInt32 length, CatalogKey *key, UInt32 *textEncoding);
                    185: 
                    186: extern void    UpdateCatalogName( ConstStr31Param srcName, Str31 destName);
                    187: 
                    188: extern UInt32  CatalogNameLength( const CatalogName *name, Boolean isHFSPlus);
                    189: 
                    190: extern void            CopyCatalogName( const CatalogName *srcName, CatalogName *dstName, Boolean isHFSPLus);
                    191: 
                    192: extern OSErr   ResolveFileID( ExtendedVCB *vcb, HFSCatalogNodeID fileID, HFSCatalogNodeID *parentID, Str31 name );
                    193: 
                    194: #if 0
                    195: extern OSErr   CreateFileThreadID( FIDParam *filePB, WDCBRecPtr *wdcbPtr );
                    196: 
                    197: extern OSErr   ExchangeFiles( FIDParam *filePB, WDCBRecPtr *wdcbPtr );
                    198: #endif 
                    199: 
                    200: extern void            CopyCatalogNodeData( const ExtendedVCB *volume, const CatalogRecord *dataPtr, CatalogNodeData *nodeData);
                    201: 
                    202: extern void            UpdateVolumeEncodings( ExtendedVCB *volume, TextEncoding encoding);
                    203: 
                    204: extern void            AdjustVolumeCounts( ExtendedVCB *volume, SInt16 type, SInt16 delta );
                    205: 
                    206: 
                    207: // Catalog Iterator Routines
                    208: 
                    209: extern CatalogIterator* oGetCatalogIterator( const ExtendedVCB *volume, HFSCatalogNodeID folderID, UInt16 index);
                    210: extern CatalogIterator* GetCatalogIterator(ExtendedVCB *volume, HFSCatalogNodeID folderID, UInt32 offset);
                    211: 
                    212: extern OSErr   ReleaseCatalogIterator( CatalogIterator *catalogIterator );
                    213: 
                    214: extern void            TrashCatalogIterator( const ExtendedVCB *volume, HFSCatalogNodeID folderID );
                    215: 
                    216: void                   AgeCatalogIterator( CatalogIterator *catalogIterator );
                    217: 
                    218: extern void            UpdateBtreeIterator( const CatalogIterator *catalogIterator, BTreeIterator *btreeIterator );
                    219: 
                    220: extern void            UpdateCatalogIterator( const BTreeIterator *btreeIterator, CatalogIterator *catalogIterator );
                    221: 
                    222: 
                    223: #endif //__CATALOGPRIVATE__

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.