static struct ioreq *ioreq_start(struct XenBlkDev *blkdev)

{

    struct ioreq *ioreq = NULL;



    if (QLIST_EMPTY(&blkdev->freelist)) {

        if (blkdev->requests_total >= max_requests) {

            goto out;

        }

        /* allocate new struct */

        ioreq = g_malloc0(sizeof(*ioreq));

        ioreq->blkdev = blkdev;

        blkdev->requests_total++;

        qemu_iovec_init(&ioreq->v, BLKIF_MAX_SEGMENTS_PER_REQUEST);

    } else {

        /* get one from freelist */

        ioreq = QLIST_FIRST(&blkdev->freelist);

        QLIST_REMOVE(ioreq, list);

        qemu_iovec_reset(&ioreq->v);

    }

    QLIST_INSERT_HEAD(&blkdev->inflight, ioreq, list);

    blkdev->requests_inflight++;



out:

    return ioreq;

}

static struct ioreq *ioreq_start(struct XenBlkDev *blkdev)

{

    struct ioreq *ioreq = NULL;



    if (QLIST_EMPTY(&blkdev->freelist)) {

        if (blkdev->requests_total >= max_requests) {

            goto out;

        }

        

        ioreq = g_malloc0(sizeof(*ioreq));

        ioreq->blkdev = blkdev;

        blkdev->requests_total++;

        qemu_iovec_init(&ioreq->v, BLKIF_MAX_SEGMENTS_PER_REQUEST);

    } else {

        

        ioreq = QLIST_FIRST(&blkdev->freelist);

        QLIST_REMOVE(ioreq, list);

        qemu_iovec_reset(&ioreq->v);

    }

    QLIST_INSERT_HEAD(&blkdev->inflight, ioreq, list);

    blkdev->requests_inflight++;



out:

    return ioreq;

}

        qemu_iovec_reset(&ioreq->v);
static struct VAR_1 *FUNC_0(struct XenBlkDev *VAR_0)

{

    struct VAR_1 *VAR_1 = NULL;



    if (QLIST_EMPTY(&VAR_0->freelist)) {

        if (VAR_0->requests_total >= max_requests) {

            goto out;

        }

        

        VAR_1 = g_malloc0(sizeof(*VAR_1));

        VAR_1->VAR_0 = VAR_0;

        VAR_0->requests_total++;

        qemu_iovec_init(&VAR_1->v, BLKIF_MAX_SEGMENTS_PER_REQUEST);

    } else {

        

        VAR_1 = QLIST_FIRST(&VAR_0->freelist);

        QLIST_REMOVE(VAR_1, list);

        qemu_iovec_reset(&VAR_1->v);

    }

    QLIST_INSERT_HEAD(&VAR_0->inflight, VAR_1, list);

    VAR_0->requests_inflight++;



out:

    return VAR_1;

}

static struct VAR_1 *FUNC_0(struct XenBlkDev *VAR_0)
{ struct VAR_1 *VAR_1 = NULL; if (QLIST_EMPTY(&VAR_0->freelist)) { if (VAR_0->requests_total >= max_requests) { goto out; } VAR_1 = g_malloc0(sizeof(*VAR_1)); VAR_1->VAR_0 = VAR_0; VAR_0->requests_total++; qemu_iovec_init(&VAR_1->v, BLKIF_MAX_SEGMENTS_PER_REQUEST); } else { VAR_1 = QLIST_FIRST(&VAR_0->freelist); QLIST_REMOVE(VAR_1, list); qemu_iovec_reset(&VAR_1->v); } QLIST_INSERT_HEAD(&VAR_0->inflight, VAR_1, list); VAR_0->requests_inflight++; out:
return VAR_1; }