Example #1
0
static int
ad_detach(device_t dev)
{
    struct ad_softc *adp = device_get_ivars(dev);
    struct ata_device *atadev = device_get_softc(dev);

    /* check that we have a valid disk to detach */
    if (!device_get_ivars(dev))
	return ENXIO;
    
    /* destroy the power timeout */
    callout_drain(&atadev->spindown_timer);

    /* detach & delete all children */
    device_delete_children(dev);

    /* destroy disk from the system so we don't get any further requests */
    disk_destroy(adp->disk);

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

    /* don't leave anything behind */
    device_set_ivars(dev, NULL);
    free(adp, M_AD);
    return 0;
}
Example #2
0
static void
acd_geom_detach(void *arg, int flag)
{   
    struct acd_softc *cdp = device_get_ivars(arg);

    /* signal geom so we dont get any further requests */
    g_wither_geom(cdp->gp, ENXIO);

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

    /* dont leave anything behind */
    device_set_ivars(arg, NULL);
    free(cdp, M_ACD);
}
Example #3
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_destroy(fdp->disk);

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

    /* dont leave anything behind */
    device_set_ivars(dev, NULL);
    free(fdp, M_AFD);
    return 0;
}
Example #4
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;
}
Example #5
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;
}