static void blk_disconnect(struct XenDevice *xendev)

{

    struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev);



    if (blkdev->bs) {

        bdrv_detach_dev(blkdev->bs, blkdev);

        if (!blkdev->dinfo) {

            blk_unref(blk_by_name(blkdev->dev));

        }

        blkdev->bs = NULL;

    }

    xen_be_unbind_evtchn(&blkdev->xendev);



    if (blkdev->sring) {

        xc_gnttab_munmap(blkdev->xendev.gnttabdev, blkdev->sring, 1);

        blkdev->cnt_map--;

        blkdev->sring = NULL;

    }

}

static void blk_disconnect(struct XenDevice *xendev)

{

    struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev);



    if (blkdev->bs) {

        bdrv_detach_dev(blkdev->bs, blkdev);

        if (!blkdev->dinfo) {

            blk_unref(blk_by_name(blkdev->dev));

        }

        blkdev->bs = NULL;

    }

    xen_be_unbind_evtchn(&blkdev->xendev);



    if (blkdev->sring) {

        xc_gnttab_munmap(blkdev->xendev.gnttabdev, blkdev->sring, 1);

        blkdev->cnt_map--;

        blkdev->sring = NULL;

    }

}

static void FUNC_0(struct XenDevice *VAR_0)

{

    struct XenBlkDev *VAR_1 = container_of(VAR_0, struct XenBlkDev, VAR_0);



    if (VAR_1->bs) {

        bdrv_detach_dev(VAR_1->bs, VAR_1);

        if (!VAR_1->dinfo) {

            blk_unref(blk_by_name(VAR_1->dev));

        }

        VAR_1->bs = NULL;

    }

    xen_be_unbind_evtchn(&VAR_1->VAR_0);



    if (VAR_1->sring) {

        xc_gnttab_munmap(VAR_1->VAR_0.gnttabdev, VAR_1->sring, 1);

        VAR_1->cnt_map--;

        VAR_1->sring = NULL;

    }

}

static void FUNC_0(struct XenDevice *VAR_0)
{ struct XenBlkDev *VAR_1 = container_of(VAR_0, struct XenBlkDev, VAR_0); if (VAR_1->bs) { bdrv_detach_dev(VAR_1->bs, VAR_1); if (!VAR_1->dinfo) { blk_unref(blk_by_name(VAR_1->dev)); } VAR_1->bs = NULL; } xen_be_unbind_evtchn(&VAR_1->VAR_0); if (VAR_1->sring) { xc_gnttab_munmap(VAR_1->VAR_0.gnttabdev, VAR_1->sring, 1); VAR_1->cnt_map--; VAR_1->sring = NULL; } }