yast2-storage

Dasd.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) [2004-2010] 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 DASD_H
00024 #define DASD_H
00025 
00026 #include "storage/Disk.h"
00027 
00028 
00029 namespace storage
00030 {
00031     using std::list;
00032 
00033 
00034     class ProcParts;
00035 
00036 
00037 class Dasd : public Disk
00038     {
00039     friend class Storage;
00040 
00041     public:
00042 
00043         enum DasdFormat { DASDF_NONE, DASDF_LDL, DASDF_CDL };
00044         enum DasdType { DASDTYPE_NONE, DASDTYPE_ECKD, DASDTYPE_FBA };
00045 
00046         Dasd(Storage* s, const string& name, const string& device, unsigned long long Size,
00047              SystemInfo& systeminfo);
00048         Dasd(const Dasd& c);
00049         virtual ~Dasd();
00050 
00051         int createPartition( storage::PartitionType type, long unsigned start,
00052                              long unsigned len, string& device,
00053                              bool checkRelaxed=false );
00054         int removePartition( unsigned nr );
00055         int changePartitionId( unsigned nr, unsigned id ) { return 0; }
00056         int resizePartition( Partition* p, unsigned long newCyl );
00057         int initializeDisk( bool value );
00058         virtual string defaultLabel() const;
00059         Text fdasdText() const;
00060         Text dasdfmtText( bool doing ) const;
00061         static Text dasdfmtTexts(bool doing, const list<string>& devs);
00062         void getCommitActions(list<commitAction>& l) const;
00063         void getToCommit(storage::CommitStage stage, list<const Container*>& col,
00064                          list<const Volume*>& vol) const;
00065         int commitChanges( storage::CommitStage stage );
00066 
00067     protected:
00068 
00069         virtual void print( std::ostream& s ) const { s << *this; }
00070         virtual Container* getCopy() const { return( new Dasd( *this ) ); }
00071         bool detectPartitionsFdasd(SystemInfo& systeminfo);
00072         bool detectPartitions(SystemInfo& systeminfo);
00073         virtual bool checkPartitionsValid(SystemInfo& systeminfo, const list<Partition*>& pl) const;
00074         bool checkFdasdOutput(SystemInfo& systeminfo);
00075         void redetectGeometry() {};
00076         int doCreate( Volume* v ) { return(doFdasd()); }
00077         int doRemove( Volume* v ) { return(init_disk?0:doFdasd()); }
00078         int doFdasd();
00079         int doResize( Volume* v );
00080         int doSetType( Volume* v ) { return 0; }
00081         int doCreateLabel() { return 0; }
00082         int doDasdfmt();
00083 
00084         DasdFormat fmt;
00085 
00086         friend std::ostream& operator<< (std::ostream&, const Dasd& );
00087 
00088     private:
00089 
00090         Dasd& operator=(const Dasd&); // disallow
00091 
00092     };
00093 
00094 
00095     template <> struct EnumInfo<Dasd::DasdFormat> { static const vector<string> names; };
00096 
00097 }
00098 
00099 #endif