| Top | 
| int | fdisk_field_get_id () | 
| const char * | fdisk_field_get_name () | 
| double | fdisk_field_get_width () | 
| int | fdisk_field_is_number () | 
The fdisk fields are static user-friendly descriptions of the partition. The
fields are used to avoid label specific stuff in the functions that list disk
partitions (e.g. fdisk -l). The field Id is the same as Id for fdisk_partition_to_string().
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  | 
        int *ids; size_t nids; struct fdisk_partition *pa = NULL; struct fdisk_label *lb = fdisk_get_label(cxt, NULL); fdisk_label_get_fields_ids(lb, cxt, &ids, &nids); fdisk_get_partition(cxt, 0, &pa); for (i = 0; i < nids; i++) { const struct fdisk_field *field = fdisk_label_get_field(lb, ids[i]); int id = fdisk_field_get_id(fl); const char *name = fdisk_field_get_name(fl); char *data; fdisk_partition_to_string(pa, id, &data); printf("%s: %s\n", name, data); free(data); } free(ids);  | 
      
This example lists all information about the first partition. It will work for MBR as well as for GPT because fields are not hardcoded in the example.
See also fdisk_label_get_field_by_name(), fdisk_label_get_fields_ids_all()
and fdisk_label_get_fields_ids().
Types of fdisk_field. The fields describe a partition.
| 
 unspecified item  | 
||
| 
 partition device name  | 
||
| 
 start offset of the partition  | 
||
| 
 end offset of the partition  | 
||
| 
 number of sectors  | 
||
| 
 number of cylinders (deprecated)  | 
||
| 
 partition size  | 
||
| 
 partition type  | 
||
| 
 partition type ID  | 
||
| 
 partition attribute (GPT)  | 
||
| 
 partition boot flag  | 
||
| 
 size of the boot area (BSD)  | 
||
| 
 BSD  | 
||
| 
 End-C/H/S (MBR)  | 
||
| 
 BSD  | 
||
| 
 partition label/name  | 
||
| 
 Start-C/H/S (MBR)  | 
||
| 
 partition UUID (GPT)  | 
||
| 
 Filesystem UUID  | 
||
| 
 Filesystem LABEL  | 
||
| 
 Filesystem type  | 
||
| 
 Don't use, counter.  |