24 #ifndef STORAGE_PARTITION_H
25 #define STORAGE_PARTITION_H
28 #include "storage/Devices/BlkDevice.h"
192 unsigned int get_id()
const;
290 const Impl& get_impl()
const;
292 virtual Partition* clone()
const override;
static bool compare_by_number(const Partition *lhs, const Partition *rhs)
Compare (less than) two Partitions by number.
A partition of a Partitionable, e.g.
Definition: Partition.h:156
std::string get_partition_id_name(IdNum partition_id)
Convert the IdNum partition_id to a string.
@ ID_WINDOWS_BASIC_DATA
Windows basic data partition, only for GPT.
Definition: Partition.h:134
Definition: Partitionable.h:40
@ ID_ESP
EFI System Partition, for MS-DOS and GPT.
Definition: Partition.h:124
A start/length pair with a block size.
Definition: Region.h:74
const std::string & get_label() const
Get the partition label.
@ ID_DOS32
Only for MS-DOS.
Definition: Partition.h:97
@ ID_MICROSOFT_RESERVED
Microsoft reserved partition, only for GPT.
Definition: Partition.h:137
@ ID_RAID
RAID partition, for MS-DOS, GPT and DASD.
Definition: Partition.h:121
void set_type(PartitionType type)
Set the partiton type.
bool is_partition(const Device *device)
Checks whether device points to a Partition.
@ PRIMARY
Primary partition.
@ ID_NTFS
Only for MS-DOS.
Definition: Partition.h:94
The storage namespace.
Definition: Actiongraph.h:39
void set_id(unsigned int id)
static const Partition * find_by_name(const Devicegraph *devicegraph, const std::string &name)
Find a Partition by its name.
PartitionType
Enum with partition types.
Definition: Partition.h:41
@ ID_UNKNOWN
Only set during probing.
Definition: Partition.h:127
Definition: PartitionTable.h:88
@ ID_EXTENDED
Only for MS-DOS.
Definition: Partition.h:100
const std::string & get_uuid() const
Get the partition UUID.
std::string get_partition_type_name(PartitionType partition_type)
Convert the PartitionType partition_type to a string.
void set_boot(bool boot)
Set the boot flag of the partition.
Region get_unused_surrounding_region() const
Returns the unused region surrounding the partition (including the partition itself).
PartitionType get_type() const
Get the partition type.
An abstract Block Device.
Definition: BlkDevice.h:47
@ ID_LVM
LVM partition, for MS-DOS, GPT and DASD.
Definition: Partition.h:118
The main container of the libstorage-ng.
Definition: Devicegraph.h:170
@ ID_DOS16
Only for MS-DOS.
Definition: Partition.h:91
@ ID_BIOS_BOOT
BIOS boot partition (https://en.wikipedia.org/wiki/BIOS_boot_partition), only for GPT.
Definition: Partition.h:131
@ ID_DIAG
For MS-DOS and GPT.
Definition: Partition.h:103
const Partitionable * get_partitionable() const
Return the partitionable the partition belongs to.
An abstract base class for storage devices.
Definition: Device.h:82
@ ID_LINUX
For MS-DOS, GPT, DASD and implicit.
Definition: Partition.h:112
const PartitionTable * get_partition_table() const
Return the partition table the partition belongs to.
@ ID_DOS12
Only for MS-DOS.
Definition: Partition.h:88
void set_legacy_boot(bool legacy_boot)
Set the legacy boot flag of the partition.
static Partition * create(Devicegraph *devicegraph, const std::string &name, const Region ®ion, PartitionType type)
Create a device of type Partition.
@ ID_IRST
Intel Rapid Start Technology, for MS-DOS and GPT.
Definition: Partition.h:115
unsigned int get_number() const
Get the partition number.
static Partition * find_by_name(Devicegraph *devicegraph, const std::string &name)
Find a Partition by its name.
Partition * to_partition(Device *device)
Converts pointer to Device to pointer to Partition.
bool is_boot() const
Query the boot flag of the partition.
bool is_legacy_boot() const
Query the legacy boot flag of the partition.
@ ID_PREP
PPC PReP Boot partition, for MS-DOS and GPT.
Definition: Partition.h:106
@ ID_SWAP
Swap partition, for MS-DOS, GPT and DASD.
Definition: Partition.h:109
IdNum
Enum with values used as partition ids.
Definition: Partition.h:85