23#ifndef STORAGE_BTRFS_SUBVOLUME_H
24#define STORAGE_BTRFS_SUBVOLUME_H
27#include "storage/Filesystems/Mountable.h"
28#include "storage/Devicegraph.h"
43 class BtrfsSubvolume :
public Mountable
55 static BtrfsSubvolume* load(
Devicegraph* devicegraph,
const xmlNode* node);
206 static bool compare_by_id(
const BtrfsSubvolume* lhs,
const BtrfsSubvolume* rhs);
213 const Impl& get_impl()
const;
215 virtual BtrfsSubvolume* clone()
const override;
217 BtrfsSubvolume(Impl* impl);
Class to represent a qgroup of a btrfs filesystem.
Definition BtrfsQgroup.h:45
Class to represent a btrfs subvolume in the devicegraph.
Definition BtrfsSubvolume.h:44
const std::string & get_path() const
Get the path of the btrfs subvolume.
BtrfsSubvolume * get_top_level_btrfs_subvolume()
Return the top-level subvolume.
const BtrfsSubvolume * get_origin() const
Get the origin of the btrfs subvolume if it has one.
BtrfsSubvolume * get_origin()
Get the origin of the btrfs subvolume if it has one.
const BtrfsQgroup * get_btrfs_qgroup() const
Return the corresponding level 0 qgroup of the subvolume.
long get_id() const
Get the id of the btrfs subvolume.
BtrfsQgroup * create_btrfs_qgroup()
Create the corresponding level 0 qgroup for the subvolume.
bool has_origin() const
Check whether the btrfs subvolume has an origin.
BtrfsSubvolume * create_btrfs_subvolume(const std::string &path)
Create a btrfs subvolume for the btrfs subvolume.
void set_default_btrfs_subvolume()
Set the subvolume to be the default subvolume.
bool is_top_level() const
Check whether the subvolume is the top-level subvolume.
bool is_nocow() const
Get the copy-on-write (COW) flag of the btrfs subvolume.
std::vector< const BtrfsSubvolume * > get_snapshots() const
Get snapshots of the btrfs subvolume.
bool has_snapshots() const
Check whether the btrfs subvolume has snapshots.
bool is_default_btrfs_subvolume() const
Check whether the subvolume is the default subvolume.
static bool compare_by_id(const BtrfsSubvolume *lhs, const BtrfsSubvolume *rhs)
Compare (less than) two BtrfsSubvolumes by id.
void set_nocow(bool nocow)
Set the copy-on-write (COW) flag of the btrfs subvolume.
std::vector< BtrfsSubvolume * > get_snapshots()
Get snapshots of the btrfs subvolume.
BtrfsQgroup * get_btrfs_qgroup()
Return the corresponding level 0 qgroup of the subvolume.
const Btrfs * get_btrfs() const
Return the btrfs filesystem of the btrfs subvolume.
bool has_btrfs_qgroup() const
Return whether the subvolume as a corresponding level 0 qgroup.
const BtrfsSubvolume * get_top_level_btrfs_subvolume() const
Return the top-level subvolume.
static BtrfsSubvolume * create(Devicegraph *devicegraph, const std::string &path)
Create a device of type BtrfsSubvolume.
Btrfs * get_btrfs()
Return the btrfs filesystem of the btrfs subvolume.
Class to represent a btrfs filesystem https://en.wikipedia.org/wiki/Btrfs in the devicegraph.
Definition Btrfs.h:80
An abstract base class for storage devices.
Definition Device.h:82
The main container of the libstorage-ng.
Definition Devicegraph.h:170
The storage namespace.
Definition Actiongraph.h:40
bool is_btrfs_subvolume(const Device *device)
Checks whether device points to a BtrfsSubvolume.
BtrfsSubvolume * to_btrfs_subvolume(Device *device)
Converts pointer to Device to pointer to BtrfsSubvolume.