svn commit: r239987 - head/sys/geom

Pawel Jakub Dawidek pjd at FreeBSD.org
Sat Sep 1 10:52:19 UTC 2012


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);
 }
 


More information about the svn-src-all mailing list