00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00027 #ifndef PED_UNIT_H_INCLUDED
00028 #define PED_UNIT_H_INCLUDED
00029
00030 #include <parted/device.h>
00031
00032 #include <stdarg.h>
00033 #include <stdio.h>
00034
00035 #define PED_SECTOR_SIZE_DEFAULT 512LL
00036 #define PED_KILOBYTE_SIZE 1000LL
00037 #define PED_MEGABYTE_SIZE 1000000LL
00038 #define PED_GIGABYTE_SIZE 1000000000LL
00039 #define PED_TERABYTE_SIZE 1000000000000LL
00040 #define PED_KIBIBYTE_SIZE 1024LL
00041 #define PED_MEBIBYTE_SIZE 1048576LL
00042 #define PED_GIBIBYTE_SIZE 1073741824LL
00043 #define PED_TEBIBYTE_SIZE 1099511627776LL
00044
00048 typedef enum {
00049 PED_UNIT_SECTOR,
00050 PED_UNIT_BYTE,
00051 PED_UNIT_KILOBYTE,
00052 PED_UNIT_MEGABYTE,
00053 PED_UNIT_GIGABYTE,
00054 PED_UNIT_TERABYTE,
00055 PED_UNIT_COMPACT,
00056 PED_UNIT_CYLINDER,
00057 PED_UNIT_CHS,
00058 PED_UNIT_PERCENT,
00059 PED_UNIT_KIBIBYTE,
00060 PED_UNIT_MEBIBYTE,
00061 PED_UNIT_GIBIBYTE,
00062 PED_UNIT_TEBIBYTE
00063 } PedUnit;
00064
00065 #define PED_UNIT_FIRST PED_UNIT_SECTOR
00066 #define PED_UNIT_LAST PED_UNIT_TEBIBYTE
00067
00068 extern long long ped_unit_get_size (const PedDevice* dev, PedUnit unit);
00069 extern const char* ped_unit_get_name (PedUnit unit);
00070 extern PedUnit ped_unit_get_by_name (const char* unit_name);
00071
00072 extern void ped_unit_set_default (PedUnit unit);
00073 extern PedUnit ped_unit_get_default ();
00074
00075 extern char* ped_unit_format_byte (const PedDevice* dev, PedSector byte);
00076 extern char* ped_unit_format_custom_byte (const PedDevice* dev, PedSector byte,
00077 PedUnit unit);
00078
00079 extern char* ped_unit_format (const PedDevice* dev, PedSector sector);
00080 extern char* ped_unit_format_custom (const PedDevice* dev, PedSector sector,
00081 PedUnit unit);
00082
00083 extern int ped_unit_parse (const char* str, const PedDevice* dev,
00084 PedSector* sector,
00085 PedGeometry** range);
00086 extern int ped_unit_parse_custom (const char* str, const PedDevice* dev,
00087 PedUnit unit, PedSector* sector,
00088 PedGeometry** range);
00089
00090 #endif
00091