Partition.h

Go to the documentation of this file.
00001 #ifndef PARTITION_H
00002 #define PARTITION_H
00003 
00004 #include "y2storage/StorageInterface.h"
00005 #include "y2storage/Volume.h"
00006 #include "y2storage/Region.h"
00007 
00008 namespace storage
00009 {
00010 
00011 class Disk;
00012 
00013 class Partition : public Volume
00014     {
00015     public:
00016 
00017         typedef enum { ID_DOS16=0x6, ID_DOS=0x0c, ID_NTFS=0x07,
00018                        ID_EXTENDED=0x0f,
00019                        ID_LINUX=0x83, ID_SWAP=0x82, ID_LVM=0x8e, ID_RAID=0xfd,
00020                        ID_APPLE_OTHER=0x101, ID_APPLE_HFS=0x102,
00021                        ID_GPT_BOOT=0x103, ID_GPT_SERVICE=0x104,
00022                        ID_GPT_MSFTRES=0x105, ID_APPLE_UFS=0x106 } IdNum;
00023 
00024         Partition( const Disk& d, unsigned Pnr, unsigned long long SizeK,
00025                    unsigned long Start, unsigned long CSize,
00026                    storage::PartitionType Type, 
00027                    unsigned id=ID_LINUX, bool Boot=false );
00028         Partition( const Disk& d, const string& Data );
00029         Partition( const Disk& d, const Partition& p );
00030         virtual ~Partition();
00031 
00032         unsigned long cylStart() const { return reg.start(); }
00033         unsigned long cylSize() const { return reg.len(); }
00034         unsigned long cylEnd() const { return reg.start()+reg.len()-1; }
00035         const Region& region() const { return reg; }
00036         const std::list<string> udevId() const;
00037         const string& udevPath() const;
00038         string sysfsPath() const;
00039         bool intersectArea( const Region& r, unsigned fuzz=0 ) const;
00040         bool contains( const Region& r, unsigned fuzz=0 ) const;
00041         unsigned OrigNr() const { return( orig_num ); }
00042         bool boot() const { return bootflag; }
00043         unsigned id() const { return idt; }
00044         storage::PartitionType type() const { return typ; }
00045         std::ostream& logData( std::ostream& file ) const;
00046         void changeRegion( unsigned long Start, unsigned long CSize,
00047                            unsigned long long SizeK );
00048         void changeNumber( unsigned new_num );
00049         void changeId( unsigned id );
00050         void changeIdDone();
00051         void unChangeId();
00052         string removeText( bool doing=true ) const;
00053         string createText( bool doing=true ) const;
00054         string formatText(bool doing=true) const;
00055         string resizeText(bool doing=true) const;
00056         void getCommitActions( std::list<storage::commitAction*>& l ) const;
00057         string setTypeText( bool doing=true ) const;
00058         int setFormat( bool format=true, storage::FsType fs=storage::REISERFS );
00059         int changeMount( const string& val );
00060         const Disk* const disk() const;
00061         bool isWindows() const;
00062         friend std::ostream& operator<< (std::ostream& s, const Partition &p );
00063         static bool notDeleted( const Partition&d ) { return( !d.deleted() ); }
00064         static bool toChangeId( const Partition&d ) { return( !d.deleted() && d.idt!=d.orig_id ); }
00065         virtual void print( std::ostream& s ) const { s << *this; }
00066         void setResizedSize( unsigned long long SizeK );
00067         void forgetResize(); 
00068         bool canUseDevice() const;
00069 
00070         void getInfo( storage::PartitionInfo& info ) const;
00071         bool equalContent( const Partition& rhs ) const;
00072         void logDifference( const Partition& d ) const;
00073         void addUdevData();
00074 
00075     protected:
00076         Partition& operator=( const Partition& );
00077 
00078         Region reg;
00079         bool bootflag;
00080         storage::PartitionType typ;
00081         unsigned idt;
00082         unsigned orig_id;
00083         string parted_start;
00084         unsigned orig_num;
00085 
00086         void addAltUdevId( unsigned num );
00087         void addAltUdevPath( unsigned num );
00088         static string pt_names[storage::PTYPE_ANY+1];
00089         mutable storage::PartitionInfo info;
00090     };
00091 
00092 }
00093 
00094 #endif

Generated on Thu Jul 6 00:40:24 2006 for yast2-storage by  doxygen 1.4.6