diff mbox series

[3/8] disk: simplify part_print_efi()

Message ID 20220116151441.219566-4-heinrich.schuchardt@canonical.com
State Accepted, archived
Commit a4492eeee14294c61680d56893df4d73880f098e
Delegated to: Heinrich Schuchardt
Headers show
Series efi_loader: simplify printing GUIDs | expand

Commit Message

Heinrich Schuchardt Jan. 16, 2022, 3:14 p.m. UTC
Use printf code %pUs to print the text representation of the partition type
GUID.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 disk/part_efi.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

Comments

Simon Glass Jan. 21, 2022, 3:20 p.m. UTC | #1
On Sun, 16 Jan 2022 at 08:14, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> Use printf code %pUs to print the text representation of the partition type
> GUID.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  disk/part_efi.c | 21 ++++++++-------------
>  1 file changed, 8 insertions(+), 13 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox series

Patch

diff --git a/disk/part_efi.c b/disk/part_efi.c
index 3809333078..94e2930200 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -221,8 +221,7 @@  void part_print_efi(struct blk_desc *dev_desc)
 	ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, dev_desc->blksz);
 	gpt_entry *gpt_pte = NULL;
 	int i = 0;
-	char uuid[UUID_STR_LEN + 1];
-	unsigned char *uuid_bin;
+	unsigned char *uuid;
 
 	/* This function validates AND fills in the GPT header and PTE */
 	if (find_valid_gpt(dev_desc, gpt_head, &gpt_pte) != 1)
@@ -245,17 +244,13 @@  void part_print_efi(struct blk_desc *dev_desc)
 			le64_to_cpu(gpt_pte[i].ending_lba),
 			print_efiname(&gpt_pte[i]));
 		printf("\tattrs:\t0x%016llx\n", gpt_pte[i].attributes.raw);
-		uuid_bin = (unsigned char *)gpt_pte[i].partition_type_guid.b;
-		uuid_bin_to_str(uuid_bin, uuid, UUID_STR_FORMAT_GUID);
-		printf("\ttype:\t%s\n", uuid);
-		if (CONFIG_IS_ENABLED(PARTITION_TYPE_GUID)) {
-			const char *type = uuid_guid_get_str(uuid_bin);
-			if (type)
-				printf("\ttype:\t%s\n", type);
-		}
-		uuid_bin = (unsigned char *)gpt_pte[i].unique_partition_guid.b;
-		uuid_bin_to_str(uuid_bin, uuid, UUID_STR_FORMAT_GUID);
-		printf("\tguid:\t%s\n", uuid);
+		uuid = (unsigned char *)gpt_pte[i].partition_type_guid.b;
+		if (CONFIG_IS_ENABLED(PARTITION_TYPE_GUID))
+			printf("\ttype:\t%pUl\n\t\t(%pUs)\n", uuid, uuid);
+		else
+			printf("\ttype:\t%pUl\n", uuid);
+		uuid = (unsigned char *)gpt_pte[i].unique_partition_guid.b;
+		printf("\tguid:\t%pUl\n", uuid);
 	}
 
 	/* Remember to free pte */