[PATCH] Add 'label' to rescue/geom

From: Xin LI <delphij_at_delphij.net>
Date: Fri, 11 Jan 2008 17:19:22 -0800
-----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-----

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
_at__at_ -2,10 +2,10 _at__at_
 
 .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
_at__at_ -40,16 +40,21 _at__at_ __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
_at__at_ -54,6 +54,8 _at__at_ __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;
_at__at_ -584,6 +586,9 _at__at_ 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 */
Received on Sat Jan 12 2008 - 00:19:29 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:25 UTC