From 5c783b54d605aa21c8e3e0e188ab99d58135addd Mon Sep 17 00:00:00 2001 From: Philippe Reynes Date: Fri, 22 Apr 2022 17:46:48 +0200 Subject: disk: part_efi: add support to repair gpt table If a gpt table is corrupted (after a power cut for example), then the gpt table should repaired. The function gpt_repair_headers check if at least one gpt table is valid, and then only write the corrupted gpt table. Signed-off-by: Philippe Reynes --- include/part.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/part.h b/include/part.h index 3a6958dcb2a..6f604e7315a 100644 --- a/include/part.h +++ b/include/part.h @@ -466,6 +466,16 @@ int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf); int gpt_verify_headers(struct blk_desc *dev_desc, gpt_header *gpt_head, gpt_entry **gpt_pte); +/** + * gpt_repair_headers() - Function to repair the GPT's header + * and partition table entries (PTE) + * + * @param dev_desc - block device descriptor + * + * Return: - '0' on success, otherwise error + */ +int gpt_repair_headers(struct blk_desc *dev_desc); + /** * gpt_verify_partitions() - Function to check if partitions' name, start and * size correspond to '$partitions' env variable -- cgit v1.2.3