libstorage-ng
|
Class to represent a btrfs filesystem https://en.wikipedia.org/wiki/Btrfs in the devicegraph. More...
#include <Btrfs.h>
Public Member Functions | |
BtrfsRaidLevel | get_metadata_raid_level () const |
Get the metadata RAID level. More... | |
void | set_metadata_raid_level (BtrfsRaidLevel metadata_raid_level) |
Set the metadata RAID level. More... | |
BtrfsRaidLevel | get_data_raid_level () const |
Get the data RAID level. More... | |
void | set_data_raid_level (BtrfsRaidLevel data_raid_level) |
Set the data RAID level. More... | |
std::vector< BtrfsRaidLevel > | get_allowed_metadata_raid_levels () const |
Get the allowed metadata RAID levels for the btrfs. More... | |
std::vector< BtrfsRaidLevel > | get_allowed_data_raid_levels () const |
Get the allowed data RAID levels for the btrfs. More... | |
bool | has_quota () const |
Return whether quota is enabled for the btrfs. | |
void | set_quota (bool quota) |
Enable or disable quota for the btrfs. More... | |
FilesystemUser * | add_device (BlkDevice *blk_device) |
Add a block device to the btrfs. More... | |
void | remove_device (BlkDevice *blk_device) |
Remove a block device from the btrfs. More... | |
BtrfsSubvolume * | get_top_level_btrfs_subvolume () |
Get the top-level subvolume. | |
const BtrfsSubvolume * | get_top_level_btrfs_subvolume () const |
Get the top-level subvolume. More... | |
BtrfsSubvolume * | get_default_btrfs_subvolume () |
Get the default subvolume. | |
const BtrfsSubvolume * | get_default_btrfs_subvolume () const |
Get the default subvolume. More... | |
void | set_default_btrfs_subvolume (BtrfsSubvolume *btrfs_subvolume) const |
Set the default subvolume. More... | |
std::vector< BtrfsSubvolume * > | get_btrfs_subvolumes () |
Get all subvolumes of the btrfs. | |
std::vector< const BtrfsSubvolume * > | get_btrfs_subvolumes () const |
Get all subvolumes of the btrfs. More... | |
BtrfsSubvolume * | find_btrfs_subvolume_by_path (const std::string &path) |
Find a btrfs subvolume of the btrfs by its path. More... | |
const BtrfsSubvolume * | find_btrfs_subvolume_by_path (const std::string &path) const |
Find a btrfs subvolume of the btrfs by its path. More... | |
BtrfsQgroup * | create_btrfs_qgroup (const BtrfsQgroup::id_t &id) |
Create a new btrfs qgroup on the btrfs. More... | |
std::vector< BtrfsQgroup * > | get_btrfs_qgroups () |
Get all btrfs qgroups of the btrfs. | |
std::vector< const BtrfsQgroup * > | get_btrfs_qgroups () const |
Get all btrfs qgroups of the btrfs. More... | |
BtrfsQgroup * | find_btrfs_qgroup_by_id (const BtrfsQgroup::id_t &id) |
Find a btrfs qgroup of the btrfs by its id. More... | |
const BtrfsQgroup * | find_btrfs_qgroup_by_id (const BtrfsQgroup::id_t &id) const |
Find a btrfs qgroup of the btrfs by its id. More... | |
bool | get_configure_snapper () const |
void | set_configure_snapper (bool configure) |
Impl & | get_impl () |
const Impl & | get_impl () const |
virtual Btrfs * | clone () const override |
Btrfs (Impl *impl) | |
![]() | |
bool | supports_label () const |
Return whether the filesystem supports a label. | |
unsigned int | max_labelsize () const |
Return the maximal allowed filesystem label length. | |
const std::string & | get_label () const |
Get the filesystem label. | |
void | set_label (const std::string &label) |
Set the filesystem label. More... | |
bool | supports_uuid () const |
Return whether the filesystem supports a UUID. | |
const std::string & | get_uuid () const |
Get the filesystem UUID. More... | |
void | set_uuid (const std::string &uuid) |
Set the filesystem UUID. More... | |
const std::string & | get_mkfs_options () const |
Get extra options for the filesystem mkfs command. | |
void | set_mkfs_options (const std::string &mkfs_options) |
Set extra options for the filesystem mkfs command. More... | |
bool | supports_tune_options () const |
Checks whether the filesystem supports tune options. | |
const std::string & | get_tune_options () const |
Get extra options for the filesystem tune command. | |
void | set_tune_options (const std::string &tune_options) |
Set extra options for the filesystem tune command. More... | |
bool | supports_shrink () const |
Checks whether shrinking the filesystem is supported. | |
bool | supports_grow () const |
Checks whether growing the filesystem is supported. | |
bool | supports_mounted_shrink () const |
Checks whether shrinking the filesystem while being mounted is supported. | |
bool | supports_mounted_grow () const |
Checks whether growing the filesystem while being mounted is supported. | |
bool | supports_unmounted_shrink () const |
Checks whether shrinking the filesystem while being unmounted is supported. | |
bool | supports_unmounted_grow () const |
Checks whether growing the filesystem while being unmounted is supported. | |
void | set_resize_info (const ResizeInfo &resize_info) |
Set the ResizeInfo. More... | |
ContentInfo | detect_content_info () const |
Detect the content info of the filesystem. More... | |
void | set_content_info (const ContentInfo &content_info) |
Set the ResizeInfo. More... | |
std::vector< BlkDevice * > | get_blk_devices () |
Get underlying blk devices of the blk filesystem. | |
std::vector< const BlkDevice * > | get_blk_devices () const |
Get underlying blk devices of the blk filesystem. More... | |
Impl & | get_impl () |
const Impl & | get_impl () const |
![]() | |
FsType | get_type () const |
Get the filesystem type. More... | |
bool | has_space_info () const |
SpaceInfo | detect_space_info () const |
So far only supported for Nfs. More... | |
void | set_space_info (const SpaceInfo &space_info) |
Set the SpaceInfo. More... | |
Impl & | get_impl () |
const Impl & | get_impl () const |
![]() | |
bool | supports_mount () const |
Checks whether the library supports mounting the mountable. More... | |
MountPoint * | create_mount_point (const std::string &path) |
Create a new mount point for the mountable with path. More... | |
bool | has_mount_point () const |
Checks whether the mountable has a mount point. | |
MountPoint * | get_mount_point () |
Returns the mount point of the mountable. | |
const MountPoint * | get_mount_point () const |
Returns the mount point of the mountable. More... | |
void | remove_mount_point () |
Removes the mount point from the mountable. More... | |
bool | has_filesystem () const |
Checks whether the mountable has a filesystem. More... | |
Filesystem * | get_filesystem () |
Return the filesystem of the mountable. More... | |
const Filesystem * | get_filesystem () const |
Return the filesystem of the mountable. More... | |
MountByType | get_mount_by () const ST_DEPRECATED |
void | set_mount_by (MountByType mount_by) ST_DEPRECATED |
const std::vector< std::string > & | get_mount_opts () const ST_DEPRECATED |
void | set_mount_opts (const std::vector< std::string > &mount_opts) ST_DEPRECATED |
const std::vector< std::string > & | get_fstab_options () const ST_DEPRECATED |
void | set_fstab_options (const std::vector< std::string > &mount_opts) ST_DEPRECATED |
Impl & | get_impl () |
const Impl & | get_impl () const |
![]() | |
sid_t | get_sid () const |
Return the storage id (sid) of the device. More... | |
bool | operator== (const Device &rhs) const |
bool | operator!= (const Device &rhs) const |
Device * | copy_to_devicegraph (Devicegraph *devicegraph) const |
Copies the device to the devicegraph. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
Devicegraph * | get_devicegraph () |
Return the devicegraph the device belongs to. | |
const Devicegraph * | get_devicegraph () const |
Return the devicegraph the device belongs to. More... | |
Impl & | get_impl () |
const Impl & | get_impl () const |
void | save (xmlNode *node) const ST_DEPRECATED |
Static Public Member Functions | |
static Btrfs * | create (Devicegraph *devicegraph) |
Create a device of type Btrfs. More... | |
static Btrfs * | load (Devicegraph *devicegraph, const xmlNode *node) |
static std::vector< Btrfs * > | get_all (Devicegraph *devicegraph) |
Get all Btrfses. | |
static std::vector< const Btrfs * > | get_all (const Devicegraph *devicegraph) |
Get all Btrfses. More... | |
![]() | |
static std::vector< BlkFilesystem * > | get_all (Devicegraph *devicegraph) |
Get all BlkFilesystems. | |
static std::vector< const BlkFilesystem * > | get_all (const Devicegraph *devicegraph) |
Get all BlkFilesystems. More... | |
static std::vector< const BlkFilesystem * > | find_by_label (const Devicegraph *devicegraph, const std::string &label) |
Find filesystems by label. | |
static std::vector< const BlkFilesystem * > | find_by_uuid (const Devicegraph *devicegraph, const std::string &uuid) |
Find filesystems by UUID. | |
![]() | |
static std::vector< Filesystem * > | get_all (Devicegraph *devicegraph) |
Get all Filesystems. | |
static std::vector< const Filesystem * > | get_all (const Devicegraph *devicegraph) |
Get all Filesystems. More... | |
![]() | |
static std::vector< Mountable * > | get_all (Devicegraph *devicegraph) |
Get all Mountables. | |
static std::vector< const Mountable * > | get_all (const Devicegraph *devicegraph) |
Get all Mountables. More... | |
static bool | is_valid_path (FsType fs_type, const std::string &path) |
Checks whether the path is valid. More... | |
![]() | |
static std::vector< Device * > | get_all (Devicegraph *devicegraph) |
Get all Devices. | |
static std::vector< const Device * > | get_all (const Devicegraph *devicegraph) |
Get all Devices. More... | |
static bool | compare_by_sid (const Device *lhs, const Device *rhs) |
Compare (less than) two Devices by sid. More... | |
static bool | compare_by_name (const Device *lhs, const Device *rhs) |
Compare (less than) two Devices by name. More... | |
Additional Inherited Members | |
![]() | |
BlkFilesystem (Impl *impl) | |
![]() | |
Filesystem (Impl *impl) | |
![]() | |
Mountable (Impl *impl) | |
![]() | |
Device (Impl *impl) | |
void | create (Devicegraph *devicegraph) ST_DEPRECATED |
Create a device in the devicegraph. More... | |
void | load (Devicegraph *devicegraph) ST_DEPRECATED |
Class to represent a btrfs filesystem https://en.wikipedia.org/wiki/Btrfs in the devicegraph.
FilesystemUser* storage::Btrfs::add_device | ( | BlkDevice * | blk_device | ) |
Add a block device to the btrfs.
WrongNumberOfChildren |
|
static |
Create a device of type Btrfs.
Usually this function is not called directly. Instead BlkDevice::create_blk_filesystem() is called.
BtrfsQgroup* storage::Btrfs::create_btrfs_qgroup | ( | const BtrfsQgroup::id_t & | id | ) |
Create a new btrfs qgroup on the btrfs.
Creating level 0 qgroups is not supported. Quota must be enabled.
Exception |
BtrfsQgroup* storage::Btrfs::find_btrfs_qgroup_by_id | ( | const BtrfsQgroup::id_t & | id | ) |
Find a btrfs qgroup of the btrfs by its id.
BtrfsQgroupNotFoundById |
const BtrfsQgroup* storage::Btrfs::find_btrfs_qgroup_by_id | ( | const BtrfsQgroup::id_t & | id | ) | const |
Find a btrfs qgroup of the btrfs by its id.
BtrfsQgroupNotFoundById |
BtrfsSubvolume* storage::Btrfs::find_btrfs_subvolume_by_path | ( | const std::string & | path | ) |
Find a btrfs subvolume of the btrfs by its path.
BtrfsSubvolumeNotFoundByPath |
const BtrfsSubvolume* storage::Btrfs::find_btrfs_subvolume_by_path | ( | const std::string & | path | ) | const |
Find a btrfs subvolume of the btrfs by its path.
BtrfsSubvolumeNotFoundByPath |
|
static |
Get all Btrfses.
std::vector<BtrfsRaidLevel> storage::Btrfs::get_allowed_data_raid_levels | ( | ) | const |
Get the allowed data RAID levels for the btrfs.
So far, this depends on the number of devices. Levels for which mkfs.btrfs warns that they are not recommended are not included here. Additionally DEFAULT is allowed when creating a btrfs.
std::vector<BtrfsRaidLevel> storage::Btrfs::get_allowed_metadata_raid_levels | ( | ) | const |
Get the allowed metadata RAID levels for the btrfs.
So far, this depends on the number of devices. Levels for which mkfs.btrfs warns that they are not recommended are not included here. Additionally DEFAULT is allowed when creating a btrfs.
std::vector<const BtrfsQgroup*> storage::Btrfs::get_btrfs_qgroups | ( | ) | const |
Get all btrfs qgroups of the btrfs.
std::vector<const BtrfsSubvolume*> storage::Btrfs::get_btrfs_subvolumes | ( | ) | const |
Get all subvolumes of the btrfs.
BtrfsRaidLevel storage::Btrfs::get_data_raid_level | ( | ) | const |
Get the data RAID level.
const BtrfsSubvolume* storage::Btrfs::get_default_btrfs_subvolume | ( | ) | const |
Get the default subvolume.
BtrfsRaidLevel storage::Btrfs::get_metadata_raid_level | ( | ) | const |
Get the metadata RAID level.
const BtrfsSubvolume* storage::Btrfs::get_top_level_btrfs_subvolume | ( | ) | const |
Get the top-level subvolume.
void storage::Btrfs::remove_device | ( | BlkDevice * | blk_device | ) |
Remove a block device from the btrfs.
Not supported for btrfs already existing on disk.
Exception |
void storage::Btrfs::set_data_raid_level | ( | BtrfsRaidLevel | data_raid_level | ) |
void storage::Btrfs::set_default_btrfs_subvolume | ( | BtrfsSubvolume * | btrfs_subvolume | ) | const |
Set the default subvolume.
void storage::Btrfs::set_metadata_raid_level | ( | BtrfsRaidLevel | metadata_raid_level | ) |
Set the metadata RAID level.
Not supported for btrfs already existing on disk.
void storage::Btrfs::set_quota | ( | bool | quota | ) |
Enable or disable quota for the btrfs.
When enabling quota, qgroups and qgroup relations are created for the btrfs. This is done so that no qgroup related actions will be done during commit (unless further changes are done). If quota was disabled during probing, the qgroups are created like btrfs would do. If quota was enabled during probing, the qgroups from probing are restored.
When disabling quota, all qgroups and qgroup relations of the btrfs are removed.
Exception |