27#ifndef PED_DISK_H_INCLUDED
28#define PED_DISK_H_INCLUDED
51#define PED_DISK_FIRST_FLAG 1
52#define PED_DISK_LAST_FLAG 2
94#define PED_PARTITION_FIRST_FLAG 1
95#define PED_PARTITION_LAST_FLAG 22
106#define PED_DISK_TYPE_FIRST_FEATURE 1
107#define PED_DISK_TYPE_LAST_FEATURE 32
234 uint8_t* (*disk_get_uuid) (
const PedDisk* disk);
308#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
314#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
321#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
341#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
347#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
365#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
385#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
413#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
421#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
450#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
456#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
463#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
469#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
uint8_t type
Definition: dos.c:2
uint32_t start
Definition: dos.c:4
uint8_t uuid[16]
Definition: f2fs.h:27
long long PedSector
We can address 2^63 sectors.
Definition: device.h:31
void _ped_disk_free(PedDisk *disk)
Definition: disk.c:417
_PedDiskFlag
Disk flags.
Definition: disk.h:40
_PedDiskTypeFeature
Definition: disk.h:97
PedPartition * ped_disk_get_partition_by_sector(const PedDisk *disk, PedSector sect)
Returns the partition that contains sect.
Definition: disk.c:1784
bool ped_disk_get_max_supported_partition_count(const PedDisk *disk, int *supported)
Get the highest supported partition number on disk.
Definition: disk.c:710
int ped_disk_get_max_primary_partition_count(const PedDisk *disk)
Get the maximum number of (primary) partitions the disk label supports.
Definition: disk.c:745
const char * ped_disk_flag_get_name(PedDiskFlag flag)
Returns a name for a flag, e.g.
Definition: disk.c:837
PedSector ped_disk_max_partition_start_sector(const PedDisk *disk)
Return the maximum representable start sector of a partition on disk \disk.
Definition: disk.c:1819
_PedPartitionType
Partition types.
Definition: disk.h:57
uint8_t * ped_disk_get_uuid(const PedDisk *disk)
Get the uuid of the disk disk.
Definition: disk.c:909
PedPartition * ped_disk_extended_partition(const PedDisk *disk)
Definition: disk.c:1688
int ped_disk_type_check_feature(const PedDiskType *disk_type, PedDiskTypeFeature feature)
This function checks if a particular type of partition table supports a feature.
Definition: disk.c:657
int ped_disk_set_flag(PedDisk *disk, PedDiskFlag flag, int state)
Set the state (1 or 0) of a flag on a disk.
Definition: disk.c:764
int ped_disk_commit_to_dev(PedDisk *disk)
Write the changes made to the in-memory description of a partition table to the device.
Definition: disk.c:478
int ped_disk_remove_partition(PedDisk *disk, PedPartition *part)
Removes PedPartition part from PedDisk disk.
Definition: disk.c:2187
enum _PedPartitionFlag PedPartitionFlag
Definition: disk.h:117
int ped_disk_add_partition(PedDisk *disk, PedPartition *part, const PedConstraint *constraint)
Adds PedPartition part to PedDisk disk.
Definition: disk.c:2116
PedDisk * _ped_disk_alloc(const PedDevice *dev, const PedDiskType *type)
Definition: disk.c:397
int ped_disk_check(const PedDisk *disk)
Perform a sanity check on a partition table.
Definition: disk.c:599
PedGeometry * ped_disk_get_max_partition_geometry(PedDisk *disk, PedPartition *part, const PedConstraint *constraint)
Get the maximum geometry part can be grown to, subject to constraint.
Definition: disk.c:2418
int ped_disk_get_flag(const PedDisk *disk, PedDiskFlag flag)
Get the state (1 or 0) of a flag on a disk.
Definition: disk.c:798
PedAlignment * ped_disk_get_partition_alignment(const PedDisk *disk)
Get the alignment needed for partition boundaries on this disk.
Definition: disk.c:729
_PedPartitionFlag
Partition flags.
Definition: disk.h:69
int ped_disk_is_flag_available(const PedDisk *disk, PedDiskFlag flag)
Check whether a given flag is available on a disk.
Definition: disk.c:816
PedDiskFlag ped_disk_flag_get_by_name(const char *name)
Returns the flag associated with name.
Definition: disk.c:861
enum _PedDiskTypeFeature PedDiskTypeFeature
Definition: disk.h:118
int ped_disk_maximize_partition(PedDisk *disk, PedPartition *part, const PedConstraint *constraint)
Grow PedPartition part geometry to the maximum possible subject to constraint.
Definition: disk.c:2356
int ped_disk_delete_partition(PedDisk *disk, PedPartition *part)
Removes part from disk, and destroys part.
Definition: disk.c:2211
void ped_disk_destroy(PedDisk *disk)
Close disk.
Definition: disk.c:432
PedDiskType * ped_disk_type_get_next(PedDiskType const *type)
Return the next disk type registers, after "type".
Definition: disk.c:106
PedPartition * ped_disk_next_partition(const PedDisk *disk, const PedPartition *part)
Return the next partition after part on disk.
Definition: disk.c:1711
enum _PedPartitionType PedPartitionType
Definition: disk.h:116
PedDiskType * ped_disk_probe(PedDevice *dev)
Return the type of partition table detected on "dev".
Definition: disk.c:140
PedSector ped_disk_max_partition_length(const PedDisk *disk)
Return the maximum representable length (in sectors) of a partition on disk \disk.
Definition: disk.c:1809
PedPartition * ped_disk_get_partition(const PedDisk *disk, int num)
Returns the partition numbered num.
Definition: disk.c:1763
int ped_disk_get_last_partition_num(const PedDisk *disk)
Get the highest available partition number on disk.
Definition: disk.c:688
void ped_disk_type_unregister(PedDiskType *type)
Definition: disk.c:81
int ped_disk_commit_to_os(PedDisk *disk)
Tell the operating system kernel about the partition table layout of disk.
Definition: disk.c:454
PedDisk * ped_disk_duplicate(const PedDisk *old_disk)
Clone a PedDisk object.
Definition: disk.c:251
PedDisk * ped_disk_new(PedDevice *dev)
Read the partition table off a device (if one is found).
Definition: disk.c:181
int ped_disk_commit(PedDisk *disk)
Definition: disk.c:522
PedDiskFlag ped_disk_flag_next(PedDiskFlag flag)
Iterates through all disk flags.
Definition: disk.c:884
enum _PedDiskFlag PedDiskFlag
Definition: disk.h:115
int ped_disk_clobber(PedDevice *dev)
Remove all identifying signatures of a partition table,.
Definition: disk.c:311
int ped_disk_get_primary_partition_count(const PedDisk *disk)
Get the number of primary partitions.
Definition: disk.c:667
void ped_disk_type_register(PedDiskType *type)
Definition: disk.c:70
int ped_disk_delete_all(PedDisk *disk)
Removes and destroys all partitions on disk.
Definition: disk.c:2254
void ped_disk_print(const PedDisk *disk)
Prints a summary of disk's partitions.
Definition: disk.c:2657
int ped_disk_set_partition_geom(PedDisk *disk, PedPartition *part, const PedConstraint *constraint, PedSector start, PedSector end)
Sets the geometry of part (i.e.
Definition: disk.c:2292
PedDiskType * ped_disk_type_get(const char *name)
Return the disk type with a name of "name".
Definition: disk.c:120
int ped_disk_minimize_extended_partition(PedDisk *disk)
Reduce the size of the extended partition to a minimum while still wrapping its logical partitions.
Definition: disk.c:2455
PedDisk * ped_disk_new_fresh(PedDevice *dev, const PedDiskType *disk_type)
Create a new partition table on dev.
Definition: disk.c:369
@ PED_DISK_GPT_PMBR_BOOT
Definition: disk.h:48
@ PED_DISK_CYLINDER_ALIGNMENT
Definition: disk.h:46
@ PED_DISK_TYPE_PARTITION_UUID
supports partition uuids
Definition: disk.h:103
@ PED_DISK_TYPE_PARTITION_TYPE_UUID
supports partition type-uuids
Definition: disk.h:101
@ PED_DISK_TYPE_PARTITION_TYPE_ID
supports partition type-ids
Definition: disk.h:100
@ PED_DISK_TYPE_PARTITION_NAME
supports partition names
Definition: disk.h:99
@ PED_DISK_TYPE_EXTENDED
supports extended partitions
Definition: disk.h:98
@ PED_DISK_TYPE_DISK_UUID
supports disk uuids
Definition: disk.h:102
@ PED_PARTITION_METADATA
Definition: disk.h:62
@ PED_PARTITION_FREESPACE
Definition: disk.h:61
@ PED_PARTITION_PROTECTED
Definition: disk.h:63
@ PED_PARTITION_EXTENDED
Definition: disk.h:60
@ PED_PARTITION_LOGICAL
Definition: disk.h:59
@ PED_PARTITION_NORMAL
Definition: disk.h:58
@ PED_PARTITION_SWAP
Definition: disk.h:72
@ PED_PARTITION_MSFT_DATA
Definition: disk.h:85
@ PED_PARTITION_PREP
Definition: disk.h:79
@ PED_PARTITION_CHROMEOS_KERNEL
Definition: disk.h:88
@ PED_PARTITION_RAID
Definition: disk.h:74
@ PED_PARTITION_BLS_BOOT
Definition: disk.h:89
@ PED_PARTITION_LINUX_HOME
Definition: disk.h:90
@ PED_PARTITION_BOOT
Definition: disk.h:70
@ PED_PARTITION_HPSERVICE
Definition: disk.h:77
@ PED_PARTITION_HIDDEN
Definition: disk.h:73
@ PED_PARTITION_MSFT_RESERVED
Definition: disk.h:80
@ PED_PARTITION_DIAG
Definition: disk.h:83
@ PED_PARTITION_NO_AUTOMOUNT
Definition: disk.h:91
@ PED_PARTITION_LVM
Definition: disk.h:75
@ PED_PARTITION_ROOT
Definition: disk.h:71
@ PED_PARTITION_ESP
Definition: disk.h:87
@ PED_PARTITION_BIOS_GRUB
Definition: disk.h:81
@ PED_PARTITION_LBA
Definition: disk.h:76
@ PED_PARTITION_LEGACY_BOOT
Definition: disk.h:84
@ PED_PARTITION_PALO
Definition: disk.h:78
@ PED_PARTITION_APPLE_TV_RECOVERY
Definition: disk.h:82
@ PED_PARTITION_IRST
Definition: disk.h:86
int ped_partition_set_name(PedPartition *part, const char *name)
Sets the name of a partition.
Definition: disk.c:1553
const char * ped_partition_type_get_name(PedPartitionType part_type)
Returns a name that seems mildly appropriate for a partition type type.
Definition: disk.c:2517
PedPartitionFlag ped_partition_flag_next(PedPartitionFlag flag)
Iterates through all flags.
Definition: disk.c:2606
void _ped_partition_free(PedPartition *part)
Definition: disk.c:1253
int ped_partition_is_active(const PedPartition *part)
Return whether or not the partition is "active".
Definition: disk.c:1366
int ped_partition_is_busy(const PedPartition *part)
Check whether a partition is mounted or busy in some other way.
Definition: disk.c:560
int ped_partition_set_type_id(PedPartition *part, uint8_t id)
Set the type-id of the partition part.
Definition: disk.c:1594
PedPartition * ped_partition_new(const PedDisk *disk, PedPartitionType type, const PedFileSystemType *fs_type, PedSector start, PedSector end)
Create a new PedPartition on disk.
Definition: disk.c:1301
void ped_partition_destroy(PedPartition *part)
Destroy a PedPartition object.
Definition: disk.c:1349
int _ped_partition_attempt_align(PedPartition *part, const PedConstraint *external, PedConstraint *internal)
Definition: disk.c:1259
uint8_t ped_partition_get_type_id(const PedPartition *part)
Get the type-id of the partition part.
Definition: disk.c:1612
PedPartition * _ped_partition_alloc(const PedDisk *disk, PedPartitionType type, const PedFileSystemType *fs_type, PedSector start, PedSector end)
Definition: disk.c:1220
int ped_partition_set_system(PedPartition *part, const PedFileSystemType *fs_type)
Sets the system type on the partition to fs_type.
Definition: disk.c:1462
int ped_partition_is_flag_available(const PedPartition *part, PedPartitionFlag flag)
Check whether a given flag is available on a partition.
Definition: disk.c:1442
const char * ped_partition_flag_get_name(PedPartitionFlag flag)
Returns a name for a flag, e.g.
Definition: disk.c:2540
uint8_t * ped_partition_get_uuid(const PedPartition *part)
Get the uuid of the partition part.
Definition: disk.c:1666
char * ped_partition_get_path(const PedPartition *part)
Return a path that can be used to address the partition in the operating system.
Definition: disk.c:572
int ped_partition_get_flag(const PedPartition *part, PedPartitionFlag flag)
Get the state (1 or 0) of a flag on a partition.
Definition: disk.c:1426
const char * ped_partition_get_name(const PedPartition *part)
Returns the name of a partition part.
Definition: disk.c:1576
int ped_partition_set_type_uuid(PedPartition *part, const uint8_t *uuid)
Set the type-uuid of the partition part.
Definition: disk.c:1630
uint8_t * ped_partition_get_type_uuid(const PedPartition *part)
Get the type-uuid of the partition part.
Definition: disk.c:1648
PedPartitionFlag ped_partition_flag_get_by_name(const char *name)
Returns the flag associated with name.
Definition: disk.c:2618
int ped_partition_set_flag(PedPartition *part, PedPartitionFlag flag, int state)
Set the state (1 or 0) of a flag on a partition.
Definition: disk.c:1393
#define __attribute(arg)
Definition: parted.h:32
char name[16]
Definition: pc98.c:13
Definition: constraint.h:29
A block device - for example, /dev/hda, not /dev/hda3.
Definition: device.h:74
Architecture-specific operations.
Definition: disk.h:297
int(* disk_commit)(PedDisk *disk)
Definition: disk.h:300
int(* partition_is_busy)(const PedPartition *part)
Definition: disk.h:299
int(* partition_set_flag)(PedPartition *part, PedPartitionFlag flag, int state)
Definition: disk.h:248
int(* disk_set_flag)(PedDisk *disk, PedDiskFlag flag, int state)
Definition: disk.h:224
void(* partition_set_name)(PedPartition *part, const char *name)
Definition: disk.h:258
bool(* partition_check)(const PedPartition *part)
Definition: disk.h:272
int(* disk_is_flag_available)(const PedDisk *disk, PedDiskFlag flag)
Definition: disk.h:231
int(* probe)(const PedDevice *dev)
Definition: disk.h:217
int(* disk_get_flag)(const PedDisk *disk, PedDiskFlag flag)
Definition: disk.h:228
void(* free)(PedDisk *disk)
Definition: disk.h:221
int(* get_max_primary_partition_count)(const PedDisk *disk)
Definition: disk.h:276
int(* partition_set_type_uuid)(PedPartition *part, const uint8_t *uuid)
Definition: disk.h:264
PedSector(* max_length)(void)
Definition: disk.h:280
int(* clobber)(PedDevice *dev)
Definition: disk.h:218
int(* write)(const PedDisk *disk)
Definition: disk.h:223
int(* partition_get_flag)(const PedPartition *part, PedPartitionFlag flag)
Definition: disk.h:252
int(* alloc_metadata)(PedDisk *disk)
Definition: disk.h:275
bool(* get_max_supported_partition_count)(const PedDisk *disk, int *supported)
Definition: disk.h:277
int(* partition_enumerate)(PedPartition *part)
Definition: disk.h:271
int(* partition_set_system)(PedPartition *part, const PedFileSystemType *fs_type)
Definition: disk.h:246
int(* partition_is_flag_available)(const PedPartition *part, PedPartitionFlag flag)
Definition: disk.h:255
int(* read)(PedDisk *disk)
Definition: disk.h:222
int(* partition_set_type_id)(PedPartition *part, uint8_t id)
Definition: disk.h:261
int(* partition_align)(PedPartition *part, const PedConstraint *constraint)
Definition: disk.h:269
void(* partition_destroy)(PedPartition *part)
Definition: disk.h:245
uint8_t(* partition_get_type_id)(const PedPartition *part)
Definition: disk.h:262
PedSector(* max_start_sector)(void)
Definition: disk.h:281
PedDiskOps *const ops
Definition: disk.h:288
PedDiskTypeFeature features
bitmap of supported features
Definition: disk.h:290
PedDiskType * next
Definition: disk.h:285
const char * name
the name of the partition table type.
Definition: disk.h:286
Represents a disk label (partition table).
Definition: disk.h:197
const PedDiskType * type
type of disk label
Definition: disk.h:200
int needs_clobber
clobber before write?
Definition: disk.h:209
int update_mode
mode without free/metadata partitions, for easier update
Definition: disk.h:210
void * disk_specific
Definition: disk.h:206
const int * block_sizes
block sizes supported by this label
Definition: disk.h:201
PedDevice * dev
the device where the partition table lies
Definition: disk.h:198
PedPartition * part_list
list of partitions.
Definition: disk.h:203
Structure describing type of file system.
Definition: filesys.h:46
Geometry of the partition.
Definition: geom.h:35
PedPartition structure represents a partition.
Definition: disk.h:144
PedDisk * disk
Definition: disk.h:149
PedPartitionType type
the type of partition: a bit field of PED_PARTITION_LOGICAL, PED_PARTITION_EXTENDED,...
Definition: disk.h:158
PedGeometry geom
geometry of the partition
Definition: disk.h:150
PedPartition * part_list
Definition: disk.h:182
int num
Definition: disk.h:157
const PedFileSystemType * fs_type
Only used for an extended partition.
Definition: disk.h:177
void * disk_specific
Definition: disk.h:184
PedPartition * next
the partition table of the partition
Definition: disk.h:146
PedPartition * prev
Definition: disk.h:145