Top | ![]() |
![]() |
![]() |
![]() |
gboolean | bd_part_check_deps () |
gboolean | bd_part_init () |
void | bd_part_close () |
gboolean | bd_part_create_table () |
BDPartSpec * | bd_part_create_part () |
gboolean | bd_part_delete_part () |
gboolean | bd_part_resize_part () |
BDPartSpec ** | bd_part_get_disk_parts () |
BDPartSpec * | bd_part_get_part_spec () |
gboolean | bd_part_set_part_flag () |
BDPartSpec * | bd_part_spec_copy () |
void | bd_part_spec_free () |
GType | bd_part_spec_get_type () |
const gchar * | bd_part_get_flag_str () |
const gchar * | bd_part_get_part_table_type_str () |
const gchar * | bd_part_get_type_str () |
BDPartSpec * | bd_part_get_best_free_region () |
BDPartSpec ** | bd_part_get_disk_free_regions () |
BDPartDiskSpec * | bd_part_get_disk_spec () |
BDPartSpec * | bd_part_get_part_by_pos () |
gboolean | bd_part_set_disk_flag () |
gboolean | bd_part_set_part_flags () |
gboolean | bd_part_set_part_name () |
gboolean | bd_part_set_part_type () |
gboolean | bd_part_set_part_id () |
gchar * | bd_part_get_part_id () |
GQuark | bd_part_error_quark () |
#define | BD_PART_ERROR |
#define | BD_PART_TYPE_SPEC |
enum | BDPartAlign |
enum | BDPartFlag |
BDPartSpec | |
enum | BDPartType |
enum | BDPartTypeReq |
enum | BDPartError |
enum | BDPartTableType |
enum | BDPartDiskFlag |
BDPartDiskSpec |
A plugin for operations with partition tables. Currently supported table (disk label) types are MBR and GPT. See the functions below to get an overview of which operations are supported. If there's anything missing, please don't hesitate to report it as this plugin (just like all the others) is subject to future development and enhancements.
This particular implementation of the part plugin uses libparted for manipulations of both the MBR and GPT disk label types together with the sgdisk utility for some extra GPT-specific features libparted doesn't support. In the future, there's likely to be another implementation of this plugin based on libfdisk which provides full support for both MBR and GPT tables (and possibly some others).
gboolean
bd_part_init ();
Initializes the plugin. **This function is called automatically by the library's initialization functions.**
void
bd_part_close ();
Cleans up after the plugin. **This function is called automatically by the library's functions that unload it.**
gboolean bd_part_create_table (const gchar *disk
,BDPartTableType type
,gboolean ignore_existing
,GError **error
);
BDPartSpec * bd_part_create_part (const gchar *disk
,BDPartTypeReq type
,guint64 start
,guint64 size
,BDPartAlign align
,GError **error
);
disk |
disk to create partition on |
|
type |
type of the partition to create (if |
|
start |
where the partition should start (i.e. offset from the disk start) |
|
size |
desired size of the partition (if 0, a max-sized partition is created) |
|
align |
alignment to use for the partition |
|
error |
place to store error (if any). |
[out] |
gboolean bd_part_delete_part (const gchar *disk
,const gchar *part
,GError **error
);
gboolean bd_part_resize_part (const gchar *disk
,const gchar *part
,guint64 size
,BDPartAlign align
,GError **error
);
BDPartSpec ** bd_part_get_disk_parts (const gchar *disk
,GError **error
);
BDPartSpec * bd_part_get_part_spec (const gchar *disk
,const gchar *part
,GError **error
);
gboolean bd_part_set_part_flag (const gchar *disk
,const gchar *part
,BDPartFlag flag
,gboolean state
,GError **error
);
const gchar * bd_part_get_part_table_type_str (BDPartTableType type
,GError **error
);
BDPartSpec * bd_part_get_best_free_region (const gchar *disk
,BDPartType type
,guint64 size
,GError **error
);
disk |
disk to get the best free region for |
|
type |
type of the partition that is planned to be added |
|
size |
size of the partition to be added |
|
error |
place to store error (if any). |
[out] |
spec of the best free region on disk
for a new partition of type type
with the size of size
or NULL
if there is none such region or if
there was an error (error
gets populated)
Note: For the type
BD_PART_TYPE_NORMAL
, the smallest possible space that *is not* in an extended partition
is found. For the type
BD_PART_TYPE_LOGICAL
, the smallest possible space that *is* in an extended
partition is found. For BD_PART_TYPE_EXTENDED
, the biggest possible space is found as long as there
is no other extended partition (there can only be one).
[transfer full]
BDPartSpec ** bd_part_get_disk_free_regions (const gchar *disk
,GError **error
);
BDPartDiskSpec * bd_part_get_disk_spec (const gchar *disk
,GError **error
);
BDPartSpec * bd_part_get_part_by_pos (const gchar *disk
,guint64 position
,GError **error
);
gboolean bd_part_set_disk_flag (const gchar *disk
,BDPartDiskFlag flag
,gboolean state
,GError **error
);
gboolean bd_part_set_part_flags (const gchar *disk
,const gchar *part
,guint64 flags
,GError **error
);
disk |
disk the partition belongs to |
|
part |
partition to set the flag on |
|
flags |
flags to set (mask combined from BDPartFlag numbers) |
|
error |
place to store error (if any). |
[out] |
gboolean bd_part_set_part_name (const gchar *disk
,const gchar *part
,const gchar *name
,GError **error
);
gboolean bd_part_set_part_type (const gchar *disk
,const gchar *part
,const gchar *type_guid
,GError **error
);
gboolean bd_part_set_part_id (const gchar *disk
,const gchar *part
,const gchar *part_id
,GError **error
);
gchar * bd_part_get_part_id (const gchar *disk
,const gchar *part
,GError **error
);
Returns (transfer full): partition id type or NULL
in case of error
typedef struct { gchar *path; gchar *name; gchar *type_guid; guint64 type; guint64 start; guint64 size; guint64 flags; } BDPartSpec;
path of the partition (block device) |
||
name of the partition (for GPT partitions) |
||
GUID of the partition's type (GPT) |
||
bit combination of partition's types (BDPartType) |
||
start of the partition |
||
size of the partition |
||
bit combination of partition's flags (BDPartFlag) |
typedef struct { gchar *path; BDPartTableType table_type; guint64 size; guint64 sector_size; guint64 flags; } BDPartDiskSpec;
path of the disk (block device) |
||
BDPartTableType |
type of the disk's partition table |
|
size of the disk |
||
disk's sector size |
||
bit combination of the disk's flags (BDPartDiskFlag) |