yast2-storage

DmPart.h

Go to the documentation of this file.
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 "storage/Dm.h"
00027 #include "storage/Partition.h"
00028 
00029 namespace storage
00030 {
00031 
00032 class DmPartCo;
00033     class ProcParts;
00034 
00035 
00036 class DmPart : public Dm
00037     {
00038     public:
00039 
00040         DmPart(const DmPartCo& c, const string& name, const string& device, unsigned nr,
00041                Partition* p, SystemInfo& si);
00042         DmPart(const DmPartCo& c, const string& name, const string& device, unsigned nr,
00043                Partition* p);
00044         DmPart(const DmPartCo& c, const DmPart& v);
00045         virtual ~DmPart();
00046 
00047         friend std::ostream& operator<< (std::ostream& s, const DmPart &p );
00048         virtual void print( std::ostream& s ) const { s << *this; }
00049         void getInfo( storage::DmPartInfo& info ) const;
00050         bool equalContent( const DmPart& rhs ) const;
00051 
00052         void logDifference(std::ostream& log, const DmPart& 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& parts);
00060         void updateSize();
00061         void getCommitActions(list<commitAction>& l) const;
00062         void addUdevData();
00063         virtual list<string> getUsing() const;
00064         virtual list<string> udevId() const;
00065         virtual Text setTypeText(bool doing) const;
00066         static bool notDeleted( const DmPart& l ) { return( !l.deleted() ); }
00067 
00068     protected:
00069 
00070         virtual const string shortPrintedName() const { return( "DmPart" ); }
00071         const DmPartCo* co() const; 
00072         void addAltUdevId( unsigned num );
00073         Partition* p;
00074 
00075         mutable storage::DmPartInfo info; // workaround for broken ycp bindings
00076 
00077     private:
00078 
00079         DmPart(const DmPart&);            // disallow
00080         DmPart& operator=(const DmPart&); // disallow
00081 
00082     };
00083 
00084 }
00085 
00086 #endif