From owner-freebsd-current@FreeBSD.ORG Sat Jan 12 01:19:29 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5603B16A418 for ; Sat, 12 Jan 2008 01:19:29 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.delphij.net (delphij-pt.tunnel.tserv2.fmt.ipv6.he.net [IPv6:2001:470:1f03:2c9::2]) by mx1.freebsd.org (Postfix) with ESMTP id E51B713C4E8 for ; Sat, 12 Jan 2008 01:19:28 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.geekcn.org (unknown [202.108.54.204]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tarsier.delphij.net (Postfix) with ESMTP id A52D328449 for ; Sat, 12 Jan 2008 09:19:27 +0800 (CST) Received: from localhost (unknown [202.108.54.204]) by tarsier.geekcn.org (Postfix) with ESMTP id 68F9AEB3A62; Sat, 12 Jan 2008 09:19:27 +0800 (CST) X-Virus-Scanned: amavisd-new at geekcn.org Received: from tarsier.geekcn.org ([202.108.54.204]) by localhost (mail.geekcn.org [202.108.54.204]) (amavisd-new, port 10024) with ESMTP id v9DMkRnSgAc6; Sat, 12 Jan 2008 09:19:25 +0800 (CST) Received: from charlie.delphij.net (71.5.7.139.ptr.us.xo.net [71.5.7.139]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tarsier.geekcn.org (Postfix) with ESMTP id 3DE6FEB37EB; Sat, 12 Jan 2008 09:19:24 +0800 (CST) DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns; h=message-id:date:from:reply-to:organization:user-agent: mime-version:to:subject:x-enigmail-version:openpgp:content-type; b=FSRRHAywc1fJQ+v1/rnANAZIH9glpiLfuI+Lsk6ZWPqn9INQqmJ1Zw5+QVU4RSPz+ R/yddcis+f01Q35rYQ3Dw== Message-ID: <4788159A.2070703@delphij.net> Date: Fri, 11 Jan 2008 17:19:22 -0800 From: Xin LI Organization: The FreeBSD Project User-Agent: Thunderbird 2.0.0.9 (X11/20071125) MIME-Version: 1.0 To: FreeBSD Current X-Enigmail-Version: 0.95.5 OpenPGP: id=18EDEBA0; url=http://www.delphij.net/delphij.asc Content-Type: multipart/mixed; boundary="------------010507080403060808030601" Subject: [PATCH] Add 'label' to rescue/geom X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Jan 2008 01:19:29 -0000 This is a multi-part message in MIME format. --------------010507080403060808030601 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit -----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 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----- --------------010507080403060808030601 Content-Type: text/plain; name="geom-label.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="geom-label.diff" 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 */ --------------010507080403060808030601--