sbuild::DeviceLock Class Reference

Set an advisory lock on a device. More...

#include <sbuild-lock.h>

Inheritance diagram for sbuild::DeviceLock:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 DeviceLock (std::string const &device)
 The constructor.
virtual ~DeviceLock ()
void set_lock (Type lock_type, unsigned int timeout)
void unset_lock ()
 Release a lock.

Private Attributes

std::string device
 The device to lock.

Detailed Description

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.


Constructor & Destructor Documentation

DeviceLock::DeviceLock std::string const &  device  ) 
 

The constructor.

Parameters:
device the device to lock (full pathname).

DeviceLock::~DeviceLock  )  [virtual]
 


Member Function Documentation

void DeviceLock::set_lock Type  lock_type,
unsigned int  timeout
 

void DeviceLock::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.


Member Data Documentation

std::string sbuild::DeviceLock::device [private]
 

The device to lock.


The documentation for this class was generated from the following files:
Generated on Mon Jan 30 13:23:58 2006 for schroot by  doxygen 1.4.6