Skip to content

Commit 1cc7ead

Browse files
stefano-garzarellastefanhaRH
authored andcommitted
iothread: use IOThreadParamInfo in iothread_[set|get]_param()
Commit 0445409 ("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 <[email protected]> Signed-off-by: Stefano Garzarella <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-id: [email protected] Signed-off-by: Stefan Hajnoczi <[email protected]>
1 parent f0ed36a commit 1cc7ead

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

iothread.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -231,20 +231,18 @@ static IOThreadParamInfo aio_max_batch_info = {
231231
};
232232

233233
static void iothread_get_param(Object *obj, Visitor *v,
234-
const char *name, void *opaque, Error **errp)
234+
const char *name, IOThreadParamInfo *info, Error **errp)
235235
{
236236
IOThread *iothread = IOTHREAD(obj);
237-
IOThreadParamInfo *info = opaque;
238237
int64_t *field = (void *)iothread + info->offset;
239238

240239
visit_type_int64(v, name, field, errp);
241240
}
242241

243242
static bool iothread_set_param(Object *obj, Visitor *v,
244-
const char *name, void *opaque, Error **errp)
243+
const char *name, IOThreadParamInfo *info, Error **errp)
245244
{
246245
IOThread *iothread = IOTHREAD(obj);
247-
IOThreadParamInfo *info = opaque;
248246
int64_t *field = (void *)iothread + info->offset;
249247
int64_t value;
250248

@@ -266,16 +264,18 @@ static bool iothread_set_param(Object *obj, Visitor *v,
266264
static void iothread_get_poll_param(Object *obj, Visitor *v,
267265
const char *name, void *opaque, Error **errp)
268266
{
267+
IOThreadParamInfo *info = opaque;
269268

270-
iothread_get_param(obj, v, name, opaque, errp);
269+
iothread_get_param(obj, v, name, info, errp);
271270
}
272271

273272
static void iothread_set_poll_param(Object *obj, Visitor *v,
274273
const char *name, void *opaque, Error **errp)
275274
{
276275
IOThread *iothread = IOTHREAD(obj);
276+
IOThreadParamInfo *info = opaque;
277277

278-
if (!iothread_set_param(obj, v, name, opaque, errp)) {
278+
if (!iothread_set_param(obj, v, name, info, errp)) {
279279
return;
280280
}
281281

@@ -291,16 +291,18 @@ static void iothread_set_poll_param(Object *obj, Visitor *v,
291291
static void iothread_get_aio_param(Object *obj, Visitor *v,
292292
const char *name, void *opaque, Error **errp)
293293
{
294+
IOThreadParamInfo *info = opaque;
294295

295-
iothread_get_param(obj, v, name, opaque, errp);
296+
iothread_get_param(obj, v, name, info, errp);
296297
}
297298

298299
static void iothread_set_aio_param(Object *obj, Visitor *v,
299300
const char *name, void *opaque, Error **errp)
300301
{
301302
IOThread *iothread = IOTHREAD(obj);
303+
IOThreadParamInfo *info = opaque;
302304

303-
if (!iothread_set_param(obj, v, name, opaque, errp)) {
305+
if (!iothread_set_param(obj, v, name, info, errp)) {
304306
return;
305307
}
306308

0 commit comments

Comments
 (0)