libstorage-ng
Public Member Functions | List of all members
storage::Alignment Class Reference

A class to calculate partition alignment based on hardware topology. More...

#include <Alignment.h>

Public Member Functions

 Alignment (const Topology &topology, AlignType align_type=AlignType::OPTIMAL)
 
 Alignment (const Alignment &alignment)
 
 Alignment (Alignment &&alignment)=default
 
Alignmentoperator= (const Alignment &alignment)
 
Alignmentoperator= (Alignment &&alignment)=default
 
bool can_be_aligned (const Region &region, AlignPolicy align_policy) const
 Checks whether a region can be aligned. More...
 
Region align (const Region &region, AlignPolicy align_policy=AlignPolicy::ALIGN_START_AND_END) const
 Aligns a region. More...
 
long offset () const
 
unsigned long grain () const
 
Impl & get_impl ()
 
const Impl & get_impl () const
 

Detailed Description

A class to calculate partition alignment based on hardware topology.

The starting sector of an aligned partition must obey the form "sector = offset + X * grain". Alignment may fail if the start of the aligned partition region is after the end of the aligned partition region.

Member Function Documentation

◆ align()

Region storage::Alignment::align ( const Region region,
AlignPolicy  align_policy = AlignPolicy::ALIGN_START_AND_END 
) const

Aligns a region.

Exceptions
AlignError

◆ can_be_aligned()

bool storage::Alignment::can_be_aligned ( const Region region,
AlignPolicy  align_policy 
) const

Checks whether a region can be aligned.

Alignment may fail if the aligned end is before the aligned start.


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