libzypp
10.5.0
|
00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00013 // -*- C++ -*- 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 00137 static MountEntries 00138 getEntries(const std::string &mtab = ""); 00139 00140 private: 00141 00144 ExternalProgram *process; 00145 00152 void run( const char *const *argv, const Environment& environment, 00153 ExternalProgram::Stderr_Disposition stderr_disp = 00154 ExternalProgram::Stderr_To_Stdout); 00155 00156 void run( const char *const *argv, 00157 ExternalProgram::Stderr_Disposition stderr_disp = 00158 ExternalProgram::Stderr_To_Stdout) { 00159 Environment notused; 00160 run( argv, notused, stderr_disp ); 00161 } 00162 00166 int Status(); 00167 00170 void Kill(); 00171 00172 00175 int exit_code; 00176 }; 00177 00178 00179 } // namespace media 00180 } // namespace zypp 00181 00182 #endif