Annotation of kernel/bsd/hfs/hfscommon/headers/HFSVolumes.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:           HFSVolumes.h
        !            27:  
        !            28:        Contains:       On-disk data structures for HFS and HFS Plus volumes.
        !            29: 
        !            30:        Version:        Mac OS 8.1
        !            31: 
        !            32:        Copyright:      � 1984-1998 by Apple Computer, Inc.  All rights reserved.
        !            33: 
        !            34:        File Ownership:
        !            35: 
        !            36:                DRI:               Mark Day
        !            37: 
        !            38:                Other Contacts:    Deric Horn
        !            39: 
        !            40:                Technology:        File Systems
        !            41: 
        !            42:        Writers:
        !            43: 
        !            44:                (ngk)   Nick Kledzik
        !            45:                (gap)   george puckett
        !            46:                (djb)   Don Brady
        !            47:                (msd)   Mark Day
        !            48:                (DSH)   Deric Horn
        !            49: 
        !            50:        Change History (most recent first):
        !            51: 
        !            52:        From HFSVolumes.i:
        !            53: 
        !            54:          <Rhap>          4/9/98        djb             Use a different kHFSPlusMountVersion for Rhapsody.
        !            55: 
        !            56:                 <2>     2/12/98        ngk             Clean up: add version field in this header, change Types.i to
        !            57:                                                                        MacTypes.i, remove pragma comments, remove unnecesarry typedef
        !            58:                                                                        struct Foo Foo statements.
        !            59:                 <1>      2/9/98        msd             first checked in
        !            60:                 <0>      2/5/98        msd             Imported from HFSVolumesPriv.i.  Added "HFS" to many names.
        !            61:                                                                        Added reserved field to HFSPlusAttrInlineData.
        !            62: 
        !            63:        From HFSVolumesPriv.i:
        !            64:        
        !            65:          <CS19>        11/16/97        djb             Bump volume format version for Unicode changes.
        !            66:          <CS18>        10/23/97        msd             Bug 1685113. Change kHFSPlusMountVersion to '8.10' to trigger
        !            67:                                                                        MountCheck; it also happens to be a more correct value.
        !            68:          <CS17>        10/19/97        msd             Bug 1684586. Rename modifyDate to attributeModDate. GetCatInfo
        !            69:                                                                        and SetCatInfo use only contentModDate.
        !            70:          <CS16>         9/19/97        msd             Fix bug 1679778. In the LargeCatalogFile structure, change the
        !            71:                                                                        name of the linkCount field to "reserved1" since we no longer
        !            72:                                                                        support hard links.
        !            73:          <CS15>         9/10/97        msd             Make sure fork and extent information is 8-byte aligned in
        !            74:                                                                        attribute records.
        !            75:          <CS14>          9/4/97        msd             Attributes are now identified by a single Unicode string (flags
        !            76:                                                                        and OSTypes are gone), and may have extents (allowing them to be
        !            77:                                                                        very large). Removed C define of bitmapFile. Removed
        !            78:                                                                        kVolumeHardLinksBit. Added field lastMountedVersion to
        !            79:                                                                        VolumeHeader; moved unused space near start of structure to make
        !            80:                                                                        following fields nicely aligned. LargeExtentKey's keyLength is
        !            81:                                                                        now a UInt16, like all the rest of the HFS Plus B-Trees. Change
        !            82:                                                                        kHFSPlusVersion to $0003.
        !            83:          <CS13>          9/2/97        DSH             Moved the VolumeHeader to sector 2 of HFS+ partition, bumped
        !            84:                                                                        kHFSPlusVersion to 0X0002.
        !            85:          <CS12>          8/5/97        msd             Change kHFSPlusSigWord to $482B ('H+'). Add enum for
        !            86:                                                                        kHFSPlusVersion (set to $0001).
        !            87:          <CS11>         6/24/97        djb             Add link count to HFS Plus file record. Add kVolumeHardLinksBit.
        !            88:          <CS10>         6/20/97        msd             Remove the define for contentModDate.
        !            89:           <CS9>         6/12/97        djb             Removed rootFileCount and rootFolderCount. Added new dates,
        !            90:                                                                        permissions, and encodingBitmap, changed signature to "D8".
        !            91:           <CS8>          6/6/97        djb             Removed enum names and #pragma enumsalwaysint.
        !            92:           <CS7>          6/4/97        gap             Removed ForBride conditional. Caused problem in
        !            93:                                                                        HFSVolumesPriv.a.
        !            94:           <CS6>          6/4/97        gap             Add #pragma enumsalwaysint so file will work with latest
        !            95:                                                                        Interfacer tool in Bride build.
        !            96:           <CS5>         5/30/97        djb             Add constants for minimum key lengths.
        !            97:           <CS4>         5/28/97        msd             Add AttributeKey and associated enums.
        !            98:           <CS3>         5/20/97        DSH             Keep sigWord in sync with last build, D5.
        !            99:           <CS2>         5/15/97        msd             Key length and fork type for extent records should be unsigned.
        !           100:           <CS1>         4/28/97        djb             first checked in
        !           101: 
        !           102:          <HFS7>          4/7/97        msd             Add FileID for attributes BTree.
        !           103:          <HFS6>          4/4/97        djb             Major update to HFS Plus structures.
        !           104:          <HFS5>         3/17/97        DSH             Adding kNumHFSPlusExtents, and kNumHFSExtents.
        !           105:          <HFS4>         2/19/97        djb             Latest HFS Plus format changes. Removed B-Tree Manager data
        !           106:                                                                        structures since they're defined in BTreesPrivate.h.
        !           107:          <HFS3>         2/13/97        msd             Add unions for extent key and data.
        !           108:          <HFS2>         1/16/97        djb             Changed kLargeExtentKeyMaximumLength to 11.
        !           109:          <HFS1>          1/9/97        djb             first checked in
        !           110:                 <0>      1/7/97        djb             Converted from HFSVolumePriv.h file.
        !           111: */
        !           112: #ifndef __HFSVOLUMES__
        !           113: #define __HFSVOLUMES__
        !           114: 
        !           115: #if TARGET_OS_MAC
        !           116:        #ifndef __MACTYPES__
        !           117:        #include <MacTypes.h>
        !           118:        #endif
        !           119:        #ifndef __FILES__
        !           120:        #include <Files.h>
        !           121:        #endif
        !           122:        #ifndef __FINDER__
        !           123:        #include <Finder.h>
        !           124:        #endif
        !           125: #endif /* TARGET_OS_MAC */
        !           126: 
        !           127: #if TARGET_OS_RHAPSODY
        !           128:        #ifndef __MACOSTYPES__
        !           129:        #include <MacOSTypes.h>
        !           130:        #endif
        !           131:        #ifndef __MACOSSTUBS__
        !           132:        #include <MacOSStubs.h>
        !           133:        #endif
        !           134: #endif /* TARGET_OS_RHAPSODY */
        !           135: 
        !           136: 
        !           137: #if PRAGMA_ONCE
        !           138: #pragma once
        !           139: #endif
        !           140: 
        !           141: #ifdef __cplusplus
        !           142: extern "C" {
        !           143: #endif
        !           144: 
        !           145: #if PRAGMA_IMPORT
        !           146: #pragma import on
        !           147: #endif
        !           148: 
        !           149: #if PRAGMA_STRUCT_ALIGN
        !           150:        #pragma options align=mac68k
        !           151: #elif PRAGMA_STRUCT_PACKPUSH
        !           152:        #pragma pack(push, 2)
        !           153: #elif PRAGMA_STRUCT_PACK
        !           154:        #pragma pack(2)
        !           155: #endif
        !           156: 
        !           157: /* Signatures used to differentiate between HFS and HFS Plus volumes */
        !           158: 
        !           159: enum {
        !           160:        kHFSSigWord                                     = 0x4244,                                               /* 'BD' in ASCII */
        !           161:        kHFSPlusSigWord                         = 0x482B,                                               /* 'H+' in ASCII */
        !           162:        kHFSPlusVersion                         = 0x0004,                                               /* will change as format changes (version 4 shipped with Mac OS 8.1) */
        !           163: 
        !           164: #if TARGET_OS_MAC
        !           165:        kHFSPlusMountVersion            = FOUR_CHAR_CODE('8.10')                /* will change as implementations change ('8.10' in Mac OS 8.1) */
        !           166: #endif
        !           167: 
        !           168: #if TARGET_OS_RHAPSODY
        !           169:        kHFSPlusMountVersion            = FOUR_CHAR_CODE('9.00')                /* will change as implementations change */
        !           170: #endif
        !           171: 
        !           172: 
        !           173: };
        !           174: 
        !           175: 
        !           176: /* CatalogNodeID is used to track catalog objects */
        !           177: typedef UInt32                                                         HFSCatalogNodeID;
        !           178: /* Unicode strings are used for file and folder names (HFS Plus only) */
        !           179: 
        !           180: struct HFSUniStr255 {
        !           181:        UInt16                                                  length;                                         /* number of unicode characters */
        !           182:        UniChar                                                 unicode[255];                           /* unicode characters */
        !           183: };
        !           184: typedef struct HFSUniStr255                            HFSUniStr255;
        !           185: 
        !           186: typedef const HFSUniStr255 *                   ConstHFSUniStr255Param;
        !           187: 
        !           188: enum {
        !           189:        kHFSMaxVolumeNameChars          = 27,
        !           190:        kHFSMaxFileNameChars            = 31,
        !           191:        kHFSPlusMaxFileNameChars        = 255
        !           192: };
        !           193: 
        !           194: 
        !           195: /* Extent overflow file data structures */
        !           196: /* HFS Extent key */
        !           197: 
        !           198: struct HFSExtentKey {
        !           199:        UInt8                                                   keyLength;                                      /* length of key, excluding this field */
        !           200:        UInt8                                                   forkType;                                       /* 0 = data fork, FF = resource fork */
        !           201:        HFSCatalogNodeID                                fileID;                                         /* file ID */
        !           202:        UInt16                                                  startBlock;                                     /* first file allocation block number in this extent */
        !           203: };
        !           204: typedef struct HFSExtentKey                            HFSExtentKey;
        !           205: /* HFS Plus Extent key */
        !           206: 
        !           207: struct HFSPlusExtentKey {
        !           208:        UInt16                                                  keyLength;                                      /* length of key, excluding this field */
        !           209:        UInt8                                                   forkType;                                       /* 0 = data fork, FF = resource fork */
        !           210:        UInt8                                                   pad;                                            /* make the other fields align on 32-bit boundary */
        !           211:        HFSCatalogNodeID                                fileID;                                         /* file ID */
        !           212:        UInt32                                                  startBlock;                                     /* first file allocation block number in this extent */
        !           213: };
        !           214: typedef struct HFSPlusExtentKey                        HFSPlusExtentKey;
        !           215: /* Number of extent descriptors per extent record */
        !           216: 
        !           217: enum {
        !           218:        kHFSExtentDensity                       = 3,
        !           219:        kHFSPlusExtentDensity           = 8
        !           220: };
        !           221: 
        !           222: /* HFS extent descriptor */
        !           223: 
        !           224: struct HFSExtentDescriptor {
        !           225:        UInt16                                                  startBlock;                                     /* first allocation block */
        !           226:        UInt16                                                  blockCount;                                     /* number of allocation blocks */
        !           227: };
        !           228: typedef struct HFSExtentDescriptor             HFSExtentDescriptor;
        !           229: /* HFS Plus extent descriptor */
        !           230: 
        !           231: struct HFSPlusExtentDescriptor {
        !           232:        UInt32                                                  startBlock;                                     /* first allocation block */
        !           233:        UInt32                                                  blockCount;                                     /* number of allocation blocks */
        !           234: };
        !           235: typedef struct HFSPlusExtentDescriptor HFSPlusExtentDescriptor;
        !           236: /* HFS extent record */
        !           237: 
        !           238: typedef HFSExtentDescriptor                    HFSExtentRecord[3];
        !           239: /* HFS Plus extent record */
        !           240: typedef HFSPlusExtentDescriptor                HFSPlusExtentRecord[8];
        !           241: 
        !           242: /* Fork data info (HFS Plus only) - 80 bytes */
        !           243: 
        !           244: struct HFSPlusForkData {
        !           245:        UInt64                                                  logicalSize;                            /* fork's logical size in bytes */
        !           246:        UInt32                                                  clumpSize;                                      /* fork's clump size in bytes */
        !           247:        UInt32                                                  totalBlocks;                            /* total blocks used by this fork */
        !           248:        HFSPlusExtentRecord                     extents;                                        /* initial set of extents */
        !           249: };
        !           250: typedef struct HFSPlusForkData                 HFSPlusForkData;
        !           251: /* Permissions info (HFS Plus only) - 16 bytes */
        !           252: 
        !           253: struct HFSPlusPermissions {
        !           254:        UInt32                                                  ownerID;                                        /* user or group ID of file/folder owner */
        !           255:        UInt32                                                  groupID;                                        /* additional user of group ID */
        !           256:        UInt32                                                  permissions;                            /* permissions (bytes: unused, owner, group, everyone) */
        !           257:        UInt32                                                  specialDevice;                          /* UNIX: device for character or block special file */
        !           258: };
        !           259: typedef struct HFSPlusPermissions              HFSPlusPermissions;
        !           260: /* Catalog file data structures */
        !           261: 
        !           262: enum {
        !           263:        kHFSRootParentID                        = 1,                                                    /* Parent ID of the root folder */
        !           264:        kHFSRootFolderID                        = 2,                                                    /* Folder ID of the root folder */
        !           265:        kHFSExtentsFileID                       = 3,                                                    /* File ID of the extents file */
        !           266:        kHFSCatalogFileID                       = 4,                                                    /* File ID of the catalog file */
        !           267:        kHFSBadBlockFileID                      = 5,                                                    /* File ID of the bad allocation block file */
        !           268:        kHFSAllocationFileID            = 6,                                                    /* File ID of the allocation file (HFS Plus only) */
        !           269:        kHFSStartupFileID                       = 7,                                                    /* File ID of the startup file (HFS Plus only) */
        !           270:        kHFSAttributesFileID            = 8,                                                    /* File ID of the attribute file (HFS Plus only) */
        !           271:        kHFSBogusExtentFileID           = 15,                                                   /* Used for exchanging extents in extents file */
        !           272:        kHFSFirstUserCatalogNodeID      = 16
        !           273: };
        !           274: 
        !           275: 
        !           276: /* HFS catalog key */
        !           277: 
        !           278: struct HFSCatalogKey {
        !           279:        UInt8                                                   keyLength;                                      /* key length (in bytes) */
        !           280:        UInt8                                                   reserved;                                       /* reserved (set to zero) */
        !           281:        HFSCatalogNodeID                                parentID;                                       /* parent folder ID */
        !           282:        Str31                                                   nodeName;                                       /* catalog node name */
        !           283: };
        !           284: typedef struct HFSCatalogKey                   HFSCatalogKey;
        !           285: /* HFS Plus catalog key */
        !           286: 
        !           287: struct HFSPlusCatalogKey {
        !           288:        UInt16                                                  keyLength;                                      /* key length (in bytes) */
        !           289:        HFSCatalogNodeID                                parentID;                                       /* parent folder ID */
        !           290:        HFSUniStr255                                    nodeName;                                       /* catalog node name */
        !           291: };
        !           292: typedef struct HFSPlusCatalogKey               HFSPlusCatalogKey;
        !           293: 
        !           294: /* Catalog record types */
        !           295: 
        !           296: enum {
        !           297:                                                                                                                                /* HFS Catalog Records */
        !           298:        kHFSFolderRecord                        = 0x0100,                                               /* Folder record */
        !           299:        kHFSFileRecord                          = 0x0200,                                               /* File record */
        !           300:        kHFSFolderThreadRecord          = 0x0300,                                               /* Folder thread record */
        !           301:        kHFSFileThreadRecord            = 0x0400,                                               /* File thread record */
        !           302:                                                                                                                                /* HFS Plus Catalog Records */
        !           303:        kHFSPlusFolderRecord            = 1,                                                    /* Folder record */
        !           304:        kHFSPlusFileRecord                      = 2,                                                    /* File record */
        !           305:        kHFSPlusFolderThreadRecord      = 3,                                                    /* Folder thread record */
        !           306:        kHFSPlusFileThreadRecord        = 4                                                             /* File thread record */
        !           307: };
        !           308: 
        !           309: 
        !           310: /* Catalog file record flags */
        !           311: 
        !           312: enum {
        !           313:        kHFSFileLockedBit                       = 0x0000,                                               /* file is locked and cannot be written to */
        !           314:        kHFSFileLockedMask                      = 0x0001,
        !           315:        kHFSThreadExistsBit                     = 0x0001,                                               /* a file thread record exists for this file */
        !           316:        kHFSThreadExistsMask            = 0x0002
        !           317: };
        !           318: 
        !           319: 
        !           320: /* HFS catalog folder record - 70 bytes */
        !           321: 
        !           322: struct HFSCatalogFolder {
        !           323:        SInt16                                                  recordType;                                     /* record type */
        !           324:        UInt16                                                  flags;                                          /* folder flags */
        !           325:        UInt16                                                  valence;                                        /* folder valence */
        !           326:        HFSCatalogNodeID                                folderID;                                       /* folder ID */
        !           327:        UInt32                                                  createDate;                                     /* date and time of creation */
        !           328:        UInt32                                                  modifyDate;                                     /* date and time of last modification */
        !           329:        UInt32                                                  backupDate;                                     /* date and time of last backup */
        !           330:        DInfo                                                   userInfo;                                       /* Finder information */
        !           331:        DXInfo                                                  finderInfo;                                     /* additional Finder information */
        !           332:        UInt32                                                  reserved[4];                            /* reserved - set to zero */
        !           333: };
        !           334: typedef struct HFSCatalogFolder                        HFSCatalogFolder;
        !           335: /* HFS Plus catalog folder record - 88 bytes */
        !           336: 
        !           337: struct HFSPlusCatalogFolder {
        !           338:        SInt16                                                  recordType;                                     /* record type = HFS Plus folder record */
        !           339:        UInt16                                                  flags;                                          /* file flags */
        !           340:        UInt32                                                  valence;                                        /* folder's valence (limited to 2^16 in Mac OS) */
        !           341:        HFSCatalogNodeID                                folderID;                                       /* folder ID */
        !           342:        UInt32                                                  createDate;                                     /* date and time of creation */
        !           343:        UInt32                                                  contentModDate;                         /* date and time of last content modification */
        !           344:        UInt32                                                  attributeModDate;                       /* date and time of last attribute modification */
        !           345:        UInt32                                                  accessDate;                                     /* date and time of last access (Rhapsody only) */
        !           346:        UInt32                                                  backupDate;                                     /* date and time of last backup */
        !           347:        HFSPlusPermissions                              permissions;                            /* permissions (for Rhapsody) */
        !           348:        DInfo                                                   userInfo;                                       /* Finder information */
        !           349:        DXInfo                                                  finderInfo;                                     /* additional Finder information */
        !           350:        UInt32                                                  textEncoding;                           /* hint for name conversions */
        !           351:        UInt32                                                  reserved;                                       /* reserved - set to zero */
        !           352: };
        !           353: typedef struct HFSPlusCatalogFolder            HFSPlusCatalogFolder;
        !           354: /* HFS catalog file record - 102 bytes */
        !           355: 
        !           356: struct HFSCatalogFile {
        !           357:        SInt16                                                  recordType;                                     /* record type */
        !           358:        SInt8                                                   flags;                                          /* file flags */
        !           359:        SInt8                                                   fileType;                                       /* file type (unused ?) */
        !           360:        FInfo                                                   userInfo;                                       /* Finder information */
        !           361:        HFSCatalogNodeID                                fileID;                                         /* file ID */
        !           362:        UInt16                                                  dataStartBlock;                         /* not used - set to zero */
        !           363:        SInt32                                                  dataLogicalSize;                        /* logical EOF of data fork */
        !           364:        SInt32                                                  dataPhysicalSize;                       /* physical EOF of data fork */
        !           365:        UInt16                                                  rsrcStartBlock;                         /* not used - set to zero */
        !           366:        SInt32                                                  rsrcLogicalSize;                        /* logical EOF of resource fork */
        !           367:        SInt32                                                  rsrcPhysicalSize;                       /* physical EOF of resource fork */
        !           368:        UInt32                                                  createDate;                                     /* date and time of creation */
        !           369:        UInt32                                                  modifyDate;                                     /* date and time of last modification */
        !           370:        UInt32                                                  backupDate;                                     /* date and time of last backup */
        !           371:        FXInfo                                                  finderInfo;                                     /* additional Finder information */
        !           372:        UInt16                                                  clumpSize;                                      /* file clump size (not used) */
        !           373:        HFSExtentRecord                                 dataExtents;                            /* first data fork extent record */
        !           374:        HFSExtentRecord                                 rsrcExtents;                            /* first resource fork extent record */
        !           375:        UInt32                                                  reserved;                                       /* reserved - set to zero */
        !           376: };
        !           377: typedef struct HFSCatalogFile                  HFSCatalogFile;
        !           378: /* HFS Plus catalog file record - 248 bytes */
        !           379: 
        !           380: struct HFSPlusCatalogFile {
        !           381:        SInt16                                                  recordType;                                     /* record type = HFS Plus file record */
        !           382:        UInt16                                                  flags;                                          /* file flags */
        !           383:        UInt32                                                  reserved1;                                      /* reserved - set to zero */
        !           384:        HFSCatalogNodeID                                fileID;                                         /* file ID */
        !           385:        UInt32                                                  createDate;                                     /* date and time of creation */
        !           386:        UInt32                                                  contentModDate;                         /* date and time of last content modification */
        !           387:        UInt32                                                  attributeModDate;                       /* date and time of last attribute modification */
        !           388:        UInt32                                                  accessDate;                                     /* date and time of last access (Rhapsody only) */
        !           389:        UInt32                                                  backupDate;                                     /* date and time of last backup */
        !           390:        HFSPlusPermissions                              permissions;                            /* permissions (for Rhapsody) */
        !           391:        FInfo                                                   userInfo;                                       /* Finder information */
        !           392:        FXInfo                                                  finderInfo;                                     /* additional Finder information */
        !           393:        UInt32                                                  textEncoding;                           /* hint for name conversions */
        !           394:        UInt32                                                  reserved2;                                      /* reserved - set to zero */
        !           395: 
        !           396:                                                                                                                                /* start on double long (64 bit) boundry */
        !           397:        HFSPlusForkData                                 dataFork;                                       /* size and block data for data fork */
        !           398:        HFSPlusForkData                                 resourceFork;                           /* size and block data for resource fork */
        !           399: };
        !           400: typedef struct HFSPlusCatalogFile              HFSPlusCatalogFile;
        !           401: /* HFS catalog thread record - 46 bytes */
        !           402: 
        !           403: struct HFSCatalogThread {
        !           404:        SInt16                                                  recordType;                                     /* record type */
        !           405:        SInt32                                                  reserved[2];                            /* reserved - set to zero */
        !           406:        HFSCatalogNodeID                                parentID;                                       /* parent ID for this catalog node */
        !           407:        Str31                                                   nodeName;                                       /* name of this catalog node */
        !           408: };
        !           409: typedef struct HFSCatalogThread                        HFSCatalogThread;
        !           410: /* HFS Plus catalog thread record -- 264 bytes */
        !           411: 
        !           412: struct HFSPlusCatalogThread {
        !           413:        SInt16                                                  recordType;                                     /* record type */
        !           414:        SInt16                                                  reserved;                                       /* reserved - set to zero */
        !           415:        HFSCatalogNodeID                                parentID;                                       /* parent ID for this catalog node */
        !           416:        HFSUniStr255                                    nodeName;                                       /* name of this catalog node (variable length) */
        !           417: };
        !           418: typedef struct HFSPlusCatalogThread            HFSPlusCatalogThread;
        !           419: 
        !           420: /*
        !           421:        These are the types of records in the attribute B-tree.  The values were chosen
        !           422:        so that they wouldn't conflict with the catalog record types.
        !           423: */
        !           424: 
        !           425: enum {
        !           426:        kHFSPlusAttrInlineData          = 0x10,                                                 /* if size <  kAttrOverflowSize */
        !           427:        kHFSPlusAttrForkData            = 0x20,                                                 /* if size >= kAttrOverflowSize */
        !           428:        kHFSPlusAttrExtents                     = 0x30                                                  /* overflow extents for large attributes */
        !           429: };
        !           430: 
        !           431: 
        !           432: /*
        !           433:        HFSPlusAttrInlineData
        !           434:        For small attributes, whose entire value is stored within this one
        !           435:        B-tree record.
        !           436:        There would not be any other records for this attribute.
        !           437: */
        !           438: 
        !           439: struct HFSPlusAttrInlineData {
        !           440:        UInt32                                                  recordType;                                     /*      = kHFSPlusAttrInlineData*/
        !           441:        UInt32                                                  reserved;
        !           442:        UInt32                                                  logicalSize;                            /*      size in bytes of userData*/
        !           443:        Byte                                                    userData[2];                            /*      variable length; space allocated is a multiple of 2 bytes*/
        !           444: };
        !           445: typedef struct HFSPlusAttrInlineData   HFSPlusAttrInlineData;
        !           446: /*
        !           447:        HFSPlusAttrForkData
        !           448:        For larger attributes, whose value is stored in allocation blocks.
        !           449:        If the attribute has more than 8 extents, there will be additonal
        !           450:        records (of type HFSPlusAttrExtents) for this attribute.
        !           451: */
        !           452: 
        !           453: struct HFSPlusAttrForkData {
        !           454:        UInt32                                                  recordType;                                     /*      = kHFSPlusAttrForkData*/
        !           455:        UInt32                                                  reserved;
        !           456:        HFSPlusForkData                                 theFork;                                        /*      size and first extents of value*/
        !           457: };
        !           458: typedef struct HFSPlusAttrForkData             HFSPlusAttrForkData;
        !           459: /*
        !           460:        HFSPlusAttrExtents
        !           461:        This record contains information about overflow extents for large,
        !           462:        fragmented attributes.
        !           463: */
        !           464: 
        !           465: struct HFSPlusAttrExtents {
        !           466:        UInt32                                                  recordType;                                     /*      = kHFSPlusAttrExtents*/
        !           467:        UInt32                                                  reserved;
        !           468:        HFSPlusExtentRecord                     extents;                                        /*      additional extents*/
        !           469: };
        !           470: typedef struct HFSPlusAttrExtents              HFSPlusAttrExtents;
        !           471: /*     A generic Attribute Record*/
        !           472: 
        !           473: union HFSPlusAttrRecord {
        !           474:        UInt32                                                  recordType;
        !           475:        HFSPlusAttrInlineData                   inlineData;
        !           476:        HFSPlusAttrForkData                     forkData;
        !           477:        HFSPlusAttrExtents                              overflowExtents;
        !           478: };
        !           479: typedef union HFSPlusAttrRecord                        HFSPlusAttrRecord;
        !           480: /* Key and node lengths */
        !           481: 
        !           482: enum {
        !           483:        kHFSPlusExtentKeyMaximumLength = sizeof(HFSPlusExtentKey) - sizeof(UInt16),
        !           484:        kHFSExtentKeyMaximumLength      = sizeof(HFSExtentKey) - sizeof(UInt8),
        !           485:        kHFSPlusCatalogKeyMaximumLength = sizeof(HFSPlusCatalogKey) - sizeof(UInt16),
        !           486:        kHFSPlusCatalogKeyMinimumLength = kHFSPlusCatalogKeyMaximumLength - sizeof(HFSUniStr255) + sizeof(UInt16),
        !           487:        kHFSCatalogKeyMaximumLength     = sizeof(HFSCatalogKey) - sizeof(UInt8),
        !           488:        kHFSCatalogKeyMinimumLength     = kHFSCatalogKeyMaximumLength - sizeof(Str31) + sizeof(UInt8),
        !           489:        kHFSPlusCatalogMinNodeSize      = 4096,
        !           490:        kHFSPlusExtentMinNodeSize       = 512,
        !           491:        kHFSPlusAttrMinNodeSize         = 4096
        !           492: };
        !           493: 
        !           494: 
        !           495: /* HFS and HFS Plus volume attribute bits */
        !           496: 
        !           497: enum {
        !           498:                                                                                                                                /* Bits 0-6 are reserved (always cleared by MountVol call) */
        !           499:        kHFSVolumeHardwareLockBit       = 7,                                                    /* volume is locked by hardware */
        !           500:        kHFSVolumeUnmountedBit          = 8,                                                    /* volume was successfully unmounted */
        !           501:        kHFSVolumeSparedBlocksBit       = 9,                                                    /* volume has bad blocks spared */
        !           502:        kHFSVolumeNoCacheRequiredBit = 10,                                                      /* don't cache volume blocks (i.e. RAM or ROM disk) */
        !           503:        kHFSBootVolumeInconsistentBit = 11,                                                     /* boot volume is inconsistent (System 7.6 and later) */
        !           504:                                                                                                                                /* Bits 12-14 are reserved for future use */
        !           505:        kHFSVolumeSoftwareLockBit       = 15,                                                   /* volume is locked by software */
        !           506:        kHFSVolumeHardwareLockMask      = 1 << kHFSVolumeHardwareLockBit,
        !           507:        kHFSVolumeUnmountedMask         = 1 << kHFSVolumeUnmountedBit,
        !           508:        kHFSVolumeSparedBlocksMask      = 1 << kHFSVolumeSparedBlocksBit,
        !           509:        kHFSVolumeNoCacheRequiredMask = 1 << kHFSVolumeNoCacheRequiredBit,
        !           510:        kHFSBootVolumeInconsistentMask = 1 << kHFSBootVolumeInconsistentBit,
        !           511:        kHFSVolumeSoftwareLockMask      = 1 << kHFSVolumeSoftwareLockBit,
        !           512:        kHFSMDBAttributesMask           = 0x8380
        !           513: };
        !           514: 
        !           515: 
        !           516: /* Master Directory Block (HFS only) - 162 bytes */
        !           517: /* Stored at sector #2 (3rd sector) */
        !           518: 
        !           519: struct HFSMasterDirectoryBlock {
        !           520: 
        !           521:                                                                                                                                /* These first fields are also used by MFS */
        !           522: 
        !           523:        UInt16                                                  drSigWord;                                      /* volume signature */
        !           524:        UInt32                                                  drCrDate;                                       /* date and time of volume creation */
        !           525:        UInt32                                                  drLsMod;                                        /* date and time of last modification */
        !           526:        UInt16                                                  drAtrb;                                         /* volume attributes */
        !           527:        SInt16                                                  drNmFls;                                        /* number of files in root folder */
        !           528:        UInt16                                                  drVBMSt;                                        /* first block of volume bitmap */
        !           529:        UInt16                                                  drAllocPtr;                                     /* start of next allocation search */
        !           530:        UInt16                                                  drNmAlBlks;                                     /* number of allocation blocks in volume */
        !           531:        SInt32                                                  drAlBlkSiz;                                     /* size (in bytes) of allocation blocks */
        !           532:        SInt32                                                  drClpSiz;                                       /* default clump size */
        !           533:        SInt16                                                  drAlBlSt;                                       /* first allocation block in volume */
        !           534:        UInt32                                                  drNxtCNID;                                      /* next unused catalog node ID */
        !           535:        SInt16                                                  drFreeBks;                                      /* number of unused allocation blocks */
        !           536:        Str27                                                   drVN;                                           /* volume name */
        !           537: 
        !           538:                                                                                                                                /* Master Directory Block extensions for HFS */
        !           539: 
        !           540:        UInt32                                                  drVolBkUp;                                      /* date and time of last backup */
        !           541:        UInt16                                                  drVSeqNum;                                      /* volume backup sequence number */
        !           542:        SInt32                                                  drWrCnt;                                        /* volume write count */
        !           543:        SInt32                                                  drXTClpSiz;                                     /* clump size for extents overflow file */
        !           544:        SInt32                                                  drCTClpSiz;                                     /* clump size for catalog file */
        !           545:        SInt16                                                  drNmRtDirs;                                     /* number of directories in root folder */
        !           546:        SInt32                                                  drFilCnt;                                       /* number of files in volume */
        !           547:        SInt32                                                  drDirCnt;                                       /* number of directories in volume */
        !           548:        SInt32                                                  drFndrInfo[8];                          /* information used by the Finder */
        !           549:        UInt16                                                  drEmbedSigWord;                         /* embedded volume signature (formerly drVCSize) */
        !           550:        HFSExtentDescriptor                     drEmbedExtent;                          /* embedded volume location and size (formerly drVBMCSize and drCtlCSize) */
        !           551:        SInt32                                                  drXTFlSize;                                     /* size of extents overflow file */
        !           552:        HFSExtentRecord                                 drXTExtRec;                                     /* extent record for extents overflow file */
        !           553:        SInt32                                                  drCTFlSize;                                     /* size of catalog file */
        !           554:        HFSExtentRecord                                 drCTExtRec;                                     /* extent record for catalog file */
        !           555: };
        !           556: typedef struct HFSMasterDirectoryBlock HFSMasterDirectoryBlock;
        !           557: 
        !           558: /* HFSPlusVolumeHeader (HFS Plus only) - 512 bytes */
        !           559: /* Stored at sector #2 (1st sector) and sector n-2 */
        !           560: 
        !           561: struct HFSPlusVolumeHeader {
        !           562:        UInt16                                                  signature;                                      /* volume signature == 'H+' */
        !           563:        UInt16                                                  version;                                        /* current version is kHFSPlusVersion */
        !           564:        UInt32                                                  attributes;                                     /* volume attributes */
        !           565:        UInt32                                                  lastMountedVersion;                     /* implementation version which last mounted volume */
        !           566:        UInt32                                                  reserved;                                       /* reserved - set to zero */
        !           567: 
        !           568:        UInt32                                                  createDate;                                     /* date and time of volume creation */
        !           569:        UInt32                                                  modifyDate;                                     /* date and time of last modification */
        !           570:        UInt32                                                  backupDate;                                     /* date and time of last backup */
        !           571:        UInt32                                                  checkedDate;                            /* date and time of last disk check */
        !           572: 
        !           573:        UInt32                                                  fileCount;                                      /* number of files in volume */
        !           574:        UInt32                                                  folderCount;                            /* number of directories in volume */
        !           575: 
        !           576:        UInt32                                                  blockSize;                                      /* size (in bytes) of allocation blocks */
        !           577:        UInt32                                                  totalBlocks;                            /* number of allocation blocks in volume (includes this header and VBM*/
        !           578:        UInt32                                                  freeBlocks;                                     /* number of unused allocation blocks */
        !           579: 
        !           580:        UInt32                                                  nextAllocation;                         /* start of next allocation search */
        !           581:        UInt32                                                  rsrcClumpSize;                          /* default resource fork clump size */
        !           582:        UInt32                                                  dataClumpSize;                          /* default data fork clump size */
        !           583:        HFSCatalogNodeID                                nextCatalogID;                          /* next unused catalog node ID */
        !           584: 
        !           585:        UInt32                                                  writeCount;                                     /* volume write count */
        !           586:        UInt64                                                  encodingsBitmap;                        /* which encodings have been use  on this volume */
        !           587: 
        !           588:        UInt8                                                   finderInfo[32];                         /* information used by the Finder */
        !           589: 
        !           590:        HFSPlusForkData                                 allocationFile;                         /* allocation bitmap file */
        !           591:        HFSPlusForkData                                 extentsFile;                            /* extents B-tree file */
        !           592:        HFSPlusForkData                                 catalogFile;                            /* catalog B-tree file */
        !           593:        HFSPlusForkData                                 attributesFile;                         /* extended attributes B-tree file */
        !           594:        HFSPlusForkData                                 startupFile;                            /* boot file */
        !           595: };
        !           596: typedef struct HFSPlusVolumeHeader             HFSPlusVolumeHeader;
        !           597: 
        !           598: #if PRAGMA_STRUCT_ALIGN
        !           599:        #pragma options align=reset
        !           600: #elif PRAGMA_STRUCT_PACKPUSH
        !           601:        #pragma pack(pop)
        !           602: #elif PRAGMA_STRUCT_PACK
        !           603:        #pragma pack()
        !           604: #endif
        !           605: 
        !           606: #ifdef PRAGMA_IMPORT_OFF
        !           607: #pragma import off
        !           608: #elif PRAGMA_IMPORT
        !           609: #pragma import reset
        !           610: #endif
        !           611: 
        !           612: #ifdef __cplusplus
        !           613: }
        !           614: #endif
        !           615: 
        !           616: #endif /* __HFSVOLUMES__ */

unix.superglobalmegacorp.com

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