libzypp 17.31.23
|
#include </home/abuild/rpmbuild/BUILD/libzypp-17.31.23/zypp-media/ng/worker/devicedriver.h>
Public Member Functions | |
DeviceDriver (WorkerCaps::WorkerType wType) | |
void | setProvider (ProvideWorkerWeakRef workerRef) |
virtual AttachResult | mountDevice (const uint32_t id, const zypp::Url &mediaUrl, const std::string &attachId, const std::string &label, const HeaderValueMap &extras)=0 |
virtual zyppng::expected< WorkerCaps > | initialize (const zyppng::worker::Configuration &conf) |
bool | detachMedia (const std::string &attachId) |
void | releaseIdleDevices () |
virtual void | detectDevices () |
std::vector< std::shared_ptr< Device > > & | knownDevices () |
const std::vector< std::shared_ptr< Device > > & | knownDevices () const |
std::unordered_map< std::string, AttachedMedia > & | attachedMedia () |
virtual bool | isVolatile () const |
void | setAttachRoot (const zypp::Pathname &root) |
zypp::Pathname | attachRoot () const |
virtual void | immediateShutdown () |
ProvideWorkerRef | parentWorker () const |
const zyppng::worker::Configuration & | config () const |
Protected Member Functions | |
virtual void | unmountDevice (Device &dev) |
zyppng::expected< void > | isDesiredMedium (const zypp::Url &deviceUrl, const zypp::Pathname &mountPoint, const zyppng::MediaDataVerifierRef &verifier, uint mediaNr=1) |
zypp::Pathname | createAttachPoint (const zypp::Pathname &attach_root) const |
void | removeAttachPoint (const zypp::Pathname &attach_pt) const |
bool | checkAttached (const zypp::Pathname &mountPoint, const std::function< bool(const zypp::media::MountEntry &)> predicate) |
Static Protected Member Functions | |
static const std::function< bool(const zypp::media::MountEntry &)> | devicePredicate (unsigned int majNr, unsigned int minNr) |
static const std::function< bool(const zypp::media::MountEntry &)> | fstypePredicate (const std::string &src, const std::vector< std::string > &fstypes) |
static const std::function< bool(const zypp::media::MountEntry &)> | bindMountPredicate (const std::string &src) |
Private Attributes | |
WorkerCaps::WorkerType | _wType |
zyppng::worker::Configuration | _config |
time_t | _attach_mtime = 0 |
zypp::Pathname | _attachRoot |
std::vector< std::shared_ptr< Device > > | _sysDevs |
std::unordered_map< std::string, AttachedMedia > | _attachedMedia |
ProvideWorkerWeakRef | _parentWorker |
Abstract base class to be used together with the
Definition at line 64 of file devicedriver.h.
zyppng::worker::DeviceDriver::DeviceDriver | ( | WorkerCaps::WorkerType | wType | ) |
Definition at line 25 of file devicedriver.cc.
void zyppng::worker::DeviceDriver::setProvider | ( | ProvideWorkerWeakRef | workerRef | ) |
Tells the driver which provide worker to use when requiring auth data or media changes
Definition at line 29 of file devicedriver.cc.
|
pure virtual |
Called by the provide loop whenever a attach request is received.
|
virtual |
Definition at line 34 of file devicedriver.cc.
bool zyppng::worker::DeviceDriver::detachMedia | ( | const std::string & | attachId | ) |
Detaches the medium referenced by attachId. Returns false if the medium could not be found
Definition at line 60 of file devicedriver.cc.
void zyppng::worker::DeviceDriver::releaseIdleDevices | ( | ) |
Physically detaches all devices that are not referenced by a attachment anymore
Definition at line 70 of file devicedriver.cc.
|
virtual |
Called by the parent to populate the device array every time a provide request arrives, only relevant for workers that operate on detectable devices. The base implementation does nothing
Definition at line 85 of file devicedriver.cc.
std::vector< std::shared_ptr< Device > > & zyppng::worker::DeviceDriver::knownDevices | ( | ) |
Returns a list of all currently known devices, a subclass should always make sure that all currently mounted devices are present in that list.
Definition at line 90 of file devicedriver.cc.
const std::vector< std::shared_ptr< Device > > & zyppng::worker::DeviceDriver::knownDevices | ( | ) | const |
Returns a list of all currently known devices, a subclass should always make sure that all currently mounted devices are present in that list.
Definition at line 95 of file devicedriver.cc.
std::unordered_map< std::string, AttachedMedia > & zyppng::worker::DeviceDriver::attachedMedia | ( | ) |
Returns the list of currently attached medias
Definition at line 100 of file devicedriver.cc.
|
virtual |
Returns true if the worker handles volatile devices ( e.g. DVDs ). The default impl returns false.
Definition at line 139 of file devicedriver.cc.
void zyppng::worker::DeviceDriver::setAttachRoot | ( | const zypp::Pathname & | root | ) |
Changes the attach root to a specific path, otherwise realpath(".") is used.
Definition at line 144 of file devicedriver.cc.
zypp::Pathname zyppng::worker::DeviceDriver::attachRoot | ( | ) | const |
Returns the attachRoot as dictated by the controller
Definition at line 149 of file devicedriver.cc.
|
virtual |
The system is shutting down, release all ressources
Definition at line 105 of file devicedriver.cc.
ProvideWorkerRef zyppng::worker::DeviceDriver::parentWorker | ( | ) | const |
Returns the parent worker if set
Definition at line 119 of file devicedriver.cc.
const zyppng::worker::Configuration & zyppng::worker::DeviceDriver::config | ( | ) | const |
Returns the configuration that was sent by the controller
Definition at line 158 of file devicedriver.cc.
|
protectedvirtual |
Forcefully unmounts the device, this does not check if there any attached medias still relying on it
Definition at line 124 of file devicedriver.cc.
|
protected |
Checks if the medium deviceUrl mounted on path matches the verifier and mediaNr
Definition at line 163 of file devicedriver.cc.
|
protected |
Definition at line 210 of file devicedriver.cc.
|
protected |
Definition at line 269 of file devicedriver.cc.
|
protected |
Definition at line 284 of file devicedriver.cc.
|
staticprotected |
Returns a predicate for the checkAttached function that looks for a real device in the mount table
Definition at line 316 of file devicedriver.cc.
|
staticprotected |
Returns a predicate for the checkAttached function that looks for a virtual mount ( like smb or nfs ) in the mount table
Definition at line 332 of file devicedriver.cc.
|
staticprotected |
Returns a predicate for the checkAttached function that looks for a bind mount in the mount table
Definition at line 348 of file devicedriver.cc.
|
private |
Definition at line 187 of file devicedriver.h.
|
private |
Definition at line 188 of file devicedriver.h.
|
private |
Definition at line 189 of file devicedriver.h.
|
private |
Definition at line 190 of file devicedriver.h.
|
private |
Definition at line 191 of file devicedriver.h.
|
private |
Definition at line 192 of file devicedriver.h.
|
private |
Definition at line 193 of file devicedriver.h.