|
yast2-storage
|
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 GEOMETRY_H 00024 #define GEOMETRY_H 00025 00026 #include "storage/XmlFile.h" 00027 00028 00029 namespace storage 00030 { 00031 00032 struct Geometry 00033 { 00034 Geometry(); 00035 00036 unsigned long cylinders; 00037 unsigned int heads; 00038 unsigned int sectors; 00039 unsigned int sector_size; 00040 00041 unsigned long long sizeK() const; 00042 00043 unsigned long cylinderSize() const; 00044 unsigned long headSize() const; 00045 00046 unsigned long long cylinderToKb(unsigned long cylinder) const; 00047 unsigned long kbToCylinder(unsigned long long kb) const; 00048 00049 unsigned long long sectorToKb(unsigned long long sector) const; 00050 unsigned long long kbToSector(unsigned long long kb) const; 00051 00052 bool operator==(const Geometry& rhs) const; 00053 bool operator!=(const Geometry& rhs) const { return !(*this == rhs); } 00054 00055 friend std::ostream& operator<<(std::ostream& s, const Geometry& geo); 00056 00057 friend bool getChildValue(const xmlNode* node, const char* name, Geometry& value); 00058 friend void setChildValue(xmlNode* node, const char* name, const Geometry& value); 00059 }; 00060 00061 00062 bool detectGeometry(const string& device, Geometry& geometry); 00063 00064 } 00065 00066 00067 #endif
1.7.3