10 #ifndef ZYPP_MEDIA_NG_WORKER_DEVICEDRIVER_H_INCLUDED 11 #define ZYPP_MEDIA_NG_WORKER_DEVICEDRIVER_H_INCLUDED 13 #include <zypp-media/ng/ProvideFwd> 14 #include <zypp-media/ng/worker/ProvideWorker> 15 #include <zypp-media/ng/HeaderValueMap> 16 #include <zypp-media/Mount> 17 #include <zypp-core/zyppng/base/Signals> 18 #include <zypp-core/zyppng/base/Base> 19 #include <zypp-core/zyppng/base/zyppglobal.h> 20 #include <zypp-core/zyppng/pipelines/Expected> 22 #include <unordered_map> 41 std::shared_ptr<Device>
_dev;
73 void setProvider ( ProvideWorkerWeakRef workerRef );
117 const std::vector<std::shared_ptr<Device>> &
knownDevices()
const;
122 std::unordered_map<std::string, AttachedMedia> &
attachedMedia();
174 static const std::function<bool( const zypp::media::MountEntry &)>
devicePredicate (
unsigned int majNr,
unsigned int minNr );
179 static const std::function<bool( const zypp::media::MountEntry &)>
fstypePredicate (
const std::string &src,
const std::vector<std::string> &fstypes );
184 static const std::function<bool( const zypp::media::MountEntry &)>
bindMountPredicate (
const std::string &src );
DeviceDriver(WorkerCaps::WorkerType wType)
void releaseIdleDevices()
bool detachMedia(const std::string &attachId)
virtual AttachResult mountDevice(const uint32_t id, const zypp::Url &mediaUrl, const std::string &attachId, const std::string &label, const HeaderValueMap &extras)=0
std::unordered_map< std::string, AttachedMedia > & attachedMedia()
ProvideWorkerWeakRef _parentWorker
zypp::Pathname attachRoot() const
bool _ephemeral
If set to true the device is removed from the internal list after the last attachpoint was released...
std::unordered_map< std::string, std::any > _properties
std::vector< std::shared_ptr< Device > > _sysDevs
expected< void, AttachError > AttachResult
WorkerCaps::WorkerType _wType
virtual void immediateShutdown()
unsigned int _maj_nr
Major number of the device.
virtual zyppng::expected< WorkerCaps > initialize(const zyppng::worker::Configuration &conf)
std::unordered_map< std::string, AttachedMedia > _attachedMedia
ProvideWorkerRef parentWorker() const
static const std::function< bool(const zypp::media::MountEntry &)> bindMountPredicate(const std::string &src)
const zyppng::worker::Configuration & config() const
unsigned int _min_nr
Minor number of the device.
zypp::Pathname _attachRoot
std::string _name
Path of the device node or URL for e.g. nfs devices.
void removeAttachPoint(const zypp::Pathname &attach_pt) const
std::vector< std::shared_ptr< Device > > & knownDevices()
zypp::Pathname createAttachPoint(const zypp::Pathname &attach_root) const
void setAttachRoot(const zypp::Pathname &root)
bool checkAttached(const zypp::Pathname &mountPoint, const std::function< bool(const zypp::media::MountEntry &)> predicate)
Base class for Exception.
static const std::function< bool(const zypp::media::MountEntry &)> devicePredicate(unsigned int majNr, unsigned int minNr)
ZYPP_FWD_DECL_TYPE_WITH_REFS(DeviceDriver)
A "struct mntent" like mount entry structure, but using std::strings.
zypp::Pathname _mountPoint
Mountpoint of the device, if empty dev is not mounted.
zypp::proto::Configuration Configuration
void setProvider(ProvideWorkerWeakRef workerRef)
zyppng::expected< void > isDesiredMedium(const zypp::Url &deviceUrl, const zypp::Pathname &mountPoint, const zyppng::MediaDataVerifierRef &verifier, uint mediaNr=1)
virtual bool isVolatile() const
static const std::function< bool(const zypp::media::MountEntry &)> fstypePredicate(const std::string &src, const std::vector< std::string > &fstypes)
zyppng::worker::Configuration _config
virtual void detectDevices()
virtual void unmountDevice(Device &dev)
AttachError(const uint code, const std::string &reason, const bool transient, const HeaderValueMap &extra={})