From 490259bdc07a28796d98b0a8aaea4ca9c10c6414 Mon Sep 17 00:00:00 2001 From: krw Date: Fri, 31 Mar 2023 13:11:40 +0000 Subject: [PATCH] Be more consistent in function naming. Functions taking or returning struct uuid's use 'uuid' in their names. Lengthen a pointlessly short line. No functional change. --- sbin/fdisk/cmd.c | 8 ++++---- sbin/fdisk/gpt.c | 4 ++-- sbin/fdisk/part.c | 12 +++++------- sbin/fdisk/part.h | 6 +++--- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c index d446eb52018..3dabe6be38b 100644 --- a/sbin/fdisk/cmd.c +++ b/sbin/fdisk/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.172 2023/03/29 19:34:49 krw Exp $ */ +/* $OpenBSD: cmd.c,v 1.173 2023/03/31 13:11:40 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -264,14 +264,14 @@ gsetpid(const int pn) GPT_print_parthdr(TERSE); GPT_print_part(pn, "s", TERSE); - if (PRT_protected_guid(&gp[pn].gp_type)) { + if (PRT_protected_uuid(&gp[pn].gp_type)) { printf("can't edit partition type %s\n", PRT_uuid_to_name(&gp[pn].gp_type)); return -1; } gp[pn].gp_type = *ask_uuid(&gp[pn].gp_type); - if (PRT_protected_guid(&gp[pn].gp_type)) { + if (PRT_protected_uuid(&gp[pn].gp_type)) { printf("can't change partition type to %s\n", PRT_uuid_to_name(&gp[pn].gp_type)); return -1; @@ -636,7 +636,7 @@ ask_uuid(const struct uuid *olduuid) uuid_create_nil(&uuid, NULL); goto done; default: - uuid = *PRT_menuid_to_guid(menuid); + uuid = *PRT_menuid_to_uuid(menuid); 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 40aa00c7897..bebb470c718 100644 --- a/sbin/fdisk/gpt.c +++ b/sbin/fdisk/gpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gpt.c,v 1.87 2023/03/25 15:05:45 krw Exp $ */ +/* $OpenBSD: gpt.c,v 1.88 2023/03/31 13:11:41 krw Exp $ */ /* * Copyright (c) 2015 Markus Muller * Copyright (c) 2015 Kenneth R Westerback @@ -619,7 +619,7 @@ init_gp(const int how) memset(&gp, 0, sizeof(gp)); else { for (pn = 0; pn < gh.gh_part_num; pn++) { - if (PRT_protected_guid(&gp[pn].gp_type) || + if (PRT_protected_uuid(&gp[pn].gp_type) || (gp[pn].gp_attrs & GPTPARTATTR_REQUIRED)) continue; memset(&gp[pn], 0, sizeof(gp[pn])); diff --git a/sbin/fdisk/part.c b/sbin/fdisk/part.c index 98c5479c2f5..bccd5ce0615 100644 --- a/sbin/fdisk/part.c +++ b/sbin/fdisk/part.c @@ -1,4 +1,4 @@ -/* $OpenBSD: part.c,v 1.144 2023/03/30 22:53:39 krw Exp $ */ +/* $OpenBSD: part.c,v 1.145 2023/03/31 13:11:41 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -290,7 +290,7 @@ uuid_attr(const struct uuid *uuid) } int -PRT_protected_guid(const struct uuid *uuid) +PRT_protected_uuid(const struct uuid *uuid) { const struct gpt_type *gt; unsigned int pn; @@ -440,10 +440,8 @@ PRT_print_part(const int num, const struct prt *prt, const char *units) PRT_lba_to_chs(prt, &start, &end); mt = find_mbr_type(prt->prt_id); - printf("%c%1d: %.2X %6llu %3u %3u - %6llu %3u %3u " - "[%12llu:%12.0f%s] %s\n", - (prt->prt_flag == DOSACTIVE)?'*':' ', - num, prt->prt_id, + printf("%c%1d: %.2X %6llu %3u %3u - %6llu %3u %3u " "[%12llu:%12.0f%s] " + "%s\n", (prt->prt_flag == DOSACTIVE) ? '*' : ' ', num, prt->prt_id, start.chs_cyl, start.chs_head, start.chs_sect, end.chs_cyl, end.chs_head, end.chs_sect, prt->prt_bs, size, ut->ut_abbr, mt ? mt->mt_name : ""); @@ -532,7 +530,7 @@ PRT_uuid_to_menuid(const struct uuid *uuid) } const struct uuid * -PRT_menuid_to_guid(const int menuid) +PRT_menuid_to_uuid(const int menuid) { static struct uuid guid; int i; diff --git a/sbin/fdisk/part.h b/sbin/fdisk/part.h index 3dc76b83d6c..e1697e9daa9 100644 --- a/sbin/fdisk/part.h +++ b/sbin/fdisk/part.h @@ -1,4 +1,4 @@ -/* $OpenBSD: part.h,v 1.42 2023/03/29 19:34:49 krw Exp $ */ +/* $OpenBSD: part.h,v 1.43 2023/03/31 13:11:41 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -39,6 +39,6 @@ void PRT_print_part(const int, const struct prt *, const char *); void PRT_print_parthdr(void); const char *PRT_uuid_to_name(const struct uuid *); int PRT_uuid_to_menuid(const struct uuid *); -const struct uuid *PRT_menuid_to_guid(const int); -int PRT_protected_guid(const struct uuid *); +const struct uuid *PRT_menuid_to_uuid(const int); +int PRT_protected_uuid(const struct uuid *); int PRT_lba_to_chs(const struct prt*, struct chs *, struct chs*); -- 2.20.1