Annotation of kernel/bsd/hfs/hfscommon/headers/FileMgrInternal.h, revision 1.1

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:           FilesInternal.h
        !            27: 
        !            28:        Contains:       IPI for File Manager (HFS Plus)
        !            29: 
        !            30:        Version:        HFS Plus 1.0
        !            31: 
        !            32:        Copyright:      � 1996-1998 by Apple Computer, Inc., all rights reserved.
        !            33: 
        !            34:        File Ownership:
        !            35: 
        !            36:                DRI:                            Don Brady
        !            37: 
        !            38:                Other Contacts:         Mark Day, Deric horn, Jim Luther
        !            39: 
        !            40:                Technology:                     File Systems
        !            41: 
        !            42:        Writers:
        !            43: 
        !            44:                (JL)    Jim Luther
        !            45:                (msd)   Mark Day
        !            46:                (djb)   Don Brady
        !            47:                (DSH)   Deric Horn
        !            48: 
        !            49:        Change History (most recent first):
        !            50:          <Rhap>        11/20/98        djb             Add support for UTF-8 names.
        !            51:          <Rhap>         8/31/98        djb             Added boolean flag to GetTimeLocal prototype.
        !            52:          <Rhap>         6/30/98        djb             Add NodesAreContiguous prototype (for radar #2249539).
        !            53:          <Rhap>         6/22/98        djb             Add ERR_BASE to error codes to make them negative (for Rhapsody only).
        !            54:                                                                        Replace DeallocFile prototype with DeleteFile prototype.
        !            55:          <Rhap>          6/5/98        djb             Added CreateFileIDRef prototype;
        !            56:          <Rhap>          6/3/98        djb             Add MoveRenameCatalogNode prototype (replaces seperate Move and Rename).
        !            57:          <Rhap>         4/17/98        djb             Add VCB locking.
        !            58:          <Rhap>          4/6/98        djb             Removed CreateVolumeCatalogCache and DisposeVolumeCatalogCache (obsolete).
        !            59:          <Rhap>          4/2/98        djb             UpdateCatalogNode now takes parID and name as input.
        !            60:          <Rhap>         3/31/98        djb             Sync up with final HFSVolumes.h header file.
        !            61:          <Rhap>         3/17/98        djb             Fixed CreateCatalogNode interface to take kCatalogFolderNode and
        !            62:                                                                        kCatalogFileNode as type input.
        !            63: 
        !            64:          <CS30>         1/29/98        DSH             Added TrashVolumeDiskCache prototype for TrashAllFSCaches API
        !            65:                                                                        support.
        !            66:          <CS29>        12/10/97        DSH             2201501, Overload the NodeData valence field for over 2 Gig file
        !            67:                                                                        support.
        !            68:          <CS28>        11/18/97        DSH             Conditionalize ou BlockCameFromDisk() macro for DFA
        !            69:          <CS27>        11/16/97        djb             LockMappingTable is now defined in UnicodeConverterPriv.i.
        !            70:          <CS26>        11/13/97        djb             Move CatalogIterator struct to CatalogPrivate.h. Include
        !            71:                                                                        UnicodeConverter.i instead of Unicode.i.
        !            72:          <CS25>         11/3/97        JL              #2001483 - changed UnMountVolume's prototype.
        !            73:                <24>    10/31/97        DSH             Added consistencyStatus parameter to MountCheck.
        !            74:          <CS23>        10/21/97        DSH             Interfacer tweak
        !            75:          <CS22>        10/21/97        DSH             Conditionalize LMGetFCBTable, LMGetFSVars for DFA to call
        !            76:                                                                        through DFAs LowMem accessors.
        !            77:          <CS21>        10/20/97        msd             Add a bytesMaximum parameter to BlockAllocate; removed fcb
        !            78:                                                                        parameter.
        !            79:          <CS20>        10/19/97        msd             Bug 1684586. Remove the modifyDate field from CatalogNodeDate.
        !            80:                                                                        GetCatInfo and SetCatInfo use only contentModDate.
        !            81:          <CS19>        10/16/97        djb             Add LMGetFSVars and LMGetFCBTable macros, add gBlockCacheDirty
        !            82:                                                                        to FSVars, simplified HFS Stack swapping macros.
        !            83:          <CS18>        10/13/97        DSH             Added InitBTreeHeader prototype
        !            84:          <CS17>        10/13/97        djb             Add volumeNameEncodingHint to VCB, add textEncoding to
        !            85:                                                                        CatalogNodeData, add gTextEncodingFontName to FSVars.
        !            86:          <CS16>         10/1/97        DSH             Added CheckVolumeConsistency() for 1682475.
        !            87:          <CS15>         10/1/97        djb             New Catalog iterators and Catalog node cache SPI.
        !            88:          <CS14>         9/17/97        DSH             Moved prototype HFSBlocksFromTotalSectors() here for DFA
        !            89:                                                                        wrapperless volume support.
        !            90:          <CS13>         9/16/97        msd             Add a field to FSVarsRec to store old WriteXParam address.
        !            91:          <CS12>         9/15/97        djb             Add gBootPToUTable to FSVars (used to bootstrap Unicode).
        !            92:          <CS11>          9/7/97        djb             Add FlushBlockCache prototype.
        !            93:          <CS10>          9/4/97        djb             Add cmParentNotFound error code and reportMissingParent bit.
        !            94:           <CS9>          9/4/97        msd             Remove unused attributes calls. Rename PropertyCloseVolume to
        !            95:                                                                        AttributesCloseVolume. In CatalogNodeData, replace
        !            96:                                                                        attributeModDate with modifyDate. Remove macro LatestModDate.
        !            97:           <CS8>         8/22/97        djb             Add readFromDisk flag to GetCacheBlock and BlockCameFromDisk
        !            98:                                                                        macro.
        !            99:           <CS7>         8/18/97        DSH             Override ASM cache accessing routines for DFA to use DFA cache.
        !           100:           <CS6>         7/28/97        msd             Add prototypes for CacheReadInPlace, RemountWrappedVolumes.
        !           101:           <CS5>         7/25/97        DSH             Added GenericMRUCache Routines
        !           102:           <CS4>         7/22/97        msd             In CatalogNodeData, move attributeModDate after backupDate; this
        !           103:                                                                        allows SetCatInfo to manipulate the rest of the dates in one
        !           104:                                                                        block, the same as in the parameter block.
        !           105:           <CS3>         7/21/97        djb             Add more instrumentation globals (CallProfile). Reallign FSVars.
        !           106:           <CS2>         7/18/97        msd             Selector for PBCreateAttribute conflicts with PBGetXCatInfo. The
        !           107:                                                                        attribute calls now have selectors in the range $65..$69.
        !           108:           <CS1>         7/16/97        DSH             first checked in
        !           109:          <CS23>          7/8/97        DSH             Added LockMappingTable() until its moved into the Unicode header
        !           110:                                                                        files.
        !           111:          <CS22>          7/7/97        DSH             Taking out changes made in HFS <45> for greater compatability
        !           112:                                                                        with the Tempo installer.
        !           113:          <CS21>         6/27/97        msd             Add PBLongRename SPI. Add prototype for
        !           114:                                                                        RenameCatalogNodeUnicode.
        !           115:          <CS20>         6/26/97        DSH             Conditionalized macro LocalToUTC to not look at FSVars for DFA.
        !           116:          <CS19>         6/25/97        msd             Add prototype for HFSCommunicationProc.
        !           117:          <CS18>         6/24/97        DSH             Adding runtime flags to deturmine unicode usage and installation
        !           118:                                                                        status.
        !           119:          <CS17>         6/24/97        djb             Add linkCount to CatalogNodeData. Add LinkCatalogNode prototype.
        !           120:                                                                        Move Private Catalog Manager prototypes to CatalogPrivate.h.
        !           121:          <CS16>         6/20/97        msd             Add prototype for CopyCatalogNodeData. In CatalogNodeData,
        !           122:                                                                        replaced modifyDate with contentModDate and attributeModDate.
        !           123:                                                                        Added a LatestModDate macro.
        !           124:                <15>     6/18/97        djb             Add mask to ConversionContext. Add encodingsBitmap to VCB (and
        !           125:                                                                        reallign some fields). Add gInstalledEncodings to FSVars.
        !           126:          <CS14>         6/17/97        msd             The conversions between local time and UTC have the sign of the
        !           127:                                                                        offset backwards.
        !           128:          <CS13>         6/13/97        djb             Removed PrepareOutputName. Changed parameters for
        !           129:                                                                        DeleteCatalogNode, MoveCatalogNode, PrepareInputName. Add
        !           130:                                                                        private catalog macros.
        !           131:          <CS12>         6/12/97        msd             Export BlockAllocateAny and UpdateVCBFreeBlks.
        !           132:          <CS11>         6/12/97        msd             Add a parameter block and prototype for an SPI to create very
        !           133:                                                                        large files.
        !           134:          <CS10>          6/9/97        msd             Add an offsetToUTC field to FSVarsRec. Add prototypes for
        !           135:                                                                        GetTimeUTC and GetTimeLocal; add macros for LocalToUTC and
        !           136:                                                                        UTCToLocal.
        !           137:           <CS9>          6/5/97        msd             Add MapLogicalToPhysical (internal routine), PBMapFilePosition
        !           138:                                                                        for external use.
        !           139:           <CS8>          6/4/97        djb             More Unicode converter changes (support for non roman scripts).
        !           140:           <CS7>          6/2/97        msd             Add prototype for AdjustEOF.
        !           141:           <CS6>         5/28/97        msd             Add prototypes for attributes SPI, both internal routines and PB
        !           142:                                                                        calls. Add FindFileNameGlueRec and FindFileName routine.
        !           143:                                                                        Prototypes for FindFileControlBlock and AccessBTree disappeared,
        !           144:                                                                        so added again.
        !           145:           <CS5>         5/20/97        DSH             Including LowMemPriv.a in DFA compiles
        !           146:           <CS4>         5/19/97        djb             Add uppLockMappingTable to FSVars.
        !           147:           <CS3>         5/19/97        djb             Add CreateVolumeCatalogCache and DisposeVolumeCatalogCache
        !           148:                                                                        prototypes. Remove private CatalogDataCache structure.
        !           149:           <CS2>         5/16/97        msd             Use fixed-size integers for GetBlock_glue and RelBlock_glue so
        !           150:                                                                        it will build with compilers other than MPW C and SC. Add
        !           151:                                                                        prototype for FillHFSStack, UnMountVolume, and
        !           152:                                                                        MakeVCBsExtendedVCBs from VolumeRequests.c. Add prototypes for
        !           153:                                                                        CreateEmbeddedVolume and InitUnicodeConverter.
        !           154:           <CS1>          5/9/97        djb             first checked in
        !           155:           <CS2>          5/7/97        djb             Add summary trace data. Shrink FSVars.later to 4 longs.
        !           156:           <CS1>         4/28/97        djb             first checked in
        !           157: 
        !           158: */
        !           159: #ifndef __FILEMGRINTERNAL__
        !           160: #define __FILEMGRINTERNAL__
        !           161: 
        !           162: #if TARGET_OS_MAC
        !           163: 
        !           164: #ifndef __TYPES__
        !           165: #include <Types.h>
        !           166: #endif
        !           167: #ifndef __FILES__
        !           168: #include <Files.h>
        !           169: #endif
        !           170: #ifndef __FSM__
        !           171: #include <FSM.h>
        !           172: #endif
        !           173: #ifndef __LOWMEM__
        !           174: #include <LowMem.h>
        !           175: #endif
        !           176: #ifndef __OSUTILS__
        !           177: #include <OSUtils.h>
        !           178: #endif
        !           179: #ifndef __PROCESSES__
        !           180: #include <Processes.h>
        !           181: #endif
        !           182: #ifndef __TEXTCOMMON__
        !           183: #include <TextCommon.h>
        !           184: #endif
        !           185: #ifndef __UNICODECONVERTER__
        !           186: #include <UnicodeConverter.h>
        !           187: #endif
        !           188: 
        !           189: #else
        !           190: 
        !           191: #ifndef __MACOSTYPES__
        !           192: #include "system/MacOSTypes.h"
        !           193: #endif
        !           194: #ifndef __MACOSSTUBS__
        !           195: #include "system/MacOSStubs.h"
        !           196: #endif
        !           197: #include <mach/machine/simple_lock.h>
        !           198: #endif         /* TARGET_OS_MAC */
        !           199: 
        !           200: #ifndef __HFSVOLUMES__
        !           201: #include "HFSVolumes.h"
        !           202: #endif
        !           203: 
        !           204: #if FORDISKFIRSTAID
        !           205: #else
        !           206: #define FORDISKFIRSTAID 0
        !           207: #endif
        !           208: 
        !           209: #if PRAGMA_ONCE
        !           210: #pragma once
        !           211: #endif
        !           212: 
        !           213: #ifdef __cplusplus
        !           214: extern "C" {
        !           215: #endif
        !           216: 
        !           217: #if PRAGMA_IMPORT
        !           218: #pragma import on
        !           219: #endif
        !           220: 
        !           221: #if PRAGMA_STRUCT_ALIGN
        !           222:        #pragma options align=mac68k
        !           223: #elif PRAGMA_STRUCT_PACKPUSH
        !           224:        #pragma pack(push, 2)
        !           225: #elif PRAGMA_STRUCT_PACK
        !           226:        #pragma pack(2)
        !           227: #endif
        !           228: 
        !           229: /* internal error codes*/
        !           230: 
        !           231: #if TARGET_OS_RHAPSODY
        !           232:   #define ERR_BASE     -32767
        !           233: #else
        !           234:   #define ERR_BASE     0
        !           235: #endif
        !           236: 
        !           237: enum {
        !           238:                                                                                                                                /* FXM errors*/
        !           239:        fxRangeErr                                      = ERR_BASE + 16,                                /* file position beyond mapped range*/
        !           240:        fxOvFlErr                                       = ERR_BASE + 17,                                /* extents file overflow*/
        !           241:                                                                                                                                /* Unicode errors*/
        !           242:        uniTooLongErr                           = ERR_BASE + 24,                                /* Unicode string too long to convert to Str31*/
        !           243:        uniBufferTooSmallErr            = ERR_BASE + 25,                                /* Unicode output buffer too small*/
        !           244:        uniNotMappableErr                       = ERR_BASE + 26,                                /* Unicode string can't be mapped to given script*/
        !           245:                                                                                                                                /* BTree Manager errors*/
        !           246:        btNotFound                                      = ERR_BASE + 32,                                /* record not found*/
        !           247:        btExists                                        = ERR_BASE + 33,                                /* record already exists*/
        !           248:        btNoSpaceAvail                          = ERR_BASE + 34,                                /* no available space*/
        !           249:        btNoFit                                         = ERR_BASE + 35,                                /* record doesn't fit in node */
        !           250:        btBadNode                                       = ERR_BASE + 36,                                /* bad node detected*/
        !           251:        btBadHdr                                        = ERR_BASE + 37,                                /* bad BTree header record detected*/
        !           252:        dsBadRotate                                     = ERR_BASE + 64,                                /* bad BTree rotate*/
        !           253:                                                                                                                                /* Catalog Manager errors*/
        !           254:        cmNotFound                                      = ERR_BASE + 48,                                /* CNode not found*/
        !           255:        cmExists                                        = ERR_BASE + 49,                                /* CNode already exists*/
        !           256:        cmNotEmpty                                      = ERR_BASE + 50,                                /* directory CNode not empty (valence = 0)*/
        !           257:        cmRootCN                                        = ERR_BASE + 51,                                /* invalid reference to root CNode*/
        !           258:        cmBadNews                                       = ERR_BASE + 52,                                /* detected bad catalog structure*/
        !           259:        cmFThdDirErr                            = ERR_BASE + 53,                                /* thread belongs to a directory not a file*/
        !           260:        cmFThdGone                                      = ERR_BASE + 54,                                /* file thread doesn't exist*/
        !           261:        cmParentNotFound                        = ERR_BASE + 55,                                /* CNode for parent ID does not exist*/
        !           262:                                                                                                                                /* TFS internal errors*/
        !           263:        fsDSIntErr                                      = -127                                                  /* Internal file system error*/
        !           264: };
        !           265: 
        !           266: 
        !           267: /* internal flags*/
        !           268: 
        !           269: 
        !           270: enum {
        !           271:                                                                                                                                /* File System busy flag:*/
        !           272:                                                                                                                                /* Bit zero of FSBusy (lomem $360) is true when the file system is running.*/
        !           273:                                                                                                                                /* The word at $360 is cleared when the file system is exited. The*/
        !           274:                                                                                                                                /* bits defined here are for additional flags in the FSBusy word that are*/
        !           275:                                                                                                                                /* valid only when the file system is running.*/
        !           276:        fsBusyBit                                       = 0,                                                    /* file system is running; other FSBusy bits are valid*/
        !           277:        fsSCSIDefer                                     = 1,                                                    /* file system is waiting for SCSI transaction to complete*/
        !           278:        fsIntMaskDefer                          = 2,                                                    /* file system is waiting until the interrupt mask is lowered*/
        !           279:                                                                                                                                /* Flag bits in HFSFlags byte:*/
        !           280:        hfsReq                                          = 0,                                                    /* Set if request is specific to HFS*/
        !           281:        dirCN                                           = 1,                                                    /* Set if a CNode is a directory*/
        !           282:        reportMissingParent                     = 4,                                                    /* tell Catalog to report missing parents (used by MakeFSSpec)*/
        !           283:        skipPMSP                                        = 5,                                                    /* Set to skip PMSP setup (one-shot)*/
        !           284:        noPMSP                                          = 6,                                                    /* Set to disable PMSP completely (status flag)*/
        !           285:        hfsContd                                        = 7,                                                    /* Set if Async trap is continued*/
        !           286:                                                                                                                                /* fsFlags values*/
        !           287:        fsNoAllocate                            = 0,
        !           288:        fsNoAllocateMask                        = 0x01,                                                 /* true when allocating memory is a very bad idea*/
        !           289:        fsNeedFCBs                                      = 1,
        !           290:        fsNeedFCBsMask                          = 0x02,                                                 /* true when a local FCB couldn't be found      */
        !           291:        fsNoFCBExpansion                        = 2,
        !           292:        fsNoFCBExpansionMask            = 0x04,                                                 /* true if no FCB expansion logic is desired*/
        !           293:                                                                                                                                /*      ExtendFile option flags*/
        !           294:                                                                                                                                /*      extendFileAllBit                        = 0,                            |* allocate all requested bytes or none *|*/
        !           295:                                                                                                                                /*      extendFileAllMask                       = 0x0001,*/
        !           296:                                                                                                                                /*      */
        !           297:                                                                                                                                /*      extendFileContigBit                     = 1,                            |* force contiguous allocation *|*/
        !           298:                                                                                                                                /*      extendFileContigMask            = 0x0002*/
        !           299:        kEFContigBit                            = 1,                                                    /*      force contiguous allocation*/
        !           300:        kEFContigMask                           = 0x02,
        !           301:        kEFAllBit                                       = 0,                                                    /*      allocate all requested bytes or none*/
        !           302:        kEFAllMask                                      = 0x01,                                                 /*      TruncateFile option flags*/
        !           303:        kTFTrunExtBit                           = 0,                                                    /*      truncate to the extent containing new PEOF*/
        !           304:        kTFTrunExtMask                          = 1
        !           305: };
        !           306: 
        !           307: 
        !           308: 
        !           309: enum {
        !           310:        HFSStkLen                                       = 1792,                                                 /* old stack size (pre HFS Plus)*/
        !           311:        kFileSystemStackSlop            = 16,                                                   /* additional temporary space*/
        !           312:        kFileSystemStackSize            = 16384,                                                /* give us more breathing room*/
        !           313:        kFileSystemVersion                      = FOUR_CHAR_CODE('2.0A'),               /* current file system version*/
        !           314:                                                                                                                                /*      31744 = $7C00, a nice round number close to*/
        !           315:                                                                                                                                /*      (32767*1000)/1024, which is about the largest */
        !           316:                                                                                                                                /*      free space unsuspecting, decimal-K minded apps*/
        !           317:                                                                                                                                /*      might be expected to handle.*/
        !           318:                                                                                                                                /*      AlBlkLim*/
        !           319:        kMaxHFSAllocationBlocks         = 31744,
        !           320:        WDRfnMin                                        = -32767,                                               /* lowest assigned WD RefNum*/
        !           321:        WDRfnMax                                        = -4096,                                                /* largest possible WDrefnum*/
        !           322:        kFirstFileRefnum                        = 2,                                                    /* smallest FCB refnum*/
        !           323:        kNoHint                                         = 0
        !           324: };
        !           325: 
        !           326: 
        !           327: /* Internal LowMem pointers*/
        !           328: 
        !           329: /*�� The following should really be in LowMemPriv.i*/
        !           330: 
        !           331: enum {
        !           332:        FSCallAsync                                     = 0x0342,                                               /*      ONE BYTE FREE*/
        !           333:        NoEject                                         = 0x034B,                                               /* used by Eject and Offline*/
        !           334:        CacheFlag                                       = 0x0377,
        !           335:        SysBMCPtr                                       = 0x0378,                                               /* System-wide bitmap cache pointer*/
        !           336:        SysCtlCPtr                                      = 0x0380,                                               /* System-wide control cache pointer*/
        !           337:        HFSDSErr                                        = 0x0392,                                               /* Final gasp - error that caused IOErr.*/
        !           338:        LMParamBlock                            = 0x03A4,                                               /* LMGetParams() just gives us a copy of it*/
        !           339:        FSVarsPtr                                       = 0x0BB8,                                               /* lomem that points to file system variable block*/
        !           340:        CacheVars                                       = 0x0394,
        !           341:        HFSStkPtr                                       = 0x036E,                                               /* Temporary location of HFS Stack pointer*/
        !           342:        FSIOErr                                         = 0x03DE,                                               /* last I/O error (NEXT WORD FREE)*/
        !           343:                                                                                                                                /* file manager vectors not found in LowMemPriv.i*/
        !           344:        JUpdAltMDB                                      = (0xED) * 4 + 0x0400,                  /* ($A0ED) $0400 is n/OSTable*/
        !           345:        JCkExtFS                                        = (0xEE) * 4 + 0x0400,                  /* ($A0EE) $0400 is n/OSTable*/
        !           346:        JBMChk                                          = (0xF0) * 4 + 0x0400,                  /* ($A0F0) $0400 is n/OSTable*/
        !           347:        JTstMod                                         = (0xF1) * 4 + 0x0400,                  /* ($A0F1) $0400 is n/OSTable*/
        !           348:        JLocCRec                                        = (0xF2) * 4 + 0x0400,                  /* ($A0F2) $0400 is n/OSTable*/
        !           349:        JTreeSearch                                     = (0xF3) * 4 + 0x0400,                  /* ($A0F3) $0400 is n/OSTable*/
        !           350:        JMapFBlock                                      = (0xF4) * 4 + 0x0400,                  /* ($A0F4) $0400 is n/OSTable*/
        !           351:        JXFSearch                                       = (0xF5) * 4 + 0x0400,                  /* ($A0F5) $0400 is n/OSTable*/
        !           352:        JReadBM                                         = (0xF6) * 4 + 0x0400                   /* ($A0F6) $0400 is n/OSTable*/
        !           353: };
        !           354: 
        !           355: 
        !           356: /* Poor Man's Search Path*/
        !           357: 
        !           358: struct SearchPathHeader {
        !           359:        Ptr                                                     PMSPHook;                                       /* Hook for PMSP modification*/
        !           360:        short                                                   PMSPIndx;                                       /* Index to PMSP index from start of PMSP*/
        !           361: };
        !           362: typedef struct SearchPathHeader SearchPathHeader;
        !           363: 
        !           364: struct SearchPathEntry {
        !           365:        short                                                   spVRefNum;                                      /* VRefNum in PMSP entry*/
        !           366:        UInt32                                                  spDirID;                                        /* Directory ID in PMSP entry*/
        !           367: };
        !           368: typedef struct SearchPathEntry SearchPathEntry;
        !           369: 
        !           370: 
        !           371: enum {
        !           372:        kPoorMansSearchIndex            = -2,
        !           373:        MaxDVCnt                                        = 8,                                                    /* Leave room for 8 default VRefNums*/
        !           374:        PMSPSize                                        = MaxDVCnt * sizeof(SearchPathEntry) + sizeof(SearchPathHeader) + 2
        !           375: };
        !           376: 
        !           377: 
        !           378: 
        !           379: enum {
        !           380:        fsWDCBExtendCount                       = 8,                                                    /* # of WDCB's to add when we run out*/
        !           381:                                                                                                                                /*      FileIDs variables*/
        !           382:        kNumExtentsToCache                      = 4                                                             /*      just guessing for ExchangeFiles*/
        !           383: };
        !           384: 
        !           385: 
        !           386: enum {
        !           387:        kInvalidMRUCacheKey                     = -1L,                                                  /* flag to denote current MRU cache key is invalid*/
        !           388:        kDefaultNumMRUCacheBlocks       = 16                                                    /* default number of blocks in each cache*/
        !           389: };
        !           390: 
        !           391: 
        !           392: /* Universal Extent Key */
        !           393: 
        !           394: union ExtentKey {
        !           395:        HFSExtentKey                                    hfs;
        !           396:        HFSPlusExtentKey                                hfsPlus;
        !           397: };
        !           398: typedef union ExtentKey                                        ExtentKey;
        !           399: /* Universal extent descriptor */
        !           400: 
        !           401: union ExtentDescriptor {
        !           402:        HFSExtentDescriptor                     hfs;
        !           403:        HFSPlusExtentDescriptor                 hfsPlus;
        !           404: };
        !           405: typedef union ExtentDescriptor                 ExtentDescriptor;
        !           406: /* Universal extent record */
        !           407: 
        !           408: union ExtentRecord {
        !           409:        HFSExtentRecord                                 hfs;
        !           410:        HFSPlusExtentRecord                     hfsPlus;
        !           411: };
        !           412: typedef union ExtentRecord                             ExtentRecord;
        !           413: /* Universal catalog key */
        !           414: 
        !           415: union CatalogKey {
        !           416:        HFSCatalogKey                                   hfs;
        !           417:        HFSPlusCatalogKey                               hfsPlus;
        !           418: };
        !           419: typedef union CatalogKey                               CatalogKey;
        !           420: /* Universal catalog data record */
        !           421: 
        !           422: union CatalogRecord {
        !           423:        SInt16                                                  recordType;
        !           424:        HFSCatalogFolder                                hfsFolder;
        !           425:        HFSCatalogFile                                  hfsFile;
        !           426:        HFSCatalogThread                                hfsThread;
        !           427:        HFSPlusCatalogFolder                    hfsPlusFolder;
        !           428:        HFSPlusCatalogFile                              hfsPlusFile;
        !           429:        HFSPlusCatalogThread                    hfsPlusThread;
        !           430: };
        !           431: typedef union CatalogRecord                            CatalogRecord;
        !           432: /*
        !           433:        Key for records in the attributes file.  Fields are compared in the order:
        !           434:                cnid, attributeName, startBlock
        !           435: */
        !           436: 
        !           437: struct AttributeKey {
        !           438:        UInt16                                                  keyLength;                                      /* must set kBTBigKeysMask and kBTVariableIndexKeysMask in BTree header's attributes */
        !           439:        UInt16                                                  pad;
        !           440:        HFSCatalogNodeID                                cnid;                                           /* file or folder ID */
        !           441:        UInt32                                                  startBlock;                                     /* block # relative to start of attribute */
        !           442:        HFSUniStr255                                    attributeName;                          /* variable length */
        !           443: };
        !           444: typedef struct AttributeKey                            AttributeKey;
        !           445: 
        !           446: enum {
        !           447:        kAttributeKeyMaximumLength      = sizeof(AttributeKey) - sizeof(UInt16),
        !           448:        kAttributeKeyMinimumLength      = kAttributeKeyMaximumLength - sizeof(HFSUniStr255) + sizeof(UInt16)
        !           449: };
        !           450: 
        !           451: 
        !           452: enum {
        !           453:        CMMaxCName                                      = kHFSMaxFileNameChars
        !           454: };
        !           455: 
        !           456: 
        !           457: /* Internal Data structures*/
        !           458: 
        !           459: struct ExtendedVCB {
        !           460:        QElemPtr                                                qLink;
        !           461:        SInt16                                                  qType;
        !           462:        SInt16                                                  vcbFlags;
        !           463:        UInt16                                                  vcbSigWord;
        !           464:        UInt32                                                  vcbCrDate;
        !           465:        UInt32                                                  vcbLsMod;
        !           466:        SInt16                                                  vcbAtrb;
        !           467:        UInt16                                                  vcbNmFls;
        !           468:        SInt16                                                  vcbVBMSt;
        !           469:        SInt16                                                  vcbAllocPtr;
        !           470:        UInt16                                                  vcbNmAlBlks;
        !           471:        SInt32                                                  vcbAlBlkSiz;
        !           472:        SInt32                                                  vcbClpSiz;
        !           473:        SInt16                                                  vcbAlBlSt;
        !           474:        SInt32                                                  vcbNxtCNID;
        !           475:        UInt16                                                  vcbFreeBks;
        !           476:     UInt8                                                      vcbVN[256];
        !           477:        SInt16                                                  vcbDrvNum;
        !           478:        SInt16                                                  vcbDRefNum;
        !           479:        SInt16                                                  vcbFSID;
        !           480:        SInt16                                                  vcbVRefNum;
        !           481:        Ptr                                                     vcbMAdr;
        !           482:        Ptr                                                     vcbBufAdr;
        !           483:        SInt16                                                  vcbMLen;
        !           484:        SInt16                                                  vcbDirIndex;
        !           485:        SInt16                                                  vcbDirBlk;
        !           486:        UInt32                                                  vcbVolBkUp;
        !           487:        UInt16                                                  vcbVSeqNum;
        !           488:        SInt32                                                  vcbWrCnt;
        !           489:        SInt32                                                  vcbXTClpSiz;
        !           490:        SInt32                                                  vcbCTClpSiz;
        !           491:        UInt16                                                  vcbNmRtDirs;
        !           492:        SInt32                                                  vcbFilCnt;
        !           493:        SInt32                                                  vcbDirCnt;
        !           494:        SInt32                                                  vcbFndrInfo[8];
        !           495:        UInt16                                                  vcbEmbedSigWord;                        /* embedded volume signature (formerly vcbVCSize)*/
        !           496:        HFSExtentDescriptor                     vcbEmbedExtent;                         /* embedded volume location and size (formerly vcbVBMCSiz and vcbCtlCSiz)*/
        !           497:        UInt16                                                  vcbXTAlBlks;
        !           498:        UInt16                                                  vcbCTAlBlks;
        !           499:        FileReference                                   extentsRefNum;
        !           500:        FileReference                                   catalogRefNum;
        !           501:        Ptr                                                     vcbCtlBuf;
        !           502:        SInt32                                                  vcbDirIDM;
        !           503:        SInt16                                                  vcbOffsM;
        !           504: 
        !           505:                                                                                                                                /*      Extended VCB information*/
        !           506:        UInt16                                                  reserved;                                       /* align to 4-byte boundry*/
        !           507:        UInt32                                                  hfsPlusIOPosOffset;                     /*      Disk block where HFS+ starts    */
        !           508: 
        !           509:        FileReference                                   allocationsRefNum;
        !           510:        FileReference                                   attributesRefNum;                       /*      volume's attributes file, if any*/
        !           511: 
        !           512:        UInt32                                                  allocationsClumpSize;           /*      clump size for allocations file (also in fcb)*/
        !           513:        UInt32                                                  attributesClumpSize;            /*      clump size for attributes file (also in fcb)*/
        !           514: 
        !           515:        UInt32                                                  blockSize;                                      /*      size of allocation blocks - vcbAlBlkSiz*/
        !           516:        UInt32                                                  totalBlocks;                            /*      number of allocation blocks in volume (includes this header and VBM) - vcbNmAlBlks*/
        !           517:        UInt32                                                  freeBlocks;                                     /*      number of unused allocation blocks - vcbFreeBks*/
        !           518:        UInt32                                                  nextAllocation;                         /*      start of next allocation search - vcbAllocPtr*/
        !           519: 
        !           520:        UInt32                                                  checkedDate;                            /*      date and time of last disk check        */
        !           521: 
        !           522:        UInt64                                                  encodingsBitmap;                        /* HFS Plus only*/
        !           523:        TextEncoding                                    volumeNameEncodingHint;         /* Text encoding used for volume name*/
        !           524: 
        !           525:        Ptr                                                     hintCachePtr;                           /* points to this volumes heuristicHint cache*/
        !           526: 
        !           527: #if TARGET_OS_RHAPSODY
        !           528:        simple_lock_data_t                              vcbSimpleLock;                          /* simple lock to allow concurrent access to vcb data */
        !           529: #endif
        !           530: };
        !           531: typedef struct ExtendedVCB ExtendedVCB;
        !           532: 
        !           533: struct FCB {
        !           534:        UInt32                                                  fcbFlNm;                                        /* FCB file number. Non-zero marks FCB used */
        !           535:        SignedByte                                              fcbFlags;                                       /* FCB flags */
        !           536:        SignedByte                                              fcbTypByt;                                      /* File type byte */
        !           537:        UInt16                                                  fcbSBlk;                                        /* File start block (in alloc size blks) */
        !           538:        UInt32                                                  fcbEOF;                                         /* Logical length or EOF in bytes */
        !           539:        UInt32                                                  fcbPLen;                                        /* Physical file length in bytes */
        !           540:        UInt32                                                  fcbCrPs;                                        /* Current position within file */
        !           541:        ExtendedVCB *                                   fcbVPtr;                                        /* Pointer to the corresponding ExtendedVCB */
        !           542:        Ptr                                                     fcbBfAdr;                                       /* File's buffer address */
        !           543:        unsigned short                                  fcbFlPos;                                       /* Directory block this file is in */
        !           544:        UInt32                                                  fcbClmpSize;                            /* Number of bytes per clump */
        !           545:        Ptr                                                     fcbBTCBPtr;                                     /* Pointer to B*-Tree control block for file */
        !           546:        HFSExtentRecord                                 fcbExtRec;                                      /* First 3 file extents */
        !           547: #if TARGET_OS_MAC
        !           548:        OSType                                                  fcbFType;                                       /* File's 4 Finder Type bytes */
        !           549:        UInt32                                                  fcbCatPos;                                      /* Catalog hint for use on Close */
        !           550:        UInt32                                                  fcbDirID;                                       /* Parent Directory ID */
        !           551:        Str31                                                   fcbCName;                                       /* CName of open file */
        !           552: #endif
        !           553: };
        !           554: typedef struct FCB FCB;
        !           555: 
        !           556: struct ExtendedFCB {
        !           557:        UInt32                                                  processID1;                                     /*      these two fields are the Process Manager PID that*/
        !           558:        UInt32                                                  processID2;                                     /*      opened the file (used to clean up at process death).*/
        !           559:        HFSPlusExtentRecord                     extents;                                        /*      extents for HFS+ volumes*/
        !           560: };
        !           561: typedef struct ExtendedFCB ExtendedFCB;
        !           562: 
        !           563: struct ParallelFCB {
        !           564:        UInt16                                                  count;                                          /*      number of ExtendedFCB's*/
        !           565:        UInt16                                                  unitSize;                                       /*      size of a single ExtendedFCB (should be sizeof(ExtendedFCB))*/
        !           566:        ExtendedFCB                                     extendedFCB[1];
        !           567: };
        !           568: typedef struct ParallelFCB ParallelFCB;
        !           569: 
        !           570: struct ExtendedWDCB {
        !           571:        UInt32                                                  processID1;
        !           572:        UInt32                                                  processID2;
        !           573: };
        !           574: typedef struct ExtendedWDCB ExtendedWDCB;
        !           575: 
        !           576: 
        !           577: struct ParallelWDCB {
        !           578:        UInt16                                                  count;                                          /*      number of ExtendedFCB's*/
        !           579:        UInt16                                                  unitSize;                                       /*      size of a single ExtendedFCB (should be sizeof(ExtendedFCB))*/
        !           580:        ExtendedWDCB                                    extendedWDCB[1];
        !           581: };
        !           582: typedef struct ParallelWDCB ParallelWDCB;
        !           583: 
        !           584: struct WDCBArray {
        !           585:        UInt16                                                  count;
        !           586:        WDCBRec                                                 wdcb[1];
        !           587: };
        !           588: typedef struct WDCBArray WDCBArray;
        !           589: 
        !           590: struct FCBArray {
        !           591:        UInt16                                                  length;                                         /*      first word is FCB part length*/
        !           592:        FCB                                                     fcb[1];                                         /*      fcb array*/
        !           593: };
        !           594: typedef struct FCBArray FCBArray;
        !           595: 
        !           596: /*     Volumes*/
        !           597: 
        !           598: 
        !           599: enum {
        !           600:        vcbMaxNam                                       = 27,                                                   /* volumes currently have a 27 byte max name length*/
        !           601:                                                                                                                                /* VCB flags*/
        !           602:        vcbManualEjectMask                      = 0x0001,                                               /* bit 0        manual-eject bit: set if volume is in a manual-eject drive*/
        !           603:        vcbFlushCriticalInfoMask        = 0x0002,                                               /* bit 1        critical info bit: set if critical MDB information needs to flush*/
        !           604:                                                                                                                                /*      IoParam->ioVAtrb*/
        !           605:        kDefaultVolumeMask                      = 0x0020,
        !           606:        kFilesOpenMask                          = 0x0040
        !           607: };
        !           608: 
        !           609: 
        !           610: /* Catalog Node Data - universal data returned from the Catalog Manager*/
        !           611: 
        !           612: 
        !           613: enum {
        !           614:        kCatalogFolderNode                      = FOUR_CHAR_CODE('fold'),
        !           615:        kCatalogFileNode                        = FOUR_CHAR_CODE('file'),               /* mask bits for afp's three inhibit bits which live in fdXFlags in xFndrInfo*/
        !           616:        xFFFilAttrLockMask                      = 0x70
        !           617: };
        !           618: 
        !           619: /*     valence is overloaded for files and used as additional flags. 2201501*/
        !           620: 
        !           621: enum {
        !           622:        kLargeDataForkMask                      = 0x00000001,
        !           623:        kLargeRsrcForkMask                      = 0x00000002
        !           624: };
        !           625: 
        !           626: struct CatalogNodeData {
        !           627:        OSType                                                  nodeType;                                       /* 'file' or 'fold' */
        !           628:        UInt32                                                  nodeFlags;                                      /* node flags */
        !           629:        HFSCatalogNodeID                                nodeID;                                         /* node ID */
        !           630:        UInt32                                                  createDate;                                     /* date and time of creation */
        !           631:        UInt32                                                  contentModDate;                         /* date and time of last fork modification */
        !           632:        UInt32                                                  backupDate;                                     /* date and time of last backup */
        !           633:        UInt8                                                   finderInfo[16];                         /* Finder information part 1 */
        !           634:        UInt8                                                   extFinderInfo[16];                      /* Finder information part 2 */
        !           635: 
        !           636:        UInt32                                                  valence;                                        /* valence for folders, overloaded for files for additional flags (larger than 2 Gig flag) */
        !           637:        UInt32                                                  textEncoding;                           /* hint for name conversions */
        !           638: 
        !           639:        UInt32                                                  dataLogicalSize;                        /* files only */
        !           640:        UInt32                                                  dataPhysicalSize;                       /* files only */
        !           641:        UInt32                                                  rsrcLogicalSize;                        /* files only */
        !           642:        UInt32                                                  rsrcPhysicalSize;                       /* files only */
        !           643: 
        !           644:        HFSPlusExtentRecord                     dataExtents;                            /* files only */
        !           645:        HFSPlusExtentRecord                     rsrcExtents;                            /* files only */
        !           646: #if TARGET_OS_RHAPSODY
        !           647:     UInt32                                                     accessDate;                                     /* date and time of last access (Rhapsody only) */
        !           648:     UInt32                                                     attributeModDate;                               /* date and time of last attribute modification (Rhapsody only) */
        !           649:     HFSPlusPermissions                                 permissions;                            /* permissions (for Rhapsody) */
        !           650: #endif
        !           651: 
        !           652: };
        !           653: typedef struct CatalogNodeData CatalogNodeData;
        !           654: 
        !           655: /* Universal catalog name*/
        !           656: 
        !           657: union CatalogName {
        !           658:        Str31                                                   pstr;
        !           659:        HFSUniStr255                                    ustr;
        !           660: };
        !           661: typedef union CatalogName CatalogName;
        !           662: 
        !           663: /* Unicode Conversion*/
        !           664: 
        !           665: 
        !           666: enum {
        !           667:        kMacBaseEncodingCount           = 50,
        !           668:        kTextEncodingUndefined          = 0x00007FFF
        !           669: };
        !           670: 
        !           671: struct ConversionContext {
        !           672:        TextToUnicodeInfo                               toUnicode;
        !           673:        UnicodeToTextInfo                               fromUnicode;
        !           674: };
        !           675: typedef struct ConversionContext ConversionContext;
        !           676: 
        !           677: struct CallProfile {
        !           678:        UInt16                                                  refCount;
        !           679:        UInt16                                                  errCount;
        !           680:        UInt32                                                  callCount;
        !           681:        UInt32                                                  minTime;
        !           682:        UInt32                                                  maxTime;
        !           683:        UInt64                                                  totalTime;
        !           684:        UInt64                                                  startBase;                                      /* in nanoseconds*/
        !           685: };
        !           686: typedef struct CallProfile CallProfile;
        !           687: 
        !           688: 
        !           689: struct FSVarsRec {
        !           690: #if TARGET_OS_MAC
        !           691:        short                                                   length;
        !           692:        void *                                                  gBlockCacheGlobals;
        !           693:        long                                                    XFS;
        !           694:        long                                                    BTMgr;
        !           695:        long                                                    DTDBMgr;
        !           696:        long                                                    FSMgr;
        !           697:        long                                                    QMgr;
        !           698:        ParallelFCB *                                   fcbPBuf;                                        /*      Parallel FCB array*/
        !           699:        long                                                    wdcbPBuf;
        !           700:        short                                                   reserved1;
        !           701:        DeferredTask                                    fsDefer;                                        /* <in OSUtils.h>*/
        !           702:        long                                                    dtOwnCall;
        !           703:        long                                                    FSMHook;
        !           704:        short                                                   fsSelector;
        !           705:        Byte                                                    fsFlags;
        !           706:        Boolean                                                 gBlockCacheDirty;
        !           707:        ExtendedVCB *                                   dsRecoverVCBPtr;                        /* pointer to VCB of volume we're doing a disk switch for*/
        !           708:        unsigned char *                                 dsRecoverNamePtr;                       /* points to name of volume we're doing a disk switch for*/
        !           709:        UInt16                                                  fsFCBBurst;                                     /* # of FCBs that we'd like to keep free*/
        !           710:        UInt16                                                  fsFCBGrow;                                      /* # of FCBs to make free when we grow the array*/
        !           711:        UInt16                                                  fsFCBMax;                                       /* max # of FCBs to allow*/
        !           712:        UInt16                                                  fsFCBCounter;                           /* counts down as files are opened*/
        !           713:        UInt32                                                  later[4];                                       /* and a few more for later*/
        !           714: 
        !           715:        void *                                                  userStackPtr;                           /* user's A7 stack pointer*/
        !           716:        FSSpec                                                  gCatalogFSSpec;                         /* space to hold catalog manager's FSSpec output (70 bytes)*/
        !           717:        Boolean                                                 gUseDynamicUnicodeConverters;
        !           718:        Boolean                                                 gIsUnicodeInstalled;
        !           719:        CatalogNodeData                                 gCatalogData;                           /* space to hold catalog manager's universal node data (212 bytes)*/
        !           720: 
        !           721:        UInt32                                                  gDefaultBaseEncoding;
        !           722:        ItemCount                                               gInstalledEncodings;
        !           723:        ConversionContext                               gConversionContext[50];
        !           724:        UniversalProcPtr                                uppCreateTextToUnicodeInfo;
        !           725:        UniversalProcPtr                                uppCreateUnicodeToTextInfo;
        !           726:        UniversalProcPtr                                uppConvertFromTextToUnicode;
        !           727:        UniversalProcPtr                                uppConvertFromUnicodeToText;
        !           728:        UniversalProcPtr                                uppUpgradeScriptInfoToTextEncoding;
        !           729:        UniversalProcPtr                                uppRevertTextEncodingToScriptInfo;
        !           730:        UniversalProcPtr                                uppLockMappingTable;
        !           731: 
        !           732:        UInt32                                                  gNativeCPUtype;                         /* what processor are we running on*/
        !           733:        UInt32                                                  gTimeBaseFactor;                        /* adjustment for �sec*/
        !           734:        CallProfile                                     gCallProfile[32];                       /* call profiles for unicode and b-tree calls*/
        !           735: 
        !           736:        Ptr                                                     gAttributesBuffer;                      /* used by attributes code to read/construct keys and/or data*/
        !           737:        UInt32                                                  gAttributesBufferSize;          /* size of block pointed to by gAttributesBuffer*/
        !           738:        SInt32                                                  offsetToUTC;                            /* added to local time to produce UTC (GMT)*/
        !           739:        Ptr                                                     gBootPToUTable;                         /* used by boot code to find Extensions folder*/
        !           740:        UniversalProcPtr                                oldWriteXPRam;                          /* previous WriteXPRam trap address*/
        !           741:        Ptr                                                     gCatalogCacheGlobals;           /* private catalog cache (for iterators)*/
        !           742:        CatalogKey                                              gLastCatalogKey;                        /* keep a copy for UpdateCatalogNode*/
        !           743:        CatalogRecord                                   gLastCatalogRecord;                     /* keep a copy for UpdateCatalogNode*/
        !           744:        StringPtr                                               gTextEncodingFontName;          /* points to font name (only used when no HFS Plus volumes have been mounted)*/
        !           745: #else
        !           746:        UInt32                                                  gDefaultBaseEncoding;
        !           747:        ItemCount                                               gInstalledEncodings;
        !           748:        ConversionContext                               gConversionContext[50];
        !           749:        Ptr                                                     gBootPToUTable;                         /* used by boot code to find Extensions folder*/
        !           750:        StringPtr                                               gTextEncodingFontName;          /* points to font name (only used when no HFS Plus volumes have been mounted)*/
        !           751:        Boolean                                                 gUseDynamicUnicodeConverters;
        !           752:        Boolean                                                 gIsUnicodeInstalled;
        !           753: #endif /* TARGET_OS_MAC */
        !           754: };
        !           755: typedef struct FSVarsRec FSVarsRec;
        !           756: 
        !           757: 
        !           758: #if TARGET_OS_MAC
        !           759: #define PANIC(reason) panic("\p" reason)
        !           760: #else
        !           761: #define PANIC(reason) panic(reason)
        !           762: #endif /* TARGET_OS_MAC */
        !           763: 
        !           764: EXTERN_API_C( void )
        !           765: LMSetCacheFlag                                 (Byte                                   value);
        !           766: 
        !           767: /* cache usage count now used as cache flag*/
        !           768: #define        LMSetCacheFlag( value )                         (*(Ptr) 0x0377 = ( value ))
        !           769: 
        !           770: /* Internal macros*/
        !           771: /* Disk First Aid constants*/
        !           772: 
        !           773: enum {
        !           774:        kHFSStage                                       = 0,
        !           775:        kVerifyStage                            = 1,
        !           776:        kRepairStage                            = 2
        !           777: };
        !           778: 
        !           779: #if FORDISKFIRSTAID
        !           780:        EXTERN_API_C( FSVarsRec *)
        !           781:        LMGetFSVars                                                     (void);
        !           782:        
        !           783:        #define         LMGetFSVars()                   LMGetFSMVars()
        !           784:        EXTERN_API_C( Ptr )
        !           785:        LMGetFCBTable                                           (void);
        !           786:        
        !           787:        #define         LMGetFCBTable()                 LMGetFCBSPtr()
        !           788:        EXTERN_API_C( UInt32 )
        !           789:        GetDFAStage                                                     (void);
        !           790: #else
        !           791:        #if TARGET_OS_MAC
        !           792:                EXTERN_API_C( FSVarsRec *)
        !           793:                LMGetFSVars                                             (void);
        !           794:                
        !           795:                #define         LMGetFSVars()           (*(FSVarsRec**) 0x0BB8)
        !           796:                EXTERN_API_C( Ptr )
        !           797:                LMGetFCBTable                                   (void);
        !           798:                
        !           799:                #define         LMGetFCBTable()         (*(Ptr*) 0x034E)
        !           800:                EXTERN_API_C( UInt32 )
        !           801:                GetDFAStage                                             (void);
        !           802:        #endif  /* TARGET_OS_MAC */
        !           803:        
        !           804:        #define         GetDFAStage()                   (UInt32) kHFSStage
        !           805: #endif  /* (FORDISKFIRSTAID) */
        !           806: 
        !           807: 
        !           808: EXTERN_API_C( FileReference )
        !           809: GetFileRefNumFromFCB                   (const FCB *                                    fcb);
        !           810: 
        !           811: #if ! TARGET_OS_RHAPSODY
        !           812: #define        GetFileRefNumFromFCB(fcb)                       ((short) ( ((UInt32) (fcb)) - ((UInt32) LMGetFCBTable() ) ))
        !           813: #endif
        !           814: 
        !           815: EXTERN_API_C( FCB *)
        !           816: GetFileControlBlock                            (FileReference                                  refNum);
        !           817: 
        !           818: #if ! TARGET_OS_RHAPSODY
        !           819: #define        GetFileControlBlock(refNum)             ((FCB*) ( (Ptr)LMGetFCBTable() + refNum ) )
        !           820: #endif
        !           821: 
        !           822: EXTERN_API_C( Boolean )
        !           823: BlockCameFromDisk                              (void);
        !           824: 
        !           825: #if !(FORDISKFIRSTAID || TARGET_OS_RHAPSODY)
        !           826: #define        BlockCameFromDisk()                                     ( *(*(UInt16 **)CacheVars + 29) == 0)
        !           827: #endif
        !           828: 
        !           829: /*     The following macro marks a VCB as dirty by setting the upper 8 bits of the flags*/
        !           830: EXTERN_API_C( void )
        !           831: MarkVCBDirty                                   (ExtendedVCB *                  vcb);
        !           832: 
        !           833: EXTERN_API_C( void )
        !           834: MarkVCBClean                                   (ExtendedVCB *                  vcb);
        !           835: 
        !           836: EXTERN_API_C( Boolean )
        !           837: IsVCBDirty                                             (ExtendedVCB *                  vcb);
        !           838: 
        !           839: #if TARGET_OS_RHAPSODY
        !           840:        #define VCB_LOCK_INIT(vcb)              simple_lock_init(&vcb->vcbSimpleLock)
        !           841:        #define VCB_LOCK(vcb)                   simple_lock(&vcb->vcbSimpleLock)
        !           842:        #define VCB_UNLOCK(vcb)                 simple_unlock(&vcb->vcbSimpleLock)
        !           843: 
        !           844:        #define MarkVCBDirty(vcb)               { VCB_LOCK((vcb)); ((vcb)->vcbFlags |= 0xFF00); VCB_UNLOCK((vcb)); }
        !           845:        #define MarkVCBClean(vcb)               { VCB_LOCK((vcb)); ((vcb)->vcbFlags &= 0x00FF); VCB_UNLOCK((vcb)); }
        !           846:        #define IsVCBDirty(vcb)                 ((Boolean) ((vcb->vcbFlags & 0xFF00) != 0))
        !           847: #else
        !           848:        #define VCB_LOCK_INIT(vcb)      
        !           849:        #define VCB_LOCK(vcb)           
        !           850:        #define VCB_UNLOCK(vcb)         
        !           851: 
        !           852:        #define MarkVCBDirty(vcb)               ((vcb)->vcbFlags |= 0xFF00)
        !           853:        #define MarkVCBClean(vcb)               ((vcb)->vcbFlags &= 0x00FF)
        !           854:        #define IsVCBDirty(vcb)                 ((Boolean) ((vcb->vcbFlags & 0xFF00) != 0))
        !           855: #endif
        !           856: 
        !           857: 
        !           858: /*     Test for error and return if error occurred*/
        !           859: EXTERN_API_C( void )
        !           860: ReturnIfError                                  (OSErr                                  result);
        !           861: 
        !           862: #define        ReturnIfError(result)                                   if ( (result) != noErr ) return (result); else ;
        !           863: /*     Test for passed condition and return if true*/
        !           864: EXTERN_API_C( void )
        !           865: ReturnErrorIf                                  (Boolean                                condition,
        !           866:                                                                 OSErr                                  result);
        !           867: 
        !           868: #define        ReturnErrorIf(condition, error)                 if ( (condition) )      return( (error) );
        !           869: /*     Exit function on error*/
        !           870: EXTERN_API_C( void )
        !           871: ExitOnError                                            (OSErr                                  result);
        !           872: 
        !           873: #define        ExitOnError( result )                                   if ( ( result ) != noErr )      goto ErrorExit; else ;
        !           874: /*     Return the low 16 bits of a 32 bit value, pinned if too large*/
        !           875: EXTERN_API_C( UInt16 )
        !           876: LongToShort                                            (UInt32                                 l);
        !           877: 
        !           878: #define        LongToShort( l )        l <= (UInt32)0x0000FFFF ? ((UInt16) l) : ((UInt16) 0xFFFF)
        !           879: 
        !           880: 
        !           881: /* Catalog Manager Routines (IPI)*/
        !           882: 
        !           883: EXTERN_API_C( OSErr )
        !           884: CreateCatalogNode                              (ExtendedVCB *                  volume,
        !           885:                                                                 HFSCatalogNodeID               parentID,
        !           886:                                                                 ConstUTF8Param                 name,
        !           887:                                                                 UInt32                                 nodeType,
        !           888:                                                                 HFSCatalogNodeID *             catalogNodeID,
        !           889:                                                                 UInt32 *                               catalogHint);
        !           890: 
        !           891: EXTERN_API_C( OSErr )
        !           892: DeleteCatalogNode                              (ExtendedVCB *                  volume,
        !           893:                                                                 HFSCatalogNodeID               parentID,
        !           894:                                                                 ConstUTF8Param                 name,
        !           895:                                                                 UInt32                                 hint);
        !           896: 
        !           897: EXTERN_API_C( OSErr )
        !           898: GetCatalogNode                                 (ExtendedVCB *                  volume,
        !           899:                                                                 HFSCatalogNodeID               parentID,
        !           900:                                                                 ConstUTF8Param                 name,
        !           901:                                                                 UInt32                                 hint,
        !           902:                                                                 FSSpec *                               nodeSpec,
        !           903:                                                                 CatalogNodeData *              nodeData,
        !           904:                                                                 UInt32 *                               newHint);
        !           905: 
        !           906: EXTERN_API_C( OSErr )
        !           907: GetCatalogOffspring                            (ExtendedVCB *                  volume,
        !           908:                                                                 HFSCatalogNodeID               folderID,
        !           909:                                                                 UInt16                                 index,
        !           910:                                                                 FSSpec *                               spec,
        !           911:                                                                 CatalogNodeData *              nodeData,
        !           912:                                                                 UInt32 *                               hint);
        !           913: 
        !           914: EXTERN_API_C( OSErr )
        !           915: MoveRenameCatalogNode                  (ExtendedVCB *                  volume,
        !           916:                                                                 HFSCatalogNodeID               srcParentID,
        !           917:                                                                 ConstUTF8Param                 srcName,
        !           918:                                                                 UInt32                                 srcHint,
        !           919:                                                                 HFSCatalogNodeID               dstParentID,
        !           920:                                                                 ConstUTF8Param                 dstName,
        !           921:                                                                 UInt32 *                               newHint);
        !           922: 
        !           923: #if TARGET_OS_MAC
        !           924: EXTERN_API_C( OSErr )
        !           925: UpdateCatalogNode                              (ExtendedVCB *                  volume,
        !           926:                                                                 const CatalogNodeData * nodeData,
        !           927:                                                                 UInt32                                 catalogHint);
        !           928: #else
        !           929: EXTERN_API_C( OSErr )
        !           930: UpdateCatalogNode                              (ExtendedVCB *                  volume,
        !           931:                                                                 HFSCatalogNodeID               parentID,
        !           932:                                                                 ConstUTF8Param                 name,
        !           933:                                                                 UInt32                                 catalogHint, 
        !           934:                                                                 const CatalogNodeData * nodeData);
        !           935: #endif
        !           936: 
        !           937: EXTERN_API_C( OSErr )
        !           938: CreateFileIDRef                                        (ExtendedVCB *                  volume,
        !           939:                                                                 HFSCatalogNodeID               parentID,
        !           940:                                                                 ConstUTF8Param                 name,
        !           941:                                                                 UInt32                                 hint,
        !           942:                                                                 HFSCatalogNodeID *             threadID);
        !           943: 
        !           944: EXTERN_API_C( OSErr )
        !           945: ExchangeFileIDs                                        (ExtendedVCB *                  volume,
        !           946:                                                                 ConstUTF8Param                 srcName,
        !           947:                                                                 ConstUTF8Param                 destName,
        !           948:                                                                 HFSCatalogNodeID               srcID,
        !           949:                                                                 HFSCatalogNodeID               destID,
        !           950:                                                                 UInt32                                 srcHint,
        !           951:                                                                 UInt32                                 destHint );
        !           952: 
        !           953: EXTERN_API_C( OSErr )
        !           954: LinkCatalogNode                                        (ExtendedVCB *                  volume,
        !           955:                                                                 HFSCatalogNodeID               parentID,
        !           956:                                                                 ConstUTF8Param                 name,
        !           957:                                                                 HFSCatalogNodeID               linkParentID,
        !           958:                                                                 ConstUTF8Param                 linkName);
        !           959: 
        !           960: EXTERN_API_C( SInt32 )
        !           961: CompareCatalogKeys                             (HFSCatalogKey *                searchKey,
        !           962:                                                                 HFSCatalogKey *                trialKey);
        !           963: 
        !           964: EXTERN_API_C( SInt32 )
        !           965: CompareExtendedCatalogKeys             (HFSPlusCatalogKey *    searchKey,
        !           966:                                                                 HFSPlusCatalogKey *    trialKey);
        !           967: 
        !           968: EXTERN_API_C( OSErr )
        !           969: InitCatalogCache                               (void);
        !           970: 
        !           971: EXTERN_API_C( void )
        !           972: InvalidateCatalogCache                 (ExtendedVCB *                  volume);
        !           973: 
        !           974: 
        !           975: /* GenericMRUCache Routines*/
        !           976: EXTERN_API_C( OSErr )
        !           977: InitMRUCache                                   (UInt32                                 bufferSize,
        !           978:                                                                 UInt32                                 numCacheBlocks,
        !           979:                                                                 Ptr *                                  cachePtr);
        !           980: 
        !           981: EXTERN_API_C( OSErr )
        !           982: DisposeMRUCache                                        (Ptr                                    cachePtr);
        !           983: 
        !           984: EXTERN_API_C( void )
        !           985: TrashMRUCache                                  (Ptr                                    cachePtr);
        !           986: 
        !           987: EXTERN_API_C( OSErr )
        !           988: GetMRUCacheBlock                               (UInt32                                 key,
        !           989:                                                                 Ptr                                    cachePtr,
        !           990:                                                                 Ptr *                                  buffer);
        !           991: 
        !           992: EXTERN_API_C( void )
        !           993: InvalidateMRUCacheBlock                        (Ptr                                    cachePtr,
        !           994:                                                                 Ptr                                    buffer);
        !           995: 
        !           996: EXTERN_API_C( void )
        !           997: InsertMRUCacheBlock                            (Ptr                                    cachePtr,
        !           998:                                                                 UInt32                                 key,
        !           999:                                                                 Ptr                                    buffer);
        !          1000: 
        !          1001: /* MountCheck Routines*/
        !          1002: EXTERN_API_C( OSErr )
        !          1003: MountCheck                                             (ExtendedVCB *                  vcb,
        !          1004:                                                                 UInt32 *                               consistencyStatus);
        !          1005: 
        !          1006: /* BTree Manager Routines*/
        !          1007: 
        !          1008: typedef CALLBACK_API_C( SInt32 , KeyCompareProcPtr )(void *a, void *b);
        !          1009: 
        !          1010: #if TARGET_OS_MAC
        !          1011: EXTERN_API_C( OSErr )
        !          1012: OpenBTree                                              (FileReference                          refNum,
        !          1013:                                                                 KeyCompareProcPtr              keyCompareProc);
        !          1014: #endif
        !          1015: 
        !          1016: #if TARGET_OS_MAC
        !          1017: EXTERN_API_C( OSErr )
        !          1018: CloseBTree                                             (FileReference                          refNum);
        !          1019: #endif
        !          1020: 
        !          1021: #if TARGET_OS_MAC
        !          1022: EXTERN_API_C( OSErr )
        !          1023: FlushBTree                                             (FileReference                          refNum);
        !          1024: #endif
        !          1025: 
        !          1026: EXTERN_API_C( OSErr )
        !          1027: SearchBTreeRecord                              (FileReference                          refNum,
        !          1028:                                                                 const void *                   key,
        !          1029:                                                                 UInt32                                 hint,
        !          1030:                                                                 void *                                 foundKey,
        !          1031:                                                                 void *                                 data,
        !          1032:                                                                 UInt16 *                               dataSize,
        !          1033:                                                                 UInt32 *                               newHint);
        !          1034: #if TARGET_OS_MAC
        !          1035: EXTERN_API_C( OSErr )
        !          1036: GetBTreeRecord                                 (FileReference                          refNum,
        !          1037:                                                                 SInt16                                 selectionIndex,
        !          1038:                                                                 void *                                 key,
        !          1039:                                                                 void *                                 data,
        !          1040:                                                                 UInt16 *                               dataSize,
        !          1041:                                                                 UInt32 *                               newHint);
        !          1042: #endif
        !          1043: 
        !          1044: EXTERN_API_C( OSErr )
        !          1045: InsertBTreeRecord                              (FileReference                          refNum,
        !          1046:                                                                 void *                                 key,
        !          1047:                                                                 void *                                 data,
        !          1048:                                                                 UInt16                                 dataSize,
        !          1049:                                                                 UInt32 *                               newHint);
        !          1050: 
        !          1051: EXTERN_API_C( OSErr )
        !          1052: DeleteBTreeRecord                              (FileReference                          refNum,
        !          1053:                                                                 void *                                 key);
        !          1054: 
        !          1055: EXTERN_API_C( OSErr )
        !          1056: ReplaceBTreeRecord                             (FileReference                          refNum,
        !          1057:                                                                 const void *                   key,
        !          1058:                                                                 UInt32                                 hint,
        !          1059:                                                                 void *                                 newData,
        !          1060:                                                                 UInt16                                 dataSize,
        !          1061:                                                                 UInt32 *                               newHint);
        !          1062: 
        !          1063: /*     From HFSVolumesInit.c*/
        !          1064: EXTERN_API_C( void )
        !          1065: InitBTreeHeader                                        (UInt32                                 fileSize,
        !          1066:                                                                 UInt32                                 clumpSize,
        !          1067:                                                                 UInt16                                 nodeSize,
        !          1068:                                                                 UInt16                                 recordCount,
        !          1069:                                                                 UInt16                                 keySize,
        !          1070:                                                                 UInt32                                 attributes,
        !          1071:                                                                 UInt32 *                               mapNodes,
        !          1072:                                                                 void *                                 buffer);
        !          1073: 
        !          1074: /*     Prototypes for big block cache*/
        !          1075: 
        !          1076: EXTERN_API_C( OSErr )
        !          1077: InitializeBlockCache                   (UInt32                                 blockSize,
        !          1078:                                                                 UInt32                                 blockCount);
        !          1079: 
        !          1080: EXTERN_API_C( OSErr )
        !          1081: FlushBlockCache                                        (void);
        !          1082: 
        !          1083: EXTERN_API_C( OSErr )
        !          1084: GetCacheBlock                                  (FileReference                          fileRefNum,
        !          1085:                                                                 UInt32                                 blockNumber,
        !          1086:                                                                 UInt32                                 blockSize,
        !          1087:                                                                 UInt16                                 options,
        !          1088:                                                                 LogicalAddress *               buffer,
        !          1089:                                                                 Boolean *                              readFromDisk);
        !          1090: 
        !          1091: EXTERN_API_C( OSErr )
        !          1092: ReleaseCacheBlock                              (LogicalAddress                 buffer,
        !          1093:                                                                 UInt16                                 options);
        !          1094: 
        !          1095: EXTERN_API_C( OSErr )
        !          1096: MarkCacheBlock                                 (LogicalAddress                 buffer);
        !          1097: 
        !          1098: EXTERN_API_C( OSErr )
        !          1099: TrashCacheBlocks                               (FileReference                          fileRefNum);
        !          1100: 
        !          1101: /*     Prototypes for C->Asm glue*/
        !          1102: EXTERN_API_C( OSErr )
        !          1103: GetBlock_glue                                  (UInt16                                 flags,
        !          1104:                                                                 UInt32                                 nodeNumber,
        !          1105:                                                                 Ptr *                                  nodeBuffer,
        !          1106:                                                                 FileReference                          refNum,
        !          1107:                                                                 ExtendedVCB *                  vcb);
        !          1108: 
        !          1109: EXTERN_API_C( OSErr )
        !          1110: RelBlock_glue                                  (Ptr                                    nodeBuffer,
        !          1111:                                                                 UInt16                                 flags);
        !          1112: 
        !          1113: EXTERN_API_C( void )
        !          1114: MarkBlock_glue                                 (Ptr                                    nodeBuffer);
        !          1115: 
        !          1116: EXTERN_API_C( OSErr )
        !          1117: C_FlushCache                                   (ExtendedVCB *                  vcb,
        !          1118:                                                                 UInt32                                 flags,
        !          1119:                                                                 FileReference                          refNum);
        !          1120: 
        !          1121: EXTERN_API_C( OSErr )
        !          1122: CacheReadInPlace                               (ExtendedVCB *                  volume,
        !          1123:                                                                 HIOParam *                             iopb,
        !          1124:                                                                 UInt32                                 currentPosition,
        !          1125:                                                                 UInt32                                 maximumBytes,
        !          1126:                                                                 UInt32 *                               actualBytes);
        !          1127: 
        !          1128: EXTERN_API_C( void )   TrashVolumeDiskCache(ExtendedVCB * vcb);
        !          1129: 
        !          1130: /*     Prototypes for exported routines in VolumeAllocation.c*/
        !          1131: EXTERN_API_C( OSErr )
        !          1132: BlockAllocate                                  (ExtendedVCB *                  vcb,
        !          1133:                                                                 UInt32                                 startingBlock,
        !          1134:                                                                 UInt32                                 bytesRequested,
        !          1135:                                                                 UInt32                                 bytesMaximum,
        !          1136:                                                                 Boolean                                forceContiguous,
        !          1137:                                                                 UInt32 *                               startBlock,
        !          1138:                                                                 UInt32 *                               actualBlocks);
        !          1139: 
        !          1140: EXTERN_API_C( OSErr )
        !          1141: BlockDeallocate                                        (ExtendedVCB *                  vcb,
        !          1142:                                                                 UInt32                                 firstBlock,
        !          1143:                                                                 UInt32                                 numBlocks);
        !          1144: 
        !          1145: EXTERN_API_C( SInt32 )
        !          1146: BlockCheck                                             (ExtendedVCB *                  vcb,
        !          1147:                                                                 HFSPlusExtentRecord    extents);
        !          1148: 
        !          1149: EXTERN_API_C( OSErr )
        !          1150: UpdateFreeCount                                        (ExtendedVCB *                  vcb);
        !          1151: 
        !          1152: 
        !          1153: EXTERN_API_C( OSErr )
        !          1154: AllocateFreeSpace                              (ExtendedVCB *                  vcb,
        !          1155:                                                                 UInt32 *                               startBlock,
        !          1156:                                                                 UInt32 *                               actualBlocks);
        !          1157: 
        !          1158: EXTERN_API_C( UInt32 )
        !          1159: DivideAndRoundUp                               (UInt32                                 numerator,
        !          1160:                                                                 UInt32                                 denominator);
        !          1161: 
        !          1162: EXTERN_API_C( OSErr )
        !          1163: BlockAllocateAny                               (ExtendedVCB *                  vcb,
        !          1164:                                                                 UInt32                                 startingBlock,
        !          1165:                                                                 UInt32                                 endingBlock,
        !          1166:                                                                 UInt32                                 maxBlocks,
        !          1167:                                                                 UInt32 *                               actualStartBlock,
        !          1168:                                                                 UInt32 *                               actualNumBlocks);
        !          1169: 
        !          1170: EXTERN_API_C( void )
        !          1171: UpdateVCBFreeBlks                              (ExtendedVCB *                  vcb);
        !          1172: 
        !          1173: /*     File Extent Mapping routines*/
        !          1174: EXTERN_API_C( OSErr )
        !          1175: FlushExtentFile                                        (ExtendedVCB *                  vcb);
        !          1176: 
        !          1177: EXTERN_API_C( SInt32 )
        !          1178: CompareExtentKeys                              (const HFSExtentKey *   searchKey,
        !          1179:                                                                 const HFSExtentKey *   trialKey);
        !          1180: 
        !          1181: EXTERN_API_C( SInt32 )
        !          1182: CompareExtentKeysPlus                  (const HFSPlusExtentKey *searchKey,
        !          1183:                                                                 const HFSPlusExtentKey *trialKey);
        !          1184: 
        !          1185: EXTERN_API_C( OSErr )
        !          1186: DeleteFile                                             (ExtendedVCB *                  vcb,
        !          1187:                                                                 HFSCatalogNodeID               parDirID,
        !          1188:                                                                 ConstUTF8Param                 catalogName,
        !          1189:                                                                 UInt32                                 catalogHint);
        !          1190: 
        !          1191: EXTERN_API_C( OSErr )
        !          1192: TruncateFileC                                  (ExtendedVCB *                  vcb,
        !          1193:                                                                 FCB *                                  fcb,
        !          1194:                                                                 UInt32                                 peof,
        !          1195:                                                                 Boolean                                truncateToExtent);
        !          1196: 
        !          1197: EXTERN_API_C( OSErr )
        !          1198: ExtendFileC                                            (ExtendedVCB *                  vcb,
        !          1199:                                                                 FCB *                                  fcb,
        !          1200:                                                                 UInt32                                 bytesToAdd,
        !          1201:                                                                 UInt32                                 flags,
        !          1202:                                                                 UInt32 *                               actualBytesAdded);
        !          1203: 
        !          1204: EXTERN_API_C( OSErr )
        !          1205: MapFileBlockC                                  (ExtendedVCB *                  vcb,
        !          1206:                                                                 FCB *                                  fcb,
        !          1207:                                                                 UInt32                                 numberOfBytes,
        !          1208:                                                                 UInt32                                 offset,
        !          1209:                                                                 UInt32 *                               startBlock,
        !          1210:                                                                 UInt32 *                               availableBytes);
        !          1211: 
        !          1212: #if TARGET_OS_RHAPSODY
        !          1213: EXTERN_API_C( Boolean )
        !          1214: NodesAreContiguous                             (ExtendedVCB *                  vcb,
        !          1215:                                                                 FCB *                                  fcb,
        !          1216:                                                                 UInt32                                 nodeSize);
        !          1217: #endif
        !          1218: 
        !          1219: EXTERN_API_C( OSErr )
        !          1220: GrowParallelFCBs                               (void);
        !          1221: 
        !          1222: EXTERN_API_C( void )
        !          1223: AdjustEOF                                              (FCB *                                  sourceFCB);
        !          1224: 
        !          1225: EXTERN_API_C( OSErr )
        !          1226: MapLogicalToPhysical                   (HIOParam *                             pb);
        !          1227: 
        !          1228:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !          1229:                                                                                                                                                                                        #pragma parameter __D0 PBMapFilePosition(__A0)
        !          1230:                                                                                                                                                                                        #endif
        !          1231: EXTERN_API( OSErr )
        !          1232: PBMapFilePosition                              (HIOParam *                             pb)                                                                     TWOWORDINLINE(0x7051, 0xA260);
        !          1233: 
        !          1234: /*     Extended Attributes Manager routines*/
        !          1235: EXTERN_API_C( SInt32 )
        !          1236: CompareAttributeKeys                   (const void *                   searchKey,
        !          1237:                                                                 const void *                   trialKey);
        !          1238: 
        !          1239: EXTERN_API_C( OSErr )
        !          1240: AttributesOpenVolume                   (ExtendedVCB *                  vcb);
        !          1241: 
        !          1242: EXTERN_API_C( OSErr )
        !          1243: AttributesCloseVolume                  (ExtendedVCB *                  vcb);
        !          1244: 
        !          1245: 
        !          1246: /*     Utility routines*/
        !          1247: 
        !          1248: EXTERN_API( OSErr )
        !          1249: HFSCommunicationProc                   (short                                  message,
        !          1250:                                                                 void *                                 paramBlock,
        !          1251:                                                                 void *                                 globalsPtr);
        !          1252: 
        !          1253: EXTERN_API_C( void )
        !          1254: ClearMemory                                            (void *                                 start,
        !          1255:                                                                 UInt32                                 length);
        !          1256: 
        !          1257: EXTERN_API_C( Boolean )
        !          1258: UnicodeBinaryCompare                   (ConstHFSUniStr255Param ustr1,
        !          1259:                                                                 ConstHFSUniStr255Param ustr2);
        !          1260: 
        !          1261: EXTERN_API_C( Boolean )
        !          1262: PascalBinaryCompare                            (ConstStr31Param                pstr1,
        !          1263:                                                                 ConstStr31Param                pstr2);
        !          1264: 
        !          1265: EXTERN_API_C( OSErr )
        !          1266: VolumeWritable                                 (ExtendedVCB *                  vcb);
        !          1267: 
        !          1268: EXTERN_API_C( void )
        !          1269: Get1stFileControlBlock                 (UInt16 *                               index,
        !          1270:                                                                 Ptr *                                  fcbsH);
        !          1271: 
        !          1272: EXTERN_API_C( Boolean )
        !          1273: GetNextFileControlBlock                        (UInt16 *                               index,
        !          1274:                                                                 Ptr                                    fcbsPtr);
        !          1275: 
        !          1276: 
        !          1277: /*�� Obsolete this ASM call*/
        !          1278: #if TARGET_OS_MAC
        !          1279: EXTERN_API_C( ExtendedFCB *)
        !          1280: ParallelFCBFromRefnum                  (FileReference                          refNum);
        !          1281: #endif
        !          1282: 
        !          1283: /*     Assembly glue routines should use ints instead of shorts to be usable with SC compiler.*/
        !          1284: EXTERN_API_C( ExtendedFCB *)
        !          1285: GetParallelFCB                                 (FileReference                                  fref);
        !          1286: 
        !          1287: struct FindFileNameGlueRec {
        !          1288:        UInt32                                                  nameLength;
        !          1289:        char *                                                  nameBuffer;
        !          1290:        ExtendedVCB *                                   vcb;
        !          1291:        WDCBRec *                                               wdcb;
        !          1292:        Ptr                                                     volumeBuffer;
        !          1293:        CatalogNodeData *                               data;
        !          1294:        HFSCatalogNodeID                                id;
        !          1295:        UInt32                                                  hint;
        !          1296: };
        !          1297: typedef struct FindFileNameGlueRec FindFileNameGlueRec;
        !          1298: 
        !          1299: EXTERN_API_C( OSErr )
        !          1300: FindFileName                                   (ParamBlockRec *                filePB,
        !          1301:                                                                 FindFileNameGlueRec *  ff);
        !          1302: 
        !          1303: /*     Get the current time in UTC (GMT)*/
        !          1304: EXTERN_API_C( UInt32 )
        !          1305: GetTimeUTC                                             (void);
        !          1306: 
        !          1307: /*     Get the current local time*/
        !          1308: EXTERN_API_C( UInt32 )
        !          1309: GetTimeLocal                                   (Boolean forHFS);
        !          1310: 
        !          1311: EXTERN_API_C( UInt32 )
        !          1312: LocalToUTC                                             (UInt32                                 localTime);
        !          1313: 
        !          1314: EXTERN_API_C( UInt32 )
        !          1315: UTCToLocal                                             (UInt32                                 utcTime);
        !          1316: 
        !          1317: EXTERN_API_C( UInt64 )
        !          1318: U64Add                                                 (UInt64                                 x,
        !          1319:                                                                 UInt64                                 y);
        !          1320: 
        !          1321: EXTERN_API_C( UInt64 )
        !          1322: U64Subtract                                            (UInt64                                 left,
        !          1323:                                                                 UInt64                                 right);
        !          1324: 
        !          1325: 
        !          1326: /*     Volumes routines*/
        !          1327: EXTERN_API_C( OSErr )
        !          1328: FlushVolumeControlBlock                        (ExtendedVCB *                  vcb);
        !          1329: 
        !          1330: EXTERN_API_C( OSErr )
        !          1331: CheckVolumeOffLine                             (ExtendedVCB *                  vcb);
        !          1332: 
        !          1333: EXTERN_API_C( OSErr )
        !          1334: CloseFile                                              (ExtendedVCB *                  vcb,
        !          1335:                                                                 SInt16                                 index,
        !          1336:                                                                 Ptr                                    fcbs);
        !          1337: 
        !          1338: EXTERN_API_C( OSErr )
        !          1339: FlushAlternateVolumeControlBlock (ExtendedVCB *                        vcb,
        !          1340:                                                                 Boolean                                isHFSPlus);
        !          1341: 
        !          1342: EXTERN_API_C( OSErr )
        !          1343: FindDrive                                              (short *                                driverRefNum,
        !          1344:                                                                 DrvQEl **                              dqe,
        !          1345:                                                                 short                                  driveNumber);
        !          1346: 
        !          1347: EXTERN_API_C( OSErr )
        !          1348: GetVCBDriveNum                                 (ExtendedVCB **                 vcb,
        !          1349:                                                                 short                                  driveNumber);
        !          1350: 
        !          1351: EXTERN_API_C( OSErr )
        !          1352: ValidVolumeHeader                              (HFSPlusVolumeHeader *                  volumeHeader);
        !          1353: 
        !          1354: EXTERN_API_C( void )
        !          1355: FillHFSStack                                   (void);
        !          1356: 
        !          1357: EXTERN_API_C( OSErr )
        !          1358: UnMountVolume                                  (VolumeParam *                  volume,
        !          1359:                                                                 WDCBRecPtr *                   wdcb);
        !          1360: 
        !          1361: EXTERN_API_C( OSErr )
        !          1362: MakeVCBsExtendedVCBs                   (void);
        !          1363: 
        !          1364: #if TARGET_OS_MAC
        !          1365: EXTERN_API_C( OSErr )
        !          1366: FindFileControlBlock                   (UInt16 *                               index,
        !          1367:                                  Ptr *                                 fcbsH);
        !          1368: #else  /* TARGET_OS_MAC */
        !          1369: EXTERN_API_C( OSErr )
        !          1370: GetNewFCB                                              (ExtendedVCB *                  vcb,
        !          1371:                                   FileReference* fRefPtr);
        !          1372: #endif /* TARGET_OS_MAC */
        !          1373: 
        !          1374: EXTERN_API_C( FCB *)
        !          1375: SetupFCB                                               (ExtendedVCB *                  vcb,
        !          1376:                                                 FileReference                  refNum,
        !          1377:                                                                 UInt32                                 fileID,
        !          1378:                                                                 UInt32                                 fileClumpSize);
        !          1379: 
        !          1380: EXTERN_API_C( OSErr )
        !          1381: AccessBTree                                            (ExtendedVCB *                  vcb,
        !          1382:                                                                 FileReference                          refNum,
        !          1383:                                                                 UInt32                                 fileID,
        !          1384:                                                                 UInt32                                 fileClumpSize,
        !          1385:                                                                 void *                                 CompareRoutine);
        !          1386: 
        !          1387: EXTERN_API_C( void )
        !          1388: RemountWrappedVolumes                  (void);
        !          1389: 
        !          1390: EXTERN_API_C( OSErr )
        !          1391: CheckVolumeConsistency                 (ExtendedVCB *                  vcb);
        !          1392: 
        !          1393: EXTERN_API_C( void )
        !          1394: HFSBlocksFromTotalSectors              (UInt32                                 totalSectors,
        !          1395:                                                                 UInt32 *                               blockSize,
        !          1396:                                                                 UInt16 *                               blockCount);
        !          1397: 
        !          1398: /*     CreateEmbeddedVolume.c*/
        !          1399: EXTERN_API_C( OSErr )
        !          1400: CreateEmbeddedVolume                   (ParmBlkPtr                     paramBlock);
        !          1401: 
        !          1402: 
        !          1403: /*     Private Files SPI*/
        !          1404: 
        !          1405: /*���move following to FilesPriv.i*/
        !          1406: 
        !          1407: 
        !          1408: 
        !          1409: enum {
        !          1410:                                                                                                                                /* Private HFSDispatch calls (currently implemented only in AppleShare or FileShare)*/
        !          1411:        selectShare                                     = 0x42,
        !          1412:        selectUnshare                           = 0x43,
        !          1413:        selectGetUGEntry                        = 0x44,
        !          1414:        selectServerControl                     = 0x45,
        !          1415:        selectServerStartup                     = 0x46
        !          1416: };
        !          1417: 
        !          1418: 
        !          1419: 
        !          1420: enum {
        !          1421:                                                                                                                                /* fields for _FSControl call:*/
        !          1422:        ioFSVrsn                                        = 0x20,                                                 /* File system version*/
        !          1423:        ioHQElSize                                      = 52                                                    /* size of a standard HFS call queue element*/
        !          1424: };
        !          1425: 
        !          1426: 
        !          1427: struct SearchPathParam {
        !          1428:        QElemPtr                                                qLink;
        !          1429:        short                                                   qType;
        !          1430:        short                                                   ioTrap;
        !          1431:        Ptr                                                     ioCmdAddr;
        !          1432:        IOCompletionUPP                                 ioCompletion;
        !          1433:        OSErr                                                   ioResult;
        !          1434:        StringPtr                                               ioNamePtr;
        !          1435:        short                                                   ioVRefNum;
        !          1436:        short                                                   ioRefNum;
        !          1437:        SInt8                                                   ioPMSPFlg;                                      /* Flag whether to enable the PMSP*/
        !          1438:        SInt8                                                   filler1;
        !          1439:        Ptr                                                     ioPMSPHook;                                     /* Pointer to PMSP hook proc*/
        !          1440: };
        !          1441: typedef struct SearchPathParam SearchPathParam;
        !          1442: 
        !          1443: typedef SearchPathParam *                              SearchPathParamPtr;
        !          1444:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !          1445:                                                                                                                                                                                        #pragma parameter __D0 FSControl(__A0)
        !          1446:                                                                                                                                                                                        #endif
        !          1447: EXTERN_API( OSErr )
        !          1448: FSControl                                              (ParmBlkPtr                     paramBlock)                                                     TWOWORDINLINE(0x7000, 0xA260);
        !          1449: 
        !          1450:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !          1451:                                                                                                                                                                                        #pragma parameter __D0 MakeEmbeddedVolume(__A0)
        !          1452:                                                                                                                                                                                        #endif
        !          1453: EXTERN_API( OSErr )
        !          1454: MakeEmbeddedVolume                             (ParmBlkPtr                     paramBlock)                                                     TWOWORDINLINE(0x701C, 0xA260);
        !          1455: 
        !          1456:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !          1457:                                                                                                                                                                                        #pragma parameter __D0 SetPMSP(__A0)
        !          1458:                                                                                                                                                                                        #endif
        !          1459: EXTERN_API( OSErr )
        !          1460: SetPMSP                                                        (ParmBlkPtr                     paramBlock)                                                     TWOWORDINLINE(0x700C, 0xA260);
        !          1461: 
        !          1462:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !          1463:                                                                                                                                                                                        #pragma parameter __D0 GetParallelFCBFromRefnum(__A0)
        !          1464:                                                                                                                                                                                        #endif
        !          1465: EXTERN_API( OSErr )
        !          1466: GetParallelFCBFromRefnum               (ParmBlkPtr                     paramBlock)                                                     TWOWORDINLINE(0x7050, 0xA260);
        !          1467: 
        !          1468: struct CreateLargeFileParam {
        !          1469:                                                                                                                                /* The first several fields come from HFileInfo. */
        !          1470:        QElemPtr                                                qLink;                                          /*queue link in header*/
        !          1471:        short                                                   qType;                                          /*type byte for safety check*/
        !          1472:        short                                                   ioTrap;                                         /*FS: the Trap*/
        !          1473:        Ptr                                                     ioCmdAddr;                                      /*FS: address to dispatch to*/
        !          1474:        IOCompletionUPP                                 ioCompletion;                           /*completion routine addr (0 for synch calls)*/
        !          1475:        OSErr                                                   ioResult;                                       /*result code*/
        !          1476:        StringPtr                                               ioNamePtr;                                      /*ptr to Vol:FileName string*/
        !          1477:        short                                                   ioVRefNum;                                      /*volume refnum (DrvNum for Eject and MountVol)*/
        !          1478:        short                                                   ioFRefNum;
        !          1479:        SInt8                                                   ioFVersNum;
        !          1480:        SInt8                                                   filler1;
        !          1481:        short                                                   ioFDirIndex;
        !          1482:        SInt8                                                   ioFlAttrib;
        !          1483:        SInt8                                                   ioACUser;
        !          1484:        FInfo                                                   ioFlFndrInfo;
        !          1485:        long                                                    ioDirID;
        !          1486: 
        !          1487:                                                                                                                                /* The rest of these fields are specific to the PBCreateLargeFile call. */
        !          1488:        UInt64                                                  dataLogicalEOF;
        !          1489:        UInt64                                                  dataPhysicalEOF;
        !          1490:        UInt64                                                  rsrcLogicalEOF;
        !          1491:        UInt64                                                  rsrcPhysicalEOF;
        !          1492: };
        !          1493: typedef struct CreateLargeFileParam CreateLargeFileParam;
        !          1494: 
        !          1495: EXTERN_API_C( OSErr )
        !          1496: CreateLargeFile                                        (CreateLargeFileParam * pb);
        !          1497: 
        !          1498:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !          1499:                                                                                                                                                                                        #pragma parameter __D0 PBCreateLargeFile(__A0)
        !          1500:                                                                                                                                                                                        #endif
        !          1501: EXTERN_API( OSErr )
        !          1502: PBCreateLargeFile                              (CreateLargeFileParam * paramBlock)                                                     TWOWORDINLINE(0x7064, 0xA260);
        !          1503: 
        !          1504: EXTERN_API_C( OSErr )
        !          1505: LongRename                                             (CMovePBRec *                   pb);
        !          1506: 
        !          1507:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !          1508:                                                                                                                                                                                        #pragma parameter __D0 PBLongRenameSync(__A0)
        !          1509:                                                                                                                                                                                        #endif
        !          1510: EXTERN_API( OSErr )
        !          1511: PBLongRenameSync                               (CMovePBRec *                   paramBlock)                                                     TWOWORDINLINE(0x701E, 0xA260);
        !          1512: 
        !          1513: struct AttributeParam {
        !          1514:        QElemPtr                                                qLink;
        !          1515:        short                                                   qType;
        !          1516:        short                                                   ioTrap;
        !          1517:        Ptr                                                     ioCmdAddr;
        !          1518:        ProcPtr                                                 ioCompletion;                           /* --> A pointer to a completion routine */
        !          1519:        OSErr                                                   ioResult;                                       /* --> The result code of the function */
        !          1520:        StringPtr                                               ioNamePtr;                                      /* --> Pointer to pathname to object */
        !          1521:        short                                                   ioVRefNum;                                      /* --> A volume specification */
        !          1522:        long                                                    filler1;
        !          1523:        long                                                    filler2;
        !          1524:        Ptr                                                     ioBuffer;
        !          1525:        unsigned long                                   ioReqCount;
        !          1526:        unsigned long                                   ioActCount;
        !          1527:        HFSUniStr255 *                                  ioAttributeName;                        /* --> A pointer to the attribute name buffer */
        !          1528:        long                                                    ioDirID;                                        /* --> A directory ID */
        !          1529: };
        !          1530: typedef struct AttributeParam AttributeParam;
        !          1531: 
        !          1532: EXTERN_API_C( OSErr )
        !          1533: CreateAttribute                                        (AttributeParam *               pb);
        !          1534: 
        !          1535:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !          1536:                                                                                                                                                                                        #pragma parameter __D0 PBCreateAttributeSync(__A0)
        !          1537:                                                                                                                                                                                        #endif
        !          1538: EXTERN_API( OSErr )
        !          1539: PBCreateAttributeSync                  (AttributeParam *               paramBlock)                                                     TWOWORDINLINE(0x7065, 0xA260);
        !          1540: 
        !          1541: 
        !          1542: #if PRAGMA_STRUCT_ALIGN
        !          1543:        #pragma options align=reset
        !          1544: #elif PRAGMA_STRUCT_PACKPUSH
        !          1545:        #pragma pack(pop)
        !          1546: #elif PRAGMA_STRUCT_PACK
        !          1547:        #pragma pack()
        !          1548: #endif
        !          1549: 
        !          1550: #ifdef PRAGMA_IMPORT_OFF
        !          1551: #pragma import off
        !          1552: #elif PRAGMA_IMPORT
        !          1553: #pragma import reset
        !          1554: #endif
        !          1555: 
        !          1556: #ifdef __cplusplus
        !          1557: }
        !          1558: #endif
        !          1559: 
        !          1560: #endif /* __FILEMGRINTERNAL__ */
        !          1561: 

unix.superglobalmegacorp.com

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