summaryrefslogtreecommitdiff
path: root/sbin/fdisk
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2022-09-15 10:10:15 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2022-09-15 10:10:15 +0000
commitc553257e2d7c4fb0b9fab369aadcac3578baae24 (patch)
treefbf4ad8f10c8244c63576a7b48bcc8c652b8395d /sbin/fdisk
parent2cbe156d98e662b71752b30f09bec73f38d49018 (diff)
Add GPTPARTATTR_MS_* defines for Microsoft basic data attributes
and make 'fdisk -v' display their names (NoAutoMount, Hidden, Shadow, ReadOnly). Shift 1ULL instead of 1 to make it clear these are uint64_t flags. Makes clang happier.
Diffstat (limited to 'sbin/fdisk')
-rw-r--r--sbin/fdisk/gpt.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/sbin/fdisk/gpt.c b/sbin/fdisk/gpt.c
index c3f66ca7ebb..3800e737a3e 100644
--- a/sbin/fdisk/gpt.c
+++ b/sbin/fdisk/gpt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gpt.c,v 1.81 2022/09/11 11:47:55 krw Exp $ */
+/* $OpenBSD: gpt.c,v 1.82 2022/09/15 10:10:14 krw Exp $ */
/*
* Copyright (c) 2015 Markus Muller <mmu@grummel.net>
* Copyright (c) 2015 Kenneth R Westerback <krw@openbsd.org>
@@ -434,7 +434,9 @@ 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_msdos;
char *guidstr = NULL;
double size;
uint64_t attrs, end, start;
@@ -463,7 +465,19 @@ GPT_print_part(const unsigned int pn, const char *units, const int verbosity)
if (attrs & GPTPARTATTR_IGNORE)
printf("Ignore ");
if (attrs & GPTPARTATTR_BOOTABLE)
- printf("Bootable");
+ printf("Bootable ");
+ uuid_dec_be(gpt_uuid_msdos, &uuid_msdos);
+ if (uuid_compare(&uuid_msdos, &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 ");
+ }
printf("\n");
}
}