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

Generated on Wed Sep 23 15:11:30 2009 for yast2-storage by  doxygen 1.4.6