unit.h

Go to the documentation of this file.
00001 /*
00002     libparted - a library for manipulating disk partitions
00003     Copyright (C) 2005, 2007 Free Software Foundation, Inc.
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
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 /* PED_UNIT_H_INCLUDED */
00091 

Generated on Fri May 4 05:15:31 2007 for libparted by  doxygen 1.5.2