Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Sep 2012 10:52:19 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r239987 - head/sys/geom
Message-ID:  <201209011052.q81AqJqG096627@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Sat Sep  1 10:52:19 2012
New Revision: 239987
URL: http://svn.freebsd.org/changeset/base/239987

Log:
  Allow to pass providers with /dev/ prefix to g_provider_by_name().
  
  MFC after:	3 days

Modified:
  head/sys/geom/geom_subr.c

Modified: head/sys/geom/geom_subr.c
==============================================================================
--- head/sys/geom/geom_subr.c	Sat Sep  1 10:48:38 2012	(r239986)
+++ head/sys/geom/geom_subr.c	Sat Sep  1 10:52:19 2012	(r239987)
@@ -686,6 +686,10 @@ g_resize_provider(struct g_provider *pp,
 	g_post_event(g_resize_provider_event, hh, M_WAITOK, NULL);
 }
 
+#ifndef	_PATH_DEV
+#define	_PATH_DEV	"/dev/"
+#endif
+
 struct g_provider *
 g_provider_by_name(char const *arg)
 {
@@ -693,6 +697,9 @@ g_provider_by_name(char const *arg)
 	struct g_geom *gp;
 	struct g_provider *pp;
 
+	if (strncmp(arg, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
+		arg += sizeof(_PATH_DEV) - 1;
+
 	LIST_FOREACH(cp, &g_classes, class) {
 		LIST_FOREACH(gp, &cp->geom, geom) {
 			LIST_FOREACH(pp, &gp->provider, provider) {
@@ -701,6 +708,7 @@ g_provider_by_name(char const *arg)
 			}
 		}
 	}
+
 	return (NULL);
 }
 



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