summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2023-03-29 19:34:50 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2023-03-29 19:34:50 +0000
commit7b564877eeafb975ff2ea542cc5be2a7d93b5224 (patch)
tree6a7b8fe4e50261f42795008ecb91a7b6a5503367
parent8fba2c72f5c39d2bd098b827d23464d66356e8e3 (diff)
Change 'type' to 'menuid' in various struct's, functions and
variables related to gpt partitions. Makes it clear that there is no required tie between mbr partition types and gpt partition types. No functional change.
-rw-r--r--sbin/fdisk/cmd.c16
-rw-r--r--sbin/fdisk/part.c16
-rw-r--r--sbin/fdisk/part.h6
3 files changed, 19 insertions, 19 deletions
diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c
index ffeb1d0cdfb..d446eb52018 100644
--- a/sbin/fdisk/cmd.c
+++ b/sbin/fdisk/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.171 2023/03/29 14:20:50 krw Exp $ */
+/* $OpenBSD: cmd.c,v 1.172 2023/03/29 19:34:49 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -594,16 +594,16 @@ ask_uuid(const struct uuid *olduuid)
char lbuf[LINEBUFSZ];
char *dflt = NULL;
uint32_t status;
- int num;
+ int menuid;
- num = PRT_uuid_to_type(olduuid);
- if (num == -1) {
+ menuid = PRT_uuid_to_menuid(olduuid);
+ if (menuid == -1) {
uuid_to_string(olduuid, &dflt, &status);
if (status != uuid_s_ok) {
printf("uuid_to_string() failed\n");
goto done;
}
- } else if (asprintf(&dflt, "%X", num) == -1) {
+ } else if (asprintf(&dflt, "%X", menuid) == -1) {
warn("asprintf()");
goto done;
}
@@ -627,8 +627,8 @@ ask_uuid(const struct uuid *olduuid)
if (status == uuid_s_ok)
goto done;
- num = hex_octet(lbuf);
- switch (num) {
+ menuid = hex_octet(lbuf);
+ switch (menuid) {
case -1:
printf("'%s' is not a valid partition id\n", lbuf);
break;
@@ -636,7 +636,7 @@ ask_uuid(const struct uuid *olduuid)
uuid_create_nil(&uuid, NULL);
goto done;
default:
- uuid = *PRT_type_to_guid(num);
+ uuid = *PRT_menuid_to_guid(menuid);
if (uuid_is_nil(&uuid, NULL) == 0)
goto done;
printf("'%s' has no associated UUID\n", lbuf);
diff --git a/sbin/fdisk/part.c b/sbin/fdisk/part.c
index ef2bf129e15..8e0af123128 100644
--- a/sbin/fdisk/part.c
+++ b/sbin/fdisk/part.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: part.c,v 1.141 2023/03/29 15:55:34 krw Exp $ */
+/* $OpenBSD: part.c,v 1.142 2023/03/29 19:34:49 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -141,7 +141,7 @@ const struct mbr_type mbr_types[] = {
};
struct gpt_type {
- int gt_type;
+ int gt_menuid;
int gt_attr;
#define GTATTR_PROTECT (1 << 0)
#define GTATTR_PROTECT_EFISYS (1 << 1)
@@ -342,11 +342,11 @@ PRT_print_gptmenu(char *lbuf, size_t lbuflen)
printf("Choose from the following Partition id values:\n");
for (i = 0; i < idrows; i++) {
for (cidx = i; cidx < i + idrows * 3; cidx += idrows) {
- printf("%02X %-15s", gpt_types[cidx].gt_type,
+ printf("%02X %-15s", gpt_types[cidx].gt_menuid,
gpt_types[cidx].gt_name);
}
if (cidx < nitems(gpt_types))
- printf("%02X %s", gpt_types[cidx].gt_type,
+ printf("%02X %s", gpt_types[cidx].gt_menuid,
gpt_types[cidx].gt_name);
printf("\n");
}
@@ -521,7 +521,7 @@ PRT_uuid_to_name(const struct uuid *uuid)
}
int
-PRT_uuid_to_type(const struct uuid *uuid)
+PRT_uuid_to_menuid(const struct uuid *uuid)
{
const struct gpt_type *gt;
@@ -529,11 +529,11 @@ PRT_uuid_to_type(const struct uuid *uuid)
if (gt == NULL)
return -1;
else
- return gt->gt_type;
+ return gt->gt_menuid;
}
const struct uuid *
-PRT_type_to_guid(const int type)
+PRT_menuid_to_guid(const int menuid)
{
static struct uuid guid;
int i, entries;
@@ -544,7 +544,7 @@ PRT_type_to_guid(const int type)
entries = nitems(gpt_types);
for (i = 0; i < entries; i++) {
- if (gpt_types[i].gt_type == type)
+ if (gpt_types[i].gt_menuid == menuid)
break;
}
if (i < entries)
diff --git a/sbin/fdisk/part.h b/sbin/fdisk/part.h
index 7f2d114b044..3dc76b83d6c 100644
--- a/sbin/fdisk/part.h
+++ b/sbin/fdisk/part.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: part.h,v 1.41 2023/03/26 16:23:58 krw Exp $ */
+/* $OpenBSD: part.h,v 1.42 2023/03/29 19:34:49 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -38,7 +38,7 @@ void PRT_make(const struct prt *,const uint64_t, const uint64_t,
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_type(const struct uuid *);
-const struct uuid *PRT_type_to_guid(const int);
+int PRT_uuid_to_menuid(const struct uuid *);
+const struct uuid *PRT_menuid_to_guid(const int);
int PRT_protected_guid(const struct uuid *);
int PRT_lba_to_chs(const struct prt*, struct chs *, struct chs*);