Changeset View
Changeset View
Standalone View
Standalone View
head/sys/geom/eli/g_eli.c
Show First 20 Lines • Show All 728 Lines • ▼ Show 20 Lines | g_eli_read_metadata_offset(struct g_class *mp, struct g_provider *pp, | ||||
/* | /* | ||||
* g_eli_read_metadata() is always called from the event thread. | * g_eli_read_metadata() is always called from the event thread. | ||||
* Our geom is created and destroyed in the same event, so there | * Our geom is created and destroyed in the same event, so there | ||||
* could be no orphan nor spoil event in the meantime. | * could be no orphan nor spoil event in the meantime. | ||||
*/ | */ | ||||
gp->orphan = g_eli_orphan_spoil_assert; | gp->orphan = g_eli_orphan_spoil_assert; | ||||
gp->spoiled = g_eli_orphan_spoil_assert; | gp->spoiled = g_eli_orphan_spoil_assert; | ||||
cp = g_new_consumer(gp); | cp = g_new_consumer(gp); | ||||
cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; | |||||
error = g_attach(cp, pp); | error = g_attach(cp, pp); | ||||
if (error != 0) | if (error != 0) | ||||
goto end; | goto end; | ||||
error = g_access(cp, 1, 0, 0); | error = g_access(cp, 1, 0, 0); | ||||
if (error != 0) | if (error != 0) | ||||
goto end; | goto end; | ||||
g_topology_unlock(); | g_topology_unlock(); | ||||
buf = g_read_data(cp, offset, pp->sectorsize, &error); | buf = g_read_data(cp, offset, pp->sectorsize, &error); | ||||
▲ Show 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | g_eli_create(struct gctl_req *req, struct g_class *mp, struct g_provider *bpp, | ||||
sc->sc_geom = gp; | sc->sc_geom = gp; | ||||
bioq_init(&sc->sc_queue); | bioq_init(&sc->sc_queue); | ||||
mtx_init(&sc->sc_queue_mtx, "geli:queue", NULL, MTX_DEF); | mtx_init(&sc->sc_queue_mtx, "geli:queue", NULL, MTX_DEF); | ||||
mtx_init(&sc->sc_ekeys_lock, "geli:ekeys", NULL, MTX_DEF); | mtx_init(&sc->sc_ekeys_lock, "geli:ekeys", NULL, MTX_DEF); | ||||
pp = NULL; | pp = NULL; | ||||
cp = g_new_consumer(gp); | cp = g_new_consumer(gp); | ||||
cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; | |||||
error = g_attach(cp, bpp); | error = g_attach(cp, bpp); | ||||
if (error != 0) { | if (error != 0) { | ||||
if (req != NULL) { | if (req != NULL) { | ||||
gctl_error(req, "Cannot attach to %s (error=%d).", | gctl_error(req, "Cannot attach to %s (error=%d).", | ||||
bpp->name, error); | bpp->name, error); | ||||
} else { | } else { | ||||
G_ELI_DEBUG(1, "Cannot attach to %s (error=%d).", | G_ELI_DEBUG(1, "Cannot attach to %s (error=%d).", | ||||
bpp->name, error); | bpp->name, error); | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | for (i = 0; i < threads; i++) { | ||||
} | } | ||||
LIST_INSERT_HEAD(&sc->sc_workers, wr, w_next); | LIST_INSERT_HEAD(&sc->sc_workers, wr, w_next); | ||||
} | } | ||||
/* | /* | ||||
* Create decrypted provider. | * Create decrypted provider. | ||||
*/ | */ | ||||
pp = g_new_providerf(gp, "%s%s", bpp->name, G_ELI_SUFFIX); | pp = g_new_providerf(gp, "%s%s", bpp->name, G_ELI_SUFFIX); | ||||
pp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE; | |||||
pp->mediasize = sc->sc_mediasize; | pp->mediasize = sc->sc_mediasize; | ||||
pp->sectorsize = sc->sc_sectorsize; | pp->sectorsize = sc->sc_sectorsize; | ||||
LIST_FOREACH(gap, &bpp->aliases, ga_next) | LIST_FOREACH(gap, &bpp->aliases, ga_next) | ||||
g_provider_add_alias(pp, "%s%s", gap->ga_alias, G_ELI_SUFFIX); | g_provider_add_alias(pp, "%s%s", gap->ga_alias, G_ELI_SUFFIX); | ||||
g_error_provider(pp, 0); | g_error_provider(pp, 0); | ||||
G_ELI_DEBUG(0, "Device %s created.", pp->name); | G_ELI_DEBUG(0, "Device %s created.", pp->name); | ||||
▲ Show 20 Lines • Show All 473 Lines • Show Last 20 Lines |