Allow building of a special rescue version of geom that
has a subset of the classes compiled-in.
This commit is contained in:
parent
a3393da7bf
commit
a16f9b367d
@ -1,5 +1,23 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.if defined(RESCUE)
|
||||
|
||||
.PATH: ${.CURDIR}/class/part ${.CURDIR}/core ${.CURDIR}/misc
|
||||
|
||||
PROG= geom
|
||||
SRCS= geom.c geom_part.c subr.c
|
||||
|
||||
CFLAGS+=-I${.CURDIR} -I${.CURDIR}/core
|
||||
|
||||
DPADD= ${LIBGEOM} ${LIBSBUF} ${LIBBSDXML} ${LIBUTIL}
|
||||
LDADD= -lgeom -lsbuf -lbsdxml -lutil
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
.else
|
||||
|
||||
SUBDIR= core class
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
||||
.endif
|
||||
|
@ -43,15 +43,21 @@ __FBSDID("$FreeBSD$");
|
||||
#include "core/geom.h"
|
||||
#include "misc/subr.h"
|
||||
|
||||
uint32_t lib_version = G_LIB_VERSION;
|
||||
uint32_t version = 0;
|
||||
#ifdef RESCUE
|
||||
#define PUBSYM(x) gpart_##x
|
||||
#else
|
||||
#define PUBSYM(x) x
|
||||
#endif
|
||||
|
||||
uint32_t PUBSYM(lib_version) = G_LIB_VERSION;
|
||||
uint32_t PUBSYM(version) = 0;
|
||||
|
||||
static char optional[] = "";
|
||||
static char flags[] = "C";
|
||||
|
||||
static void gpart_show(struct gctl_req *, unsigned);
|
||||
|
||||
struct g_command class_commands[] = {
|
||||
struct g_command PUBSYM(class_commands)[] = {
|
||||
{ "add", 0, NULL, {
|
||||
{ 'b', "start", NULL, G_TYPE_STRING },
|
||||
{ 's', "size", NULL, G_TYPE_STRING },
|
||||
|
@ -51,6 +51,10 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include "misc/subr.h"
|
||||
|
||||
#ifdef RESCUE
|
||||
extern uint32_t gpart_version;
|
||||
extern struct g_command gpart_class_commands[];
|
||||
#endif
|
||||
|
||||
static char comm[MAXPATHLEN], *class_name = NULL, *gclass_name = NULL;
|
||||
static uint32_t *version = NULL;
|
||||
@ -466,6 +470,7 @@ run_command(int argc, char *argv[])
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
#ifndef RESCUE
|
||||
static const char *
|
||||
library_path(void)
|
||||
{
|
||||
@ -524,6 +529,7 @@ load_library(void)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
#endif /* !RESCUE */
|
||||
|
||||
/*
|
||||
* Class name should be all capital letters.
|
||||
@ -571,8 +577,18 @@ get_class(int *argc, char ***argv)
|
||||
} else {
|
||||
errx(EXIT_FAILURE, "Invalid utility name.");
|
||||
}
|
||||
set_class_name();
|
||||
|
||||
#ifndef RESCUE
|
||||
load_library();
|
||||
#else
|
||||
if (!strcasecmp(class_name, "part")) {
|
||||
version = &gpart_version;
|
||||
class_commands = gpart_class_commands;
|
||||
} else
|
||||
errx(EXIT_FAILURE, "Invalid class name.");
|
||||
#endif /* !RESCUE */
|
||||
|
||||
set_class_name();
|
||||
if (*argc < 1)
|
||||
usage();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user