1N/A/*
1N/A libparted - a library for manipulating disk partitions
1N/A Copyright (C) 2005, 2007, 2009-2010 Free Software Foundation, Inc.
1N/A
1N/A This program is free software; you can redistribute it and/or modify
1N/A it under the terms of the GNU General Public License as published by
1N/A the Free Software Foundation; either version 3 of the License, or
1N/A (at your option) any later version.
1N/A
1N/A This program is distributed in the hope that it will be useful,
1N/A but WITHOUT ANY WARRANTY; without even the implied warranty of
1N/A MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1N/A GNU General Public License for more details.
1N/A
1N/A You should have received a copy of the GNU General Public License
1N/A along with this program. If not, see <http://www.gnu.org/licenses/>.
1N/A*/
1N/A
1N/A/**
1N/A * \addtogroup PedUnit
1N/A * @{
1N/A */
1N/A
1N/A/** \file unit.h */
1N/A
1N/A#ifndef PED_UNIT_H_INCLUDED
1N/A#define PED_UNIT_H_INCLUDED
1N/A
1N/A#include <parted/device.h>
1N/A
1N/A#include <stdarg.h>
1N/A#include <stdio.h>
1N/A
1N/A#define PED_SECTOR_SIZE_DEFAULT 512LL
1N/A#define PED_KILOBYTE_SIZE 1000LL
1N/A#define PED_MEGABYTE_SIZE 1000000LL
1N/A#define PED_GIGABYTE_SIZE 1000000000LL
1N/A#define PED_TERABYTE_SIZE 1000000000000LL
1N/A#define PED_KIBIBYTE_SIZE 1024LL
1N/A#define PED_MEBIBYTE_SIZE 1048576LL
1N/A#define PED_GIBIBYTE_SIZE 1073741824LL
1N/A#define PED_TEBIBYTE_SIZE 1099511627776LL
1N/A
1N/A/**
1N/A * Human-friendly unit for representation of a location within device
1N/A */
1N/Atypedef enum {
1N/A PED_UNIT_SECTOR,
1N/A PED_UNIT_BYTE,
1N/A PED_UNIT_KILOBYTE,
1N/A PED_UNIT_MEGABYTE,
1N/A PED_UNIT_GIGABYTE,
1N/A PED_UNIT_TERABYTE,
1N/A PED_UNIT_COMPACT,
1N/A PED_UNIT_CYLINDER,
1N/A PED_UNIT_CHS,
1N/A PED_UNIT_PERCENT,
1N/A PED_UNIT_KIBIBYTE,
1N/A PED_UNIT_MEBIBYTE,
1N/A PED_UNIT_GIBIBYTE,
1N/A PED_UNIT_TEBIBYTE
1N/A} PedUnit;
1N/A
1N/A#define PED_UNIT_FIRST PED_UNIT_SECTOR
1N/A#define PED_UNIT_LAST PED_UNIT_TEBIBYTE
1N/A
1N/Aextern long long ped_unit_get_size (const PedDevice* dev, PedUnit unit);
1N/Aextern const char* ped_unit_get_name (PedUnit unit);
1N/Aextern PedUnit ped_unit_get_by_name (const char* unit_name);
1N/A
1N/Aextern void ped_unit_set_default (PedUnit unit);
1N/Aextern PedUnit ped_unit_get_default ();
1N/A
1N/Aextern char* ped_unit_format_byte (const PedDevice* dev, PedSector byte);
1N/Aextern char* ped_unit_format_custom_byte (const PedDevice* dev, PedSector byte,
1N/A PedUnit unit);
1N/A
1N/Aextern char* ped_unit_format (const PedDevice* dev, PedSector sector);
1N/Aextern char* ped_unit_format_custom (const PedDevice* dev, PedSector sector,
1N/A PedUnit unit);
1N/A
1N/Aextern int ped_unit_parse (const char* str, const PedDevice* dev,
1N/A PedSector* sector,
1N/A PedGeometry** range);
1N/Aextern int ped_unit_parse_custom (const char* str, const PedDevice* dev,
1N/A PedUnit unit, PedSector* sector,
1N/A PedGeometry** range);
1N/A
1N/A#endif /* PED_UNIT_H_INCLUDED */
1N/A
1N/A/** @} */