yast2-storage

Dasdview.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 DASDVIEW_H
00024 #define DASDVIEW_H
00025 
00026 #include "storage/StorageInterface.h"
00027 #include "storage/Geometry.h"
00028 #include "storage/Dasd.h"
00029 
00030 
00031 namespace storage
00032 {
00033     class SystemCmd;
00034 
00035 
00036     class Dasdview
00037     {
00038 
00039     public:
00040 
00041         Dasdview(const string& device);
00042 
00043         const Geometry& getGeometry() const { return geometry; }
00044         Dasd::DasdFormat getDasdFormat() const { return dasd_format; }
00045         Dasd::DasdType getDasdType() const { return dasd_type; }
00046 
00047     private:
00048 
00049         Geometry geometry;
00050         Dasd::DasdFormat dasd_format;
00051         Dasd::DasdType dasd_type;
00052 
00053         void scanGeometry(SystemCmd& cmd);
00054 
00055     };
00056 
00057 
00058     class Fdasd
00059     {
00060 
00061     public:
00062 
00063         Fdasd(const string& device);
00064 
00065         struct Entry
00066         {
00067             Entry() : num(0) {}
00068 
00069             unsigned num;
00070             Region cylRegion;
00071             Region headRegion;
00072 
00073             friend std::ostream& operator<<(std::ostream& s, const Entry& e);
00074         };
00075 
00076         const Geometry& getGeometry() const { return geometry; }
00077 
00078         typedef vector<Entry>::const_iterator const_iterator;
00079 
00080         const vector<Entry>& getEntries() const { return entries; }
00081 
00082         bool getEntry(unsigned num, Entry& entry) const;
00083 
00084     private:
00085 
00086         typedef vector<Entry>::iterator iterator;
00087 
00088         Geometry geometry;
00089         vector<Entry> entries;
00090 
00091         void scanGeometry(SystemCmd& cmd);
00092         void scanEntryLine(const string& line);
00093 
00094     };
00095 
00096 }
00097 
00098 #endif