Welcome to NYCU CSIT Mirror site

Labelitem: libfdisk Reference Manual

Labelitem

Labelitem — disk label items

Description

The labelitem is label specific items stored in the partition table header. The information provided by labelitems are not specific to the partitions.

For example

1
2
3
4
5
6
struct fdisk_labelitem *item = fdisk_new_labelitem();

fdisk_get_disklabel_item(cxt, GPT_LABELITEM_ALTLBA, item);
print("Backup header LBA: %ju\n", fdisk_labelitem_get_data_u64(item));

fdisk_unref_labelitem(item);

returns LBA of the alternative GPT header.

See also fdisk_get_disklabel_item(). The IDs are generic (e.g. FDISK_LABEL_ITEM_*) and label specific ((e.g. GPT_LABELITEM_*).

Functions

fdisk_new_labelitem ()

struct fdisk_labelitem *
fdisk_new_labelitem (void);

Returns

new instance.

Since: 2.29


fdisk_ref_labelitem ()

void
fdisk_ref_labelitem (struct fdisk_labelitem *li);

Increments reference counter.

Parameters

li

label item

 

Since: 2.29


fdisk_reset_labelitem ()

int
fdisk_reset_labelitem (struct fdisk_labelitem *li);

Zeroize data stored in the li (does not modify anything in disk label).

Parameters

li

label item

 

Returns

0 on success, or <0 in case of error

Since: 2.29


fdisk_unref_labelitem ()

void
fdisk_unref_labelitem (struct fdisk_labelitem *li);

Decrements reference counter, on zero the li is automatically deallocated.

Parameters

li

label item

 

Since: 2.29


fdisk_labelitem_get_name ()

const char *
fdisk_labelitem_get_name (struct fdisk_labelitem *li);

Parameters

li

label item

 

Returns

item name or NULL.

Since: 2.29


fdisk_labelitem_get_id ()

int
fdisk_labelitem_get_id (struct fdisk_labelitem *li);

Parameters

li

label item

 

Returns

item Id or <0 in case of error.

Since: 2.29


fdisk_labelitem_get_data_u64 ()

int
fdisk_labelitem_get_data_u64 (struct fdisk_labelitem *li,
                              uint64_t *data);

Parameters

li

label item

 

data

returns data

 

Returns

0 on success, <0 on error

Since: 2.29


fdisk_labelitem_get_data_string ()

int
fdisk_labelitem_get_data_string (struct fdisk_labelitem *li,
                                 const char **data);

Parameters

li

label item

 

data

returns data

 

Returns

0 on success, <0 on error.

Since: 2.29


fdisk_labelitem_is_string ()

int
fdisk_labelitem_is_string (struct fdisk_labelitem *li);

Parameters

li

label item

 

Returns

0 or 1

Since: 2.29


fdisk_labelitem_is_number ()

int
fdisk_labelitem_is_number (struct fdisk_labelitem *li);

Parameters

li

label item

 

Returns

0 or 1

Since: 2.29

Types and Values