Mount.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00013
00014
00015 #ifndef ZYPP_MEDIA_MOUNT_H
00016 #define ZYPP_MEDIA_MOUNT_H
00017
00018 #include <set>
00019 #include <map>
00020 #include <string>
00021 #include <iosfwd>
00022
00023 #include "zypp/ExternalProgram.h"
00024 #include "zypp/KVMap.h"
00025
00026 namespace zypp {
00027 namespace media {
00028
00029
00034 struct MountEntry
00035 {
00036 MountEntry(const std::string &source,
00037 const std::string &target,
00038 const std::string &fstype,
00039 const std::string &options,
00040 const int dumpfreq = 0,
00041 const int passnum = 0)
00042 : src(source)
00043 , dir(target)
00044 , type(fstype)
00045 , opts(options)
00046 , freq(dumpfreq)
00047 , pass(passnum)
00048 {}
00049
00050 std::string src;
00051 std::string dir;
00052 std::string type;
00053 std::string opts;
00054 int freq;
00055 int pass;
00056 };
00057
00061 typedef std::vector<MountEntry> MountEntries;
00062
00064 std::ostream & operator<<( std::ostream & str, const MountEntry & obj );
00065
00069 class Mount
00070 {
00071 public:
00072
00077 typedef ExternalProgram::Environment Environment;
00078
00082 typedef KVMap<kvmap::KVMapBase::CharSep<'=',','> > Options;
00083
00084 public:
00085
00089 Mount();
00090
00094 ~Mount();
00095
00109 void mount ( const std::string& source,
00110 const std::string& target,
00111 const std::string& filesystem,
00112 const std::string& options,
00113 const Environment& environment = Environment() );
00114
00122 void umount (const std::string& path);
00123
00124 public:
00125
00136 static MountEntries
00137 getEntries(const std::string &mtab = "");
00138
00139 private:
00140
00143 ExternalProgram *process;
00144
00151 void run( const char *const *argv, const Environment& environment,
00152 ExternalProgram::Stderr_Disposition stderr_disp =
00153 ExternalProgram::Stderr_To_Stdout);
00154
00155 void run( const char *const *argv,
00156 ExternalProgram::Stderr_Disposition stderr_disp =
00157 ExternalProgram::Stderr_To_Stdout) {
00158 Environment notused;
00159 run( argv, notused, stderr_disp );
00160 }
00161
00165 int Status();
00166
00169 void Kill();
00170
00171
00174 int exit_code;
00175 };
00176
00177
00178 }
00179 }
00180
00181 #endif