00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef STORAGE_H
00024 #define STORAGE_H
00025
00026 #include <iostream>
00027 #include <list>
00028 #include <map>
00029
00030 #include "y2storage/StorageInterface.h"
00031 #include "y2storage/StorageTypes.h"
00032 #include "y2storage/StorageTmpl.h"
00033 #include "y2storage/Container.h"
00034 #include "y2storage/Volume.h"
00035 #include "y2storage/Disk.h"
00036 #include "y2storage/Partition.h"
00037 #include "y2storage/LvmVg.h"
00038 #include "y2storage/LvmLv.h"
00039 #include "y2storage/DmraidCo.h"
00040 #include "y2storage/Dmraid.h"
00041 #include "y2storage/DmmultipathCo.h"
00042 #include "y2storage/Dmmultipath.h"
00043 #include "y2storage/MdCo.h"
00044 #include "y2storage/Md.h"
00045 #include "y2storage/MdPartCo.h"
00046 #include "y2storage/MdPart.h"
00047 #include "y2storage/DmCo.h"
00048 #include "y2storage/LoopCo.h"
00049 #include "y2storage/Loop.h"
00050 #include "y2storage/NfsCo.h"
00051 #include "y2storage/Nfs.h"
00052 #include "y2storage/FilterIterator.h"
00053 #include "y2storage/DerefIterator.h"
00054 #include "y2storage/ListListIterator.h"
00055 #include "y2storage/IterPair.h"
00056 #include "y2storage/Lock.h"
00057
00058 namespace storage
00059 {
00060
00061 extern CallbackProgressBar progress_bar_cb_ycp;
00062 extern CallbackShowInstallInfo install_info_cb_ycp;
00063 extern CallbackInfoPopup info_popup_cb_ycp;
00064 extern CallbackYesNoPopup yesno_popup_cb_ycp;
00065 extern CallbackPasswordPopup password_popup_cb_ycp;
00066
00067 template <int Value>
00068 class CheckType
00069 {
00070 public:
00071 bool operator()( const Container& d ) const
00072 {
00073 return( d.type()==Value );
00074 }
00075 };
00076
00077 template< class Iter, int Value, class CastResult >
00078 class CastCheckIterator : public CheckType<Value>,
00079 public FilterIterator< CheckType<Value>, Iter >
00080 {
00081 typedef FilterIterator<CheckType<Value>, Iter> _bclass;
00082 public:
00083 typedef CastResult value_type;
00084 typedef CastResult& reference;
00085 typedef CastResult* pointer;
00086
00087 CastCheckIterator() : _bclass() {}
00088 CastCheckIterator( const Iter& b, const Iter& e, bool atend=false) :
00089 _bclass( b, e, *this, atend ) {}
00090 CastCheckIterator( const IterPair<Iter>& pair, bool atend=false) :
00091 _bclass( pair, *this, atend ) {}
00092 CastCheckIterator( const CastCheckIterator& i) { *this=i;}
00093 CastResult operator*() const
00094 {
00095 return( static_cast<CastResult>(_bclass::operator*()) );
00096 }
00097 CastResult* operator->() const
00098 {
00099 return( static_cast<CastResult*>(_bclass::operator->()) );
00100 }
00101 CastCheckIterator& operator++()
00102 {
00103 _bclass::operator++(); return(*this);
00104 }
00105 CastCheckIterator operator++(int)
00106 {
00107 y2war( "Expensive ++ CastCheckIterator" );
00108 CastCheckIterator tmp(*this);
00109 _bclass::operator++();
00110 return(tmp);
00111 }
00112 CastCheckIterator& operator--()
00113 {
00114 _bclass::operator--(); return(*this);
00115 }
00116 CastCheckIterator operator--(int)
00117 {
00118 y2war( "Expensive -- CastCheckIterator" );
00119 CastCheckIterator tmp(*this);
00120 _bclass::operator--();
00121 return(tmp);
00122 }
00123 };
00124
00125 template < bool (* FncP)( const Container& c ) >
00126 class CheckByFnc
00127 {
00128 public:
00129 bool operator()( const Container& d ) const
00130 {
00131 return( (*FncP)(d) );
00132 }
00133 };
00134
00135 template< class Iter, bool (* FncP)( const Container& c ), class CastResult >
00136 class CastCheckFncIterator : public CheckByFnc<FncP>,
00137 public FilterIterator< CheckByFnc<FncP>, Iter >
00138 {
00139 typedef FilterIterator<CheckByFnc<FncP>, Iter> _bclass;
00140 public:
00141 typedef CastResult value_type;
00142 typedef CastResult& reference;
00143 typedef CastResult* pointer;
00144
00145 CastCheckFncIterator() : _bclass() {}
00146 CastCheckFncIterator( const Iter& b, const Iter& e, bool atend=false) :
00147 _bclass( b, e, *this, atend ) {}
00148 CastCheckFncIterator( const IterPair<Iter>& pair, bool atend=false) :
00149 _bclass( pair, *this, atend ) {}
00150 CastCheckFncIterator( const CastCheckFncIterator& i) { *this=i;}
00151 CastResult operator*() const
00152 {
00153 return( static_cast<CastResult>(_bclass::operator*()) );
00154 }
00155 CastResult* operator->() const
00156 {
00157 return( static_cast<CastResult*>(_bclass::operator->()) );
00158 }
00159 CastCheckFncIterator& operator++()
00160 {
00161 _bclass::operator++(); return(*this);
00162 }
00163 CastCheckFncIterator operator++(int)
00164 {
00165 y2war( "Expensive ++ CastCheckFncIterator" );
00166 CastCheckFncIterator tmp(*this);
00167 _bclass::operator++();
00168 return(tmp);
00169 }
00170 CastCheckFncIterator& operator--()
00171 {
00172 _bclass::operator--(); return(*this);
00173 }
00174 CastCheckFncIterator operator--(int)
00175 {
00176 y2war( "Expensive -- CastCheckFncIterator" );
00177 CastCheckFncIterator tmp(*this);
00178 _bclass::operator--();
00179 return(tmp);
00180 }
00181 };
00182
00198 class EtcFstab;
00199 class EtcRaidtab;
00200 class DiskData;
00201
00202 class Storage : public storage::StorageInterface
00203 {
00204 protected:
00205
00206 typedef std::list<Container*> CCont;
00207 typedef CCont::iterator CIter;
00208 typedef CCont::const_iterator CCIter;
00209
00210 static bool isMd( const Container&d )
00211 { return( d.type()==storage::MD ); }
00212 static bool isLoop( const Container&d )
00213 { return( d.type()==storage::LOOP ); }
00214 static bool isNfs( const Container&d )
00215 { return( d.type()==storage::NFSC ); }
00216 static bool isDm( const Container&d )
00217 { return( d.type()==storage::DM ); }
00218 struct FreeInfo
00219 {
00220 unsigned long long resize_free;
00221 unsigned long long df_free;
00222 unsigned long long used;
00223 bool win;
00224 bool efi;
00225 bool rok;
00226 FreeInfo() { resize_free=df_free=used=0; efi=win=rok=false; }
00227 FreeInfo( unsigned long long df,
00228 unsigned long long resize,
00229 unsigned long long usd, bool w=false, bool e=false,
00230 bool r=true )
00231 { resize_free=resize; df_free=df; used=usd; win=w;
00232 efi=e, rok=r; }
00233 };
00234
00235 public:
00236 struct SkipDeleted { bool operator()(const Container&d) const {return( !d.deleted());}};
00237 static SkipDeleted SkipDel;
00238 static bool notDeleted( const Container&d ) { return( !d.deleted() ); };
00239 static bool isDmPart( const Container&d )
00240 { return d.type() == storage::DMRAID || d.type() == storage::DMMULTIPATH; }
00241 static bool isMdPart( const Container&d )
00242 { return( d.type()==storage::MDPART ); }
00243
00244 static void initDefaultLogger ();
00245
00246 Storage(const Environment& env);
00247
00248 bool readonly() const { return env.readonly; }
00249 bool testmode() const { return env.testmode; }
00250 bool autodetect() const { return env.autodetect; }
00251 bool instsys() const { return env.instsys; }
00252 string logdir() const { return env.logdir; }
00253 string testdir() const { return env.testdir; }
00254
00255 void setCacheChanges( bool val=true ) { cache = val; }
00256 bool isCacheChanges() const { return( cache ); }
00257 void assertInit() { if( !initialized ) initialize(); }
00258 void rescanEverything();
00259 int checkCache();
00260 const string& root() const { return( rootprefix ); }
00261 string prependRoot(const string& mp) const;
00262 const string& tmpDir() const;
00263 bool efiBoot() const { return efiboot; }
00264 bool hasIScsiDisks() const;
00265 static const string& arch() { return( proc_arch ); }
00266 static bool isPPCMac() { return( is_ppc_mac ); }
00267 static bool isPPCPegasos() { return( is_ppc_pegasos ); }
00268 EtcFstab* getFstab() { return fstab; }
00269 EtcRaidtab* getRaidtab() { return raidtab; }
00270 void handleLogFile( const string& name );
00271 static bool testFilesEqual( const string& n1, const string& n2 );
00272 void printInfo( std::ostream& str ) { printInfo( str, "" ); }
00273 void printInfo( std::ostream& str, const string& name );
00274 void printInfoCo( std::ostream& str, const string& name ) { printInfo( str, name ); }
00275 void logCo(const Container* c) const;
00276 void logCo(const string& device);
00277 void logProcData( const string& l="" );
00278 storage::UsedByType usedBy( const string& dev );
00279 bool usedBy( const string& dev, storage::usedBy& ub );
00280 bool clearUsedBy(const string& dev);
00281 bool setUsedBy(const string& dev, storage::UsedByType ub_type,
00282 const string& ub_name);
00283 bool canUseDevice( const string& dev, bool disks_allowed=false );
00284 bool knownDevice( const string& dev, bool disks_allowed=false );
00285 bool setDmcryptData( const string& dev, const string& dm,
00286 unsigned dmnum, unsigned long long siz,
00287 storage::EncryptType typ );
00288 bool deletedDevice( const string& dev );
00289 bool isDisk( const string& dev );
00290 const Volume* getVolume( const string& dev );
00291 unsigned long long deviceSize( const string& dev );
00292 string deviceByNumber( const string& majmin );
00293 void rootMounted();
00294 bool isRootMounted() const { return( root_mounted ); }
00295 string findNormalDevice( const string& device );
00296 bool findVolume( const string& device, Volume const* &vol );
00297 bool findDm( const string& device, const Dm*& dm );
00298 bool findDmUsing( const string& device, const Dm*& dm );
00299 bool removeDm( const string& device );
00300
00301 virtual ~Storage();
00302
00303
00304
00305 void getContainers( deque<storage::ContainerInfo>& infos );
00306 int getDiskInfo( const string& disk, storage::DiskInfo& info);
00307 int getLvmVgInfo( const string& name, storage::LvmVgInfo& info);
00308 int getDmraidCoInfo( const string& name, storage::DmraidCoInfo& info);
00309 int getDmmultipathCoInfo( const string& name, storage::DmmultipathCoInfo& info);
00310 int getContDiskInfo( const string& disk, storage::ContainerInfo& cinfo,
00311 storage::DiskInfo& info);
00312 int getContLvmVgInfo( const string& name, storage::ContainerInfo& cinfo,
00313 storage::LvmVgInfo& info);
00314 int getContDmraidCoInfo( const string& name,
00315 storage::ContainerInfo& cinfo,
00316 storage::DmraidCoInfo& info );
00317 int getContDmmultipathCoInfo( const string& name,
00318 storage::ContainerInfo& cinfo,
00319 storage::DmmultipathCoInfo& info );
00320 void getVolumes (deque<storage::VolumeInfo>& vlist);
00321 int getVolume( const string& device, storage::VolumeInfo& info);
00322 int getPartitionInfo( const string& disk,
00323 deque<storage::PartitionInfo>& plist );
00324 int getLvmLvInfo( const string& name,
00325 deque<storage::LvmLvInfo>& plist );
00326 int getMdInfo( deque<storage::MdInfo>& plist );
00327 int getMdPartInfo( const string& device, deque<storage::MdPartInfo>& plist );
00328 int getDmInfo( deque<storage::DmInfo>& plist );
00329 int getNfsInfo( deque<storage::NfsInfo>& plist );
00330 int getLoopInfo( deque<storage::LoopInfo>& plist );
00331 int getDmraidInfo( const string& name,
00332 deque<storage::DmraidInfo>& plist );
00333 int getDmmultipathInfo( const string& name,
00334 deque<storage::DmmultipathInfo>& plist );
00335 int getContVolInfo( const string& dev, ContVolInfo& info);
00336
00337 bool getFsCapabilities( storage::FsType fstype,
00338 storage::FsCapabilities& fscapabilities) const;
00339 list<string> getAllUsedFs() const;
00340 void setExtError( const string& txt );
00341 int createPartition( const string& disk, storage::PartitionType type,
00342 unsigned long start, unsigned long size,
00343 string& device );
00344 int resizePartition( const string& device, unsigned long sizeCyl );
00345 int resizePartitionNoFs( const string& device, unsigned long sizeCyl );
00346 int nextFreePartition( const string& disk, storage::PartitionType type,
00347 unsigned &nr, string& device );
00348 int updatePartitionArea( const string& device,
00349 unsigned long start, unsigned long size );
00350 int freeCylindersAfterPartition(const string& device, unsigned long& freeCyls);
00351 int createPartitionKb( const string& disk, storage::PartitionType type,
00352 unsigned long long start,
00353 unsigned long long sizek, string& device );
00354 int createPartitionAny( const string& disk, unsigned long long size,
00355 string& device );
00356 int createPartitionMax( const string& disk, storage::PartitionType type,
00357 string& device );
00358 unsigned long kbToCylinder( const string& disk, unsigned long long size );
00359 unsigned long long cylinderToKb( const string& disk, unsigned long size );
00360 int removePartition( const string& partition );
00361 int changePartitionId( const string& partition, unsigned id );
00362 int forgetChangePartitionId( const string& partition );
00363 int getUnusedPartitionSlots(const string& disk, list<PartitionSlotInfo>& slots);
00364 int destroyPartitionTable( const string& disk, const string& label );
00365 int initializeDisk( const string& disk, bool value );
00366 string defaultDiskLabel() const;
00367 string defaultDiskLabelSize( unsigned long long size_k ) const;
00368 unsigned long long maxSizeLabelK( const string& label ) const;
00369
00370 int changeFormatVolume( const string& device, bool format,
00371 storage::FsType fs );
00372 int changeLabelVolume( const string& device, const string& label );
00373 int eraseLabelVolume( const string& device );
00374 int changeMkfsOptVolume( const string& device, const string& opts );
00375 int changeTunefsOptVolume( const string& device, const string& opts );
00376 int changeDescText( const string& device, const string& txt );
00377 int changeMountPoint( const string& device, const string& mount );
00378 int getMountPoint( const string& device, string& mount );
00379 int changeMountBy( const string& device, storage::MountByType mby );
00380 int getMountBy( const string& device, storage::MountByType& mby );
00381 int changeFstabOptions( const string&, const string& options );
00382 int getFstabOptions( const string& device, string& options );
00383 int addFstabOptions( const string&, const string& options );
00384 int removeFstabOptions( const string&, const string& options );
00385 int setCryptPassword( const string& device, const string& pwd );
00386 int verifyCryptPassword( const string& device, const string& pwd );
00387 int verifyCryptFilePassword( const string& file, const string& pwd );
00388 bool needCryptPassword( const string& device );
00389 int forgetCryptPassword( const string& device );
00390 int getCryptPassword( const string& device, string& pwd );
00391 int setCrypt( const string& device, bool val );
00392 int setCryptType( const string& device, bool val, EncryptType typ );
00393 int getCrypt( const string& device, bool& val );
00394 int setIgnoreFstab( const string& device, bool val );
00395 int getIgnoreFstab( const string& device, bool& val );
00396 int addFstabEntry( const string& device, const string& mount,
00397 const string& vfs, const string& options,
00398 unsigned freq, unsigned passno );
00399 int resizeVolume( const string& device, unsigned long long newSizeMb );
00400 int resizeVolumeNoFs( const string& device, unsigned long long newSizeMb );
00401 int forgetResizeVolume( const string& device );
00402 void setRecursiveRemoval( bool val=true );
00403 bool getRecursiveRemoval() const { return recursiveRemove; }
00404 void setZeroNewPartitions( bool val=true );
00405 bool getZeroNewPartitions() const { return zeroNewPartitions; }
00406 void setDefaultMountBy (MountByType mby = MOUNTBY_DEVICE);
00407 MountByType getDefaultMountBy() const { return defaultMountBy; }
00408 void setDetectMountedVolumes( bool val=true );
00409 bool getDetectMountedVolumes() const { return detectMounted; }
00410 void setEfiBoot(bool val);
00411 bool getEfiBoot();
00412 void setRootPrefix( const string& root );
00413 string getRootPrefix() const { return rootprefix; }
00414 int removeVolume( const string& device );
00415 int removeUsing( const string& device, const storage::usedBy& uby );
00416 bool checkDeviceMounted( const string& device, string& mp );
00417 bool umountDevice( const string& device );
00418 bool mountDev( const string& device, const string& mp, bool ro=true,
00419 const string& opts="" );
00420 bool mountDevice( const string& device, const string& mp )
00421 { return( mountDev( device, mp, false )); }
00422 bool mountDeviceOpts( const string& device, const string& mp,
00423 const string& opts )
00424 { return( mountDev( device, mp, false, opts )); }
00425 bool mountDeviceRo( const string& device, const string& mp,
00426 const string& opts )
00427 { return( mountDev( device, mp, true, opts )); }
00428 bool readFstab( const string& dir, deque<storage::VolumeInfo>& infos);
00429 bool getFreeInfo( const string& device, unsigned long long& resize_free,
00430 unsigned long long& df_free,
00431 unsigned long long& used, bool& win, bool& efi,
00432 bool use_cache );
00433 unsigned long long getDfSize( const string& mp );
00434 int createBackupState( const string& name );
00435 int removeBackupState( const string& name );
00436 int restoreBackupState( const string& name );
00437 bool checkBackupState( const string& name );
00438 bool equalBackupStates( const string& lhs, const string& rhs,
00439 bool verbose_log ) const;
00440
00441 int createLvmVg( const string& name, unsigned long long peSizeK,
00442 bool lvm1, const deque<string>& devs );
00443 int removeLvmVg( const string& name );
00444 int extendLvmVg( const string& name, const deque<string>& devs );
00445 int shrinkLvmVg( const string& name, const deque<string>& devs );
00446 int createLvmLv( const string& vg, const string& name,
00447 unsigned long long sizeM, unsigned stripe,
00448 string& device );
00449 int removeLvmLvByDevice( const string& device );
00450 int removeLvmLv( const string& vg, const string& name );
00451 int changeLvStripeCount( const string& vg, const string& name,
00452 unsigned long stripes );
00453 int changeLvStripeSize( const string& vg, const string& name,
00454 unsigned long long stripeSize );
00455
00456 int createLvmLvSnapshot(const string& vg, const string& origin,
00457 const string& name, unsigned long long cowSizeK,
00458 string& device);
00459 int removeLvmLvSnapshot(const string& vg, const string& name);
00460 int getLvmLvSnapshotStateInfo(const string& vg, const string& name,
00461 LvmLvSnapshotStateInfo& info);
00462
00463 int nextFreeMd(int &nr, string &device);
00464 bool checkMdNumber(int num);
00465 int createMd( const string& name, storage::MdType rtype,
00466 const deque<string>& devs );
00467 int createMdAny( storage::MdType rtype, const deque<string>& devs,
00468 string& device );
00469 int removeMd( const string& name, bool destroySb=true );
00470 int extendMd( const string& name, const string& dev );
00471 int shrinkMd( const string& name, const string& dev );
00472 int changeMdType( const string& name, storage::MdType rtype );
00473 int changeMdChunk( const string& name, unsigned long chunk );
00474 int changeMdParity( const string& name, storage::MdParity ptype );
00475 int checkMd( const string& name );
00476 int getMdStateInfo(const string& name, MdStateInfo& info);
00477 int computeMdSize(MdType md_type, list<string> devices,
00478 unsigned long long& sizeK);
00479
00480 void setImsmDriver(ImsmDriver val) { imsm_driver = val; }
00481 ImsmDriver getImsmDriver() const { return imsm_driver; }
00482
00483 int getMdPartCoInfo( const string& name, MdPartCoInfo& info);
00484 int getContMdPartCoInfo( const string& name, ContainerInfo& cinfo,
00485 MdPartCoInfo& info);
00486 int getMdPartCoStateInfo(const string& name, MdPartCoStateInfo& info);
00487 int removeMdPartCo(const string& devName, bool destroySb);
00488
00489 int addNfsDevice( const string& nfsDev, const string& opts,
00490 unsigned long long sizeK, const string& mp );
00491 int checkNfsDevice( const string& nfsDev, const string& opts,
00492 unsigned long long& sizeK );
00493
00494 int createFileLoop( const string& lname, bool reuseExisting,
00495 unsigned long long sizeK, const string& mp,
00496 const string& pwd, string& device );
00497 int modifyFileLoop( const string& device, const string& lname,
00498 bool reuseExisting, unsigned long long sizeK );
00499 int removeFileLoop( const string& lname, bool removeFile );
00500
00501 int removeDmraid( const string& name );
00502
00503 deque<string> getCommitActions( bool mark_destructive ) const;
00504 void getCommitInfo(bool mark_destructive, CommitInfo& info) const;
00505 const string& getLastAction() const { return lastAction; }
00506 const string& getExtendedErrorMessage() const { return extendedError; }
00507 void eraseFreeInfo( const string& device );
00508
00509 int waitForDevice() const;
00510 int waitForDevice( const string& device ) const;
00511 void checkDeviceExclusive( const string& device, unsigned secs );
00512 int zeroDevice(const string& device, unsigned long long sizeK, bool random = false,
00513 unsigned long long beginK = 200, unsigned long long endK = 10);
00514
00515 void getDiskList( bool (* CheckFnc)( const Disk& ),
00516 std::list<Disk*>& dl );
00517 void changeDeviceName( const string& old, const string& nw );
00518
00519 int commit();
00520 void handleHald( bool stop );
00521 void activateHld( bool val=true );
00522 void activateMultipath( bool val=true );
00523 void removeDmTableTo( const Volume& vol );
00524 void removeDmTableTo( const string& device );
00525 bool removeDmTable( const string& table );
00526 bool removeDmMapsTo( const string& dev );
00527 bool checkDmMapsTo( const string& dev );
00528 void updateDmEmptyPeMap();
00529 void dumpObjectList();
00530
00531 string byteToHumanString(unsigned long long size, bool classic, int precision, bool omit_zeroes) const;
00532 bool humanStringToByte(const string& str, bool classic, unsigned long long& size) const;
00533
00534 void setCallbackProgressBar(CallbackProgressBar pfnc) { progress_bar_cb = pfnc; }
00535 CallbackProgressBar getCallbackProgressBar() const { return progress_bar_cb; }
00536 void setCallbackShowInstallInfo(CallbackShowInstallInfo pfnc) { install_info_cb = pfnc; }
00537 CallbackShowInstallInfo getCallbackShowInstallInfo() const { return install_info_cb; }
00538 void setCallbackInfoPopup(CallbackInfoPopup pfnc) { info_popup_cb = pfnc; }
00539 CallbackInfoPopup getCallbackInfoPopup() const { return info_popup_cb; }
00540 void setCallbackYesNoPopup(CallbackYesNoPopup pfnc) { yesno_popup_cb = pfnc; }
00541 CallbackYesNoPopup getCallbackYesNoPopup() const { return yesno_popup_cb; }
00542 void setCallbackPasswordPopup(CallbackPasswordPopup pfnc) { password_popup_cb = pfnc; }
00543 CallbackPasswordPopup getCallbackPasswordPopup() const { return password_popup_cb; }
00544
00545 void addInfoPopupText( const string& disk, const string& txt );
00546
00547 CallbackProgressBar getCallbackProgressBarTheOne() const
00548 { return progress_bar_cb ? progress_bar_cb : progress_bar_cb_ycp; }
00549 CallbackShowInstallInfo getCallbackShowInstallInfoTheOne() const
00550 { return install_info_cb ? install_info_cb : install_info_cb_ycp; }
00551 CallbackInfoPopup getCallbackInfoPopupTheOne() const
00552 { return info_popup_cb ? info_popup_cb : info_popup_cb_ycp; }
00553 CallbackYesNoPopup getCallbackYesNoPopupTheOne() const
00554 { return yesno_popup_cb ? yesno_popup_cb : yesno_popup_cb_ycp; }
00555 CallbackPasswordPopup getCallbackPasswordPopupTheOne() const
00556 { return password_popup_cb ? password_popup_cb : password_popup_cb_ycp; }
00557
00558 void progressBarCb(const string& id, unsigned cur, unsigned max) const;
00559 void showInfoCb(const string& info);
00560 void infoPopupCb(const string& info) const;
00561 bool yesnoPopupCb(const string& info) const;
00562 bool passwordPopupCb(const string& device, int attempts, string& password) const;
00563
00564
00565 protected:
00566
00567 template< class Pred >
00568 struct ConstContainerPI { typedef ContainerIter<Pred, CCIter> type; };
00569 typedef CheckFnc<const Container> CheckFncCont;
00570 typedef CheckerIterator< CheckFncCont, ConstContainerPI<CheckFncCont>::type,
00571 CCIter, Container > ConstContPIterator;
00572 template< class Pred >
00573 struct ContainerPI { typedef ContainerIter<Pred, CIter> type; };
00574 template< class Pred >
00575 struct ContainerI
00576 { typedef ContainerDerIter<Pred, typename ContainerPI<Pred>::type,
00577 Container> type; };
00578 typedef CheckerIterator< CheckFncCont, ContainerPI<CheckFncCont>::type,
00579 CIter, Container > ContPIterator;
00580 typedef DerefIterator<ContPIterator,Container> ContIterator;
00581 typedef IterPair<ContIterator> CPair;
00582
00583 public:
00584
00585 template< class Pred >
00586 struct ConstContainerI
00587 { typedef ContainerDerIter<Pred, typename ConstContainerPI<Pred>::type,
00588 const Container> type; };
00589 template< class Pred >
00590 struct ContCondIPair { typedef MakeCondIterPair<Pred,
00591 typename ConstContainerI<Pred>::type> type;};
00592 typedef DerefIterator<ConstContPIterator,const Container> ConstContIterator;
00593 typedef IterPair<ConstContIterator> ConstContPair;
00594
00595
00596 ConstContPair contPair( bool (* CheckFnc)( const Container& )=NULL ) const
00597 {
00598 return( ConstContPair( contBegin( CheckFnc ), contEnd( CheckFnc ) ));
00599 }
00600 ConstContIterator contBegin( bool (* CheckFnc)( const Container& )=NULL ) const
00601 {
00602 return( ConstContIterator( ConstContPIterator( cont.begin(), cont.end(), CheckFnc )) );
00603 }
00604 ConstContIterator contEnd( bool (* CheckFnc)( const Container& )=NULL ) const
00605 {
00606 return( ConstContIterator( ConstContPIterator( cont.begin(), cont.end(), CheckFnc, true )) );
00607 }
00608 template< class Pred > typename ContCondIPair<Pred>::type contCondPair( const Pred& p ) const
00609 {
00610 return( typename ContCondIPair<Pred>::type( contCondBegin( p ), contCondEnd( p ) ) );
00611 }
00612 template< class Pred > typename ConstContainerI<Pred>::type contCondBegin( const Pred& p ) const
00613 {
00614 return( typename ConstContainerI<Pred>::type( typename ConstContainerPI<Pred>::type( cont.begin(), cont.end(), p )) );
00615 }
00616 template< class Pred > typename ConstContainerI<Pred>::type contCondEnd( const Pred& p ) const
00617 {
00618 return( typename ConstContainerI<Pred>::type( typename ConstContainerPI<Pred>::type( cont.begin(), cont.end(), p, true )) );
00619 }
00620 protected:
00621
00622 CPair cPair( bool (* CheckFnc)( const Container& )=NULL )
00623 {
00624 return( CPair( cBegin(CheckFnc), cEnd(CheckFnc) ));
00625 }
00626 ContIterator cBegin( bool (* CheckFnc)( const Container& )=NULL )
00627 {
00628 return( ContIterator( ContPIterator( cont.begin(), cont.end(), CheckFnc )) );
00629 }
00630 ContIterator cEnd( bool (* CheckFnc)( const Container& )=NULL )
00631 {
00632 return( ContIterator( ContPIterator( cont.begin(), cont.end(), CheckFnc, true )) );
00633 }
00634
00635
00636 protected:
00637
00638 typedef CastCheckIterator<CCIter, storage::DISK, const Disk *> ContainerCDiskIter;
00639 template< class Pred >
00640 struct ConstDiskPI { typedef ContainerIter<Pred, ContainerCDiskIter> type; };
00641 typedef CastCheckIterator<CIter, storage::DISK, Disk *> ContainerDiskIter;
00642 template< class Pred >
00643 struct DiskPI { typedef ContainerIter<Pred, ContainerDiskIter> type; };
00644 template< class Pred >
00645 struct DiskI { typedef ContainerDerIter<Pred, typename DiskPI<Pred>::type, Disk> type; };
00646 typedef CheckFnc<const Disk> CheckFncDisk;
00647 typedef CheckerIterator< CheckFncDisk, ConstDiskPI<CheckFncDisk>::type,
00648 ContainerCDiskIter, Disk > ConstDiskPIterator;
00649 typedef CheckerIterator< CheckFncDisk, DiskPI<CheckFncDisk>::type,
00650 ContainerDiskIter, Disk > DiskPIterator;
00651 typedef DerefIterator<DiskPIterator,Disk> DiskIterator;
00652 typedef IterPair<DiskIterator> DiskPair;
00653
00654 public:
00655
00656 typedef DerefIterator<ConstDiskPIterator,const Disk> ConstDiskIterator;
00657 template< class Pred >
00658 struct ConstDiskI
00659 { typedef ContainerDerIter<Pred, typename ConstDiskPI<Pred>::type,
00660 const Disk> type; };
00661 template< class Pred >
00662 struct DiskCondIPair { typedef MakeCondIterPair<Pred, typename ConstDiskI<Pred>::type> type; };
00663 typedef IterPair<ConstDiskIterator> ConstDiskPair;
00664
00665
00666 ConstDiskPair diskPair( bool (* CheckFnc)( const Disk& )=NULL ) const
00667 {
00668 return( ConstDiskPair( diskBegin( CheckFnc ), diskEnd( CheckFnc ) ));
00669 }
00670 ConstDiskIterator diskBegin( bool (* CheckFnc)( const Disk& )=NULL ) const
00671 {
00672 IterPair<ContainerCDiskIter> p( ContainerCDiskIter( cont.begin(), cont.end() ),
00673 ContainerCDiskIter( cont.begin(), cont.end(), true ));
00674 return( ConstDiskIterator( ConstDiskPIterator( p, CheckFnc )) );
00675 }
00676 ConstDiskIterator diskEnd( bool (* CheckFnc)( const Disk& )=NULL ) const
00677 {
00678 IterPair<ContainerCDiskIter> p( ContainerCDiskIter( cont.begin(), cont.end() ),
00679 ContainerCDiskIter( cont.begin(), cont.end(), true ));
00680 return( ConstDiskIterator( ConstDiskPIterator( p, CheckFnc, true )) );
00681 }
00682 template< class Pred > typename DiskCondIPair<Pred>::type diskCondPair( const Pred& p ) const
00683 {
00684 return( typename DiskCondIPair<Pred>::type( diskCondBegin( p ), diskCondEnd( p ) ) );
00685 }
00686 template< class Pred > typename ConstDiskI<Pred>::type diskCondBegin( const Pred& p ) const
00687 {
00688 IterPair<ContainerCDiskIter> pair( ContainerCDiskIter( cont.begin(), cont.end() ),
00689 ContainerCDiskIter( cont.begin(), cont.end(), true ));
00690 return( typename ConstDiskI<Pred>::type( typename ConstDiskPI<Pred>::type( pair, p )) );
00691 }
00692 template< class Pred > typename ConstDiskI<Pred>::type diskCondEnd( const Pred& p ) const
00693 {
00694 IterPair<ContainerCDiskIter> pair( ContainerCDiskIter( cont.begin(), cont.end() ),
00695 ContainerCDiskIter( cont.begin(), cont.end(), true ));
00696 return( typename ConstDiskI<Pred>::type( typename ConstDiskPI<Pred>::type( pair, p, true )) );
00697 }
00698 protected:
00699
00700 DiskPair dPair( bool (* CheckFnc)( const Disk& )=NULL )
00701 {
00702 return( DiskPair( dBegin( CheckFnc ), dEnd( CheckFnc ) ));
00703 }
00704 DiskIterator dBegin( bool (* CheckFnc)( const Disk& )=NULL )
00705 {
00706 IterPair<ContainerDiskIter> p( ContainerDiskIter( cont.begin(), cont.end() ),
00707 ContainerDiskIter( cont.begin(), cont.end(), true ));
00708 return( DiskIterator( DiskPIterator( p, CheckFnc )) );
00709 }
00710 DiskIterator dEnd( bool (* CheckFnc)( const Disk& )=NULL )
00711 {
00712 IterPair<ContainerDiskIter> p( ContainerDiskIter( cont.begin(), cont.end() ),
00713 ContainerDiskIter( cont.begin(), cont.end(), true ));
00714 return( DiskIterator( DiskPIterator( p, CheckFnc, true )) );
00715 }
00716
00717
00718
00719 protected:
00720
00721 typedef CastCheckIterator<CCIter, storage::LVM, const LvmVg *> ContainerCLvmVgIter;
00722 template< class Pred >
00723 struct ConstLvmVgPI { typedef ContainerIter<Pred, ContainerCLvmVgIter> type; };
00724 typedef CastCheckIterator<CIter, storage::LVM, LvmVg *> ContainerLvmVgIter;
00725 template< class Pred >
00726 struct LvmVgPI { typedef ContainerIter<Pred, ContainerLvmVgIter> type; };
00727 template< class Pred >
00728 struct LvmVgI { typedef ContainerDerIter<Pred, typename LvmVgPI<Pred>::type, LvmVg> type; };
00729 typedef CheckFnc<const LvmVg> CheckFncLvmVg;
00730 typedef CheckerIterator< CheckFncLvmVg, ConstLvmVgPI<CheckFncLvmVg>::type,
00731 ContainerCLvmVgIter, LvmVg > ConstLvmVgPIterator;
00732 typedef CheckerIterator< CheckFncLvmVg, LvmVgPI<CheckFncLvmVg>::type,
00733 ContainerLvmVgIter, LvmVg > LvmVgPIterator;
00734 typedef DerefIterator<LvmVgPIterator,LvmVg> LvmVgIterator;
00735 typedef IterPair<LvmVgIterator> LvmVgPair;
00736
00737 public:
00738
00739 typedef DerefIterator<ConstLvmVgPIterator,const LvmVg> ConstLvmVgIterator;
00740 template< class Pred >
00741 struct ConstLvmVgI
00742 { typedef ContainerDerIter<Pred, typename ConstLvmVgPI<Pred>::type,
00743 const LvmVg> type; };
00744 template< class Pred >
00745 struct LvmVgCondIPair { typedef MakeCondIterPair<Pred, typename ConstLvmVgI<Pred>::type> type; };
00746 typedef IterPair<ConstLvmVgIterator> ConstLvmVgPair;
00747
00748
00749 ConstLvmVgPair lvmVgPair( bool (* CheckFnc)( const LvmVg& )=NULL ) const
00750 {
00751 return( ConstLvmVgPair( lvmVgBegin( CheckFnc ), lvmVgEnd( CheckFnc ) ));
00752 }
00753 ConstLvmVgIterator lvmVgBegin( bool (* CheckFnc)( const LvmVg& )=NULL ) const
00754 {
00755 IterPair<ContainerCLvmVgIter> p( ContainerCLvmVgIter( cont.begin(), cont.end() ),
00756 ContainerCLvmVgIter( cont.begin(), cont.end(), true ));
00757 return( ConstLvmVgIterator( ConstLvmVgPIterator( p, CheckFnc )) );
00758 }
00759 ConstLvmVgIterator lvmVgEnd( bool (* CheckFnc)( const LvmVg& )=NULL ) const
00760 {
00761 IterPair<ContainerCLvmVgIter> p( ContainerCLvmVgIter( cont.begin(), cont.end() ),
00762 ContainerCLvmVgIter( cont.begin(), cont.end(), true ));
00763 return( ConstLvmVgIterator( ConstLvmVgPIterator( p, CheckFnc, true )) );
00764 }
00765 template< class Pred > typename LvmVgCondIPair<Pred>::type lvmVgCondPair( const Pred& p ) const
00766 {
00767 return( typename LvmVgCondIPair<Pred>::type( lvmVgCondBegin( p ), lvmVgCondEnd( p ) ) );
00768 }
00769 template< class Pred > typename ConstLvmVgI<Pred>::type lvmVgCondBegin( const Pred& p ) const
00770 {
00771 IterPair<ContainerCLvmVgIter> pair( ContainerCLvmVgIter( cont.begin(), cont.end() ),
00772 ContainerCLvmVgIter( cont.begin(), cont.end(), true ));
00773 return( typename ConstLvmVgI<Pred>::type( typename ConstLvmVgPI<Pred>::type( pair, p )) );
00774 }
00775 template< class Pred > typename ConstLvmVgI<Pred>::type lvmVgCondEnd( const Pred& p ) const
00776 {
00777 IterPair<ContainerCLvmVgIter> pair( ContainerCLvmVgIter( cont.begin(), cont.end() ),
00778 ContainerCLvmVgIter( cont.begin(), cont.end(), true ));
00779 return( typename ConstLvmVgI<Pred>::type( typename ConstLvmVgPI<Pred>::type( pair, p, true )) );
00780 }
00781 protected:
00782
00783 LvmVgPair lvgPair( bool (* CheckFnc)( const LvmVg& )=NULL )
00784 {
00785 return( LvmVgPair( lvgBegin( CheckFnc ), lvgEnd( CheckFnc ) ));
00786 }
00787 LvmVgIterator lvgBegin( bool (* CheckFnc)( const LvmVg& )=NULL )
00788 {
00789 IterPair<ContainerLvmVgIter> p( ContainerLvmVgIter( cont.begin(), cont.end() ),
00790 ContainerLvmVgIter( cont.begin(), cont.end(), true ));
00791 return( LvmVgIterator( LvmVgPIterator( p, CheckFnc )) );
00792 }
00793 LvmVgIterator lvgEnd( bool (* CheckFnc)( const LvmVg& )=NULL )
00794 {
00795 IterPair<ContainerLvmVgIter> p( ContainerLvmVgIter( cont.begin(), cont.end() ),
00796 ContainerLvmVgIter( cont.begin(), cont.end(), true ));
00797 return( LvmVgIterator( LvmVgPIterator( p, CheckFnc, true )) );
00798 }
00799
00800
00801 protected:
00802
00803 typedef CastCheckFncIterator<CCIter, isDmPart, const DmPartCo *> ContainerCDmPartIter;
00804 template< class Pred >
00805 struct ConstDmPartCoPI { typedef ContainerIter<Pred, ContainerCDmPartIter> type; };
00806 typedef CastCheckFncIterator<CIter, isDmPart, DmPartCo *> ContainerDmPartIter;
00807 template< class Pred >
00808 struct DmPartCoPI { typedef ContainerIter<Pred, ContainerDmPartIter> type; };
00809 template< class Pred >
00810 struct DmPartCoI { typedef ContainerDerIter<Pred, typename DmPartCoPI<Pred>::type, DmPartCo> type; };
00811 typedef CheckFnc<const DmPartCo> CheckFncDmPartCo;
00812 typedef CheckerIterator< CheckFncDmPartCo, ConstDmPartCoPI<CheckFncDmPartCo>::type,
00813 ContainerCDmPartIter, DmPartCo > ConstDmPartCoPIterator;
00814 typedef CheckerIterator< CheckFncDmPartCo, DmPartCoPI<CheckFncDmPartCo>::type,
00815 ContainerDmPartIter, DmPartCo > DmPartCoPIterator;
00816 typedef DerefIterator<DmPartCoPIterator,DmPartCo> DmPartCoIterator;
00817 typedef IterPair<DmPartCoIterator> DmPartCoPair;
00818
00819 public:
00820
00821 typedef DerefIterator<ConstDmPartCoPIterator,const DmPartCo> ConstDmPartCoIterator;
00822 template< class Pred >
00823 struct ConstDmPartCoI
00824 { typedef ContainerDerIter<Pred, typename ConstDmPartCoPI<Pred>::type,
00825 const DmPartCo> type; };
00826 template< class Pred >
00827 struct DmPartCoCondIPair { typedef MakeCondIterPair<Pred, typename ConstDmPartCoI<Pred>::type> type; };
00828 typedef IterPair<ConstDmPartCoIterator> ConstDmPartCoPair;
00829
00830
00831 ConstDmPartCoPair dmpartCoPair( bool (* CheckFnc)( const DmPartCo& )=NULL ) const
00832 {
00833 return( ConstDmPartCoPair( dmpartCoBegin( CheckFnc ), dmpartCoEnd( CheckFnc ) ));
00834 }
00835 ConstDmPartCoIterator dmpartCoBegin( bool (* CheckFnc)( const DmPartCo& )=NULL ) const
00836 {
00837 IterPair<ContainerCDmPartIter> p( ContainerCDmPartIter( cont.begin(), cont.end() ),
00838 ContainerCDmPartIter( cont.begin(), cont.end(), true ));
00839 return( ConstDmPartCoIterator( ConstDmPartCoPIterator( p, CheckFnc )) );
00840 }
00841 ConstDmPartCoIterator dmpartCoEnd( bool (* CheckFnc)( const DmPartCo& )=NULL ) const
00842 {
00843 IterPair<ContainerCDmPartIter> p( ContainerCDmPartIter( cont.begin(), cont.end() ),
00844 ContainerCDmPartIter( cont.begin(), cont.end(), true ));
00845 return( ConstDmPartCoIterator( ConstDmPartCoPIterator( p, CheckFnc, true )) );
00846 }
00847 template< class Pred > typename DmPartCoCondIPair<Pred>::type dmPartCoCondPair( const Pred& p ) const
00848 {
00849 return( typename DmPartCoCondIPair<Pred>::type( dmpartCoCondBegin( p ), dmpartCoCondEnd( p ) ) );
00850 }
00851 template< class Pred > typename ConstDmPartCoI<Pred>::type dmpartCoCondBegin( const Pred& p ) const
00852 {
00853 IterPair<ContainerCDmPartIter> pair( ContainerCDmPartIter( cont.begin(), cont.end() ),
00854 ContainerCDmPartIter( cont.begin(), cont.end(), true ));
00855 return( typename ConstDmPartCoI<Pred>::type( typename ConstDmPartCoPI<Pred>::type( pair, p )) );
00856 }
00857 template< class Pred > typename ConstDmPartCoI<Pred>::type dmpartCoCondEnd( const Pred& p ) const
00858 {
00859 IterPair<ContainerCDmPartIter> pair( ContainerCDmPartIter( cont.begin(), cont.end() ),
00860 ContainerCDmPartIter( cont.begin(), cont.end(), true ));
00861 return( typename ConstDmPartCoI<Pred>::type( typename ConstDmPartCoPI<Pred>::type( pair, p, true )) );
00862 }
00863 protected:
00864
00865 DmPartCoPair dmpCoPair( bool (* CheckFnc)( const DmPartCo& )=NULL )
00866 {
00867 return( DmPartCoPair( dmpCoBegin( CheckFnc ), dmpCoEnd( CheckFnc ) ));
00868 }
00869 DmPartCoIterator dmpCoBegin( bool (* CheckFnc)( const DmPartCo& )=NULL )
00870 {
00871 IterPair<ContainerDmPartIter> p( ContainerDmPartIter( cont.begin(), cont.end() ),
00872 ContainerDmPartIter( cont.begin(), cont.end(), true ));
00873 return( DmPartCoIterator( DmPartCoPIterator( p, CheckFnc )) );
00874 }
00875 DmPartCoIterator dmpCoEnd( bool (* CheckFnc)( const DmPartCo& )=NULL )
00876 {
00877 IterPair<ContainerDmPartIter> p( ContainerDmPartIter( cont.begin(), cont.end() ),
00878 ContainerDmPartIter( cont.begin(), cont.end(), true ));
00879 return( DmPartCoIterator( DmPartCoPIterator( p, CheckFnc, true )) );
00880 }
00881
00882
00883 protected:
00884
00885 typedef CastCheckIterator<CCIter, storage::DMRAID, const DmraidCo *> ContainerCDmraidIter;
00886 template< class Pred >
00887 struct ConstDmraidCoPI { typedef ContainerIter<Pred, ContainerCDmraidIter> type; };
00888 typedef CastCheckIterator<CIter, storage::DMRAID, DmraidCo *> ContainerDmraidIter;
00889 template< class Pred >
00890 struct DmraidCoPI { typedef ContainerIter<Pred, ContainerDmraidIter> type; };
00891 template< class Pred >
00892 struct DmraidCoI { typedef ContainerDerIter<Pred, typename DmraidCoPI<Pred>::type, DmraidCo> type; };
00893 typedef CheckFnc<const DmraidCo> CheckFncDmraidCo;
00894 typedef CheckerIterator< CheckFncDmraidCo, ConstDmraidCoPI<CheckFncDmraidCo>::type,
00895 ContainerCDmraidIter, DmraidCo > ConstDmraidCoPIterator;
00896 typedef CheckerIterator< CheckFncDmraidCo, DmraidCoPI<CheckFncDmraidCo>::type,
00897 ContainerDmraidIter, DmraidCo > DmraidCoPIterator;
00898 typedef DerefIterator<DmraidCoPIterator,DmraidCo> DmraidCoIterator;
00899 typedef IterPair<DmraidCoIterator> DmraidCoPair;
00900
00901 public:
00902
00903 typedef DerefIterator<ConstDmraidCoPIterator,const DmraidCo> ConstDmraidCoIterator;
00904 template< class Pred >
00905 struct ConstDmraidCoI
00906 { typedef ContainerDerIter<Pred, typename ConstDmraidCoPI<Pred>::type,
00907 const DmraidCo> type; };
00908 template< class Pred >
00909 struct DmraidCoCondIPair { typedef MakeCondIterPair<Pred, typename ConstDmraidCoI<Pred>::type> type; };
00910 typedef IterPair<ConstDmraidCoIterator> ConstDmraidCoPair;
00911
00912
00913 ConstDmraidCoPair dmraidCoPair( bool (* CheckFnc)( const DmraidCo& )=NULL ) const
00914 {
00915 return( ConstDmraidCoPair( dmraidCoBegin( CheckFnc ), dmraidCoEnd( CheckFnc ) ));
00916 }
00917 ConstDmraidCoIterator dmraidCoBegin( bool (* CheckFnc)( const DmraidCo& )=NULL ) const
00918 {
00919 IterPair<ContainerCDmraidIter> p( ContainerCDmraidIter( cont.begin(), cont.end() ),
00920 ContainerCDmraidIter( cont.begin(), cont.end(), true ));
00921 return( ConstDmraidCoIterator( ConstDmraidCoPIterator( p, CheckFnc )) );
00922 }
00923 ConstDmraidCoIterator dmraidCoEnd( bool (* CheckFnc)( const DmraidCo& )=NULL ) const
00924 {
00925 IterPair<ContainerCDmraidIter> p( ContainerCDmraidIter( cont.begin(), cont.end() ),
00926 ContainerCDmraidIter( cont.begin(), cont.end(), true ));
00927 return( ConstDmraidCoIterator( ConstDmraidCoPIterator( p, CheckFnc, true )) );
00928 }
00929 template< class Pred > typename DmraidCoCondIPair<Pred>::type dmraidCoCondPair( const Pred& p ) const
00930 {
00931 return( typename DmraidCoCondIPair<Pred>::type( dmraidCoCondBegin( p ), dmraidCoCondEnd( p ) ) );
00932 }
00933 template< class Pred > typename ConstDmraidCoI<Pred>::type dmraidCoCondBegin( const Pred& p ) const
00934 {
00935 IterPair<ContainerCDmraidIter> pair( ContainerCDmraidIter( cont.begin(), cont.end() ),
00936 ContainerCDmraidIter( cont.begin(), cont.end(), true ));
00937 return( typename ConstDmraidCoI<Pred>::type( typename ConstDmraidCoPI<Pred>::type( pair, p )) );
00938 }
00939 template< class Pred > typename ConstDmraidCoI<Pred>::type dmraidCoCondEnd( const Pred& p ) const
00940 {
00941 IterPair<ContainerCDmraidIter> pair( ContainerCDmraidIter( cont.begin(), cont.end() ),
00942 ContainerCDmraidIter( cont.begin(), cont.end(), true ));
00943 return( typename ConstDmraidCoI<Pred>::type( typename ConstDmraidCoPI<Pred>::type( pair, p, true )) );
00944 }
00945 protected:
00946
00947 DmraidCoPair dmrCoPair( bool (* CheckFnc)( const DmraidCo& )=NULL )
00948 {
00949 return( DmraidCoPair( dmrCoBegin( CheckFnc ), dmrCoEnd( CheckFnc ) ));
00950 }
00951 DmraidCoIterator dmrCoBegin( bool (* CheckFnc)( const DmraidCo& )=NULL )
00952 {
00953 IterPair<ContainerDmraidIter> p( ContainerDmraidIter( cont.begin(), cont.end() ),
00954 ContainerDmraidIter( cont.begin(), cont.end(), true ));
00955 return( DmraidCoIterator( DmraidCoPIterator( p, CheckFnc )) );
00956 }
00957 DmraidCoIterator dmrCoEnd( bool (* CheckFnc)( const DmraidCo& )=NULL )
00958 {
00959 IterPair<ContainerDmraidIter> p( ContainerDmraidIter( cont.begin(), cont.end() ),
00960 ContainerDmraidIter( cont.begin(), cont.end(), true ));
00961 return( DmraidCoIterator( DmraidCoPIterator( p, CheckFnc, true )) );
00962 }
00963
00964
00965
00966 protected:
00967
00968 typedef CastCheckIterator<CCIter, storage::DMMULTIPATH, const DmmultipathCo *> ContainerCDmmultipathIter;
00969 template< class Pred >
00970 struct ConstDmmultipathCoPI { typedef ContainerIter<Pred, ContainerCDmmultipathIter> type; };
00971 typedef CastCheckIterator<CIter, storage::DMMULTIPATH, DmmultipathCo *> ContainerDmmultipathIter;
00972 template< class Pred >
00973 struct DmmultipathCoPI { typedef ContainerIter<Pred, ContainerDmmultipathIter> type; };
00974 template< class Pred >
00975 struct DmmultipathCoI { typedef ContainerDerIter<Pred, typename DmmultipathCoPI<Pred>::type, DmmultipathCo> type; };
00976 typedef CheckFnc<const DmmultipathCo> CheckFncDmmultipathCo;
00977 typedef CheckerIterator< CheckFncDmmultipathCo, ConstDmmultipathCoPI<CheckFncDmmultipathCo>::type,
00978 ContainerCDmmultipathIter, DmmultipathCo > ConstDmmultipathCoPIterator;
00979 typedef CheckerIterator< CheckFncDmmultipathCo, DmmultipathCoPI<CheckFncDmmultipathCo>::type,
00980 ContainerDmmultipathIter, DmmultipathCo > DmmultipathCoPIterator;
00981 typedef DerefIterator<DmmultipathCoPIterator,DmmultipathCo> DmmultipathCoIterator;
00982 typedef IterPair<DmmultipathCoIterator> DmmultipathCoPair;
00983
00984 public:
00985
00986 typedef DerefIterator<ConstDmmultipathCoPIterator,const DmmultipathCo> ConstDmmultipathCoIterator;
00987 template< class Pred >
00988 struct ConstDmmultipathCoI
00989 { typedef ContainerDerIter<Pred, typename ConstDmmultipathCoPI<Pred>::type,
00990 const DmmultipathCo> type; };
00991 template< class Pred >
00992 struct DmmultipathCoCondIPair { typedef MakeCondIterPair<Pred, typename ConstDmmultipathCoI<Pred>::type> type; };
00993 typedef IterPair<ConstDmmultipathCoIterator> ConstDmmultipathCoPair;
00994
00995
00996 ConstDmmultipathCoPair dmmultipathCoPair( bool (* CheckFnc)( const DmmultipathCo& )=NULL ) const
00997 {
00998 return( ConstDmmultipathCoPair( dmmultipathCoBegin( CheckFnc ), dmmultipathCoEnd( CheckFnc ) ));
00999 }
01000 ConstDmmultipathCoIterator dmmultipathCoBegin( bool (* CheckFnc)( const DmmultipathCo& )=NULL ) const
01001 {
01002 IterPair<ContainerCDmmultipathIter> p( ContainerCDmmultipathIter( cont.begin(), cont.end() ),
01003 ContainerCDmmultipathIter( cont.begin(), cont.end(), true ));
01004 return( ConstDmmultipathCoIterator( ConstDmmultipathCoPIterator( p, CheckFnc )) );
01005 }
01006 ConstDmmultipathCoIterator dmmultipathCoEnd( bool (* CheckFnc)( const DmmultipathCo& )=NULL ) const
01007 {
01008 IterPair<ContainerCDmmultipathIter> p( ContainerCDmmultipathIter( cont.begin(), cont.end() ),
01009 ContainerCDmmultipathIter( cont.begin(), cont.end(), true ));
01010 return( ConstDmmultipathCoIterator( ConstDmmultipathCoPIterator( p, CheckFnc, true )) );
01011 }
01012 template< class Pred > typename DmmultipathCoCondIPair<Pred>::type dmmultipathCoCondPair( const Pred& p ) const
01013 {
01014 return( typename DmmultipathCoCondIPair<Pred>::type( dmmultipathCoCondBegin( p ), dmmultipathCoCondEnd( p ) ) );
01015 }
01016 template< class Pred > typename ConstDmmultipathCoI<Pred>::type dmmultipathCoCondBegin( const Pred& p ) const
01017 {
01018 IterPair<ContainerCDmmultipathIter> pair( ContainerCDmmultipathIter( cont.begin(), cont.end() ),
01019 ContainerCDmmultipathIter( cont.begin(), cont.end(), true ));
01020 return( typename ConstDmmultipathCoI<Pred>::type( typename ConstDmmultipathCoPI<Pred>::type( pair, p )) );
01021 }
01022 template< class Pred > typename ConstDmmultipathCoI<Pred>::type dmmultipathCoCondEnd( const Pred& p ) const
01023 {
01024 IterPair<ContainerCDmmultipathIter> pair( ContainerCDmmultipathIter( cont.begin(), cont.end() ),
01025 ContainerCDmmultipathIter( cont.begin(), cont.end(), true ));
01026 return( typename ConstDmmultipathCoI<Pred>::type( typename ConstDmmultipathCoPI<Pred>::type( pair, p, true )) );
01027 }
01028 protected:
01029
01030 DmmultipathCoPair dmmCoPair( bool (* CheckFnc)( const DmmultipathCo& )=NULL )
01031 {
01032 return( DmmultipathCoPair( dmmCoBegin( CheckFnc ), dmmCoEnd( CheckFnc ) ));
01033 }
01034 DmmultipathCoIterator dmmCoBegin( bool (* CheckFnc)( const DmmultipathCo& )=NULL )
01035 {
01036 IterPair<ContainerDmmultipathIter> p( ContainerDmmultipathIter( cont.begin(), cont.end() ),
01037 ContainerDmmultipathIter( cont.begin(), cont.end(), true ));
01038 return( DmmultipathCoIterator( DmmultipathCoPIterator( p, CheckFnc )) );
01039 }
01040 DmmultipathCoIterator dmmCoEnd( bool (* CheckFnc)( const DmmultipathCo& )=NULL )
01041 {
01042 IterPair<ContainerDmmultipathIter> p( ContainerDmmultipathIter( cont.begin(), cont.end() ),
01043 ContainerDmmultipathIter( cont.begin(), cont.end(), true ));
01044 return( DmmultipathCoIterator( DmmultipathCoPIterator( p, CheckFnc, true )) );
01045 }
01046
01047
01048
01049 protected:
01050
01051 typedef CastCheckFncIterator<CCIter, isMdPart, const MdPartCo *> ContainerCMdPartIter;
01052 template< class Pred >
01053 struct ConstMdPartCoPI { typedef ContainerIter<Pred, ContainerCMdPartIter> type; };
01054 typedef CastCheckFncIterator<CIter, isMdPart, MdPartCo *> ContainerMdPartIter;
01055 template< class Pred >
01056 struct MdPartCoPI { typedef ContainerIter<Pred, ContainerMdPartIter> type; };
01057 template< class Pred >
01058 struct MdPartCoI { typedef ContainerDerIter<Pred, typename MdPartCoPI<Pred>::type, MdPartCo> type; };
01059 typedef CheckFnc<const MdPartCo> CheckFncMdPartCo;
01060 typedef CheckerIterator< CheckFncMdPartCo, ConstMdPartCoPI<CheckFncMdPartCo>::type,
01061 ContainerCMdPartIter, MdPartCo > ConstMdPartCoPIterator;
01062 typedef CheckerIterator< CheckFncMdPartCo, MdPartCoPI<CheckFncMdPartCo>::type,
01063 ContainerMdPartIter, MdPartCo > MdPartCoPIterator;
01064 typedef DerefIterator<MdPartCoPIterator,MdPartCo> MdPartCoIterator;
01065 typedef IterPair<MdPartCoIterator> MdPartCoPair;
01066
01067 public:
01068
01069 typedef DerefIterator<ConstMdPartCoPIterator,const MdPartCo> ConstMdPartCoIterator;
01070 template< class Pred >
01071 struct ConstMdPartCoI
01072 { typedef ContainerDerIter<Pred, typename ConstMdPartCoPI<Pred>::type,
01073 const MdPartCo> type; };
01074 template< class Pred >
01075 struct MdPartCoCondIPair { typedef MakeCondIterPair<Pred, typename ConstMdPartCoI<Pred>::type> type; };
01076 typedef IterPair<ConstMdPartCoIterator> ConstMdPartCoPair;
01077
01078
01079 ConstMdPartCoPair mdpartCoPair( bool (* CheckFnc)( const MdPartCo& )=NULL ) const
01080 {
01081 return( ConstMdPartCoPair( mdpartCoBegin( CheckFnc ), mdpartCoEnd( CheckFnc ) ));
01082 }
01083 ConstMdPartCoIterator mdpartCoBegin( bool (* CheckFnc)( const MdPartCo& )=NULL ) const
01084 {
01085 IterPair<ContainerCMdPartIter> p( ContainerCMdPartIter( cont.begin(), cont.end() ),
01086 ContainerCMdPartIter( cont.begin(), cont.end(), true ));
01087 return( ConstMdPartCoIterator( ConstMdPartCoPIterator( p, CheckFnc )) );
01088 }
01089 ConstMdPartCoIterator mdpartCoEnd( bool (* CheckFnc)( const MdPartCo& )=NULL ) const
01090 {
01091 IterPair<ContainerCMdPartIter> p( ContainerCMdPartIter( cont.begin(), cont.end() ),
01092 ContainerCMdPartIter( cont.begin(), cont.end(), true ));
01093 return( ConstMdPartCoIterator( ConstMdPartCoPIterator( p, CheckFnc, true )) );
01094 }
01095 template< class Pred > typename MdPartCoCondIPair<Pred>::type mdPartCoCondPair( const Pred& p ) const
01096 {
01097 return( typename MdPartCoCondIPair<Pred>::type( mdpartCoCondBegin( p ), mdpartCoCondEnd( p ) ) );
01098 }
01099 template< class Pred > typename ConstMdPartCoI<Pred>::type mdpartCoCondBegin( const Pred& p ) const
01100 {
01101 IterPair<ContainerCMdPartIter> pair( ContainerCMdPartIter( cont.begin(), cont.end() ),
01102 ContainerCMdPartIter( cont.begin(), cont.end(), true ));
01103 return( typename ConstMdPartCoI<Pred>::type( typename ConstMdPartCoPI<Pred>::type( pair, p )) );
01104 }
01105 template< class Pred > typename ConstMdPartCoI<Pred>::type mdpartCoCondEnd( const Pred& p ) const
01106 {
01107 IterPair<ContainerCMdPartIter> pair( ContainerCMdPartIter( cont.begin(), cont.end() ),
01108 ContainerCMdPartIter( cont.begin(), cont.end(), true ));
01109 return( typename ConstMdPartCoI<Pred>::type( typename ConstMdPartCoPI<Pred>::type( pair, p, true )) );
01110 }
01111 protected:
01112
01113 MdPartCoPair mdpCoPair( bool (* CheckFnc)( const MdPartCo& )=NULL )
01114 {
01115 return( MdPartCoPair( mdpCoBegin( CheckFnc ), mdpCoEnd( CheckFnc ) ));
01116 }
01117 MdPartCoIterator mdpCoBegin( bool (* CheckFnc)( const MdPartCo& )=NULL )
01118 {
01119 IterPair<ContainerMdPartIter> p( ContainerMdPartIter( cont.begin(), cont.end() ),
01120 ContainerMdPartIter( cont.begin(), cont.end(), true ));
01121 return( MdPartCoIterator( MdPartCoPIterator( p, CheckFnc )) );
01122 }
01123 MdPartCoIterator mdpCoEnd( bool (* CheckFnc)( const MdPartCo& )=NULL )
01124 {
01125 IterPair<ContainerMdPartIter> p( ContainerMdPartIter( cont.begin(), cont.end() ),
01126 ContainerMdPartIter( cont.begin(), cont.end(), true ));
01127 return( MdPartCoIterator( MdPartCoPIterator( p, CheckFnc, true )) );
01128 }
01129
01130
01131
01132
01133 protected:
01134
01135 typedef ListListIterator<Container::ConstPlainIterator, ConstContIterator> ConstVolInter;
01136 template< class Pred >
01137 struct ConstVolumePI { typedef ContainerIter<Pred, ConstVolInter> type; };
01138 typedef CheckFnc<const Volume> CheckFncVol;
01139 typedef CheckerIterator< CheckFncVol, ConstVolumePI<CheckFncVol>::type,
01140 ConstVolInter, Volume > ConstVolPIterator;
01141 typedef ListListIterator<Container::PlainIterator, ContIterator> VolPart;
01142 template< class Pred >
01143 struct VolumeI { typedef ContainerIter<Pred, VolPart> type; };
01144 typedef CheckerIterator< CheckFncVol, VolumeI<CheckFncVol>::type,
01145 VolPart, Volume > VolPIterator;
01146 typedef DerefIterator<VolPIterator,Volume> VolIterator;
01147 typedef IterPair<VolIterator> VPair;
01148
01149 public:
01150
01151 template< class Pred >
01152 struct ConstVolumeI { typedef ContainerDerIter<Pred, typename ConstVolumePI<Pred>::type, const Volume> type; };
01153 template< class Pred >
01154 struct VolCondIPair { typedef MakeCondIterPair<Pred, typename ConstVolumeI<Pred>::type> type;};
01155 typedef DerefIterator<ConstVolPIterator,const Volume> ConstVolIterator;
01156 typedef IterPair<ConstVolIterator> ConstVolPair;
01157
01158
01159 ConstVolPair volPair( bool (* CheckCnt)( const Container& )) const
01160 {
01161 return( ConstVolPair( volBegin( CheckCnt ), volEnd( CheckCnt ) ));
01162 }
01163 ConstVolPair volPair( bool (* CheckVol)( const Volume& )=NULL,
01164 bool (* CheckCnt)( const Container& )=NULL) const
01165 {
01166 return( ConstVolPair( volBegin( CheckVol, CheckCnt ),
01167 volEnd( CheckVol, CheckCnt ) ));
01168 }
01169 ConstVolIterator volBegin( bool (* CheckCnt)( const Container& )) const
01170 {
01171 return( volBegin( NULL, CheckCnt ) );
01172 }
01173 ConstVolIterator volBegin( bool (* CheckVol)( const Volume& )=NULL,
01174 bool (* CheckCnt)( const Container& )=NULL) const
01175 {
01176 IterPair<ConstVolInter> p( (ConstVolInter( contPair( CheckCnt ))),
01177 (ConstVolInter( contPair( CheckCnt ), true )));
01178 return( ConstVolIterator( ConstVolPIterator(p, CheckVol )));
01179 }
01180 ConstVolIterator volEnd( bool (* CheckCnt)( const Container& )) const
01181 {
01182 return( volEnd( NULL, CheckCnt ) );
01183 }
01184 ConstVolIterator volEnd( bool (* CheckVol)( const Volume& )=NULL,
01185 bool (* CheckCnt)( const Container& )=NULL) const
01186 {
01187 IterPair<ConstVolInter> p( (ConstVolInter( contPair( CheckCnt ))),
01188 (ConstVolInter( contPair( CheckCnt ), true )));
01189 return( ConstVolIterator( ConstVolPIterator(p, CheckVol, true )));
01190 }
01191 template< class Pred > typename VolCondIPair<Pred>::type volCondPair( const Pred& p ) const
01192 {
01193 return( typename VolCondIPair<Pred>::type( volCondBegin( p ), volCondEnd( p ) ) );
01194 }
01195 template< class Pred > typename ConstVolumeI<Pred>::type volCondBegin( const Pred& p ) const
01196 {
01197 IterPair<ConstVolInter> pair( (ConstVolInter( contPair())),
01198 (ConstVolInter( contPair(), true )));
01199 return( typename ConstVolumeI<Pred>::type( typename ConstVolumePI<Pred>::type(pair, p) ) );
01200 }
01201 template< class Pred > typename ConstVolumeI<Pred>::type volCondEnd( const Pred& p ) const
01202 {
01203 IterPair<ConstVolInter> pair( (ConstVolInter( contPair())),
01204 (ConstVolInter( contPair(), true )));
01205 return( typename ConstVolumeI<Pred>::type( typename ConstVolumePI<Pred>::type(pair, p, true )) );
01206 }
01207
01208 protected:
01209
01210 VPair vPair( bool (* CheckCnt)( const Container& ))
01211 {
01212 return( VPair( vBegin( CheckCnt ), vEnd( CheckCnt ) ));
01213 }
01214 VPair vPair( bool (* CheckVol)( const Volume& )=NULL,
01215 bool (* CheckCnt)( const Container& )=NULL)
01216 {
01217 return( VPair( vBegin( CheckVol, CheckCnt ),
01218 vEnd( CheckVol, CheckCnt ) ));
01219 }
01220 VolIterator vBegin( bool (* CheckCnt)( const Container& ))
01221 {
01222 return( vBegin( NULL, CheckCnt ) );
01223 }
01224 VolIterator vBegin( bool (* CheckVol)( const Volume& )=NULL,
01225 bool (* CheckCnt)( const Container& )=NULL)
01226 {
01227 IterPair<VolPart> p( (VolPart( cPair( CheckCnt ))),
01228 (VolPart( cPair( CheckCnt ), true )));
01229 return( VolIterator( VolPIterator( p, CheckVol )));
01230 }
01231 VolIterator vEnd( bool (* CheckCnt)( const Container& ))
01232 {
01233 return( vEnd( NULL, CheckCnt ) );
01234 }
01235 VolIterator vEnd( bool (* CheckVol)( const Volume& )=NULL,
01236 bool (* CheckCnt)( const Container& )=NULL)
01237 {
01238 IterPair<VolPart> p( (VolPart( cPair( CheckCnt ))),
01239 (VolPart( cPair( CheckCnt ), true )));
01240 return( VolIterator( VolPIterator( p, CheckVol, true )));
01241 }
01242
01243
01244 protected:
01245
01246 typedef ListListIterator<Container::ConstPlainIterator, ConstDiskIterator> ConstPartInter;
01247 typedef CastIterator<ConstPartInter, Partition *> ConstPartInter2;
01248 template< class Pred >
01249 struct ConstPartitionPI { typedef ContainerIter<Pred, ConstPartInter2> type; };
01250 typedef CheckFnc<const Partition> CheckFncPartition;
01251 typedef CheckerIterator< CheckFncPartition, ConstPartitionPI<CheckFncPartition>::type,
01252 ConstPartInter2, Partition > ConstPartPIterator;
01253 public:
01254
01255 template< class Pred >
01256 struct ConstPartitionI
01257 { typedef ContainerDerIter<Pred, typename ConstPartitionPI<Pred>::type,
01258 const Partition> type; };
01259 template< class Pred >
01260 struct PartCondIPair
01261 { typedef MakeCondIterPair<Pred, typename ConstPartitionI<Pred>::type> type;};
01262 typedef DerefIterator<ConstPartPIterator, const Partition> ConstPartIterator;
01263 typedef IterPair<ConstPartIterator> ConstPartPair;
01264
01265
01266 ConstPartPair partPair( bool (* CheckCnt)( const Disk& )) const
01267 {
01268 return( ConstPartPair( partBegin( CheckCnt ), partEnd( CheckCnt ) ));
01269 }
01270 ConstPartPair partPair( bool (* CheckPart)( const Partition& )=NULL,
01271 bool (* CheckCnt)( const Disk& )=NULL) const
01272 {
01273 return( ConstPartPair( partBegin( CheckPart, CheckCnt ),
01274 partEnd( CheckPart, CheckCnt ) ));
01275 }
01276 ConstPartIterator partBegin( bool (* CheckDisk)( const Disk& )) const
01277 {
01278 return( partBegin( NULL, CheckDisk ) );
01279 }
01280 ConstPartIterator partBegin( bool (* CheckPart)( const Partition& )=NULL,
01281 bool (* CheckDisk)( const Disk& )=NULL) const
01282 {
01283 IterPair<ConstPartInter2> p( (ConstPartInter(diskPair( CheckDisk ))),
01284 (ConstPartInter(diskPair( CheckDisk ), true )));
01285 return( ConstPartIterator( ConstPartPIterator(p, CheckPart )));
01286 }
01287 ConstPartIterator partEnd( bool (* CheckDisk)( const Disk& )) const
01288 {
01289 return( partEnd( NULL, CheckDisk ) );
01290 }
01291 ConstPartIterator partEnd( bool (* CheckPart)( const Partition& )=NULL,
01292 bool (* CheckDisk)( const Disk& )=NULL) const
01293 {
01294 IterPair<ConstPartInter2> p( (ConstPartInter(diskPair( CheckDisk ))),
01295 (ConstPartInter(diskPair( CheckDisk ), true )));
01296 return( ConstPartIterator( ConstPartPIterator(p, CheckPart, true )));
01297 }
01298 template< class Pred > typename PartCondIPair<Pred>::type partCondPair( const Pred& p ) const
01299 {
01300 return( typename PartCondIPair<Pred>::type( partCondBegin( p ), partCondEnd( p ) ) );
01301 }
01302 template< class Pred > typename ConstPartitionI<Pred>::type partCondBegin( const Pred& p ) const
01303 {
01304 IterPair<ConstPartInter2> pair( (ConstPartInter( diskPair())),
01305 (ConstPartInter( diskPair(), true )));
01306 return( typename ConstPartitionI<Pred>::type( typename ConstPartitionPI<Pred>::type(pair, p) ) );
01307 }
01308 template< class Pred > typename ConstPartitionI<Pred>::type partCondEnd( const Pred& p ) const
01309 {
01310 IterPair<ConstPartInter2> pair( (ConstPartInter( diskPair())),
01311 (ConstPartInter( diskPair(), true )));
01312 return( typename ConstPartitionI<Pred>::type( typename ConstPartitionPI<Pred>::type(pair, p, true )) );
01313 }
01314
01315
01316 protected:
01317
01318 typedef ListListIterator<Container::ConstPlainIterator, ConstLvmVgIterator> ConstLvmLvInter;
01319 typedef CastIterator<ConstLvmLvInter, LvmLv *> ConstLvmLvInter2;
01320 template< class Pred >
01321 struct ConstLvmLvPI { typedef ContainerIter<Pred, ConstLvmLvInter2> type; };
01322 typedef CheckFnc<const LvmLv> CheckFncLvmLv;
01323 typedef CheckerIterator< CheckFncLvmLv, ConstLvmLvPI<CheckFncLvmLv>::type,
01324 ConstLvmLvInter2, LvmLv > ConstLvmLvPIterator;
01325 public:
01326
01327 template< class Pred >
01328 struct ConstLvmLvI
01329 { typedef ContainerDerIter<Pred, typename ConstLvmLvPI<Pred>::type,
01330 const LvmLv> type; };
01331 template< class Pred >
01332 struct LvmLvCondIPair
01333 { typedef MakeCondIterPair<Pred, typename ConstLvmLvI<Pred>::type> type;};
01334 typedef DerefIterator<ConstLvmLvPIterator, const LvmLv> ConstLvmLvIterator;
01335 typedef IterPair<ConstLvmLvIterator> ConstLvmLvPair;
01336
01337
01338 ConstLvmLvPair lvmLvPair( bool (* CheckLvmVg)( const LvmVg& )) const
01339 {
01340 return( ConstLvmLvPair( lvmLvBegin( CheckLvmVg ), lvmLvEnd( CheckLvmVg ) ));
01341 }
01342 ConstLvmLvPair lvmLvPair( bool (* CheckLvmLv)( const LvmLv& )=NULL,
01343 bool (* CheckLvmVg)( const LvmVg& )=NULL) const
01344 {
01345 return( ConstLvmLvPair( lvmLvBegin( CheckLvmLv, CheckLvmVg ),
01346 lvmLvEnd( CheckLvmLv, CheckLvmVg ) ));
01347 }
01348 ConstLvmLvIterator lvmLvBegin( bool (* CheckLvmVg)( const LvmVg& )) const
01349 {
01350 return( lvmLvBegin( NULL, CheckLvmVg ) );
01351 }
01352 ConstLvmLvIterator lvmLvBegin( bool (* CheckLvmLv)( const LvmLv& )=NULL,
01353 bool (* CheckLvmVg)( const LvmVg& )=NULL) const
01354 {
01355 IterPair<ConstLvmLvInter2> p( (ConstLvmLvInter(lvmVgPair( CheckLvmVg ))),
01356 (ConstLvmLvInter(lvmVgPair( CheckLvmVg ), true )));
01357 return( ConstLvmLvIterator( ConstLvmLvPIterator(p, CheckLvmLv )));
01358 }
01359 ConstLvmLvIterator lvmLvEnd( bool (* CheckLvmVg)( const LvmVg& )) const
01360 {
01361 return( lvmLvEnd( NULL, CheckLvmVg ) );
01362 }
01363 ConstLvmLvIterator lvmLvEnd( bool (* CheckLvmLv)( const LvmLv& )=NULL,
01364 bool (* CheckLvmVg)( const LvmVg& )=NULL) const
01365 {
01366 IterPair<ConstLvmLvInter2> p( (ConstLvmLvInter(lvmVgPair( CheckLvmVg ))),
01367 (ConstLvmLvInter(lvmVgPair( CheckLvmVg ), true )));
01368 return( ConstLvmLvIterator( ConstLvmLvPIterator(p, CheckLvmLv, true )));
01369 }
01370 template< class Pred > typename LvmLvCondIPair<Pred>::type lvmLvCondPair( const Pred& p ) const
01371 {
01372 return( typename LvmLvCondIPair<Pred>::type( lvmLvCondBegin( p ), lvmLvCondEnd( p ) ) );
01373 }
01374 template< class Pred > typename ConstLvmLvI<Pred>::type lvmLvCondBegin( const Pred& p ) const
01375 {
01376 IterPair<ConstLvmLvInter2> pair( (ConstLvmLvInter( lvmVgPair())),
01377 (ConstLvmLvInter( lvmVgPair(), true )));
01378 return( typename ConstLvmLvI<Pred>::type( typename ConstLvmLvPI<Pred>::type(pair, p) ) );
01379 }
01380 template< class Pred > typename ConstLvmLvI<Pred>::type lvmLvCondEnd( const Pred& p ) const
01381 {
01382 IterPair<ConstLvmLvInter2> pair( (ConstLvmLvInter( lvmVgPair())),
01383 (ConstLvmLvInter( lvmVgPair(), true )));
01384 return( typename ConstLvmLvI<Pred>::type( typename ConstLvmLvPI<Pred>::type(pair, p, true )) );
01385 }
01386
01387
01388 protected:
01389
01390 typedef CastIterator<ConstVolInter, Md *> ConstMdInter;
01391 template< class Pred >
01392 struct ConstMdPI { typedef ContainerIter<Pred,
01393 ConstMdInter> type; };
01394 typedef CheckFnc<const Md> CheckFncMd;
01395 typedef CheckerIterator< CheckFncMd, ConstMdPI<CheckFncMd>::type,
01396 ConstMdInter, Md > ConstMdPIterator;
01397 public:
01398
01399 template< class Pred >
01400 struct ConstMdI
01401 { typedef ContainerDerIter<Pred, typename ConstMdPI<Pred>::type,
01402 const Md> type; };
01403 template< class Pred >
01404 struct MdCondIPair
01405 { typedef MakeCondIterPair<Pred, typename ConstMdI<Pred>::type> type;};
01406 typedef DerefIterator<ConstMdPIterator, const Md> ConstMdIterator;
01407 typedef IterPair<ConstMdIterator> ConstMdPair;
01408
01409
01410 ConstMdPair mdPair( bool (* CheckMd)( const Md& )=NULL ) const
01411 {
01412 return( ConstMdPair( mdBegin( CheckMd ), mdEnd( CheckMd ) ));
01413 }
01414 ConstMdIterator mdBegin( bool (* CheckMd)( const Md& )=NULL ) const
01415 {
01416 ConstVolInter b( contPair( isMd ) );
01417 ConstVolInter e( contPair( isMd ), true );
01418 IterPair<ConstMdInter> p( (ConstMdInter(b)), (ConstMdInter(e)) );
01419 return( ConstMdIterator( ConstMdPIterator(p, CheckMd )));
01420 }
01421 ConstMdIterator mdEnd( bool (* CheckMd)( const Md& )=NULL ) const
01422 {
01423 ConstVolInter b( contPair( isMd ) );
01424 ConstVolInter e( contPair( isMd ), true );
01425 IterPair<ConstMdInter> p( (ConstMdInter(b)), (ConstMdInter(e)) );
01426 return( ConstMdIterator( ConstMdPIterator(p, CheckMd, true )));
01427 }
01428 template< class Pred > typename MdCondIPair<Pred>::type mdCondPair( const Pred& p ) const
01429 {
01430 return( typename MdCondIPair<Pred>::type( mdCondBegin( p ), mdCondEnd( p ) ) );
01431 }
01432 template< class Pred > typename ConstMdI<Pred>::type mdCondBegin( const Pred& p ) const
01433 {
01434 ConstVolInter b( contPair( isMd ) );
01435 ConstVolInter e( contPair( isMd ), true );
01436 IterPair<ConstMdInter> pair( (ConstMdInter(b)), (ConstMdInter(e)) );
01437 return( typename ConstMdI<Pred>::type( typename ConstMdPI<Pred>::type(pair, p) ) );
01438 }
01439 template< class Pred > typename ConstMdI<Pred>::type mdCondEnd( const Pred& p ) const
01440 {
01441 ConstVolInter b( contPair( isMd ) );
01442 ConstVolInter e( contPair( isMd ), true );
01443 IterPair<ConstMdInter> pair( (ConstMdInter(b)), (ConstMdInter(e)) );
01444 return( typename ConstMdI<Pred>::type( typename ConstMdPI<Pred>::type(pair, p, true )) );
01445 }
01446
01448 protected:
01449
01450 typedef CastIterator<ConstVolInter, MdPart *> ConstMdPartInter;
01451 template< class Pred >
01452 struct ConstMdPartPI { typedef ContainerIter<Pred,
01453 ConstMdPartInter> type; };
01454 typedef CheckFnc<const MdPart> CheckFncMdPart;
01455 typedef CheckerIterator< CheckFncMdPart, ConstMdPartPI<CheckFncMdPart>::type,
01456 ConstMdPartInter, MdPart > ConstMdPartPIterator;
01457 public:
01458
01459 template< class Pred >
01460 struct ConstMdPartI
01461 { typedef ContainerDerIter<Pred, typename ConstMdPartPI<Pred>::type,
01462 const MdPart> type; };
01463 template< class Pred >
01464 struct MdPartCondIPair
01465 { typedef MakeCondIterPair<Pred, typename ConstMdPartI<Pred>::type> type;};
01466 typedef DerefIterator<ConstMdPartPIterator, const MdPart> ConstMdPartIterator;
01467 typedef IterPair<ConstMdPartIterator> ConstMdPartPair;
01468
01469
01470
01471 ConstMdPartPair mdPartPair( bool (* CheckMdPart)( const MdPart& )=NULL ) const
01472 {
01473 return( ConstMdPartPair( mdPartBegin( CheckMdPart ), mdPartEnd( CheckMdPart ) ));
01474 }
01475
01476 ConstMdPartIterator mdPartBegin( bool (* CheckMdPart)( const MdPart& )=NULL ) const
01477 {
01478 ConstVolInter b( contPair( isMdPart ) );
01479 ConstVolInter e( contPair( isMdPart ), true );
01480 IterPair<ConstMdPartInter> p( (ConstMdPartInter(b)), (ConstMdPartInter(e)) );
01481 return( ConstMdPartIterator( ConstMdPartPIterator(p, CheckMdPart )));
01482 }
01483 ConstMdPartIterator mdPartEnd( bool (* CheckMdPart)( const MdPart& )=NULL ) const
01484 {
01485 ConstVolInter b( contPair( isMdPart ) );
01486 ConstVolInter e( contPair( isMdPart ), true );
01487 IterPair<ConstMdPartInter> p( (ConstMdPartInter(b)), (ConstMdPartInter(e)) );
01488 return( ConstMdPartIterator( ConstMdPartPIterator(p, CheckMdPart, true )));
01489 }
01490 template< class Pred > typename MdPartCondIPair<Pred>::type mdPartCondPair( const Pred& p ) const
01491 {
01492 return( typename MdPartCondIPair<Pred>::type( mdPartCondBegin( p ), mdPartCondEnd( p ) ) );
01493 }
01494 template< class Pred > typename ConstMdPartI<Pred>::type mdPartCondBegin( const Pred& p ) const
01495 {
01496 ConstVolInter b( contPair( isMdPart ) );
01497 ConstVolInter e( contPair( isMdPart ), true );
01498 IterPair<ConstMdPartInter> pair( (ConstMdPartInter(b)), (ConstMdPartInter(e)) );
01499 return( typename ConstMdPartI<Pred>::type( typename ConstMdPartPI<Pred>::type(pair, p) ) );
01500 }
01501 template< class Pred > typename ConstMdPartI<Pred>::type mdPartCondEnd( const Pred& p ) const
01502 {
01503 ConstVolInter b( contPair( isMdPart ) );
01504 ConstVolInter e( contPair( isMdPart ), true );
01505 IterPair<ConstMdPartInter> pair( (ConstMdPartInter(b)), (ConstMdPartInter(e)) );
01506 return( typename ConstMdPartI<Pred>::type( typename ConstMdPartPI<Pred>::type(pair, p, true )) );
01507 }
01508
01509
01510
01511
01512
01513
01514 protected:
01515
01516 typedef CastIterator<ConstVolInter, Loop *> ConstLoopInter;
01517 template< class Pred >
01518 struct ConstLoopPI { typedef ContainerIter<Pred,
01519 ConstLoopInter> type; };
01520 typedef CheckFnc<const Loop> CheckFncLoop;
01521 typedef CheckerIterator< CheckFncLoop, ConstLoopPI<CheckFncLoop>::type,
01522 ConstLoopInter, Loop > ConstLoopPIterator;
01523 public:
01524
01525 template< class Pred >
01526 struct ConstLoopI
01527 { typedef ContainerDerIter<Pred, typename ConstLoopPI<Pred>::type,
01528 const Loop> type; };
01529 template< class Pred >
01530 struct LoopCondIPair
01531 { typedef MakeCondIterPair<Pred, typename ConstLoopI<Pred>::type> type;};
01532 typedef DerefIterator<ConstLoopPIterator, const Loop> ConstLoopIterator;
01533 typedef IterPair<ConstLoopIterator> ConstLoopPair;
01534
01535
01536 ConstLoopPair loopPair( bool (* CheckLoop)( const Loop& )=NULL ) const
01537 {
01538 return( ConstLoopPair( loopBegin( CheckLoop ), loopEnd( CheckLoop ) ));
01539 }
01540 ConstLoopIterator loopBegin( bool (* CheckLoop)( const Loop& )=NULL ) const
01541 {
01542 ConstVolInter b( contPair( isLoop ) );
01543 ConstVolInter e( contPair( isLoop ), true );
01544 IterPair<ConstLoopInter> p( (ConstLoopInter(b)), (ConstLoopInter(e)) );
01545 return( ConstLoopIterator( ConstLoopPIterator(p, CheckLoop )));
01546 }
01547 ConstLoopIterator loopEnd( bool (* CheckLoop)( const Loop& )=NULL ) const
01548 {
01549 ConstVolInter b( contPair( isLoop ) );
01550 ConstVolInter e( contPair( isLoop ), true );
01551 IterPair<ConstLoopInter> p( (ConstLoopInter(b)), (ConstLoopInter(e)) );
01552 return( ConstLoopIterator( ConstLoopPIterator(p, CheckLoop, true )));
01553 }
01554 template< class Pred > typename LoopCondIPair<Pred>::type loopCondPair( const Pred& p ) const
01555 {
01556 return( typename LoopCondIPair<Pred>::type( loopCondBegin( p ), loopCondEnd( p ) ) );
01557 }
01558 template< class Pred > typename ConstLoopI<Pred>::type loopCondBegin( const Pred& p ) const
01559 {
01560 ConstVolInter b( contPair( isLoop ) );
01561 ConstVolInter e( contPair( isLoop ), true );
01562 IterPair<ConstLoopInter> pair( (ConstLoopInter(b)), (ConstLoopInter(e)) );
01563 return( typename ConstLoopI<Pred>::type( typename ConstLoopPI<Pred>::type(pair, p) ) );
01564 }
01565 template< class Pred > typename ConstLoopI<Pred>::type loopCondEnd( const Pred& p ) const
01566 {
01567 ConstVolInter b( contPair( isLoop ) );
01568 ConstVolInter e( contPair( isLoop ), true );
01569 IterPair<ConstLoopInter> pair( (ConstLoopInter(b)), (ConstLoopInter(e)) );
01570 return( typename ConstLoopI<Pred>::type( typename ConstLoopPI<Pred>::type(pair, p, true )) );
01571 }
01572
01573
01574 protected:
01575
01576 typedef CastIterator<ConstVolInter, Nfs *> ConstNfsInter;
01577 template< class Pred >
01578 struct ConstNfsPI { typedef ContainerIter<Pred,
01579 ConstNfsInter> type; };
01580 typedef CheckFnc<const Nfs> CheckFncNfs;
01581 typedef CheckerIterator< CheckFncNfs, ConstNfsPI<CheckFncNfs>::type,
01582 ConstNfsInter, Nfs > ConstNfsPIterator;
01583 public:
01584
01585 template< class Pred >
01586 struct ConstNfsI
01587 { typedef ContainerDerIter<Pred, typename ConstNfsPI<Pred>::type,
01588 const Nfs> type; };
01589 template< class Pred >
01590 struct NfsCondIPair
01591 { typedef MakeCondIterPair<Pred, typename ConstNfsI<Pred>::type> type;};
01592 typedef DerefIterator<ConstNfsPIterator, const Nfs> ConstNfsIterator;
01593 typedef IterPair<ConstNfsIterator> ConstNfsPair;
01594
01595
01596 ConstNfsPair nfsPair( bool (* CheckNfs)( const Nfs& )=NULL ) const
01597 {
01598 return( ConstNfsPair( nfsBegin( CheckNfs ), nfsEnd( CheckNfs ) ));
01599 }
01600 ConstNfsIterator nfsBegin( bool (* CheckNfs)( const Nfs& )=NULL ) const
01601 {
01602 ConstVolInter b( contPair( isNfs ) );
01603 ConstVolInter e( contPair( isNfs ), true );
01604 IterPair<ConstNfsInter> p( (ConstNfsInter(b)), (ConstNfsInter(e)) );
01605 return( ConstNfsIterator( ConstNfsPIterator(p, CheckNfs )));
01606 }
01607 ConstNfsIterator nfsEnd( bool (* CheckNfs)( const Nfs& )=NULL ) const
01608 {
01609 ConstVolInter b( contPair( isNfs ) );
01610 ConstVolInter e( contPair( isNfs ), true );
01611 IterPair<ConstNfsInter> p( (ConstNfsInter(b)), (ConstNfsInter(e)) );
01612 return( ConstNfsIterator( ConstNfsPIterator(p, CheckNfs, true )));
01613 }
01614 template< class Pred > typename NfsCondIPair<Pred>::type nfsCondPair( const Pred& p ) const
01615 {
01616 return( typename NfsCondIPair<Pred>::type( nfsCondBegin( p ), nfsCondEnd( p ) ) );
01617 }
01618 template< class Pred > typename ConstNfsI<Pred>::type nfsCondBegin( const Pred& p ) const
01619 {
01620 ConstVolInter b( contPair( isNfs ) );
01621 ConstVolInter e( contPair( isNfs ), true );
01622 IterPair<ConstNfsInter> pair( (ConstNfsInter(b)), (ConstNfsInter(e)) );
01623 return( typename ConstNfsI<Pred>::type( typename ConstNfsPI<Pred>::type(pair, p) ) );
01624 }
01625 template< class Pred > typename ConstNfsI<Pred>::type nfsCondEnd( const Pred& p ) const
01626 {
01627 ConstVolInter b( contPair( isNfs ) );
01628 ConstVolInter e( contPair( isNfs ), true );
01629 IterPair<ConstNfsInter> pair( (ConstNfsInter(b)), (ConstNfsInter(e)) );
01630 return( typename ConstNfsI<Pred>::type( typename ConstNfsPI<Pred>::type(pair, p, true )) );
01631 }
01632
01633
01634 protected:
01635
01636 typedef CastIterator<ConstVolInter, Dm *> ConstDmInter;
01637 template< class Pred >
01638 struct ConstDmPI { typedef ContainerIter<Pred,
01639 ConstDmInter> type; };
01640 typedef CheckFnc<const Dm> CheckFncDm;
01641 typedef CheckerIterator< CheckFncDm, ConstDmPI<CheckFncDm>::type,
01642 ConstDmInter, Dm > ConstDmPIterator;
01643 public:
01644
01645 template< class Pred >
01646 struct ConstDmI
01647 { typedef ContainerDerIter<Pred, typename ConstDmPI<Pred>::type,
01648 const Dm> type; };
01649 template< class Pred >
01650 struct DmCondIPair
01651 { typedef MakeCondIterPair<Pred, typename ConstDmI<Pred>::type> type;};
01652 typedef DerefIterator<ConstDmPIterator, const Dm> ConstDmIterator;
01653 typedef IterPair<ConstDmIterator> ConstDmPair;
01654
01655
01656 ConstDmPair dmPair( bool (* CheckDm)( const Dm& )=NULL ) const
01657 {
01658 return( ConstDmPair( dmBegin( CheckDm ), dmEnd( CheckDm ) ));
01659 }
01660 ConstDmIterator dmBegin( bool (* CheckDm)( const Dm& )=NULL ) const
01661 {
01662 ConstVolInter b( contPair( isDm ) );
01663 ConstVolInter e( contPair( isDm ), true );
01664 IterPair<ConstDmInter> p( (ConstDmInter(b)), (ConstDmInter(e)) );
01665 return( ConstDmIterator( ConstDmPIterator(p, CheckDm )));
01666 }
01667 ConstDmIterator dmEnd( bool (* CheckDm)( const Dm& )=NULL ) const
01668 {
01669 ConstVolInter b( contPair( isDm ) );
01670 ConstVolInter e( contPair( isDm ), true );
01671 IterPair<ConstDmInter> p( (ConstDmInter(b)), (ConstDmInter(e)) );
01672 return( ConstDmIterator( ConstDmPIterator(p, CheckDm, true )));
01673 }
01674 template< class Pred > typename DmCondIPair<Pred>::type dmCondPair( const Pred& p ) const
01675 {
01676 return( typename DmCondIPair<Pred>::type( dmCondBegin( p ), dmCondEnd( p ) ) );
01677 }
01678 template< class Pred > typename ConstDmI<Pred>::type dmCondBegin( const Pred& p ) const
01679 {
01680 ConstVolInter b( contPair( isDm ) );
01681 ConstVolInter e( contPair( isDm ), true );
01682 IterPair<ConstDmInter> pair( (ConstDmInter(b)), (ConstDmInter(e)) );
01683 return( typename ConstDmI<Pred>::type( typename ConstDmPI<Pred>::type(pair, p) ) );
01684 }
01685 template< class Pred > typename ConstDmI<Pred>::type dmCondEnd( const Pred& p ) const
01686 {
01687 ConstVolInter b( contPair( isDm ) );
01688 ConstVolInter e( contPair( isDm ), true );
01689 IterPair<ConstDmInter> pair( (ConstDmInter(b)), (ConstDmInter(e)) );
01690 return( typename ConstDmI<Pred>::type( typename ConstDmPI<Pred>::type(pair, p, true )) );
01691 }
01692
01693
01694 protected:
01695
01696 typedef ListListIterator<Container::ConstPlainIterator, ConstDmraidCoIterator> ConstDmraidInter;
01697 typedef CastIterator<ConstDmraidInter, Dmraid *> ConstDmraidInter2;
01698 template< class Pred >
01699 struct ConstDmraidPI { typedef ContainerIter<Pred, ConstDmraidInter2> type; };
01700 typedef CheckFnc<const Dmraid> CheckFncDmraid;
01701 typedef CheckerIterator< CheckFncDmraid, ConstDmraidPI<CheckFncDmraid>::type,
01702 ConstDmraidInter2, Dmraid > ConstDmraidPIterator;
01703 public:
01704
01705 template< class Pred >
01706 struct ConstDmraidI
01707 { typedef ContainerDerIter<Pred, typename ConstDmraidPI<Pred>::type,
01708 const Dmraid> type; };
01709 template< class Pred >
01710 struct DmraidCondIPair
01711 { typedef MakeCondIterPair<Pred, typename ConstDmraidI<Pred>::type> type;};
01712 typedef DerefIterator<ConstDmraidPIterator, const Dmraid> ConstDmraidIterator;
01713 typedef IterPair<ConstDmraidIterator> ConstDmraidPair;
01714
01715
01716 ConstDmraidPair dmrPair( bool (* CheckDmraidCo)( const DmraidCo& )) const
01717 {
01718 return( ConstDmraidPair( dmrBegin( CheckDmraidCo ), dmrEnd( CheckDmraidCo ) ));
01719 }
01720 ConstDmraidPair dmrPair( bool (* CheckDmraid)( const Dmraid& )=NULL,
01721 bool (* CheckDmraidCo)( const DmraidCo& )=NULL) const
01722 {
01723 return( ConstDmraidPair( dmrBegin( CheckDmraid, CheckDmraidCo ),
01724 dmrEnd( CheckDmraid, CheckDmraidCo ) ));
01725 }
01726 ConstDmraidIterator dmrBegin( bool (* CheckDmraidCo)( const DmraidCo& )) const
01727 {
01728 return( dmrBegin( NULL, CheckDmraidCo ) );
01729 }
01730 ConstDmraidIterator dmrBegin( bool (* CheckDmraid)( const Dmraid& )=NULL,
01731 bool (* CheckDmraidCo)( const DmraidCo& )=NULL) const
01732 {
01733 IterPair<ConstDmraidInter2> p( (ConstDmraidInter(dmraidCoPair( CheckDmraidCo ))),
01734 (ConstDmraidInter(dmraidCoPair( CheckDmraidCo ), true )));
01735 return( ConstDmraidIterator( ConstDmraidPIterator(p, CheckDmraid )));
01736 }
01737 ConstDmraidIterator dmrEnd( bool (* CheckDmraidCo)( const DmraidCo& )) const
01738 {
01739 return( dmrEnd( NULL, CheckDmraidCo ) );
01740 }
01741 ConstDmraidIterator dmrEnd( bool (* CheckDmraid)( const Dmraid& )=NULL,
01742 bool (* CheckDmraidCo)( const DmraidCo& )=NULL) const
01743 {
01744 IterPair<ConstDmraidInter2> p( (ConstDmraidInter(dmraidCoPair( CheckDmraidCo ))),
01745 (ConstDmraidInter(dmraidCoPair( CheckDmraidCo ), true )));
01746 return( ConstDmraidIterator( ConstDmraidPIterator(p, CheckDmraid, true )));
01747 }
01748 template< class Pred > typename DmraidCondIPair<Pred>::type dmrCondPair( const Pred& p ) const
01749 {
01750 return( typename DmraidCondIPair<Pred>::type( dmrCondBegin( p ), dmrCondEnd( p ) ) );
01751 }
01752 template< class Pred > typename ConstDmraidI<Pred>::type dmrCondBegin( const Pred& p ) const
01753 {
01754 IterPair<ConstDmraidInter2> pair( (ConstDmraidInter( dmraidCoPair())),
01755 (ConstDmraidInter( dmraidCoPair(), true )));
01756 return( typename ConstDmraidI<Pred>::type( typename ConstDmraidPI<Pred>::type(pair, p) ) );
01757 }
01758 template< class Pred > typename ConstDmraidI<Pred>::type dmrCondEnd( const Pred& p ) const
01759 {
01760 IterPair<ConstDmraidInter2> pair( (ConstDmraidInter( dmrCoPair())),
01761 (ConstDmraidInter( dmrCoPair(), true )));
01762 return( typename ConstDmraidI<Pred>::type( typename ConstDmraidPI<Pred>::type(pair, p, true )) );
01763 }
01764
01765
01766
01767 protected:
01768
01769 typedef ListListIterator<Container::ConstPlainIterator, ConstDmmultipathCoIterator> ConstDmmultipathInter;
01770 typedef CastIterator<ConstDmmultipathInter, Dmmultipath *> ConstDmmultipathInter2;
01771 template< class Pred >
01772 struct ConstDmmultipathPI { typedef ContainerIter<Pred, ConstDmmultipathInter2> type; };
01773 typedef CheckFnc<const Dmmultipath> CheckFncDmmultipath;
01774 typedef CheckerIterator< CheckFncDmmultipath, ConstDmmultipathPI<CheckFncDmmultipath>::type,
01775 ConstDmmultipathInter2, Dmmultipath > ConstDmmultipathPIterator;
01776 public:
01777
01778 template< class Pred >
01779 struct ConstDmmultipathI
01780 { typedef ContainerDerIter<Pred, typename ConstDmmultipathPI<Pred>::type,
01781 const Dmmultipath> type; };
01782 template< class Pred >
01783 struct DmmultipathCondIPair
01784 { typedef MakeCondIterPair<Pred, typename ConstDmmultipathI<Pred>::type> type; };
01785 typedef DerefIterator<ConstDmmultipathPIterator, const Dmmultipath> ConstDmmultipathIterator;
01786 typedef IterPair<ConstDmmultipathIterator> ConstDmmultipathPair;
01787
01788
01789 ConstDmmultipathPair dmmPair( bool (* CheckDmmultipathCo)( const DmmultipathCo& )) const
01790 {
01791 return( ConstDmmultipathPair( dmmBegin( CheckDmmultipathCo ), dmmEnd( CheckDmmultipathCo ) ));
01792 }
01793 ConstDmmultipathPair dmmPair( bool (* CheckDmmultipath)( const Dmmultipath& )=NULL,
01794 bool (* CheckDmmultipathCo)( const DmmultipathCo& )=NULL) const
01795 {
01796 return( ConstDmmultipathPair( dmmBegin( CheckDmmultipath, CheckDmmultipathCo ),
01797 dmmEnd( CheckDmmultipath, CheckDmmultipathCo ) ));
01798 }
01799 ConstDmmultipathIterator dmmBegin( bool (* CheckDmmultipathCo)( const DmmultipathCo& )) const
01800 {
01801 return( dmmBegin( NULL, CheckDmmultipathCo ) );
01802 }
01803 ConstDmmultipathIterator dmmBegin( bool (* CheckDmmultipath)( const Dmmultipath& )=NULL,
01804 bool (* CheckDmmultipathCo)( const DmmultipathCo& )=NULL) const
01805 {
01806 IterPair<ConstDmmultipathInter2> p( (ConstDmmultipathInter(dmmultipathCoPair( CheckDmmultipathCo ))),
01807 (ConstDmmultipathInter(dmmultipathCoPair( CheckDmmultipathCo ), true )));
01808 return( ConstDmmultipathIterator( ConstDmmultipathPIterator(p, CheckDmmultipath )));
01809 }
01810 ConstDmmultipathIterator dmmEnd( bool (* CheckDmmultipathCo)( const DmmultipathCo& )) const
01811 {
01812 return( dmmEnd( NULL, CheckDmmultipathCo ) );
01813 }
01814 ConstDmmultipathIterator dmmEnd( bool (* CheckDmmultipath)( const Dmmultipath& )=NULL,
01815 bool (* CheckDmmultipathCo)( const DmmultipathCo& )=NULL) const
01816 {
01817 IterPair<ConstDmmultipathInter2> p( (ConstDmmultipathInter(dmmultipathCoPair( CheckDmmultipathCo ))),
01818 (ConstDmmultipathInter(dmmultipathCoPair( CheckDmmultipathCo ), true )));
01819 return( ConstDmmultipathIterator( ConstDmmultipathPIterator(p, CheckDmmultipath, true )));
01820 }
01821 template< class Pred > typename DmmultipathCondIPair<Pred>::type dmmCondPair( const Pred& p ) const
01822 {
01823 return( typename DmmultipathCondIPair<Pred>::type( dmmCondBegin( p ), dmmCondEnd( p ) ) );
01824 }
01825 template< class Pred > typename ConstDmmultipathI<Pred>::type dmmCondBegin( const Pred& p ) const
01826 {
01827 IterPair<ConstDmmultipathInter2> pair( (ConstDmmultipathInter( dmmultipathCoPair())),
01828 (ConstDmmultipathInter( dmmultipathCoPair(), true )));
01829 return( typename ConstDmmultipathI<Pred>::type( typename ConstDmmultipathPI<Pred>::type(pair, p) ) );
01830 }
01831 template< class Pred > typename ConstDmmultipathI<Pred>::type dmmCondEnd( const Pred& p ) const
01832 {
01833 IterPair<ConstDmmultipathInter2> pair( (ConstDmmultipathInter( dmmCoPair())),
01834 (ConstDmmultipathInter( dmmCoPair(), true )));
01835 return( typename ConstDmmultipathI<Pred>::type( typename ConstDmmultipathPI<Pred>::type(pair, p, true )) );
01836 }
01837
01838
01839 protected:
01840
01841 void initialize();
01842 void logSystemInfo() const;
01843 void detectDisks( ProcPart& ppart );
01844 void autodetectDisks( ProcPart& ppart );
01845 void detectMultipath();
01846 void detectMds();
01847 void detectMdParts(ProcPart& ppart);
01848
01849
01850 bool discoverMdPVols();
01851 void detectLoops( ProcPart& ppart );
01852 void detectNfs( ProcMounts& mounts );
01853 void detectLvmVgs();
01854 void detectDmraid( ProcPart& ppart );
01855 void detectDmmultipath( ProcPart& ppart );
01856 void detectDm(ProcPart& ppart, bool only_crypt);
01857 void initDisk( list<DiskData>& dl, ProcPart& pp );
01858 void detectFsData( const VolIterator& begin, const VolIterator& end,
01859 ProcMounts& mounts );
01860 void detectFsDataTestMode( const string& file,
01861 const VolIterator& begin,
01862 const VolIterator& end );
01863 int resizeVolume( const string& device, unsigned long long newSizeMb,
01864 bool ignore_fs );
01865 int resizePartition( const string& device, unsigned long sizeCyl,
01866 bool ignore_fs );
01867 static void detectArch();
01868 void addToList( Container* e )
01869 { pointerIntoSortedList<Container>( cont, e ); }
01870 DiskIterator findDisk( const string& disk );
01871 DiskIterator findDiskId( const string& id );
01872 DiskIterator findDiskPath( const string& path );
01873 LvmVgIterator findLvmVg( const string& name );
01874 DmraidCoIterator findDmraidCo( const string& name );
01875 DmmultipathCoIterator findDmmultipathCo( const string& name );
01876 DmPartCoIterator findDmPartCo( const string& name );
01877
01878 MdPartCoIterator findMdPartCo( const string& name );
01879
01880 bool findVolume( const string& device, ContIterator& c,
01881 VolIterator& v );
01882 bool findVolume( const string& device, VolIterator& v,
01883 bool also_del=false );
01884 bool findContainer( const string& device, ContIterator& c );
01885
01886 void checkPwdBuf( const string& device );
01887 bool haveMd( MdCo*& md );
01888 int getMdPartMdNums(list<int>& mdPartNums);
01889 bool haveDm(DmCo*& dm);
01890 bool haveNfs( NfsCo*& co );
01891 bool haveLoop( LoopCo*& loop );
01892 int removeContainer( Container* val, bool call_del=true );
01893 void logVolumes( const string& Dir );
01894 int commitPair( CPair& p, bool (* fnc)( const Container& ) );
01895 void sortCommitLists( storage::CommitStage stage,
01896 std::list<Container*>& co,
01897 std::list<Volume*>& vl,
01898 std::list<storage::commitAction*>& todo );
01899 bool ignoreError( std::list<commitAction*>::iterator i,
01900 std::list<commitAction*>& al );
01901 string backupStates() const;
01902 void detectObjects();
01903 void deleteClist( CCont& co );
01904 void deleteBackups();
01905 void setFreeInfo( const string& device, unsigned long long df_free,
01906 unsigned long long resize_free,
01907 unsigned long long used, bool win, bool efi,
01908 bool resize_ok );
01909 bool getFreeInf( const string& device, unsigned long long& df_free,
01910 unsigned long long& resize_free,
01911 unsigned long long& used, bool& win, bool& efi,
01912 bool& resize_ok );
01913
01914
01915 const Environment env;
01916 Lock lock;
01917 bool cache;
01918 bool initialized;
01919 bool recursiveRemove;
01920 bool zeroNewPartitions;
01921 MountByType defaultMountBy;
01922 bool detectMounted;
01923 bool root_mounted;
01924 string tempdir;
01925 string rootprefix;
01926 unsigned hald_pid;
01927 bool efiboot;
01928 static string proc_arch;
01929 static bool is_ppc_mac;
01930 static bool is_ppc_pegasos;
01931 CCont cont;
01932 EtcFstab *fstab;
01933 EtcRaidtab *raidtab;
01934
01935 ImsmDriver imsm_driver;
01936
01937 CallbackProgressBar progress_bar_cb;
01938 CallbackShowInstallInfo install_info_cb;
01939 CallbackInfoPopup info_popup_cb;
01940 CallbackYesNoPopup yesno_popup_cb;
01941 CallbackPasswordPopup password_popup_cb;
01942
01943 friend std::ostream& operator<< (std::ostream& s, Storage &v );
01944
01945 unsigned max_log_num;
01946 string lastAction;
01947 string extendedError;
01948 std::map<string,CCont> backups;
01949 std::map<string,FreeInfo> freeInfo;
01950 std::map<string,string> pwdBuf;
01951 std::list<std::pair<string,string> > infoPopupTxts;
01952 };
01953
01954 inline std::ostream& operator<< (std::ostream& s, commitAction &a )
01955 {
01956 s << "stage:" << a.stage
01957 << " type:" << a.type
01958 << " cont:" << a.container
01959 << " dest:" << a.destructive;
01960 if( a.container && a.co() )
01961 s << " name:" << a.co()->name();
01962 else if( a.vol() )
01963 s << " name:" << a.vol()->name();
01964 if( !a.descr.empty() )
01965 s << " desc:" << a.descr;
01966 return( s );
01967 };
01968
01969 }
01970
01971 #endif