コード例 #1
0
ファイル: atapi-fd.c プロジェクト: UnitedMarsupials/kame
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;
}   
コード例 #2
0
ファイル: atapi-fd.c プロジェクト: UnitedMarsupials/kame
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;
}   
コード例 #3
0
ファイル: ata-disk.c プロジェクト: juanfra684/DragonFlyBSD
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;
}
コード例 #4
0
ファイル: atapi-fd.c プロジェクト: Gwenio/DragonFlyBSD
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;
}