Re: [Qemu-devel] [PATCH 03/40] virtio: move allocation to virtqueue_pop/vring_pop

2015-11-29 Thread Fam Zheng
On Tue, 11/24 19:00, Paolo Bonzini wrote: > @@ -436,10 +454,11 @@ static void control_out(VirtIODevice *vdev, VirtQueue > *vq) > buf = g_malloc(cur_len); > len = cur_len; > } > -iov_to_buf(elem.out_sg, elem.out_num, 0, buf, cur_len); > +iov_to_buf

[Qemu-devel] [PATCH 03/40] virtio: move allocation to virtqueue_pop/vring_pop

2015-11-24 Thread Paolo Bonzini
The return code of virtqueue_pop/vring_pop is unused except to check for errors or 0. We can thus easily move allocation inside the functions and just return a pointer to the VirtQueueElement. The advantage is that we will be able to allocate only the space that is needed for the actual size of t