00001 /* 00002 * Copyright (c) [2004-2009] Novell, Inc. 00003 * 00004 * All Rights Reserved. 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of version 2 of the GNU General Public License as published 00008 * by the Free Software Foundation. 00009 * 00010 * This program is distributed in the hope that it will be useful, but WITHOUT 00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00013 * more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, contact Novell, Inc. 00017 * 00018 * To contact Novell about this file by physical or electronic mail, you may 00019 * find current contact information at www.novell.com. 00020 */ 00021 00022 00023 #ifndef DM_PART_H 00024 #define DM_PART_H 00025 00026 #include "y2storage/Dm.h" 00027 #include "y2storage/Partition.h" 00028 00029 namespace storage 00030 { 00031 00032 class DmPartCo; 00033 class ProcPart; 00034 00035 class DmPart : public Dm 00036 { 00037 public: 00038 DmPart( const DmPartCo& d, unsigned nr, Partition* p=NULL ); 00039 DmPart( const DmPartCo& d, const DmPart& rd ); 00040 DmPart& operator=( const DmPart& ); 00041 00042 virtual ~DmPart(); 00043 friend std::ostream& operator<< (std::ostream& s, const DmPart &p ); 00044 virtual void print( std::ostream& s ) const { s << *this; } 00045 void getInfo( storage::DmPartInfo& info ) const; 00046 bool equalContent( const DmPart& rhs ) const; 00047 void logDifference( const DmPart& d ) const; 00048 void setPtr( Partition* pa ) { p=pa; }; 00049 Partition* getPtr() const { return p; }; 00050 unsigned id() const { return p?p->id():0; } 00051 void updateName(); 00052 void updateMinor(); 00053 void updateSize( ProcPart& pp ); 00054 void updateSize(); 00055 void getCommitActions( std::list<storage::commitAction*>& l ) const; 00056 void addUdevData(); 00057 virtual const std::list<string> udevId() const; 00058 virtual string setTypeText( bool doing=true ) const; 00059 static bool notDeleted( const DmPart& l ) { return( !l.deleted() ); } 00060 00061 protected: 00062 void init( const string& name ); 00063 void dataFromPart( const Partition* p ); 00064 virtual const string shortPrintedName() const { return( "DmPart" ); } 00065 const DmPartCo* co() const; 00066 void addAltUdevId( unsigned num ); 00067 Partition* p; 00068 00069 mutable storage::DmPartInfo info; 00070 }; 00071 00072 } 00073 00074 #endif
1.5.6