liblp.partition_opener

Classes

BlockDeviceInfo([partition_name, size, ...])

IPartitionOpener()

Test-friendly interface for interacting with partitions.

PartitionOpener()

Helper class to implement IPartitionOpener.

class liblp.partition_opener.BlockDeviceInfo(partition_name: str = '', size: int = 0, alignment: int = 0, alignment_offset: int = 0, logical_block_size: int = 0)
class liblp.partition_opener.IPartitionOpener

Test-friendly interface for interacting with partitions.

GetDeviceString(partition_name: str) str

Return a path that can be used to pass the block device to device-mapper. This must either result in an absolute path, or a major:minor device sequence.

GetInfo(partition_name: str) BlockDeviceInfo

Return block device information about the given named physical partition. The name can be an absolute path if the full path is already known.

Note: Signature should have been GetInfo(self, partition_name: str, info: BlockDeviceInfo) -> bool

For obvious reasons, we directly return a BlockDeviceInfo object or None if it failed.

Open(partition_name: str, flags: int) BufferedIOBase

Open the given named physical partition with the provided open() flags. The name can be an absolute path if the full path is already known.

class liblp.partition_opener.PartitionOpener

Helper class to implement IPartitionOpener. If |partition_name| is not an absolute path, /dev/block/by-name/ will be prepended.

GetDeviceString(partition_name: str) str

Return a path that can be used to pass the block device to device-mapper. This must either result in an absolute path, or a major:minor device sequence.

GetInfo(partition_name: str) BlockDeviceInfo

Return block device information about the given named physical partition. The name can be an absolute path if the full path is already known.

Note: Signature should have been GetInfo(self, partition_name: str, info: BlockDeviceInfo) -> bool

For obvious reasons, we directly return a BlockDeviceInfo object or None if it failed.

Open(partition_name: str, flags: int) BufferedIOBase

Open the given named physical partition with the provided open() flags. The name can be an absolute path if the full path is already known.