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