libzypp: zypp::media::Mount Class Reference

libzypp 17.38.10

zypp::media::Mount Class Reference

Interface to the mount program. More...

`#include <zypp-media/mount.h>`

## Public Types
using | Environment = ExternalProgram::Environment
| For passing additional environment variables to mount.
using | Options = KVMap<kvmap::KVMapBase::CharSep<'=', ','>>
| Mount options.

## Public Member Functions
| Mount ()
| Create an new instance.
| ~Mount ()
| Clean up.
void | mount (const std::string &source, const std::string &target, const std::string &filesystem, const std::string &options, const Environment &environment=Environment())
| mount device
void | umount (const std::string &path)
| umount device

## Static Public Member Functions
static MountEntries | getEntries (const std::string &mtab="")
| Return mount entries from /etc/mtab or /etc/fstab file.
static time_t | getMTime ()
| Get the modification time of the /etc/mtab file.

## Detailed Description

Interface to the mount program.

Definition at line 75 of file mount.h.

## Member Typedef Documentation

## ◆ Environment

using zypp::media::Mount::Environment = ExternalProgram::Environment

For passing additional environment variables to mount.

Definition at line 83 of file mount.h.

## ◆ Options

using zypp::media::Mount::Options = KVMap<kvmap::KVMapBase::CharSep<'=', ','>>

Mount options.

'key' or 'key=value' pairs, separated by ','

Definition at line 88 of file mount.h.

## Constructor & Destructor Documentation

## ◆ Mount()

zypp::media::Mount::Mount | ( |  | ) |

Create an new instance.

Definition at line 56 of file mount.cc.

## ◆ ~Mount()

zypp::media::Mount::~Mount | ( |  | ) |

Clean up.

Definition at line 59 of file mount.cc.

## Member Function Documentation

## ◆ mount()

void zypp::media::Mount::mount | ( | const std::string & | source,
|  | const std::string & | target,
|  | const std::string & | filesystem,
|  | const std::string & | options,
|  | const Environment & | environment = Environment() )

mount device

Parameters

  source | what to mount (e.g. /dev/hda3)
  target | where to mount (e.g. /mnt)
  filesystem | which filesystem to use (e.g. reiserfs) (-t parameter)
  options | mount options (e.g. ro) (-o parameter)
  environment | optinal environment to pass (e.g. PASSWD="sennah")

Exceptions

  MediaException |

Definition at line 62 of file mount.cc.

## ◆ umount()

void zypp::media::Mount::umount | ( | const std::string & | path | ) |

umount device

Parameters

  path | device or mountpoint to umount

Exceptions

  MediaException |

Definition at line 117 of file mount.cc.

## ◆ getEntries()

MountEntries zypp::media::Mount::getEntries | ( | const std::string & | mtab = "" | ) |
| static

Return mount entries from /etc/mtab or /etc/fstab file.

Parameters

  mtab | The name of the (mounted) file system description file to read from. This file should be one /etc/mtab, /etc/fstab or /proc/mounts. Default is to read /proc/mounts and /etc/mtab in case is not a symlink to /proc/mounts.

Returns
  A vector with mount entries or empty vector if reading or parsing of the mtab file(s) failed.

Definition at line 169 of file mount.cc.

## ◆ getMTime()

time_t zypp::media::Mount::getMTime | ( |  | ) |
| static

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

Returns
  Modification time of the /etc/mtab file.

Definition at line 264 of file mount.cc.

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

- zypp-media/mount.h
- zypp-media/mount.cc