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 
00132         static MountEntries
00133         getEntries(const std::string &mtab = "");
00134 
00135     private:
00136 
00139         ExternalProgram *process;
00140 
00147         void run( const char *const *argv, const Environment& environment,
00148                   ExternalProgram::Stderr_Disposition stderr_disp =
00149                   ExternalProgram::Stderr_To_Stdout);
00150 
00151         void run( const char *const *argv,
00152                   ExternalProgram::Stderr_Disposition stderr_disp =
00153                   ExternalProgram::Stderr_To_Stdout) {
00154           Environment notused;
00155           run( argv, notused, stderr_disp );
00156         }
00157 
00161         int Status();
00162 
00165         void Kill();
00166 
00167 
00170         int exit_code;
00171     };
00172 
00173 
00174   } // namespace media
00175 } // namespace zypp
00176 
00177 #endif

Generated on Thu Jul 6 00:07:21 2006 for zypp by  doxygen 1.4.6