svn commit: r230565 - stable/8/sys/geom/part
Andrey V. Elsukov
ae at FreeBSD.org
Thu Jan 26 07:42:55 UTC 2012
Author: ae
Date: Thu Jan 26 07:42:54 2012
New Revision: 230565
URL: http://svn.freebsd.org/changeset/base/230565
Log:
MFC r215118:
Move code for search of existing geom into g_part_find_geom
function and use this function instead of g_part_parm_geom
in g_part_ctl_create.
Modified:
stable/8/sys/geom/part/g_part.c
Directory Properties:
stable/8/sys/ (props changed)
Modified: stable/8/sys/geom/part/g_part.c
==============================================================================
--- stable/8/sys/geom/part/g_part.c Thu Jan 26 07:03:30 2012 (r230564)
+++ stable/8/sys/geom/part/g_part.c Thu Jan 26 07:42:54 2012 (r230565)
@@ -299,6 +299,17 @@ g_part_new_provider(struct g_geom *gp, s
g_error_provider(entry->gpe_pp, 0);
}
+static struct g_geom*
+g_part_find_geom(const char *name)
+{
+ struct g_geom *gp;
+ LIST_FOREACH(gp, &g_part_class.geom, geom) {
+ if (!strcmp(name, gp->name))
+ break;
+ }
+ return (gp);
+}
+
static int
g_part_parm_geom(const char *name, struct g_geom **v)
{
@@ -306,10 +317,7 @@ g_part_parm_geom(const char *name, struc
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
name += strlen(_PATH_DEV);
- LIST_FOREACH(gp, &g_part_class.geom, geom) {
- if (!strcmp(name, gp->name))
- break;
- }
+ gp = g_part_find_geom(name);
if (gp == NULL)
return (EINVAL);
*v = gp;
@@ -682,8 +690,8 @@ g_part_ctl_create(struct gctl_req *req,
g_topology_assert();
/* Check that there isn't already a g_part geom on the provider. */
- error = g_part_parm_geom(pp->name, &gp);
- if (!error) {
+ gp = g_part_find_geom(pp->name);
+ if (gp != NULL) {
null = gp->softc;
if (null->gpt_scheme != &g_part_null_scheme) {
gctl_error(req, "%d geom '%s'", EEXIST, pp->name);
More information about the svn-src-all
mailing list