boredzo/impluse-hfs

New verb: defragment

Opened this issue · 1 comments

So, impluse already uses a defragmenting converter for conversion from HFS to HFS+.

With #52, impluse will gain the ability to create HFS volumes. And it already can both read and write HFS+ volumes.

It seems like impluse should end up with the ability to read in any HFS or HFS+ volume, then do a defragmenting “conversion” to the same format, producing a defragmented but not really converted volume.

One possible use for this would be resizing partitions. Currently, shrinking a partition risks data loss if some of the lost space was occupied. But if the volume were defragmented by impluse, its free space would be redistributed to the end, and some shrinkage might be possible. (For this purpose, defragment should report the minimum viable size of the whole volume.)

There might be a refactoring opportunity here, where both ImpHFSVolume and ImpHFSPlusVolume come in immutable and mutable variants. (Currently, ImpHFSPlusVolume kind of is the mutable variant of ImpHFSVolume.)