Replace checks for RESCUE in sources with checks for STATIC_GEOM_CLASSES
and define STATIC_GEOM_CLASSES when building the rescue binary. This way geom can more easily be part of other crunched binaries, as it requires only a Makefile change.
This commit is contained in:
parent
48f6b9b8b1
commit
14bf405be4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=179550
@ -10,7 +10,7 @@
|
|||||||
PROG= geom
|
PROG= geom
|
||||||
SRCS= geom.c geom_label.c geom_part.c subr.c
|
SRCS= geom.c geom_label.c geom_part.c subr.c
|
||||||
|
|
||||||
CFLAGS+=-I${.CURDIR} -I${.CURDIR}/core
|
CFLAGS+=-I${.CURDIR} -I${.CURDIR}/core -DSTATIC_GEOM_CLASSES
|
||||||
|
|
||||||
DPADD= ${LIBGEOM} ${LIBSBUF} ${LIBBSDXML} ${LIBUTIL}
|
DPADD= ${LIBGEOM} ${LIBSBUF} ${LIBBSDXML} ${LIBUTIL}
|
||||||
LDADD= -lgeom -lsbuf -lbsdxml -lutil
|
LDADD= -lgeom -lsbuf -lbsdxml -lutil
|
||||||
|
@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include "core/geom.h"
|
#include "core/geom.h"
|
||||||
#include "misc/subr.h"
|
#include "misc/subr.h"
|
||||||
|
|
||||||
#ifdef RESCUE
|
#ifdef STATIC_GEOM_CLASSES
|
||||||
#define PUBSYM(x) glabel_##x
|
#define PUBSYM(x) glabel_##x
|
||||||
#else
|
#else
|
||||||
#define PUBSYM(x) x
|
#define PUBSYM(x) x
|
||||||
|
@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include "core/geom.h"
|
#include "core/geom.h"
|
||||||
#include "misc/subr.h"
|
#include "misc/subr.h"
|
||||||
|
|
||||||
#ifdef RESCUE
|
#ifdef STATIC_GEOM_CLASSES
|
||||||
#define PUBSYM(x) gpart_##x
|
#define PUBSYM(x) gpart_##x
|
||||||
#else
|
#else
|
||||||
#define PUBSYM(x) x
|
#define PUBSYM(x) x
|
||||||
|
@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include "misc/subr.h"
|
#include "misc/subr.h"
|
||||||
|
|
||||||
#ifdef RESCUE
|
#ifdef STATIC_GEOM_CLASSES
|
||||||
extern uint32_t gpart_version;
|
extern uint32_t gpart_version;
|
||||||
extern struct g_command gpart_class_commands[];
|
extern struct g_command gpart_class_commands[];
|
||||||
extern uint32_t glabel_version;
|
extern uint32_t glabel_version;
|
||||||
@ -472,7 +472,7 @@ run_command(int argc, char *argv[])
|
|||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef RESCUE
|
#ifndef STATIC_GEOM_CLASSES
|
||||||
static const char *
|
static const char *
|
||||||
library_path(void)
|
library_path(void)
|
||||||
{
|
{
|
||||||
@ -551,7 +551,7 @@ load_library(void)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* !RESCUE */
|
#endif /* !STATIC_GEOM_CLASSES */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class name should be all capital letters.
|
* Class name should be all capital letters.
|
||||||
@ -600,7 +600,7 @@ get_class(int *argc, char ***argv)
|
|||||||
errx(EXIT_FAILURE, "Invalid utility name.");
|
errx(EXIT_FAILURE, "Invalid utility name.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef RESCUE
|
#ifndef STATIC_GEOM_CLASSES
|
||||||
load_library();
|
load_library();
|
||||||
#else
|
#else
|
||||||
if (!strcasecmp(class_name, "part")) {
|
if (!strcasecmp(class_name, "part")) {
|
||||||
@ -611,7 +611,7 @@ get_class(int *argc, char ***argv)
|
|||||||
class_commands = glabel_class_commands;
|
class_commands = glabel_class_commands;
|
||||||
} else
|
} else
|
||||||
errx(EXIT_FAILURE, "Invalid class name.");
|
errx(EXIT_FAILURE, "Invalid class name.");
|
||||||
#endif /* !RESCUE */
|
#endif /* !STATIC_GEOM_CLASSES */
|
||||||
|
|
||||||
set_class_name();
|
set_class_name();
|
||||||
if (*argc < 1)
|
if (*argc < 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user