Thread (1 message) 1 message, 1 author, 2020-12-08

Re: [RFC PATCH 16/27] virtio: Expose virtqueue_alloc_element

flat view

From: Stefan Hajnoczi <hidden>
Date: 2020-12-08 08:29:12
Also in: kvm, qemu-devel

On Fri, Nov 20, 2020 at 07:50:54PM +0100, Eugenio Pérez wrote:
Specify VirtQueueElement * as return type makes no harm at this moment.
The reason for the void * return type is that C implicitly converts void
pointers to pointers of any type. The function takes a size_t sz
argument so it can allocate a object of user-defined size. The idea is
that the user's struct embeds a VirtQueueElement field. Changing the
return type to VirtQueueElement * means that callers may need to
explicitly cast to the user's struct type.

It's a question of coding style but I think the void * return type
communicates what is going on better than VirtQueueElement *.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help