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

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

type

 

BSD_LABELITEM_DISK

disk

 

BSD_LABELITEM_PACKNAME

packname

 

BSD_LABELITEM_FLAGS

flags (removable, ecc, badsect)

 

BSD_LABELITEM_SECSIZE

Bytes/Sector

 

BSD_LABELITEM_NTRACKS

Tracks/Cylinder

 

BSD_LABELITEM_SECPERCYL

Sectors/Cylinder

 

BSD_LABELITEM_CYLINDERS

Cylinders

 

BSD_LABELITEM_RPM

rpm

 

BSD_LABELITEM_INTERLEAVE

interleave

 

BSD_LABELITEM_TRACKSKEW

trackskew

 

BSD_LABELITEM_CYLINDERSKEW

cylinderskew

 

BSD_LABELITEM_HEADSWITCH

headswitch

 

BSD_LABELITEM_TRKSEEK

track-to-track seek

 

enum fdisk_labelitem_gen

Generic disklabel items.

Members

FDISK_LABELITEM_ID

Unique disk identifier

 

__FDISK_NLABELITEMS

Specifies reserved range for generic items (0..7)

 

enum fdisk_labelitem_gpt

GPT specific label items.

Members

GPT_LABELITEM_ID

GPT disklabel UUID (!= partition UUID)

 

GPT_LABELITEM_FIRSTLBA

First Usable LBA

 

GPT_LABELITEM_LASTLBA

Usable LBA

 

GPT_LABELITEM_ALTLBA

Alternative LBA (backup header LBA)

 

GPT_LABELITEM_ENTRIESLBA

Partitions entries array LBA

 

GPT_LABELITEM_ENTRIESALLOC

Number of allocated entries in entries array

 

enum fdisk_labelitem_sgi

SGI specific label items.

Members

SGI_LABELITEM_PCYLCOUNT

Physical cylinders

 

SGI_LABELITEM_SPARECYL

Extra sects/cyl

 

SGI_LABELITEM_ILFACT

nterleave

 

SGI_LABELITEM_BOOTFILE

Bootfile

 

enum fdisk_labelitem_sun

SUN specific label items.

Members

SUN_LABELITEM_LABELID

Label ID

 

SUN_LABELITEM_VTOCID

Volume ID

 

SUN_LABELITEM_RPM

Rpm

 

SUN_LABELITEM_ACYL

Alternate cylinders

 

SUN_LABELITEM_PCYL

Physical cylinders

 

SUN_LABELITEM_APC

Extra sects/cyl

 

SUN_LABELITEM_INTRLV

Interleave