Changeset View
Changeset View
Standalone View
Standalone View
head/sys/geom/raid3/g_raid3_ctl.c
Show First 20 Lines • Show All 416 Lines • ▼ Show 20 Lines | if (*nargs != 2) { | ||||
gctl_error(req, "Invalid number of arguments."); | gctl_error(req, "Invalid number of arguments."); | ||||
return; | return; | ||||
} | } | ||||
hardcode = gctl_get_paraml(req, "hardcode", sizeof(*hardcode)); | hardcode = gctl_get_paraml(req, "hardcode", sizeof(*hardcode)); | ||||
if (hardcode == NULL) { | if (hardcode == NULL) { | ||||
gctl_error(req, "No '%s' argument.", "hardcode"); | gctl_error(req, "No '%s' argument.", "hardcode"); | ||||
return; | return; | ||||
} | } | ||||
name = gctl_get_asciiparam(req, "arg1"); | pp = gctl_get_provider(req, "arg1"); | ||||
if (name == NULL) { | if (pp == NULL) | ||||
gctl_error(req, "No 'arg%u' argument.", 1); | |||||
return; | return; | ||||
} | |||||
if (gctl_get_param(req, "number", NULL) != NULL) | if (gctl_get_param(req, "number", NULL) != NULL) | ||||
no = gctl_get_paraml(req, "number", sizeof(*no)); | no = gctl_get_paraml(req, "number", sizeof(*no)); | ||||
else | else | ||||
no = NULL; | no = NULL; | ||||
if (strncmp(name, _PATH_DEV, 5) == 0) | |||||
name += 5; | |||||
g_topology_lock(); | |||||
pp = g_provider_by_name(name); | |||||
if (pp == NULL) { | |||||
g_topology_unlock(); | |||||
gctl_error(req, "Invalid provider."); | |||||
return; | |||||
} | |||||
gp = g_new_geomf(mp, "raid3:insert"); | gp = g_new_geomf(mp, "raid3:insert"); | ||||
gp->orphan = g_raid3_ctl_insert_orphan; | gp->orphan = g_raid3_ctl_insert_orphan; | ||||
cp = g_new_consumer(gp); | cp = g_new_consumer(gp); | ||||
error = g_attach(cp, pp); | error = g_attach(cp, pp); | ||||
if (error != 0) { | if (error != 0) { | ||||
g_topology_unlock(); | g_topology_unlock(); | ||||
gctl_error(req, "Cannot attach to %s.", pp->name); | gctl_error(req, "Cannot attach to %s.", pp->name); | ||||
goto end; | goto end; | ||||
▲ Show 20 Lines • Show All 193 Lines • Show Last 20 Lines |