| device.h | | device.h | |
| | | | |
| skipping to change at line 20 | | skipping to change at line 20 | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
| along with this program; if not, write to the Free Software | | along with this program; if not, write to the Free Software | |
| Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U
SA | | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U
SA | |
| */ | | */ | |
| | | | |
|
| | | /** | |
| | | * \addtogroup PedDevice | |
| | | * @{ | |
| | | */ | |
| | | | |
| | | /** \file device.h */ | |
| | | | |
| #ifndef PED_DEVICE_H_INCLUDED | | #ifndef PED_DEVICE_H_INCLUDED | |
| #define PED_DEVICE_H_INCLUDED | | #define PED_DEVICE_H_INCLUDED | |
| | | | |
| #include <parted/timer.h> | | #include <parted/timer.h> | |
| | | | |
|
| | | /** We can address 2^63 sectors */ | |
| typedef long long PedSector; | | typedef long long PedSector; | |
| | | | |
|
| | | /** \deprecated Removal from API planned */ | |
| typedef enum { | | typedef enum { | |
|
| PED_DEVICE_UNKNOWN = 0, | | PED_DEVICE_UNKNOWN = 0, | |
| PED_DEVICE_SCSI = 1, | | PED_DEVICE_SCSI = 1, | |
| PED_DEVICE_IDE = 2, | | PED_DEVICE_IDE = 2, | |
| PED_DEVICE_DAC960 = 3, | | PED_DEVICE_DAC960 = 3, | |
| PED_DEVICE_CPQARRAY = 4, | | PED_DEVICE_CPQARRAY = 4, | |
| PED_DEVICE_FILE = 5, | | PED_DEVICE_FILE = 5, | |
| PED_DEVICE_ATARAID = 6, | | PED_DEVICE_ATARAID = 6, | |
| PED_DEVICE_I2O = 7, | | PED_DEVICE_I2O = 7, | |
| PED_DEVICE_UBD = 8 | | PED_DEVICE_UBD = 8 | |
| } PedDeviceType; | | } PedDeviceType; | |
| | | | |
| typedef struct _PedDevice PedDevice; | | typedef struct _PedDevice PedDevice; | |
| typedef struct _PedDeviceArchOps PedDeviceArchOps; | | typedef struct _PedDeviceArchOps PedDeviceArchOps; | |
| typedef struct _PedCHSGeometry PedCHSGeometry; | | typedef struct _PedCHSGeometry PedCHSGeometry; | |
| | | | |
|
| | | /** | |
| | | * A cylinder-head-sector "old-style" geometry. | |
| | | * | |
| | | * A device addressed in this way has C*H*S sectors. | |
| | | */ | |
| struct _PedCHSGeometry { | | struct _PedCHSGeometry { | |
|
| int cylinders; | | int cylinders; | |
| int heads; | | int heads; | |
| int sectors; | | int sectors; | |
| }; | | }; | |
| | | | |
|
| /* A hard disk device - eg. /dev/hda, not /dev/hda3 */ | | /** A block device - for example, /dev/hda, not /dev/hda3 */ | |
| struct _PedDevice { | | struct _PedDevice { | |
|
| PedDevice* next; | | PedDevice* next; | |
| | | | |
|
| char* model; /* description of hardware * | | char* model; /**< \brief description of hardware | |
| / | | (manufacturer, model) */ | |
| char* path; /* device /dev entry */ | | char* path; /**< device /dev entry */ | |
| | | | |
|
| PedDeviceType type; /* SCSI, IDE, etc. */ | | PedDeviceType type; /**< SCSI, IDE, etc. | |
| int sector_size; | | \deprecated \sa PedDeviceType | |
| PedSector length; | | */ | |
| | | long long sector_size; /**< logical sector size */ | |
| | | long long phys_sector_size; /**< physical sector size * | |
| | | / | |
| | | PedSector length; /**< device length (LBA) */ | |
| | | | |
|
| int open_count; | | int open_count; /**< the number of times this device ha | |
| int read_only; | | s | |
| int external_mode; | | been opened with ped_device_open() | |
| int dirty; | | . */ | |
| int boot_dirty; | | int read_only; | |
| | | int external_mode; | |
| | | int dirty; | |
| | | int boot_dirty; | |
| | | | |
|
| PedCHSGeometry hw_geom; | | PedCHSGeometry hw_geom; | |
| PedCHSGeometry bios_geom; | | PedCHSGeometry bios_geom; | |
| short host, did; | | short host, did; | |
| | | | |
|
| void* arch_specific; | | void* arch_specific; | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * List of functions implementing architecture-specific operations. | |
| | | */ | |
| struct _PedDeviceArchOps { | | struct _PedDeviceArchOps { | |
|
| PedDevice* (*_new) (const char* path); | | PedDevice* (*_new) (const char* path); | |
| void (*destroy) (PedDevice* dev); | | void (*destroy) (PedDevice* dev); | |
| int (*is_busy) (PedDevice* dev); | | int (*is_busy) (PedDevice* dev); | |
| int (*open) (PedDevice* dev); | | int (*open) (PedDevice* dev); | |
| int (*refresh_open) (PedDevice* dev); | | int (*refresh_open) (PedDevice* dev); | |
| int (*close) (PedDevice* dev); | | int (*close) (PedDevice* dev); | |
| int (*refresh_close) (PedDevice* dev); | | int (*refresh_close) (PedDevice* dev); | |
| int (*read) (PedDevice* dev, void* buffer, | | int (*read) (const PedDevice* dev, void* buffer, | |
| PedSector start, PedSector count); | | PedSector start, PedSector count); | |
| int (*write) (PedDevice* dev, const void* buffer, | | int (*write) (PedDevice* dev, const void* buffer, | |
| PedSector start, PedSector count); | | PedSector start, PedSector count); | |
| int (*sync) (PedDevice* dev); | | int (*sync) (PedDevice* dev); | |
| int (*sync_fast) (PedDevice* dev); | | int (*sync_fast) (PedDevice* dev); | |
| PedSector (*check) (PedDevice* dev, void* buffer, | | PedSector (*check) (PedDevice* dev, void* buffer, | |
| PedSector start, PedSector count); | | PedSector start, PedSector count); | |
| void (*probe_all) (); | | void (*probe_all) (); | |
| }; | | }; | |
| | | | |
| extern void ped_device_probe_all (); | | extern void ped_device_probe_all (); | |
| extern void ped_device_free_all (); | | extern void ped_device_free_all (); | |
| | | | |
| extern PedDevice* ped_device_get (const char* name); | | extern PedDevice* ped_device_get (const char* name); | |
| extern PedDevice* ped_device_get_next (const PedDevice* dev); | | extern PedDevice* ped_device_get_next (const PedDevice* dev); | |
| extern int ped_device_is_busy (PedDevice* dev); | | extern int ped_device_is_busy (PedDevice* dev); | |
| extern int ped_device_open (PedDevice* dev); | | extern int ped_device_open (PedDevice* dev); | |
| extern int ped_device_close (PedDevice* dev); | | extern int ped_device_close (PedDevice* dev); | |
| extern void ped_device_destroy (PedDevice* dev); | | extern void ped_device_destroy (PedDevice* dev); | |
| | | | |
| extern int ped_device_begin_external_access (PedDevice* dev); | | extern int ped_device_begin_external_access (PedDevice* dev); | |
| extern int ped_device_end_external_access (PedDevice* dev); | | extern int ped_device_end_external_access (PedDevice* dev); | |
| | | | |
|
| extern int ped_device_read (PedDevice* dev, void* buffer, | | extern int ped_device_read (const PedDevice* dev, void* buffer, | |
| PedSector start, PedSector count); | | PedSector start, PedSector count); | |
| extern int ped_device_write (PedDevice* dev, const void* buffer, | | extern int ped_device_write (PedDevice* dev, const void* buffer, | |
|
| PedSector start, PedSector count); | | PedSector start, PedSector count); | |
| extern int ped_device_sync (PedDevice* dev); | | extern int ped_device_sync (PedDevice* dev); | |
| extern int ped_device_sync_fast (PedDevice* dev); | | extern int ped_device_sync_fast (PedDevice* dev); | |
| extern PedSector ped_device_check (PedDevice* dev, void* buffer, | | extern PedSector ped_device_check (PedDevice* dev, void* buffer, | |
|
| PedSector start, PedSector count); | | PedSector start, PedSector count); | |
| | | extern PedConstraint* ped_device_get_constraint (PedDevice* dev); | |
| | | | |
| /* private stuff ;-) */ | | /* private stuff ;-) */ | |
| | | | |
| extern void _ped_device_probe (const char* path); | | extern void _ped_device_probe (const char* path); | |
| | | | |
| #endif /* PED_DEVICE_H_INCLUDED */ | | #endif /* PED_DEVICE_H_INCLUDED */ | |
|
| | | | |
| | | /** @} */ | |
| | | | |
End of changes. 19 change blocks. |
| 49 lines changed or deleted | | 74 lines changed or added | |
|
| disk.h | | disk.h | |
| | | | |
| skipping to change at line 20 | | skipping to change at line 20 | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
| along with this program; if not, write to the Free Software | | along with this program; if not, write to the Free Software | |
| Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U
SA | | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U
SA | |
| */ | | */ | |
| | | | |
|
| | | /** | |
| | | * \addtogroup PedDisk | |
| | | * @{ | |
| | | */ | |
| | | | |
| | | /** \file disk.h */ | |
| | | | |
| #ifndef PED_DISK_H_INCLUDED | | #ifndef PED_DISK_H_INCLUDED | |
| #define PED_DISK_H_INCLUDED | | #define PED_DISK_H_INCLUDED | |
| | | | |
|
| typedef struct _PedDisk PedDisk; | | typedef struct _PedDisk PedDisk; | |
| typedef struct _PedPartition PedPartition; | | typedef struct _PedPartition PedPartition; | |
| typedef const struct _PedDiskOps PedDiskOps; | | typedef const struct _PedDiskOps PedDiskOps; | |
| typedef struct _PedDiskType PedDiskType; | | typedef struct _PedDiskType PedDiskType; | |
| typedef const struct _PedDiskArchOps PedDiskArchOps; | | typedef const struct _PedDiskArchOps PedDiskArchOps; | |
| | | | |
| #include <parted/device.h> | | #include <parted/device.h> | |
| #include <parted/filesys.h> | | #include <parted/filesys.h> | |
| #include <parted/natmath.h> | | #include <parted/natmath.h> | |
| #include <parted/geom.h> | | #include <parted/geom.h> | |
| | | | |
|
| | | /** | |
| | | * Partition types | |
| | | */ | |
| typedef enum { | | typedef enum { | |
|
| PED_PARTITION_NORMAL = 0x00, | | PED_PARTITION_NORMAL = 0x00, | |
| PED_PARTITION_LOGICAL = 0x01, | | PED_PARTITION_LOGICAL = 0x01, | |
| PED_PARTITION_EXTENDED = 0x02, | | PED_PARTITION_EXTENDED = 0x02, | |
| PED_PARTITION_FREESPACE = 0x04, | | PED_PARTITION_FREESPACE = 0x04, | |
| PED_PARTITION_METADATA = 0x08 | | PED_PARTITION_METADATA = 0x08 | |
| } PedPartitionType; | | } PedPartitionType; | |
| | | | |
|
| | | /** | |
| | | * Partition flags. | |
| | | */ | |
| typedef enum { | | typedef enum { | |
|
| PED_PARTITION_BOOT=1, | | PED_PARTITION_BOOT=1, | |
| PED_PARTITION_ROOT=2, | | PED_PARTITION_ROOT=2, | |
| PED_PARTITION_SWAP=3, | | PED_PARTITION_SWAP=3, | |
| PED_PARTITION_HIDDEN=4, | | PED_PARTITION_HIDDEN=4, | |
| PED_PARTITION_RAID=5, | | PED_PARTITION_RAID=5, | |
| PED_PARTITION_LVM=6, | | PED_PARTITION_LVM=6, | |
| PED_PARTITION_LBA=7, | | PED_PARTITION_LBA=7, | |
| PED_PARTITION_HPSERVICE=8, | | PED_PARTITION_HPSERVICE=8, | |
| PED_PARTITION_PALO=9, | | PED_PARTITION_PALO=9, | |
| PED_PARTITION_PREP=10, | | PED_PARTITION_PREP=10, | |
| PED_PARTITION_MSFT_RESERVED=11 | | PED_PARTITION_MSFT_RESERVED=11 | |
| } PedPartitionFlag; | | } PedPartitionFlag; | |
|
| #define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT | | #define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT | |
| #define PED_PARTITION_LAST_FLAG PED_PARTITION_MSFT_RESERVED | | #define PED_PARTITION_LAST_FLAG PED_PARTITION_MSFT_RESERVED | |
| | | | |
| typedef enum { | | typedef enum { | |
|
| PED_DISK_TYPE_EXTENDED=1, /* supports extended partitions */ | | PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions * | |
| PED_DISK_TYPE_PARTITION_NAME=2 /* supports partition names */ | | / | |
| | | PED_DISK_TYPE_PARTITION_NAME=2 /**< supports partition names */ | |
| } PedDiskTypeFeature; | | } PedDiskTypeFeature; | |
| #define PED_DISK_TYPE_FIRST_FEATURE PED_DISK_TYPE_EXTENDED | | #define PED_DISK_TYPE_FIRST_FEATURE PED_DISK_TYPE_EXTENDED | |
| #define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_PARTITION_NAME | | #define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_PARTITION_NAME | |
| | | | |
|
| struct _PedPartition { | | /** @} */ | |
| PedPartition* prev; | | | |
| PedPartition* next; | | | |
| | | | |
|
| PedDisk* disk; | | /** | |
| PedGeometry geom; | | * \addtogroup PedPartition | |
| int num; | | * | |
| | | * @{ | |
| | | */ | |
| | | | |
|
| PedPartitionType type; | | /** \file disk.h */ | |
| const PedFileSystemType* fs_type; | | | |
| PedPartition* part_list; /* for extended partitions * | | | |
| / | | | |
| | | | |
|
| void* disk_specific; | | /** | |
| | | * PedPartition structure represents a partition. | |
| | | */ | |
| | | struct _PedPartition { | |
| | | PedPartition* prev; | |
| | | PedPartition* next; | |
| | | | |
| | | PedDisk* disk; /**< the partition table of the part | |
| | | ition */ | |
| | | PedGeometry geom; /**< geometry of the partition */ | |
| | | int num; /**< the partition number: In Linux | |
| | | , this is the | |
| | | same as the minor number. No | |
| | | assumption | |
| | | should be made about "num" a | |
| | | nd "type" | |
| | | - different disk labels have | |
| | | different rules. */ | |
| | | PedPartitionType type; /**< the type of partition: a bit fi | |
| | | eld of | |
| | | PED_PARTITION_LOGICAL, PED_P | |
| | | ARTITION_EXTENDED, | |
| | | PED_PARTITION_METADATA | |
| | | and PED_PARTITION_FREESPACE. | |
| | | Both the first two, and the | |
| | | last two are | |
| | | mutually exclusive. | |
| | | An extended partitio | |
| | | n is a primary | |
| | | partition that may contain l | |
| | | ogical partitions. | |
| | | There is at most one extende | |
| | | d partition on | |
| | | a disk. | |
| | | A logical partition | |
| | | is like a primary | |
| | | partition, except it's insid | |
| | | e an extended | |
| | | partition. Internally, pseud | |
| | | o partitions are | |
| | | allocated to represent free | |
| | | space, or disk | |
| | | label meta-data. These have | |
| | | the | |
| | | PED_PARTITION_FREESPACE or | |
| | | PED_PARTITION_METADATA bit s | |
| | | et. */ | |
| | | const PedFileSystemType* fs_type; /**< The type of file system | |
| | | on the partition. | |
| | | NULL if unknown. */ | |
| | | PedPartition* part_list; /**< Only used for an exten | |
| | | ded partition. | |
| | | The list of logical | |
| | | partitions | |
| | | (and free space and | |
| | | metadata within | |
| | | the extended partiti | |
| | | on). */ | |
| | | | |
| | | void* disk_specific; | |
| }; | | }; | |
| | | | |
|
| | | /** @} */ | |
| | | | |
| | | /** | |
| | | * \addtogroup PedDisk | |
| | | * @{ | |
| | | */ | |
| | | | |
| | | /** | |
| | | * Represents a disk label (partition table). | |
| | | */ | |
| struct _PedDisk { | | struct _PedDisk { | |
|
| PedDevice* dev; | | PedDevice* dev; /**< the device where the | |
| const PedDiskType* type; | | partition table lies */ | |
| PedPartition* part_list; | | const PedDiskType* type; /**< type of disk label */ | |
| | | const int* block_sizes; /**< block sizes supported | |
| | | by this label */ | |
| | | PedPartition* part_list; /**< list of partitions. Access wi | |
| | | th | |
| | | ped_disk_next_partition() */ | |
| | | | |
|
| void* disk_specific; | | void* disk_specific; | |
| | | | |
| /* office use only ;-) */ | | /* office use only ;-) */ | |
|
| int needs_clobber; /* clobber before write? */ | | int needs_clobber; /**< clobber before write? | |
| int update_mode; /* mode without free/metadat | | */ | |
| a | | int update_mode; /**< mode without free/meta | |
| partitions, for easier | | data | |
| update */ | | partitions, for easier | |
| | | update */ | |
| }; | | }; | |
| | | | |
| struct _PedDiskOps { | | struct _PedDiskOps { | |
|
| /* disk label operations */ | | /* disk label operations */ | |
| int (*probe) (PedDevice *dev); | | int (*probe) (const PedDevice *dev); | |
| int (*clobber) (PedDevice* dev); | | int (*clobber) (PedDevice* dev); | |
| PedDisk* (*alloc) (PedDevice* dev); | | PedDisk* (*alloc) (const PedDevice* dev); | |
| PedDisk* (*duplicate) (const PedDisk* disk); | | PedDisk* (*duplicate) (const PedDisk* disk); | |
| void (*free) (PedDisk* disk); | | void (*free) (PedDisk* disk); | |
| int (*read) (PedDisk* disk); | | int (*read) (PedDisk* disk); | |
| int (*write) (PedDisk* disk); | | int (*write) (PedDisk* disk); | |
| | | /** \todo add label guessing op here */ | |
| | | | |
|
| /* partition operations */ | | /* partition operations */ | |
| PedPartition* (*partition_new) ( | | PedPartition* (*partition_new) ( | |
| const PedDisk* disk, | | const PedDisk* disk, | |
| PedPartitionType part_type, | | PedPartitionType part_type, | |
| const PedFileSystemType* fs_type, | | const PedFileSystemType* fs_type, | |
| PedSector start, | | PedSector start, | |
| PedSector end); | | PedSector end); | |
| PedPartition* (*partition_duplicate) (const PedPartition* part); | | PedPartition* (*partition_duplicate) (const PedPartition* part); | |
| void (*partition_destroy) (PedPartition* part); | | void (*partition_destroy) (PedPartition* part); | |
| int (*partition_set_system) (PedPartition* part, | | int (*partition_set_system) (PedPartition* part, | |
| const PedFileSystemType* fs_type); | | const PedFileSystemType* fs_type); | |
| int (*partition_set_flag) ( | | int (*partition_set_flag) ( | |
| PedPartition* part, | | PedPartition* part, | |
| PedPartitionFlag flag, | | PedPartitionFlag flag, | |
| int state); | | int state); | |
| int (*partition_get_flag) ( | | int (*partition_get_flag) ( | |
| const PedPartition* part, | | const PedPartition* part, | |
| PedPartitionFlag flag); | | PedPartitionFlag flag); | |
| int (*partition_is_flag_available) ( | | int (*partition_is_flag_available) ( | |
| const PedPartition* part, | | const PedPartition* part, | |
| PedPartitionFlag flag); | | PedPartitionFlag flag); | |
| void (*partition_set_name) (PedPartition* part, const char* name); | | void (*partition_set_name) (PedPartition* part, const char* name); | |
| const char* (*partition_get_name) (const PedPartition* part); | | const char* (*partition_get_name) (const PedPartition* part); | |
| int (*partition_align) (PedPartition* part, | | int (*partition_align) (PedPartition* part, | |
| const PedConstraint* constraint); | | const PedConstraint* constraint); | |
| int (*partition_enumerate) (PedPartition* part); | | int (*partition_enumerate) (PedPartition* part); | |
| | | | |
|
| /* other */ | | /* other */ | |
| int (*alloc_metadata) (PedDisk* disk); | | int (*alloc_metadata) (PedDisk* disk); | |
| int (*get_max_primary_partition_count) (const PedDisk* disk); | | int (*get_max_primary_partition_count) (const PedDisk* disk); | |
| }; | | }; | |
| | | | |
| struct _PedDiskType { | | struct _PedDiskType { | |
|
| PedDiskType* next; | | PedDiskType* next; | |
| const char* name; | | const char* name; /**< the name of the partition table | |
| PedDiskOps* const ops; | | type. | |
| | | \todo not very intuitive name */ | |
| | | PedDiskOps* const ops; | |
| | | | |
|
| PedDiskTypeFeature features; /* bitmap of supported features
*/ | | PedDiskTypeFeature features; /**< bitmap of supported featur
es */ | |
| }; | | }; | |
| | | | |
|
| /* Architecture specific operations. i.e. communication with kernel (or | | /** | |
| | | * Architecture-specific operations. i.e. communication with kernel (or | |
| * whatever) about changes, etc. | | * whatever) about changes, etc. | |
| */ | | */ | |
| struct _PedDiskArchOps { | | struct _PedDiskArchOps { | |
|
| char* (*partition_get_path) (const PedPartition* part); | | char* (*partition_get_path) (const PedPartition* part); | |
| int (*partition_is_busy) (const PedPartition* part); | | int (*partition_is_busy) (const PedPartition* part); | |
| int (*disk_commit) (PedDisk* disk); | | int (*disk_commit) (PedDisk* disk); | |
| }; | | }; | |
| | | | |
| extern void ped_register_disk_type (PedDiskType* type); | | extern void ped_register_disk_type (PedDiskType* type); | |
| extern void ped_unregister_disk_type (PedDiskType* type); | | extern void ped_unregister_disk_type (PedDiskType* type); | |
| extern PedDiskType* ped_disk_type_get_next (PedDiskType* type); | | extern PedDiskType* ped_disk_type_get_next (PedDiskType* type); | |
| extern PedDiskType* ped_disk_type_get (const char* name); | | extern PedDiskType* ped_disk_type_get (const char* name); | |
| extern int ped_disk_type_check_feature (const PedDiskType* disk_type, | | extern int ped_disk_type_check_feature (const PedDiskType* disk_type, | |
|
| PedDiskTypeFeature feature); | | PedDiskTypeFeature feature); | |
| | | | |
| extern PedDiskType* ped_disk_probe (PedDevice* dev); | | extern PedDiskType* ped_disk_probe (PedDevice* dev); | |
| extern int ped_disk_clobber (PedDevice* dev); | | extern int ped_disk_clobber (PedDevice* dev); | |
| extern int ped_disk_clobber_exclude (PedDevice* dev, | | extern int ped_disk_clobber_exclude (PedDevice* dev, | |
|
| const PedDiskType* exclude); | | const PedDiskType* exclude); | |
| extern PedDisk* ped_disk_new (PedDevice* dev); | | extern PedDisk* ped_disk_new (PedDevice* dev); | |
| extern PedDisk* ped_disk_new_fresh (PedDevice* dev, | | extern PedDisk* ped_disk_new_fresh (PedDevice* dev, | |
|
| const PedDiskType* disk_type); | | const PedDiskType* disk_type); | |
| extern PedDisk* ped_disk_duplicate (const PedDisk* old_disk); | | extern PedDisk* ped_disk_duplicate (const PedDisk* old_disk); | |
| extern void ped_disk_destroy (PedDisk* disk); | | extern void ped_disk_destroy (PedDisk* disk); | |
| extern int ped_disk_commit (PedDisk* disk); | | extern int ped_disk_commit (PedDisk* disk); | |
| extern int ped_disk_commit_to_dev (PedDisk* disk); | | extern int ped_disk_commit_to_dev (PedDisk* disk); | |
| extern int ped_disk_commit_to_os (PedDisk* disk); | | extern int ped_disk_commit_to_os (PedDisk* disk); | |
| extern int ped_disk_check (PedDisk* disk); | | extern int ped_disk_check (PedDisk* disk); | |
| extern void ped_disk_print (PedDisk* disk); | | extern void ped_disk_print (PedDisk* disk); | |
| | | | |
| extern int ped_disk_get_primary_partition_count (PedDisk* disk); | | extern int ped_disk_get_primary_partition_count (PedDisk* disk); | |
| extern int ped_disk_get_last_partition_num (PedDisk* disk); | | extern int ped_disk_get_last_partition_num (PedDisk* disk); | |
| extern int ped_disk_get_max_primary_partition_count (const PedDisk* disk); | | extern int ped_disk_get_max_primary_partition_count (const PedDisk* disk); | |
| | | | |
|
| | | /** @} */ | |
| | | | |
| | | /** | |
| | | * \addtogroup PedPartition | |
| | | * | |
| | | * @{ | |
| | | */ | |
| | | | |
| extern PedPartition* ped_partition_new (const PedDisk* disk, | | extern PedPartition* ped_partition_new (const PedDisk* disk, | |
|
| PedPartitionType type, | | PedPartitionType type, | |
| const PedFileSystemType* fs_type, | | const PedFileSystemType* fs_type, | |
| PedSector start, | | PedSector start, | |
| PedSector end); | | PedSector end); | |
| extern void ped_partition_destroy (PedPartition* part); | | extern void ped_partition_destroy (PedPartition* part); | |
| extern int ped_partition_is_active (const PedPartition* part); | | extern int ped_partition_is_active (const PedPartition* part); | |
| extern int ped_partition_set_flag (PedPartition* part, PedPartitionFlag fla
g, | | extern int ped_partition_set_flag (PedPartition* part, PedPartitionFlag fla
g, | |
|
| int state); | | int state); | |
| extern int ped_partition_get_flag (const PedPartition* part, | | extern int ped_partition_get_flag (const PedPartition* part, | |
|
| PedPartitionFlag flag); | | PedPartitionFlag flag); | |
| extern int ped_partition_is_flag_available (const PedPartition* part, | | extern int ped_partition_is_flag_available (const PedPartition* part, | |
|
| PedPartitionFlag flag); | | PedPartitionFlag flag); | |
| extern int ped_partition_set_system (PedPartition* part, | | extern int ped_partition_set_system (PedPartition* part, | |
|
| const PedFileSystemType* fs_type); | | const PedFileSystemType* fs_type); | |
| extern int ped_partition_set_name (PedPartition* part, const char* name); | | extern int ped_partition_set_name (PedPartition* part, const char* name); | |
| extern const char* ped_partition_get_name (const PedPartition* part); | | extern const char* ped_partition_get_name (const PedPartition* part); | |
| extern int ped_partition_is_busy (const PedPartition* part); | | extern int ped_partition_is_busy (const PedPartition* part); | |
| extern char* ped_partition_get_path (const PedPartition* part); | | extern char* ped_partition_get_path (const PedPartition* part); | |
| | | | |
| extern const char* ped_partition_type_get_name (PedPartitionType part_type)
; | | extern const char* ped_partition_type_get_name (PedPartitionType part_type)
; | |
| extern const char* ped_partition_flag_get_name (PedPartitionFlag flag); | | extern const char* ped_partition_flag_get_name (PedPartitionFlag flag); | |
| extern PedPartitionFlag ped_partition_flag_get_by_name (const char* name); | | extern PedPartitionFlag ped_partition_flag_get_by_name (const char* name); | |
| extern PedPartitionFlag ped_partition_flag_next (PedPartitionFlag flag); | | extern PedPartitionFlag ped_partition_flag_next (PedPartitionFlag flag); | |
| | | | |
|
| | | /** @} */ | |
| | | | |
| | | /** | |
| | | * \addtogroup PedDisk | |
| | | * @{ | |
| | | */ | |
| | | | |
| extern int ped_disk_add_partition (PedDisk* disk, PedPartition* part, | | extern int ped_disk_add_partition (PedDisk* disk, PedPartition* part, | |
|
| const PedConstraint* constraint); | | const PedConstraint* constraint); | |
| extern int ped_disk_remove_partition (PedDisk* disk, PedPartition* part); | | extern int ped_disk_remove_partition (PedDisk* disk, PedPartition* part); | |
| extern int ped_disk_delete_partition (PedDisk* disk, PedPartition* part); | | extern int ped_disk_delete_partition (PedDisk* disk, PedPartition* part); | |
| extern int ped_disk_delete_all (PedDisk* disk); | | extern int ped_disk_delete_all (PedDisk* disk); | |
| extern int ped_disk_set_partition_geom (PedDisk* disk, PedPartition* part, | | extern int ped_disk_set_partition_geom (PedDisk* disk, PedPartition* part, | |
|
| const PedConstraint* constraint, | | const PedConstraint* constraint, | |
| PedSector start, PedSector end); | | PedSector start, PedSector end); | |
| extern int ped_disk_maximize_partition (PedDisk* disk, PedPartition* part, | | extern int ped_disk_maximize_partition (PedDisk* disk, PedPartition* part, | |
|
| const PedConstraint* constraint); | | const PedConstraint* constraint); | |
| extern PedGeometry* ped_disk_get_max_partition_geometry (PedDisk* disk, | | extern PedGeometry* ped_disk_get_max_partition_geometry (PedDisk* disk, | |
|
| PedPartition* part, const PedConstraint* constraint); | | PedPartition* part, const PedConstraint* constraint); | |
| extern int ped_disk_minimize_extended_partition (PedDisk* disk); | | extern int ped_disk_minimize_extended_partition (PedDisk* disk); | |
| | | | |
| extern PedPartition* ped_disk_next_partition (const PedDisk* disk, | | extern PedPartition* ped_disk_next_partition (const PedDisk* disk, | |
|
| const PedPartition* part); | | const PedPartition* part); | |
| extern PedPartition* ped_disk_get_partition (const PedDisk* disk, int num); | | extern PedPartition* ped_disk_get_partition (const PedDisk* disk, int num); | |
| extern PedPartition* ped_disk_get_partition_by_sector (const PedDisk* disk, | | extern PedPartition* ped_disk_get_partition_by_sector (const PedDisk* disk, | |
|
| PedSector sect); | | PedSector sect); | |
| extern PedPartition* ped_disk_extended_partition (const PedDisk* disk); | | extern PedPartition* ped_disk_extended_partition (const PedDisk* disk); | |
| | | | |
| /* internal functions */ | | /* internal functions */ | |
|
| extern PedDisk* _ped_disk_alloc (PedDevice* dev, const PedDiskType* type); | | extern PedDisk* _ped_disk_alloc (const PedDevice* dev, const PedDiskType* t
ype); | |
| extern void _ped_disk_free (PedDisk* disk); | | extern void _ped_disk_free (PedDisk* disk); | |
| | | | |
|
| | | /** @} */ | |
| | | | |
| | | /** | |
| | | * \addtogroup PedPartition | |
| | | * | |
| | | * @{ | |
| | | */ | |
| | | | |
| extern PedPartition* _ped_partition_alloc (const PedDisk* disk, | | extern PedPartition* _ped_partition_alloc (const PedDisk* disk, | |
|
| PedPartitionType type, | | PedPartitionType type, | |
| const PedFileSystemType* fs_type, | | const PedFileSystemType* fs_type | |
| PedSector start, | | , | |
| PedSector end); | | PedSector start, | |
| | | PedSector end); | |
| extern void _ped_partition_free (PedPartition* part); | | extern void _ped_partition_free (PedPartition* part); | |
| | | | |
| extern int _ped_partition_attempt_align ( | | extern int _ped_partition_attempt_align ( | |
|
| PedPartition* part, const PedConstraint* external, | | PedPartition* part, const PedConstraint* external, | |
| PedConstraint* internal); | | PedConstraint* internal); | |
| | | | |
| #endif /* PED_DISK_H_INCLUDED */ | | #endif /* PED_DISK_H_INCLUDED */ | |
|
| | | | |
| | | /** @} */ | |
| | | | |
End of changes. 44 change blocks. |
| 115 lines changed or deleted | | 229 lines changed or added | |
|
| exception.h | | exception.h | |
| | | | |
| skipping to change at line 20 | | skipping to change at line 20 | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
| along with this program; if not, write to the Free Software | | along with this program; if not, write to the Free Software | |
| Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U
SA | | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U
SA | |
| */ | | */ | |
| | | | |
|
| | | /** | |
| | | * \addtogroup PedException | |
| | | * @{ | |
| | | */ | |
| | | | |
| | | /** \file exception.h */ | |
| | | | |
| #ifndef PED_EXCEPTION_H_INCLUDED | | #ifndef PED_EXCEPTION_H_INCLUDED | |
| #define PED_EXCEPTION_H_INCLUDED | | #define PED_EXCEPTION_H_INCLUDED | |
| | | | |
| typedef struct _PedException PedException; | | typedef struct _PedException PedException; | |
| | | | |
|
| | | /** | |
| | | * Exception type | |
| | | */ | |
| enum _PedExceptionType { | | enum _PedExceptionType { | |
| PED_EXCEPTION_INFORMATION=1, | | PED_EXCEPTION_INFORMATION=1, | |
| PED_EXCEPTION_WARNING=2, | | PED_EXCEPTION_WARNING=2, | |
| PED_EXCEPTION_ERROR=3, | | PED_EXCEPTION_ERROR=3, | |
| PED_EXCEPTION_FATAL=4, | | PED_EXCEPTION_FATAL=4, | |
| PED_EXCEPTION_BUG=5, | | PED_EXCEPTION_BUG=5, | |
| PED_EXCEPTION_NO_FEATURE=6, | | PED_EXCEPTION_NO_FEATURE=6, | |
| }; | | }; | |
| typedef enum _PedExceptionType PedExceptionType; | | typedef enum _PedExceptionType PedExceptionType; | |
| | | | |
|
| | | /** | |
| | | * Option for resolving the exception | |
| | | */ | |
| enum _PedExceptionOption { | | enum _PedExceptionOption { | |
| PED_EXCEPTION_UNHANDLED=0, | | PED_EXCEPTION_UNHANDLED=0, | |
| PED_EXCEPTION_FIX=1, | | PED_EXCEPTION_FIX=1, | |
| PED_EXCEPTION_YES=2, | | PED_EXCEPTION_YES=2, | |
| PED_EXCEPTION_NO=4, | | PED_EXCEPTION_NO=4, | |
| PED_EXCEPTION_OK=8, | | PED_EXCEPTION_OK=8, | |
| PED_EXCEPTION_RETRY=16, | | PED_EXCEPTION_RETRY=16, | |
| PED_EXCEPTION_IGNORE=32, | | PED_EXCEPTION_IGNORE=32, | |
| PED_EXCEPTION_CANCEL=64, | | PED_EXCEPTION_CANCEL=64, | |
| }; | | }; | |
| typedef enum _PedExceptionOption PedExceptionOption; | | typedef enum _PedExceptionOption PedExceptionOption; | |
| #define PED_EXCEPTION_OK_CANCEL (PED_EXCEPTION_OK + PED_EXCEPTIO
N_CANCEL) | | #define PED_EXCEPTION_OK_CANCEL (PED_EXCEPTION_OK + PED_EXCEPTIO
N_CANCEL) | |
| #define PED_EXCEPTION_YES_NO (PED_EXCEPTION_YES + PED_EXCEPTION_NO) | | #define PED_EXCEPTION_YES_NO (PED_EXCEPTION_YES + PED_EXCEPTION_NO) | |
| #define PED_EXCEPTION_YES_NO_CANCEL (PED_EXCEPTION_YES_NO \ | | #define PED_EXCEPTION_YES_NO_CANCEL (PED_EXCEPTION_YES_NO \ | |
|
| + PED_EXCEPTION_CANCEL) | | + PED_EXCEPTION_CANCEL) | |
| #define PED_EXCEPTION_IGNORE_CANCEL (PED_EXCEPTION_IGNORE \ | | #define PED_EXCEPTION_IGNORE_CANCEL (PED_EXCEPTION_IGNORE \ | |
| + PED_EXCEPTION_CANCEL) | | + PED_EXCEPTION_CANCEL) | |
| #define PED_EXCEPTION_RETRY_CANCEL (PED_EXCEPTION_RETRY + PED_EXCEPTION_CA
NCEL) | | #define PED_EXCEPTION_RETRY_CANCEL (PED_EXCEPTION_RETRY + PED_EXCEPTION_CA
NCEL) | |
|
| #define PED_EXCEPTION_RETRY_IGNORE_CANCEL (PED_EXCEPTION_RETRY \ | | #define PED_EXCEPTION_RETRY_IGNORE_CANCEL (PED_EXCEPTION_RETRY \ | |
| + PED_EXCEPTION_IGNORE_CANCEL) | | + PED_EXCEPTION_IGNORE_CANCEL) | |
| #define PED_EXCEPTION_OPTION_FIRST PED_EXCEPTION_FIX | | #define PED_EXCEPTION_OPTION_FIRST PED_EXCEPTION_FIX | |
| #define PED_EXCEPTION_OPTION_LAST PED_EXCEPTION_CANCEL | | #define PED_EXCEPTION_OPTION_LAST PED_EXCEPTION_CANCEL | |
| | | | |
|
| | | /** | |
| | | * Structure with information about exception | |
| | | */ | |
| struct _PedException { | | struct _PedException { | |
|
| char* message; | | char* message; /**< text describing what th | |
| PedExceptionType type; | | e event was */ | |
| PedExceptionOption options; /* or'ed list of options tha | | PedExceptionType type; /**< type of exception */ | |
| t | | PedExceptionOption options; /**< ORed list of options th | |
| | | at | |
| the exception handler can | | the exception handler can | |
|
| return */ | | return (the ways an excep | |
| | | tion | |
| | | can be resolved) */ | |
| }; | | }; | |
| | | | |
| typedef PedExceptionOption (PedExceptionHandler) (PedException* ex); | | typedef PedExceptionOption (PedExceptionHandler) (PedException* ex); | |
| | | | |
| extern int ped_exception; /* set to true if there's an exception */ | | extern int ped_exception; /* set to true if there's an exception */ | |
| | | | |
| extern char* ped_exception_get_type_string (PedExceptionType ex_type); | | extern char* ped_exception_get_type_string (PedExceptionType ex_type); | |
| extern char* ped_exception_get_option_string (PedExceptionOption ex_opt); | | extern char* ped_exception_get_option_string (PedExceptionOption ex_opt); | |
| | | | |
| extern void ped_exception_set_handler (PedExceptionHandler* handler); | | extern void ped_exception_set_handler (PedExceptionHandler* handler); | |
| | | | |
| skipping to change at line 96 | | skipping to change at line 113 | |
| extern void ped_exception_catch (); | | extern void ped_exception_catch (); | |
| | | | |
| /* indicate that exceptions should not go to the exception handler, but pas
sed | | /* indicate that exceptions should not go to the exception handler, but pas
sed | |
| up to the calling function(s) */ | | up to the calling function(s) */ | |
| extern void ped_exception_fetch_all (); | | extern void ped_exception_fetch_all (); | |
| | | | |
| /* indicate that exceptions should invoke the exception handler */ | | /* indicate that exceptions should invoke the exception handler */ | |
| extern void ped_exception_leave_all (); | | extern void ped_exception_leave_all (); | |
| | | | |
| #endif /* PED_EXCEPTION_H_INCLUDED */ | | #endif /* PED_EXCEPTION_H_INCLUDED */ | |
|
| | | | |
| | | /** @} */ | |
| | | | |
End of changes. 9 change blocks. |
| 8 lines changed or deleted | | 27 lines changed or added | |
|
| filesys.h | | filesys.h | |
| | | | |
| skipping to change at line 20 | | skipping to change at line 20 | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
| along with this program; if not, write to the Free Software | | along with this program; if not, write to the Free Software | |
| Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U
SA | | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U
SA | |
| */ | | */ | |
| | | | |
|
| | | /** | |
| | | * \addtogroup PedFileSystem | |
| | | * @{ | |
| | | */ | |
| | | | |
| | | /** \file filesys.h */ | |
| | | | |
| #ifndef PED_FILESYS_H_INCLUDED | | #ifndef PED_FILESYS_H_INCLUDED | |
| #define PED_FILESYS_H_INCLUDED | | #define PED_FILESYS_H_INCLUDED | |
| | | | |
| typedef struct _PedFileSystem PedFileSystem; | | typedef struct _PedFileSystem PedFileSystem; | |
| typedef struct _PedFileSystemType PedFileSystemType; | | typedef struct _PedFileSystemType PedFileSystemType; | |
| typedef const struct _PedFileSystemOps PedFileSystemOps; | | typedef const struct _PedFileSystemOps PedFileSystemOps; | |
| | | | |
| #include <parted/geom.h> | | #include <parted/geom.h> | |
| #include <parted/disk.h> | | #include <parted/disk.h> | |
| #include <parted/exception.h> | | #include <parted/exception.h> | |
| | | | |
| skipping to change at line 52 | | skipping to change at line 59 | |
| PedFileSystem* (*copy) (const PedFileSystem* fs, PedGeometry* geom, | | PedFileSystem* (*copy) (const PedFileSystem* fs, PedGeometry* geom, | |
| PedTimer* timer); | | PedTimer* timer); | |
| int (*resize) (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer
); | | int (*resize) (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer
); | |
| | | | |
| PedConstraint* (*get_create_constraint) (const PedDevice* dev); | | PedConstraint* (*get_create_constraint) (const PedDevice* dev); | |
| PedConstraint* (*get_resize_constraint) (const PedFileSystem* fs); | | PedConstraint* (*get_resize_constraint) (const PedFileSystem* fs); | |
| PedConstraint* (*get_copy_constraint) (const PedFileSystem* fs, | | PedConstraint* (*get_copy_constraint) (const PedFileSystem* fs, | |
| const PedDevice* dev); | | const PedDevice* dev); | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * Structure describing type of file system | |
| | | */ | |
| struct _PedFileSystemType { | | struct _PedFileSystemType { | |
| PedFileSystemType* next; | | PedFileSystemType* next; | |
|
| const char* const name; | | const char* const name; /**< name of the file system | |
| | | type */ | |
| | | const int* block_sizes; | |
| PedFileSystemOps* const ops; | | PedFileSystemOps* const ops; | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * Structure describing file system | |
| | | */ | |
| struct _PedFileSystem { | | struct _PedFileSystem { | |
|
| PedFileSystemType* type; | | PedFileSystemType* type; /**< the file system type */ | |
| PedGeometry* geom; | | PedGeometry* geom; /**< where the file system a | |
| int checked; | | ctually is */ | |
| | | int checked; /**< 1 if the file system ha | |
| | | s been checked. | |
| | | 0 otherwise. */ | |
| | | | |
| void* type_specific; | | void* type_specific; | |
| | | | |
| }; | | }; | |
| | | | |
| extern void ped_file_system_type_register (PedFileSystemType* type); | | extern void ped_file_system_type_register (PedFileSystemType* type); | |
| extern void ped_file_system_type_unregister (PedFileSystemType* type); | | extern void ped_file_system_type_unregister (PedFileSystemType* type); | |
| | | | |
| extern PedFileSystemType* ped_file_system_type_get (const char* name); | | extern PedFileSystemType* ped_file_system_type_get (const char* name); | |
| extern PedFileSystemType* | | extern PedFileSystemType* | |
| | | | |
| skipping to change at line 100 | | skipping to change at line 115 | |
| PedTimer* timer); | | PedTimer* timer); | |
| | | | |
| extern PedConstraint* ped_file_system_get_create_constraint ( | | extern PedConstraint* ped_file_system_get_create_constraint ( | |
| const PedFileSystemType* fs_type, const PedDevice* dev); | | const PedFileSystemType* fs_type, const PedDevice* dev); | |
| extern PedConstraint* ped_file_system_get_resize_constraint ( | | extern PedConstraint* ped_file_system_get_resize_constraint ( | |
| const PedFileSystem* fs); | | const PedFileSystem* fs); | |
| extern PedConstraint* ped_file_system_get_copy_constraint ( | | extern PedConstraint* ped_file_system_get_copy_constraint ( | |
| const PedFileSystem* fs, const PedDevice* dev); | | const PedFileSystem* fs, const PedDevice* dev); | |
| | | | |
| #endif /* PED_FILESYS_H_INCLUDED */ | | #endif /* PED_FILESYS_H_INCLUDED */ | |
|
| | | | |
| | | /** @} */ | |
| | | | |
End of changes. 6 change blocks. |
| 4 lines changed or deleted | | 22 lines changed or added | |
|
| timer.h | | timer.h | |
| | | | |
| skipping to change at line 20 | | skipping to change at line 20 | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
| along with this program; if not, write to the Free Software | | along with this program; if not, write to the Free Software | |
| Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U
SA | | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U
SA | |
| */ | | */ | |
| | | | |
|
| | | /** | |
| | | * \addtogroup PedTimer | |
| | | * @{ | |
| | | */ | |
| | | | |
| | | /** \file timer.h */ | |
| | | | |
| #ifndef PED_TIMER_H_INCLUDED | | #ifndef PED_TIMER_H_INCLUDED | |
| #define PED_TIMER_H_INCLUDED | | #define PED_TIMER_H_INCLUDED | |
| | | | |
| #include <time.h> | | #include <time.h> | |
| | | | |
| typedef struct _PedTimer PedTimer; | | typedef struct _PedTimer PedTimer; | |
| | | | |
| typedef void PedTimerHandler (PedTimer* timer, void* context); | | typedef void PedTimerHandler (PedTimer* timer, void* context); | |
| | | | |
|
| | | /* | |
| | | * Structure keeping track of progress and time | |
| | | */ | |
| struct _PedTimer { | | struct _PedTimer { | |
|
| float frac; /* fraction of operation don | | float frac; /**< fraction of operation d | |
| e */ | | one */ | |
| time_t start; /* time of start of op */ | | time_t start; /**< time of start of op */ | |
| time_t now; /* time of last update (now! | | time_t now; /**< time of last update (no | |
| ) */ | | w!) */ | |
| time_t predicted_end; /* expected finish time */ | | time_t predicted_end; /**< expected finish time */ | |
| const char* state_name; /* eg: "copying data" */ | | const char* state_name; /**< eg: "copying data" */ | |
| PedTimerHandler* handler; /* who to notify on updates | | PedTimerHandler* handler; /**< who to notify on update | |
| */ | | s */ | |
| void* context; /* context to pass to handle | | void* context; /**< context to pass to hand | |
| r */ | | ler */ | |
| }; | | }; | |
| | | | |
| extern PedTimer* ped_timer_new (PedTimerHandler* handler, void* context); | | extern PedTimer* ped_timer_new (PedTimerHandler* handler, void* context); | |
| extern void ped_timer_destroy (PedTimer* timer); | | extern void ped_timer_destroy (PedTimer* timer); | |
| | | | |
| /* a nested timer automatically notifies it's parent. You should only | | /* a nested timer automatically notifies it's parent. You should only | |
| * create one when you are going to use it (not before) | | * create one when you are going to use it (not before) | |
| */ | | */ | |
| extern PedTimer* ped_timer_new_nested (PedTimer* parent, float nest_frac); | | extern PedTimer* ped_timer_new_nested (PedTimer* parent, float nest_frac); | |
| extern void ped_timer_destroy_nested (PedTimer* timer); | | extern void ped_timer_destroy_nested (PedTimer* timer); | |
| | | | |
| extern void ped_timer_touch (PedTimer* timer); | | extern void ped_timer_touch (PedTimer* timer); | |
| extern void ped_timer_reset (PedTimer* timer); | | extern void ped_timer_reset (PedTimer* timer); | |
| extern void ped_timer_update (PedTimer* timer, float new_frac); | | extern void ped_timer_update (PedTimer* timer, float new_frac); | |
| extern void ped_timer_set_state_name (PedTimer* timer, const char* state_na
me); | | extern void ped_timer_set_state_name (PedTimer* timer, const char* state_na
me); | |
| | | | |
| #endif /* PED_TIMER_H_INCLUDED */ | | #endif /* PED_TIMER_H_INCLUDED */ | |
|
| | | | |
| | | /** @} */ | |
| | | | |
End of changes. 4 change blocks. |
| 11 lines changed or deleted | | 21 lines changed or added | |
|
| unit.h | | unit.h | |
| | | | |
| skipping to change at line 20 | | skipping to change at line 20 | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
| along with this program; if not, write to the Free Software | | along with this program; if not, write to the Free Software | |
| Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U
SA | | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, U
SA | |
| */ | | */ | |
| | | | |
|
| | | /** | |
| | | * \addtogroup PedUnit | |
| | | * @{ | |
| | | */ | |
| | | | |
| | | /** \file unit.h */ | |
| | | | |
| #ifndef PED_UNIT_H_INCLUDED | | #ifndef PED_UNIT_H_INCLUDED | |
| #define PED_UNIT_H_INCLUDED | | #define PED_UNIT_H_INCLUDED | |
| | | | |
| #include <parted/device.h> | | #include <parted/device.h> | |
| | | | |
| #include <stdarg.h> | | #include <stdarg.h> | |
| #include <stdio.h> | | #include <stdio.h> | |
| | | | |
|
| #define PED_SECTOR_SIZE 512LL | | #define PED_SECTOR_SIZE_DEFAULT 512LL | |
| #define PED_KILOBYTE_SIZE 1000LL | | #define PED_KILOBYTE_SIZE 1000LL | |
| #define PED_MEGABYTE_SIZE 1000000LL | | #define PED_MEGABYTE_SIZE 1000000LL | |
| #define PED_GIGABYTE_SIZE 1000000000LL | | #define PED_GIGABYTE_SIZE 1000000000LL | |
| #define PED_TERABYTE_SIZE 1000000000000LL | | #define PED_TERABYTE_SIZE 1000000000000LL | |
|
| | | #define PED_KIBIBYTE_SIZE 1024LL | |
| | | #define PED_MEBIBYTE_SIZE 1048576LL | |
| | | #define PED_GIBIBYTE_SIZE 1073741824LL | |
| | | #define PED_TEBIBYTE_SIZE 1099511627776LL | |
| | | | |
|
| | | /** | |
| | | * Human-friendly unit for representation of a location within device | |
| | | */ | |
| typedef enum { | | typedef enum { | |
| PED_UNIT_SECTOR, | | PED_UNIT_SECTOR, | |
| PED_UNIT_BYTE, | | PED_UNIT_BYTE, | |
| PED_UNIT_KILOBYTE, | | PED_UNIT_KILOBYTE, | |
| PED_UNIT_MEGABYTE, | | PED_UNIT_MEGABYTE, | |
| PED_UNIT_GIGABYTE, | | PED_UNIT_GIGABYTE, | |
| PED_UNIT_TERABYTE, | | PED_UNIT_TERABYTE, | |
| PED_UNIT_COMPACT, | | PED_UNIT_COMPACT, | |
| PED_UNIT_CYLINDER, | | PED_UNIT_CYLINDER, | |
| PED_UNIT_CHS, | | PED_UNIT_CHS, | |
|
| PED_UNIT_PERCENT | | PED_UNIT_PERCENT, | |
| | | PED_UNIT_KIBIBYTE, | |
| | | PED_UNIT_MEBIBYTE, | |
| | | PED_UNIT_GIBIBYTE, | |
| | | PED_UNIT_TEBIBYTE | |
| } PedUnit; | | } PedUnit; | |
| | | | |
| #define PED_UNIT_FIRST PED_UNIT_SECTOR | | #define PED_UNIT_FIRST PED_UNIT_SECTOR | |
|
| #define PED_UNIT_LAST PED_UNIT_PERCENT | | #define PED_UNIT_LAST PED_UNIT_TEBIBYTE | |
| | | | |
| extern long long ped_unit_get_size (PedDevice* dev, PedUnit unit); | | extern long long ped_unit_get_size (PedDevice* dev, PedUnit unit); | |
| extern const char* ped_unit_get_name (PedUnit unit); | | extern const char* ped_unit_get_name (PedUnit unit); | |
| extern PedUnit ped_unit_get_by_name (const char* unit_name); | | extern PedUnit ped_unit_get_by_name (const char* unit_name); | |
| | | | |
| extern void ped_unit_set_default (PedUnit unit); | | extern void ped_unit_set_default (PedUnit unit); | |
| extern PedUnit ped_unit_get_default (); | | extern PedUnit ped_unit_get_default (); | |
| | | | |
|
| | | extern char* ped_unit_format_byte (PedDevice* dev, PedSector byte); | |
| | | extern char* ped_unit_format_custom_byte (PedDevice* dev, PedSector byte, | |
| | | PedUnit unit); | |
| | | | |
| extern char* ped_unit_format (PedDevice* dev, PedSector sector); | | extern char* ped_unit_format (PedDevice* dev, PedSector sector); | |
| extern char* ped_unit_format_custom (PedDevice* dev, PedSector sector, | | extern char* ped_unit_format_custom (PedDevice* dev, PedSector sector, | |
| PedUnit unit); | | PedUnit unit); | |
| | | | |
| extern int ped_unit_parse (const char* str, PedDevice* dev, PedSector* sect
or, | | extern int ped_unit_parse (const char* str, PedDevice* dev, PedSector* sect
or, | |
| PedGeometry** range); | | PedGeometry** range); | |
| extern int ped_unit_parse_custom (const char* str, PedDevice* dev, | | extern int ped_unit_parse_custom (const char* str, PedDevice* dev, | |
| PedUnit unit, PedSector* sector, | | PedUnit unit, PedSector* sector, | |
| PedGeometry** range); | | PedGeometry** range); | |
| | | | |
| #endif /* PED_UNIT_H_INCLUDED */ | | #endif /* PED_UNIT_H_INCLUDED */ | |
|
| | | | |
| | | /** @} */ | |
| | | | |
End of changes. 8 change blocks. |
| 3 lines changed or deleted | | 25 lines changed or added | |
|