PedPartition
[PedDisk]

Partition access. More...

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.
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.
PedPartitionped_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.
const char * ped_partition_type_get_name (PedPartitionType type)
 Returns a name that seems mildly appropriate for a partition type type.

Detailed Description

Partition access.


Function Documentation

void ped_partition_destroy ( PedPartition part  ) 

Destroy a PedPartition object.

Note:
Should not be called on a partition that is in a partition table. Use ped_disk_delete_partition() instead.

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".

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

PedPartitionFlag ped_partition_flag_next ( PedPartitionFlag  flag  ) 

Iterates through all flags.

ped_partition_flag_next(0) returns the first flag

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

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.

Todo:
Where's the check for flag availability?

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.

Note:
The returned string should not be modified. It should not be referenced after the partition is destroyed.

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.

Note:
An extended partition is busy if any logical partitions are mounted.
Returns:
1 if busy.

int ped_partition_is_flag_available ( const PedPartition part,
PedPartitionFlag  flag 
)

Check whether a given flag is available on a partition.

Returns:
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.

Parameters:
type One of PED_PARTITION_NORMAL, PED_PARTITION_EXTENDED, PED_PARTITION_LOGICAL.
Note:
The constructed partition is not added to disk's partition table. Use ped_disk_add_partition() to do this.
Returns:
A new PedPartition object, NULL on failure.
Exceptions:
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.

Note:
It is an error to call this on an unavailable flag -- use ped_partition_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.

int ped_partition_set_name ( PedPartition part,
const char *  name 
)

Sets the name of a partition.

Note:
This will only work if the disk label supports it. You can use to check whether this feature is enabled for a label.

name will not be modified by libparted. It can be freed by the caller immediately after ped_partition_set_name() is called.

Returns:
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.

Note:
The file system may be opened, to get more information about the file system, e.g. to determine if it's FAT16 or FAT32.
Returns:
0 on failure.

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 ;-)

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


Generated on Fri May 4 05:15:31 2007 for libparted by  doxygen 1.5.2