Changeset View
Changeset View
Standalone View
Standalone View
sys/geom/union/g_union.c
Show First 20 Lines • Show All 164 Lines • ▼ Show 20 Lines | g_union_ctl_create(struct gctl_req *req, struct g_class *mp, bool verbose) | ||||
if (*nargs > 2) { | if (*nargs > 2) { | ||||
gctl_error(req, "Extra device(s)."); | gctl_error(req, "Extra device(s)."); | ||||
return; | return; | ||||
} | } | ||||
offset = g_union_fetcharg(req, "offset"); | offset = g_union_fetcharg(req, "offset"); | ||||
size = g_union_fetcharg(req, "size"); | size = g_union_fetcharg(req, "size"); | ||||
secsize = g_union_fetcharg(req, "secsize"); | secsize = g_union_fetcharg(req, "secsize"); | ||||
gunionname = gctl_get_asciiparam(req, "gunionname"); | gunionname = gctl_get_providername(req, "gunionname"); | ||||
if (gunionname == NULL) | |||||
/* error message provided by gctl_get_providername() */ | |||||
return; | |||||
upperpp = gctl_get_provider(req, "arg0"); | upperpp = gctl_get_provider(req, "arg0"); | ||||
lowerpp = gctl_get_provider(req, "arg1"); | lowerpp = gctl_get_provider(req, "arg1"); | ||||
if (upperpp == NULL || lowerpp == NULL) | if (upperpp == NULL || lowerpp == NULL) | ||||
/* error message provided by gctl_get_provider() */ | /* error message provided by gctl_get_provider() */ | ||||
return; | return; | ||||
/* Create the union */ | /* Create the union */ | ||||
if (secsize == 0) | if (secsize == 0) | ||||
▲ Show 20 Lines • Show All 236 Lines • ▼ Show 20 Lines | g_union_ctl_destroy(struct gctl_req *req, struct g_class *mp, bool verbose) | ||||
force = gctl_get_paraml(req, "force", sizeof(*force)); | force = gctl_get_paraml(req, "force", sizeof(*force)); | ||||
if (force == NULL) { | if (force == NULL) { | ||||
gctl_error(req, "No 'force' argument."); | gctl_error(req, "No 'force' argument."); | ||||
return; | return; | ||||
} | } | ||||
for (i = 0; i < *nargs; i++) { | for (i = 0; i < *nargs; i++) { | ||||
snprintf(param, sizeof(param), "arg%d", i); | snprintf(param, sizeof(param), "arg%d", i); | ||||
name = gctl_get_asciiparam(req, param); | name = gctl_get_providername(req, param); | ||||
if (name == NULL) { | if (name == NULL) | ||||
gctl_msg(req, "No '%s' argument.", param); | |||||
continue; | continue; | ||||
} | |||||
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0) | |||||
name += strlen(_PATH_DEV); | |||||
gp = g_union_find_geom(mp, name); | gp = g_union_find_geom(mp, name); | ||||
if (gp == NULL) { | if (gp == NULL) { | ||||
gctl_msg(req, "Device %s is invalid.", name); | gctl_msg(req, "Device %s is invalid.", name); | ||||
continue; | continue; | ||||
} | } | ||||
error = g_union_destroy(verbose ? req : NULL, gp, *force); | error = g_union_destroy(verbose ? req : NULL, gp, *force); | ||||
if (error != 0) | if (error != 0) | ||||
gctl_msg(req, "Error %d: cannot destroy device %s.", | gctl_msg(req, "Error %d: cannot destroy device %s.", | ||||
▲ Show 20 Lines • Show All 956 Lines • Show Last 20 Lines |