Public Member Functions | Protected Member Functions | Protected Attributes | Friends

sbuild::chroot_block_device_base Class Reference

A base class for block-device chroots. More...

#include <sbuild-chroot-block-device-base.h>

Inheritance diagram for sbuild::chroot_block_device_base:
Inheritance graph
[legend]
Collaboration diagram for sbuild::chroot_block_device_base:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~chroot_block_device_base ()
 The destructor.
std::string const & get_device () const
 Get the block device of the chroot.
void set_device (std::string const &device)
 Set the block device of the chroot.
virtual std::string get_path () const
 Get the path to the chroot.
std::string const & get_chroot_type () const
 Get the type of the chroot.
virtual void setup_env (chroot const &chroot, environment &env) const
 Set environment.
virtual session_flags get_session_flags (chroot const &chroot) const
 Get the session flags of the chroot.

Protected Member Functions

 chroot_block_device_base ()
 The constructor.
 chroot_block_device_base (const chroot_block_device_base &rhs)
 The copy constructor.
virtual void get_details (chroot const &chroot, format_detail &detail) const
 Get detailed information about the chroot for output.
virtual void get_keyfile (chroot const &chroot, keyfile &keyfile) const
 Copy the chroot properties into a keyfile.
virtual void set_keyfile (chroot &chroot, keyfile const &keyfile, string_list &used_keys)
 Set the chroot properties from a keyfile.

Protected Attributes

std::string device
 The block device to use.

Friends

class chroot

Detailed Description

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.


Constructor & Destructor Documentation

chroot_block_device_base::chroot_block_device_base (  )  [protected]
chroot_block_device_base::chroot_block_device_base ( const chroot_block_device_base rhs  )  [protected]

The copy constructor.

Todo:
Required to set mount_device. Remove once no longer needed.

References device.

chroot_block_device_base::~chroot_block_device_base (  )  [virtual]

The destructor.


Member Function Documentation

std::string const & chroot_block_device_base::get_chroot_type (  )  const [virtual]

Get the type of the chroot.

Returns:
the chroot type.

Implements sbuild::chroot.

Reimplemented in sbuild::chroot_lvm_snapshot.

void chroot_block_device_base::get_details ( chroot const &  chroot,
format_detail detail 
) const [protected, virtual]

Get detailed information about the chroot for output.

Parameters:
chroot the chroot to use.
detail the details to output to.

Implements sbuild::chroot.

Reimplemented in sbuild::chroot_block_device, and sbuild::chroot_lvm_snapshot.

References sbuild::_(), sbuild::format_detail::add(), device, and get_device().

std::string const & chroot_block_device_base::get_device (  )  const

Get the block device of the chroot.

Returns:
the device.

References device.

Referenced by get_details(), get_keyfile(), setup_env(), sbuild::chroot_lvm_snapshot::setup_lock(), and sbuild::chroot_block_device::setup_lock().

void chroot_block_device_base::get_keyfile ( chroot const &  chroot,
keyfile keyfile 
) const [protected, virtual]

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.

Parameters:
chroot the chroot to use.
keyfile the keyfile to use.

Implements sbuild::chroot.

Reimplemented in sbuild::chroot_block_device, and sbuild::chroot_lvm_snapshot.

References get_device(), sbuild::chroot::get_keyfile_name(), and sbuild::basic_keyfile< K, P >::set_object_value().

std::string chroot_block_device_base::get_path (  )  const [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.

Returns:
the path.

Implements sbuild::chroot.

References sbuild::chroot::get_mount_location().

sbuild::chroot::session_flags chroot_block_device_base::get_session_flags ( chroot const &  chroot  )  const [virtual]

Get the session flags of the chroot.

These determine how the Session controlling the chroot will operate.

Parameters:
chroot the chroot to use.
Returns:
the session flags.

Implements sbuild::chroot.

Reimplemented in sbuild::chroot_block_device, and sbuild::chroot_lvm_snapshot.

void chroot_block_device_base::set_device ( std::string const &  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.

Parameters:
device the device.

Todo:
: This may not be appropriate for derived classes such as lvm_snapshot, since re-setting the device could overwrite the mount device.

References sbuild::chroot::DEVICE_ABS, and sbuild::is_absname().

Referenced by set_keyfile().

void chroot_block_device_base::set_keyfile ( chroot chroot,
keyfile const &  keyfile,
string_list used_keys 
) [protected, virtual]

Set the chroot properties from a keyfile.

The chroot name must have previously been set, so that the correct keyfile group may be determined.

Parameters:
chroot the chroot to use.
keyfile the keyfile to get the properties from.
used_keys a list of the keys used will be set.

Implements sbuild::chroot.

Reimplemented in sbuild::chroot_block_device, and sbuild::chroot_lvm_snapshot.

References sbuild::chroot::get_keyfile_name(), sbuild::basic_keyfile< K, P >::get_object_value(), sbuild::keyfile_base::PRIORITY_REQUIRED, and set_device().

void chroot_block_device_base::setup_env ( chroot const &  chroot,
environment env 
) const [virtual]

Set environment.

Set the environment that the setup scripts will see during execution.

Parameters:
chroot the chroot to use.
env the environment to set.

Implements sbuild::chroot.

Reimplemented in sbuild::chroot_block_device, and sbuild::chroot_lvm_snapshot.

References sbuild::environment::add(), and get_device().


Friends And Related Function Documentation

friend class chroot [friend]

Member Data Documentation


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