sbuild
1.7.1
|
A base class for block-device chroots. More...
#include <block-device-base.h>
Public Types | |
typedef chroot::error | error |
Exception type. | |
![]() | |
enum | session_flags { SESSION_NOFLAGS = 0, SESSION_CREATE = 1 << 0, SESSION_CLONE = 1 << 1, SESSION_PURGE = 1 << 2 } |
Chroot session properties. More... | |
typedef std::shared_ptr< facet > | ptr |
A shared_ptr to a chroot facet object. | |
typedef std::shared_ptr< const facet > | const_ptr |
A shared_ptr to a const chroot facet object. | |
![]() | |
typedef std::shared_ptr< storage > | ptr |
A shared_ptr to a chroot storage object. | |
typedef std::shared_ptr< const storage > | const_ptr |
A shared_ptr to a const chroot storage object. | |
Public Member Functions | |
virtual | ~block_device_base () |
The destructor. | |
std::string const & | get_device () const |
Get the block device of the chroot. More... | |
void | set_device (const std::string &device) |
Set the block device of the chroot. More... | |
virtual std::string | get_path () const |
Get the path to the chroot. More... | |
virtual void | setup_env (environment &env) const |
Set environment. More... | |
![]() | |
virtual | ~facet () |
The destructor. | |
virtual ptr | clone () const =0 |
Copy the chroot facet. More... | |
virtual std::string const & | get_name () const =0 |
Get the name of the chroot facet. More... | |
virtual session_flags | get_session_flags () const |
Get the session flags of the chroot. More... | |
![]() | |
virtual | ~storage () |
The destructor. | |
virtual void | setup_lock (chroot::setup_type type, bool lock, int status) |
Protected Member Functions | |
block_device_base () | |
The constructor. | |
block_device_base (const block_device_base &rhs) | |
The copy constructor. | |
void | set_chroot (chroot &chroot, bool copy) |
Set containing chroot. More... | |
virtual void | get_details (format_detail &detail) const |
Get detailed information about the chroot for output. More... | |
virtual void | get_used_keys (string_list &used_keys) const |
Get a list of the keys used during keyfile parsing. More... | |
virtual void | get_keyfile (keyfile &keyfile) const |
Copy the chroot properties into a keyfile. More... | |
virtual void | set_keyfile (const keyfile &keyfile) |
Set the chroot properties from a keyfile. More... | |
![]() | |
facet () | |
The constructor. | |
![]() | |
storage () | |
The constructor. | |
Protected Attributes | |
std::string | device |
The block device to use. | |
![]() | |
chroot * | owner |
Chroot owning this facet. | |
Friends | |
class | chroot |
A base class for block-device chroots.
This class doesn't implement a chroot (get_chroot_type is not implemented).
Originally lvm-snapshot inherited from the block-device chroot, but this was changed when union support was introduced. This design prevents lvm-snapshot offering union based sessions.
|
protectedvirtual |
Get detailed information about the chroot for output.
detail | the details to output to. |
Reimplemented from sbuild::chroot::facet::facet.
Reimplemented in sbuild::chroot::facet::lvm_snapshot.
References sbuild::_(), sbuild::format_detail::add(), device, and get_device().
Referenced by sbuild::chroot::facet::lvm_snapshot::get_details().
std::string const & sbuild::chroot::facet::block_device_base::get_device | ( | ) | const |
Get the block device of the chroot.
References device.
Referenced by sbuild::chroot::facet::block_device::chroot_session_setup(), sbuild::chroot::facet::lvm_snapshot::chroot_session_setup(), get_details(), get_keyfile(), and setup_env().
|
protectedvirtual |
Copy the chroot properties into a keyfile.
The keyfile group with the name of the chroot will be set; if it already exists, it will be removed before setting it.
keyfile | the keyfile to use. |
Reimplemented from sbuild::chroot::facet::facet.
Reimplemented in sbuild::chroot::facet::lvm_snapshot.
References get_device(), sbuild::chroot::chroot::get_name(), sbuild::chroot::facet::facet::owner, and sbuild::keyfile::set_object_value().
Referenced by sbuild::chroot::facet::lvm_snapshot::get_keyfile().
|
virtual |
Get the path to the chroot.
This is the absolute path to the root of the chroot, and is typically the same as the mount location and location concatenated together, but is overridden by the chroot type if required.
Implements sbuild::chroot::facet::storage.
References sbuild::chroot::chroot::get_facet(), sbuild::chroot::chroot::get_mount_location(), and sbuild::chroot::facet::facet::owner.
|
protectedvirtual |
Get a list of the keys used during keyfile parsing.
Reimplemented from sbuild::chroot::facet::facet.
Reimplemented in sbuild::chroot::facet::lvm_snapshot.
Referenced by sbuild::chroot::facet::lvm_snapshot::get_used_keys().
|
protectedvirtual |
Set containing chroot.
The copy parameter is used to inform the facet if it is new or a copy; this is intended to allow additional facets to only be added if the facet is new, for example, to avoid re-adding removed facets when copying a chroot.
chroot | the chroot containing this facet. |
copy | true if the facet has been copied, or false if this is a new instance. |
Reimplemented from sbuild::chroot::facet::facet.
Reimplemented in sbuild::chroot::facet::block_device, and sbuild::chroot::facet::lvm_snapshot.
References sbuild::chroot::chroot::add_facet(), sbuild::chroot::facet::mountable::create(), sbuild::chroot::chroot::get_facet(), sbuild::chroot::facet::facet::owner, and sbuild::chroot::facet::facet::set_chroot().
Referenced by sbuild::chroot::facet::lvm_snapshot::set_chroot(), and sbuild::chroot::facet::block_device::set_chroot().
void sbuild::chroot::facet::block_device_base::set_device | ( | const std::string & | device) |
Set the block device of the chroot.
This is the "source" device. It may be the case that the real device is different (for example, an LVM snapshot PV), but by default will be the device to mount.
device | the device. |
References device, sbuild::chroot::chroot::DEVICE_ABS, and sbuild::is_absname().
Referenced by set_keyfile().
|
protectedvirtual |
Set the chroot properties from a keyfile.
The chroot name must have previously been set, so that the correct keyfile group may be determined.
keyfile | the keyfile to get the properties from. |
Reimplemented from sbuild::chroot::facet::facet.
Reimplemented in sbuild::chroot::facet::lvm_snapshot.
References sbuild::chroot::chroot::get_name(), sbuild::keyfile::get_object_value(), sbuild::chroot::facet::facet::owner, sbuild::keyfile::PRIORITY_REQUIRED, and set_device().
Referenced by sbuild::chroot::facet::lvm_snapshot::set_keyfile().
|
virtual |
Set environment.
Set the environment that the setup scripts will see during execution.
env | the environment to set. |
Reimplemented from sbuild::chroot::facet::facet.
Reimplemented in sbuild::chroot::facet::lvm_snapshot.
References sbuild::environment::add(), and get_device().
Referenced by sbuild::chroot::facet::lvm_snapshot::setup_env().