From: "Michael S. Tsirkin" <mst@redhat.com>
To: marcandre.lureau@redhat.com
Cc: haifeng.lin@huawei.com, thibaut.collet@6wind.com,
jasowang@redhat.com, qemu-devel@nongnu.org, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 06/16] vhost: use variable arguments for vhost_call()
Date: Wed, 16 Sep 2015 17:01:18 +0300 [thread overview]
Message-ID: <20150916170000-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <1438864852-4939-7-git-send-email-marcandre.lureau@redhat.com>
On Thu, Aug 06, 2015 at 02:40:42PM +0200, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> It is useful to pass extra arguments to the funtions, for
> various backend needs.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Let's not do this.
It's probably time to replace vhost_call with an ops struct of functions.
This will solve this in a clean way.
> ---
> hw/virtio/vhost-backend.c | 4 ++--
> hw/virtio/vhost-user.c | 4 ++--
> include/hw/virtio/vhost-backend.h | 6 ++++--
> 3 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/hw/virtio/vhost-backend.c b/hw/virtio/vhost-backend.c
> index 4d68a27..7255089 100644
> --- a/hw/virtio/vhost-backend.c
> +++ b/hw/virtio/vhost-backend.c
> @@ -14,8 +14,8 @@
>
> #include <sys/ioctl.h>
>
> -static int vhost_kernel_call(struct vhost_dev *dev, unsigned long int request,
> - void *arg)
> +static int vhost_kernel_call(struct vhost_dev *dev,
> + unsigned long int request, void *arg, ...)
> {
> int fd = (uintptr_t) dev->opaque;
>
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index 4993b63..8b6d7e7 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -190,8 +190,8 @@ static int vhost_user_write(struct vhost_dev *dev, VhostUserMsg *msg,
> 0 : -1;
> }
>
> -static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,
> - void *arg)
> +static int vhost_user_call(struct vhost_dev *dev,
> + unsigned long int request, void *arg, ...)
> {
> VhostUserMsg msg;
> VhostUserRequest msg_request;
> diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-backend.h
> index e472f29..36fa0f7 100644
> --- a/include/hw/virtio/vhost-backend.h
> +++ b/include/hw/virtio/vhost-backend.h
> @@ -11,6 +11,8 @@
> #ifndef VHOST_BACKEND_H_
> #define VHOST_BACKEND_H_
>
> +#include <stdarg.h>
> +
> typedef enum VhostBackendType {
> VHOST_BACKEND_TYPE_NONE = 0,
> VHOST_BACKEND_TYPE_KERNEL = 1,
> @@ -20,8 +22,8 @@ typedef enum VhostBackendType {
>
> struct vhost_dev;
>
> -typedef int (*vhost_call)(struct vhost_dev *dev, unsigned long int request,
> - void *arg);
> +typedef int (*vhost_call)(struct vhost_dev *dev,
> + unsigned long int request, void *arg, ...);
> typedef int (*vhost_backend_init)(struct vhost_dev *dev, void *opaque);
> typedef int (*vhost_backend_cleanup)(struct vhost_dev *dev);
>
> --
> 2.4.3
next prev parent reply other threads:[~2015-09-16 14:01 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-06 12:40 [Qemu-devel] [PATCH v3 00/16] vhost-user: add migration log support (for 2.5) marcandre.lureau
2015-08-06 12:40 ` [Qemu-devel] [PATCH v3 01/16] configure: probe for memfd marcandre.lureau
2015-08-06 12:40 ` [Qemu-devel] [PATCH v3 02/16] util: add linux-only memfd fallback marcandre.lureau
2015-08-06 12:40 ` [Qemu-devel] [PATCH v3 03/16] util: add memfd helpers marcandre.lureau
2015-09-29 14:57 ` Michael S. Tsirkin
2015-09-29 15:25 ` Marc-André Lureau
2015-09-29 15:41 ` Michael S. Tsirkin
2015-08-06 12:40 ` [Qemu-devel] [PATCH v3 04/16] vhost: alloc shareable log marcandre.lureau
2015-09-16 14:06 ` Michael S. Tsirkin
2015-09-19 9:01 ` Marc-André Lureau
2015-08-06 12:40 ` [Qemu-devel] [PATCH v3 05/16] vhost: document log resizing marcandre.lureau
2015-08-06 12:40 ` [Qemu-devel] [PATCH v3 06/16] vhost: use variable arguments for vhost_call() marcandre.lureau
2015-09-16 14:01 ` Michael S. Tsirkin [this message]
2015-09-19 8:58 ` Marc-André Lureau
2015-08-06 12:40 ` [Qemu-devel] [PATCH v3 07/16] vhost-user: start and end the va_list marcandre.lureau
2015-08-06 12:40 ` [Qemu-devel] [PATCH v3 08/16] vhost-user: send log shm fd along with log_base marcandre.lureau
2015-09-16 14:08 ` Michael S. Tsirkin
2015-09-19 8:59 ` Marc-André Lureau
2015-08-06 12:40 ` [Qemu-devel] [PATCH v3 09/16] vhost-user: document migration log marcandre.lureau
2015-08-06 12:40 ` [Qemu-devel] [PATCH v3 10/16] net: add trace_vhost_user_event marcandre.lureau
2015-08-06 12:40 ` [Qemu-devel] [PATCH v3 11/16] vhost-user-test: move wait_for_fds() out marcandre.lureau
2015-08-06 12:40 ` [Qemu-devel] [PATCH v3 12/16] vhost-user-test: remove useless static check marcandre.lureau
2015-08-06 12:40 ` [Qemu-devel] [PATCH v3 13/16] vhost-user-test: wrap server in TestServer struct marcandre.lureau
2015-08-06 12:40 ` [Qemu-devel] [PATCH v3 14/16] vhost-user-test: learn to tweak various qemu arguments marcandre.lureau
2015-08-06 12:40 ` [Qemu-devel] [PATCH v3 15/16] vhost-user-test: add live-migration test marcandre.lureau
2015-08-06 12:40 ` [Qemu-devel] [PATCH v3 16/16] vhost-user-test: check ownership during migration marcandre.lureau
2015-09-16 14:02 ` [Qemu-devel] [PATCH v3 00/16] vhost-user: add migration log support (for 2.5) Michael S. Tsirkin
2015-09-16 14:46 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150916170000-mutt-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=haifeng.lin@huawei.com \
--cc=jasowang@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thibaut.collet@6wind.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).