27#ifndef PED_UNIT_H_INCLUDED
28#define PED_UNIT_H_INCLUDED
35#define PED_SECTOR_SIZE_DEFAULT 512LL
36#define PED_KILOBYTE_SIZE 1000LL
37#define PED_MEGABYTE_SIZE 1000000LL
38#define PED_GIGABYTE_SIZE 1000000000LL
39#define PED_TERABYTE_SIZE 1000000000000LL
40#define PED_KIBIBYTE_SIZE 1024LL
41#define PED_MEBIBYTE_SIZE 1048576LL
42#define PED_GIBIBYTE_SIZE 1073741824LL
43#define PED_TEBIBYTE_SIZE 1099511627776LL
65#define PED_UNIT_FIRST PED_UNIT_SECTOR
66#define PED_UNIT_LAST PED_UNIT_TEBIBYTE
long long PedSector
We can address 2^63 sectors.
Definition device.h:31
struct _PedDevice PedDevice
Definition device.h:58
struct _PedGeometry PedGeometry
Definition geom.h:30
char * ped_unit_format_byte(const PedDevice *dev, PedSector byte)
Get a string that describes the location of the byte on device dev.
Definition unit.c:269
const char * ped_unit_get_name(PedUnit unit)
Get a textual (non-internationalized) representation of a unit.
Definition unit.c:156
PedUnit ped_unit_get_by_name(const char *unit_name)
Get a unit based on its textual representation: unit_name.
Definition unit.c:167
int ped_unit_parse(const char *str, const PedDevice *dev, PedSector *sector, PedGeometry **range)
If str contains a valid description of a location on dev, then *sector is modified to describe the lo...
Definition unit.c:315
char * ped_unit_format_custom_byte(const PedDevice *dev, PedSector byte, PedUnit unit)
Get a string that describes the location of the byte on device dev.
Definition unit.c:196
PedUnit ped_unit_get_default()
Get the current default unit.
Definition unit.c:107
void ped_unit_set_default(PedUnit unit)
Set the default unit used by subsequent calls to the PedUnit API.
Definition unit.c:97
long long ped_unit_get_size(const PedDevice *dev, PedUnit unit)
Get the byte size of a given unit.
Definition unit.c:116
PedUnit
Human-friendly unit for representation of a location within device.
Definition unit.h:48
char * ped_unit_format_custom(const PedDevice *dev, PedSector sector, PedUnit unit)
Get a string that describes the location sector on device dev.
Definition unit.c:282
char * ped_unit_format(const PedDevice *dev, PedSector sector)
Get a string that describes the location sector on device dev.
Definition unit.c:296
int ped_unit_parse_custom(const char *str, const PedDevice *dev, PedUnit unit, PedSector *sector, PedGeometry **range)
If str contains a valid description of a location on dev, then *sector is modified to describe the lo...
Definition unit.c:502
@ PED_UNIT_MEGABYTE
Definition unit.h:52
@ PED_UNIT_TERABYTE
Definition unit.h:54
@ PED_UNIT_GIBIBYTE
Definition unit.h:61
@ PED_UNIT_KILOBYTE
Definition unit.h:51
@ PED_UNIT_GIGABYTE
Definition unit.h:53
@ PED_UNIT_BYTE
Definition unit.h:50
@ PED_UNIT_MEBIBYTE
Definition unit.h:60
@ PED_UNIT_COMPACT
Definition unit.h:55
@ PED_UNIT_SECTOR
Definition unit.h:49
@ PED_UNIT_TEBIBYTE
Definition unit.h:62
@ PED_UNIT_CYLINDER
Definition unit.h:56
@ PED_UNIT_CHS
Definition unit.h:57
@ PED_UNIT_PERCENT
Definition unit.h:58
@ PED_UNIT_KIBIBYTE
Definition unit.h:59
uint8_t sector
Definition pc98.c:7