libzypp 17.37.17
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
24#include <utility>
25#include <zypp-core/KVMap>
26
27namespace zypp {
28 namespace media {
29
30
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
84
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
std::map< std::string, std::string > Environment
For passing additional environment variables to set.
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
ExternalProgram::Environment Environment
For passing additional environment variables to mount.
Definition mount.h:83
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
KVMap< kvmap::KVMapBase::CharSep<'=', ','> > Options
Mount options.
Definition mount.h:88
~Mount()
Clean up.
Definition mount.cc:59
Mount()
Create an new instance.
Definition mount.cc:56
Definition Arch.h:364
String related utilities and Regular expression matching.
Types and functions for filesystem operations.
Definition Glob.cc:24
std::ostream & operator<<(std::ostream &str, const MediaHandler &obj)
Easy-to use interface to the ZYPP dependency resolver.
A map of (key,value) strings.
Definition kvmap.h:174
KVMapPolicy for KVMaps using a single char as separator (e.g.
Definition kvmap.h:106
std::string dir
file system path prefix
Definition mount.h:57
std::string src
name of mounted file system
Definition mount.h:56
bool isBlockDevice() const
Returns true if the src part points to a block device in /dev.
Definition mount.cc:50
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
std::string type
filesystem / mount type
Definition mount.h:58
std::vector< MountEntry > MountEntries
A vector of mount entries.
Definition mount.h:67
int freq
dump frequency in days
Definition mount.h:60
int pass
pass number on parallel fsck
Definition mount.h:61
std::string opts
mount options
Definition mount.h:59