You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

69 lines
2.1 KiB

From 6f768ec049944ab39c79fcaa7bdf9622385b7672 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Thu, 16 Mar 2017 13:29:50 +0100
Subject: [PATCH 092/116] fdisk: print header UUID for GPT
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1344726
Signed-off-by: Karel Zak <kzak@redhat.com>
---
fdisks/fdisk.c | 2 ++
libfdisk/src/fdiskP.h | 1 +
libfdisk/src/gpt.c | 18 ++++++++++++++++++
3 files changed, 21 insertions(+)
diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c
index 0ec9909..974d735 100644
--- a/fdisks/fdisk.c
+++ b/fdisks/fdisk.c
@@ -657,6 +657,8 @@ list_disk_geometry(struct fdisk_context *cxt) {
printf(_("Disk label type: %s\n"), cxt->label->name);
if (fdisk_is_disklabel(cxt, DOS))
dos_print_mbr_id(cxt);
+ if (fdisk_is_disklabel(cxt, GPT))
+ gpt_print_header_id(cxt);
printf("\n");
}
diff --git a/libfdisk/src/fdiskP.h b/libfdisk/src/fdiskP.h
index ce42860..6711ab8 100644
--- a/libfdisk/src/fdiskP.h
+++ b/libfdisk/src/fdiskP.h
@@ -315,6 +315,7 @@ extern void fdisk_deinit_label(struct fdisk_label *lb);
/* gpt.c -- temporary bypass library API... */
extern void gpt_list_table(struct fdisk_context *cxt, int xtra);
+extern void gpt_print_header_id(struct fdisk_context *cxt);
/* ask.c */
extern int fdisk_ask_partnum(struct fdisk_context *cxt, size_t *partnum, int wantnew);
diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c
index d3bdc2d..899e1b2 100644
--- a/libfdisk/src/gpt.c
+++ b/libfdisk/src/gpt.c
@@ -341,6 +341,24 @@ static inline int partition_unused(const struct gpt_entry *e)
sizeof(struct gpt_guid));
}
+void gpt_print_header_id(struct fdisk_context *cxt)
+{
+ char str[37];
+ struct gpt_header *header;
+ struct fdisk_gpt_label *gpt;
+
+ assert(cxt);
+ assert(cxt->label);
+ assert(fdisk_is_disklabel(cxt, GPT));
+
+ gpt = self_label(cxt);
+ header = gpt->pheader ? gpt->pheader : gpt->bheader;
+
+ guid_to_string(&header->disk_guid, str);
+
+ printf("Disk identifier: %s\n", str);
+}
+
/*
* Builds a clean new valid protective MBR - will wipe out any existing data.
* Returns 0 on success, otherwise < 0 on error.
--
2.9.3