Changeset View
Changeset View
Standalone View
Standalone View
head/sys/geom/raid3/g_raid3_ctl.c
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | |||||
static struct g_raid3_disk * | static struct g_raid3_disk * | ||||
g_raid3_find_disk(struct g_raid3_softc *sc, const char *name) | g_raid3_find_disk(struct g_raid3_softc *sc, const char *name) | ||||
{ | { | ||||
struct g_raid3_disk *disk; | struct g_raid3_disk *disk; | ||||
u_int n; | u_int n; | ||||
sx_assert(&sc->sc_lock, SX_XLOCKED); | sx_assert(&sc->sc_lock, SX_XLOCKED); | ||||
if (strncmp(name, "/dev/", 5) == 0) | if (strncmp(name, _PATH_DEV, 5) == 0) | ||||
name += 5; | name += 5; | ||||
for (n = 0; n < sc->sc_ndisks; n++) { | for (n = 0; n < sc->sc_ndisks; n++) { | ||||
disk = &sc->sc_disks[n]; | disk = &sc->sc_disks[n]; | ||||
if (disk->d_state == G_RAID3_DISK_STATE_NODISK) | if (disk->d_state == G_RAID3_DISK_STATE_NODISK) | ||||
continue; | continue; | ||||
if (disk->d_consumer == NULL) | if (disk->d_consumer == NULL) | ||||
continue; | continue; | ||||
if (disk->d_consumer->provider == NULL) | if (disk->d_consumer->provider == NULL) | ||||
▲ Show 20 Lines • Show All 336 Lines • ▼ Show 20 Lines | g_raid3_ctl_insert(struct gctl_req *req, struct g_class *mp) | ||||
if (name == NULL) { | if (name == NULL) { | ||||
gctl_error(req, "No 'arg%u' argument.", 1); | 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, "/dev/", 5) == 0) | if (strncmp(name, _PATH_DEV, 5) == 0) | ||||
name += 5; | name += 5; | ||||
g_topology_lock(); | g_topology_lock(); | ||||
pp = g_provider_by_name(name); | pp = g_provider_by_name(name); | ||||
if (pp == NULL) { | if (pp == NULL) { | ||||
g_topology_unlock(); | g_topology_unlock(); | ||||
gctl_error(req, "Invalid provider."); | gctl_error(req, "Invalid provider."); | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 201 Lines • Show Last 20 Lines |