Labelitem

Labelitem — disk label items

Functions

Types and Values

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

struct fdisk_labelitem

struct fdisk_labelitem;

library handler for label specific information. See generic FDISK_LABELITEM_* and label specific {GPT,MBR,..}_LABELITEM_*.


enum fdisk_labelitem_bsd

BSD specific label items.

Members

BSD_LABELITEM_TYPE

   

BSD_LABELITEM_DISK

   

BSD_LABELITEM_PACKNAME

   

BSD_LABELITEM_FLAGS

   

BSD_LABELITEM_SECSIZE

   

BSD_LABELITEM_NTRACKS

   

BSD_LABELITEM_SECPERCYL

   

BSD_LABELITEM_CYLINDERS

   

BSD_LABELITEM_RPM

   

BSD_LABELITEM_INTERLEAVE

   

BSD_LABELITEM_TRACKSKEW

   

BSD_LABELITEM_CYLINDERSKEW

   

BSD_LABELITEM_HEADSWITCH

   

BSD_LABELITEM_TRKSEEK

   

enum fdisk_labelitem_gen

Generic disklabel items

Members

FDISK_LABELITEM_ID

   

__FDISK_NLABELITEMS

   

enum fdisk_labelitem_gpt

GPT specific label items.

Members

GPT_LABELITEM_ID

   

GPT_LABELITEM_FIRSTLBA

   

GPT_LABELITEM_LASTLBA

   

GPT_LABELITEM_ALTLBA

   

GPT_LABELITEM_ENTRIESLBA

   

GPT_LABELITEM_ENTRIESALLOC

   

enum fdisk_labelitem_sgi

SGI specific label items.

Members

SGI_LABELITEM_PCYLCOUNT

   

SGI_LABELITEM_SPARECYL

   

SGI_LABELITEM_ILFACT

   

SGI_LABELITEM_BOOTFILE

   

enum fdisk_labelitem_sun

SUN specific label items.

Members

SUN_LABELITEM_LABELID

   

SUN_LABELITEM_VTOCID

   

SUN_LABELITEM_RPM

   

SUN_LABELITEM_ACYL

   

SUN_LABELITEM_PCYL

   

SUN_LABELITEM_APC

   

SUN_LABELITEM_INTRLV