From d0f0c9048e3ad00aed75599165efc21c38aa45b5 Mon Sep 17 00:00:00 2001 From: krw Date: Wed, 10 May 2023 12:59:47 +0000 Subject: [PATCH] Microsoft GPT partition attributes can appear on partitions other than Basic Data partitions. e.g. Windows Recovery and Windows Reserved partitions. So tweak verbiage to make clear they are MS attributes by prepending 'MS' and always display them. No functional change other than modified fdisk -v output. --- sbin/fdisk/gpt.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/sbin/fdisk/gpt.c b/sbin/fdisk/gpt.c index b0fc72fa033..e1f9aef2671 100644 --- a/sbin/fdisk/gpt.c +++ b/sbin/fdisk/gpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gpt.c,v 1.89 2023/04/07 16:34:41 krw Exp $ */ +/* $OpenBSD: gpt.c,v 1.90 2023/05/10 12:59:47 krw Exp $ */ /* * Copyright (c) 2015 Markus Muller * Copyright (c) 2015 Kenneth R Westerback @@ -436,9 +436,7 @@ GPT_print_parthdr(const int verbosity) void GPT_print_part(const unsigned int pn, const char *units, const int verbosity) { - const uint8_t gpt_uuid_msdos[] = GPT_UUID_MSDOS; const struct unit_type *ut; - struct uuid uuid; char *guidstr = NULL; double size; uint64_t attrs, end, start; @@ -468,17 +466,14 @@ GPT_print_part(const unsigned int pn, const char *units, const int verbosity) printf("Ignore "); if (attrs & GPTPARTATTR_BOOTABLE) printf("Bootable "); - uuid_dec_be(gpt_uuid_msdos, &uuid); - if (uuid_compare(&uuid, &gp[pn].gp_type, NULL) == 0) { - if (attrs & GPTPARTATTR_MS_READONLY) - printf("ReadOnly " ); - if (attrs & GPTPARTATTR_MS_SHADOW) - printf("Shadow "); - if (attrs & GPTPARTATTR_MS_HIDDEN) - printf("Hidden "); - if (attrs & GPTPARTATTR_MS_NOAUTOMOUNT) - printf("NoAutoMount "); - } + if (attrs & GPTPARTATTR_MS_READONLY) + printf("MSReadOnly " ); + if (attrs & GPTPARTATTR_MS_SHADOW) + printf("MSShadow "); + if (attrs & GPTPARTATTR_MS_HIDDEN) + printf("MSHidden "); + if (attrs & GPTPARTATTR_MS_NOAUTOMOUNT) + printf("MSNoAutoMount "); printf("\n"); } } -- 2.20.1