> diff --git a/include/hw/virtio/virtio-dmabuf.h
b/include/hw/virtio/virtio-dmabuf.h
> new file mode 100644
> index 0000000000..536e622555
> --- /dev/null
> +++ b/include/hw/virtio/virtio-dmabuf.h
> @@ -0,0 +1,103 @@
> +/*
> + * Virtio Shared dma-buf
> + *
> + * Copyright Red Hat, Inc. 2023
> + *
> + * Authors:
> + * Albert Esteve <aesteve@redhat.com
<mailto:aesteve@redhat.com>>
> + *
> + * This work is licensed under the terms of the GNU GPL,
version 2.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#ifndef VIRTIO_DMABUF_H
> +#define VIRTIO_DMABUF_H
> +
> +#include "qemu/osdep.h"
> +
> +#include <glib.h>
> +#include "qemu/uuid.h"
> +#include "vhost.h"
> +
> +enum SharedObjectType {
> + TYPE_INVALID = 0,
> + TYPE_DMABUF,
> + TYPE_VHOST_DEV,
> +};
> +
Please declare a
typedef
> +struct VirtioSharedObject {
> + enum SharedObjectType type;
> + gpointer value;
> +};
VirtioSharedObject;
and use it instead of 'struct VirtioSharedObject'.
You mean making the struct anonymous and typedefing?
So after re-reading your comment and looking for more examples in the
codebase, I see
it is not uncommon to have a named struct also typedef in the same
declaration.
So I will typedef, but not make it anonymous, same for the enum.