23#ifndef STORAGE_PARTITION_TABLE_H
24#define STORAGE_PARTITION_TABLE_H
29#include "storage/Utils/Swig.h"
30#include "storage/Utils/Region.h"
31#include "storage/Utils/Alignment.h"
32#include "storage/Devices/Device.h"
33#include "storage/Devices/Partition.h"
43 UNKNOWN, LOOP, MSDOS, GPT, DASD, MAC, IMPLICIT, AIX, SUN, ATARI, BSD, AMIGA, DVH
67 unsigned nr()
const ST_DEPRECATED {
return number; }
72 bool primary_possible;
74 bool extended_possible;
76 bool logical_possible;
80 friend std::ostream& operator<<(std::ostream& s,
const PartitionSlot& partition_slot);
87 class PartitionTable :
public Device
140 unsigned int num_primary()
const;
141 bool has_extended()
const;
142 unsigned int num_logical()
const;
235 const Impl& get_impl()
const;
239 PartitionTable(Impl* impl);
A class to calculate partition alignment based on hardware topology.
Definition Alignment.h:92
An abstract base class for storage devices.
Definition Device.h:82
Definition PartitionTable.h:88
unsigned int max_logical() const
Highest number for a logical partition.
std::vector< const Partition * > get_partitions() const
Get the partitions of the partition table.
const Partition * get_extended() const
Returns the extended partition of the partition table.
std::vector< PartitionSlot > get_unused_partition_slots(AlignPolicy align_policy=AlignPolicy::ALIGN_START_KEEP_END, AlignType align_type=AlignType::OPTIMAL) const
std::vector< Partition * > get_partitions()
Get the partitions of the partition table.
bool extended_possible() const
Returns whether a extended partition is supported.
Region align(const Region ®ion, AlignPolicy align_policy=AlignPolicy::ALIGN_START_AND_END, AlignType align_type=AlignType::OPTIMAL) const
region is sector-based.
PtType get_type() const
Get the partition type.
const Partitionable * get_partitionable() const
Return the partitionable of the partition table.
Partition * get_partition(const std::string &name)
bool is_partition_no_automount_flag_supported() const
Returns whether the no-automount flag is supported on partitions on the partition table.
bool is_partition_id_supported(unsigned int id) const
Returns whether the partition id is supported on the partition table.
unsigned int max_primary() const
Highest number for a primary or extended partition.
Partitionable * get_partitionable()
Return the partitionable of the partition table.
Partition * create_partition(const std::string &name, const Region ®ion, PartitionType type)
region is sector-based.
bool is_partition_legacy_boot_flag_supported() const
Returns whether the legacy boot flag is supported on partitions on the partition table.
void delete_partition(Partition *partition)
Delete a partition in the partition table.
bool is_partition_boot_flag_supported() const
Returns whether the boot flag is supported on partitions on the partition table.
A partition of a Partitionable, e.g.
Definition Partition.h:281
Definition Partitionable.h:40
A start/length pair with a block size.
Definition Region.h:85
The storage namespace.
Definition Actiongraph.h:40
PtType
Partition Table Type.
Definition PartitionTable.h:42
PartitionTable * to_partition_table(Device *device)
Converts pointer to Device to pointer to PartitionTable.
PartitionType
Enum with partition types.
Definition Partition.h:43
AlignType
Definition Alignment.h:37
@ OPTIMAL
Align to topology information.
Definition Alignment.h:46
bool is_partition_table(const Device *device)
Checks whether device points to a PartitionTable.
AlignPolicy
Definition Alignment.h:51
@ ALIGN_START_AND_END
Align start and end.
Definition Alignment.h:55
@ ALIGN_START_KEEP_END
Align start and keep end.
Definition Alignment.h:61
std::string get_pt_type_name(PtType pt_type)
Convert the PtType pt_type to a string.