Make it possible to build glabel into rescue geom(8) utility.
Ok'ed by: marcel No objection: -current@
This commit is contained in:
parent
a6a568708b
commit
bc69d66f2f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=176852
@ -2,10 +2,13 @@
|
|||||||
|
|
||||||
.if defined(RESCUE)
|
.if defined(RESCUE)
|
||||||
|
|
||||||
.PATH: ${.CURDIR}/class/part ${.CURDIR}/core ${.CURDIR}/misc
|
.PATH: ${.CURDIR}/class/part \
|
||||||
|
${.CURDIR}/class/label \
|
||||||
|
${.CURDIR}/core \
|
||||||
|
${.CURDIR}/misc
|
||||||
|
|
||||||
PROG= geom
|
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
|
CFLAGS+=-I${.CURDIR} -I${.CURDIR}/core
|
||||||
|
|
||||||
|
@ -40,16 +40,21 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include "core/geom.h"
|
#include "core/geom.h"
|
||||||
#include "misc/subr.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 PUBSYM(lib_version) = G_LIB_VERSION;
|
||||||
uint32_t version = G_LABEL_VERSION;
|
uint32_t PUBSYM(version) = G_LABEL_VERSION;
|
||||||
|
|
||||||
static void label_main(struct gctl_req *req, unsigned flags);
|
static void label_main(struct gctl_req *req, unsigned flags);
|
||||||
static void label_clear(struct gctl_req *req);
|
static void label_clear(struct gctl_req *req);
|
||||||
static void label_dump(struct gctl_req *req);
|
static void label_dump(struct gctl_req *req);
|
||||||
static void label_label(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,
|
{ "clear", G_FLAG_VERBOSE, label_main, G_NULL_OPTS, NULL,
|
||||||
"[-v] dev ..."
|
"[-v] dev ..."
|
||||||
},
|
},
|
||||||
|
@ -54,6 +54,8 @@ __FBSDID("$FreeBSD$");
|
|||||||
#ifdef RESCUE
|
#ifdef RESCUE
|
||||||
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 struct g_command glabel_class_commands[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char comm[MAXPATHLEN], *class_name = NULL, *gclass_name = NULL;
|
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")) {
|
if (!strcasecmp(class_name, "part")) {
|
||||||
version = &gpart_version;
|
version = &gpart_version;
|
||||||
class_commands = gpart_class_commands;
|
class_commands = gpart_class_commands;
|
||||||
|
} else if (!strcasecmp(class_name, "label")) {
|
||||||
|
version = &glabel_version;
|
||||||
|
class_commands = glabel_class_commands;
|
||||||
} else
|
} else
|
||||||
errx(EXIT_FAILURE, "Invalid class name.");
|
errx(EXIT_FAILURE, "Invalid class name.");
|
||||||
#endif /* !RESCUE */
|
#endif /* !RESCUE */
|
||||||
|
Loading…
Reference in New Issue
Block a user