static void ioreq_unmap(struct ioreq *ioreq)

{

    int gnt = ioreq->blkdev->xendev.gnttabdev;

    int i;



    if (ioreq->v.niov == 0) {

        return;

    }

    if (batch_maps) {

        if (!ioreq->pages) {

            return;

        }

        if (xc_gnttab_munmap(gnt, ioreq->pages, ioreq->v.niov) != 0) {

            xen_be_printf(&ioreq->blkdev->xendev, 0, "xc_gnttab_munmap failed: %s\n",

                          strerror(errno));

        }

        ioreq->blkdev->cnt_map -= ioreq->v.niov;

        ioreq->pages = NULL;

    } else {

        for (i = 0; i < ioreq->v.niov; i++) {

            if (!ioreq->page[i]) {

                continue;

            }

            if (xc_gnttab_munmap(gnt, ioreq->page[i], 1) != 0) {

                xen_be_printf(&ioreq->blkdev->xendev, 0, "xc_gnttab_munmap failed: %s\n",

                              strerror(errno));

            }

            ioreq->blkdev->cnt_map--;

            ioreq->page[i] = NULL;

        }

    }

}

static void ioreq_unmap(struct ioreq *ioreq)

{

    int gnt = ioreq->blkdev->xendev.gnttabdev;

    int i;



    if (ioreq->v.niov == 0) {

        return;

    }

    if (batch_maps) {

        if (!ioreq->pages) {

            return;

        }

        if (xc_gnttab_munmap(gnt, ioreq->pages, ioreq->v.niov) != 0) {

            xen_be_printf(&ioreq->blkdev->xendev, 0, "xc_gnttab_munmap failed: %s\n",

                          strerror(errno));

        }

        ioreq->blkdev->cnt_map -= ioreq->v.niov;

        ioreq->pages = NULL;

    } else {

        for (i = 0; i < ioreq->v.niov; i++) {

            if (!ioreq->page[i]) {

                continue;

            }

            if (xc_gnttab_munmap(gnt, ioreq->page[i], 1) != 0) {

                xen_be_printf(&ioreq->blkdev->xendev, 0, "xc_gnttab_munmap failed: %s\n",

                              strerror(errno));

            }

            ioreq->blkdev->cnt_map--;

            ioreq->page[i] = NULL;

        }

    }

}

static void FUNC_0(struct VAR_0 *VAR_0)

{

    int VAR_1 = VAR_0->blkdev->xendev.gnttabdev;

    int VAR_2;



    if (VAR_0->v.niov == 0) {

        return;

    }

    if (batch_maps) {

        if (!VAR_0->pages) {

            return;

        }

        if (xc_gnttab_munmap(VAR_1, VAR_0->pages, VAR_0->v.niov) != 0) {

            xen_be_printf(&VAR_0->blkdev->xendev, 0, "xc_gnttab_munmap failed: %s\n",

                          strerror(errno));

        }

        VAR_0->blkdev->cnt_map -= VAR_0->v.niov;

        VAR_0->pages = NULL;

    } else {

        for (VAR_2 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) {

            if (!VAR_0->page[VAR_2]) {

                continue;

            }

            if (xc_gnttab_munmap(VAR_1, VAR_0->page[VAR_2], 1) != 0) {

                xen_be_printf(&VAR_0->blkdev->xendev, 0, "xc_gnttab_munmap failed: %s\n",

                              strerror(errno));

            }

            VAR_0->blkdev->cnt_map--;

            VAR_0->page[VAR_2] = NULL;

        }

    }

}

static void FUNC_0(struct VAR_0 *VAR_0)
{ int VAR_1 = VAR_0->blkdev->xendev.gnttabdev; int VAR_2; if (VAR_0->v.niov == 0) { return; } if (batch_maps) { if (!VAR_0->pages) { return; } if (xc_gnttab_munmap(VAR_1, VAR_0->pages, VAR_0->v.niov) != 0) { xen_be_printf(&VAR_0->blkdev->xendev, 0, "xc_gnttab_munmap failed: %s\n",
strerror(errno)); } VAR_0->blkdev->cnt_map -= VAR_0->v.niov; VAR_0->pages = NULL; } else { for (VAR_2 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) { if (!VAR_0->page[VAR_2]) { continue; } if (xc_gnttab_munmap(VAR_1, VAR_0->page[VAR_2], 1) != 0) { xen_be_printf(&VAR_0->blkdev->xendev, 0, "xc_gnttab_munmap failed: %s\n",
strerror(errno)); } VAR_0->blkdev->cnt_map--; VAR_0->page[VAR_2] = NULL; } } }