void *qemu_get_virtqueue_element(QEMUFile *f, size_t sz)

{

    VirtQueueElement *elem;

    VirtQueueElementOld data;

    int i;



    qemu_get_buffer(f, (uint8_t *)&data, sizeof(VirtQueueElementOld));



    elem = virtqueue_alloc_element(sz, data.out_num, data.in_num);

    elem->index = data.index;



    for (i = 0; i < elem->in_num; i++) {

        elem->in_addr[i] = data.in_addr[i];

    }



    for (i = 0; i < elem->out_num; i++) {

        elem->out_addr[i] = data.out_addr[i];

    }



    for (i = 0; i < elem->in_num; i++) {

        /* Base is overwritten by virtqueue_map.  */

        elem->in_sg[i].iov_base = 0;

        elem->in_sg[i].iov_len = data.in_sg[i].iov_len;

    }



    for (i = 0; i < elem->out_num; i++) {

        /* Base is overwritten by virtqueue_map.  */

        elem->out_sg[i].iov_base = 0;

        elem->out_sg[i].iov_len = data.out_sg[i].iov_len;

    }



    virtqueue_map(elem);

    return elem;

}

void *qemu_get_virtqueue_element(QEMUFile *f, size_t sz)

{

    VirtQueueElement *elem;

    VirtQueueElementOld data;

    int i;



    qemu_get_buffer(f, (uint8_t *)&data, sizeof(VirtQueueElementOld));



    elem = virtqueue_alloc_element(sz, data.out_num, data.in_num);

    elem->index = data.index;



    for (i = 0; i < elem->in_num; i++) {

        elem->in_addr[i] = data.in_addr[i];

    }



    for (i = 0; i < elem->out_num; i++) {

        elem->out_addr[i] = data.out_addr[i];

    }



    for (i = 0; i < elem->in_num; i++) {

        

        elem->in_sg[i].iov_base = 0;

        elem->in_sg[i].iov_len = data.in_sg[i].iov_len;

    }



    for (i = 0; i < elem->out_num; i++) {

        

        elem->out_sg[i].iov_base = 0;

        elem->out_sg[i].iov_len = data.out_sg[i].iov_len;

    }



    virtqueue_map(elem);

    return elem;

}

void *FUNC_0(QEMUFile *VAR_0, size_t VAR_1)

{

    VirtQueueElement *elem;

    VirtQueueElementOld data;

    int VAR_2;



    qemu_get_buffer(VAR_0, (uint8_t *)&data, sizeof(VirtQueueElementOld));



    elem = virtqueue_alloc_element(VAR_1, data.out_num, data.in_num);

    elem->index = data.index;



    for (VAR_2 = 0; VAR_2 < elem->in_num; VAR_2++) {

        elem->in_addr[VAR_2] = data.in_addr[VAR_2];

    }



    for (VAR_2 = 0; VAR_2 < elem->out_num; VAR_2++) {

        elem->out_addr[VAR_2] = data.out_addr[VAR_2];

    }



    for (VAR_2 = 0; VAR_2 < elem->in_num; VAR_2++) {

        

        elem->in_sg[VAR_2].iov_base = 0;

        elem->in_sg[VAR_2].iov_len = data.in_sg[VAR_2].iov_len;

    }



    for (VAR_2 = 0; VAR_2 < elem->out_num; VAR_2++) {

        

        elem->out_sg[VAR_2].iov_base = 0;

        elem->out_sg[VAR_2].iov_len = data.out_sg[VAR_2].iov_len;

    }



    virtqueue_map(elem);

    return elem;

}

void *FUNC_0(QEMUFile *VAR_0, size_t VAR_1)
{ VirtQueueElement *elem; VirtQueueElementOld data; int VAR_2; qemu_get_buffer(VAR_0, (uint8_t *)&data, sizeof(VirtQueueElementOld)); elem = virtqueue_alloc_element(VAR_1, data.out_num, data.in_num); elem->index = data.index; for (VAR_2 = 0; VAR_2 < elem->in_num; VAR_2++) { elem->in_addr[VAR_2] = data.in_addr[VAR_2]; } for (VAR_2 = 0; VAR_2 < elem->out_num; VAR_2++) { elem->out_addr[VAR_2] = data.out_addr[VAR_2]; } for (VAR_2 = 0; VAR_2 < elem->in_num; VAR_2++) { elem->in_sg[VAR_2].iov_base = 0; elem->in_sg[VAR_2].iov_len = data.in_sg[VAR_2].iov_len; } for (VAR_2 = 0; VAR_2 < elem->out_num; VAR_2++) { elem->out_sg[VAR_2].iov_base = 0; elem->out_sg[VAR_2].iov_len = data.out_sg[VAR_2].iov_len; } virtqueue_map(elem); return elem; }