User:Finxx/HFS+: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
Content added Content deleted
(Created page with "{{Filesystems}} HFS+ is the successor to HFS, and was introduced by Apple in Mac OS 8.1. It has support for larger disks and allows for more than 65,000 files. It also has...")
 
No edit summary
Line 1: Line 1:
{{Filesystems}}
{{Filesystems}}
HFS+ is the successor to [[HFS]], and was introduced by Apple in Mac OS 8.1. It has support for larger disks and allows for more than 65,000 files. It also has support for [[journaling]]. The format is described in Apple's "legacy" documentation, as TN1150.
HFS+ is the successor to [[HFS]], and was introduced by Apple in Mac OS 8.1. It has support for larger disks and allows for more than 65,000 files. It also has support for [[journaling]]. The format is described in Apple's "legacy" documentation, as TN1150.

== Concepts ==
Files in HFS+ as stored in what are called "forks". Data is stored in "allocation blocks".
<source lang="c">
struct HFSPlusExtentDescriptor {
UInt32 startBlock;
UInt32 blockCount;
};
typedef struct HFSPlusExtentDescriptor HFSPlusExtentDescriptor;

struct HFSPlusForkData {
UInt64 logicalSize;
UInt32 clumpSize;
UInt32 totalBlocks;
HFSPlusExtentRecord extents; // additional extents are in extent overflow
};
typedef struct HFSPlusForkData HFSPlusForkData;
typedef HFSPlusExtentDescriptor HFSPlusExtentRecord[8];
</source>


== Structure ==
== Structure ==
{| class="wikitable"
|-
! Offset !! Size !! Description
|-
| 0 || 2 || Reserved
|-
| 2 || 1 || Volume Header
|-
| 3 || ... || Files
|-
| Last - 1 || 1 || Volume Header backup
|-
| Last || 1 || Reserved
|-
|}


<source lang="c">
struct HFSPlusVolumeHeader {
UInt16 signature;
UInt16 version;
UInt32 attributes;
UInt32 lastMountedVersion;
UInt32 journalInfoBlock;
UInt32 createDate;
UInt32 modifyDate;
UInt32 backupDate;
UInt32 checkedDate;
UInt32 fileCount;
UInt32 folderCount;
UInt32 blockSize;
UInt32 totalBlocks;
UInt32 freeBlocks;
UInt32 nextAllocation;
UInt32 rsrcClumpSize;
UInt32 dataClumpSize;
HFSCatalogNodeID nextCatalogID;
UInt32 writeCount;
UInt64 encodingsBitmap;
UInt32 finderInfo[8];
HFSPlusForkData allocationFile;
HFSPlusForkData extentsFile;
HFSPlusForkData catalogFile;
HFSPlusForkData attributesFile;
HFSPlusForkData startupFile;
};
typedef struct HFSPlusVolumeHeader HFSPlusVolumeHeader;
</source>


== External Links ==
== External Links ==

Revision as of 13:46, 28 March 2024

Filesystems
Virtual Filesystems

VFS

Disk Filesystems
CD/DVD Filesystems
Network Filesystems
Flash Filesystems

HFS+ is the successor to HFS, and was introduced by Apple in Mac OS 8.1. It has support for larger disks and allows for more than 65,000 files. It also has support for journaling. The format is described in Apple's "legacy" documentation, as TN1150.

Concepts

Files in HFS+ as stored in what are called "forks". Data is stored in "allocation blocks".

struct HFSPlusExtentDescriptor {
    UInt32                  startBlock;
    UInt32                  blockCount;
};
typedef struct HFSPlusExtentDescriptor HFSPlusExtentDescriptor;

struct HFSPlusForkData {
    UInt64                  logicalSize;
    UInt32                  clumpSize;
    UInt32                  totalBlocks;
    HFSPlusExtentRecord     extents; // additional extents are in extent overflow
};
typedef struct HFSPlusForkData HFSPlusForkData;
 
typedef HFSPlusExtentDescriptor HFSPlusExtentRecord[8];

Structure

Offset Size Description
0 2 Reserved
2 1 Volume Header
3 ... Files
Last - 1 1 Volume Header backup
Last 1 Reserved
struct HFSPlusVolumeHeader {
    UInt16              signature;
    UInt16              version;
    UInt32              attributes;
    UInt32              lastMountedVersion;
    UInt32              journalInfoBlock;
 
    UInt32              createDate;
    UInt32              modifyDate;
    UInt32              backupDate;
    UInt32              checkedDate;
 
    UInt32              fileCount;
    UInt32              folderCount;
 
    UInt32              blockSize;
    UInt32              totalBlocks;
    UInt32              freeBlocks;
 
    UInt32              nextAllocation;
    UInt32              rsrcClumpSize;
    UInt32              dataClumpSize;
    HFSCatalogNodeID    nextCatalogID;
 
    UInt32              writeCount;
    UInt64              encodingsBitmap;
 
    UInt32              finderInfo[8];
 
    HFSPlusForkData     allocationFile;
    HFSPlusForkData     extentsFile;
    HFSPlusForkData     catalogFile;
    HFSPlusForkData     attributesFile;
    HFSPlusForkData     startupFile;
};
typedef struct HFSPlusVolumeHeader HFSPlusVolumeHeader;

External Links