Mount.h

Go to the documentation of this file.
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 #include <set>
00018 #include <map>
00019 #include <string>
00020 
00021 #include "zypp/ExternalProgram.h"
00022 #include "zypp/KVMap.h"
00023 
00024 namespace zypp {
00025   namespace media {
00026 
00027 
00032     struct MountEntry
00033     {
00034         MountEntry(const std::string &source,
00035                    const std::string &target,
00036                    const std::string &fstype,
00037                    const std::string &options,
00038                    const int         dumpfreq = 0,
00039                    const int         passnum  = 0)
00040             : src(source)
00041             , dir(target)
00042             , type(fstype)
00043             , opts(options)
00044             , freq(dumpfreq)
00045             , pass(passnum)
00046         {}
00047 
00048         std::string src;  
00049         std::string dir;  
00050         std::string type; 
00051         std::string opts; 
00052         int         freq; 
00053         int         pass; 
00054     };
00055 
00059     typedef std::vector<MountEntry> MountEntries;
00060 
00061 
00065     class Mount
00066     {
00067     public:
00068 
00073         typedef ExternalProgram::Environment Environment;
00074 
00078         typedef KVMap<kvmap::KVMapBase::CharSep<'=',','> > Options;
00079 
00080     public:
00081 
00085         Mount();
00086 
00090         ~Mount();
00091 
00105         void mount ( const std::string& source,
00106                         const std::string& target,
00107                         const std::string& filesystem,
00108                         const std::string& options,
00109                         const Environment& environment = Environment() );
00110 
00118         void umount (const std::string& path);
00119 
00120     public:
00121 
00131         static MountEntries
00132         getEntries(const std::string &mtab = "");
00133 
00134     private:
00135 
00138         ExternalProgram *process;
00139 
00146         void run( const char *const *argv, const Environment& environment,
00147                   ExternalProgram::Stderr_Disposition stderr_disp =
00148                   ExternalProgram::Stderr_To_Stdout);
00149 
00150         void run( const char *const *argv,
00151                   ExternalProgram::Stderr_Disposition stderr_disp =
00152                   ExternalProgram::Stderr_To_Stdout) {
00153           Environment notused;
00154           run( argv, notused, stderr_disp );
00155         }
00156 
00160         int Status();
00161 
00164         void Kill();
00165 
00166 
00169         int exit_code;
00170     };
00171 
00172 
00173   } // namespace media
00174 } // namespace zypp
00175 
00176 #endif

Generated on Mon Jun 5 19:10:33 2006 for zypp by  doxygen 1.4.6