libparted 3.6
|
Partition access. More...
Files | |
file | disk.h |
file | disk.h |
Data Structures | |
struct | _PedPartition |
PedPartition structure represents a partition. More... | |
Functions | |
PedPartition * | _ped_partition_alloc (const PedDisk *disk, PedPartitionType type, const PedFileSystemType *fs_type, PedSector start, PedSector end) |
int | _ped_partition_attempt_align (PedPartition *part, const PedConstraint *external, PedConstraint *internal) |
void | _ped_partition_free (PedPartition *part) |
void | ped_partition_destroy (PedPartition *part) |
Destroy a PedPartition object. | |
PedPartitionFlag | ped_partition_flag_get_by_name (const char *name) |
Returns the flag associated with name . | |
const char * | ped_partition_flag_get_name (PedPartitionFlag flag) |
Returns a name for a flag , e.g. | |
PedPartitionFlag | ped_partition_flag_next (PedPartitionFlag flag) |
Iterates through all flags. | |
int | ped_partition_get_flag (const PedPartition *part, PedPartitionFlag flag) |
Get the state (1 or 0 ) of a flag on a partition. | |
const char * | ped_partition_get_name (const PedPartition *part) |
Returns the name of a partition part . | |
char * | ped_partition_get_path (const PedPartition *part) |
Return a path that can be used to address the partition in the operating system. | |
uint8_t | ped_partition_get_type_id (const PedPartition *part) |
Get the type-id of the partition part . | |
uint8_t * | ped_partition_get_type_uuid (const PedPartition *part) |
Get the type-uuid of the partition part . | |
uint8_t * | ped_partition_get_uuid (const PedPartition *part) |
Get the uuid of the partition part . | |
int | ped_partition_is_active (const PedPartition *part) |
Return whether or not the partition is "active". | |
int | ped_partition_is_busy (const PedPartition *part) |
Check whether a partition is mounted or busy in some other way. | |
int | ped_partition_is_flag_available (const PedPartition *part, PedPartitionFlag flag) |
Check whether a given flag is available on a partition. | |
PedPartition * | ped_partition_new (const PedDisk *disk, PedPartitionType type, const PedFileSystemType *fs_type, PedSector start, PedSector end) |
Create a new PedPartition on disk . | |
int | ped_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) |
Set the state (1 or 0 ) of a flag on a partition. | |
int | ped_partition_set_name (PedPartition *part, const char *name) |
Sets the name of a partition. | |
int | ped_partition_set_system (PedPartition *part, const PedFileSystemType *fs_type) |
Sets the system type on the partition to fs_type . | |
int | ped_partition_set_type_id (PedPartition *part, uint8_t id) |
Set the type-id of the partition part . | |
int | ped_partition_set_type_uuid (PedPartition *part, const uint8_t *uuid) |
Set the type-uuid of the partition part . | |
const char * | ped_partition_type_get_name (PedPartitionType type) |
Returns a name that seems mildly appropriate for a partition type type . | |
Partition access.
PedPartition * _ped_partition_alloc | ( | const PedDisk * | disk, |
PedPartitionType | type, | ||
const PedFileSystemType * | fs_type, | ||
PedSector | start, | ||
PedSector | end | ||
) |
int _ped_partition_attempt_align | ( | PedPartition * | part, |
const PedConstraint * | external, | ||
PedConstraint * | internal | ||
) |
void _ped_partition_free | ( | PedPartition * | part | ) |
void ped_partition_destroy | ( | PedPartition * | part | ) |
Destroy a PedPartition object.
PedPartitionFlag ped_partition_flag_get_by_name | ( | const char * | name | ) |
Returns the flag associated with name
.
name
can be the English string, or the translation for the native language.
const char * ped_partition_flag_get_name | ( | PedPartitionFlag | flag | ) |
Returns a name for a flag
, e.g.
PED_PARTITION_BOOT will return "boot".
PedPartitionFlag ped_partition_flag_next | ( | PedPartitionFlag | flag | ) |
Iterates through all flags.
ped_partition_flag_next(0) returns the first flag
int ped_partition_get_flag | ( | const PedPartition * | part, |
PedPartitionFlag | flag | ||
) |
Get the state (1
or 0
) of a flag on a partition.
See ped_partition_set_flag() for conditions that must hold.
const char * ped_partition_get_name | ( | const PedPartition * | part | ) |
Returns the name of a partition part
.
This will only work if the disk label supports it.
char * ped_partition_get_path | ( | const PedPartition * | part | ) |
Return a path that can be used to address the partition in the operating system.
uint8_t ped_partition_get_type_id | ( | const PedPartition * | part | ) |
Get the type-id of the partition part
.
This will only work if the disk label supports it.
uint8_t * ped_partition_get_type_uuid | ( | const PedPartition * | part | ) |
Get the type-uuid of the partition part
.
This will only work if the disk label supports it.
uint8_t * ped_partition_get_uuid | ( | const PedPartition * | part | ) |
Get the uuid of the partition part
.
This will only work if the disk label supports it.
int ped_partition_is_active | ( | const PedPartition * | part | ) |
Return whether or not the partition is "active".
A partition is active if part->type
is neither PED_PARTITION_METADATA
nor PED_PARTITION_FREE
.
int ped_partition_is_busy | ( | const PedPartition * | part | ) |
Check whether a partition is mounted or busy in some other way.
1
if busy. int ped_partition_is_flag_available | ( | const PedPartition * | part, |
PedPartitionFlag | flag | ||
) |
Check whether a given flag is available on a partition.
1
if the flag is available. PedPartition * ped_partition_new | ( | const PedDisk * | disk, |
PedPartitionType | type, | ||
const PedFileSystemType * | fs_type, | ||
PedSector | start, | ||
PedSector | end | ||
) |
Create a new PedPartition on disk
.
type | One of PED_PARTITION_NORMAL , PED_PARTITION_EXTENDED , PED_PARTITION_LOGICAL . |
disk
's partition table. Use ped_disk_add_partition() to do this.PED_EXCEPTION_ERROR | if type is EXTENDED or LOGICAL but the label does not support this concept. |
int ped_partition_set_flag | ( | PedPartition * | part, |
PedPartitionFlag | flag, | ||
int | state | ||
) |
Set the state (1
or 0
) of a flag on a partition.
Flags are disk label specific, although they have a global "namespace": the flag PED_PARTITION_BOOT, for example, roughly means "this" partition is bootable". But this means different things on different disk labels (and may not be defined on some disk labels). For example, on MS-DOS disk labels, there can only be one boot partition, and this refers to the partition that will be booted from on startup. On PC98 disk labels, the user can choose from any bootable partition on startup.
PED_EXCEPTION_ERROR | if the requested flag is not available for this label. |
int ped_partition_set_name | ( | PedPartition * | part, |
const char * | name | ||
) |
Sets the name of a partition.
name
will not be modified by libparted. It can be freed by the caller immediately after ped_partition_set_name() is called.1
on success, 0
otherwise. int ped_partition_set_system | ( | PedPartition * | part, |
const PedFileSystemType * | fs_type | ||
) |
Sets the system type on the partition to fs_type
.
0
on failure. int ped_partition_set_type_id | ( | PedPartition * | part, |
uint8_t | id | ||
) |
Set the type-id of the partition part
.
This will only work if the disk label supports it.
int ped_partition_set_type_uuid | ( | PedPartition * | part, |
const uint8_t * | uuid | ||
) |
Set the type-uuid of the partition part
.
This will only work if the disk label supports it.
const char * ped_partition_type_get_name | ( | PedPartitionType | type | ) |
Returns a name that seems mildly appropriate for a partition type type
.
Eg, if you pass (PED_PARTITION_LOGICAL & PED_PARTITION_FREESPACE), it will return "free". This isn't to be taken too seriously - it's just useful for user interfaces, so you can show the user something ;-)