Пример #1
0
static int
idad_detach(device_t dev)
{
	struct idad_softc *drv;

	drv = (struct idad_softc *)device_get_softc(dev);
	devstat_remove_entry(&drv->stats);
	disk_destroy(&drv->disk);
	return (0);
}
Пример #2
0
static int
ipsd_detach(device_t dev)
{
	ipsdisk_softc_t *dsc;

	DEVICE_PRINTF(2, dev, "in detach\n");
	dsc = (ipsdisk_softc_t *)device_get_softc(dev);
	if (dsc->state & IPS_DEV_OPEN)
		return (EBUSY);
	devstat_remove_entry(&dsc->stats);
	disk_destroy(&dsc->ipsd_disk);
	return 0;
}
Пример #3
0
static void
ptdtor(struct cam_periph *periph)
{
    struct pt_softc *softc;

    softc = (struct pt_softc *)periph->softc;

    devstat_remove_entry(softc->device_stats);
    cam_periph_unlock(periph);
    destroy_dev(softc->dev);
    cam_periph_lock(periph);
    free(softc, M_DEVBUF);
}
Пример #4
0
static void
ptdtor(struct cam_periph *periph)
{
	struct pt_softc *softc;

	softc = (struct pt_softc *)periph->softc;

	devstat_remove_entry(&softc->device_stats);

	cam_extend_release(ptperiphs, periph->unit_number);
	xpt_print(periph->path, "removing device entry\n");
	dev_ops_remove_minor(&pt_ops, periph->unit_number);
	kfree(softc, M_DEVBUF);
}
Пример #5
0
static void
ptdtor(struct cam_periph *periph)
{
	struct pt_softc *softc;

	softc = (struct pt_softc *)periph->softc;

	devstat_remove_entry(&softc->device_stats);

	destroy_dev(softc->dev);

	xpt_print_path(periph->path);
	printf("removing device entry\n");
	free(softc, M_DEVBUF);
}
Пример #6
0
void
afddetach(struct ata_device *atadev)
{   
    struct afd_softc *fdp = atadev->driver;
    struct bio *bp;
    
    while ((bp = bioq_first(&fdp->queue))) {
	bioq_remove(&fdp->queue, bp);
	biofinish(bp, NULL, ENXIO);
    }
    disk_invalidate(&fdp->disk);
    disk_destroy(fdp->dev);
    devstat_remove_entry(&fdp->stats);
    ata_free_name(atadev);
    ata_free_lun(&afd_lun_map, fdp->lun);
    free(fdp, M_AFD);
    atadev->driver = NULL;
}   
Пример #7
0
void	
astdetach(struct ata_device *atadev)
{   
    struct ast_softc *stp = atadev->driver;
    struct buf *bp;
    
    while ((bp = bufq_first(&stp->queue))) {
	bufq_remove(&stp->queue, bp);
	bp->b_flags |= B_ERROR;
	bp->b_error = ENXIO;
	biodone(bp);
    }
    destroy_dev(stp->dev1);
    destroy_dev(stp->dev2);
    devstat_remove_entry(&stp->stats);
    ata_free_name(atadev);
    ata_free_lun(&ast_lun_map, stp->lun);
    free(stp, M_AST);
    atadev->driver = NULL;
}
Пример #8
0
void
afddetach(struct ata_device *atadev)
{   
    struct afd_softc *fdp = atadev->driver;
    struct buf *bp;
    
    while ((bp = bufq_first(&fdp->queue))) {
	bufq_remove(&fdp->queue, bp);
	bp->b_flags |= B_ERROR;
	bp->b_error = ENXIO;
	biodone(bp);
    }
    disk_invalidate(&fdp->disk);
    disk_destroy(fdp->dev);
    devstat_remove_entry(&fdp->stats);
    ata_free_name(atadev);
    ata_free_lun(&afd_lun_map, fdp->lun);
    free(fdp, M_AFD);
    atadev->driver = NULL;
}   
Пример #9
0
static int
ad_detach(device_t dev)
{
    struct ad_softc *adp = device_get_ivars(dev);
    device_t *children;
    int nchildren, i;

    /* check that we have a valid disk to detach */
    if (!adp)
	return ENXIO;

#if 0 /* XXX TGEN Probably useless, we fail the queue below. */
    /* check that the disk is closed */
    if (adp->ad_flags & AD_DISK_OPEN)
        return EBUSY;
#endif /* 0 */
    
    /* detach & delete all children */
    if (!device_get_children(dev, &children, &nchildren)) {
	for (i = 0; i < nchildren; i++)
	    if (children[i])
		device_delete_child(dev, children[i]);
	kfree(children, M_TEMP);
    }

    /* detroy disk from the system so we dont get any further requests */
    disk_invalidate(&adp->disk);
    disk_destroy(&adp->disk);

    /* fail requests on the queue and any thats "in flight" for this device */
    ata_fail_requests(dev);

    /* dont leave anything behind */
    /* disk_destroy() already took care of the dev_ops */
    devstat_remove_entry(&adp->stats);
    device_set_ivars(dev, NULL);
    kfree(adp, M_AD);
    return 0;
}
Пример #10
0
static int
mfi_syspd_detach(device_t dev)
{
	struct mfi_system_pd *sc;

	sc = device_get_softc(dev);
	lockmgr(&sc->pd_controller->mfi_io_lock, LK_EXCLUSIVE);
	if ((sc->pd_flags & MFI_DISK_FLAGS_OPEN) &&
	    (sc->pd_controller->mfi_keep_deleted_volumes ||
	    sc->pd_controller->mfi_detaching)) {
		lockmgr(&sc->pd_controller->mfi_io_lock, LK_RELEASE);
		return (EBUSY);
	}
	lockmgr(&sc->pd_controller->mfi_io_lock, LK_RELEASE);

	disk_destroy(&sc->pd_disk);
	devstat_remove_entry(&sc->pd_devstat);
	lockmgr(&sc->pd_controller->mfi_io_lock, LK_EXCLUSIVE);
	TAILQ_REMOVE(&sc->pd_controller->mfi_syspd_tqh, sc, pd_link);
	lockmgr(&sc->pd_controller->mfi_io_lock, LK_RELEASE);
	kfree(sc->pd_info, M_MFIBUF);
	return (0);
}
Пример #11
0
static int
afd_detach(device_t dev)
{   
    struct afd_softc *fdp = device_get_ivars(dev);

    /* check that we have a valid device to detach */
    if (!device_get_ivars(dev))
        return ENXIO;
    
    /* detroy disk from the system so we dont get any further requests */
    disk_invalidate(&fdp->disk);
    disk_destroy(&fdp->disk);

    /* fail requests on the queue and any thats "in flight" for this device */
    ata_fail_requests(dev);

    /* dont leave anything behind */
    /* disk_destroy() already took care of the dev_ops */
    devstat_remove_entry(&fdp->stats);
    device_set_ivars(dev, NULL);
    kfree(fdp, M_AFD);
    return 0;
}