[PATCH] Add 'label' to rescue/geom
Xin LI
delphij at delphij.net
Fri Jan 11 17:19:29 PST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I found that it might be useful to add 'label' to rescue/geom as well.
Attached is a patch to implement this.
This adds ~80KB to rescue binary on FreeBSD/amd64.
Cheers,
- --
Xin LI <delphij at delphij.net> http://www.delphij.net/
FreeBSD - The Power to Serve!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)
iD8DBQFHiBWai+vbBBjt66ARAopvAKDC0ql1CDBPerwHgUzpiSzSkvRj+gCgjM49
0hUbFgvJl2x4+Lh0kzohX+Q=
=YZDq
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: Makefile
===================================================================
RCS file: /home/ncvs/src/sbin/geom/Makefile,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile
--- Makefile 4 Nov 2007 00:32:53 -0000 1.2
+++ Makefile 12 Jan 2008 01:11:57 -0000
@@ -2,10 +2,10 @@
.if defined(RESCUE)
-.PATH: ${.CURDIR}/class/part ${.CURDIR}/core ${.CURDIR}/misc
+.PATH: ${.CURDIR}/class/label ${.CURDIR}/class/part ${.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
Index: class/label/geom_label.c
===================================================================
RCS file: /home/ncvs/src/sbin/geom/class/label/geom_label.c,v
retrieving revision 1.10
diff -u -p -r1.10 geom_label.c
--- class/label/geom_label.c 15 May 2007 20:25:16 -0000 1.10
+++ class/label/geom_label.c 12 Jan 2008 01:09:06 -0000
@@ -40,16 +40,21 @@ __FBSDID("$FreeBSD: src/sbin/geom/class/
#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 ..."
},
Index: core/geom.c
===================================================================
RCS file: /home/ncvs/src/sbin/geom/core/geom.c,v
retrieving revision 1.33
diff -u -p -r1.33 geom.c
--- core/geom.c 4 Nov 2007 00:32:54 -0000 1.33
+++ core/geom.c 12 Jan 2008 01:15:02 -0000
@@ -54,6 +54,8 @@ __FBSDID("$FreeBSD: src/sbin/geom/core/g
#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;
@@ -584,6 +586,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 */
More information about the freebsd-current
mailing list