00001 /* 00002 * File: MdPart.h 00003 * 00004 * Declaration of MdPart class which represents single partition on MD 00005 * Device (RAID Volume). 00006 * 00007 * Copyright (c) 2009, Intel Corporation. 00008 * Copyright (c) 2009 Novell, Inc. 00009 * 00010 * This program is free software; you can redistribute it and/or modify it 00011 * under the terms and conditions of the GNU General Public License, 00012 * version 2, as published by the Free Software Foundation. 00013 * 00014 * This program is distributed in the hope it will be useful, but WITHOUT 00015 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00016 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00017 * more details. 00018 * 00019 * You should have received a copy of the GNU General Public License along with 00020 * this program; if not, write to the Free Software Foundation, Inc., 00021 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 00022 */ 00023 00024 #ifndef MD_PART_H 00025 #define MD_PART_H 00026 00027 00028 #include "storage/Partition.h" 00029 00030 00031 namespace storage 00032 { 00033 00034 class MdPartCo; 00035 class ProcParts; 00036 00037 class MdPart : public Volume 00038 { 00039 public: 00040 00041 MdPart(const MdPartCo& c, const string& name, const string& device, unsigned nr, 00042 Partition* p); 00043 MdPart(const MdPartCo& c, const MdPart& v); 00044 virtual ~MdPart(); 00045 00046 friend std::ostream& operator<< (std::ostream& s, const MdPart &p ); 00047 virtual void print( std::ostream& s ) const { s << *this; } 00048 void getInfo( storage::MdPartInfo& info ) const; 00049 00050 bool equalContent( const MdPart& rhs ) const; 00051 00052 void logDifference(std::ostream& log, const MdPart& rhs) const; 00053 00054 void setPtr( Partition* pa ) { p=pa; }; 00055 Partition* getPtr() const { return p; }; 00056 unsigned id() const { return p?p->id():0; } 00057 void updateName(); 00058 void updateMinor(); 00059 void updateSize(const ProcParts& pp); 00060 void updateSize(); 00061 void getCommitActions(list<commitAction>& l) const; 00062 void addUdevData(); 00063 virtual list<string> udevId() const; 00064 00065 virtual Text setTypeText(bool doing) const; 00066 00067 static bool notDeleted( const MdPart& l ) { return( !l.deleted() ); } 00068 00069 virtual string procName() const { return nm; } 00070 virtual string sysfsPath() const; 00071 00072 virtual list<string> getUsing() const; 00073 00074 protected: 00075 00076 const MdPartCo* co() const; 00077 void addAltUdevId( unsigned num ); 00078 Partition* p; 00079 00080 mutable storage::MdPartInfo info; // workaround for broken ycp bindings 00081 00082 private: 00083 00084 MdPart(const MdPart&); // disallow 00085 MdPart& operator=(const MdPart&); // disallow 00086 00087 }; 00088 00089 } 00090 00091 #endif
1.5.6