libzypp 17.31.23
mount.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
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/ExternalProgram.h>
24#include <zypp-core/KVMap>
25
26namespace zypp {
27 namespace media {
28
29
35 {
36 MountEntry(const std::string &source,
37 const std::string &target,
38 const std::string &fstype,
39 const std::string &options,
40 const int dumpfreq = 0,
41 const int passnum = 0)
42 : src(source)
43 , dir(target)
44 , type(fstype)
45 , opts(options)
46 , freq(dumpfreq)
47 , pass(passnum)
48 {}
49
53 bool isBlockDevice () const;
54
55 std::string src;
56 std::string dir;
57 std::string type;
58 std::string opts;
59 int freq;
60 int pass;
61 };
62
66 typedef std::vector<MountEntry> MountEntries;
67
69 std::ostream & operator<<( std::ostream & str, const MountEntry & obj );
70
74 class Mount
75 {
76 public:
77
83
88
89 public:
90
94 Mount();
95
99 ~Mount();
100
114 void mount ( const std::string& source,
115 const std::string& target,
116 const std::string& filesystem,
117 const std::string& options,
118 const Environment& environment = Environment() );
119
127 void umount (const std::string& path);
128
129 public:
130
142 static MountEntries
143 getEntries(const std::string &mtab = "");
144
149 static time_t getMTime();
150
151 private:
152#if LEGACY(1722)
153 ExternalProgram * _bincompat1;
154 int _bincompat2;
155#endif
156 };
157
158
159 } // namespace media
160} // namespace zypp
161
162#endif
Execute a program and give access to its io An object of this class encapsulates the execution of an ...
std::map< std::string, std::string > Environment
For passing additional environment variables to set.
Interface to the mount program.
Definition: mount.h:75
void umount(const std::string &path)
umount device
Definition: mount.cc:117
static MountEntries getEntries(const std::string &mtab="")
Return mount entries from /etc/mtab or /etc/fstab file.
Definition: mount.cc:169
KVMap< kvmap::KVMapBase::CharSep<'=',','> > Options
Mount options.
Definition: mount.h:87
static time_t getMTime()
Get the modification time of the /etc/mtab file.
Definition: mount.cc:264
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
~Mount()
Clean up.
Definition: mount.cc:59
ExternalProgram::Environment Environment
For passing additional environment variables to mount.
Definition: mount.h:82
Mount()
Create an new instance.
Definition: mount.cc:56
String related utilities and Regular expression matching.
std::ostream & operator<<(std::ostream &str, const MediaHandler &obj)
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
A map of (key,value) strings.
Definition: kvmap.h:173
KVMapPolicy for KVMaps using a single char as separator (e.g.
Definition: kvmap.h:105
A "struct mntent" like mount entry structure, but using std::strings.
Definition: mount.h:35
std::string dir
file system path prefix
Definition: mount.h:56
std::vector< MountEntry > MountEntries
A vector of mount entries.
Definition: mount.h:66
std::string src
name of mounted file system
Definition: mount.h:55
bool isBlockDevice() const
Returns true if the src part points to a block device in /dev.
Definition: mount.cc:50
std::string type
filesystem / mount type
Definition: mount.h:57
int freq
dump frequency in days
Definition: mount.h:59
int pass
pass number on parallel fsck
Definition: mount.h:60
std::string opts
mount options
Definition: mount.h:58
MountEntry(const std::string &source, const std::string &target, const std::string &fstype, const std::string &options, const int dumpfreq=0, const int passnum=0)
Definition: mount.h:36