static int blk_free(struct XenDevice *xendev)

{

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

    struct ioreq *ioreq;



    if (blkdev->blk || blkdev->sring) {

        blk_disconnect(xendev);

    }



    /* Free persistent grants */

    if (blkdev->feature_persistent) {

        g_tree_destroy(blkdev->persistent_gnts);

    }



    while (!QLIST_EMPTY(&blkdev->freelist)) {

        ioreq = QLIST_FIRST(&blkdev->freelist);

        QLIST_REMOVE(ioreq, list);

        qemu_iovec_destroy(&ioreq->v);

        g_free(ioreq);

    }



    g_free(blkdev->params);

    g_free(blkdev->mode);

    g_free(blkdev->type);

    g_free(blkdev->dev);

    g_free(blkdev->devtype);

    qemu_bh_delete(blkdev->bh);

    return 0;

}

static int blk_free(struct XenDevice *xendev)

{

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

    struct ioreq *ioreq;



    if (blkdev->blk || blkdev->sring) {

        blk_disconnect(xendev);

    }



    

    if (blkdev->feature_persistent) {

        g_tree_destroy(blkdev->persistent_gnts);

    }



    while (!QLIST_EMPTY(&blkdev->freelist)) {

        ioreq = QLIST_FIRST(&blkdev->freelist);

        QLIST_REMOVE(ioreq, list);

        qemu_iovec_destroy(&ioreq->v);

        g_free(ioreq);

    }



    g_free(blkdev->params);

    g_free(blkdev->mode);

    g_free(blkdev->type);

    g_free(blkdev->dev);

    g_free(blkdev->devtype);

    qemu_bh_delete(blkdev->bh);

    return 0;

}

    if (blkdev->feature_persistent) {         g_tree_destroy(blkdev->persistent_gnts);
static int FUNC_0(struct XenDevice *VAR_0)

{

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

    struct VAR_2 *VAR_2;



    if (VAR_1->blk || VAR_1->sring) {

        blk_disconnect(VAR_0);

    }



    

    if (VAR_1->feature_persistent) {

        g_tree_destroy(VAR_1->persistent_gnts);

    }



    while (!QLIST_EMPTY(&VAR_1->freelist)) {

        VAR_2 = QLIST_FIRST(&VAR_1->freelist);

        QLIST_REMOVE(VAR_2, list);

        qemu_iovec_destroy(&VAR_2->v);

        g_free(VAR_2);

    }



    g_free(VAR_1->params);

    g_free(VAR_1->mode);

    g_free(VAR_1->type);

    g_free(VAR_1->dev);

    g_free(VAR_1->devtype);

    qemu_bh_delete(VAR_1->bh);

    return 0;

}

static int FUNC_0(struct XenDevice *VAR_0)
{ struct XenBlkDev *VAR_1 = container_of(VAR_0, struct XenBlkDev, VAR_0); struct VAR_2 *VAR_2; if (VAR_1->blk || VAR_1->sring) { blk_disconnect(VAR_0); } if (VAR_1->feature_persistent) { g_tree_destroy(VAR_1->persistent_gnts); } while (!QLIST_EMPTY(&VAR_1->freelist)) { VAR_2 = QLIST_FIRST(&VAR_1->freelist); QLIST_REMOVE(VAR_2, list); qemu_iovec_destroy(&VAR_2->v); g_free(VAR_2); } g_free(VAR_1->params); g_free(VAR_1->mode); g_free(VAR_1->type); g_free(VAR_1->dev); g_free(VAR_1->devtype); qemu_bh_delete(VAR_1->bh); return 0; }