Changeset View
Changeset View
Standalone View
Standalone View
sys/geom/label/g_label.c
Show First 20 Lines • Show All 469 Lines • ▼ Show 20 Lines | g_label_ctl_create(struct gctl_req *req, struct g_class *mp) | ||||
g_label_create(req, mp, pp, name, G_LABEL_DIRPREFIX, pp->mediasize); | g_label_create(req, mp, pp, name, G_LABEL_DIRPREFIX, pp->mediasize); | ||||
} | } | ||||
static const char * | static const char * | ||||
g_label_skip_dir(const char *name) | g_label_skip_dir(const char *name) | ||||
{ | { | ||||
u_int i; | u_int i; | ||||
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0) | |||||
name += strlen(_PATH_DEV); | |||||
for (i = 0; g_labels[i] != NULL; i++) { | for (i = 0; g_labels[i] != NULL; i++) { | ||||
if (strncmp(name, g_labels[i]->ld_dirprefix, | if (strncmp(name, g_labels[i]->ld_dirprefix, | ||||
strlen(g_labels[i]->ld_dirprefix)) == 0) { | strlen(g_labels[i]->ld_dirprefix)) == 0) { | ||||
name += strlen(g_labels[i]->ld_dirprefix); | name += strlen(g_labels[i]->ld_dirprefix); | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
return (name); | return (name); | ||||
Show All 38 Lines | g_label_ctl_destroy(struct gctl_req *req, struct g_class *mp) | ||||
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_error(req, "No 'arg%d' argument", i); | |||||
return; | return; | ||||
} | |||||
gp = g_label_find_geom(mp, name); | gp = g_label_find_geom(mp, name); | ||||
if (gp == NULL) { | if (gp == NULL) { | ||||
G_LABEL_DEBUG(1, "Label %s is invalid.", name); | G_LABEL_DEBUG(1, "Label %s is invalid.", name); | ||||
gctl_error(req, "Label %s is invalid.", name); | gctl_error(req, "Label %s is invalid.", name); | ||||
return; | return; | ||||
} | } | ||||
error = g_label_destroy(gp, *force); | error = g_label_destroy(gp, *force); | ||||
if (error != 0) { | if (error != 0) { | ||||
Show All 38 Lines |