From: Stefan Hajnoczi <stefanha@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
qemu-block@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
"Stefano Garzarella" <sgarzare@redhat.com>
Subject: [PULL 2/2] iothread: use IOThreadParamInfo in iothread_[set|get]_param()
Date: Mon, 11 Oct 2021 13:40:44 +0100 [thread overview]
Message-ID: <20211011124044.9090-3-stefanha@redhat.com> (raw)
In-Reply-To: <20211011124044.9090-1-stefanha@redhat.com>
From: Stefano Garzarella <sgarzare@redhat.com>
Commit 0445409d74 ("iothread: generalize
iothread_set_param/iothread_get_param") moved common code to set and
get IOThread parameters in two new functions.
These functions are called inside callbacks, so we don't need to use an
opaque pointer. Let's replace `void *opaque` parameter with
`IOThreadParamInfo *info`.
Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20210727145936.147032-3-sgarzare@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
iothread.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/iothread.c b/iothread.c
index a73e560ba0..0f98af0f2a 100644
--- a/iothread.c
+++ b/iothread.c
@@ -231,20 +231,18 @@ static IOThreadParamInfo aio_max_batch_info = {
};
static void iothread_get_param(Object *obj, Visitor *v,
- const char *name, void *opaque, Error **errp)
+ const char *name, IOThreadParamInfo *info, Error **errp)
{
IOThread *iothread = IOTHREAD(obj);
- IOThreadParamInfo *info = opaque;
int64_t *field = (void *)iothread + info->offset;
visit_type_int64(v, name, field, errp);
}
static bool iothread_set_param(Object *obj, Visitor *v,
- const char *name, void *opaque, Error **errp)
+ const char *name, IOThreadParamInfo *info, Error **errp)
{
IOThread *iothread = IOTHREAD(obj);
- IOThreadParamInfo *info = opaque;
int64_t *field = (void *)iothread + info->offset;
int64_t value;
@@ -266,16 +264,18 @@ static bool iothread_set_param(Object *obj, Visitor *v,
static void iothread_get_poll_param(Object *obj, Visitor *v,
const char *name, void *opaque, Error **errp)
{
+ IOThreadParamInfo *info = opaque;
- iothread_get_param(obj, v, name, opaque, errp);
+ iothread_get_param(obj, v, name, info, errp);
}
static void iothread_set_poll_param(Object *obj, Visitor *v,
const char *name, void *opaque, Error **errp)
{
IOThread *iothread = IOTHREAD(obj);
+ IOThreadParamInfo *info = opaque;
- if (!iothread_set_param(obj, v, name, opaque, errp)) {
+ if (!iothread_set_param(obj, v, name, info, errp)) {
return;
}
@@ -291,16 +291,18 @@ static void iothread_set_poll_param(Object *obj, Visitor *v,
static void iothread_get_aio_param(Object *obj, Visitor *v,
const char *name, void *opaque, Error **errp)
{
+ IOThreadParamInfo *info = opaque;
- iothread_get_param(obj, v, name, opaque, errp);
+ iothread_get_param(obj, v, name, info, errp);
}
static void iothread_set_aio_param(Object *obj, Visitor *v,
const char *name, void *opaque, Error **errp)
{
IOThread *iothread = IOTHREAD(obj);
+ IOThreadParamInfo *info = opaque;
- if (!iothread_set_param(obj, v, name, opaque, errp)) {
+ if (!iothread_set_param(obj, v, name, info, errp)) {
return;
}
--
2.31.1
next prev parent reply other threads:[~2021-10-11 12:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-11 12:40 [PULL 0/2] Block patches Stefan Hajnoczi
2021-10-11 12:40 ` [PULL 1/2] iothread: rename PollParamInfo to IOThreadParamInfo Stefan Hajnoczi
2021-10-11 12:40 ` Stefan Hajnoczi [this message]
2021-10-11 18:23 ` [PULL 0/2] Block patches Richard Henderson
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=20211011124044.9090-3-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=kwolf@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.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).