-/* $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
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;
}
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;
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);
-/* $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
};
struct gpt_type {
- int gt_type;
+ int gt_menuid;
int gt_attr;
#define GTATTR_PROTECT (1 << 0)
#define GTATTR_PROTECT_EFISYS (1 << 1)
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");
}
}
int
-PRT_uuid_to_type(const struct uuid *uuid)
+PRT_uuid_to_menuid(const struct uuid *uuid)
{
const struct gpt_type *gt;
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;
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)
-/* $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
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*);