apfs::disk

class disk

Represents a physical disk: such as a .dmg file or a plugged in drive.

The entry point into the APFS filesystem: used to get disk info and load partitions

Public Functions

disk(const std::string &filename)

Constructs a disk with a filename.

Opens it with “rb”.

Parameters:
const std::string &filename

The path to a .dmg file or a raw disk file, such as /dev/rdiskN on macOS and \\.\PhysicalDriveN on Windows.

disk(FILE *file)

Alternatively, you can construct a disk directly from an already opened C file stream.

Ownership is transferred to this class. The caller must not close or otherwise use the stream after passing it to this constructor.

Parameters:
FILE *file

An open C file stream positioned on the disk or disk image.

partition load_partition(const partition_info_t &part) const

Used to load a partition using an entry in the partitions array storing partition_info_t objects.

partition get_partition(const std::string &guid) const

Search for a partition by GUID.