Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Mar 2009 14:23:17 +0000 (UTC)
From:      Ivan Voras <ivoras@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r190058 - head/sys/geom/part
Message-ID:  <200903191423.n2JENHUl064869@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903191423.n2JENHUl064869>