svn commit: r240267 - stable/9/sys/geom

Mikolaj Golub trociny at FreeBSD.org
Sun Sep 9 08:28:18 UTC 2012


Author: trociny
Date: Sun Sep  9 08:28:17 2012
New Revision: 240267
URL: http://svn.freebsd.org/changeset/base/240267

Log:
  MFC r239987 (pjd):
  
  Allow to pass providers with /dev/ prefix to g_provider_by_name().

Modified:
  stable/9/sys/geom/geom_subr.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/geom_subr.c
==============================================================================
--- stable/9/sys/geom/geom_subr.c	Sun Sep  9 08:21:06 2012	(r240266)
+++ stable/9/sys/geom/geom_subr.c	Sun Sep  9 08:28:17 2012	(r240267)
@@ -601,6 +601,10 @@ g_error_provider(struct g_provider *pp, 
 	pp->error = error;
 }
 
+#ifndef	_PATH_DEV
+#define	_PATH_DEV	"/dev/"
+#endif
+
 struct g_provider *
 g_provider_by_name(char const *arg)
 {
@@ -608,6 +612,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) {
@@ -616,6 +623,7 @@ g_provider_by_name(char const *arg)
 			}
 		}
 	}
+
 	return (NULL);
 }
 


More information about the svn-src-stable-9 mailing list