24 #ifndef STORAGE_BLK_DEVICE_H 25 #define STORAGE_BLK_DEVICE_H 28 #include "storage/Utils/Swig.h" 29 #include "storage/Devices/Device.h" 30 #include "storage/Filesystems/BlkFilesystem.h" 48 const std::string& get_name()
const;
49 void set_name(
const std::string& name);
51 const Region& get_region()
const;
58 unsigned long long get_size()
const;
63 void set_size(
unsigned long long size);
82 bool is_active()
const;
84 const std::string& get_sysfs_name()
const;
85 const std::string& get_sysfs_path()
const;
87 const std::vector<std::string>& get_udev_paths()
const;
88 const std::vector<std::string>& get_udev_ids()
const;
106 void set_dm_table_name(
const std::string& dm_table_name);
152 bool has_blk_filesystem()
const;
169 bool has_filesystem() const ST_DEPRECATED {
return has_blk_filesystem(); }
201 bool has_encryption()
const;
219 bool has_bcache()
const;
238 bool has_bcache_cset()
const;
260 const Impl& get_impl()
const;
269 bool is_blk_device(
const Device* device);
Bcache * create_bcache(const std::string &name)
Creates a Bcache on the blk device.
BcacheCset * get_bcache_cset()
static std::vector< BlkDevice * > get_all(Devicegraph *devicegraph)
Get all BlkDevices.
void set_size(unsigned long long size)
bool is_usable_as_blk_device() const
Checks whether the blk device is in general usable as a blk device.
Encryption * get_encryption()
Encryption * create_encryption(const std::string &dm_name)
Creates an encryption device on the blk device.
static BlkDevice * find_by_any_name(Devicegraph *devicegraph, const std::string &name)
Find a block device by any name including any symbolic links in /dev.
A bcache device.
Definition: Bcache.h:61
BlkFilesystem * create_filesystem(FsType fs_type) ST_DEPRECATED
Creates a block filesystem on the block device.
Definition: BlkDevice.h:167
A start/length pair with a block size.
Definition: Region.h:73
BlkFilesystem * create_blk_filesystem(FsType fs_type)
Creates a block filesystem on the block device.
BlkDevice * to_blk_device(Device *device)
Converts pointer to Device to pointer to BlkDevice.
An encryption layer on a blk device.
Definition: Encryption.h:45
const std::string & get_dm_table_name() const
Return device-mapper table name (dm-table-name for short).
The master container of the libstorage.
Definition: Devicegraph.h:153
const Topology & get_topology() const
Get the topology.
BlkFilesystem * get_blk_filesystem()
Definition: BlkFilesystem.h:42
An abstract Block Device.
Definition: BlkDevice.h:44
void set_topology(const Topology &topology)
Set the topology.
An abstract base class of storage devices, and a vertex in the Devicegraph.
Definition: Device.h:75
A bcache cache set.
Definition: BcacheCset.h:41
const BlkFilesystem * get_filesystem() const ST_DEPRECATED
Definition: BlkDevice.h:179
static bool compare_by_dm_table_name(const BlkDevice *lhs, const BlkDevice *rhs)
Compare (less than) two BlkDevices by DM table name.
void set_region(const Region ®ion)
A class to represent hardware alignment information.
Definition: Topology.h:38
The storage namespace.
Definition: Actiongraph.h:37
BcacheCset * create_bcache_cset()
Creates an BcacheCset on the blk device.
std::string get_size_string() const
Returns the size of the block device as a localised string.
BlkFilesystem * get_filesystem() ST_DEPRECATED
Definition: BlkDevice.h:174
void remove_encryption()
Removes an encryption device on the blk device.
static BlkDevice * find_by_name(Devicegraph *devicegraph, const std::string &name)
Find a block device by its name.