Make it possible to build glabel into rescue geom(8) utility.
Ok'ed by: marcel No objection: -current@
This commit is contained in:
parent
365714faf0
commit
2d536251f1
@ -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
|
||||
|
||||
|
@ -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 ..."
|
||||
},
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user