#include <sbuild-lock.h>
Inheritance diagram for sbuild::device_lock:
Public Member Functions | |
device_lock (std::string const &device) | |
The constructor. | |
virtual | ~device_lock () |
The destructor. | |
virtual void | set_lock (lock::type lock_type, unsigned int timeout) |
Acquire a lock. | |
virtual void | unset_lock () |
Release a lock. | |
Private Attributes | |
std::string | device |
The device to lock. |
Set an advisory lock on a device. The lock is acquired using liblockdev lock_dev(). Note that a lock_type of LOCK_SHARED is equivalent to LOCK_EXCLUSIVE, because this lock type does not support shared locks.
Definition at line 166 of file sbuild-lock.h.
device_lock::device_lock | ( | std::string const & | device | ) |
The constructor.
device | the device to lock (full pathname). |
Definition at line 209 of file sbuild-lock.cc.
device_lock::~device_lock | ( | ) | [virtual] |
void device_lock::set_lock | ( | lock::type | lock_type, | |
unsigned int | timeout | |||
) | [virtual] |
Acquire a lock.
lock_type | the type of lock to acquire. | |
timeout | the time in seconds to wait on the lock. |
Implements sbuild::lock.
Definition at line 220 of file sbuild-lock.cc.
References sbuild::lock::DEVICE_LOCK, sbuild::lock::DEVICE_LOCK_TIMEOUT, sbuild::lock::DEVICE_TEST, sbuild::lock::DEVICE_UNLOCK, sbuild::lock::DEVICE_UNLOCK_TIMEOUT, sbuild::lock::LOCK_EXCLUSIVE, sbuild::lock::LOCK_SHARED, lock_timeout, sbuild::lock::set_timer(), and sbuild::lock::unset_timer().
Referenced by sbuild::chroot_lvm_snapshot::setup_lock(), sbuild::chroot_block_device::setup_lock(), and unset_lock().
Here is the call graph for this function:
Here is the caller graph for this function:
void device_lock::unset_lock | ( | ) | [virtual] |
Release a lock.
This is equivalent to set_lock with a lock_type of LOCK_NONE and a timeout of 0.
Implements sbuild::lock.
Definition at line 291 of file sbuild-lock.cc.
References sbuild::lock::LOCK_NONE, and set_lock().
Referenced by sbuild::chroot_lvm_snapshot::setup_lock(), and sbuild::chroot_block_device::setup_lock().
Here is the call graph for this function:
Here is the caller graph for this function:
std::string sbuild::device_lock::device [private] |