libzypp: zypp-media/mount.h Source File

libzypp 17.38.5

mount.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12
13// -*- C++ -*-
14
15#ifndef ZYPP_MEDIA_MOUNT_H
16#define ZYPP_MEDIA_MOUNT_H
17
18#include <set>
19#include <map>
20#include <string>
21#include <iosfwd>
22
23#include <zypp-core/ExternalProgram.h>
24#include <utility>
25#include <zypp-core/KVMap>
26
27namespace zypp {
28 namespace media {
29
30
35 struct MountEntry
36 {
37 MountEntry(std::string source,
38 std::string target,
39 std::string fstype,
40 std::string options,
41 const int dumpfreq = 0,
42 const int passnum = 0)
43 : src(std::move(source))
44 , dir(std::move(target))
45 , type(std::move(fstype))
46 , opts(std::move(options))
47 , freq(dumpfreq)
48 , pass(passnum)
49 {}
50
54 bool isBlockDevice () const;
55
56 std::string src;
57 std::string dir;
58 std::string type;
59 std::string opts;
60 int freq;
61 int pass;
62 };
63
67 using MountEntries = std::vector<MountEntry>;
68
70 std::ostream & operator<<( std::ostream & str, const MountEntry & obj );
71
75 class Mount
76 {
77 public:
78
83 using Environment = ExternalProgram::Environment;
84
88 using Options = KVMap<kvmap::KVMapBase::CharSep<'=', ','>>;
89
90 public:
91
95 Mount();
96
100 ~Mount();
101
114
115 void mount ( const std::string& source,
116 const std::string& target,
117 const std::string& filesystem,
118 const std::string& options,
119 const Environment& environment = Environment() );
120
128 void umount (const std::string& path);
129
130 public:
131
143 static MountEntries
144 getEntries(const std::string &mtab = "");
145
150 static time_t getMTime();
151 };
152
153
154 } // namespace media
155} // namespace zypp
156
157#endif
ExternalProgram.h
zypp::ExternalProgram::Environment
std::map< std::string, std::string > Environment
For passing additional environment variables to set.
Definition ExternalProgram.h:84
zypp::media::Mount::umount
void umount(const std::string &path)
umount device
Definition mount.cc:117
zypp::media::Mount::getEntries
static MountEntries getEntries(const std::string &mtab="")
Return mount entries from /etc/mtab or /etc/fstab file.
Definition mount.cc:169
zypp::media::Mount::Environment
ExternalProgram::Environment Environment
For passing additional environment variables to mount.
Definition mount.h:83
zypp::media::Mount::getMTime
static time_t getMTime()
Get the modification time of the /etc/mtab file.
Definition mount.cc:264
zypp::media::Mount::mount
void mount(const std::string &source, const std::string &target, const std::string &filesystem, const std::string &options, const Environment &environment=Environment())
mount device
Definition mount.cc:62
zypp::media::Mount::Options
KVMap< kvmap::KVMapBase::CharSep<'=', ','> > Options
Mount options.
Definition mount.h:88
zypp::media::Mount::~Mount
~Mount()
Clean up.
Definition mount.cc:59
zypp::media::Mount::Mount
Mount()
Create an new instance.
Definition mount.cc:56
std
Definition ansi.h:855
str
String related utilities and Regular expression matching.
zypp::filesystem
Types and functions for filesystem operations.
Definition Glob.cc:24
zypp::media
Definition MediaNetworkRequestExecutor.h:22
zypp::media::operator<<
std::ostream & operator<<(std::ostream &str, const MediaHandler &obj)
Definition MediaHandler.cc:1181
zypp::target
Definition KeyRing.h:325
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::KVMap
A map of (key,value) strings.
Definition kvmap.h:174
zypp::kvmap::KVMapBase::CharSep
KVMapPolicy for KVMaps using a single char as separator (e.g.
Definition kvmap.h:106
zypp::media::MountEntry::dir
std::string dir
file system path prefix
Definition mount.h:57
zypp::media::MountEntry::src
std::string src
name of mounted file system
Definition mount.h:56
zypp::media::MountEntry::isBlockDevice
bool isBlockDevice() const
Returns true if the src part points to a block device in /dev.
Definition mount.cc:50
zypp::media::MountEntry::MountEntry
MountEntry(std::string source, std::string target, std::string fstype, std::string options, const int dumpfreq=0, const int passnum=0)
Definition mount.h:37
zypp::media::MountEntry::type
std::string type
filesystem / mount type
Definition mount.h:58
zypp::media::MountEntry::MountEntries
std::vector< MountEntry > MountEntries
A vector of mount entries.
Definition mount.h:67
zypp::media::MountEntry::freq
int freq
dump frequency in days
Definition mount.h:60
zypp::media::MountEntry::pass
int pass
pass number on parallel fsck
Definition mount.h:61
zypp::media::MountEntry::opts
std::string opts
mount options
Definition mount.h:59