libzypp  10.5.0
zypp::media::MediaISO Class Reference

Implementation class for ISO MediaHandler. More...

#include <MediaISO.h>

Inheritance diagram for zypp::media::MediaISO:

List of all members.

Public Member Functions

 MediaISO (const Url &url_r, const Pathname &attach_point_hint_r)
virtual ~MediaISO ()
virtual bool isAttached () const
 True if media is attached.

Protected Member Functions

virtual void attachTo (bool next=false)
 Call concrete handler to attach the media.
virtual void releaseFrom (const std::string &ejectDev="")
 Call concrete handler to release the media.
virtual void getFile (const Pathname &filename) const
 Call concrete handler to provide file below attach point.
virtual void getDir (const Pathname &dirname, bool recurse_r) const
 Call concrete handler to provide directory content (not recursive!) below attach point.
virtual void getDirInfo (std::list< std::string > &retlist, const Pathname &dirname, bool dots=true) const
 Call concrete handler to provide a content list of directory on media via retlist.
virtual void getDirInfo (filesystem::DirContent &retlist, const Pathname &dirname, bool dots=true) const
 Basically the same as getDirInfo above.
virtual bool getDoesFileExist (const Pathname &filename) const
 check if a file exists

Private Member Functions

std::string findUnusedLoopDevice ()

Private Attributes

Pathname _isofile
MediaAccessId _isosource
std::string _filesystem

Detailed Description

Implementation class for ISO MediaHandler.

See also:
MediaHandler

Definition at line 35 of file MediaISO.h.


Constructor & Destructor Documentation

zypp::media::MediaISO::MediaISO ( const Url url_r,
const Pathname &  attach_point_hint_r 
)

Definition at line 48 of file MediaISO.cc.

zypp::media::MediaISO::~MediaISO ( ) [virtual]

Definition at line 125 of file MediaISO.cc.


Member Function Documentation

string zypp::media::MediaISO::findUnusedLoopDevice ( ) [private]

Definition at line 152 of file MediaISO.cc.

void zypp::media::MediaISO::attachTo ( bool  next = false) [protected, virtual]

Call concrete handler to attach the media.

Asserted that not already attached, and attachPoint is a directory.

Parameters:
nexttry next available device in turn until end of device list is reached (for media which are accessible through multiple devices like cdroms).
Exceptions:
MediaException
Todo:
make this thread-safe - another thread might pick up the same device

Implements zypp::media::MediaHandler.

Definition at line 178 of file MediaISO.cc.

void zypp::media::MediaISO::releaseFrom ( const std::string &  ejectDev = "") [protected, virtual]

Call concrete handler to release the media.

If eject is true, and the media is used in one handler instance only, physically eject the media (i.e. CD-ROM).

Asserted that media is attached.

Parameters:
ejectDevDevice to eject. None if empty.
Exceptions:
MediaException

Implements zypp::media::MediaHandler.

Definition at line 294 of file MediaISO.cc.

void zypp::media::MediaISO::getFile ( const Pathname &  filename) const [protected, virtual]

Call concrete handler to provide file below attach point.

Default implementation provided, that returns whether a file is located at 'localRoot + filename'.

Asserted that media is attached.

Exceptions:
MediaException

Implements zypp::media::MediaHandler.

Definition at line 320 of file MediaISO.cc.

void zypp::media::MediaISO::getDir ( const Pathname &  dirname,
bool  recurse_r 
) const [protected, virtual]

Call concrete handler to provide directory content (not recursive!) below attach point.

Return E_not_supported_by_media if media does not support retrieval of directory content.

Default implementation provided, that returns whether a directory is located at 'localRoot + dirname'.

Asserted that media is attached.

Exceptions:
MediaException

Implements zypp::media::MediaHandler.

Definition at line 326 of file MediaISO.cc.

void zypp::media::MediaISO::getDirInfo ( std::list< std::string > &  retlist,
const Pathname &  dirname,
bool  dots = true 
) const [protected, virtual]

Call concrete handler to provide a content list of directory on media via retlist.

If dots is false entries starting with '.' are not reported.

Return E_not_supported_by_media if media does not support retrieval of directory content.

Default implementation provided, that returns the content of a directory at 'localRoot + dirnname' retrieved via 'readdir'.

Asserted that media is attached and retlist is empty.

Exceptions:
MediaException

Implements zypp::media::MediaHandler.

Definition at line 333 of file MediaISO.cc.

void zypp::media::MediaISO::getDirInfo ( filesystem::DirContent retlist,
const Pathname &  dirname,
bool  dots = true 
) const [protected, virtual]

Basically the same as getDirInfo above.

The content list is returned as filesystem::DirContent, which includes name and filetype of each directory entry. Retrieving the filetype usg. requires an additional ::stat call for each entry, thus it's more expensive than a simple readdir.

Asserted that media is attached and retlist is empty.

Exceptions:
MediaException

Implements zypp::media::MediaHandler.

Definition at line 341 of file MediaISO.cc.

bool zypp::media::MediaISO::getDoesFileExist ( const Pathname &  filename) const [protected, virtual]

check if a file exists

Asserted that url is a file and not a dir.

Exceptions:
MediaException

Implements zypp::media::MediaHandler.

Definition at line 348 of file MediaISO.cc.

bool zypp::media::MediaISO::isAttached ( ) const [virtual]

True if media is attached.

Reimplemented from zypp::media::MediaHandler.

Definition at line 146 of file MediaISO.cc.


Member Data Documentation

Pathname zypp::media::MediaISO::_isofile [private]

Definition at line 38 of file MediaISO.h.

Definition at line 39 of file MediaISO.h.

std::string zypp::media::MediaISO::_filesystem [private]

Definition at line 40 of file MediaISO.h.


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