sbuild  1.7.1
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
sbuild::chroot::facet::block_device Class Reference

A chroot stored on an unmounted block device. More...

#include <block-device.h>

+ Inheritance diagram for sbuild::chroot::facet::block_device:
+ Collaboration diagram for sbuild::chroot::facet::block_device:

Public Types

typedef std::shared_ptr
< block_device
ptr
 A shared_ptr to a chroot facet object.
 
typedef std::shared_ptr< const
block_device
const_ptr
 A shared_ptr to a const chroot facet object.
 
- Public Types inherited from sbuild::chroot::facet::block_device_base
typedef chroot::error error
 Exception type.
 
- Public Types inherited from sbuild::chroot::facet::facet
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< facetptr
 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.
 
- Public Types inherited from sbuild::chroot::facet::storage
typedef std::shared_ptr< storageptr
 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 Types inherited from sbuild::chroot::facet::session_setup
typedef std::shared_ptr
< session_setup
ptr
 A shared_ptr to a chroot session_setup object.
 
typedef std::shared_ptr< const
session_setup
const_ptr
 A shared_ptr to a const chroot session_setup object.
 

Public Member Functions

virtual ~block_device ()
 The destructor.
 
virtual std::string const & get_name () const
 Get the name of the chroot facet. More...
 
virtual facet::ptr clone () const
 Copy the chroot facet. More...
 
virtual void chroot_session_setup (const chroot &parent, const std::string &session_id, const std::string &alias, const std::string &user, bool root)
 Set up a newly-cloned session chroot. More...
 
- Public Member Functions inherited from sbuild::chroot::facet::block_device_base
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...
 
- Public Member Functions inherited from sbuild::chroot::facet::facet
virtual ~facet ()
 The destructor.
 
virtual session_flags get_session_flags () const
 Get the session flags of the chroot. More...
 
- Public Member Functions inherited from sbuild::chroot::facet::storage
virtual ~storage ()
 The destructor.
 
- Public Member Functions inherited from sbuild::chroot::facet::session_setup
virtual ~session_setup ()
 The destructor.
 

Static Public Member Functions

static ptr create ()
 Create a chroot facet. More...
 
static ptr create (const lvm_snapshot &rhs)
 Create a chroot facet copied from an LVM snapshot. More...
 

Protected Member Functions

 block_device ()
 The constructor.
 
 block_device (const block_device &rhs)
 The copy constructor.
 
 block_device (const lvm_snapshot &rhs)
 The copy constructor.
 
void set_chroot (chroot &chroot, bool copy)
 Set containing chroot. More...
 
virtual void setup_lock (chroot::setup_type type, bool lock, int status)
 
- Protected Member Functions inherited from sbuild::chroot::facet::block_device_base
 block_device_base ()
 The constructor.
 
 block_device_base (const block_device_base &rhs)
 The copy constructor.
 
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...
 
- Protected Member Functions inherited from sbuild::chroot::facet::facet
 facet ()
 The constructor.
 
- Protected Member Functions inherited from sbuild::chroot::facet::storage
 storage ()
 The constructor.
 
- Protected Member Functions inherited from sbuild::chroot::facet::session_setup
 session_setup ()
 The constructor.
 

Friends

class chroot
 
class lvm_snapshot
 

Additional Inherited Members

- Protected Attributes inherited from sbuild::chroot::facet::block_device_base
std::string device
 The block device to use.
 

Detailed Description

A chroot stored on an unmounted block device.

The device will be mounted on demand.

Member Function Documentation

void sbuild::chroot::facet::block_device::chroot_session_setup ( const chroot parent,
const std::string &  session_id,
const std::string &  alias,
const std::string &  user,
bool  root 
)
virtual

Set up a newly-cloned session chroot.

Parameters
parentthe parent of the cloned chroot.
session_idthe identifier (session_id) for the new session.
aliasused to initially identify the chroot.
userthe user creating the session.
roottrue if the user has root access, otherwise false.

Implements sbuild::chroot::facet::session_setup.

References sbuild::chroot::facet::block_device_base::get_device(), sbuild::chroot::chroot::get_facet(), and sbuild::chroot::facet::facet::owner.

facet::ptr sbuild::chroot::facet::block_device::clone ( ) const
virtual

Copy the chroot facet.

This is a virtual copy constructor.

Returns
a shared_ptr to the new copy of the chroot facet.

Implements sbuild::chroot::facet::facet.

References block_device().

block_device::ptr sbuild::chroot::facet::block_device::create ( )
static

Create a chroot facet.

Returns
a shared_ptr to the new chroot facet.

References block_device().

Referenced by sbuild::chroot::facet::lvm_snapshot::chroot_source_setup().

+ Here is the caller graph for this function:

block_device::ptr sbuild::chroot::facet::block_device::create ( const lvm_snapshot rhs)
static

Create a chroot facet copied from an LVM snapshot.

Parameters
rhsthe LVM snapshot to copy.
Returns
a shared_ptr to the new chroot facet.

References block_device().

std::string const & sbuild::chroot::facet::block_device::get_name ( ) const
virtual

Get the name of the chroot facet.

Returns
the chroot facet name.

Implements sbuild::chroot::facet::facet.

void sbuild::chroot::facet::block_device::set_chroot ( chroot chroot,
bool  copy 
)
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.

Parameters
chrootthe chroot containing this facet.
copytrue if the facet has been copied, or false if this is a new instance.

Reimplemented from sbuild::chroot::facet::block_device_base.

References sbuild::chroot::chroot::add_facet(), sbuild::chroot::facet::session_clonable::create(), sbuild::chroot::facet::fsunion::create(), sbuild::chroot::chroot::get_facet(), sbuild::chroot::facet::facet::owner, and sbuild::chroot::facet::block_device_base::set_chroot().


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