Changeset View
Changeset View
Standalone View
Standalone View
sys/geom/journal/g_journal.c
Show First 20 Lines • Show All 2,506 Lines • ▼ Show 20 Lines | |||||
static struct g_journal_softc * | static struct g_journal_softc * | ||||
g_journal_find_device(struct g_class *mp, const char *name) | g_journal_find_device(struct g_class *mp, const char *name) | ||||
{ | { | ||||
struct g_journal_softc *sc; | struct g_journal_softc *sc; | ||||
struct g_geom *gp; | struct g_geom *gp; | ||||
struct g_provider *pp; | struct g_provider *pp; | ||||
if (strncmp(name, _PATH_DEV, 5) == 0) | |||||
name += 5; | |||||
LIST_FOREACH(gp, &mp->geom, geom) { | LIST_FOREACH(gp, &mp->geom, geom) { | ||||
sc = gp->softc; | sc = gp->softc; | ||||
if (sc == NULL) | if (sc == NULL) | ||||
continue; | continue; | ||||
if (sc->sc_flags & GJF_DEVICE_DESTROY) | if (sc->sc_flags & GJF_DEVICE_DESTROY) | ||||
continue; | continue; | ||||
if ((sc->sc_type & GJ_TYPE_COMPLETE) != GJ_TYPE_COMPLETE) | if ((sc->sc_type & GJ_TYPE_COMPLETE) != GJ_TYPE_COMPLETE) | ||||
continue; | continue; | ||||
Show All 24 Lines | g_journal_ctl_destroy(struct gctl_req *req, struct g_class *mp) | ||||
} | } | ||||
if (*nargs <= 0) { | if (*nargs <= 0) { | ||||
gctl_error(req, "Missing device(s)."); | gctl_error(req, "Missing device(s)."); | ||||
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; | ||||
} | |||||
sc = g_journal_find_device(mp, name); | sc = g_journal_find_device(mp, name); | ||||
if (sc == NULL) { | if (sc == NULL) { | ||||
gctl_error(req, "No such device: %s.", name); | gctl_error(req, "No such device: %s.", name); | ||||
return; | return; | ||||
} | } | ||||
error = g_journal_destroy(sc); | error = g_journal_destroy(sc); | ||||
if (error != 0) { | if (error != 0) { | ||||
gctl_error(req, "Cannot destroy device %s (error=%d).", | gctl_error(req, "Cannot destroy device %s (error=%d).", | ||||
▲ Show 20 Lines • Show All 454 Lines • Show Last 20 Lines |