From owner-svn-src-head@FreeBSD.ORG Thu Mar 19 14:23:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F9971065670; Thu, 19 Mar 2009 14:23:18 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E793E8FC1E; Thu, 19 Mar 2009 14:23:17 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2JENH56064871; Thu, 19 Mar 2009 14:23:17 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2JENHUl064869; Thu, 19 Mar 2009 14:23:17 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <200903191423.n2JENHUl064869@svn.freebsd.org> From: Ivan Voras Date: Thu, 19 Mar 2009 14:23:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190058 - head/sys/geom/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Mar 2009 14:23:18 -0000 Author: ivoras Date: Thu Mar 19 14:23:17 2009 New Revision: 190058 URL: http://svn.freebsd.org/changeset/base/190058 Log: Make GEOM provider names starting with "/dev/" acceptable as well as their "raw" names. While there, change the formatting of extended MSDOS partitions so that the dot (".") is not used to separate two numbers (which kind of looks like the whole is a decimal number). Use "+" instead, which also hints that the second part of the name is the offset from the start of the partition in the first part of the name. Also change the offset from decimal to hexadecimal notation, simply for aesthetic reasons and future compatibility. GEOM_PART is the default in 8-CURRENT but not yet in 7-STABLE so this changeset can be MFC-ed without causing major problems from the second part. Reviewed by: marcel Approved by: gnn (mentor) MFC after: 2 weeks Modified: head/sys/geom/part/g_part.c head/sys/geom/part/g_part_ebr.c Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Thu Mar 19 14:20:00 2009 (r190057) +++ head/sys/geom/part/g_part.c Thu Mar 19 14:23:17 2009 (r190058) @@ -49,6 +49,10 @@ __FBSDID("$FreeBSD$"); #include "g_part_if.h" +#ifndef _PATH_DEV +#define _PATH_DEV "/dev/" +#endif + static kobj_method_t g_part_null_methods[] = { { 0, 0 } }; @@ -273,12 +277,17 @@ g_part_new_provider(struct g_geom *gp, s } static int -g_part_parm_geom(const char *p, struct g_geom **v) +g_part_parm_geom(const char *rawname, struct g_geom **v) { struct g_geom *gp; + const char *pname; + if (strncmp(rawname, _PATH_DEV, strlen(_PATH_DEV)) == 0) + pname = rawname + strlen(_PATH_DEV); + else + pname = rawname; LIST_FOREACH(gp, &g_part_class.geom, geom) { - if (!strcmp(p, gp->name)) + if (!strcmp(pname, gp->name)) break; } if (gp == NULL) @@ -288,11 +297,14 @@ g_part_parm_geom(const char *p, struct g } static int -g_part_parm_provider(const char *p, struct g_provider **v) +g_part_parm_provider(const char *pname, struct g_provider **v) { struct g_provider *pp; - pp = g_provider_by_name(p); + if (strncmp(pname, _PATH_DEV, strlen(_PATH_DEV)) == 0) + pp = g_provider_by_name(pname + strlen(_PATH_DEV)); + else + pp = g_provider_by_name(pname); if (pp == NULL) return (EINVAL); *v = pp; Modified: head/sys/geom/part/g_part_ebr.c ============================================================================== --- head/sys/geom/part/g_part_ebr.c Thu Mar 19 14:20:00 2009 (r190057) +++ head/sys/geom/part/g_part_ebr.c Thu Mar 19 14:23:17 2009 (r190058) @@ -343,7 +343,7 @@ g_part_ebr_name(struct g_part_table *tab char *buf, size_t bufsz) { - snprintf(buf, bufsz, ".%08u", entry->gpe_index); + snprintf(buf, bufsz, "+%08x", entry->gpe_index); return (buf); }