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)
struct _PedConstraint PedConstraint
Definition constraint.h:23
uint8_t type
Definition dos.c:2
uint32_t start
Definition dos.c:4
uint8_t uuid[16]
Definition f2fs.h:27
struct _PedAlignment PedAlignment
Definition natmath.h:31
long long PedSector
We can address 2^63 sectors.
Definition device.h:31
struct _PedDevice PedDevice
Definition device.h:58
void _ped_disk_free(PedDisk *disk)
Definition disk.c:423
_PedDiskFlag
Disk flags.
Definition disk.h:40
_PedDiskTypeFeature
Definition disk.h:97
struct _PedPartition PedPartition
Definition disk.h:120
PedPartition * ped_disk_get_partition_by_sector(const PedDisk *disk, PedSector sect)
Returns the partition that contains sect.
Definition disk.c:1790
const struct _PedDiskArchOps PedDiskArchOps
Definition disk.h:123
bool ped_disk_get_max_supported_partition_count(const PedDisk *disk, int *supported)
Get the highest supported partition number on disk.
Definition disk.c:716
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:751
const char * ped_disk_flag_get_name(PedDiskFlag flag)
Returns a name for a flag, e.g.
Definition disk.c:843
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:1825
_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:915
PedPartition * ped_disk_extended_partition(const PedDisk *disk)
Definition disk.c:1694
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:663
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:770
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:484
int ped_disk_remove_partition(PedDisk *disk, PedPartition *part)
Removes PedPartition part from PedDisk disk.
Definition disk.c:2193
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:2122
PedDisk * _ped_disk_alloc(const PedDevice *dev, const PedDiskType *type)
Definition disk.c:403
int ped_disk_check(const PedDisk *disk)
Perform a sanity check on a partition table.
Definition disk.c:605
struct _PedDiskType PedDiskType
Definition disk.h:122
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:2424
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:804
PedAlignment * ped_disk_get_partition_alignment(const PedDisk *disk)
Get the alignment needed for partition boundaries on this disk.
Definition disk.c:735
_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:822
PedDiskFlag ped_disk_flag_get_by_name(const char *name)
Returns the flag associated with name.
Definition disk.c:867
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:2362
int ped_disk_delete_partition(PedDisk *disk, PedPartition *part)
Removes part from disk, and destroys part.
Definition disk.c:2217
void ped_disk_destroy(PedDisk *disk)
Close disk.
Definition disk.c:438
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:1717
struct _PedDisk PedDisk
Definition disk.h:119
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:1815
PedPartition * ped_disk_get_partition(const PedDisk *disk, int num)
Returns the partition numbered num.
Definition disk.c:1769
int ped_disk_get_last_partition_num(const PedDisk *disk)
Get the highest available partition number on disk.
Definition disk.c:694
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:460
PedDisk * ped_disk_duplicate(const PedDisk *old_disk)
Clone a PedDisk object.
Definition disk.c:257
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:528
PedDiskFlag ped_disk_flag_next(PedDiskFlag flag)
Iterates through all disk flags.
Definition disk.c:890
enum _PedDiskFlag PedDiskFlag
Definition disk.h:115
const struct _PedDiskOps PedDiskOps
Definition disk.h:121
int ped_disk_clobber(PedDevice *dev)
Remove all identifying signatures of a partition table,.
Definition disk.c:317
int ped_disk_get_primary_partition_count(const PedDisk *disk)
Get the number of primary partitions.
Definition disk.c:673
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:2260
void ped_disk_print(const PedDisk *disk)
Prints a summary of disk's partitions.
Definition disk.c:2663
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:2298
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:2461
PedDisk * ped_disk_new_fresh(PedDevice *dev, const PedDiskType *disk_type)
Create a new partition table on dev.
Definition disk.c:375
@ 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
struct _PedFileSystemType PedFileSystemType
Definition filesys.h:31
struct _PedGeometry PedGeometry
Definition geom.h:30
int ped_partition_set_name(PedPartition *part, const char *name)
Sets the name of a partition.
Definition disk.c:1559
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:2523
PedPartitionFlag ped_partition_flag_next(PedPartitionFlag flag)
Iterates through all flags.
Definition disk.c:2612
void _ped_partition_free(PedPartition *part)
Definition disk.c:1259
int ped_partition_is_active(const PedPartition *part)
Return whether or not the partition is "active".
Definition disk.c:1372
int ped_partition_is_busy(const PedPartition *part)
Check whether a partition is mounted or busy in some other way.
Definition disk.c:566
int ped_partition_set_type_id(PedPartition *part, uint8_t id)
Set the type-id of the partition part.
Definition disk.c:1600
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:1307
void ped_partition_destroy(PedPartition *part)
Destroy a PedPartition object.
Definition disk.c:1355
int _ped_partition_attempt_align(PedPartition *part, const PedConstraint *external, PedConstraint *internal)
Definition disk.c:1265
uint8_t ped_partition_get_type_id(const PedPartition *part)
Get the type-id of the partition part.
Definition disk.c:1618
PedPartition * _ped_partition_alloc(const PedDisk *disk, PedPartitionType type, const PedFileSystemType *fs_type, PedSector start, PedSector end)
Definition disk.c:1226
int ped_partition_set_system(PedPartition *part, const PedFileSystemType *fs_type)
Sets the system type on the partition to fs_type.
Definition disk.c:1468
int ped_partition_is_flag_available(const PedPartition *part, PedPartitionFlag flag)
Check whether a given flag is available on a partition.
Definition disk.c:1448
const char * ped_partition_flag_get_name(PedPartitionFlag flag)
Returns a name for a flag, e.g.
Definition disk.c:2546
uint8_t * ped_partition_get_uuid(const PedPartition *part)
Get the uuid of the partition part.
Definition disk.c:1672
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:578
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:1432
const char * ped_partition_get_name(const PedPartition *part)
Returns the name of a partition part.
Definition disk.c:1582
int ped_partition_set_type_uuid(PedPartition *part, const uint8_t *uuid)
Set the type-uuid of the partition part.
Definition disk.c:1636
uint8_t * ped_partition_get_type_uuid(const PedPartition *part)
Get the type-uuid of the partition part.
Definition disk.c:1654
PedPartitionFlag ped_partition_flag_get_by_name(const char *name)
Returns the flag associated with name.
Definition disk.c:2624
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:1399
#define __attribute(arg)
Definition parted.h:32
char name[16]
Definition pc98.c:13
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
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