summaryrefslogtreecommitdiffstats
path: root/sbin/geom/core
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2007-11-04 00:32:54 +0000
committermarcel <marcel@FreeBSD.org>2007-11-04 00:32:54 +0000
commite52d34f074eb45508929484728604bbb8fb94593 (patch)
tree39bd6447af5779e5d5f8008faa8cd7b63166dfc0 /sbin/geom/core
parent46608d3cace876f78956135d50fcacc0c45d9a8e (diff)
downloadFreeBSD-src-e52d34f074eb45508929484728604bbb8fb94593.zip
FreeBSD-src-e52d34f074eb45508929484728604bbb8fb94593.tar.gz
Allow building of a special rescue version of geom that
has a subset of the classes compiled-in.
Diffstat (limited to 'sbin/geom/core')
-rw-r--r--sbin/geom/core/geom.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c
index cfa1e60..2345be3 100644
--- a/sbin/geom/core/geom.c
+++ b/sbin/geom/core/geom.c
@@ -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();
}
OpenPOWER on IntegriCloud