24 #ifndef STORAGE_STORAGE_H 25 #define STORAGE_STORAGE_H 33 #include <boost/noncopyable.hpp> 35 #include "storage/CommitOptions.h" 36 #include "storage/Utils/Callbacks.h" 37 #include "storage/Utils/Swig.h" 107 virtual bool multipath(
bool looks_like_real_multipath)
const = 0;
120 virtual std::pair<bool, std::string>
luks(
const std::string& uuid,
int attempt)
const = 0;
135 const std::string& get_device_name()
const;
136 unsigned long long get_size()
const;
137 const std::string& get_dm_table_name()
const;
138 bool is_dm_table_name_generated()
const;
139 const std::string& get_uuid()
const;
140 const std::string& get_label()
const;
146 Impl& get_impl() {
return *impl; }
147 const Impl& get_impl()
const {
return *impl; }
151 const std::unique_ptr<Impl> impl;
170 virtual std::pair<bool, std::string>
luks(
const LuksInfo& luks_info,
int attempt)
const = 0;
185 const std::string& get_device_name()
const;
186 unsigned long long get_size()
const;
187 const std::string& get_dm_table_name()
const;
188 bool is_dm_table_name_generated()
const;
189 const std::string& get_uuid()
const;
195 Impl& get_impl() {
return *impl; }
196 const Impl& get_impl()
const {
return *impl; }
200 const std::unique_ptr<Impl> impl;
222 virtual void end()
const {}
229 virtual std::pair<bool, std::string>
bitlocker(
const BitlockerInfo& bitlocker_info,
int attempt)
const = 0;
259 bool multipath()
const;
260 bool dm_raid()
const;
264 bool bitlocker()
const;
270 Impl& get_impl() {
return *impl; }
271 const Impl& get_impl()
const {
return *impl; }
275 const std::unique_ptr<Impl> impl;
308 const std::string& command, uint64_t used_features)
const = 0;
327 virtual void end()
const {}
345 const std::string& name,
PtType pt_type,
346 FsType fs_type)
const = 0;
355 const std::string& name,
PtType pt_type)
const = 0;
364 const std::string& name,
PtType pt_type)
const = 0;
375 const std::string& name,
PtType pt_type)
const = 0;
386 const std::string& name, FsType fs_type)
const = 0;
397 virtual void error(
const std::string& message)
const = 0;
428 const Arch& get_arch()
const;
454 bool equal_devicegraph(
const std::string& lhs,
const std::string& rhs)
const;
549 const std::string& get_rootprefix()
const;
550 void set_rootprefix(
const std::string& rootprefix) ST_DEPRECATED;
662 void rename_pool(
const std::string& old_name,
const std::string& new_name);
677 std::map<std::string, Pool*>
get_pools();
682 std::map<std::string, const Pool*>
get_pools()
const;
700 Impl& get_impl() {
return *impl; }
701 const Impl& get_impl()
const {
return *impl; }
705 const std::unique_ptr<Impl> impl;
Provides information whether deactivate_v2() was able to deactivate subsystems.
Definition: Storage.h:249
Definition: Storage.h:234
void remove_pool(const std::string &name)
Remove a pool by name.
Definition: Environment.h:63
std::map< std::string, Pool * > get_pools()
Get all pools with their names.
void probe(const ProbeCallbacks *probe_callbacks=nullptr)
Probe the system and replace the probed, system and staging devicegraphs.
virtual void end() const
Called at the end of activation.
Definition: Storage.h:222
virtual bool ambiguity_partition_table_and_luks(const std::string &message, const std::string &what, const std::string &name, PtType pt_type) const =0
This error callback is called when a partition table and a LUKS are found on a device.
MountByType get_default_mount_by() const
Query the default mount-by method.
Definition: CommitOptions.h:31
Definition: Storage.h:313
virtual void begin() const
Called at the begin of activation.
Definition: Storage.h:217
virtual bool ambiguity_partition_table_and_filesystem(const std::string &message, const std::string &what, const std::string &name, PtType pt_type, FsType fs_type) const =0
This error callback is called when a partition table and a filesystem are found on a device...
Devicegraph * copy_devicegraph(const std::string &source_name, const std::string &dest_name)
void restore_devicegraph(const std::string &name)
const Devicegraph * get_probed() const
Return the probed devicegraph.
bool exist_devicegraph(const std::string &name) const
Check whether a devicegraph exists by name.
Storage(const Environment &environment)
Construct Storage object.
void check(const CheckCallbacks *check_callbacks=nullptr) const
Checks all devicegraphs.
Definition: Storage.h:332
void commit(const CommitOptions &commit_options, const CommitCallbacks *commit_callbacks=nullptr)
The actiongraph must be valid.
virtual void begin() const
Called at the begin of probing.
Definition: Storage.h:322
virtual std::pair< bool, std::string > luks(const std::string &uuid, int attempt) const =0
Decide whether the LUKS with uuid should be activated.
std::string prepend_rootprefix(const std::string &mount_point) const
Prepends the root prefix to a mount point if necessary.
bool exists_pool(const std::string &name) const
Check whether a pool exists by name.
Stores information about a Bitlocker device.
Definition: Storage.h:178
PtType
Partition Table Type.
Definition: PartitionTable.h:42
const Actiongraph * calculate_actiongraph()
The actiongraph is only valid until either the probed or staging devicegraph is modified.
The main container of the libstorage-ng.
Definition: Devicegraph.h:169
Devicegraph * get_devicegraph(const std::string &name)
Return a devicegraph by name.
virtual std::pair< bool, std::string > bitlocker(const BitlockerInfo &bitlocker_info, int attempt) const =0
Decide whether the BitLocker should be activated.
Definition: Storage.h:402
void rename_pool(const std::string &old_name, const std::string &new_name)
Rename a pool.
The actiongraph has all actions including the dependencies among them to get from one devicegraph to ...
Definition: Actiongraph.h:60
DeactivateStatus deactivate() const ST_DEPRECATED
virtual bool unsupported_filesystem(const std::string &message, const std::string &what, const std::string &name, FsType fs_type) const =0
This error callback is called when a known but unsupported filesystem type, e.g.
virtual bool multipath(bool looks_like_real_multipath) const =0
Decide whether multipath should be activated.
Pool * create_pool(const std::string &name)
Create a pool with name.
void set_default_mount_by(MountByType default_mount_by)
Set the default mount-by method.
Devicegraph * get_staging()
Return the staging devicegraph.
virtual bool missing_command(const std::string &message, const std::string &what, const std::string &command, uint64_t used_features) const =0
Callback for missing commands.
void activate(const ActivateCallbacks *activate_callbacks) const
Activate devices like multipath, DM and MD RAID, LVM and LUKS.
virtual void end() const
Called at the end of probing.
Definition: Storage.h:327
Stores information about a LUKS device.
Definition: Storage.h:128
Definition: Storage.h:289
Devicegraph * get_system()
Return the system devicegraph.
std::vector< std::string > get_devicegraph_names() const ST_DEPRECATED
Get the names of all devicegraphs.
Definition: Callbacks.h:33
std::vector< std::string > get_pool_names() const ST_DEPRECATED
Get the names of all pools.
virtual bool unsupported_partition_table(const std::string &message, const std::string &what, const std::string &name, PtType pt_type) const =0
This error callback is called when a known but unsupported partition table type, e.g.
virtual void message(const std::string &message) const =0
Callback for progress messages.
Specialized callbacks with a more generic parameter for LUKS activation.
Definition: Storage.h:159
The main entry point to libstorage.
Definition: Storage.h:412
void generate_pools(const Devicegraph *devicegraph)
Generate pools, e.g.
virtual bool ambiguity_partition_table_and_lvm_pv(const std::string &message, const std::string &what, const std::string &name, PtType pt_type) const =0
This error callback is called when a partition table and a LVM PV are found on a device.
Devicegraph * create_devicegraph(const std::string &name)
Create a devicegraph with name.
Definition: Storage.h:280
The storage namespace.
Definition: Actiongraph.h:38
DeactivateStatusV2 deactivate_v2() const
Deactivate devices like multipath, DM and MD RAID, LVM and LUKS.
void remove_devicegraph(const std::string &name)
Remove a devicegraph by name.
A pool represents a collection of devices.
Definition: Pool.h:82
Definition: Storage.h:391
virtual std::pair< bool, std::string > luks(const LuksInfo &luks_info, int attempt) const =0
Decide whether the LUKS should be activated.
Specialized callbacks with a more generic parameter for Bitlocker activation.
Definition: Storage.h:208
std::map< std::string, const Devicegraph * > get_devicegraphs() const
Get all devicegraphs with their names.
Pool * get_pool(const std::string &name)
Return a pool by name.
Other storage subsystems are activated automatically, e.g.
Definition: Storage.h:96
MountByType
The key by which the mount program identifies a mountable.
Definition: Mountable.h:60