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