Storage.h

Go to the documentation of this file.
00001 #ifndef STORAGE_H
00002 #define STORAGE_H
00003 
00004 #include <iostream>
00005 #include <list>
00006 #include <map>
00007 
00008 #include "y2storage/StorageInterface.h"
00009 #include "y2storage/StorageTypes.h"
00010 #include "y2storage/StorageTmpl.h"
00011 #include "y2storage/Container.h"
00012 #include "y2storage/Volume.h"
00013 #include "y2storage/Disk.h"
00014 #include "y2storage/Partition.h"
00015 #include "y2storage/LvmVg.h"
00016 #include "y2storage/LvmLv.h"
00017 #include "y2storage/EvmsCo.h"
00018 #include "y2storage/Evms.h"
00019 #include "y2storage/MdCo.h"
00020 #include "y2storage/Md.h"
00021 #include "y2storage/DmCo.h"
00022 #include "y2storage/LoopCo.h"
00023 #include "y2storage/Loop.h"
00024 #include "y2storage/NfsCo.h"
00025 #include "y2storage/Nfs.h"
00026 #include "y2storage/FilterIterator.h"
00027 #include "y2storage/DerefIterator.h"
00028 #include "y2storage/ListListIterator.h"
00029 #include "y2storage/IterPair.h"
00030 
00031 namespace storage
00032 {
00033 template <int Value>
00034 class CheckType
00035     {
00036     public:
00037         bool operator()( const Container& d ) const
00038             {
00039             return( d.type()==Value );
00040             }
00041     };
00042 
00043 template< class Iter, int Value, class CastResult >
00044 class CastCheckIterator : public CheckType<Value>,
00045                           public FilterIterator< CheckType<Value>, Iter >
00046     {
00047     typedef FilterIterator<CheckType<Value>, Iter> _bclass;
00048     public:
00049         typedef CastResult value_type;
00050         typedef CastResult& reference;
00051         typedef CastResult* pointer;
00052 
00053         CastCheckIterator() : _bclass() {}
00054         CastCheckIterator( const Iter& b, const Iter& e, bool atend=false) :
00055             _bclass( b, e, *this, atend ) {}
00056         CastCheckIterator( const IterPair<Iter>& pair, bool atend=false) :
00057             _bclass( pair, *this, atend ) {}
00058         CastCheckIterator( const CastCheckIterator& i) { *this=i;}
00059         CastResult operator*() const
00060             {
00061             return( static_cast<CastResult>(_bclass::operator*()) );
00062             }
00063         CastResult* operator->() const
00064             {
00065             return( static_cast<CastResult*>(_bclass::operator->()) );
00066             }
00067         CastCheckIterator& operator++()
00068             {
00069             _bclass::operator++(); return(*this);
00070             }
00071         CastCheckIterator operator++(int)
00072             {
00073             y2warning( "Expensive ++ CastCheckIterator" );
00074             CastCheckIterator tmp(*this);
00075             _bclass::operator++();
00076             return(tmp);
00077             }
00078         CastCheckIterator& operator--()
00079             {
00080             _bclass::operator--(); return(*this);
00081             }
00082         CastCheckIterator operator--(int)
00083             {
00084             y2warning( "Expensive -- CastCheckIterator" );
00085             CastCheckIterator tmp(*this);
00086             _bclass::operator--();
00087             return(tmp);
00088             }
00089     };
00090 
00106 class EtcFstab;
00107 class DiskData;
00108 
00109 class Storage : public storage::StorageInterface
00110     {
00111     protected:
00112 
00113         typedef std::list<Container*> CCont;
00114         typedef CCont::iterator CIter;
00115         typedef CCont::const_iterator CCIter;
00116 
00117         static bool isMd( const Container&d )
00118             { return( d.type()==storage::MD ); }
00119         static bool isLoop( const Container&d )
00120             { return( d.type()==storage::LOOP ); }
00121         static bool isNfs( const Container&d )
00122             { return( d.type()==storage::NFSC ); }
00123         static bool isDm( const Container&d )
00124             { return( d.type()==storage::DM ); }
00125         struct FreeInfo
00126             {
00127             unsigned long long resize_free;
00128             unsigned long long df_free;
00129             unsigned long long used;
00130             bool win;
00131             bool efi;
00132             bool rok;
00133             FreeInfo() { resize_free=df_free=used=0; efi=win=rok=false; }
00134             FreeInfo( unsigned long long df,
00135                       unsigned long long resize,
00136                       unsigned long long usd, bool w=false, bool e=false,
00137                       bool r=true )
00138                       { resize_free=resize; df_free=df; used=usd; win=w; 
00139                         efi=e, rok=r; }
00140             };
00141 
00142     public:
00143         struct SkipDeleted { bool operator()(const Container&d) const {return( !d.deleted());}};
00144         static SkipDeleted SkipDel;
00145         static bool notDeleted( const Container&d ) { return( !d.deleted() ); };
00146 
00147         static void initDefaultLogger ();
00148 
00149         Storage( bool ronly=false, bool testmode=false, bool autodetect=true );
00150         bool test() const { return( testmode ); }
00151         bool instsys() const { return( inst_sys ); }
00152         void setCacheChanges( bool val=true ) { cache = val; }
00153         bool isCacheChanges() const { return( cache ); }
00154         void assertInit() { if( !initialized ) initialize(); }
00155         void rescanEverything();
00156         int checkCache();
00157         const string& tDir() const { return( testdir ); }
00158         const string& root() const { return( rootprefix ); }
00159         const string& tmpDir() const;
00160         static const string& arch() { return( proc_arch ); }
00161         static const string& sysfsDir() { return( sysfs_dir ); }
00162         EtcFstab* getFstab() { return fstab; }
00163         void handleLogFile( const string& name );
00164         static bool testFilesEqual( const string& n1, const string& n2 );
00165         void printInfo( std::ostream& str );
00166         void logCo( Container* c ) const;
00167         void logCo( const string& device );
00168         void logProcData( const string& l="" );
00169         storage::UsedByType usedBy( const string& dev );
00170         bool setUsedBy( const string& dev, storage::UsedByType typ,
00171                         const string& name );
00172         bool canUseDevice( const string& dev, bool disks_allowed=false );
00173         bool knownDevice( const string& dev, bool disks_allowed=false );
00174         bool setDmcryptData( const string& dev, const string& dm, unsigned long long siz );
00175         bool deletedDevice( const string& dev );
00176         bool isDisk( const string& dev );
00177         const Volume* getVolume( const string& dev );
00178         unsigned long long deviceSize( const string& dev );
00179         string deviceByNumber( const string& majmin );
00180         void rootMounted();
00181         bool isRootMounted() const { return( root_mounted ); }
00182         string findNormalDevice( const string& device );
00183         bool findVolume( const string& device, Volume const* &vol );
00184         bool findDm( const string& device, const Dm*& dm );
00185         bool findDmUsing( const string& device, const Dm*& dm );
00186         bool removeDm( const string& device );
00187 
00188         virtual ~Storage();
00189 
00190         // functions for interface
00191 
00192         void getContainers( deque<storage::ContainerInfo>& infos );
00193         int getDiskInfo( const string& disk, storage::DiskInfo& info);
00194         int getLvmVgInfo( const string& name, storage::LvmVgInfo& info);
00195         int getEvmsCoInfo( const string& name, storage::EvmsCoInfo& info);
00196         int getContDiskInfo( const string& disk, storage::ContainerInfo& cinfo,
00197                              storage::DiskInfo& info);
00198         int getContLvmVgInfo( const string& name, storage::ContainerInfo& cinfo,
00199                               storage::LvmVgInfo& info);
00200         int getContEvmsCoInfo( const string& name,
00201                                storage::ContainerInfo& cinfo,
00202                                storage::EvmsCoInfo& info );
00203         void getVolumes (deque<storage::VolumeInfo>& vlist);
00204         int getVolume( const string& device, storage::VolumeInfo& info);
00205         int getPartitionInfo( const string& disk,
00206                               deque<storage::PartitionInfo>& plist );
00207         int getLvmLvInfo( const string& name,
00208                           deque<storage::LvmLvInfo>& plist );
00209         int getEvmsInfo( const string& name,
00210                          deque<storage::EvmsInfo>& plist );
00211         int getMdInfo( deque<storage::MdInfo>& plist );
00212         int getDmInfo( deque<storage::DmInfo>& plist );
00213         int getNfsInfo( deque<storage::NfsInfo>& plist );
00214         int getLoopInfo( deque<storage::LoopInfo>& plist );
00215         int getContVolInfo( const string& dev, ContVolInfo& info);
00216 
00217         bool getFsCapabilities( storage::FsType fstype,
00218                                 storage::FsCapabilities& fscapabilities) const;
00219         void setExtError( const string& txt );
00220         int createPartition( const string& disk, storage::PartitionType type,
00221                              unsigned long start, unsigned long size,
00222                              string& device );
00223         int resizePartition( const string& device, unsigned long sizeCyl );
00224         int resizePartitionNoFs( const string& device, unsigned long sizeCyl );
00225         int nextFreePartition( const string& disk, storage::PartitionType type,
00226                                unsigned &nr, string& device );
00227         int updatePartitionArea( const string& device,
00228                                  unsigned long start, unsigned long size );
00229         int createPartitionKb( const string& disk, storage::PartitionType type,
00230                                unsigned long long start,
00231                                unsigned long long sizek, string& device );
00232         int createPartitionAny( const string& disk, unsigned long long size,
00233                                 string& device );
00234         int createPartitionMax( const string& disk, storage::PartitionType type,
00235                                 string& device );
00236         unsigned long kbToCylinder( const string& disk, unsigned long long size );
00237         unsigned long long cylinderToKb( const string& disk, unsigned long size );
00238         int removePartition( const string& partition );
00239         int changePartitionId( const string& partition, unsigned id );
00240         int forgetChangePartitionId( const string& partition );
00241         int destroyPartitionTable( const string& disk, const string& label );
00242         int initializeDisk( const string& disk, bool value );
00243         string defaultDiskLabel() const;
00244         string defaultDiskLabelSize( unsigned long long size_k ) const;
00245         unsigned long long maxSizeLabelK( const string& label ) const;
00246 
00247         int changeFormatVolume( const string& device, bool format,
00248                                 storage::FsType fs );
00249         int changeLabelVolume( const string& device, const string& label );
00250         int eraseLabelVolume( const string& device );
00251         int changeMkfsOptVolume( const string& device, const string& opts );
00252         int changeDescText( const string& device, const string& txt );
00253         int changeMountPoint( const string& device, const string& mount );
00254         int getMountPoint( const string& device, string& mount );
00255         int changeMountBy( const string& device, storage::MountByType mby );
00256         int getMountBy( const string& device, storage::MountByType& mby );
00257         int changeFstabOptions( const string&, const string& options );
00258         int getFstabOptions( const string& device, string& options );
00259         int addFstabOptions( const string&, const string& options );
00260         int removeFstabOptions( const string&, const string& options );
00261         int setCryptPassword( const string& device, const string& pwd );
00262         int forgetCryptPassword( const string& device );
00263         int getCryptPassword( const string& device, string& pwd );
00264         int setCrypt( const string& device, bool val );
00265         int setCryptType( const string& device, bool val, EncryptType typ );
00266         int getCrypt( const string& device, bool& val );
00267         int setIgnoreFstab( const string& device, bool val );
00268         int getIgnoreFstab( const string& device, bool& val );
00269         int addFstabEntry( const string& device, const string& mount,
00270                            const string& vfs, const string& options,
00271                            unsigned freq, unsigned passno );
00272         int resizeVolume( const string& device, unsigned long long newSizeMb );
00273         int resizeVolumeNoFs( const string& device, unsigned long long newSizeMb );
00274         int forgetResizeVolume( const string& device );
00275         void setRecursiveRemoval( bool val=true );
00276         bool getRecursiveRemoval() const { return recursiveRemove; }
00277         void setZeroNewPartitions( bool val=true );
00278         bool getZeroNewPartitions() const { return zeroNewPartitions; }
00279         void setDefaultMountBy (MountByType mby = MOUNTBY_DEVICE);
00280         MountByType getDefaultMountBy() const { return defaultMountBy; }
00281         void setDetectMountedVolumes( bool val=true );
00282         bool getDetectMountedVolumes() const { return detectMounted; }
00283         void setRootPrefix( const string& root );
00284         int removeVolume( const string& device );
00285         int removeUsing( const string& device, const storage::usedBy& uby );
00286         bool checkDeviceMounted( const string& device, string& mp );
00287         bool umountDevice( const string& device );
00288         bool mountDevice( const string& device, const string& mp );
00289         bool readFstab( const string& dir, deque<storage::VolumeInfo>& infos);
00290         bool getFreeInfo( const string& device, unsigned long long& resize_free,
00291                           unsigned long long& df_free,
00292                           unsigned long long& used, bool& win, bool& efi,
00293                           bool use_cache );
00294         unsigned long long getDfSize( const string& mp );
00295         int createBackupState( const string& name );
00296         int removeBackupState( const string& name );
00297         int restoreBackupState( const string& name );
00298         bool checkBackupState( const string& name );
00299         bool equalBackupStates( const string& lhs, const string& rhs,
00300                                 bool verbose_log ) const;
00301 
00302         int createLvmVg( const string& name, unsigned long long peSizeK,
00303                          bool lvm1, const deque<string>& devs );
00304         int removeLvmVg( const string& name );
00305         int extendLvmVg( const string& name, const deque<string>& devs );
00306         int shrinkLvmVg( const string& name, const deque<string>& devs );
00307         int createLvmLv( const string& vg, const string& name,
00308                          unsigned long long sizeM, unsigned stripe,
00309                          string& device );
00310         int removeLvmLvByDevice( const string& device );
00311         int removeLvmLv( const string& vg, const string& name );
00312         int changeLvStripeCount( const string& vg, const string& name,
00313                                  unsigned long stripes );
00314         int changeLvStripeSize( const string& vg, const string& name,
00315                                 unsigned long long stripeSize );
00316 
00317         int evmsActivate( bool force );
00318         int createEvmsContainer( const string& name, unsigned long long peSizeK,
00319                                  bool lvm1, const deque<string>& devs );
00320         int modifyEvmsContainer( const string& old_name, const string& new_name,
00321                                  unsigned long long peSizeK, bool lvm1 );
00322         int removeEvmsContainer( const string& name );
00323         int extendEvmsContainer( const string& name, const deque<string>& devs );
00324         int shrinkEvmsContainer( const string& name, const deque<string>& devs );
00325         int createEvmsVolume( const string& vg, const string& name,
00326                               unsigned long long sizeM, unsigned stripe,
00327                               string& device );
00328         int removeEvmsVolumeByDevice( const string& device );
00329         int removeEvmsVolume( const string& vg, const string& name );
00330         int changeEvmsStripeCount( const string& coname, const string& name,
00331                                    unsigned long stripes );
00332         int changeEvmsStripeSize( const string& coname, const string& name,
00333                                   unsigned long long stripeSize );
00334 
00335         int createMd( const string& name, storage::MdType rtype,
00336                       const deque<string>& devs );
00337         int createMdAny( storage::MdType rtype, const deque<string>& devs,
00338                          string& device );
00339         int removeMd( const string& name, bool destroySb=true );
00340         int extendMd( const string& name, const string& dev );
00341         int shrinkMd( const string& name, const string& dev );
00342         int changeMdType( const string& name, storage::MdType rtype );
00343         int changeMdChunk( const string& name, unsigned long chunk );
00344         int changeMdParity( const string& name, storage::MdParity ptype );
00345         int checkMd( const string& name );
00346 
00347 
00348         int addNfsDevice( const string& nfsDev, const string& opts,
00349                           unsigned long long sizeK, const string& mp );
00350         int checkNfsDevice( const string& nfsDev, const string& opts,
00351                             unsigned long long& sizeK );
00352 
00353         int createFileLoop( const string& lname, bool reuseExisting,
00354                             unsigned long long sizeK, const string& mp,
00355                             const string& pwd, string& device );
00356         int modifyFileLoop( const string& device, const string& lname, 
00357                             bool reuseExisting, unsigned long long sizeK );
00358         int removeFileLoop( const string& lname, bool removeFile );
00359 
00360         deque<string> getCommitActions( bool mark_destructive );
00361         const string& getLastAction() const { return lastAction; }
00362         const string& getExtendedErrorMessage() const { return extendedError; }
00363         void eraseFreeInfo( const string& device );
00364         int waitForDevice() const;
00365         int waitForDevice( const string& device ) const;
00366         void checkDeviceExclusive( const string& device, unsigned secs );
00367         void getDiskList( bool (* CheckFnc)( const Disk& ),
00368                           std::list<Disk*>& dl );
00369         void changeDeviceName( const string& old, const string& nw );
00370 
00371         int commit();
00372         void handleHald( bool stop );
00373         void activateHld( bool val=true );
00374         void removeDmTableTo( const Volume& vol );
00375         void removeDmTableTo( const string& device );
00376         bool removeDmTable( const string& table );
00377         bool removeDmMapsTo( const string& dev, bool also_evms=false );
00378         bool checkDmMapsTo( const string& dev );
00379         void updateDmEmptyPeMap();
00380         void dumpObjectList();
00381 
00382         void setCallbackProgressBar( storage::CallbackProgressBar pfnc )
00383             { progress_bar_cb=pfnc; }
00384         storage::CallbackProgressBar getCallbackProgressBar() const
00385             { return progress_bar_cb; }
00386         void setCallbackShowInstallInfo( storage::CallbackShowInstallInfo pfnc )
00387             { install_info_cb=pfnc; }
00388         storage::CallbackShowInstallInfo getCallbackShowInstallInfo() const
00389             { return install_info_cb; }
00390         void setCallbackInfoPopup( storage::CallbackInfoPopup pfnc )
00391             { info_popup_cb=pfnc; }
00392         storage::CallbackInfoPopup getCallbackInfoPopup() const
00393             { return info_popup_cb; }
00394         void setCallbackYesNoPopup( storage::CallbackYesNoPopup pfnc )
00395             { yesno_popup_cb=pfnc; }
00396         storage::CallbackYesNoPopup getCallbackYesNoPopup() const
00397             { return yesno_popup_cb; }
00398 
00399         static void setCallbackProgressBarYcp( storage::CallbackProgressBar pfnc )
00400             { progress_bar_cb_ycp=pfnc; }
00401         static storage::CallbackProgressBar getCallbackProgressBarYcp()
00402             { return progress_bar_cb_ycp; }
00403         static void setCallbackShowInstallInfoYcp( storage::CallbackShowInstallInfo pfnc )
00404             { install_info_cb_ycp=pfnc; }
00405         static storage::CallbackShowInstallInfo getCallbackShowInstallInfoYcp()
00406             { return install_info_cb_ycp; }
00407         static void setCallbackInfoPopupYcp( storage::CallbackInfoPopup pfnc )
00408             { info_popup_cb_ycp=pfnc; }
00409         static storage::CallbackInfoPopup getCallbackInfoPopupYcp()
00410             { return info_popup_cb_ycp; }
00411         static void setCallbackYesNoPopupYcp( storage::CallbackYesNoPopup pfnc )
00412             { yesno_popup_cb_ycp=pfnc; }
00413         static storage::CallbackYesNoPopup getCallbackYesNoPopupYcp()
00414             { return yesno_popup_cb_ycp; }
00415 
00416         storage::CallbackProgressBar getCallbackProgressBarTheOne() const
00417             { return progress_bar_cb ? progress_bar_cb : progress_bar_cb_ycp; }
00418         storage::CallbackShowInstallInfo getCallbackShowInstallInfoTheOne() const
00419             { return install_info_cb ? install_info_cb : install_info_cb_ycp; }
00420         storage::CallbackInfoPopup getCallbackInfoPopupTheOne() const
00421             { return info_popup_cb ? info_popup_cb : info_popup_cb_ycp; }
00422         storage::CallbackYesNoPopup getCallbackYesNoPopupTheOne() const
00423             { return yesno_popup_cb ? yesno_popup_cb : yesno_popup_cb_ycp; }
00424 
00425         void progressBarCb( const string& id, unsigned cur, unsigned max );
00426         void showInfoCb( const string& info );
00427         void infoPopupCb( const string& info );
00428         bool yesnoPopupCb( const string& info );
00429 
00430 // iterators over container
00431     protected:
00432         // protected typedefs for iterators over container
00433         template< class Pred >
00434             struct ConstContainerPI { typedef ContainerIter<Pred, CCIter> type; };
00435         typedef CheckFnc<const Container> CheckFncCont;
00436         typedef CheckerIterator< CheckFncCont, ConstContainerPI<CheckFncCont>::type,
00437                                  CCIter, Container > ConstContPIterator;
00438         template< class Pred >
00439             struct ContainerPI { typedef ContainerIter<Pred, CIter> type; };
00440         template< class Pred >
00441             struct ContainerI
00442                 { typedef ContainerDerIter<Pred, typename ContainerPI<Pred>::type,
00443                                            Container> type; };
00444         typedef CheckerIterator< CheckFncCont, ContainerPI<CheckFncCont>::type,
00445                                  CIter, Container > ContPIterator;
00446         typedef DerefIterator<ContPIterator,Container> ContIterator;
00447         typedef IterPair<ContIterator> CPair;
00448 
00449     public:
00450         // public typedefs for iterators over containers
00451         template< class Pred >
00452             struct ConstContainerI
00453                 { typedef ContainerDerIter<Pred, typename ConstContainerPI<Pred>::type,
00454                                            const Container> type; };
00455         template< class Pred >
00456             struct ContCondIPair { typedef MakeCondIterPair<Pred,
00457                                    typename ConstContainerI<Pred>::type> type;};
00458         typedef DerefIterator<ConstContPIterator,const Container> ConstContIterator;
00459         typedef IterPair<ConstContIterator> ConstContPair;
00460 
00461         // public member functions for iterators over containers
00462         ConstContPair contPair( bool (* CheckFnc)( const Container& )=NULL ) const
00463             {
00464             return( ConstContPair( contBegin( CheckFnc ), contEnd( CheckFnc ) ));
00465             }
00466         ConstContIterator contBegin( bool (* CheckFnc)( const Container& )=NULL ) const
00467             {
00468             return( ConstContIterator( ConstContPIterator( cont.begin(), cont.end(), CheckFnc )) );
00469             }
00470         ConstContIterator contEnd( bool (* CheckFnc)( const Container& )=NULL ) const
00471             {
00472             return( ConstContIterator( ConstContPIterator( cont.begin(), cont.end(), CheckFnc, true )) );
00473             }
00474         template< class Pred > typename ContCondIPair<Pred>::type contCondPair( const Pred& p ) const
00475             {
00476             return( typename ContCondIPair<Pred>::type( contCondBegin( p ), contCondEnd( p ) ) );
00477             }
00478         template< class Pred > typename ConstContainerI<Pred>::type contCondBegin( const Pred& p ) const
00479             {
00480             return( typename ConstContainerI<Pred>::type( typename ConstContainerPI<Pred>::type( cont.begin(), cont.end(), p )) );
00481             }
00482         template< class Pred > typename ConstContainerI<Pred>::type contCondEnd( const Pred& p ) const
00483             {
00484             return( typename ConstContainerI<Pred>::type( typename ConstContainerPI<Pred>::type( cont.begin(), cont.end(), p, true )) );
00485             }
00486     protected:
00487         // protected member functions for iterators over containers
00488         CPair cPair( bool (* CheckFnc)( const Container& )=NULL )
00489             {
00490             return( CPair( cBegin(CheckFnc), cEnd(CheckFnc) ));
00491             }
00492         ContIterator cBegin( bool (* CheckFnc)( const Container& )=NULL )
00493             {
00494             return( ContIterator( ContPIterator( cont.begin(), cont.end(), CheckFnc )) );
00495             }
00496         ContIterator cEnd( bool (* CheckFnc)( const Container& )=NULL )
00497             {
00498             return( ContIterator( ContPIterator( cont.begin(), cont.end(), CheckFnc, true )) );
00499             }
00500 
00501 // iterators over disks
00502     protected:
00503         // protected typedefs for iterators over disks
00504         typedef CastCheckIterator<CCIter, storage::DISK, const Disk *> ContainerCDiskIter;
00505         template< class Pred >
00506             struct ConstDiskPI { typedef ContainerIter<Pred, ContainerCDiskIter> type; };
00507         typedef CastCheckIterator<CIter, storage::DISK, Disk *> ContainerDiskIter;
00508         template< class Pred >
00509             struct DiskPI { typedef ContainerIter<Pred, ContainerDiskIter> type; };
00510         template< class Pred >
00511             struct DiskI { typedef ContainerDerIter<Pred, typename DiskPI<Pred>::type, Disk> type; };
00512         typedef CheckFnc<const Disk> CheckFncDisk;
00513         typedef CheckerIterator< CheckFncDisk, ConstDiskPI<CheckFncDisk>::type,
00514                                  ContainerCDiskIter, Disk > ConstDiskPIterator;
00515         typedef CheckerIterator< CheckFncDisk, DiskPI<CheckFncDisk>::type,
00516                                  ContainerDiskIter, Disk > DiskPIterator;
00517         typedef DerefIterator<DiskPIterator,Disk> DiskIterator;
00518         typedef IterPair<DiskIterator> DiskPair;
00519 
00520     public:
00521         // public typedefs for iterators over disks
00522         typedef DerefIterator<ConstDiskPIterator,const Disk> ConstDiskIterator;
00523         template< class Pred >
00524             struct ConstDiskI
00525                 { typedef ContainerDerIter<Pred, typename ConstDiskPI<Pred>::type,
00526                                            const Disk> type; };
00527         template< class Pred >
00528             struct DiskCondIPair { typedef MakeCondIterPair<Pred, typename ConstDiskI<Pred>::type> type; };
00529         typedef IterPair<ConstDiskIterator> ConstDiskPair;
00530 
00531         // public member functions for iterators over disks
00532         ConstDiskPair diskPair( bool (* CheckFnc)( const Disk& )=NULL ) const
00533             {
00534             return( ConstDiskPair( diskBegin( CheckFnc ), diskEnd( CheckFnc ) ));
00535             }
00536         ConstDiskIterator diskBegin( bool (* CheckFnc)( const Disk& )=NULL ) const
00537             {
00538             IterPair<ContainerCDiskIter> p( ContainerCDiskIter( cont.begin(), cont.end() ),
00539                                             ContainerCDiskIter( cont.begin(), cont.end(), true ));
00540             return( ConstDiskIterator( ConstDiskPIterator( p, CheckFnc )) );
00541             }
00542         ConstDiskIterator diskEnd( bool (* CheckFnc)( const Disk& )=NULL ) const
00543             {
00544             IterPair<ContainerCDiskIter> p( ContainerCDiskIter( cont.begin(), cont.end() ),
00545                                             ContainerCDiskIter( cont.begin(), cont.end(), true ));
00546             return( ConstDiskIterator( ConstDiskPIterator( p, CheckFnc, true )) );
00547             }
00548         template< class Pred > typename DiskCondIPair<Pred>::type diskCondPair( const Pred& p ) const
00549             {
00550             return( typename DiskCondIPair<Pred>::type( diskCondBegin( p ), diskCondEnd( p ) ) );
00551             }
00552         template< class Pred > typename ConstDiskI<Pred>::type diskCondBegin( const Pred& p ) const
00553             {
00554             IterPair<ContainerCDiskIter> pair( ContainerCDiskIter( cont.begin(), cont.end() ),
00555                                                ContainerCDiskIter( cont.begin(), cont.end(), true ));
00556             return( typename ConstDiskI<Pred>::type( typename ConstDiskPI<Pred>::type( pair, p )) );
00557             }
00558         template< class Pred > typename ConstDiskI<Pred>::type diskCondEnd( const Pred& p ) const
00559             {
00560             IterPair<ContainerCDiskIter> pair( ContainerCDiskIter( cont.begin(), cont.end() ),
00561                                                ContainerCDiskIter( cont.begin(), cont.end(), true ));
00562             return( typename ConstDiskI<Pred>::type( typename ConstDiskPI<Pred>::type( pair, p, true )) );
00563             }
00564     protected:
00565         // protected member functions for iterators over disks
00566         DiskPair dPair( bool (* CheckFnc)( const Disk& )=NULL )
00567             {
00568             return( DiskPair( dBegin( CheckFnc ), dEnd( CheckFnc ) ));
00569             }
00570         DiskIterator dBegin( bool (* CheckFnc)( const Disk& )=NULL )
00571             {
00572             IterPair<ContainerDiskIter> p( ContainerDiskIter( cont.begin(), cont.end() ),
00573                                            ContainerDiskIter( cont.begin(), cont.end(), true ));
00574             return( DiskIterator( DiskPIterator( p, CheckFnc )) );
00575             }
00576         DiskIterator dEnd( bool (* CheckFnc)( const Disk& )=NULL )
00577             {
00578             IterPair<ContainerDiskIter> p( ContainerDiskIter( cont.begin(), cont.end() ),
00579                                            ContainerDiskIter( cont.begin(), cont.end(), true ));
00580             return( DiskIterator( DiskPIterator( p, CheckFnc, true )) );
00581             }
00582 
00583 
00584 // iterators over LVM VGs
00585     protected:
00586         // protected typedefs for iterators over LVM VGs
00587         typedef CastCheckIterator<CCIter, storage::LVM, const LvmVg *> ContainerCLvmVgIter;
00588         template< class Pred >
00589             struct ConstLvmVgPI { typedef ContainerIter<Pred, ContainerCLvmVgIter> type; };
00590         typedef CastCheckIterator<CIter, storage::LVM, LvmVg *> ContainerLvmVgIter;
00591         template< class Pred >
00592             struct LvmVgPI { typedef ContainerIter<Pred, ContainerLvmVgIter> type; };
00593         template< class Pred >
00594             struct LvmVgI { typedef ContainerDerIter<Pred, typename LvmVgPI<Pred>::type, LvmVg> type; };
00595         typedef CheckFnc<const LvmVg> CheckFncLvmVg;
00596         typedef CheckerIterator< CheckFncLvmVg, ConstLvmVgPI<CheckFncLvmVg>::type,
00597                                  ContainerCLvmVgIter, LvmVg > ConstLvmVgPIterator;
00598         typedef CheckerIterator< CheckFncLvmVg, LvmVgPI<CheckFncLvmVg>::type,
00599                                  ContainerLvmVgIter, LvmVg > LvmVgPIterator;
00600         typedef DerefIterator<LvmVgPIterator,LvmVg> LvmVgIterator;
00601         typedef IterPair<LvmVgIterator> LvmVgPair;
00602 
00603     public:
00604         // public typedefs for iterators over LVM VGs
00605         typedef DerefIterator<ConstLvmVgPIterator,const LvmVg> ConstLvmVgIterator;
00606         template< class Pred >
00607             struct ConstLvmVgI
00608                 { typedef ContainerDerIter<Pred, typename ConstLvmVgPI<Pred>::type,
00609                                            const LvmVg> type; };
00610         template< class Pred >
00611             struct LvmVgCondIPair { typedef MakeCondIterPair<Pred, typename ConstLvmVgI<Pred>::type> type; };
00612         typedef IterPair<ConstLvmVgIterator> ConstLvmVgPair;
00613 
00614         // public member functions for iterators over LVM VGs
00615         ConstLvmVgPair lvmVgPair( bool (* CheckFnc)( const LvmVg& )=NULL ) const
00616             {
00617             return( ConstLvmVgPair( lvmVgBegin( CheckFnc ), lvmVgEnd( CheckFnc ) ));
00618             }
00619         ConstLvmVgIterator lvmVgBegin( bool (* CheckFnc)( const LvmVg& )=NULL ) const
00620             {
00621             IterPair<ContainerCLvmVgIter> p( ContainerCLvmVgIter( cont.begin(), cont.end() ),
00622                                              ContainerCLvmVgIter( cont.begin(), cont.end(), true ));
00623             return( ConstLvmVgIterator( ConstLvmVgPIterator( p, CheckFnc )) );
00624             }
00625         ConstLvmVgIterator lvmVgEnd( bool (* CheckFnc)( const LvmVg& )=NULL ) const
00626             {
00627             IterPair<ContainerCLvmVgIter> p( ContainerCLvmVgIter( cont.begin(), cont.end() ),
00628                                              ContainerCLvmVgIter( cont.begin(), cont.end(), true ));
00629             return( ConstLvmVgIterator( ConstLvmVgPIterator( p, CheckFnc, true )) );
00630             }
00631         template< class Pred > typename LvmVgCondIPair<Pred>::type lvmVgCondPair( const Pred& p ) const
00632             {
00633             return( typename LvmVgCondIPair<Pred>::type( lvmVgCondBegin( p ), lvmVgCondEnd( p ) ) );
00634             }
00635         template< class Pred > typename ConstLvmVgI<Pred>::type lvmVgCondBegin( const Pred& p ) const
00636             {
00637             IterPair<ContainerCLvmVgIter> pair( ContainerCLvmVgIter( cont.begin(), cont.end() ),
00638                                                 ContainerCLvmVgIter( cont.begin(), cont.end(), true ));
00639             return( typename ConstLvmVgI<Pred>::type( typename ConstLvmVgPI<Pred>::type( pair, p )) );
00640             }
00641         template< class Pred > typename ConstLvmVgI<Pred>::type lvmVgCondEnd( const Pred& p ) const
00642             {
00643             IterPair<ContainerCLvmVgIter> pair( ContainerCLvmVgIter( cont.begin(), cont.end() ),
00644                                                 ContainerCLvmVgIter( cont.begin(), cont.end(), true ));
00645             return( typename ConstLvmVgI<Pred>::type( typename ConstLvmVgPI<Pred>::type( pair, p, true )) );
00646             }
00647     protected:
00648         // protected member functions for iterators over LVM VGs
00649         LvmVgPair lvgPair( bool (* CheckFnc)( const LvmVg& )=NULL )
00650             {
00651             return( LvmVgPair( lvgBegin( CheckFnc ), lvgEnd( CheckFnc ) ));
00652             }
00653         LvmVgIterator lvgBegin( bool (* CheckFnc)( const LvmVg& )=NULL )
00654             {
00655             IterPair<ContainerLvmVgIter> p( ContainerLvmVgIter( cont.begin(), cont.end() ),
00656                                             ContainerLvmVgIter( cont.begin(), cont.end(), true ));
00657             return( LvmVgIterator( LvmVgPIterator( p, CheckFnc )) );
00658             }
00659         LvmVgIterator lvgEnd( bool (* CheckFnc)( const LvmVg& )=NULL )
00660             {
00661             IterPair<ContainerLvmVgIter> p( ContainerLvmVgIter( cont.begin(), cont.end() ),
00662                                             ContainerLvmVgIter( cont.begin(), cont.end(), true ));
00663             return( LvmVgIterator( LvmVgPIterator( p, CheckFnc, true )) );
00664             }
00665 
00666 // iterators over EVMS container
00667     protected:
00668         // protected typedefs for iterators over EVMS container
00669         typedef CastCheckIterator<CCIter, storage::EVMS, const EvmsCo *> ContainerCEvmsIter;
00670         template< class Pred >
00671             struct ConstEvmsCoPI { typedef ContainerIter<Pred, ContainerCEvmsIter> type; };
00672         typedef CastCheckIterator<CIter, storage::EVMS, EvmsCo *> ContainerEvmsIter;
00673         template< class Pred >
00674             struct EvmsCoPI { typedef ContainerIter<Pred, ContainerEvmsIter> type; };
00675         template< class Pred >
00676             struct EvmsCoI { typedef ContainerDerIter<Pred, typename EvmsCoPI<Pred>::type, EvmsCo> type; };
00677         typedef CheckFnc<const EvmsCo> CheckFncEvmsCo;
00678         typedef CheckerIterator< CheckFncEvmsCo, ConstEvmsCoPI<CheckFncEvmsCo>::type,
00679                                  ContainerCEvmsIter, EvmsCo > ConstEvmsCoPIterator;
00680         typedef CheckerIterator< CheckFncEvmsCo, EvmsCoPI<CheckFncEvmsCo>::type,
00681                                  ContainerEvmsIter, EvmsCo > EvmsCoPIterator;
00682         typedef DerefIterator<EvmsCoPIterator,EvmsCo> EvmsCoIterator;
00683         typedef IterPair<EvmsCoIterator> EvmsCoPair;
00684 
00685     public:
00686         // public typedefs for iterators over EVMS container
00687         typedef DerefIterator<ConstEvmsCoPIterator,const EvmsCo> ConstEvmsCoIterator;
00688         template< class Pred >
00689             struct ConstEvmsCoI
00690                 { typedef ContainerDerIter<Pred, typename ConstEvmsCoPI<Pred>::type,
00691                                            const EvmsCo> type; };
00692         template< class Pred >
00693             struct EvmsCoCondIPair { typedef MakeCondIterPair<Pred, typename ConstEvmsCoI<Pred>::type> type; };
00694         typedef IterPair<ConstEvmsCoIterator> ConstEvmsCoPair;
00695 
00696         // public member functions for iterators over EVMS container
00697         ConstEvmsCoPair evmsCoPair( bool (* CheckFnc)( const EvmsCo& )=NULL ) const
00698             {
00699             return( ConstEvmsCoPair( evmsCoBegin( CheckFnc ), evmsCoEnd( CheckFnc ) ));
00700             }
00701         ConstEvmsCoIterator evmsCoBegin( bool (* CheckFnc)( const EvmsCo& )=NULL ) const
00702             {
00703             IterPair<ContainerCEvmsIter> p( ContainerCEvmsIter( cont.begin(), cont.end() ),
00704                                             ContainerCEvmsIter( cont.begin(), cont.end(), true ));
00705             return( ConstEvmsCoIterator( ConstEvmsCoPIterator( p, CheckFnc )) );
00706             }
00707         ConstEvmsCoIterator evmsCoEnd( bool (* CheckFnc)( const EvmsCo& )=NULL ) const
00708             {
00709             IterPair<ContainerCEvmsIter> p( ContainerCEvmsIter( cont.begin(), cont.end() ),
00710                                             ContainerCEvmsIter( cont.begin(), cont.end(), true ));
00711             return( ConstEvmsCoIterator( ConstEvmsCoPIterator( p, CheckFnc, true )) );
00712             }
00713         template< class Pred > typename EvmsCoCondIPair<Pred>::type evmsCoCondPair( const Pred& p ) const
00714             {
00715             return( typename EvmsCoCondIPair<Pred>::type( evmsCoCondBegin( p ), evmsCoCondEnd( p ) ) );
00716             }
00717         template< class Pred > typename ConstEvmsCoI<Pred>::type evmsCoCondBegin( const Pred& p ) const
00718             {
00719             IterPair<ContainerCEvmsIter> pair( ContainerCEvmsIter( cont.begin(), cont.end() ),
00720                                                ContainerCEvmsIter( cont.begin(), cont.end(), true ));
00721             return( typename ConstEvmsCoI<Pred>::type( typename ConstEvmsCoPI<Pred>::type( pair, p )) );
00722             }
00723         template< class Pred > typename ConstEvmsCoI<Pred>::type evmsCoCondEnd( const Pred& p ) const
00724             {
00725             IterPair<ContainerCEvmsIter> pair( ContainerCEvmsIter( cont.begin(), cont.end() ),
00726                                                ContainerCEvmsIter( cont.begin(), cont.end(), true ));
00727             return( typename ConstEvmsCoI<Pred>::type( typename ConstEvmsCoPI<Pred>::type( pair, p, true )) );
00728             }
00729     protected:
00730         // protected member functions for iterators over EVMS container
00731         EvmsCoPair evCoPair( bool (* CheckFnc)( const EvmsCo& )=NULL )
00732             {
00733             return( EvmsCoPair( evCoBegin( CheckFnc ), evCoEnd( CheckFnc ) ));
00734             }
00735         EvmsCoIterator evCoBegin( bool (* CheckFnc)( const EvmsCo& )=NULL )
00736             {
00737             IterPair<ContainerEvmsIter> p( ContainerEvmsIter( cont.begin(), cont.end() ),
00738                                            ContainerEvmsIter( cont.begin(), cont.end(), true ));
00739             return( EvmsCoIterator( EvmsCoPIterator( p, CheckFnc )) );
00740             }
00741         EvmsCoIterator evCoEnd( bool (* CheckFnc)( const EvmsCo& )=NULL )
00742             {
00743             IterPair<ContainerEvmsIter> p( ContainerEvmsIter( cont.begin(), cont.end() ),
00744                                            ContainerEvmsIter( cont.begin(), cont.end(), true ));
00745             return( EvmsCoIterator( EvmsCoPIterator( p, CheckFnc, true )) );
00746             }
00747 
00748 // iterators over volumes
00749     protected:
00750         // protected typedefs for iterators over volumes
00751         typedef ListListIterator<Container::ConstPlainIterator, ConstContIterator> ConstVolInter;
00752         template< class Pred >
00753             struct ConstVolumePI { typedef ContainerIter<Pred, ConstVolInter> type; };
00754         typedef CheckFnc<const Volume> CheckFncVol;
00755         typedef CheckerIterator< CheckFncVol, ConstVolumePI<CheckFncVol>::type,
00756                                  ConstVolInter, Volume > ConstVolPIterator;
00757         typedef ListListIterator<Container::PlainIterator, ContIterator> VolPart;
00758         template< class Pred >
00759             struct VolumeI { typedef ContainerIter<Pred, VolPart> type; };
00760         typedef CheckerIterator< CheckFncVol, VolumeI<CheckFncVol>::type,
00761                                  VolPart, Volume > VolPIterator;
00762         typedef DerefIterator<VolPIterator,Volume> VolIterator;
00763         typedef IterPair<VolIterator> VPair;
00764 
00765     public:
00766         // public typedefs for iterators over volumes
00767         template< class Pred >
00768             struct ConstVolumeI { typedef ContainerDerIter<Pred, typename ConstVolumePI<Pred>::type, const Volume> type; };
00769         template< class Pred >
00770             struct VolCondIPair { typedef MakeCondIterPair<Pred, typename ConstVolumeI<Pred>::type> type;};
00771         typedef DerefIterator<ConstVolPIterator,const Volume> ConstVolIterator;
00772         typedef IterPair<ConstVolIterator> ConstVolPair;
00773 
00774         // public member functions for iterators over volumes
00775         ConstVolPair volPair( bool (* CheckCnt)( const Container& )) const
00776             {
00777             return( ConstVolPair( volBegin( CheckCnt ), volEnd( CheckCnt ) ));
00778             }
00779         ConstVolPair volPair( bool (* CheckVol)( const Volume& )=NULL,
00780                               bool (* CheckCnt)( const Container& )=NULL) const
00781             {
00782             return( ConstVolPair( volBegin( CheckVol, CheckCnt ),
00783                                   volEnd( CheckVol, CheckCnt ) ));
00784             }
00785         ConstVolIterator volBegin( bool (* CheckCnt)( const Container& )) const
00786             {
00787             return( volBegin( NULL, CheckCnt ) );
00788             }
00789         ConstVolIterator volBegin( bool (* CheckVol)( const Volume& )=NULL,
00790                                    bool (* CheckCnt)( const Container& )=NULL) const
00791             {
00792             IterPair<ConstVolInter> p( (ConstVolInter( contPair( CheckCnt ))),
00793                                        (ConstVolInter( contPair( CheckCnt ), true )));
00794             return( ConstVolIterator( ConstVolPIterator(p, CheckVol )));
00795             }
00796         ConstVolIterator volEnd( bool (* CheckCnt)( const Container& )) const
00797             {
00798             return( volEnd( NULL, CheckCnt ) );
00799             }
00800         ConstVolIterator volEnd( bool (* CheckVol)( const Volume& )=NULL,
00801                                  bool (* CheckCnt)( const Container& )=NULL) const
00802             {
00803             IterPair<ConstVolInter> p( (ConstVolInter( contPair( CheckCnt ))),
00804                                        (ConstVolInter( contPair( CheckCnt ), true )));
00805             return( ConstVolIterator( ConstVolPIterator(p, CheckVol, true )));
00806             }
00807         template< class Pred > typename VolCondIPair<Pred>::type volCondPair( const Pred& p ) const
00808             {
00809             return( typename VolCondIPair<Pred>::type( volCondBegin( p ), volCondEnd( p ) ) );
00810             }
00811         template< class Pred > typename ConstVolumeI<Pred>::type volCondBegin( const Pred& p ) const
00812             {
00813             IterPair<ConstVolInter> pair( (ConstVolInter( contPair())),
00814                                           (ConstVolInter( contPair(), true )));
00815             return( typename ConstVolumeI<Pred>::type( typename ConstVolumePI<Pred>::type(pair, p) ) );
00816             }
00817         template< class Pred > typename ConstVolumeI<Pred>::type volCondEnd( const Pred& p ) const
00818             {
00819             IterPair<ConstVolInter> pair( (ConstVolInter( contPair())),
00820                                           (ConstVolInter( contPair(), true )));
00821             return( typename ConstVolumeI<Pred>::type( typename ConstVolumePI<Pred>::type(pair, p, true )) );
00822             }
00823 
00824     protected:
00825         // protected member functions for iterators over volumes
00826         VPair vPair( bool (* CheckCnt)( const Container& ))
00827             {
00828             return( VPair( vBegin( CheckCnt ), vEnd( CheckCnt ) ));
00829             }
00830         VPair vPair( bool (* CheckVol)( const Volume& )=NULL,
00831                      bool (* CheckCnt)( const Container& )=NULL)
00832             {
00833             return( VPair( vBegin( CheckVol, CheckCnt ),
00834                            vEnd( CheckVol, CheckCnt ) ));
00835             }
00836         VolIterator vBegin( bool (* CheckCnt)( const Container& ))
00837             {
00838             return( vBegin( NULL, CheckCnt ) );
00839             }
00840         VolIterator vBegin( bool (* CheckVol)( const Volume& )=NULL,
00841                             bool (* CheckCnt)( const Container& )=NULL)
00842             {
00843             IterPair<VolPart> p( (VolPart( cPair( CheckCnt ))),
00844                                  (VolPart( cPair( CheckCnt ), true )));
00845             return( VolIterator( VolPIterator( p, CheckVol )));
00846             }
00847         VolIterator vEnd( bool (* CheckCnt)( const Container& ))
00848             {
00849             return( vEnd( NULL, CheckCnt ) );
00850             }
00851         VolIterator vEnd( bool (* CheckVol)( const Volume& )=NULL,
00852                           bool (* CheckCnt)( const Container& )=NULL)
00853             {
00854             IterPair<VolPart> p( (VolPart( cPair( CheckCnt ))),
00855                                  (VolPart( cPair( CheckCnt ), true )));
00856             return( VolIterator( VolPIterator( p, CheckVol, true )));
00857             }
00858 
00859 // iterators over partitions
00860     protected:
00861         // protected typedefs for iterators over partitions
00862         typedef ListListIterator<Container::ConstPlainIterator, ConstDiskIterator> ConstPartInter;
00863         typedef CastIterator<ConstPartInter, Partition *> ConstPartInter2;
00864         template< class Pred >
00865             struct ConstPartitionPI { typedef ContainerIter<Pred, ConstPartInter2> type; };
00866         typedef CheckFnc<const Partition> CheckFncPartition;
00867         typedef CheckerIterator< CheckFncPartition, ConstPartitionPI<CheckFncPartition>::type,
00868                                  ConstPartInter2, Partition > ConstPartPIterator;
00869     public:
00870         // public typedefs for iterators over partitions
00871         template< class Pred >
00872             struct ConstPartitionI
00873                 { typedef ContainerDerIter<Pred, typename ConstPartitionPI<Pred>::type,
00874                                            const Partition> type; };
00875         template< class Pred >
00876             struct PartCondIPair
00877                 { typedef MakeCondIterPair<Pred, typename ConstPartitionI<Pred>::type> type;};
00878         typedef DerefIterator<ConstPartPIterator, const Partition> ConstPartIterator;
00879         typedef IterPair<ConstPartIterator> ConstPartPair;
00880 
00881         // public member functions for iterators over partitions
00882         ConstPartPair partPair( bool (* CheckCnt)( const Disk& )) const
00883             {
00884             return( ConstPartPair( partBegin( CheckCnt ), partEnd( CheckCnt ) ));
00885             }
00886         ConstPartPair partPair( bool (* CheckPart)( const Partition& )=NULL,
00887                                 bool (* CheckCnt)( const Disk& )=NULL) const
00888             {
00889             return( ConstPartPair( partBegin( CheckPart, CheckCnt ),
00890                                    partEnd( CheckPart, CheckCnt ) ));
00891             }
00892         ConstPartIterator partBegin( bool (* CheckDisk)( const Disk& )) const
00893             {
00894             return( partBegin( NULL, CheckDisk ) );
00895             }
00896         ConstPartIterator partBegin( bool (* CheckPart)( const Partition& )=NULL,
00897                                      bool (* CheckDisk)( const Disk& )=NULL) const
00898             {
00899             IterPair<ConstPartInter2> p( (ConstPartInter(diskPair( CheckDisk ))),
00900                                          (ConstPartInter(diskPair( CheckDisk ), true )));
00901             return( ConstPartIterator( ConstPartPIterator(p, CheckPart )));
00902             }
00903         ConstPartIterator partEnd( bool (* CheckDisk)( const Disk& )) const
00904             {
00905             return( partEnd( NULL, CheckDisk ) );
00906             }
00907         ConstPartIterator partEnd( bool (* CheckPart)( const Partition& )=NULL,
00908                                    bool (* CheckDisk)( const Disk& )=NULL) const
00909             {
00910             IterPair<ConstPartInter2> p( (ConstPartInter(diskPair( CheckDisk ))),
00911                                          (ConstPartInter(diskPair( CheckDisk ), true )));
00912             return( ConstPartIterator( ConstPartPIterator(p, CheckPart, true )));
00913             }
00914         template< class Pred > typename PartCondIPair<Pred>::type partCondPair( const Pred& p ) const
00915             {
00916             return( typename PartCondIPair<Pred>::type( partCondBegin( p ), partCondEnd( p ) ) );
00917             }
00918         template< class Pred > typename ConstPartitionI<Pred>::type partCondBegin( const Pred& p ) const
00919             {
00920             IterPair<ConstPartInter2> pair( (ConstPartInter( diskPair())),
00921                                             (ConstPartInter( diskPair(), true )));
00922             return( typename ConstPartitionI<Pred>::type( typename ConstPartitionPI<Pred>::type(pair, p) ) );
00923             }
00924         template< class Pred > typename ConstPartitionI<Pred>::type partCondEnd( const Pred& p ) const
00925             {
00926             IterPair<ConstPartInter2> pair( (ConstPartInter( diskPair())),
00927                                             (ConstPartInter( diskPair(), true )));
00928             return( typename ConstPartitionI<Pred>::type( typename ConstPartitionPI<Pred>::type(pair, p, true )) );
00929             }
00930 
00931 // iterators over LVM LVs
00932     protected:
00933         // protected typedefs for iterators over LVM LVs
00934         typedef ListListIterator<Container::ConstPlainIterator, ConstLvmVgIterator> ConstLvmLvInter;
00935         typedef CastIterator<ConstLvmLvInter, LvmLv *> ConstLvmLvInter2;
00936         template< class Pred >
00937             struct ConstLvmLvPI { typedef ContainerIter<Pred, ConstLvmLvInter2> type; };
00938         typedef CheckFnc<const LvmLv> CheckFncLvmLv;
00939         typedef CheckerIterator< CheckFncLvmLv, ConstLvmLvPI<CheckFncLvmLv>::type,
00940                                  ConstLvmLvInter2, LvmLv > ConstLvmLvPIterator;
00941     public:
00942         // public typedefs for iterators over LVM LVs
00943         template< class Pred >
00944             struct ConstLvmLvI
00945                 { typedef ContainerDerIter<Pred, typename ConstLvmLvPI<Pred>::type,
00946                                            const LvmLv> type; };
00947         template< class Pred >
00948             struct LvmLvCondIPair
00949                 { typedef MakeCondIterPair<Pred, typename ConstLvmLvI<Pred>::type> type;};
00950         typedef DerefIterator<ConstLvmLvPIterator, const LvmLv> ConstLvmLvIterator;
00951         typedef IterPair<ConstLvmLvIterator> ConstLvmLvPair;
00952 
00953         // public member functions for iterators over LVM LVs
00954         ConstLvmLvPair lvmLvPair( bool (* CheckLvmVg)( const LvmVg& )) const
00955             {
00956             return( ConstLvmLvPair( lvmLvBegin( CheckLvmVg ), lvmLvEnd( CheckLvmVg ) ));
00957             }
00958         ConstLvmLvPair lvmLvPair( bool (* CheckLvmLv)( const LvmLv& )=NULL,
00959                                   bool (* CheckLvmVg)( const LvmVg& )=NULL) const
00960             {
00961             return( ConstLvmLvPair( lvmLvBegin( CheckLvmLv, CheckLvmVg ),
00962                                     lvmLvEnd( CheckLvmLv, CheckLvmVg ) ));
00963             }
00964         ConstLvmLvIterator lvmLvBegin( bool (* CheckLvmVg)( const LvmVg& )) const
00965             {
00966             return( lvmLvBegin( NULL, CheckLvmVg ) );
00967             }
00968         ConstLvmLvIterator lvmLvBegin( bool (* CheckLvmLv)( const LvmLv& )=NULL,
00969                                        bool (* CheckLvmVg)( const LvmVg& )=NULL) const
00970             {
00971             IterPair<ConstLvmLvInter2> p( (ConstLvmLvInter(lvmVgPair( CheckLvmVg ))),
00972                                           (ConstLvmLvInter(lvmVgPair( CheckLvmVg ), true )));
00973             return( ConstLvmLvIterator( ConstLvmLvPIterator(p, CheckLvmLv )));
00974             }
00975         ConstLvmLvIterator lvmLvEnd( bool (* CheckLvmVg)( const LvmVg& )) const
00976             {
00977             return( lvmLvEnd( NULL, CheckLvmVg ) );
00978             }
00979         ConstLvmLvIterator lvmLvEnd( bool (* CheckLvmLv)( const LvmLv& )=NULL,
00980                                      bool (* CheckLvmVg)( const LvmVg& )=NULL) const
00981             {
00982             IterPair<ConstLvmLvInter2> p( (ConstLvmLvInter(lvmVgPair( CheckLvmVg ))),
00983                                           (ConstLvmLvInter(lvmVgPair( CheckLvmVg ), true )));
00984             return( ConstLvmLvIterator( ConstLvmLvPIterator(p, CheckLvmLv, true )));
00985             }
00986         template< class Pred > typename LvmLvCondIPair<Pred>::type lvmLvCondPair( const Pred& p ) const
00987             {
00988             return( typename LvmLvCondIPair<Pred>::type( lvmLvCondBegin( p ), lvmLvCondEnd( p ) ) );
00989             }
00990         template< class Pred > typename ConstLvmLvI<Pred>::type lvmLvCondBegin( const Pred& p ) const
00991             {
00992             IterPair<ConstLvmLvInter2> pair( (ConstLvmLvInter( lvmVgPair())),
00993                                              (ConstLvmLvInter( lvmVgPair(), true )));
00994             return( typename ConstLvmLvI<Pred>::type( typename ConstLvmLvPI<Pred>::type(pair, p) ) );
00995             }
00996         template< class Pred > typename ConstLvmLvI<Pred>::type lvmLvCondEnd( const Pred& p ) const
00997             {
00998             IterPair<ConstLvmLvInter2> pair( (ConstLvmLvInter( lvmVgPair())),
00999                                              (ConstLvmLvInter( lvmVgPair(), true )));
01000             return( typename ConstLvmLvI<Pred>::type( typename ConstLvmLvPI<Pred>::type(pair, p, true )) );
01001             }
01002 
01003 // iterators over EVMS volumes
01004     protected:
01005         // protected typedefs for iterators over EVMS volumes
01006         typedef ListListIterator<Container::ConstPlainIterator, ConstEvmsCoIterator> ConstEvmsInter;
01007         typedef CastIterator<ConstEvmsInter, Evms *> ConstEvmsInter2;
01008         template< class Pred >
01009             struct ConstEvmsPI { typedef ContainerIter<Pred, ConstEvmsInter2> type; };
01010         typedef CheckFnc<const Evms> CheckFncEvms;
01011         typedef CheckerIterator< CheckFncEvms, ConstEvmsPI<CheckFncEvms>::type,
01012                                  ConstEvmsInter2, Evms > ConstEvmsPIterator;
01013     public:
01014         // public typedefs for iterators over EVMS volumes
01015         template< class Pred >
01016             struct ConstEvmsI
01017                 { typedef ContainerDerIter<Pred, typename ConstEvmsPI<Pred>::type,
01018                                            const Evms> type; };
01019         template< class Pred >
01020             struct EvmsCondIPair
01021                 { typedef MakeCondIterPair<Pred, typename ConstEvmsI<Pred>::type> type;};
01022         typedef DerefIterator<ConstEvmsPIterator, const Evms> ConstEvmsIterator;
01023         typedef IterPair<ConstEvmsIterator> ConstEvmsPair;
01024 
01025         // public member functions for iterators over EVMS volumes
01026         ConstEvmsPair evmsPair( bool (* CheckEvmsCo)( const EvmsCo& )) const
01027             {
01028             return( ConstEvmsPair( evmsBegin( CheckEvmsCo ), evmsEnd( CheckEvmsCo ) ));
01029             }
01030         ConstEvmsPair evmsPair( bool (* CheckEvms)( const Evms& )=NULL,
01031                                 bool (* CheckEvmsCo)( const EvmsCo& )=NULL) const
01032             {
01033             return( ConstEvmsPair( evmsBegin( CheckEvms, CheckEvmsCo ),
01034                                    evmsEnd( CheckEvms, CheckEvmsCo ) ));
01035             }
01036         ConstEvmsIterator evmsBegin( bool (* CheckEvmsCo)( const EvmsCo& )) const
01037             {
01038             return( evmsBegin( NULL, CheckEvmsCo ) );
01039             }
01040         ConstEvmsIterator evmsBegin( bool (* CheckEvms)( const Evms& )=NULL,
01041                                      bool (* CheckEvmsCo)( const EvmsCo& )=NULL) const
01042             {
01043             IterPair<ConstEvmsInter2> p( (ConstEvmsInter(evmsCoPair( CheckEvmsCo ))),
01044                                          (ConstEvmsInter(evmsCoPair( CheckEvmsCo ), true )));
01045             return( ConstEvmsIterator( ConstEvmsPIterator(p, CheckEvms )));
01046             }
01047         ConstEvmsIterator evmsEnd( bool (* CheckEvmsCo)( const EvmsCo& )) const
01048             {
01049             return( evmsEnd( NULL, CheckEvmsCo ) );
01050             }
01051         ConstEvmsIterator evmsEnd( bool (* CheckEvms)( const Evms& )=NULL,
01052                                    bool (* CheckEvmsCo)( const EvmsCo& )=NULL) const
01053             {
01054             IterPair<ConstEvmsInter2> p( (ConstEvmsInter(evmsCoPair( CheckEvmsCo ))),
01055                                          (ConstEvmsInter(evmsCoPair( CheckEvmsCo ), true )));
01056             return( ConstEvmsIterator( ConstEvmsPIterator(p, CheckEvms, true )));
01057             }
01058         template< class Pred > typename EvmsCondIPair<Pred>::type evmsCondPair( const Pred& p ) const
01059             {
01060             return( typename EvmsCondIPair<Pred>::type( evmsCondBegin( p ), evmsCondEnd( p ) ) );
01061             }
01062         template< class Pred > typename ConstEvmsI<Pred>::type evmsCondBegin( const Pred& p ) const
01063             {
01064             IterPair<ConstEvmsInter2> pair( (ConstEvmsInter( evmsCoPair())),
01065                                             (ConstEvmsInter( evmsCoPair(), true )));
01066             return( typename ConstEvmsI<Pred>::type( typename ConstEvmsPI<Pred>::type(pair, p) ) );
01067             }
01068         template< class Pred > typename ConstEvmsI<Pred>::type evmsCondEnd( const Pred& p ) const
01069             {
01070             IterPair<ConstEvmsInter2> pair( (ConstEvmsInter( evmsCoPair())),
01071                                             (ConstEvmsInter( evmsCoPair(), true )));
01072             return( typename ConstEvmsI<Pred>::type( typename ConstEvmsPI<Pred>::type(pair, p, true )) );
01073             }
01074 
01075 // iterators over software raid devices
01076     protected:
01077         // protected typedefs for iterators over software raid devices
01078         typedef CastIterator<ConstVolInter, Md *> ConstMdInter;
01079         template< class Pred >
01080             struct ConstMdPI { typedef ContainerIter<Pred,
01081                                                      ConstMdInter> type; };
01082         typedef CheckFnc<const Md> CheckFncMd;
01083         typedef CheckerIterator< CheckFncMd, ConstMdPI<CheckFncMd>::type,
01084                                  ConstMdInter, Md > ConstMdPIterator;
01085     public:
01086         // public typedefs for iterators over software raid devices
01087         template< class Pred >
01088             struct ConstMdI
01089                 { typedef ContainerDerIter<Pred, typename ConstMdPI<Pred>::type,
01090                                            const Md> type; };
01091         template< class Pred >
01092             struct MdCondIPair
01093                 { typedef MakeCondIterPair<Pred, typename ConstMdI<Pred>::type> type;};
01094         typedef DerefIterator<ConstMdPIterator, const Md> ConstMdIterator;
01095         typedef IterPair<ConstMdIterator> ConstMdPair;
01096 
01097         // public member functions for iterators over software raid devices
01098         ConstMdPair mdPair( bool (* CheckMd)( const Md& )=NULL ) const
01099             {
01100             return( ConstMdPair( mdBegin( CheckMd ), mdEnd( CheckMd ) ));
01101             }
01102         ConstMdIterator mdBegin( bool (* CheckMd)( const Md& )=NULL ) const
01103             {
01104             ConstVolInter b( contPair( isMd ) );
01105             ConstVolInter e( contPair( isMd ), true );
01106             IterPair<ConstMdInter> p( (ConstMdInter(b)), (ConstMdInter(e)) );
01107             return( ConstMdIterator( ConstMdPIterator(p, CheckMd )));
01108             }
01109         ConstMdIterator mdEnd( bool (* CheckMd)( const Md& )=NULL ) const
01110             {
01111             ConstVolInter b( contPair( isMd ) );
01112             ConstVolInter e( contPair( isMd ), true );
01113             IterPair<ConstMdInter> p( (ConstMdInter(b)), (ConstMdInter(e)) );
01114             return( ConstMdIterator( ConstMdPIterator(p, CheckMd, true )));
01115             }
01116         template< class Pred > typename MdCondIPair<Pred>::type mdCondPair( const Pred& p ) const
01117             {
01118             return( typename MdCondIPair<Pred>::type( mdCondBegin( p ), mdCondEnd( p ) ) );
01119             }
01120         template< class Pred > typename ConstMdI<Pred>::type mdCondBegin( const Pred& p ) const
01121             {
01122             ConstVolInter b( contPair( isMd ) );
01123             ConstVolInter e( contPair( isMd ), true );
01124             IterPair<ConstMdInter> pair( (ConstMdInter(b)), (ConstMdInter(e)) );
01125             return( typename ConstMdI<Pred>::type( typename ConstMdPI<Pred>::type(pair, p) ) );
01126             }
01127         template< class Pred > typename ConstMdI<Pred>::type mdCondEnd( const Pred& p ) const
01128             {
01129             ConstVolInter b( contPair( isMd ) );
01130             ConstVolInter e( contPair( isMd ), true );
01131             IterPair<ConstMdInter> pair( (ConstMdInter(b)), (ConstMdInter(e)) );
01132             return( typename ConstMdI<Pred>::type( typename ConstMdPI<Pred>::type(pair, p, true )) );
01133             }
01134 
01135 // iterators over file based loop devices
01136     protected:
01137         // protected typedefs for iterators over file based loop devices
01138         typedef CastIterator<ConstVolInter, Loop *> ConstLoopInter;
01139         template< class Pred >
01140             struct ConstLoopPI { typedef ContainerIter<Pred,
01141                                                      ConstLoopInter> type; };
01142         typedef CheckFnc<const Loop> CheckFncLoop;
01143         typedef CheckerIterator< CheckFncLoop, ConstLoopPI<CheckFncLoop>::type,
01144                                  ConstLoopInter, Loop > ConstLoopPIterator;
01145     public:
01146         // public typedefs for iterators over file based loop devices
01147         template< class Pred >
01148             struct ConstLoopI
01149                 { typedef ContainerDerIter<Pred, typename ConstLoopPI<Pred>::type,
01150                                            const Loop> type; };
01151         template< class Pred >
01152             struct LoopCondIPair
01153                 { typedef MakeCondIterPair<Pred, typename ConstLoopI<Pred>::type> type;};
01154         typedef DerefIterator<ConstLoopPIterator, const Loop> ConstLoopIterator;
01155         typedef IterPair<ConstLoopIterator> ConstLoopPair;
01156 
01157         // public member functions for iterators over file based loop devices
01158         ConstLoopPair loopPair( bool (* CheckLoop)( const Loop& )=NULL ) const
01159             {
01160             return( ConstLoopPair( loopBegin( CheckLoop ), loopEnd( CheckLoop ) ));
01161             }
01162         ConstLoopIterator loopBegin( bool (* CheckLoop)( const Loop& )=NULL ) const
01163             {
01164             ConstVolInter b( contPair( isLoop ) );
01165             ConstVolInter e( contPair( isLoop ), true );
01166             IterPair<ConstLoopInter> p( (ConstLoopInter(b)), (ConstLoopInter(e)) );
01167             return( ConstLoopIterator( ConstLoopPIterator(p, CheckLoop )));
01168             }
01169         ConstLoopIterator loopEnd( bool (* CheckLoop)( const Loop& )=NULL ) const
01170             {
01171             ConstVolInter b( contPair( isLoop ) );
01172             ConstVolInter e( contPair( isLoop ), true );
01173             IterPair<ConstLoopInter> p( (ConstLoopInter(b)), (ConstLoopInter(e)) );
01174             return( ConstLoopIterator( ConstLoopPIterator(p, CheckLoop, true )));
01175             }
01176         template< class Pred > typename LoopCondIPair<Pred>::type loopCondPair( const Pred& p ) const
01177             {
01178             return( typename LoopCondIPair<Pred>::type( loopCondBegin( p ), loopCondEnd( p ) ) );
01179             }
01180         template< class Pred > typename ConstLoopI<Pred>::type loopCondBegin( const Pred& p ) const
01181             {
01182             ConstVolInter b( contPair( isLoop ) );
01183             ConstVolInter e( contPair( isLoop ), true );
01184             IterPair<ConstLoopInter> pair( (ConstLoopInter(b)), (ConstLoopInter(e)) );
01185             return( typename ConstLoopI<Pred>::type( typename ConstLoopPI<Pred>::type(pair, p) ) );
01186             }
01187         template< class Pred > typename ConstLoopI<Pred>::type loopCondEnd( const Pred& p ) const
01188             {
01189             ConstVolInter b( contPair( isLoop ) );
01190             ConstVolInter e( contPair( isLoop ), true );
01191             IterPair<ConstLoopInter> pair( (ConstLoopInter(b)), (ConstLoopInter(e)) );
01192             return( typename ConstLoopI<Pred>::type( typename ConstLoopPI<Pred>::type(pair, p, true )) );
01193             }
01194 
01195 // iterators over nfs devices
01196     protected:
01197         // protected typedefs for iterators over nfs devices
01198         typedef CastIterator<ConstVolInter, Nfs *> ConstNfsInter;
01199         template< class Pred >
01200             struct ConstNfsPI { typedef ContainerIter<Pred,
01201                                                      ConstNfsInter> type; };
01202         typedef CheckFnc<const Nfs> CheckFncNfs;
01203         typedef CheckerIterator< CheckFncNfs, ConstNfsPI<CheckFncNfs>::type,
01204                                  ConstNfsInter, Nfs > ConstNfsPIterator;
01205     public:
01206         // public typedefs for iterators over nfs devices
01207         template< class Pred >
01208             struct ConstNfsI
01209                 { typedef ContainerDerIter<Pred, typename ConstNfsPI<Pred>::type,
01210                                            const Nfs> type; };
01211         template< class Pred >
01212             struct NfsCondIPair
01213                 { typedef MakeCondIterPair<Pred, typename ConstNfsI<Pred>::type> type;};
01214         typedef DerefIterator<ConstNfsPIterator, const Nfs> ConstNfsIterator;
01215         typedef IterPair<ConstNfsIterator> ConstNfsPair;
01216 
01217         // public member functions for iterators over nfs devices
01218         ConstNfsPair nfsPair( bool (* CheckNfs)( const Nfs& )=NULL ) const
01219             {
01220             return( ConstNfsPair( nfsBegin( CheckNfs ), nfsEnd( CheckNfs ) ));
01221             }
01222         ConstNfsIterator nfsBegin( bool (* CheckNfs)( const Nfs& )=NULL ) const
01223             {
01224             ConstVolInter b( contPair( isNfs ) );
01225             ConstVolInter e( contPair( isNfs ), true );
01226             IterPair<ConstNfsInter> p( (ConstNfsInter(b)), (ConstNfsInter(e)) );
01227             return( ConstNfsIterator( ConstNfsPIterator(p, CheckNfs )));
01228             }
01229         ConstNfsIterator nfsEnd( bool (* CheckNfs)( const Nfs& )=NULL ) const
01230             {
01231             ConstVolInter b( contPair( isNfs ) );
01232             ConstVolInter e( contPair( isNfs ), true );
01233             IterPair<ConstNfsInter> p( (ConstNfsInter(b)), (ConstNfsInter(e)) );
01234             return( ConstNfsIterator( ConstNfsPIterator(p, CheckNfs, true )));
01235             }
01236         template< class Pred > typename NfsCondIPair<Pred>::type nfsCondPair( const Pred& p ) const
01237             {
01238             return( typename NfsCondIPair<Pred>::type( nfsCondBegin( p ), nfsCondEnd( p ) ) );
01239             }
01240         template< class Pred > typename ConstNfsI<Pred>::type nfsCondBegin( const Pred& p ) const
01241             {
01242             ConstVolInter b( contPair( isNfs ) );
01243             ConstVolInter e( contPair( isNfs ), true );
01244             IterPair<ConstNfsInter> pair( (ConstNfsInter(b)), (ConstNfsInter(e)) );
01245             return( typename ConstNfsI<Pred>::type( typename ConstNfsPI<Pred>::type(pair, p) ) );
01246             }
01247         template< class Pred > typename ConstNfsI<Pred>::type nfsCondEnd( const Pred& p ) const
01248             {
01249             ConstVolInter b( contPair( isNfs ) );
01250             ConstVolInter e( contPair( isNfs ), true );
01251             IterPair<ConstNfsInter> pair( (ConstNfsInter(b)), (ConstNfsInter(e)) );
01252             return( typename ConstNfsI<Pred>::type( typename ConstNfsPI<Pred>::type(pair, p, true )) );
01253             }
01254 
01255 // iterators over device mapper devices
01256     protected:
01257         // protected typedefs for iterators over device mapper devices
01258         typedef CastIterator<ConstVolInter, Dm *> ConstDmInter;
01259         template< class Pred >
01260             struct ConstDmPI { typedef ContainerIter<Pred,
01261                                                      ConstDmInter> type; };
01262         typedef CheckFnc<const Dm> CheckFncDm;
01263         typedef CheckerIterator< CheckFncDm, ConstDmPI<CheckFncDm>::type,
01264                                  ConstDmInter, Dm > ConstDmPIterator;
01265     public:
01266         // public typedefs for iterators over device mapper devices
01267         template< class Pred >
01268             struct ConstDmI
01269                 { typedef ContainerDerIter<Pred, typename ConstDmPI<Pred>::type,
01270                                            const Dm> type; };
01271         template< class Pred >
01272             struct DmCondIPair
01273                 { typedef MakeCondIterPair<Pred, typename ConstDmI<Pred>::type> type;};
01274         typedef DerefIterator<ConstDmPIterator, const Dm> ConstDmIterator;
01275         typedef IterPair<ConstDmIterator> ConstDmPair;
01276 
01277         // public member functions for iterators over device mapper devices
01278         ConstDmPair dmPair( bool (* CheckDm)( const Dm& )=NULL ) const
01279             {
01280             return( ConstDmPair( dmBegin( CheckDm ), dmEnd( CheckDm ) ));
01281             }
01282         ConstDmIterator dmBegin( bool (* CheckDm)( const Dm& )=NULL ) const
01283             {
01284             ConstVolInter b( contPair( isDm ) );
01285             ConstVolInter e( contPair( isDm ), true );
01286             IterPair<ConstDmInter> p( (ConstDmInter(b)), (ConstDmInter(e)) );
01287             return( ConstDmIterator( ConstDmPIterator(p, CheckDm )));
01288             }
01289         ConstDmIterator dmEnd( bool (* CheckDm)( const Dm& )=NULL ) const
01290             {
01291             ConstVolInter b( contPair( isDm ) );
01292             ConstVolInter e( contPair( isDm ), true );
01293             IterPair<ConstDmInter> p( (ConstDmInter(b)), (ConstDmInter(e)) );
01294             return( ConstDmIterator( ConstDmPIterator(p, CheckDm, true )));
01295             }
01296         template< class Pred > typename DmCondIPair<Pred>::type dmCondPair( const Pred& p ) const
01297             {
01298             return( typename DmCondIPair<Pred>::type( dmCondBegin( p ), dmCondEnd( p ) ) );
01299             }
01300         template< class Pred > typename ConstDmI<Pred>::type dmCondBegin( const Pred& p ) const
01301             {
01302             ConstVolInter b( contPair( isDm ) );
01303             ConstVolInter e( contPair( isDm ), true );
01304             IterPair<ConstDmInter> pair( (ConstDmInter(b)), (ConstDmInter(e)) );
01305             return( typename ConstDmI<Pred>::type( typename ConstDmPI<Pred>::type(pair, p) ) );
01306             }
01307         template< class Pred > typename ConstDmI<Pred>::type dmCondEnd( const Pred& p ) const
01308             {
01309             ConstVolInter b( contPair( isDm ) );
01310             ConstVolInter e( contPair( isDm ), true );
01311             IterPair<ConstDmInter> pair( (ConstDmInter(b)), (ConstDmInter(e)) );
01312             return( typename ConstDmI<Pred>::type( typename ConstDmPI<Pred>::type(pair, p, true )) );
01313             }
01314 
01315     protected:
01316         // protected internal member functions
01317         void initialize();
01318         void detectDisks( ProcPart& ppart );
01319         void autodetectDisks( ProcPart& ppart );
01320         void detectMultipath();
01321         void detectMds();
01322         void detectLoops( ProcPart& ppart );
01323         void detectNfs( ProcMounts& mounts );
01324         void detectLvmVgs();
01325         void detectEvms();
01326         void detectDm( ProcPart& ppart );
01327         void initDisk( DiskData& data, ProcPart& pp );
01328         void detectFsData( const VolIterator& begin, const VolIterator& end,
01329                            ProcMounts& mounts );
01330         void detectFsDataTestMode( const string& file,
01331                                    const VolIterator& begin,
01332                                    const VolIterator& end );
01333         int resizeVolume( const string& device, unsigned long long newSizeMb,
01334                           bool ignore_fs );
01335         int resizePartition( const string& device, unsigned long sizeCyl,
01336                              bool ignore_fs );
01337         static void detectArch();
01338         void addToList( Container* e )
01339             { pointerIntoSortedList<Container>( cont, e ); }
01340         DiskIterator findDisk( const string& disk );
01341         LvmVgIterator findLvmVg( const string& name );
01342         EvmsCoIterator findEvmsCo( const string& name );
01343         bool findVolume( const string& device, ContIterator& c,
01344                          VolIterator& v  );
01345         bool findVolume( const string& device, VolIterator& v,
01346                          bool also_del=false );
01347         bool findContainer( const string& device, ContIterator& c );
01348 
01349         bool haveMd( MdCo*& md );
01350         bool haveNfs( NfsCo*& co );
01351         bool haveLoop( LoopCo*& loop );
01352         bool haveEvms();
01353         void handleEvmsRemoveDevice( const Disk* disk, const string& d,
01354                                      bool rename );
01355         void handleEvmsCreateDevice( const string& disk, const string& dev, 
01356                                      bool extended=false );
01357 
01358         int removeContainer( Container* val, bool call_del=true );
01359         void logVolumes( const string& Dir );
01360         int commitPair( CPair& p, bool (* fnc)( const Container& ) );
01361         void sortCommitLists( storage::CommitStage stage,
01362                               std::list<Container*>& co,
01363                               std::list<Volume*>& vl,
01364                               std::list<storage::commitAction*>& todo );
01365         bool ignoreError( std::list<commitAction*>::iterator i,
01366                           std::list<commitAction*>& al );
01367         void evmsActivateDevices();
01368         string backupStates() const;
01369         void detectObjects();
01370         void deleteClist( CCont& co );
01371         void deleteBackups();
01372         void setFreeInfo( const string& device, unsigned long long df_free,
01373                           unsigned long long resize_free,
01374                           unsigned long long used, bool win, bool efi,
01375                           bool resize_ok );
01376         bool getFreeInf( const string& device, unsigned long long& df_free,
01377                          unsigned long long& resize_free,
01378                          unsigned long long& used, bool& win, bool& efi,
01379                          bool& resize_ok );
01380 
01381         // protected internal member variables
01382         bool readonly;
01383         bool testmode;
01384         bool inst_sys;
01385         bool cache;
01386         bool initialized;
01387         bool autodetect;
01388         bool recursiveRemove;
01389         bool zeroNewPartitions;
01390         MountByType defaultMountBy;
01391         bool detectMounted;
01392         bool root_mounted;
01393         string testdir;
01394         string tempdir;
01395         string rootprefix;
01396         string logdir;
01397         unsigned hald_pid;
01398         static string proc_arch;
01399         static string sysfs_dir;
01400         CCont cont;
01401         EtcFstab *fstab;
01402 
01403         storage::CallbackProgressBar progress_bar_cb;
01404         storage::CallbackShowInstallInfo install_info_cb;
01405         storage::CallbackInfoPopup info_popup_cb;
01406         storage::CallbackYesNoPopup yesno_popup_cb;
01407         static storage::CallbackProgressBar progress_bar_cb_ycp;
01408         static storage::CallbackShowInstallInfo install_info_cb_ycp;
01409         static storage::CallbackInfoPopup info_popup_cb_ycp;
01410         static storage::CallbackYesNoPopup yesno_popup_cb_ycp;
01411         friend std::ostream& operator<< (std::ostream& s, Storage &v );
01412 
01413         unsigned max_log_num;
01414         string lastAction;
01415         string extendedError;
01416         std::map<string,CCont> backups;
01417         std::map<string,FreeInfo> freeInfo;
01418     };
01419 
01420 inline std::ostream& operator<< (std::ostream& s, commitAction &a )
01421     {
01422     s << "stage:" << a.stage
01423       << " type:" << a.type
01424       << " cont:" << a.container
01425       << " dest:" << a.destructive;
01426     if( a.container && a.co() )
01427       s << " name:" << a.co()->name();
01428     else if( a.vol() )
01429       s << " name:" << a.vol()->name();
01430     if( !a.descr.empty() )
01431       s << " desc:" << a.descr;
01432     return( s );
01433     };
01434 
01435 }
01436 
01437 #endif

Generated on Wed Apr 30 15:02:08 2008 for yast2-storage by  doxygen 1.4.6