libzypp  17.6.0
zypp::media::MediaManager Class Reference

Manages access to the 'physical' media, e.g CDROM drives, Disk volumes, directory trees, etc, using Media Access Url's. More...

#include <MediaManager.h>

Inheritance diagram for zypp::media::MediaManager:

Public Member Functions

 MediaManager ()
 Creates a MediaManager envelope instance. More...
 
 ~MediaManager ()
 Destroys MediaManager envelope instance. More...
 
MediaAccessId open (const Url &url, const Pathname &preferred_attach_point="")
 Opens the media access for specified with the url. More...
 
void close (MediaAccessId accessId)
 Close the media access with specified id. More...
 
bool isOpen (MediaAccessId accessId) const
 Query if the media access is open / exists. More...
 
std::string protocol (MediaAccessId accessId) const
 Query the protocol name used by the media access handler. More...
 
bool downloads (MediaAccessId accessId) const
 Hint if files are downloaded or not. More...
 
Url url (MediaAccessId accessId) const
 Returns the Media Access Url of the media access id. More...
 
void addVerifier (MediaAccessId accessId, const MediaVerifierRef &verifier)
 Add verifier implementation for the specified media id. More...
 
void delVerifier (MediaAccessId accessId)
 Remove verifier for specified media id. More...
 
bool setAttachPrefix (const Pathname &attach_prefix)
 Set or resets the directory name, where the media manager handlers create their temporary attach points (see open() function). More...
 
void attach (MediaAccessId accessId)
 Attach the media using the concrete handler (checks all devices). More...
 
void release (MediaAccessId accessId, const std::string &ejectDev="")
 Release the attached media and optionally eject. More...
 
void releaseAll ()
 Release all attached media. More...
 
void disconnect (MediaAccessId accessId)
 Disconnect a remote media. More...
 
bool isAttached (MediaAccessId accessId) const
 Check if media is attached or not. More...
 
bool isSharedMedia (MediaAccessId accessId) const
 Returns information if media is on a shared physical device or not. More...
 
bool isDesiredMedia (MediaAccessId accessId) const
 Ask the registered verifier if the attached media is the desired one or not. More...
 
bool isDesiredMedia (MediaAccessId accessId, const MediaVerifierRef &verifier) const
 Ask the specified verifier if the attached media is the desired one or not. More...
 
bool isChangeable (MediaAccessId accessId)
 Simple check, based on media's URL scheme, telling whether the it is possible to physically change the media inside its drive, like CDs or DVDs. More...
 
Pathname localRoot (MediaAccessId accessId) const
 Return the local directory that corresponds to medias url, no matter if media isAttached or not. More...
 
Pathname localPath (MediaAccessId accessId, const Pathname &pathname) const
 Shortcut for 'localRoot() + pathname', but returns an empty pathname if media is not attached. More...
 
void provideFile (MediaAccessId accessId, const Pathname &filename, const ByteCount &expectedFileSize) const
 Provide provide file denoted by relative path below of the 'attach point' of the specified media and the path prefix on the media. More...
 
void provideFile (MediaAccessId accessId, const Pathname &filename) const
 
void provideDir (MediaAccessId accessId, const Pathname &dirname) const
 FIXME: see MediaAccess class. More...
 
void provideDirTree (MediaAccessId accessId, const Pathname &dirname) const
 FIXME: see MediaAccess class. More...
 
void releaseFile (MediaAccessId accessId, const Pathname &filename) const
 FIXME: see MediaAccess class. More...
 
void releaseDir (MediaAccessId accessId, const Pathname &dirname) const
 FIXME: see MediaAccess class. More...
 
void releasePath (MediaAccessId accessId, const Pathname &pathname) const
 FIXME: see MediaAccess class. More...
 
void dirInfo (MediaAccessId accessId, std::list< std::string > &retlist, const Pathname &dirname, bool dots=true) const
 FIXME: see MediaAccess class. More...
 
void dirInfo (MediaAccessId accessId, filesystem::DirContent &retlist, const Pathname &dirname, bool dots=true) const
 FIXME: see MediaAccess class. More...
 
bool doesFileExist (MediaAccessId accessId, const Pathname &filename) const
 FIXME: see MediaAccess class. More...
 
void getDetectedDevices (MediaAccessId accessId, std::vector< std::string > &devices, unsigned int &index) const
 Fill in a vector of detected ejectable devices and the index of the currently attached device within the vector. More...
 
void setDeltafile (MediaAccessId accessId, const Pathname &filename) const
 
bool isUseableAttachPoint (const Pathname &path, bool mtab=true) const
 Check if the specified path is useable as attach point. More...
 

Static Public Member Functions

static time_t getMountTableMTime ()
 Get the modification time of the /etc/mtab file. More...
 
static std::vector< MountEntrygetMountEntries ()
 Get current mount entries from /etc/mtab file. More...
 

Private Member Functions

AttachedMedia getAttachedMedia (MediaAccessId &accessId) const
 
AttachedMedia findAttachedMedia (const MediaSourceRef &media) const
 
void forceReleaseShared (const MediaSourceRef &media)
 

Static Private Attributes

static zypp::RW_pointer< MediaManager_Implm_impl
 Static reference to the implementation (singleton). More...
 

Friends

class MediaHandler
 

Detailed Description

Manages access to the 'physical' media, e.g CDROM drives, Disk volumes, directory trees, etc, using Media Access Url's.

Note
The MediaManager class is just an envelope around an inner singleton like implementation.
That is, you can create as many managers as you want, also temporary in a function call.
But don't declare static MediaManager instances, unless you want to force (mutex) initialization order problems!

Media Access Url

The MediaManager uses several media access handlers (backends), that can be specified by a Media Access URL in its open() method.

All URLs may contain following query parameters, that are reserved by the Source classes and unused/ignored by the media manager:

  • alias: A source specific media alias string.

Currently, following access handlers (backends) are implemented:

MediaCD - CD/DVD drives (cd, dvd)

The access handler for media on CD / DVD drives.

  • Scheme:
    • cd: Requires a drive supporting CD media.
    • dvd: Prefers a drive supporting DVD media.
  • Examples:
    "cd:/"
    "cd:/?devices=/dev/hda,/dev/hdb"
    "cd:/subdir?devices=/dev/hda,/dev/hdb"
    "dvd:/"
    "dvd:/?devices=/dev/hda,/dev/hdb"
    "dvd:/subdir?devices=/dev/hda,/dev/hdb"
    Note: You can use either "dvd:/" (just path, no authority) or "dvd:///" (path and empty authority).
  • Query parameters:
    • devices: Optional parameter, containing a comma separated list of block device names to use, e.g.: "/dev/sr0,/dev/sr1".
      The device names will be verified using a HAL query. If one of the provided devices is not usable (not a block device, or does not support required media type), an exception is thrown.
      If the devices parameter is not provided (or empty), all avaliable CD/DVD drives 'detected' using a HAL query. The preferred drive (used as first drive) is the drive pointed to by the symlink "/dev/dvd" ("dvd" scheme only) or "/dev/cdrom".
  • Authority: A non-empty authority URL component (e.g. containing a host name) is not allowed.
  • Path name: Mandatory URL component, that specifies a subdirectory on the CD/DVD, where the desired files are located.

MediaDISK - HD disk volumes (hd)

The access handler for media on a disk volume (partition).

  • Scheme:
    • hd
  • Examples:
    "hd:/?device=/dev/hda1"
    "hd:/subdir?device=/dev/sda1"
    "hd:/subdir?device=/dev/sda1&filesystem=reiserfs"
    Note: You can use either "hd:/" (just path, no authority) or "hd:///" (path and empty authority).
  • Query parameters:
    • device: Mandatory parameter specifying the name of the block device of the partition to mount.
    • filesystem: The name of the filesystem. Defaults to "auto".
  • Authority: A non-empty authority URL component is not allowed.
  • Path name: Mandatory URL component, that specifies a subdirectory on the disk partition, where the desired files are located.

MediaDIR - Local directory tree (dir, file)

The access handler to media stored in a local directory tree.

  • Scheme:
    • dir
    • file
  • Examples:
    "dir:/directory/name"
    "file:/directory/name"
  • Query parameters: none
  • Authority: A non-empty authority URL component (e.g. containing a host name) is not allowed.
  • Path name: Mandatory URL component, that specifies a directory, where the desired files are located.

MediaISO - Loopback ISO images (iso)

The access handler for media in a ISO image (loopback mount).

  • Scheme:
    • iso
  • Examples:
    "iso:/?iso=/path/to/CD1.iso"
    "iso:/?iso=CD1.iso&url=dir:/path/to"
    "iso:/?iso=CD1.iso&url=nfs://server/path/to/media"
    "iso:/?iso=CD1.iso&url=hd:/?device=/dev/hda"
    "iso:/subdir?iso=DVD1.iso&url=nfs://nfs-server/directory&mnt=/nfs/attach/point&filesystem=udf"
  • Query parameters:
    • iso: Mandatory parameter specifying the name of the iso file.
      If the url parameter is missed, the iso parameter has to contain an absolute iso file name.
    • url: Optional parameter specifying the URL to the directory containing the iso file.
      The supported URL schemes are: hd, dir, file, nfs, nfs4, smb, cifs.
    • mnt: Optional parameter specifying the prefered attach point for the source media url.
    • filesystem: Optional name of the filesystem used in the iso file. Defaults to "auto".
  • Authority: A non-empty authority URL component is not allowed.
  • Path name: Mandatory URL component, that specifies a subdirectory inside of the iso file, where the desired files are located.

MediaNFS - NFS directory tree (nfs)

The access handler for media on NFS exported directory tree.

  • Scheme:
    • nfs
    • nfs
  • Examples:
    "nfs://nfs-server/exported/path"
    "nfs://nfs-server/exported/path?mountoptions=ro"
    "nfs://nfs-server/exported/path&type=nfs4"
    "nfs4://nfs-server/exported/path"
  • Query parameters:
    • mountoptions: The mount options separated by comma ','. Default is the "ro" option.
    • type=nfs4: Whether to mount as nfs4. This is the default for scheme nfs4.

Authority: The authority component has to provide a hostname. Username, password and port are currently ignored.

  • Path name: Mandatory URL component, that specifies the exported (sub-)directory on the NFS server, where the desired files are located.

MediaCIFS - CIFS/SMB directory tree (cifs, smb)

The access handler for media in a CIFS/SMB shared directory tree.

  • Scheme:
    • cifs
    • smb
  • Examples:
    "cifs://servername/share/path/on/the/share"
    "cifs://username:passwd@servername/share/path/on/the/share?mountoptions=ro"
    "cifs://username:passwd@servername/share/path/on/the/share?mountoptions=noguest"
    "smb://servername/share/path/on/the/share"
    "smb://username:passwd@servername/share/path/on/the/share?mountoptions=ro"
    Note: There is no difference between cifs and smb scheme (any more). In both cases the 'cifs' filesystem is used.
  • Query parameters:
    • mountoptions: The mount options separated by a comma ','. Default are the "ro" and "guest" options. Specify "noguest" to turn off "guest". This is necessary if Samba is configured to reject guest connections.
    • workgroup or domain: The name of the workgroup.
    • username: Alternative username to username in URL authority.
    • password: Alternative password to password in URL authority.
    • user: Alternative username (cifs specific variant)
    • pass: Alternative password (cifs specific variant)
  • Authority: The authority component has to provide a hostname. Optionally also a username and password.
  • Path name: Mandatory URL component, that specifies the share name with optional subdirectory, where the desired files are located.

MediaCurl - FTP/HTTP directory tree (ftp, tftp, http, https)

The access handler to media directory tree on a ftp/http server.

  • Scheme:
    • ftp
    • tftp
    • http
    • https
  • Examples:
    "ftp://server/relative/path/to/media/dir"
    "ftp://server/%2fabsolute/path/to/media/dir"
    "ftp://user:pass@server/path/to/media/dir"
    "ftp://user:pass@server/%2f/home/user/path/to/media/dir"
    "http://server/path/on/server"
    "http://user:pass@server/path"
    "https://user:pass@server/path?proxy=foo&proxyuser=me&proxypass=pw"
    Note: The "ftp" url scheme supports absolute and relative paths to the default ftp server directory (RFC1738, Section 3.2.2).
    To use an absolute path, you have to prepend the path with an additional slash, what results in a "/%2f" combination (second "/" encoded to "%2f") at the begin of the URL path.
    This is important, especially in user authenticated ftp, where the users home is usually the default directory of the server (except when the server chroots into the users home directory).
    For example, if the user "user" has a home directory "/home/user", you can use either an URL with a relative path to the home directory "ftp://user:pass@server/path/to/media" or the absolute path "ftp://user:pass@server/%2fhome/user/path/to/media" – both URLs points to the same directory on the server.
  • Query parameters:
    • cookies: Turn off using cookies by setting it to "0" (or false, no, off).
    • proxy: A proxy hostname or hostname and port separated by ':'. Setting the hostname to 'none' explicitly disables the use of a proxy even if configured in /etc/sysconfig/proxy or the environment.
    • proxyport: Alternative way to provide the proxy port.
    • proxyuser: The proxy username.
    • proxypass: The proxy password.
    • ssl_capath: The absolute CA directory to use, default is /etc/ssl/certs.
    • ssl_verify: Flag to modify the ssl verify behaviour. Valid values are: 'yes', 'no' and a comma separated list of 'host' and 'peer' flags.
      • 'no': disables ssl verify
      • 'yes': enables ssl verify, this is the default and is equivalent to 'host,peer'.
      • 'host': The server is considered the intended one, when the 'Common Name' field or a 'Subject Alternate Name' field in the certificate matches the host name in the URL.
      • 'peer': Verifies whether the certificate provided by the server is authentic against the chain of digital signatures found in ssl_capath.
    • ssl_clientcert Path to the ssl client certificate for authentication to a repo (CURLOPT_SSLCERT).
    • ssl_clientkey Path to the ssl client key for authentication to a repo (CURLOPT_SSLKEY).
    • timeout: Transfer timeout in seconds between 0 and 3600, 0 disables the timeout, default timeout is 180 seconds.
    • auth: A comma separated list of http authentication method names to use: 'basic', 'digest', 'ntlm', 'negotiate', 'spnego', 'gssnego'. Note, that this list depends on the list of methods supported by the curl library.
    • mediahandler: Set the mediahandler for this url Valid values are: 'curl', 'multicurl'
  • Authority: The authority component has to provide a hostname. Optionally also a username and password. In case of the 'ftp' scheme, username and password defaults to 'anonymous' and 'yast2@'.
  • Path name: Mandatory URL component, that specifies the path name on the server, where the desired files are located.

Proxy settings: If no proxy settings are present in tha URLs query parameters, the media handler reads the system wide proxy settings from the /etc/sysconfig/proxy file. If a proxy setting was present, but the proxy password not, it attempts to read the proxy-user variable from the ~/.curlrc (/root/.curlrc) file.
If no proxy setting was present, then libzypp does not pass any proxy settings to curl, but curl fallbacks to use the content of the http_proxy, ftp_proxy, etc environment variables.

MediaPlugin - custom media handler

Media access is delegated to a script located in the libzypp media plugin directory. The URLs query options are translated into commandline arguments passed to the script.

  • Scheme:
    • plugin
  • Examples:
    "plugin:script?loptv=lvalue&v=optv&lopt=&o&=foo"
    \__________/ \____/ \___/ | \_/
    __________/__ ____/_ _|_ \ \___
    / \ / \ / \ /\ / \
    script --loptv "lvalue" -v "optv" --lopt -o -- foo
  • Query parameters:
    • The URLs query options are translated into commandline arguments passed to the script.
    • Note: No option may appear twice, as the (option,value) pairs are stored in a hash.
    • Note: The order in which the query options are passes to the script is arbitrary, except for an option with an empty key, which is translated into '– value' and passed as final option.
    • 'c[=[value]]' ist passed as '-c [value]'
    • 'word[=[value]]' ist passed as '–word [value]'
    • '[=value]' ist passed as last args as '– [value]'
  • script<->libzypp communication:
    • to be documented.

Definition at line 473 of file MediaManager.h.

Constructor & Destructor Documentation

◆ MediaManager()

zypp::media::MediaManager::MediaManager ( )

Creates a MediaManager envelope instance.

In the case, that the inner implementation is not already allocated, and the MediaManager constructor was unable to allocate it, a std::bad_alloc exception is thrown.

All further instances increase the use counter only.

Exceptions
std::bad_alloc

Definition at line 235 of file MediaManager.cc.

◆ ~MediaManager()

zypp::media::MediaManager::~MediaManager ( )

Destroys MediaManager envelope instance.

Decreases the use counter of the inner implementation.

Definition at line 245 of file MediaManager.cc.

Member Function Documentation

◆ open()

MediaAccessId zypp::media::MediaManager::open ( const Url url,
const Pathname preferred_attach_point = "" 
)

Opens the media access for specified with the url.

If the preferred_attach_point parameter does not point to a usable attach point directory, the media manager automatically creates a temporary attach point in a default directory. This default directory can be changed using setAttachPrefix() function.

Remember to close() each id you've opened and not need any more. It is like a new and delete!

Parameters
urlThe Media Access Url.
preferred_attach_pointThe preferred, already existing directory, where the media should be attached.
Returns
a new media access id.
Exceptions
std::bad_alloc
MediaException

Definition at line 251 of file MediaManager.cc.

◆ close()

void zypp::media::MediaManager::close ( MediaAccessId  accessId)

Close the media access with specified id.

Parameters
accessIdThe media access id to close.

Definition at line 273 of file MediaManager.cc.

◆ isOpen()

bool zypp::media::MediaManager::isOpen ( MediaAccessId  accessId) const

Query if the media access is open / exists.

Parameters
accessIdThe media access id to query.
Returns
true, if access id is known and open.

Definition at line 309 of file MediaManager.cc.

◆ protocol()

std::string zypp::media::MediaManager::protocol ( MediaAccessId  accessId) const

Query the protocol name used by the media access handler.

Similar to url().getScheme().

Parameters
accessIdThe media access id to query.
Returns
The protocol name used by the media access handler, otherwise 'unknown'.
Exceptions
MediaNotOpenExceptionfor invalid access id.

Definition at line 320 of file MediaManager.cc.

◆ downloads()

bool zypp::media::MediaManager::downloads ( MediaAccessId  accessId) const

Hint if files are downloaded or not.

Parameters
accessIdThe media access id to query.
Returns
True, if provideFile downloads files.

Definition at line 331 of file MediaManager.cc.

◆ url()

Url zypp::media::MediaManager::url ( MediaAccessId  accessId) const

Returns the Media Access Url of the media access id.

Parameters
accessIdThe media access id to query.
Returns
The Media Access Url used by the media access id.
Exceptions
MediaNotOpenExceptionfor invalid access id.

Definition at line 342 of file MediaManager.cc.

◆ addVerifier()

void zypp::media::MediaManager::addVerifier ( MediaAccessId  accessId,
const MediaVerifierRef verifier 
)

Add verifier implementation for the specified media id.

By default, the NoVerifier is used.

Parameters
accessIdA media access id.
verifierThe new verifier.
Exceptions
MediaNotOpenExceptionfor invalid access id.

Definition at line 353 of file MediaManager.cc.

◆ delVerifier()

void zypp::media::MediaManager::delVerifier ( MediaAccessId  accessId)

Remove verifier for specified media id.

It resets the verifier to NoVerifier.

Parameters
accessIdA media access id.
Exceptions
MediaNotOpenExceptionfor invalid access id.

Definition at line 372 of file MediaManager.cc.

◆ setAttachPrefix()

bool zypp::media::MediaManager::setAttachPrefix ( const Pathname attach_prefix)

Set or resets the directory name, where the media manager handlers create their temporary attach points (see open() function).

It has effect to newly created temporary attach points only.

Parameters
attach_prefixThe new prefix for temporary attach points, or empty pathname to reset to defaults.
Returns
True on success, false if the attach_prefix parameters contains a path name, that does not point to a writable directory.

Definition at line 388 of file MediaManager.cc.

◆ attach()

void zypp::media::MediaManager::attach ( MediaAccessId  accessId)

Attach the media using the concrete handler (checks all devices).

Remember to release() or close() each id you've attached and not need any more. Attach is like an open of a file!

Parameters
accessIdA media access id.
Exceptions
MediaNotOpenExceptionfor invalid access id.

Definition at line 396 of file MediaManager.cc.

◆ release()

void zypp::media::MediaManager::release ( MediaAccessId  accessId,
const std::string &  ejectDev = "" 
)

Release the attached media and optionally eject.

If the ejectDev parameter is not empty all other access id's are released and the specified drive (CD/DVD drive) is ejected.

Parameters
accessIdA media access id.
ejectDevDevice to eject. None if empty.
Exceptions
MediaNotOpenExceptionfor invalid access id.

Definition at line 466 of file MediaManager.cc.

◆ releaseAll()

void zypp::media::MediaManager::releaseAll ( )

Release all attached media.

Definition at line 510 of file MediaManager.cc.

◆ disconnect()

void zypp::media::MediaManager::disconnect ( MediaAccessId  accessId)

Disconnect a remote media.

This is useful for media which e.g. holds open a connection to a server like FTP. After calling disconnect() the media object (attach point) is still valid and files are present.

But after calling disconnect() it's not possible to call fetch more data using the provideFile() or provideDir() functions anymore.

Parameters
accessIdA media access id.
Exceptions
MediaNotOpenExceptionfor invalid access id.

Definition at line 547 of file MediaManager.cc.

◆ isAttached()

bool zypp::media::MediaManager::isAttached ( MediaAccessId  accessId) const

Check if media is attached or not.

Parameters
accessIdA media access id.
Returns
True if media is attached.
Exceptions
MediaNotOpenExceptionfor invalid access id.

Definition at line 558 of file MediaManager.cc.

◆ isSharedMedia()

bool zypp::media::MediaManager::isSharedMedia ( MediaAccessId  accessId) const

Returns information if media is on a shared physical device or not.

Parameters
accessIdA media access id.
Returns
True if it is shared, false if not.
Exceptions
MediaNotOpenExceptionfor invalid access id.

Definition at line 568 of file MediaManager.cc.

◆ isDesiredMedia() [1/2]

bool zypp::media::MediaManager::isDesiredMedia ( MediaAccessId  accessId) const

Ask the registered verifier if the attached media is the desired one or not.

Parameters
accessIdA media access id.
Returns
True if media is attached and desired according to the actual verifier.
Exceptions
MediaNotOpenExceptionfor invalid access id.

Definition at line 579 of file MediaManager.cc.

◆ isDesiredMedia() [2/2]

bool zypp::media::MediaManager::isDesiredMedia ( MediaAccessId  accessId,
const MediaVerifierRef verifier 
) const

Ask the specified verifier if the attached media is the desired one or not.

Parameters
accessIdA media access id.
verifierA verifier to use.
Returns
True if media is attached and desired according to the specified verifier.
Exceptions
MediaNotOpenExceptionfor invalid access id.

Definition at line 608 of file MediaManager.cc.

◆ isChangeable()

bool zypp::media::MediaManager::isChangeable ( MediaAccessId  accessId)

Simple check, based on media's URL scheme, telling whether the it is possible to physically change the media inside its drive, like CDs or DVDs.

Useful to decide whether to request media change from user or not.

Parameters
accessIdThe media access id.
Returns
false if the media is not changeable, true otherwise.
Exceptions
MediaNotOpenExceptionfor invalid access id.

Definition at line 639 of file MediaManager.cc.

◆ localRoot()

Pathname zypp::media::MediaManager::localRoot ( MediaAccessId  accessId) const

Return the local directory that corresponds to medias url, no matter if media isAttached or not.

Files requested will be available at 'localRoot() + filename' or even better 'localPath( filename )'

Parameters
accessIdA media access id.
Returns
The directory name pointing to the media root in local filesystem or an empty pathname if the media is not attached.
Exceptions
MediaNotOpenExceptionfor invalid access id.

Definition at line 646 of file MediaManager.cc.

◆ localPath()

Pathname zypp::media::MediaManager::localPath ( MediaAccessId  accessId,
const Pathname pathname 
) const

Shortcut for 'localRoot() + pathname', but returns an empty pathname if media is not attached.

Files provided will be available at 'localPath(filename)'.

Parameters
accessIdA media access id.
pathnameA path name relative to the localRoot().
Returns
The directory name in local filesystem pointing to the desired relative pathname on the media or an empty pathname if the media is not attached.
Exceptions
MediaNotOpenExceptionfor invalid access id.

Definition at line 659 of file MediaManager.cc.

◆ provideFile() [1/2]

void zypp::media::MediaManager::provideFile ( MediaAccessId  accessId,
const Pathname filename,
const ByteCount expectedFileSize 
) const

Provide provide file denoted by relative path below of the 'attach point' of the specified media and the path prefix on the media.

Parameters
accessIdThe media access id to use.
filenameThe filename to provide, relative to localRoot().
expectedFileSizeThe expected filesize, download will stop if it is exceeded
Exceptions
MediaNotOpenExceptionin case of invalid access id.
MediaNotAttachedExceptionin case, that the media is not attached.
MediaNotDesiredExceptionin case, that the media verification failed.
MediaNotAFileExceptionin case, that the requested filename is not a file.
MediaFileNotFoundExceptionin case, that the requested filenamedoes not exists.
MediaWriteExceptionin case, that the file can't be copied from from remote source.
MediaSystemExceptionin case a system operation fails.
MediaExceptionderived exception, depending on the url (handler).

Definition at line 672 of file MediaManager.cc.

◆ provideFile() [2/2]

void zypp::media::MediaManager::provideFile ( MediaAccessId  accessId,
const Pathname filename 
) const

Definition at line 687 of file MediaManager.cc.

◆ provideDir()

void zypp::media::MediaManager::provideDir ( MediaAccessId  accessId,
const Pathname dirname 
) const

FIXME: see MediaAccess class.

Definition at line 709 of file MediaManager.cc.

◆ provideDirTree()

void zypp::media::MediaManager::provideDirTree ( MediaAccessId  accessId,
const Pathname dirname 
) const

FIXME: see MediaAccess class.

Definition at line 723 of file MediaManager.cc.

◆ releaseFile()

void zypp::media::MediaManager::releaseFile ( MediaAccessId  accessId,
const Pathname filename 
) const

FIXME: see MediaAccess class.

Definition at line 737 of file MediaManager.cc.

◆ releaseDir()

void zypp::media::MediaManager::releaseDir ( MediaAccessId  accessId,
const Pathname dirname 
) const

FIXME: see MediaAccess class.

Definition at line 751 of file MediaManager.cc.

◆ releasePath()

void zypp::media::MediaManager::releasePath ( MediaAccessId  accessId,
const Pathname pathname 
) const

FIXME: see MediaAccess class.

Definition at line 766 of file MediaManager.cc.

◆ dirInfo() [1/2]

void zypp::media::MediaManager::dirInfo ( MediaAccessId  accessId,
std::list< std::string > &  retlist,
const Pathname dirname,
bool  dots = true 
) const

FIXME: see MediaAccess class.

Definition at line 780 of file MediaManager.cc.

◆ dirInfo() [2/2]

void zypp::media::MediaManager::dirInfo ( MediaAccessId  accessId,
filesystem::DirContent retlist,
const Pathname dirname,
bool  dots = true 
) const

FIXME: see MediaAccess class.

Definition at line 797 of file MediaManager.cc.

◆ doesFileExist()

bool zypp::media::MediaManager::doesFileExist ( MediaAccessId  accessId,
const Pathname filename 
) const

FIXME: see MediaAccess class.

Definition at line 814 of file MediaManager.cc.

◆ getDetectedDevices()

void zypp::media::MediaManager::getDetectedDevices ( MediaAccessId  accessId,
std::vector< std::string > &  devices,
unsigned int &  index 
) const

Fill in a vector of detected ejectable devices and the index of the currently attached device within the vector.

The contents of the vector are the device names (/dev/cdrom and such).

Parameters
accessIdMedium id.
devicesvector to load with the device names
indexindex of the currently used device in the devices vector

Definition at line 827 of file MediaManager.cc.

◆ setDeltafile()

void zypp::media::MediaManager::setDeltafile ( MediaAccessId  accessId,
const Pathname filename 
) const

Definition at line 695 of file MediaManager.cc.

◆ getMountTableMTime()

time_t zypp::media::MediaManager::getMountTableMTime ( )
static

Get the modification time of the /etc/mtab file.

Returns
Modification time of the /etc/mtab file.

Definition at line 839 of file MediaManager.cc.

◆ getMountEntries()

MountEntries zypp::media::MediaManager::getMountEntries ( )
static

Get current mount entries from /etc/mtab file.

Returns
Current mount entries from /etc/mtab file.

Definition at line 848 of file MediaManager.cc.

◆ isUseableAttachPoint()

bool zypp::media::MediaManager::isUseableAttachPoint ( const Pathname path,
bool  mtab = true 
) const

Check if the specified path is useable as attach point.

Parameters
pathThe attach point to check.
mtabWhether to check against the mtab, too.
Returns
True, if it is a directory and there are no another attach points bellow of it.

Definition at line 857 of file MediaManager.cc.

◆ getAttachedMedia()

AttachedMedia zypp::media::MediaManager::getAttachedMedia ( MediaAccessId accessId) const
private

Definition at line 928 of file MediaManager.cc.

◆ findAttachedMedia()

AttachedMedia zypp::media::MediaManager::findAttachedMedia ( const MediaSourceRef media) const
private

Definition at line 939 of file MediaManager.cc.

◆ forceReleaseShared()

void zypp::media::MediaManager::forceReleaseShared ( const MediaSourceRef media)
private

Definition at line 961 of file MediaManager.cc.

Friends And Related Function Documentation

◆ MediaHandler

friend class MediaHandler
friend

Definition at line 878 of file MediaManager.h.

Member Data Documentation

◆ m_impl

zypp::RW_pointer< MediaManager_Impl > zypp::media::MediaManager::m_impl
staticprivate

Static reference to the implementation (singleton).

Definition at line 919 of file MediaManager.h.


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