Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/gpt Add a query function (for external code) to enumera...
details: https://anonhg.NetBSD.org/src/rev/e8999825a080
branches: trunk
changeset: 446813:e8999825a080
user: martin <martin%NetBSD.org@localhost>
date: Thu Dec 20 14:58:10 2018 +0000
description:
Add a query function (for external code) to enumerate the know guids.
Add recently added VMware GUIDs to the internal enum type.
Fix some short names (bogus + duplicate).
diffstat:
sbin/gpt/gpt_uuid.c | 28 +++++++++++++++++++++++-----
sbin/gpt/gpt_uuid.h | 9 ++++++++-
2 files changed, 31 insertions(+), 6 deletions(-)
diffs (86 lines):
diff -r 07218deff0db -r e8999825a080 sbin/gpt/gpt_uuid.c
--- a/sbin/gpt/gpt_uuid.c Thu Dec 20 10:33:41 2018 +0000
+++ b/sbin/gpt/gpt_uuid.c Thu Dec 20 14:58:10 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gpt_uuid.c,v 1.16 2018/11/06 04:04:33 mrg Exp $ */
+/* $NetBSD: gpt_uuid.c,v 1.17 2018/12/20 14:58:10 martin Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifdef __RCSID
-__RCSID("$NetBSD: gpt_uuid.c,v 1.16 2018/11/06 04:04:33 mrg Exp $");
+__RCSID("$NetBSD: gpt_uuid.c,v 1.17 2018/12/20 14:58:10 martin Exp $");
#endif
#include <err.h>
@@ -87,9 +87,9 @@
{ GPT_ENT_TYPE_NETBSD_RAIDFRAME, "raid",
"NetBSD RAIDFrame component" },
{ GPT_ENT_TYPE_NETBSD_SWAP, "swap", "NetBSD swap" },
- { GPT_ENT_TYPE_VMWARE_VMKCORE, "swap", "VMware VMkernel core dump" },
- { GPT_ENT_TYPE_VMWARE_VMFS, "swap", "VMware VMFS" },
- { GPT_ENT_TYPE_VMWARE_RESERVED, "swap", "VMware reserved" },
+ { GPT_ENT_TYPE_VMWARE_VMKCORE, "vmcore", "VMware VMkernel core dump" },
+ { GPT_ENT_TYPE_VMWARE_VMFS, "vmfs", "VMware VMFS" },
+ { GPT_ENT_TYPE_VMWARE_RESERVED, "vmresered", "VMware reserved" },
};
static void
@@ -234,6 +234,23 @@
return 0;
}
+size_t
+gpt_uuid_query(
+ void (*func)(const char *uuid, const char *short_name, const char *desc))
+{
+ size_t i;
+ char buf[64];
+
+ if (func != NULL) {
+ for (i = 0; i < __arraycount(gpt_nv); i++) {
+ gpt_uuid_numeric(buf, sizeof(buf), &gpt_nv[i].u);
+ (*func)(buf, gpt_nv[i].n, gpt_nv[i].d);
+ }
+ }
+ return __arraycount(gpt_nv);
+}
+
+#ifndef GPT_UUID_QUERY_ONLY
void
gpt_uuid_help(const char *prefix)
{
@@ -323,3 +340,4 @@
gpt_dce_to_uuid(&u, t);
return 0;
}
+#endif
diff -r 07218deff0db -r e8999825a080 sbin/gpt/gpt_uuid.h
--- a/sbin/gpt/gpt_uuid.h Thu Dec 20 10:33:41 2018 +0000
+++ b/sbin/gpt/gpt_uuid.h Thu Dec 20 14:58:10 2018 +0000
@@ -67,7 +67,10 @@
GPT_TYPE_NETBSD_FFS,
GPT_TYPE_NETBSD_LFS,
GPT_TYPE_NETBSD_RAIDFRAME,
- GPT_TYPE_NETBSD_SWAP
+ GPT_TYPE_NETBSD_SWAP,
+ GPT_TYPE_VMWARE_VMKCORE,
+ GPT_TYPE_VMWARE_VMFS,
+ GPT_TYPE_VMWARE_RESERVED
} gpt_type_t;
typedef uint8_t gpt_uuid_t[16];
@@ -98,6 +101,10 @@
struct gpt;
int gpt_uuid_generate(struct gpt *, gpt_uuid_t);
+/* returns number of entries, callback func may be NULL */
+size_t gpt_uuid_query(
+ void (*func)(const char *uuid, const char *short_name, const char *desc));
+
void gpt_uuid_help(const char *);
__END_DECLS
Home |
Main Index |
Thread Index |
Old Index