From 2d536251f1014c4a5602ae7e7a336ed297b56421 Mon Sep 17 00:00:00 2001 From: delphij Date: Wed, 5 Mar 2008 23:31:49 +0000 Subject: [PATCH] Make it possible to build glabel into rescue geom(8) utility. Ok'ed by: marcel No objection: -current@ --- sbin/geom/Makefile | 7 +++++-- sbin/geom/class/label/geom_label.c | 11 ++++++++--- sbin/geom/core/geom.c | 5 +++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/sbin/geom/Makefile b/sbin/geom/Makefile index af2b77bbec28..0cb98d1f3a54 100644 --- a/sbin/geom/Makefile +++ b/sbin/geom/Makefile @@ -2,10 +2,13 @@ .if defined(RESCUE) -.PATH: ${.CURDIR}/class/part ${.CURDIR}/core ${.CURDIR}/misc +.PATH: ${.CURDIR}/class/part \ + ${.CURDIR}/class/label \ + ${.CURDIR}/core \ + ${.CURDIR}/misc PROG= geom -SRCS= geom.c geom_part.c subr.c +SRCS= geom.c geom_label.c geom_part.c subr.c CFLAGS+=-I${.CURDIR} -I${.CURDIR}/core diff --git a/sbin/geom/class/label/geom_label.c b/sbin/geom/class/label/geom_label.c index 9e27eec376e8..eec20ca7e7a3 100644 --- a/sbin/geom/class/label/geom_label.c +++ b/sbin/geom/class/label/geom_label.c @@ -40,16 +40,21 @@ __FBSDID("$FreeBSD$"); #include "core/geom.h" #include "misc/subr.h" +#ifdef RESCUE +#define PUBSYM(x) glabel_##x +#else +#define PUBSYM(x) x +#endif -uint32_t lib_version = G_LIB_VERSION; -uint32_t version = G_LABEL_VERSION; +uint32_t PUBSYM(lib_version) = G_LIB_VERSION; +uint32_t PUBSYM(version) = G_LABEL_VERSION; static void label_main(struct gctl_req *req, unsigned flags); static void label_clear(struct gctl_req *req); static void label_dump(struct gctl_req *req); static void label_label(struct gctl_req *req); -struct g_command class_commands[] = { +struct g_command PUBSYM(class_commands)[] = { { "clear", G_FLAG_VERBOSE, label_main, G_NULL_OPTS, NULL, "[-v] dev ..." }, diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c index 91fb2f29a96f..8726e626a9a3 100644 --- a/sbin/geom/core/geom.c +++ b/sbin/geom/core/geom.c @@ -54,6 +54,8 @@ __FBSDID("$FreeBSD$"); #ifdef RESCUE extern uint32_t gpart_version; extern struct g_command gpart_class_commands[]; +extern uint32_t glabel_version; +extern struct g_command glabel_class_commands[]; #endif static char comm[MAXPATHLEN], *class_name = NULL, *gclass_name = NULL; @@ -604,6 +606,9 @@ get_class(int *argc, char ***argv) if (!strcasecmp(class_name, "part")) { version = &gpart_version; class_commands = gpart_class_commands; + } else if (!strcasecmp(class_name, "label")) { + version = &glabel_version; + class_commands = glabel_class_commands; } else errx(EXIT_FAILURE, "Invalid class name."); #endif /* !RESCUE */