FreeBSD/sys/geom/geom_disk.c
/*
 * We get this callback after all of the consumers have gone away, and just
 * before the provider is freed.  If the disk driver provided a d_gone
 * callback, let them know that it is okay to free resources -- they won't
 * be getting any more accesses from GEOM.
 */
We get this callback after all of the consumers have gone away, and just
before the provider is freed.  If the disk driver provided a d_gone
callback, let them know that it is okay to free resources -- they won't
be getting any more accesses from GEOM.
We get this callback after all of the consumers have gone away and just before the provider is freed . If the disk driver provided a d_gone callback let them know that it is okay to free resources -- they won ' t be getting any more accesses from GEOM .
static void
g_disk_providergone(struct g_provider *pp)
{
	struct disk *dp;
	struct g_disk_softc *sc;
	sc = (struct g_disk_softc *)pp->private;
	dp = sc->dp;
	if (dp != NULL && dp->d_gone != NULL)
		dp->d_gone(dp);
	if (sc->sysctl_tree != NULL) {
		sysctl_ctx_free(&sc->sysctl_ctx);
		sc->sysctl_tree = NULL;
	}
	if (sc->led[0] != 0) {
		led_set(sc->led, "0");
		sc->led[0] = 0;
	}
	pp->private = NULL;
	pp->geom->softc = NULL;
	mtx_destroy(&sc->done_mtx);
	mtx_destroy(&sc->start_mtx);
	g_free(sc);
}
static void g_disk_providergone ( struct g_provider * pp ) { struct disk * dp ; struct g_disk_softc * sc ; sc = ( struct g_disk_softc * ) pp -> private ; dp = sc -> dp ; if ( dp != NULL && dp -> d_gone != NULL ) dp -> d_gone ( dp ) ; if ( sc -> sysctl_tree != NULL ) { sysctl_ctx_free ( & sc -> sysctl_ctx ) ; sc -> sysctl_tree = NULL ; } if ( sc -> led [ 0 ] != 0 ) { led_set ( sc -> led , " " ) ; sc -> led [ 0 ] = 0 ; } pp -> private = NULL ; pp -> geom -> softc = NULL ; mtx_destroy ( & sc -> done_mtx ) ; mtx_destroy ( & sc -> start_mtx ) ; g_free ( sc ) ; }
We get this callback after all of the consumers have gone away, and just
 before the provider is freed.
We get this callback after all of the consumers have gone away and just before the provider is freed .