00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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