libstorage-ng
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
storage::Btrfs Class Reference

Class to represent a btrfs filesystem https://en.wikipedia.org/wiki/Btrfs in the devicegraph. More...

#include <Btrfs.h>

Inheritance diagram for storage::Btrfs:
[legend]
Collaboration diagram for storage::Btrfs:
[legend]

Public Member Functions

BtrfsRaidLevel get_metadata_raid_level () const
 Get the metadata RAID level.
 
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.
 
void set_data_raid_level (BtrfsRaidLevel data_raid_level)
 Set the data RAID level. More...
 
std::vector< BtrfsRaidLevelget_allowed_metadata_raid_levels () const
 Get the allowed metadata RAID levels for the btrfs. More...
 
std::vector< BtrfsRaidLevelget_allowed_data_raid_levels () const
 Get the allowed data RAID levels for the btrfs. More...
 
FilesystemUseradd_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...
 
BtrfsSubvolumeget_top_level_btrfs_subvolume ()
 
const BtrfsSubvolumeget_top_level_btrfs_subvolume () const
 
BtrfsSubvolumeget_default_btrfs_subvolume ()
 
const BtrfsSubvolumeget_default_btrfs_subvolume () const
 
void set_default_btrfs_subvolume (BtrfsSubvolume *btrfs_subvolume) const
 
std::vector< BtrfsSubvolume * > get_btrfs_subvolumes ()
 
std::vector< const BtrfsSubvolume * > get_btrfs_subvolumes () const
 
BtrfsSubvolumefind_btrfs_subvolume_by_path (const std::string &path)
 Find a btrfs subvolume of the btrfs by its path. More...
 
const BtrfsSubvolumefind_btrfs_subvolume_by_path (const std::string &path) const
 Find a btrfs subvolume of the btrfs by its path. More...
 
bool get_configure_snapper () const
 
void set_configure_snapper (bool configure)
 
Impl & get_impl ()
 
const Impl & get_impl () const
 
virtual Btrfsclone () const override
 
- Public Member Functions inherited from storage::BlkFilesystem
bool supports_label () const
 
unsigned int max_labelsize () const
 
const std::string & get_label () const
 
void set_label (const std::string &label)
 
bool supports_uuid () const
 
const std::string & get_uuid () const
 
void set_uuid (const std::string &uuid)
 
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...
 
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< const BlkDevice * > get_blk_devices () const
 
Impl & get_impl ()
 
const Impl & get_impl () const
 
- Public Member Functions inherited from storage::Filesystem
FsType get_type () const
 
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
 
- Public Member Functions inherited from storage::Mountable
bool supports_mount () const
 Checks whether the library supports mounting the mountable. More...
 
MountPointcreate_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.
 
MountPointget_mount_point ()
 Returns the mount point of the mountable.
 
const MountPointget_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...
 
Filesystemget_filesystem ()
 Return the filesystem of the mountable. More...
 
const Filesystemget_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
 
- Public Member Functions inherited from storage::Device
sid_t get_sid () const
 
bool operator== (const Device &rhs) const
 
bool operator!= (const Device &rhs) const
 
Devicecopy_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_parents ()
 
std::vector< const Device * > get_parents () const
 
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_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 ()
 
const std::map< std::string, std::string > & get_userdata () const
 
void set_userdata (const std::map< std::string, std::string > &userdata)
 
std::string get_name_sort_key () const
 Get a sort-key based on the device name. More...
 
Devicegraphget_devicegraph ()
 
const Devicegraphget_devicegraph () const
 
Impl & get_impl ()
 
const Impl & get_impl () const
 
void save (xmlNode *node) const
 

Static Public Member Functions

static Btrfscreate (Devicegraph *devicegraph)
 
static Btrfsload (Devicegraph *devicegraph, const xmlNode *node)
 
- Static Public Member Functions inherited from storage::BlkFilesystem
static std::vector< BlkFilesystem * > get_all (Devicegraph *devicegraph)
 
static std::vector< const BlkFilesystem * > get_all (const Devicegraph *devicegraph)
 
static std::vector< const BlkFilesystem * > find_by_label (const Devicegraph *devicegraph, const std::string &label)
 
static std::vector< const BlkFilesystem * > find_by_uuid (const Devicegraph *devicegraph, const std::string &uuid)
 
- Static Public Member Functions inherited from storage::Filesystem
static std::vector< Filesystem * > get_all (Devicegraph *devicegraph)
 
static std::vector< const Filesystem * > get_all (const Devicegraph *devicegraph)
 
- Static Public Member Functions inherited from storage::Mountable
static std::vector< Mountable * > get_all (Devicegraph *devicegraph)
 
static std::vector< const Mountable * > get_all (const Devicegraph *devicegraph)
 
- Static Public Member Functions inherited from storage::Device
static std::vector< Device * > get_all (Devicegraph *devicegraph)
 
static std::vector< const Device * > get_all (const Devicegraph *devicegraph)
 
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. More...
 

Protected Member Functions

 Btrfs (Impl *impl)
 
- Protected Member Functions inherited from storage::BlkFilesystem
 BlkFilesystem (Impl *impl)
 
- Protected Member Functions inherited from storage::Filesystem
 Filesystem (Impl *impl)
 
- Protected Member Functions inherited from storage::Mountable
 Mountable (Impl *impl)
 
- Protected Member Functions inherited from storage::Device
 Device (Impl *impl)
 
void create (Devicegraph *devicegraph)
 
void load (Devicegraph *devicegraph)
 

Detailed Description

Class to represent a btrfs filesystem https://en.wikipedia.org/wiki/Btrfs in the devicegraph.

Member Function Documentation

◆ add_device()

FilesystemUser* storage::Btrfs::add_device ( BlkDevice blk_device)

Add a block device to the btrfs.

Exceptions
WrongNumberOfChildren

◆ find_btrfs_subvolume_by_path() [1/2]

BtrfsSubvolume* storage::Btrfs::find_btrfs_subvolume_by_path ( const std::string &  path)

Find a btrfs subvolume of the btrfs by its path.

Exceptions
BtrfsSubvolumeNotFoundByPath

◆ find_btrfs_subvolume_by_path() [2/2]

const BtrfsSubvolume* storage::Btrfs::find_btrfs_subvolume_by_path ( const std::string &  path) const

Find a btrfs subvolume of the btrfs by its path.

Exceptions
BtrfsSubvolumeNotFoundByPath

◆ get_allowed_data_raid_levels()

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.

◆ get_allowed_metadata_raid_levels()

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.

◆ remove_device()

void storage::Btrfs::remove_device ( BlkDevice blk_device)

Remove a block device from the btrfs.

Not supported for btrfs already existing on disk.

Exceptions
Exception

◆ set_data_raid_level()

void storage::Btrfs::set_data_raid_level ( BtrfsRaidLevel  data_raid_level)

Set the data RAID level.

Not supported for btrfs already existing on disk.

◆ set_metadata_raid_level()

void storage::Btrfs::set_metadata_raid_level ( BtrfsRaidLevel  metadata_raid_level)

Set the metadata RAID level.

Not supported for btrfs already existing on disk.


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