boredzo / impluse-hfs

A tool for converting HFS (Mac OS Standard) volumes to HFS+ (Mac OS Extended) format.
BSD 3-Clause "New" or "Revised" License
43 stars 1 forks source link

Partition map rewriter #61

Open boredzo opened 4 months ago

boredzo commented 4 months ago

There are two cases in which impluse may need to make changes to a partition map:

boredzo commented 4 months ago

One thing that may be important/necessary is including a driver in the rewritten partition map.

My default inclination is to transfer any and all drivers from the original partition map. When it's an IM5 partition map and we're just resizing a partition, that should be fine. When it's an IM4 partition map, that may get trickier—a driver included in an IM4 partition map might try to read the disk's partition map, and panic (or, worse, corrupt data) if the partition map is in a different format.

boredzo commented 3 months ago

One consequence of this is that the converter should not simply copy any bytes before and after the volume. Those should be left to the partition map copier/rewriter to copy anything not in a partition or in a non-HFS partition.

Also part of this work: Finally deciding what impluse does for multiple HFS partitions. My guess is going to be to convert all HFS partitions by default, maybe with an option like --only-partition[s] that specifies one or more partitions by either order in the partition map, partition name, or volume name.

Possible optional syntax: <partition type>:<partition/volume name>. Like, Apple_HFS:Macintosh HD. Dunno if there's a need for that.

Also, partition: and volume: prefixes before partition/volume names, with p: and v: accepted as synonyms. So the partition-spec syntax would be (?P<partition_type>[^:]+:)?(?P<key_prefix>(?:partition|p|volume|v):)?(?P<name>.+). Valid partition-specs would include Macintosh HD, v:Macintosh HD, Apple_HFS:Macintosh HD, and the fully-qualified Apple_HFS:v:Macintosh HD.