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