From e48f25a46369122982cc47baaf97609f81144b2d Mon Sep 17 00:00:00 2001 From: krw Date: Fri, 6 May 2022 23:53:43 +0000 Subject: [PATCH] Rename PRT_uuid_to_[protection|typename] to PRT_uuid_to_[protected|sname], and PRT_type_to_uuid() to PRT_type_to_guid() so the names clearly match the field names being searched for. No intentional functional change. --- sbin/fdisk/cmd.c | 8 ++++---- sbin/fdisk/gpt.c | 4 ++-- sbin/fdisk/part.c | 12 ++++++------ sbin/fdisk/part.h | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c index 712e57a94c9..96b9668e197 100644 --- a/sbin/fdisk/cmd.c +++ b/sbin/fdisk/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.159 2022/04/28 13:22:19 krw Exp $ */ +/* $OpenBSD: cmd.c,v 1.160 2022/05/06 23:53:43 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -260,14 +260,14 @@ gsetpid(const int pn) if (PRT_protected_guid(&gp[pn].gp_type)) { printf("can't edit partition type %s\n", - PRT_uuid_to_typename(&gp[pn].gp_type)); + PRT_uuid_to_sname(&gp[pn].gp_type)); return -1; } gp[pn].gp_type = *ask_uuid(&gp[pn].gp_type); if (PRT_protected_guid(&gp[pn].gp_type)) { printf("can't change partition type to %s\n", - PRT_uuid_to_typename(&gp[pn].gp_type)); + PRT_uuid_to_sname(&gp[pn].gp_type)); return -1; } @@ -623,7 +623,7 @@ ask_uuid(const struct uuid *olduuid) uuid_create_nil(&uuid, NULL); goto done; default: - uuid = *PRT_type_to_uuid(num); + uuid = *PRT_type_to_guid(num); if (uuid_is_nil(&uuid, NULL) == 0) goto done; printf("'%s' has no associated UUID\n", lbuf); diff --git a/sbin/fdisk/gpt.c b/sbin/fdisk/gpt.c index 8d4837c8bca..bbd1d37e8b8 100644 --- a/sbin/fdisk/gpt.c +++ b/sbin/fdisk/gpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gpt.c,v 1.76 2022/04/28 13:22:19 krw Exp $ */ +/* $OpenBSD: gpt.c,v 1.77 2022/05/06 23:53:43 krw Exp $ */ /* * Copyright (c) 2015 Markus Muller * Copyright (c) 2015 Kenneth R Westerback @@ -442,7 +442,7 @@ GPT_print_part(const unsigned int pn, const char *units, const int verbosity) size = units_size(units, sectors, &ut); printf("%c%3u: %-36s [%12lld: %12.0f%s]\n", gp[pn].gp_attrs & GPTDOSACTIVE ? '*' : ' ', pn, - PRT_uuid_to_typename(&gp[pn].gp_type), gp[pn].gp_lba_start, + PRT_uuid_to_sname(&gp[pn].gp_type), gp[pn].gp_lba_start, size, ut->ut_abbr); if (verbosity == VERBOSE) { diff --git a/sbin/fdisk/part.c b/sbin/fdisk/part.c index 1a01d5b4113..c9c8010790f 100644 --- a/sbin/fdisk/part.c +++ b/sbin/fdisk/part.c @@ -1,4 +1,4 @@ -/* $OpenBSD: part.c,v 1.126 2022/05/06 14:22:49 krw Exp $ */ +/* $OpenBSD: part.c,v 1.127 2022/05/06 23:53:43 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -209,7 +209,7 @@ PRT_protected_guid(const struct uuid *uuid) if (strncmp(str, efistr, UUID_STR_LEN) == 0) { /* Look for partitions indicating a need to preserve EFI Sys */ for (pn = 0; pn < gh.gh_part_num; pn++) { - typename = PRT_uuid_to_typename(&gp[pn].gp_type); + typename = PRT_uuid_to_sname(&gp[pn].gp_type); if (strncmp(typename, "APFS ", 5)) continue; rslt = -1; @@ -442,7 +442,7 @@ find_gpt_type(const struct uuid *uuid) } int -PRT_uuid_to_protection(const struct uuid *uuid) +PRT_uuid_to_protected(const struct uuid *uuid) { const struct gpt_type *gt; @@ -454,7 +454,7 @@ PRT_uuid_to_protection(const struct uuid *uuid) } const char * -PRT_uuid_to_typename(const struct uuid *uuid) +PRT_uuid_to_sname(const struct uuid *uuid) { static char typename[UUID_STR_LEN + 1]; const uint8_t gpt_uuid_msdos[] = GPT_UUID_MSDOS; @@ -493,8 +493,8 @@ PRT_uuid_to_type(const struct uuid *uuid) return gt->gt_type; } -struct uuid * -PRT_type_to_uuid(const int type) +const struct uuid * +PRT_type_to_guid(const int type) { static struct uuid guid; int i, entries; diff --git a/sbin/fdisk/part.h b/sbin/fdisk/part.h index 3f4a6dc557a..366cdf21331 100644 --- a/sbin/fdisk/part.h +++ b/sbin/fdisk/part.h @@ -1,4 +1,4 @@ -/* $OpenBSD: part.h,v 1.36 2022/03/14 17:11:44 krw Exp $ */ +/* $OpenBSD: part.h,v 1.37 2022/05/06 23:53:43 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -37,9 +37,9 @@ void PRT_make(const struct prt *,const uint64_t, const uint64_t, struct dos_partition *); void PRT_print_part(const int, const struct prt *, const char *); void PRT_print_parthdr(void); -int PRT_uuid_to_protection(const struct uuid *); -const char *PRT_uuid_to_typename(const struct uuid *); +int PRT_uuid_to_protected(const struct uuid *); +const char *PRT_uuid_to_sname(const struct uuid *); int PRT_uuid_to_type(const struct uuid *); -struct uuid *PRT_type_to_uuid(const int); +const struct uuid *PRT_type_to_guid(const int); int PRT_protected_guid(const struct uuid *); int PRT_lba_to_chs(const struct prt*, struct chs *, struct chs*); -- 2.20.1