Microsoft GPT partition attributes can appear on partitions other
authorkrw <krw@openbsd.org>
Wed, 10 May 2023 12:59:47 +0000 (12:59 +0000)
committerkrw <krw@openbsd.org>
Wed, 10 May 2023 12:59:47 +0000 (12:59 +0000)
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

index b0fc72f..e1f9aef 100644 (file)
@@ -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 <mmu@grummel.net>
  * Copyright (c) 2015 Kenneth R Westerback <krw@openbsd.org>
@@ -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");
                }
        }