*offset = (uint64_t) le64_to_cpu(gpt->pheader->partition_entry_lba) *
cxt->sector_size;
return gpt_sizeof_entries(gpt->pheader, size);
+ case 3:
+ *name = _("GPT Backup Entries");
+ gpt = self_label(cxt);
+ *offset = (uint64_t) le64_to_cpu(gpt->bheader->partition_entry_lba) *
+ cxt->sector_size;
+ return gpt_sizeof_entries(gpt->bheader, size);
+ case 4:
+ *name = _("GPT Backup Header");
+ gpt = self_label(cxt);
+ *offset = (uint64_t) le64_to_cpu(gpt->pheader->alternative_lba) * cxt->sector_size;
+ *size = sizeof(struct gpt_header);
+ break;
default:
return 1; /* no more chunks */
}
* @offset: return offset where is item
* @size: of the item
*
- * Locate disklabel and returns info about @n item of the label. For example
- * GPT is composed from two items, PMBR and GPT, n=0 return offset to PMBR and n=1
- * return offset to GPT. For more details see 'D' expert fdisk command.
+ * Locate disklabel and returns info about @n item of the label.
+ *
+ * For example GPT is composed from three items, PMBR and GPT, n=0 return
+ * offset to PMBR and n=1 return offset to GPT Header and n=2 returns offset to
+ * GPT array of partitions, n=3 and n=4 returns location of the backup GPT
+ * label at the end of the disk.
+ *
+ * The function returns the current in-memory situation. It's possible that a
+ * header location is modified by write operation, for example when enabled
+ * minimization (see fdisk_gpt_enable_minimize()). In this case it's better to
+ * call this function after fdisk_write_disklabel().
+ *
+ * For more details see 'D' expert fdisk command.
*
* Returns: 0 on success, <0 on error, 1 no more items.
*/