apfs::partition

class partition : public apfs::partition_info_t

Represents an APFS partition.

A disk may contain multiple partitions, potentially using different filesystems such as APFS, NTFS, or exFAT. This class represents one partition that contains an APFS container that begins with an nx_superblock_t.

Public Functions

partition(const std::string &filename)

Constructs an APFS partition from a stream whose first block contains an nx_superblock_t.

Use this overload when the supplied stream begins directly at an APFS container superblock, rather than at the beginning of a full disk or disk image. This is not usually the case. Note that if you use this constructor, the fields in partition_info_t will remain unpopulated Alternatively, use disk to obtain a partition.

volume &get_volume(const std::string &volname)

Search for a volume by name.

Public Members

uint64_t num_blocks

Number of blocks.

uint32_t block_size

Size of each block.

uint64_t bytes_used

The total number of bytes used: is just the sum of all volume sizes.

std::vector<volume> volumes

A vector of all the volumes present on this partition.