libstorage-ng
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
storage::PartitionTable Class Reference
Inheritance diagram for storage::PartitionTable:
[legend]
Collaboration diagram for storage::PartitionTable:
[legend]

Public Member Functions

PtType get_type () const
 Get the partition type.
 
Partitioncreate_partition (const std::string &name, const Region &region, PartitionType type)
 region is sector-based.
 
void delete_partition (Partition *partition)
 Delete a partition in the partition table.
 
void delete_partition (const std::string &name) ST_DEPRECATED
 
unsigned int max_primary () const
 Highest number for a primary or extended partition.
 
bool extended_possible () const
 Returns whether a extended partition is supported.
 
unsigned int max_logical () const
 Highest number for a logical partition.
 
unsigned int num_primary () const
 
bool has_extended () const
 
unsigned int num_logical () const
 
std::vector< Partition * > get_partitions ()
 Get the partitions of the partition table.
 
std::vector< const Partition * > get_partitions () const
 Get the partitions of the partition table.
 
Partitionget_partition (const std::string &name)
 
const Partitionget_extended () const
 Returns the extended partition of the partition table.
 
Partitionableget_partitionable ()
 Return the partitionable of the partition table.
 
const Partitionableget_partitionable () const
 Return the partitionable of the partition table.
 
Alignment get_alignment (AlignType align_type=AlignType::OPTIMAL) const
 
std::vector< PartitionSlotget_unused_partition_slots (AlignPolicy align_policy=AlignPolicy::ALIGN_START_KEEP_END, AlignType align_type=AlignType::OPTIMAL) const
 
Region align (const Region &region, AlignPolicy align_policy=AlignPolicy::ALIGN_START_AND_END, AlignType align_type=AlignType::OPTIMAL) const
 region is sector-based.
 
bool is_partition_boot_flag_supported () const
 Returns whether the boot flag is supported on partitions on the partition table.
 
bool is_partition_legacy_boot_flag_supported () const
 Returns whether the legacy boot flag is supported on partitions on the partition table.
 
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.
 
Impl & get_impl ()
 
const Impl & get_impl () const
 
- Public Member Functions inherited from storage::Device
sid_t get_sid () const
 Return the storage id (sid) of the device.
 
bool operator== (const Device &rhs) const
 
bool operator!= (const Device &rhs) const
 
Devicecopy_to_devicegraph (Devicegraph *devicegraph) const
 Copies the device to the devicegraph.
 
bool exists_in_devicegraph (const Devicegraph *devicegraph) const
 Checks if the device exists in the devicegraph.
 
bool exists_in_probed () const
 Checks if the device exists in the probed devicegraph.
 
bool exists_in_staging () const
 Checks if the device exists in the staging devicegraph.
 
bool exists_in_system () const
 Checks if the device exists in the system devicegraph.
 
std::string get_displayname () const
 
ResizeInfo detect_resize_info () const
 Detect the resize info of the device.
 
bool has_children () const
 
size_t num_children () const
 
bool has_parents () const
 
size_t num_parents () const
 
std::vector< Device * > get_children ()
 
std::vector< const Device * > get_children () const
 
std::vector< Device * > get_children (View view)
 Get all children of the device.
 
std::vector< const Device * > get_children (View view) const
 Get all children of the device.
 
std::vector< Device * > get_parents ()
 
std::vector< const Device * > get_parents () const
 
std::vector< Device * > get_parents (View view)
 Get all parents of the device.
 
std::vector< const Device * > get_parents (View view) const
 Get all parents of the device.
 
std::vector< Device * > get_siblings (bool itself)
 
std::vector< const Device * > get_siblings (bool itself) const
 
std::vector< Device * > get_descendants (bool itself)
 
std::vector< const Device * > get_descendants (bool itself) const
 
std::vector< Device * > get_descendants (bool itself, View view)
 
std::vector< const Device * > get_descendants (bool itself, View view) const
 
std::vector< Device * > get_ancestors (bool itself)
 
std::vector< const Device * > get_ancestors (bool itself) const
 
std::vector< Device * > get_leaves (bool itself)
 
std::vector< const Device * > get_leaves (bool itself) const
 
std::vector< Device * > get_roots (bool itself)
 
std::vector< const Device * > get_roots (bool itself) const
 
std::vector< Holder * > get_in_holders ()
 
std::vector< const Holder * > get_in_holders () const
 
std::vector< Holder * > get_out_holders ()
 
std::vector< const Holder * > get_out_holders () const
 
void remove_descendants () ST_DEPRECATED
 
void remove_descendants (View view)
 Remove all descendants of the device.
 
const std::map< std::string, std::string > & get_userdata () const
 Return the userdata of the device.
 
void set_userdata (const std::map< std::string, std::string > &userdata)
 Set the userdata of the device.
 
std::string get_name_sort_key () const
 Get a sort-key based on the device name.
 
Devicegraphget_devicegraph ()
 Return the devicegraph the device belongs to.
 
const Devicegraphget_devicegraph () const
 Return the devicegraph the device belongs to.
 
Impl & get_impl ()
 
const Impl & get_impl () const
 
virtual Deviceclone () const =0
 
void save (xmlNode *node) const ST_DEPRECATED
 

Protected Member Functions

 PartitionTable (Impl *impl)
 
- Protected Member Functions inherited from storage::Device
 Device (Impl *impl)
 
void create (Devicegraph *devicegraph) ST_DEPRECATED
 Create a device in the devicegraph.
 
void load (Devicegraph *devicegraph) ST_DEPRECATED
 

Additional Inherited Members

- Static Public Member Functions inherited from storage::Device
static std::vector< Device * > get_all (Devicegraph *devicegraph)
 Get all Devices.
 
static std::vector< const Device * > get_all (const Devicegraph *devicegraph)
 Get all Devices.
 
static bool compare_by_sid (const Device *lhs, const Device *rhs)
 Compare (less than) two Devices by sid.
 
static bool compare_by_name (const Device *lhs, const Device *rhs)
 Compare (less than) two Devices by name.
 

Member Function Documentation

◆ align()

Region storage::PartitionTable::align ( const Region & region,
AlignPolicy align_policy = AlignPolicy::ALIGN_START_AND_END,
AlignType align_type = AlignType::OPTIMAL ) const

region is sector-based.

Exceptions
AlignError

◆ create_partition()

Partition * storage::PartitionTable::create_partition ( const std::string & name,
const Region & region,
PartitionType type )

region is sector-based.

Exceptions
DifferentBlockSizes

◆ delete_partition()

void storage::PartitionTable::delete_partition ( Partition * partition)

Delete a partition in the partition table.

Also deletes all descendants of the partition.

◆ extended_possible()

bool storage::PartitionTable::extended_possible ( ) const

Returns whether a extended partition is supported.

This function is independent of existing partitions.

◆ get_extended()

const Partition * storage::PartitionTable::get_extended ( ) const

Returns the extended partition of the partition table.

Throws if no extended partition exists.

Exceptions
Exception

◆ get_partition()

Partition * storage::PartitionTable::get_partition ( const std::string & name)
Exceptions
Exception

◆ get_partitionable() [1/2]

Partitionable * storage::PartitionTable::get_partitionable ( )

Return the partitionable of the partition table.

Exceptions
Exception

◆ get_partitionable() [2/2]

const Partitionable * storage::PartitionTable::get_partitionable ( ) const

Return the partitionable of the partition table.

Exceptions
Exception

◆ get_partitions() [1/2]

std::vector< Partition * > storage::PartitionTable::get_partitions ( )

Get the partitions of the partition table.

This includes primary, extended and logical partitions.

◆ get_partitions() [2/2]

std::vector< const Partition * > storage::PartitionTable::get_partitions ( ) const

Get the partitions of the partition table.

This includes primary, extended and logical partitions.

◆ get_type()

PtType storage::PartitionTable::get_type ( ) const

Get the partition type.

See also
PtType

◆ get_unused_partition_slots()

std::vector< PartitionSlot > storage::PartitionTable::get_unused_partition_slots ( AlignPolicy align_policy = AlignPolicy::ALIGN_START_KEEP_END,
AlignType align_type = AlignType::OPTIMAL ) const
Exceptions
Exception

◆ is_partition_id_supported()

bool storage::PartitionTable::is_partition_id_supported ( unsigned int id) const

Returns whether the partition id is supported on the partition table.

This function does not consider the partition type (primary, extended or logical) so further restriction may apply, e.g. ID_EXTENDED is not allowed for primary partitions.

Starting with libstorage-ng version 4.5.47 this function depends on the parted version and operating system flavour.

◆ is_partition_no_automount_flag_supported()

bool storage::PartitionTable::is_partition_no_automount_flag_supported ( ) const

Returns whether the no-automount flag is supported on partitions on the partition table.

So far true for GPT if parted 3.6 is available.

See PartitionTable::is_partition_no_automount_flag_supported()

Exceptions
Exception

◆ max_logical()

unsigned int storage::PartitionTable::max_logical ( ) const

Highest number for a logical partition.

Returns 0 if no logical partition is possible.

Lowest number for a logical partition is 5.

This function is independent of existing partitions.

◆ max_primary()

unsigned int storage::PartitionTable::max_primary ( ) const

Highest number for a primary or extended partition.

Returns 0 if no primary or extended partition is possible.

Lowest number for a primary or extended partition is 1.

This function is independent of existing partitions.


The documentation for this class was generated from the following file: