/*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2001 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
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):
- <MOSXS> 9/12/99 ser Removed FCBs.
- <MOSX> 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].
- <MOSXS> 9/3/99 ser Added kUndefinedStrLen.
- <MOSXS> 6/3/99 djb Removed unused/legacy vcb fields from ExtendedVCB.
- <MOSXS> 11/20/98 djb Add support for UTF-8 names.
- <MOSXS> 8/31/98 djb Added boolean flag to GetTimeLocal prototype.
- <MOSXS> 6/30/98 djb Add NodesAreContiguous prototype (for radar #2249539).
- <MOSXS> 6/22/98 djb Add ERR_BASE to error codes to make them negative (for MacOS X only).
- Replace DeallocFile prototype with DeleteFile prototype.
- <MOSXS> 6/5/98 djb Added CreateFileIDRef prototype;
- <MOSXS> 6/3/98 djb Add MoveRenameCatalogNode prototype (replaces seperate Move and Rename).
- <MOSXS> 4/17/98 djb Add VCB locking.
- <MOSXS> 4/6/98 djb Removed CreateVolumeCatalogCache and DisposeVolumeCatalogCache (obsolete).
- <MOSXS> 4/2/98 djb UpdateCatalogNode now takes parID and name as input.
- <MOSXS> 3/31/98 djb Sync up with final HFSVolumes.h header file.
- <MOSXS> 3/17/98 djb Fixed CreateCatalogNode interface to take kCatalogFolderNode and
- kCatalogFileNode as type input.
-
- <CS30> 1/29/98 DSH Added TrashVolumeDiskCache prototype for TrashAllFSCaches API
- support.
- <CS29> 12/10/97 DSH 2201501, Overload the NodeData valence field for over 2 Gig file
- support.
- <CS28> 11/18/97 DSH Conditionalize ou BlockCameFromDisk() macro for DFA
- <CS27> 11/16/97 djb LockMappingTable is now defined in UnicodeConverterPriv.i.
- <CS26> 11/13/97 djb Move CatalogIterator struct to CatalogPrivate.h. Include
- UnicodeConverter.i instead of Unicode.i.
- <CS25> 11/3/97 JL #2001483 - changed UnMountVolume's prototype.
- <24> 10/31/97 DSH Added consistencyStatus parameter to MountCheck.
- <CS23> 10/21/97 DSH Interfacer tweak
- <CS22> 10/21/97 DSH Conditionalize LMGetFCBTable, LMGetFSVars for DFA to call
- through DFAs LowMem accessors.
- <CS21> 10/20/97 msd Add a bytesMaximum parameter to BlockAllocate; removed fcb
- parameter.
- <CS20> 10/19/97 msd Bug 1684586. Remove the modifyDate field from CatalogNodeDate.
- GetCatInfo and SetCatInfo use only contentModDate.
- <CS19> 10/16/97 djb Add LMGetFSVars and LMGetFCBTable macros, add gBlockCacheDirty
- to FSVars, simplified HFS Stack swapping macros.
- <CS18> 10/13/97 DSH Added InitBTreeHeader prototype
- <CS17> 10/13/97 djb Add volumeNameEncodingHint to VCB, add textEncoding to
- CatalogNodeData, add gTextEncodingFontName to FSVars.
- <CS16> 10/1/97 DSH Added CheckVolumeConsistency() for 1682475.
- <CS15> 10/1/97 djb New Catalog iterators and Catalog node cache SPI.
- <CS14> 9/17/97 DSH Moved prototype HFSBlocksFromTotalSectors() here for DFA
- wrapperless volume support.
- <CS13> 9/16/97 msd Add a field to FSVarsRec to store old WriteXParam address.
- <CS12> 9/15/97 djb Add gBootPToUTable to FSVars (used to bootstrap Unicode).
- <CS11> 9/7/97 djb Add FlushBlockCache prototype.
- <CS10> 9/4/97 djb Add cmParentNotFound error code and reportMissingParent bit.
- <CS9> 9/4/97 msd Remove unused attributes calls. Rename PropertyCloseVolume to
- AttributesCloseVolume. In CatalogNodeData, replace
- attributeModDate with modifyDate. Remove macro LatestModDate.
- <CS8> 8/22/97 djb Add readFromDisk flag to GetCacheBlock and BlockCameFromDisk
- macro.
- <CS7> 8/18/97 DSH Override ASM cache accessing routines for DFA to use DFA cache.
- <CS6> 7/28/97 msd Add prototypes for CacheReadInPlace, RemountWrappedVolumes.
- <CS5> 7/25/97 DSH Added GenericMRUCache Routines
- <CS4> 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.
- <CS3> 7/21/97 djb Add more instrumentation globals (CallProfile). Reallign FSVars.
- <CS2> 7/18/97 msd Selector for PBCreateAttribute conflicts with PBGetXCatInfo. The
- attribute calls now have selectors in the range $65..$69.
- <CS1> 7/16/97 DSH first checked in
- <CS23> 7/8/97 DSH Added LockMappingTable() until its moved into the Unicode header
- files.
- <CS22> 7/7/97 DSH Taking out changes made in HFS <45> for greater compatability
- with the Tempo installer.
- <CS21> 6/27/97 msd Add PBLongRename SPI. Add prototype for
- RenameCatalogNodeUnicode.
- <CS20> 6/26/97 DSH Conditionalized macro LocalToUTC to not look at FSVars for DFA.
- <CS19> 6/25/97 msd Add prototype for HFSCommunicationProc.
- <CS18> 6/24/97 DSH Adding runtime flags to deturmine unicode usage and installation
- status.
- <CS17> 6/24/97 djb Add linkCount to CatalogNodeData. Add LinkCatalogNode prototype.
- Move Private Catalog Manager prototypes to CatalogPrivate.h.
- <CS16> 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.
- <CS14> 6/17/97 msd The conversions between local time and UTC have the sign of the
- offset backwards.
- <CS13> 6/13/97 djb Removed PrepareOutputName. Changed parameters for
- DeleteCatalogNode, MoveCatalogNode, PrepareInputName. Add
- private catalog macros.
- <CS12> 6/12/97 msd Export BlockAllocateAny and UpdateVCBFreeBlks.
- <CS11> 6/12/97 msd Add a parameter block and prototype for an SPI to create very
- large files.
- <CS10> 6/9/97 msd Add an offsetToUTC field to FSVarsRec. Add prototypes for
- GetTimeUTC and GetTimeLocal; add macros for LocalToUTC and
- UTCToLocal.
- <CS9> 6/5/97 msd Add MapLogicalToPhysical (internal routine), PBMapFilePosition
- for external use.
- <CS8> 6/4/97 djb More Unicode converter changes (support for non roman scripts).
- <CS7> 6/2/97 msd Add prototype for AdjustEOF.
- <CS6> 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.
- <CS5> 5/20/97 DSH Including LowMemPriv.a in DFA compiles
- <CS4> 5/19/97 djb Add uppLockMappingTable to FSVars.
- <CS3> 5/19/97 djb Add CreateVolumeCatalogCache and DisposeVolumeCatalogCache
- prototypes. Remove private CatalogDataCache structure.
- <CS2> 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.
- <CS1> 5/9/97 djb first checked in
- <CS2> 5/7/97 djb Add summary trace data. Shrink FSVars.later to 4 longs.
- <CS1> 4/28/97 djb first checked in
+ Copyright: © 1996-2001 by Apple Computer, Inc., all rights reserved.
*/
#ifndef __FILEMGRINTERNAL__
/* 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*/
};
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*/
-
-/*\80\80 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*/
};
};
-/* 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 {
};
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
#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);
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)*/
ConstUTF8Param name,
UInt32 nodeType,
HFSCatalogNodeID * catalogNodeID,
- UInt32 * catalogHint);
+ UInt32 * catalogHint,
+ UInt32 teHint);
EXTERN_API_C( OSErr )
DeleteCatalogNode (ExtendedVCB * volume,
UInt32 srcHint,
HFSCatalogNodeID dstParentID,
ConstUTF8Param dstName,
- UInt32 * newHint);
+ UInt32 * newHint,
+ UInt32 teHint);
EXTERN_API_C( OSErr )
UpdateCatalogNode (ExtendedVCB * volume,
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,
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,
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);
ExtendFileC (ExtendedVCB * vcb,
FCB * fcb,
SInt64 bytesToAdd,
+ UInt32 blockHint,
UInt32 flags,
SInt64 * actualBytesAdded);
FCB * fcb,
UInt32 nodeSize);
#endif
-EXTERN_API_C( void )
-AdjustEOF (FCB * sourceFCB);
/* Utility routines*/
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);
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