Allow to pass providers with /dev/ prefix to g_provider_by_name().

MFC after:	3 days
This commit is contained in:
Pawel Jakub Dawidek 2012-09-01 10:52:19 +00:00
parent 21fe0af7aa
commit 769afdc71e

View File

@ -686,6 +686,10 @@ g_resize_provider(struct g_provider *pp, off_t size)
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);
}