Pull request

-----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmFkMMMACgkQnKSrs4Gr
 c8jEAQf/UxO5QFfwUsQ/zpaXi4Helrz0vS9Gj8z4/DQ2Y8uZwoRSNc8/ejlBOfr4
 GDnscrog57x7P5wqiyl76VTK4PmkuyUKSefHmmLPOqqQ0uJijKxYeLAgJchZd4VC
 3tp+vSCchqxnjtKzyF5S+25Ki04fd3J/zA3dX7a9dabwMD4xnxlTCRvuYaneYSML
 eWbF5nJrdrMJh5FE78qOq29gUoGe6uf5ZsLagafRcMDu+Tc6qiVPmiItH5NxsQiC
 OX2L9f9Fpn7pqgEcTCUr9gi3zEHXCH3SAr/LEQ5+TZMmtXkB4QhDGfUqcY9SgaCM
 IBXpe0nfarl1WYdfLqsjJpReYubqMw==
 =HHDC
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Pull request

# gpg: Signature made Mon 11 Oct 2021 05:40:35 AM PDT
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]

* remotes/stefanha/tags/block-pull-request:
  iothread: use IOThreadParamInfo in iothread_[set|get]_param()
  iothread: rename PollParamInfo to IOThreadParamInfo

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2021-10-11 08:15:32 -07:00
commit c09124dcb8

View File

@ -215,36 +215,34 @@ static void iothread_complete(UserCreatable *obj, Error **errp)
typedef struct {
const char *name;
ptrdiff_t offset; /* field's byte offset in IOThread struct */
} PollParamInfo;
} IOThreadParamInfo;
static PollParamInfo poll_max_ns_info = {
static IOThreadParamInfo poll_max_ns_info = {
"poll-max-ns", offsetof(IOThread, poll_max_ns),
};
static PollParamInfo poll_grow_info = {
static IOThreadParamInfo poll_grow_info = {
"poll-grow", offsetof(IOThread, poll_grow),
};
static PollParamInfo poll_shrink_info = {
static IOThreadParamInfo poll_shrink_info = {
"poll-shrink", offsetof(IOThread, poll_shrink),
};
static PollParamInfo aio_max_batch_info = {
static IOThreadParamInfo aio_max_batch_info = {
"aio-max-batch", offsetof(IOThread, aio_max_batch),
};
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);
PollParamInfo *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);
PollParamInfo *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;
}