00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef DASD_H
00024 #define DASD_H
00025
00026 #include "y2storage/Disk.h"
00027
00028 namespace storage
00029 {
00030
00031 class SystemCmd;
00032 class ProcPart;
00033
00034 class Dasd : public Disk
00035 {
00036 friend class Storage;
00037 public:
00038 Dasd( Storage * const s, const string& Name, unsigned long long Size );
00039 Dasd( const Dasd& rhs );
00040 virtual ~Dasd();
00041 int createPartition( storage::PartitionType type, long unsigned start,
00042 long unsigned len, string& device,
00043 bool checkRelaxed=false );
00044 int removePartition( unsigned nr );
00045 int changePartitionId( unsigned nr, unsigned id ) { return 0; }
00046 int resizePartition( Partition* p, unsigned long newCyl );
00047 int initializeDisk( bool value );
00048 string fdasdText() const;
00049 string dasdfmtText( bool doing ) const;
00050 static string dasdfmtTexts( bool single, const string& devs );
00051 void getCommitActions( std::list<storage::commitAction*>& l ) const;
00052 int getToCommit( storage::CommitStage stage, std::list<Container*>& col,
00053 std::list<Volume*>& vol );
00054 int commitChanges( storage::CommitStage stage );
00055 bool detectGeometry();
00056
00057 protected:
00058 enum DasdFormat { DASDF_NONE, DASDF_LDL, DASDF_CDL };
00059
00060 virtual void print( std::ostream& s ) const { s << *this; }
00061 virtual Container* getCopy() const { return( new Dasd( *this ) ); }
00062 bool detectPartitionsFdasd(ProcPart& ppart);
00063 bool detectPartitions( ProcPart& ppart );
00064 bool checkFdasdOutput( SystemCmd& Cmd, ProcPart& ppart );
00065 bool scanFdasdLine( const string& Line, unsigned& nr,
00066 unsigned long& start, unsigned long& csize );
00067 void getGeometry( SystemCmd& cmd, unsigned long& c,
00068 unsigned& h, unsigned& s );
00069 void redetectGeometry() {};
00070 int doCreate( Volume* v ) { return(doFdasd()); }
00071 int doRemove( Volume* v ) { return(init_disk?0:doFdasd()); }
00072 int doFdasd();
00073 int doResize( Volume* v );
00074 int doSetType( Volume* v ) { return 0; }
00075 int doCreateLabel() { return 0; }
00076 int doDasdfmt();
00077 DasdFormat fmt;
00078
00079 Dasd& operator= ( const Dasd& rhs );
00080 friend std::ostream& operator<< (std::ostream&, const Dasd& );
00081
00082 };
00083
00084 }
00085
00086 #endif