X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/e3027f41d0120b4278cca462f397b6619dcd9ac5..0b4e3aa066abc0728aacb4bbeb86f53f9737156e:/bsd/hfs/hfscommon/headers/FileMgrInternal.h diff --git a/bsd/hfs/hfscommon/headers/FileMgrInternal.h b/bsd/hfs/hfscommon/headers/FileMgrInternal.h index 24c46bc56..370dca4e9 100644 --- a/bsd/hfs/hfscommon/headers/FileMgrInternal.h +++ b/bsd/hfs/hfscommon/headers/FileMgrInternal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2001 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -26,136 +26,7 @@ Version: HFS Plus 1.0 - Copyright: © 1996-1999 by Apple Computer, Inc., all rights reserved. - - File Ownership: - - DRI: Don Brady - - Other Contacts: Mark Day, Deric horn, Jim Luther - - Technology: File Systems - - Writers: - - (JL) Jim Luther - (msd) Mark Day - (djb) Don Brady - (DSH) Deric Horn - - Change History (most recent first): - 9/12/99 ser Removed FCBs. - 9/9/99 pwd Fixed some VCB fields to be unsigned instead of signed to align - the definitions with the MDB/volume header and actual use [#2355889]. - 9/3/99 ser Added kUndefinedStrLen. - 6/3/99 djb Removed unused/legacy vcb fields from ExtendedVCB. - 11/20/98 djb Add support for UTF-8 names. - 8/31/98 djb Added boolean flag to GetTimeLocal prototype. - 6/30/98 djb Add NodesAreContiguous prototype (for radar #2249539). - 6/22/98 djb Add ERR_BASE to error codes to make them negative (for MacOS X only). - Replace DeallocFile prototype with DeleteFile prototype. - 6/5/98 djb Added CreateFileIDRef prototype; - 6/3/98 djb Add MoveRenameCatalogNode prototype (replaces seperate Move and Rename). - 4/17/98 djb Add VCB locking. - 4/6/98 djb Removed CreateVolumeCatalogCache and DisposeVolumeCatalogCache (obsolete). - 4/2/98 djb UpdateCatalogNode now takes parID and name as input. - 3/31/98 djb Sync up with final HFSVolumes.h header file. - 3/17/98 djb Fixed CreateCatalogNode interface to take kCatalogFolderNode and - kCatalogFileNode as type input. - - 1/29/98 DSH Added TrashVolumeDiskCache prototype for TrashAllFSCaches API - support. - 12/10/97 DSH 2201501, Overload the NodeData valence field for over 2 Gig file - support. - 11/18/97 DSH Conditionalize ou BlockCameFromDisk() macro for DFA - 11/16/97 djb LockMappingTable is now defined in UnicodeConverterPriv.i. - 11/13/97 djb Move CatalogIterator struct to CatalogPrivate.h. Include - UnicodeConverter.i instead of Unicode.i. - 11/3/97 JL #2001483 - changed UnMountVolume's prototype. - <24> 10/31/97 DSH Added consistencyStatus parameter to MountCheck. - 10/21/97 DSH Interfacer tweak - 10/21/97 DSH Conditionalize LMGetFCBTable, LMGetFSVars for DFA to call - through DFAs LowMem accessors. - 10/20/97 msd Add a bytesMaximum parameter to BlockAllocate; removed fcb - parameter. - 10/19/97 msd Bug 1684586. Remove the modifyDate field from CatalogNodeDate. - GetCatInfo and SetCatInfo use only contentModDate. - 10/16/97 djb Add LMGetFSVars and LMGetFCBTable macros, add gBlockCacheDirty - to FSVars, simplified HFS Stack swapping macros. - 10/13/97 DSH Added InitBTreeHeader prototype - 10/13/97 djb Add volumeNameEncodingHint to VCB, add textEncoding to - CatalogNodeData, add gTextEncodingFontName to FSVars. - 10/1/97 DSH Added CheckVolumeConsistency() for 1682475. - 10/1/97 djb New Catalog iterators and Catalog node cache SPI. - 9/17/97 DSH Moved prototype HFSBlocksFromTotalSectors() here for DFA - wrapperless volume support. - 9/16/97 msd Add a field to FSVarsRec to store old WriteXParam address. - 9/15/97 djb Add gBootPToUTable to FSVars (used to bootstrap Unicode). - 9/7/97 djb Add FlushBlockCache prototype. - 9/4/97 djb Add cmParentNotFound error code and reportMissingParent bit. - 9/4/97 msd Remove unused attributes calls. Rename PropertyCloseVolume to - AttributesCloseVolume. In CatalogNodeData, replace - attributeModDate with modifyDate. Remove macro LatestModDate. - 8/22/97 djb Add readFromDisk flag to GetCacheBlock and BlockCameFromDisk - macro. - 8/18/97 DSH Override ASM cache accessing routines for DFA to use DFA cache. - 7/28/97 msd Add prototypes for CacheReadInPlace, RemountWrappedVolumes. - 7/25/97 DSH Added GenericMRUCache Routines - 7/22/97 msd In CatalogNodeData, move attributeModDate after backupDate; this - allows SetCatInfo to manipulate the rest of the dates in one - block, the same as in the parameter block. - 7/21/97 djb Add more instrumentation globals (CallProfile). Reallign FSVars. - 7/18/97 msd Selector for PBCreateAttribute conflicts with PBGetXCatInfo. The - attribute calls now have selectors in the range $65..$69. - 7/16/97 DSH first checked in - 7/8/97 DSH Added LockMappingTable() until its moved into the Unicode header - files. - 7/7/97 DSH Taking out changes made in HFS <45> for greater compatability - with the Tempo installer. - 6/27/97 msd Add PBLongRename SPI. Add prototype for - RenameCatalogNodeUnicode. - 6/26/97 DSH Conditionalized macro LocalToUTC to not look at FSVars for DFA. - 6/25/97 msd Add prototype for HFSCommunicationProc. - 6/24/97 DSH Adding runtime flags to deturmine unicode usage and installation - status. - 6/24/97 djb Add linkCount to CatalogNodeData. Add LinkCatalogNode prototype. - Move Private Catalog Manager prototypes to CatalogPrivate.h. - 6/20/97 msd Add prototype for CopyCatalogNodeData. In CatalogNodeData, - replaced modifyDate with contentModDate and attributeModDate. - Added a LatestModDate macro. - <15> 6/18/97 djb Add mask to ConversionContext. Add encodingsBitmap to VCB (and - reallign some fields). Add gInstalledEncodings to FSVars. - 6/17/97 msd The conversions between local time and UTC have the sign of the - offset backwards. - 6/13/97 djb Removed PrepareOutputName. Changed parameters for - DeleteCatalogNode, MoveCatalogNode, PrepareInputName. Add - private catalog macros. - 6/12/97 msd Export BlockAllocateAny and UpdateVCBFreeBlks. - 6/12/97 msd Add a parameter block and prototype for an SPI to create very - large files. - 6/9/97 msd Add an offsetToUTC field to FSVarsRec. Add prototypes for - GetTimeUTC and GetTimeLocal; add macros for LocalToUTC and - UTCToLocal. - 6/5/97 msd Add MapLogicalToPhysical (internal routine), PBMapFilePosition - for external use. - 6/4/97 djb More Unicode converter changes (support for non roman scripts). - 6/2/97 msd Add prototype for AdjustEOF. - 5/28/97 msd Add prototypes for attributes SPI, both internal routines and PB - calls. Add FindFileNameGlueRec and FindFileName routine. - Prototypes for FindFileControlBlock and AccessBTree disappeared, - so added again. - 5/20/97 DSH Including LowMemPriv.a in DFA compiles - 5/19/97 djb Add uppLockMappingTable to FSVars. - 5/19/97 djb Add CreateVolumeCatalogCache and DisposeVolumeCatalogCache - prototypes. Remove private CatalogDataCache structure. - 5/16/97 msd Use fixed-size integers for GetBlock_glue and RelBlock_glue so - it will build with compilers other than MPW C and SC. Add - prototype for FillHFSStack, UnMountVolume, and - MakeVCBsExtendedVCBs from VolumeRequests.c. Add prototypes for - CreateEmbeddedVolume and InitUnicodeConverter. - 5/9/97 djb first checked in - 5/7/97 djb Add summary trace data. Shrink FSVars.later to 4 longs. - 4/28/97 djb first checked in + Copyright: © 1996-2001 by Apple Computer, Inc., all rights reserved. */ #ifndef __FILEMGRINTERNAL__ @@ -232,36 +103,7 @@ enum { /* internal flags*/ - enum { - /* File System busy flag:*/ - /* Bit zero of FSBusy (lomem $360) is true when the file system is running.*/ - /* The word at $360 is cleared when the file system is exited. The*/ - /* bits defined here are for additional flags in the FSBusy word that are*/ - /* valid only when the file system is running.*/ - fsBusyBit = 0, /* file system is running; other FSBusy bits are valid*/ - fsSCSIDefer = 1, /* file system is waiting for SCSI transaction to complete*/ - fsIntMaskDefer = 2, /* file system is waiting until the interrupt mask is lowered*/ - /* Flag bits in HFSFlags byte:*/ - hfsReq = 0, /* Set if request is specific to HFS*/ - dirCN = 1, /* Set if a CNode is a directory*/ - reportMissingParent = 4, /* tell Catalog to report missing parents (used by MakeFSSpec)*/ - skipPMSP = 5, /* Set to skip PMSP setup (one-shot)*/ - noPMSP = 6, /* Set to disable PMSP completely (status flag)*/ - hfsContd = 7, /* Set if Async trap is continued*/ - /* fsFlags values*/ - fsNoAllocate = 0, - fsNoAllocateMask = 0x01, /* true when allocating memory is a very bad idea*/ - fsNeedFCBs = 1, - fsNeedFCBsMask = 0x02, /* true when a local FCB couldn't be found */ - fsNoFCBExpansion = 2, - fsNoFCBExpansionMask = 0x04, /* true if no FCB expansion logic is desired*/ - /* ExtendFile option flags*/ - /* extendFileAllBit = 0, |* allocate all requested bytes or none *|*/ - /* extendFileAllMask = 0x0001,*/ - /* */ - /* extendFileContigBit = 1, |* force contiguous allocation *|*/ - /* extendFileContigMask = 0x0002*/ kEFContigBit = 1, /* force contiguous allocation*/ kEFContigMask = 0x02, kEFAllBit = 0, /* allocate all requested bytes or none*/ @@ -271,81 +113,9 @@ enum { }; enum { - kUndefinedStrLen = 0 /* Unknown string length */ -}; - -enum { - HFSStkLen = 1792, /* old stack size (pre HFS Plus)*/ - kFileSystemStackSlop = 16, /* additional temporary space*/ - kFileSystemStackSize = 16384, /* give us more breathing room*/ - kFileSystemVersion = FOUR_CHAR_CODE('2.0A'), /* current file system version*/ - /* 31744 = $7C00, a nice round number close to*/ - /* (32767*1000)/1024, which is about the largest */ - /* free space unsuspecting, decimal-K minded apps*/ - /* might be expected to handle.*/ - /* AlBlkLim*/ - kMaxHFSAllocationBlocks = 31744, - WDRfnMin = -32767, /* lowest assigned WD RefNum*/ - WDRfnMax = -4096, /* largest possible WDrefnum*/ - kFirstFileRefnum = 2, /* smallest FCB refnum*/ - kNoHint = 0 -}; - - -/* Internal LowMem pointers*/ - -/*€€ The following should really be in LowMemPriv.i*/ - -enum { - FSCallAsync = 0x0342, /* ONE BYTE FREE*/ - NoEject = 0x034B, /* used by Eject and Offline*/ - CacheFlag = 0x0377, - SysBMCPtr = 0x0378, /* System-wide bitmap cache pointer*/ - SysCtlCPtr = 0x0380, /* System-wide control cache pointer*/ - HFSDSErr = 0x0392, /* Final gasp - error that caused IOErr.*/ - LMParamBlock = 0x03A4, /* LMGetParams() just gives us a copy of it*/ - FSVarsPtr = 0x0BB8, /* lomem that points to file system variable block*/ - CacheVars = 0x0394, - HFSStkPtr = 0x036E, /* Temporary location of HFS Stack pointer*/ - FSIOErr = 0x03DE, /* last I/O error (NEXT WORD FREE)*/ - /* file manager vectors not found in LowMemPriv.i*/ - JUpdAltMDB = (0xED) * 4 + 0x0400, /* ($A0ED) $0400 is n/OSTable*/ - JCkExtFS = (0xEE) * 4 + 0x0400, /* ($A0EE) $0400 is n/OSTable*/ - JBMChk = (0xF0) * 4 + 0x0400, /* ($A0F0) $0400 is n/OSTable*/ - JTstMod = (0xF1) * 4 + 0x0400, /* ($A0F1) $0400 is n/OSTable*/ - JLocCRec = (0xF2) * 4 + 0x0400, /* ($A0F2) $0400 is n/OSTable*/ - JTreeSearch = (0xF3) * 4 + 0x0400, /* ($A0F3) $0400 is n/OSTable*/ - JMapFBlock = (0xF4) * 4 + 0x0400, /* ($A0F4) $0400 is n/OSTable*/ - JXFSearch = (0xF5) * 4 + 0x0400, /* ($A0F5) $0400 is n/OSTable*/ - JReadBM = (0xF6) * 4 + 0x0400 /* ($A0F6) $0400 is n/OSTable*/ -}; - - -/* Poor Man's Search Path*/ - -struct SearchPathHeader { - Ptr PMSPHook; /* Hook for PMSP modification*/ - short PMSPIndx; /* Index to PMSP index from start of PMSP*/ -}; -typedef struct SearchPathHeader SearchPathHeader; - -struct SearchPathEntry { - short spVRefNum; /* VRefNum in PMSP entry*/ - UInt32 spDirID; /* Directory ID in PMSP entry*/ -}; -typedef struct SearchPathEntry SearchPathEntry; - - -enum { - kPoorMansSearchIndex = -2, - MaxDVCnt = 8, /* Leave room for 8 default VRefNums*/ - PMSPSize = MaxDVCnt * sizeof(SearchPathEntry) + sizeof(SearchPathHeader) + 2 -}; - - + kUndefinedStrLen = 0, /* Unknown string length */ + kNoHint = 0, -enum { - fsWDCBExtendCount = 8, /* # of WDCB's to add when we run out*/ /* FileIDs variables*/ kNumExtentsToCache = 4 /* just guessing for ExchangeFiles*/ }; @@ -415,20 +185,6 @@ enum { }; -/* Catalog Node Data - universal data returned from the Catalog Manager*/ - - -enum { - xFFFilAttrLockMask = 0x70 -}; - -/* valence is overloaded for files and used as additional flags. 2201501*/ - -enum { - kLargeDataForkMask = 0x00000001, - kLargeRsrcForkMask = 0x00000002 -}; - /* Universal catalog name*/ union CatalogName { @@ -437,44 +193,6 @@ union CatalogName { }; typedef union CatalogName CatalogName; -/* Unicode Conversion*/ - - -enum { - kMacBaseEncodingCount = 50, - kTextEncodingUndefined = 0x00007FFF -}; - -struct ConversionContext { - TextToUnicodeInfo toUnicode; - UnicodeToTextInfo fromUnicode; -}; -typedef struct ConversionContext ConversionContext; - -struct CallProfile { - UInt16 refCount; - UInt16 errCount; - UInt32 callCount; - UInt32 minTime; - UInt32 maxTime; - UInt64 totalTime; - UInt64 startBase; /* in nanoseconds*/ -}; -typedef struct CallProfile CallProfile; - - -struct FSVarsRec { - UInt32 gDefaultBaseEncoding; - ItemCount gInstalledEncodings; - ConversionContext gConversionContext[50]; - Ptr gBootPToUTable; /* used by boot code to find Extensions folder*/ - StringPtr gTextEncodingFontName; /* points to font name (only used when no HFS Plus volumes have been mounted)*/ - Boolean gUseDynamicUnicodeConverters; - Boolean gIsUnicodeInstalled; -}; -typedef struct FSVarsRec FSVarsRec; - - /* * MacOS accessor routines @@ -483,9 +201,6 @@ typedef struct FSVarsRec FSVarsRec; #define GetFileRefNumFromFCB(filePtr) ((filePtr)->h_vp) -EXTERN_API_C( Boolean ) -BlockCameFromDisk (void); - /* The following macro marks a VCB as dirty by setting the upper 8 bits of the flags*/ EXTERN_API_C( void ) MarkVCBDirty (ExtendedVCB *vcb); @@ -522,11 +237,7 @@ EXTERN_API_C( void ) ExitOnError (OSErr result); #define ExitOnError( result ) if ( ( result ) != noErr ) goto ErrorExit; else ; -/* Return the low 16 bits of a 32 bit value, pinned if too large*/ -EXTERN_API_C( UInt16 ) -LongToShort (UInt32 l); -#define LongToShort( l ) l <= (UInt32)0x0000FFFF ? ((UInt16) l) : ((UInt16) 0xFFFF) /* Catalog Manager Routines (IPI)*/ @@ -537,7 +248,8 @@ CreateCatalogNode (ExtendedVCB * volume, ConstUTF8Param name, UInt32 nodeType, HFSCatalogNodeID * catalogNodeID, - UInt32 * catalogHint); + UInt32 * catalogHint, + UInt32 teHint); EXTERN_API_C( OSErr ) DeleteCatalogNode (ExtendedVCB * volume, @@ -569,7 +281,8 @@ MoveRenameCatalogNode (ExtendedVCB * volume, UInt32 srcHint, HFSCatalogNodeID dstParentID, ConstUTF8Param dstName, - UInt32 * newHint); + UInt32 * newHint, + UInt32 teHint); EXTERN_API_C( OSErr ) UpdateCatalogNode (ExtendedVCB * volume, @@ -675,44 +388,6 @@ ReplaceBTreeRecord (FileReference refNum, UInt16 dataSize, UInt32 * newHint); -/* From HFSVolumesInit.c*/ -EXTERN_API_C( void ) -InitBTreeHeader (UInt32 fileSize, - UInt32 clumpSize, - UInt16 nodeSize, - UInt16 recordCount, - UInt16 keySize, - UInt32 attributes, - UInt32 * mapNodes, - void * buffer); - -/* Prototypes for big block cache*/ - -EXTERN_API_C( OSErr ) -InitializeBlockCache (UInt32 blockSize, - UInt32 blockCount); - -EXTERN_API_C( OSErr ) -FlushBlockCache (void); - -EXTERN_API_C( OSErr ) -GetCacheBlock (FileReference fileRefNum, - UInt32 blockNumber, - UInt32 blockSize, - UInt16 options, - LogicalAddress * buffer, - Boolean * readFromDisk); - -EXTERN_API_C( OSErr ) -ReleaseCacheBlock (LogicalAddress buffer, - UInt16 options); - -EXTERN_API_C( OSErr ) -MarkCacheBlock (LogicalAddress buffer); - -EXTERN_API_C( OSErr ) -TrashCacheBlocks (FileReference fileRefNum); - /* Prototypes for C->Asm glue*/ EXTERN_API_C( OSErr ) GetBlock_glue (UInt16 flags, @@ -725,17 +400,6 @@ EXTERN_API_C( OSErr ) RelBlock_glue (Ptr nodeBuffer, UInt16 flags); -EXTERN_API_C( void ) -MarkBlock_glue (Ptr nodeBuffer); - -EXTERN_API_C( OSErr ) -C_FlushCache (ExtendedVCB * vcb, - UInt32 flags, - FileReference refNum); - - -EXTERN_API_C( void ) TrashVolumeDiskCache(ExtendedVCB * vcb); - /* Prototypes for exported routines in VolumeAllocation.c*/ EXTERN_API_C( OSErr ) BlockAllocate (ExtendedVCB * vcb, @@ -751,30 +415,10 @@ BlockDeallocate (ExtendedVCB * vcb, UInt32 firstBlock, UInt32 numBlocks); -EXTERN_API_C( OSErr ) -UpdateFreeCount (ExtendedVCB * vcb); - - -EXTERN_API_C( OSErr ) -AllocateFreeSpace (ExtendedVCB * vcb, - UInt32 * startBlock, - UInt32 * actualBlocks); - EXTERN_API_C( UInt32 ) FileBytesToBlocks (SInt64 numerator, UInt32 denominator); -EXTERN_API_C( OSErr ) -BlockAllocateAny (ExtendedVCB * vcb, - UInt32 startingBlock, - UInt32 endingBlock, - UInt32 maxBlocks, - UInt32 * actualStartBlock, - UInt32 * actualNumBlocks); - -EXTERN_API_C( void ) -UpdateVCBFreeBlks (ExtendedVCB * vcb); - /* File Extent Mapping routines*/ EXTERN_API_C( OSErr ) FlushExtentFile (ExtendedVCB * vcb); @@ -803,6 +447,7 @@ EXTERN_API_C( OSErr ) ExtendFileC (ExtendedVCB * vcb, FCB * fcb, SInt64 bytesToAdd, + UInt32 blockHint, UInt32 flags, SInt64 * actualBytesAdded); @@ -820,8 +465,6 @@ NodesAreContiguous (ExtendedVCB * vcb, FCB * fcb, UInt32 nodeSize); #endif -EXTERN_API_C( void ) -AdjustEOF (FCB * sourceFCB); /* Utility routines*/ @@ -829,14 +472,6 @@ EXTERN_API_C( void ) ClearMemory (void * start, UInt32 length); -EXTERN_API_C( Boolean ) -UnicodeBinaryCompare (ConstHFSUniStr255Param ustr1, - ConstHFSUniStr255Param ustr2); - -EXTERN_API_C( Boolean ) -PascalBinaryCompare (ConstStr31Param pstr1, - ConstStr31Param pstr2); - EXTERN_API_C( OSErr ) VolumeWritable (ExtendedVCB * vcb); @@ -860,36 +495,9 @@ UTCToLocal (UInt32 utcTime); EXTERN_API_C( OSErr ) FlushVolumeControlBlock (ExtendedVCB * vcb); -EXTERN_API_C( OSErr ) -CheckVolumeOffLine (ExtendedVCB * vcb); - EXTERN_API_C( OSErr ) ValidVolumeHeader (HFSPlusVolumeHeader * volumeHeader); -EXTERN_API_C( void ) -FillHFSStack (void); - - -EXTERN_API_C( OSErr ) -AccessBTree (ExtendedVCB * vcb, - FileReference refNum, - UInt32 fileID, - UInt32 fileClumpSize, - void * CompareRoutine); - -EXTERN_API_C( void ) -RemountWrappedVolumes (void); - -EXTERN_API_C( OSErr ) -CheckVolumeConsistency (ExtendedVCB * vcb); - -EXTERN_API_C( void ) -HFSBlocksFromTotalSectors (UInt32 totalSectors, - UInt32 * blockSize, - UInt16 * blockCount); - - - #if PRAGMA_STRUCT_ALIGN #pragma options align=reset