Loading...
Searching...
No Matches
PedDisk

## Topics

| PedPartition

## Files

file | disk.h

## Data Structures

struct | _PedDisk
| Represents a disk label (partition table). More...
struct | _PedDiskArchOps
| Architecture-specific operations. More...
struct | _PedDiskOps
struct | _PedDiskType

## Macros

#define | _(String)
#define | N_(String)
#define | PED_DISK_FIRST_FLAG 1
#define | PED_DISK_FIRST_FLAG 1
#define | PED_DISK_LAST_FLAG 2
#define | PED_DISK_LAST_FLAG 2
#define | PED_DISK_TYPE_FIRST_FEATURE 1
#define | PED_DISK_TYPE_FIRST_FEATURE 1
#define | PED_DISK_TYPE_LAST_FEATURE 32
#define | PED_DISK_TYPE_LAST_FEATURE 32
#define | PED_PARTITION_FIRST_FLAG 1
#define | PED_PARTITION_FIRST_FLAG 1
#define | PED_PARTITION_LAST_FLAG 22
#define | PED_PARTITION_LAST_FLAG 22

## Typedefs

typedef struct _PedDisk | PedDisk
typedef struct _PedDisk | PedDisk
typedef const struct _PedDiskArchOps | PedDiskArchOps
typedef const struct _PedDiskArchOps | PedDiskArchOps
typedef enum _PedDiskFlag | PedDiskFlag
typedef enum _PedDiskFlag | PedDiskFlag
typedef const struct _PedDiskOps | PedDiskOps
typedef const struct _PedDiskOps | PedDiskOps
typedef struct _PedDiskType | PedDiskType
typedef struct _PedDiskType | PedDiskType
typedef enum _PedDiskTypeFeature | PedDiskTypeFeature
typedef enum _PedDiskTypeFeature | PedDiskTypeFeature
typedef struct _PedPartition | PedPartition
typedef struct _PedPartition | PedPartition
typedef enum _PedPartitionFlag | PedPartitionFlag
typedef enum _PedPartitionFlag | PedPartitionFlag
typedef enum _PedPartitionType | PedPartitionType
typedef enum _PedPartitionType | PedPartitionType

## Enumerations

enum | _PedDiskFlag { PED_DISK_CYLINDER_ALIGNMENT =1 , PED_DISK_GPT_PMBR_BOOT =2 }
| Disk flags. More...
enum | _PedDiskFlag { PED_DISK_CYLINDER_ALIGNMENT =1 , PED_DISK_GPT_PMBR_BOOT =2 }
| Disk flags. More...
enum | _PedDiskTypeFeature { PED_DISK_TYPE_EXTENDED =1 , PED_DISK_TYPE_PARTITION_NAME =2 , PED_DISK_TYPE_PARTITION_TYPE_ID =4 , PED_DISK_TYPE_PARTITION_TYPE_UUID =8 , PED_DISK_TYPE_DISK_UUID =16 , PED_DISK_TYPE_PARTITION_UUID =32 }
enum | _PedDiskTypeFeature { PED_DISK_TYPE_EXTENDED =1 , PED_DISK_TYPE_PARTITION_NAME =2 , PED_DISK_TYPE_PARTITION_TYPE_ID =4 , PED_DISK_TYPE_PARTITION_TYPE_UUID =8 , PED_DISK_TYPE_DISK_UUID =16 , PED_DISK_TYPE_PARTITION_UUID =32 }

enum

_PedPartitionFlag {
PED_PARTITION_BOOT =1 , PED_PARTITION_ROOT =2 , PED_PARTITION_SWAP =3 , PED_PARTITION_HIDDEN =4 ,
PED_PARTITION_RAID =5 , PED_PARTITION_LVM =6 , PED_PARTITION_LBA =7 , PED_PARTITION_HPSERVICE =8 ,
PED_PARTITION_PALO =9 , PED_PARTITION_PREP =10 , PED_PARTITION_MSFT_RESERVED =11 , PED_PARTITION_BIOS_GRUB =12 ,
PED_PARTITION_APPLE_TV_RECOVERY =13 , PED_PARTITION_DIAG =14 , PED_PARTITION_LEGACY_BOOT =15 , PED_PARTITION_MSFT_DATA =16 ,
PED_PARTITION_IRST =17 , PED_PARTITION_ESP =18 , PED_PARTITION_CHROMEOS_KERNEL =19 , PED_PARTITION_BLS_BOOT =20 ,
PED_PARTITION_LINUX_HOME =21 , PED_PARTITION_NO_AUTOMOUNT =22
}

| Partition flags. More...

enum

_PedPartitionFlag {
PED_PARTITION_BOOT =1 , PED_PARTITION_ROOT =2 , PED_PARTITION_SWAP =3 , PED_PARTITION_HIDDEN =4 ,
PED_PARTITION_RAID =5 , PED_PARTITION_LVM =6 , PED_PARTITION_LBA =7 , PED_PARTITION_HPSERVICE =8 ,
PED_PARTITION_PALO =9 , PED_PARTITION_PREP =10 , PED_PARTITION_MSFT_RESERVED =11 , PED_PARTITION_BIOS_GRUB =12 ,
PED_PARTITION_APPLE_TV_RECOVERY =13 , PED_PARTITION_DIAG =14 , PED_PARTITION_LEGACY_BOOT =15 , PED_PARTITION_MSFT_DATA =16 ,
PED_PARTITION_IRST =17 , PED_PARTITION_ESP =18 , PED_PARTITION_CHROMEOS_KERNEL =19 , PED_PARTITION_BLS_BOOT =20 ,
PED_PARTITION_LINUX_HOME =21 , PED_PARTITION_NO_AUTOMOUNT =22
}

| Partition flags. More...
enum | _PedPartitionType { PED_PARTITION_NORMAL = 0x00 , PED_PARTITION_LOGICAL = 0x01 , PED_PARTITION_EXTENDED = 0x02 , PED_PARTITION_FREESPACE = 0x04 , PED_PARTITION_METADATA = 0x08 , PED_PARTITION_PROTECTED = 0x10 }
| Partition types. More...
enum | _PedPartitionType { PED_PARTITION_NORMAL = 0x00 , PED_PARTITION_LOGICAL = 0x01 , PED_PARTITION_EXTENDED = 0x02 , PED_PARTITION_FREESPACE = 0x04 , PED_PARTITION_METADATA = 0x08 , PED_PARTITION_PROTECTED = 0x10 }
| Partition types. More...

## Functions

PedDisk * | _ped_disk_alloc (const PedDevice *dev, const PedDiskType *type)
void | _ped_disk_free (PedDisk *disk)
int | ped_disk_add_partition (PedDisk *disk, PedPartition *part, const PedConstraint *constraint)
| Adds PedPartition `part` to PedDisk `disk`.
int | ped_disk_check (const PedDisk *disk)
| Perform a sanity check on a partition table.
int | ped_disk_clobber (PedDevice *dev)
| Remove all identifying signatures of a partition table,.
int | ped_disk_commit (PedDisk *disk)
int | ped_disk_commit_to_dev (PedDisk *disk)
| Write the changes made to the in-memory description of a partition table to the device.
int | ped_disk_commit_to_os (PedDisk *disk)
| Tell the operating system kernel about the partition table layout of `disk`.
int | ped_disk_delete_all (PedDisk *disk)
| Removes and destroys all partitions on `disk`.
int | ped_disk_delete_partition (PedDisk *disk, PedPartition *part)
| Removes `part` from `disk`, and destroys `part`.
void | ped_disk_destroy (PedDisk *disk)
| Close `disk`.
PedDisk * | ped_disk_duplicate (const PedDisk *old_disk)
| Clone a PedDisk object.
PedPartition * | ped_disk_extended_partition (const PedDisk *disk)
PedDiskFlag | ped_disk_flag_get_by_name (const char *name)
| Returns the flag associated with `name`.
const char * | ped_disk_flag_get_name (PedDiskFlag flag)
| Returns a name for a `flag`, e.g.
PedDiskFlag | ped_disk_flag_next (PedDiskFlag flag)
| Iterates through all disk flags.
int | ped_disk_get_flag (const PedDisk *disk, PedDiskFlag flag)
| Get the state (`1` or `0`) of a flag on a disk.
int | ped_disk_get_last_partition_num (const PedDisk *disk)
| Get the highest available partition number on `disk`.
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`.
int | ped_disk_get_max_primary_partition_count (const PedDisk *disk)
| Get the maximum number of (primary) partitions the disk label supports.
bool | ped_disk_get_max_supported_partition_count (const PedDisk *disk, int *supported)
| Get the highest supported partition number on `disk`.
PedPartition * | ped_disk_get_partition (const PedDisk *disk, int num)
| Returns the partition numbered `num`.
PedAlignment * | ped_disk_get_partition_alignment (const PedDisk *disk)
| Get the alignment needed for partition boundaries on this disk.
PedPartition * | ped_disk_get_partition_by_sector (const PedDisk *disk, PedSector sect)
| Returns the partition that contains sect.
int | ped_disk_get_primary_partition_count (const PedDisk *disk)
| Get the number of primary partitions.
uint8_t * | ped_disk_get_uuid (const PedDisk *disk)
| Get the uuid of the disk `disk`.
int | ped_disk_is_flag_available (const PedDisk *disk, PedDiskFlag flag)
| Check whether a given flag is available on a disk.
PedSector | ped_disk_max_partition_length (const PedDisk *disk)
| Return the maximum representable length (in sectors) of a partition on disk \disk.
PedSector | ped_disk_max_partition_start_sector (const PedDisk *disk)
| Return the maximum representable start sector of a partition on disk \disk.
int | ped_disk_maximize_partition (PedDisk *disk, PedPartition *part, const PedConstraint *constraint)
| Grow PedPartition `part` geometry to the maximum possible subject to `constraint`.
int | ped_disk_minimize_extended_partition (PedDisk *disk)
| Reduce the size of the extended partition to a minimum while still wrapping its logical partitions.
PedDisk * | ped_disk_new (PedDevice *dev)
| Read the partition table off a device (if one is found).
PedDisk * | ped_disk_new_fresh (PedDevice *dev, const PedDiskType *type)
| Create a new partition table on `dev`.
PedPartition * | ped_disk_next_partition (const PedDisk *disk, const PedPartition *part)
| Return the next partition after `part` on `disk`.
void | ped_disk_print (const PedDisk *disk)
| Prints a summary of disk's partitions.
PedDiskType * | ped_disk_probe (PedDevice *dev)
| Return the type of partition table detected on "dev".
int | ped_disk_remove_partition (PedDisk *disk, PedPartition *part)
| Removes PedPartition `part` from PedDisk `disk`.
int | ped_disk_set_flag (PedDisk *disk, PedDiskFlag flag, int state)
| Set the state (`1` or `0`) of a flag on a disk.
int | ped_disk_set_partition_geom (PedDisk *disk, PedPartition *part, const PedConstraint *constraint, PedSector start, PedSector end)
| Sets the geometry of `part` (i.e.
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.
PedDiskType * | ped_disk_type_get (const char *name)
| Return the disk type with a name of "name".
PedDiskType * | ped_disk_type_get_next (PedDiskType const *type)
| Return the next disk type registers, after "type".
void | ped_disk_type_register (PedDiskType *type)
void | ped_disk_type_unregister (PedDiskType *type)

## Detailed Description

Disk label access.

Most programs will need to use ped_disk_new() or ped_disk_new_fresh() to get anything done. A PedDisk is always associated with a device and has a partition table. There are different types of partition tables (or disk labels). These are represented by the PedDiskType enumeration.

## Macro Definition Documentation

## _

#define _ | ( |  | String | ) |

Value:
(String)

## N_

#define N_ | ( |  | String | ) |

Value:
(String)

## PED_DISK_FIRST_FLAG [1/2]

#define PED_DISK_FIRST_FLAG 1

## PED_DISK_FIRST_FLAG [2/2]

#define PED_DISK_FIRST_FLAG 1

## PED_DISK_LAST_FLAG [1/2]

#define PED_DISK_LAST_FLAG 2

## PED_DISK_LAST_FLAG [2/2]

#define PED_DISK_LAST_FLAG 2

## PED_DISK_TYPE_FIRST_FEATURE [1/2]

#define PED_DISK_TYPE_FIRST_FEATURE 1

## PED_DISK_TYPE_FIRST_FEATURE [2/2]

#define PED_DISK_TYPE_FIRST_FEATURE 1

## PED_DISK_TYPE_LAST_FEATURE [1/2]

#define PED_DISK_TYPE_LAST_FEATURE 32

## PED_DISK_TYPE_LAST_FEATURE [2/2]

#define PED_DISK_TYPE_LAST_FEATURE 32

## PED_PARTITION_FIRST_FLAG [1/2]

#define PED_PARTITION_FIRST_FLAG 1

## PED_PARTITION_FIRST_FLAG [2/2]

#define PED_PARTITION_FIRST_FLAG 1

## PED_PARTITION_LAST_FLAG [1/2]

#define PED_PARTITION_LAST_FLAG 22

## PED_PARTITION_LAST_FLAG [2/2]

#define PED_PARTITION_LAST_FLAG 22

## Typedef Documentation

## PedDisk [1/2]

typedef struct _PedDisk PedDisk

## PedDisk [2/2]

typedef struct _PedDisk PedDisk

## PedDiskArchOps [1/2]

typedef const struct _PedDiskArchOps PedDiskArchOps

## PedDiskArchOps [2/2]

typedef const struct _PedDiskArchOps PedDiskArchOps

## PedDiskFlag [1/2]

typedef enum _PedDiskFlag PedDiskFlag

## PedDiskFlag [2/2]

typedef enum _PedDiskFlag PedDiskFlag

## PedDiskOps [1/2]

typedef const struct _PedDiskOps PedDiskOps

## PedDiskOps [2/2]

typedef const struct _PedDiskOps PedDiskOps

## PedDiskType [1/2]

typedef struct _PedDiskType PedDiskType

## PedDiskType [2/2]

typedef struct _PedDiskType PedDiskType

## PedDiskTypeFeature [1/2]

typedef enum _PedDiskTypeFeature PedDiskTypeFeature

## PedDiskTypeFeature [2/2]

typedef enum _PedDiskTypeFeature PedDiskTypeFeature

## PedPartition [1/2]

typedef struct _PedPartition PedPartition

## PedPartition [2/2]

typedef struct _PedPartition PedPartition

## PedPartitionFlag [1/2]

typedef enum _PedPartitionFlag PedPartitionFlag

## PedPartitionFlag [2/2]

typedef enum _PedPartitionFlag PedPartitionFlag

## PedPartitionType [1/2]

typedef enum _PedPartitionType PedPartitionType

## PedPartitionType [2/2]

typedef enum _PedPartitionType PedPartitionType

## Enumeration Type Documentation

## _PedDiskFlag [1/2]

enum _PedDiskFlag

Disk flags.

Enumerator
PED_DISK_CYLINDER_ALIGNMENT |
PED_DISK_GPT_PMBR_BOOT |

## _PedDiskFlag [2/2]

enum _PedDiskFlag

Disk flags.

Enumerator
PED_DISK_CYLINDER_ALIGNMENT |
PED_DISK_GPT_PMBR_BOOT |

## _PedDiskTypeFeature [1/2]

enum _PedDiskTypeFeature

Enumerator
PED_DISK_TYPE_EXTENDED | supports extended partitions
PED_DISK_TYPE_PARTITION_NAME | supports partition names
PED_DISK_TYPE_PARTITION_TYPE_ID | supports partition type-ids
PED_DISK_TYPE_PARTITION_TYPE_UUID | supports partition type-uuids
PED_DISK_TYPE_DISK_UUID | supports disk uuids
PED_DISK_TYPE_PARTITION_UUID | supports partition uuids

## _PedDiskTypeFeature [2/2]

enum _PedDiskTypeFeature

Enumerator
PED_DISK_TYPE_EXTENDED | supports extended partitions
PED_DISK_TYPE_PARTITION_NAME | supports partition names
PED_DISK_TYPE_PARTITION_TYPE_ID | supports partition type-ids
PED_DISK_TYPE_PARTITION_TYPE_UUID | supports partition type-uuids
PED_DISK_TYPE_DISK_UUID | supports disk uuids
PED_DISK_TYPE_PARTITION_UUID | supports partition uuids

## _PedPartitionFlag [1/2]

enum _PedPartitionFlag

Partition flags.

Enumerator
PED_PARTITION_BOOT |
PED_PARTITION_ROOT |
PED_PARTITION_SWAP |
PED_PARTITION_HIDDEN |
PED_PARTITION_RAID |
PED_PARTITION_LVM |
PED_PARTITION_LBA |
PED_PARTITION_HPSERVICE |
PED_PARTITION_PALO |
PED_PARTITION_PREP |
PED_PARTITION_MSFT_RESERVED |
PED_PARTITION_BIOS_GRUB |
PED_PARTITION_APPLE_TV_RECOVERY |
PED_PARTITION_DIAG |
PED_PARTITION_LEGACY_BOOT |
PED_PARTITION_MSFT_DATA |
PED_PARTITION_IRST |
PED_PARTITION_ESP |
PED_PARTITION_CHROMEOS_KERNEL |
PED_PARTITION_BLS_BOOT |
PED_PARTITION_LINUX_HOME |
PED_PARTITION_NO_AUTOMOUNT |

## _PedPartitionFlag [2/2]

enum _PedPartitionFlag

Partition flags.

Enumerator
PED_PARTITION_BOOT |
PED_PARTITION_ROOT |
PED_PARTITION_SWAP |
PED_PARTITION_HIDDEN |
PED_PARTITION_RAID |
PED_PARTITION_LVM |
PED_PARTITION_LBA |
PED_PARTITION_HPSERVICE |
PED_PARTITION_PALO |
PED_PARTITION_PREP |
PED_PARTITION_MSFT_RESERVED |
PED_PARTITION_BIOS_GRUB |
PED_PARTITION_APPLE_TV_RECOVERY |
PED_PARTITION_DIAG |
PED_PARTITION_LEGACY_BOOT |
PED_PARTITION_MSFT_DATA |
PED_PARTITION_IRST |
PED_PARTITION_ESP |
PED_PARTITION_CHROMEOS_KERNEL |
PED_PARTITION_BLS_BOOT |
PED_PARTITION_LINUX_HOME |
PED_PARTITION_NO_AUTOMOUNT |

## _PedPartitionType [1/2]

enum _PedPartitionType

Partition types.

Enumerator
PED_PARTITION_NORMAL |
PED_PARTITION_LOGICAL |
PED_PARTITION_EXTENDED |
PED_PARTITION_FREESPACE |
PED_PARTITION_METADATA |
PED_PARTITION_PROTECTED |

## _PedPartitionType [2/2]

enum _PedPartitionType

Partition types.

Enumerator
PED_PARTITION_NORMAL |
PED_PARTITION_LOGICAL |
PED_PARTITION_EXTENDED |
PED_PARTITION_FREESPACE |
PED_PARTITION_METADATA |
PED_PARTITION_PROTECTED |

## Function Documentation

## _ped_disk_alloc()

PedDisk * _ped_disk_alloc | ( | const PedDevice * | dev,
|  | const PedDiskType * | type )

extern

## _ped_disk_free()

void _ped_disk_free | ( | PedDisk * | disk | ) |

extern

## ped_disk_add_partition()

int ped_disk_add_partition | ( | PedDisk * | disk,
|  | PedPartition * | part,
|  | const PedConstraint * | constraint )

extern

Adds PedPartition `part` to PedDisk `disk`.

Warning
  The partition's geometry may be changed, subject to `constraint`. You could set `constraint` to ped_constraint_exact(&part->geom), but many partition table schemes have special requirements on the start and end of partitions. Therefore, having an overly strict constraint will probably mean that this function will fail (in which case `part` will be left unmodified) `part` is assigned a number (`part->num`) in this process.

Returns
  `0` on failure.

## ped_disk_check()

int ped_disk_check | ( | const PedDisk * | disk | ) |

extern

Perform a sanity check on a partition table.

Note
  The check performed is generic (i.e. it does not depends on the label type of the disk.

Exceptions

  PED_EXCEPTION_WARNING | if a partition type ID does not match the file system on it.

Returns
  0 if the check fails, 1 otherwise.

## ped_disk_clobber()

int ped_disk_clobber | ( | PedDevice * | dev | ) |

extern

Remove all identifying signatures of a partition table,.

Returns
  0 on error, 1 otherwise.

See also
  ped_disk_clobber()

## ped_disk_commit()

int ped_disk_commit | ( | PedDisk * | disk | ) |

extern

## ped_disk_commit_to_dev()

int ped_disk_commit_to_dev | ( | PedDisk * | disk | ) |

extern

Write the changes made to the in-memory description of a partition table to the device.

Returns
  0 on failure, 1 otherwise.

## ped_disk_commit_to_os()

int ped_disk_commit_to_os | ( | PedDisk * | disk | ) |

extern

Tell the operating system kernel about the partition table layout of `disk`.

This is rather loosely defined: for example, on old versions of Linux, it simply calls the BLKRRPART ioctl, which tells the kernel to reread the partition table. On newer versions (2.4.x), it will use the new blkpg interface to tell Linux where each partition starts/ends, etc. In this case, Linux does not need to have support for a specific type of partition table.

Returns
  0 on failure, 1 otherwise.

## ped_disk_delete_all()

int ped_disk_delete_all | ( | PedDisk * | disk | ) |

extern

Removes and destroys all partitions on `disk`.

Returns
  `0` on failure.

## ped_disk_delete_partition()

int ped_disk_delete_partition | ( | PedDisk * | disk,
|  | PedPartition * | part )

extern

Removes `part` from `disk`, and destroys `part`.

Returns
  `0` on failure.

## ped_disk_destroy()

void ped_disk_destroy | ( | PedDisk * | disk | ) |

extern

Close `disk`.

What this function does depends on the PedDiskType of `disk`, but you can generally assume that outstanding writes are flushed (this mainly means that _ped_disk_free is called).

## ped_disk_duplicate()

PedDisk * ped_disk_duplicate | ( | const PedDisk * | old_disk | ) |

extern

Clone a PedDisk object.

Returns
  Deep copy of `old_disk`, NULL on failure.

## ped_disk_extended_partition()

PedPartition * ped_disk_extended_partition | ( | const PedDisk * | disk | ) |

extern

## ped_disk_flag_get_by_name()

PedDiskFlag ped_disk_flag_get_by_name | ( | const char * | name | ) |

extern

Returns the flag associated with `name`.

`name` can be the English string, or the translation for the native language.

## ped_disk_flag_get_name()

const char * ped_disk_flag_get_name | ( | PedDiskFlag | flag | ) |

extern

Returns a name for a `flag`, e.g.

PED_DISK_CYLINDER_ALIGNMENT will return "cylinder_alignment".

Note
  The returned string will be in English. However, translations are provided, so the caller can call dgettext("parted", RESULT) on the result.

## ped_disk_flag_next()

PedDiskFlag ped_disk_flag_next | ( | PedDiskFlag | flag | ) |

extern

Iterates through all disk flags.

ped_disk_flag_next(0) returns the first flag

Returns
  the next flag, or 0 if there are no more flags

## ped_disk_get_flag()

int ped_disk_get_flag | ( | const PedDisk * | disk,
|  | PedDiskFlag | flag )

extern

Get the state (`1` or `0`) of a flag on a disk.

## ped_disk_get_last_partition_num()

int ped_disk_get_last_partition_num | ( | const PedDisk * | disk | ) |

extern

Get the highest available partition number on `disk`.

## ped_disk_get_max_partition_geometry()

PedGeometry * ped_disk_get_max_partition_geometry | ( | PedDisk * | disk,
|  | PedPartition * | part,
|  | const PedConstraint * | constraint )

extern

Get the maximum geometry `part` can be grown to, subject to `constraint`.

Returns
  `NULL` on failure.

## ped_disk_get_max_primary_partition_count()

int ped_disk_get_max_primary_partition_count | ( | const PedDisk * | disk | ) |

extern

Get the maximum number of (primary) partitions the disk label supports.

For example, MacIntosh partition maps can have different sizes, and accordingly support a different number of partitions.

## ped_disk_get_max_supported_partition_count()

bool ped_disk_get_max_supported_partition_count | ( | const PedDisk * | disk,
|  | int * | supported )

extern

Get the highest supported partition number on `disk`.

Returns
  0 if call fails. 1 otherwise.

## ped_disk_get_partition()

PedPartition * ped_disk_get_partition | ( | const PedDisk * | disk,
|  | int | num )

extern

Returns the partition numbered `num`.

Returns
  `NULL` if the specified partition does not exist.

## ped_disk_get_partition_alignment()

PedAlignment * ped_disk_get_partition_alignment | ( | const PedDisk * | disk | ) |

extern

Get the alignment needed for partition boundaries on this disk.

The returned alignment describes the alignment for the start sector of the partition, for all disklabel types which require alignment, except Sun disklabels, the end sector must be aligned too. To get the end sector alignment decrease the PedAlignment offset by 1.

Returns
  NULL on error, otherwise a pointer to a dynamically allocated alignment.

## ped_disk_get_partition_by_sector()

PedPartition * ped_disk_get_partition_by_sector | ( | const PedDisk * | disk,
|  | PedSector | sect )

extern

Returns the partition that contains sect.

If sect lies within a logical partition, then the logical partition is returned (not the extended partition).

## ped_disk_get_primary_partition_count()

int ped_disk_get_primary_partition_count | ( | const PedDisk * | disk | ) |

extern

Get the number of primary partitions.

## ped_disk_get_uuid()

uint8_t * ped_disk_get_uuid | ( | const PedDisk * | disk | ) |

extern

Get the uuid of the disk `disk`.

This will only work if the disk label supports it.

## ped_disk_is_flag_available()

int ped_disk_is_flag_available | ( | const PedDisk * | disk,
|  | PedDiskFlag | flag )

extern

Check whether a given flag is available on a disk.

Returns
  `1` if the flag is available.

## ped_disk_max_partition_length()

PedSector ped_disk_max_partition_length | ( | const PedDisk * | disk | ) |

extern

Return the maximum representable length (in sectors) of a partition on disk \disk.

## ped_disk_max_partition_start_sector()

PedSector ped_disk_max_partition_start_sector | ( | const PedDisk * | disk | ) |

extern

Return the maximum representable start sector of a partition on disk \disk.

## ped_disk_maximize_partition()

int ped_disk_maximize_partition | ( | PedDisk * | disk,
|  | PedPartition * | part,
|  | const PedConstraint * | constraint )

extern

Grow PedPartition `part` geometry to the maximum possible subject to `constraint`.

The new geometry will be a superset of the old geometry.

Returns
  0 on failure

## ped_disk_minimize_extended_partition()

int ped_disk_minimize_extended_partition | ( | PedDisk * | disk | ) |

extern

Reduce the size of the extended partition to a minimum while still wrapping its logical partitions.

If there are no logical partitions, remove the extended partition.

Returns
  0 on failure.

## ped_disk_new()

PedDisk * ped_disk_new | ( | PedDevice * | dev | ) |

extern

Read the partition table off a device (if one is found).

Warning
  May modify `dev->cylinders`, `dev->heads` and `dev->sectors` if the partition table indicates that the existing values are incorrect.

Returns
  A new PedDisk object; NULL on failure (e.g. partition table not detected).

## ped_disk_new_fresh()

PedDisk * ped_disk_new_fresh | ( | PedDevice * | dev,
|  | const PedDiskType * | type )

extern

Create a new partition table on `dev`.

This new partition table is only created in-memory, and nothing is written to disk until ped_disk_commit_to_dev() is called.

Returns
  The newly constructed PedDisk , NULL on failure.

## ped_disk_next_partition()

PedPartition * ped_disk_next_partition | ( | const PedDisk * | disk,
|  | const PedPartition * | part )

extern

Return the next partition after `part` on `disk`.

If `part` is `NULL`, return the first partition. If `part` is the last partition, returns `NULL`. If `part` is an extended partition, returns the first logical partition. If this is called repeatedly passing the return value as `part`, a depth-first traversal is executed.

Returns
  The next partition, `NULL` if no more partitions left.

## ped_disk_print()

void ped_disk_print | ( | const PedDisk * | disk | ) |

extern

Prints a summary of disk's partitions.

Useful for debugging.

## ped_disk_probe()

PedDiskType * ped_disk_probe | ( | PedDevice * | dev | ) |

extern

Return the type of partition table detected on "dev".

Returns
  Type; NULL if none was detected.

## ped_disk_remove_partition()

int ped_disk_remove_partition | ( | PedDisk * | disk,
|  | PedPartition * | part )

extern

Removes PedPartition `part` from PedDisk `disk`.

If `part` is an extended partition, it must not contain any logical partitions. `part` is NOT destroyed. The caller must call ped_partition_destroy(), or use ped_disk_delete_partition() instead.

Returns
  `0` on error.

## ped_disk_set_flag()

int ped_disk_set_flag | ( | PedDisk * | disk,
|  | PedDiskFlag | flag,
|  | int | state )

extern

Set the state (`1` or `0`) of a flag on a disk.

Note
  It is an error to call this on an unavailable flag – use ped_disk_is_flag_available() to determine which flags are available for a given disk label.

Exceptions

  PED_EXCEPTION_ERROR | if the requested flag is not available for this label.

## ped_disk_set_partition_geom()

int ped_disk_set_partition_geom | ( | PedDisk * | disk,
|  | PedPartition * | part,
|  | const PedConstraint * | constraint,
|  | PedSector | start,
|  | PedSector | end )

extern

Sets the geometry of `part` (i.e.

change a partitions location). This can fail for many reasons, e.g. can't overlap with other partitions. If it does fail, `part` will remain unchanged. Returns `0` on failure. `part's` geometry may be set to something different from `start` and `end` subject to `constraint`.

Warning
  The constraint warning from ped_disk_add_partition() applies.

Note
  this function does not modify the contents of the partition. You need to call ped_file_system_resize() separately.

## ped_disk_type_check_feature()

int ped_disk_type_check_feature | ( | const PedDiskType * | disk_type,
|  | PedDiskTypeFeature | feature )

extern

This function checks if a particular type of partition table supports a feature.

Returns
  1 if `disk_type` supports `feature`, 0 otherwise.

## ped_disk_type_get()

PedDiskType * ped_disk_type_get | ( | const char * | name | ) |

extern

Return the disk type with a name of "name".

Returns
  Disk type; NULL if no match.

## ped_disk_type_get_next()

PedDiskType * ped_disk_type_get_next | ( | PedDiskType const * | type | ) |

extern

Return the next disk type registers, after "type".

If "type" is NULL, returns the first disk type.

Returns
  Next disk; NULL if "type" is the last registered disk type.

## ped_disk_type_register()

void ped_disk_type_register | ( | PedDiskType * | type | ) |

extern

## ped_disk_type_unregister()

void ped_disk_type_unregister | ( | PedDiskType * | type | ) |

extern