int rd_detach(struct device *self, int flags) { struct rd_softc *sc = (struct rd_softc *)self; disk_gone(rdopen, self->dv_unit); /* Detach disk. */ disk_detach(&sc->sc_dk); return (0); }
int wddetach(struct device *self, int flags) { struct wd_softc *sc = (struct wd_softc *)self; timeout_del(&sc->sc_restart_timeout); bufq_drain(&sc->sc_bufq); disk_gone(wdopen, self->dv_unit); /* Detach disk. */ bufq_destroy(&sc->sc_bufq); disk_detach(&sc->sc_dk); return (0); }
int sddetach(struct device *self, int flags) { struct sd_softc *sc = (struct sd_softc *)self; bufq_drain(&sc->sc_bufq); disk_gone(sdopen, self->dv_unit); /* Get rid of the shutdown hook. */ if (sc->sc_sdhook != NULL) shutdownhook_disestablish(sc->sc_sdhook); /* Detach disk. */ bufq_destroy(&sc->sc_bufq); disk_detach(&sc->sc_dk); return (0); }
static void isf_disk_remove(struct isf_softc *sc) { struct disk *disk; ISF_LOCK_ASSERT(sc); KASSERT(sc->isf_disk != NULL, ("%s: isf_disk NULL", __func__)); sc->isf_doomed = 1; ISF_WAKEUP(sc); ISF_SLEEP(sc, sc->isf_proc, 0); /* * XXXRW: Is it OK to call disk_destroy() under the mutex, or should * we be deferring that to the calling context once it is released? */ disk = sc->isf_disk; disk_gone(disk); disk_destroy(disk); sc->isf_disk = NULL; free(sc->isf_bstate, M_ISF); device_printf(sc->isf_dev, "flash device removed\n"); }