Changeset View
Changeset View
Standalone View
Standalone View
sys/geom/geom_disk.c
Show All 12 Lines | |||||
.start = g_disk_start, | .start = g_disk_start, | ||||
.access = g_disk_access, | .access = g_disk_access, | ||||
.ioctl = g_disk_ioctl, | .ioctl = g_disk_ioctl, | ||||
.providergone = g_disk_providergone, | .providergone = g_disk_providergone, | ||||
.dumpconf = g_disk_dumpconf, | .dumpconf = g_disk_dumpconf, | ||||
}; | }; | ||||
SYSCTL_DECL(_kern_geom); | SYSCTL_DECL(_kern_geom); | ||||
static SYSCTL_NODE(_kern_geom, OID_AUTO, disk, CTLFLAG_RW, 0, | static SYSCTL_NODE(_kern_geom, OID_AUTO, disk, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, | ||||
"GEOM_DISK stuff"); | "GEOM_DISK stuff"); | ||||
DECLARE_GEOM_CLASS(g_disk_class, g_disk); | DECLARE_GEOM_CLASS(g_disk_class, g_disk); | ||||
static int | static int | ||||
g_disk_access(struct g_provider *pp, int r, int w, int e) | g_disk_access(struct g_provider *pp, int r, int w, int e) | ||||
{ | { | ||||
struct disk *dp; | struct disk *dp; | ||||
Show All 24 Lines | |||||
pp->flags |= G_PF_DIRECT_SEND; | pp->flags |= G_PF_DIRECT_SEND; | ||||
pp->flags |= G_PF_DIRECT_RECEIVE; | pp->flags |= G_PF_DIRECT_RECEIVE; | ||||
if (bootverbose) | if (bootverbose) | ||||
printf("GEOM: new disk %s\n", gp->name); | printf("GEOM: new disk %s\n", gp->name); | ||||
sysctl_ctx_init(&sc->sysctl_ctx); | sysctl_ctx_init(&sc->sysctl_ctx); | ||||
snprintf(tmpstr, sizeof(tmpstr), "GEOM disk %s", gp->name); | snprintf(tmpstr, sizeof(tmpstr), "GEOM disk %s", gp->name); | ||||
sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx, | sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx, | ||||
SYSCTL_STATIC_CHILDREN(_kern_geom_disk), OID_AUTO, gp->name, | SYSCTL_STATIC_CHILDREN(_kern_geom_disk), OID_AUTO, gp->name, | ||||
CTLFLAG_RD, 0, tmpstr); | CTLFLAG_RD | CTLFLAG_MPSAFE, 0, tmpstr); | ||||
if (sc->sysctl_tree != NULL) { | if (sc->sysctl_tree != NULL) { | ||||
SYSCTL_ADD_STRING(&sc->sysctl_ctx, | SYSCTL_ADD_STRING(&sc->sysctl_ctx, | ||||
SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, "led", | SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, "led", | ||||
CTLFLAG_RWTUN, sc->led, sizeof(sc->led), | CTLFLAG_RWTUN, sc->led, sizeof(sc->led), | ||||
"LED name"); | "LED name"); | ||||
SYSCTL_ADD_PROC(&sc->sysctl_ctx, | SYSCTL_ADD_PROC(&sc->sysctl_ctx, | ||||
SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, "flags", | SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, "flags", | ||||
CTLTYPE_STRING | CTLFLAG_RD, dp, 0, g_disk_sysctl_flags, | CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, dp, 0, | ||||
"A", "Report disk flags"); | g_disk_sysctl_flags, "A", "Report disk flags"); | ||||
} | } | ||||
pp->private = sc; | pp->private = sc; | ||||
dp->d_geom = gp; | dp->d_geom = gp; | ||||
g_error_provider(pp, 0); | g_error_provider(pp, 0); | ||||
mtx_pool_lock(mtxpool_sleep, dp); | mtx_pool_lock(mtxpool_sleep, dp); | ||||
dp->d_init_level = DISK_INIT_DONE; | dp->d_init_level = DISK_INIT_DONE; | ||||
Show All 12 Lines |