monitor: make hmp_handle_error() take MonitorHMP
Mostly mechanical, with a few adjustments around it. Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20260828-qemu-no-hmp-v5-32-9227de146347@redhat.com>
Marc-André Lureau committed
Aug 28, 2026 at 16:04 UTC
06c1600b5571af9ece3c6b5ef7d36d59267dc171
22 files changed
+114
-177
block/monitor/block-hmp-cmds.c
+26
-47
@@ -57,7 +57,7 @@
57
#include "block/block_int.h"
58
#include "block/block-hmp-cmds.h"
59
60
-static void hmp_drive_add_node(Monitor *mon, const char *optstr)
60
+static void hmp_drive_add_node(MonitorHMP *hmp, const char *optstr)
61
{
62
QemuOpts *opts;
63
QDict *qdict;
@@ -84,7 +84,7 @@ static void hmp_drive_add_node(Monitor *mon, const char *optstr)
84
bdrv_set_monitor_owned(bs);
85
out:
86
qemu_opts_del(opts);
87
- hmp_handle_error(mon, err);
87
+ hmp_handle_error(hmp, err);
88
}
89
90
void hmp_drive_add(MonitorHMP *hmp, const QDict *qdict)
@@ -98,7 +98,7 @@ void hmp_drive_add(MonitorHMP *hmp, const QDict *qdict)
98
bool node = qdict_get_try_bool(qdict, "node", false);
99
100
if (node) {
101
- hmp_drive_add_node(mon, optstr);
101
+ hmp_drive_add_node(hmp, optstr);
102
return;
103
}
104
@@ -133,12 +133,11 @@ err:
133
monitor_remove_blk(blk);
134
blk_unref(blk);
135
}
136
- hmp_handle_error(mon, err);
136
+ hmp_handle_error(hmp, err);
137
}
138
139
void hmp_drive_del(MonitorHMP *hmp, const QDict *qdict)
140
{
141
- Monitor *mon = MONITOR(hmp);
141
const char *id = qdict_get_str(qdict, "id");
142
BlockBackend *blk;
143
BlockDriverState *bs;
@@ -193,12 +192,11 @@ void hmp_drive_del(MonitorHMP *hmp, const QDict *qdict)
192
193
unlock:
194
bdrv_graph_rdunlock_main_loop();
196
- hmp_handle_error(mon, err);
195
+ hmp_handle_error(hmp, err);
196
}
197
198
void hmp_commit(MonitorHMP *hmp, const QDict *qdict)
199
{
201
- Monitor *mon = MONITOR(hmp);
200
const char *device = qdict_get_str(qdict, "device");
201
BlockBackend *blk;
202
int ret;
@@ -232,12 +230,11 @@ void hmp_commit(MonitorHMP *hmp, const QDict *qdict)
230
}
231
232
end:
235
- hmp_handle_error(mon, err);
233
+ hmp_handle_error(hmp, err);
234
}
235
236
void hmp_drive_mirror(MonitorHMP *hmp, const QDict *qdict)
237
{
240
- Monitor *mon = MONITOR(hmp);
238
const char *filename = qdict_get_str(qdict, "target");
239
const char *format = qdict_get_try_str(qdict, "format");
240
bool reuse = qdict_get_try_bool(qdict, "reuse", false);
@@ -259,12 +256,11 @@ void hmp_drive_mirror(MonitorHMP *hmp, const QDict *qdict)
256
}
257
qmp_drive_mirror(&mirror, &err);
258
end:
262
- hmp_handle_error(mon, err);
259
+ hmp_handle_error(hmp, err);
260
}
261
262
void hmp_drive_backup(MonitorHMP *hmp, const QDict *qdict)
263
{
267
- Monitor *mon = MONITOR(hmp);
264
const char *device = qdict_get_str(qdict, "device");
265
const char *filename = qdict_get_str(qdict, "target");
266
const char *format = qdict_get_try_str(qdict, "format");
@@ -290,69 +286,63 @@ void hmp_drive_backup(MonitorHMP *hmp, const QDict *qdict)
286
287
qmp_drive_backup(&backup, &err);
288
end:
293
- hmp_handle_error(mon, err);
289
+ hmp_handle_error(hmp, err);
290
}
291
292
void hmp_block_job_set_speed(MonitorHMP *hmp, const QDict *qdict)
293
{
298
- Monitor *mon = MONITOR(hmp);
294
Error *error = NULL;
295
const char *device = qdict_get_str(qdict, "device");
296
int64_t value = qdict_get_int(qdict, "speed");
297
298
qmp_block_job_set_speed(device, value, &error);
299
305
- hmp_handle_error(mon, error);
300
+ hmp_handle_error(hmp, error);
301
}
302
303
void hmp_block_job_cancel(MonitorHMP *hmp, const QDict *qdict)
304
{
310
- Monitor *mon = MONITOR(hmp);
305
Error *error = NULL;
306
const char *device = qdict_get_str(qdict, "device");
307
bool force = qdict_get_try_bool(qdict, "force", false);
308
309
qmp_block_job_cancel(device, true, force, &error);
310
317
- hmp_handle_error(mon, error);
311
+ hmp_handle_error(hmp, error);
312
}
313
314
void hmp_block_job_pause(MonitorHMP *hmp, const QDict *qdict)
315
{
322
- Monitor *mon = MONITOR(hmp);
316
Error *error = NULL;
317
const char *device = qdict_get_str(qdict, "device");
318
319
qmp_block_job_pause(device, &error);
320
328
- hmp_handle_error(mon, error);
321
+ hmp_handle_error(hmp, error);
322
}
323
324
void hmp_block_job_resume(MonitorHMP *hmp, const QDict *qdict)
325
{
333
- Monitor *mon = MONITOR(hmp);
326
Error *error = NULL;
327
const char *device = qdict_get_str(qdict, "device");
328
329
qmp_block_job_resume(device, &error);
330
339
- hmp_handle_error(mon, error);
331
+ hmp_handle_error(hmp, error);
332
}
333
334
void hmp_block_job_complete(MonitorHMP *hmp, const QDict *qdict)
335
{
344
- Monitor *mon = MONITOR(hmp);
336
Error *error = NULL;
337
const char *device = qdict_get_str(qdict, "device");
338
339
qmp_block_job_complete(device, &error);
340
350
- hmp_handle_error(mon, error);
341
+ hmp_handle_error(hmp, error);
342
}
343
344
void hmp_snapshot_blkdev(MonitorHMP *hmp, const QDict *qdict)
345
{
355
- Monitor *mon = MONITOR(hmp);
346
const char *device = qdict_get_str(qdict, "device");
347
const char *filename = qdict_get_str(qdict, "snapshot-file");
348
const char *format = qdict_get_try_str(qdict, "format");
@@ -363,35 +353,32 @@ void hmp_snapshot_blkdev(MonitorHMP *hmp, const QDict *qdict)
353
mode = reuse ? NEW_IMAGE_MODE_EXISTING : NEW_IMAGE_MODE_ABSOLUTE_PATHS;
354
qmp_blockdev_snapshot_sync(device, NULL, filename, NULL, format,
355
true, mode, &err);
366
- hmp_handle_error(mon, err);
356
+ hmp_handle_error(hmp, err);
357
}
358
359
void hmp_snapshot_blkdev_internal(MonitorHMP *hmp, const QDict *qdict)
360
{
371
- Monitor *mon = MONITOR(hmp);
361
const char *device = qdict_get_str(qdict, "device");
362
const char *name = qdict_get_str(qdict, "name");
363
Error *err = NULL;
364
365
qmp_blockdev_snapshot_internal_sync(device, name, &err);
377
- hmp_handle_error(mon, err);
366
+ hmp_handle_error(hmp, err);
367
}
368
369
void hmp_snapshot_delete_blkdev_internal(MonitorHMP *hmp, const QDict *qdict)
370
{
382
- Monitor *mon = MONITOR(hmp);
371
const char *device = qdict_get_str(qdict, "device");
372
const char *name = qdict_get_str(qdict, "name");
373
const char *id = qdict_get_try_str(qdict, "id");
374
Error *err = NULL;
375
376
qmp_blockdev_snapshot_delete_internal_sync(device, id, name, &err);
389
- hmp_handle_error(mon, err);
377
+ hmp_handle_error(hmp, err);
378
}
379
380
void hmp_nbd_server_start(MonitorHMP *hmp, const QDict *qdict)
381
{
394
- Monitor *mon = MONITOR(hmp);
382
const char *uri = qdict_get_str(qdict, "uri");
383
bool writable = qdict_get_try_bool(qdict, "writable", false);
384
bool all = qdict_get_try_bool(qdict, "all", false);
@@ -449,12 +436,11 @@ void hmp_nbd_server_start(MonitorHMP *hmp, const QDict *qdict)
436
qapi_free_BlockInfoList(block_list);
437
438
exit:
452
- hmp_handle_error(mon, local_err);
439
+ hmp_handle_error(hmp, local_err);
440
}
441
442
void hmp_nbd_server_add(MonitorHMP *hmp, const QDict *qdict)
443
{
457
- Monitor *mon = MONITOR(hmp);
444
const char *device = qdict_get_str(qdict, "device");
445
const char *name = qdict_get_try_str(qdict, "name");
446
bool writable = qdict_get_try_bool(qdict, "writable", false);
@@ -468,44 +454,40 @@ void hmp_nbd_server_add(MonitorHMP *hmp, const QDict *qdict)
454
};
455
456
qmp_nbd_server_add(&export, &local_err);
471
- hmp_handle_error(mon, local_err);
457
+ hmp_handle_error(hmp, local_err);
458
}
459
460
void hmp_nbd_server_remove(MonitorHMP *hmp, const QDict *qdict)
461
{
476
- Monitor *mon = MONITOR(hmp);
462
const char *name = qdict_get_str(qdict, "name");
463
bool force = qdict_get_try_bool(qdict, "force", false);
464
Error *err = NULL;
465
466
/* Rely on BLOCK_EXPORT_REMOVE_MODE_SAFE being the default */
467
qmp_nbd_server_remove(name, force, BLOCK_EXPORT_REMOVE_MODE_HARD, &err);
483
- hmp_handle_error(mon, err);
468
+ hmp_handle_error(hmp, err);
469
}
470
471
void hmp_nbd_server_stop(MonitorHMP *hmp, const QDict *qdict)
472
{
488
- Monitor *mon = MONITOR(hmp);
473
Error *err = NULL;
474
475
qmp_nbd_server_stop(&err);
492
- hmp_handle_error(mon, err);
476
+ hmp_handle_error(hmp, err);
477
}
478
479
void coroutine_fn hmp_block_resize(MonitorHMP *hmp, const QDict *qdict)
480
{
497
- Monitor *mon = MONITOR(hmp);
481
const char *device = qdict_get_str(qdict, "device");
482
int64_t size = qdict_get_int(qdict, "size");
483
Error *err = NULL;
484
485
qmp_block_resize(device, NULL, size, &err);
503
- hmp_handle_error(mon, err);
486
+ hmp_handle_error(hmp, err);
487
}
488
489
void hmp_block_stream(MonitorHMP *hmp, const QDict *qdict)
490
{
508
- Monitor *mon = MONITOR(hmp);
491
Error *error = NULL;
492
const char *device = qdict_get_str(qdict, "device");
493
const char *base = qdict_get_try_str(qdict, "base");
@@ -516,12 +498,11 @@ void hmp_block_stream(MonitorHMP *hmp, const QDict *qdict)
498
true, BLOCKDEV_ON_ERROR_REPORT, NULL,
499
false, false, false, false, &error);
500
519
- hmp_handle_error(mon, error);
501
+ hmp_handle_error(hmp, error);
502
}
503
504
void hmp_block_set_io_throttle(MonitorHMP *hmp, const QDict *qdict)
505
{
524
- Monitor *mon = MONITOR(hmp);
506
Error *err = NULL;
507
char *device = (char *) qdict_get_str(qdict, "device");
508
BlockIOThrottle throttle = {
@@ -545,23 +526,21 @@ void hmp_block_set_io_throttle(MonitorHMP *hmp, const QDict *qdict)
526
}
527
528
qmp_block_set_io_throttle(&throttle, &err);
548
- hmp_handle_error(mon, err);
529
+ hmp_handle_error(hmp, err);
530
}
531
532
void hmp_eject(MonitorHMP *hmp, const QDict *qdict)
533
{
553
- Monitor *mon = MONITOR(hmp);
534
bool force = qdict_get_try_bool(qdict, "force", false);
535
const char *device = qdict_get_str(qdict, "device");
536
Error *err = NULL;
537
538
qmp_eject(device, NULL, true, force, &err);
559
- hmp_handle_error(mon, err);
539
+ hmp_handle_error(hmp, err);
540
}
541
542
void hmp_qemu_io(MonitorHMP *hmp, const QDict *qdict)
543
{
564
- Monitor *mon = MONITOR(hmp);
544
bool qdev = qdict_get_try_bool(qdict, "qdev", false);
545
const char *device = qdict_get_str(qdict, "device");
546
const char *command = qdict_get_str(qdict, "command");
@@ -570,7 +549,7 @@ void hmp_qemu_io(MonitorHMP *hmp, const QDict *qdict)
549
qmp_x_qemu_io(qdev ? NULL : device,
550
qdev ? device : NULL,
551
command, &err);
573
- hmp_handle_error(mon, err);
552
+ hmp_handle_error(hmp, err);
553
}
554
555
static void print_block_info(Monitor *mon, BlockInfo *info,
@@ -851,7 +830,7 @@ void hmp_info_snapshots(MonitorHMP *hmp, const QDict *qdict)
830
831
bs = bdrv_all_find_vmstate_bs(NULL, false, NULL, &err);
832
if (!bs) {
854
- hmp_handle_error(mon, err);
833
+ hmp_handle_error(hmp, err);
834
return;
835
}
836
chardev/char-hmp-cmds.c
+6
-11
@@ -40,14 +40,13 @@ void hmp_info_chardev(MonitorHMP *hmp, const QDict *qdict)
40
41
void hmp_ringbuf_write(MonitorHMP *hmp, const QDict *qdict)
42
{
43
- Monitor *mon = MONITOR(hmp);
43
const char *chardev = qdict_get_str(qdict, "device");
44
const char *data = qdict_get_str(qdict, "data");
45
Error *err = NULL;
46
47
qmp_ringbuf_write(chardev, data, false, 0, &err);
48
50
- hmp_handle_error(mon, err);
49
+ hmp_handle_error(hmp, err);
50
}
51
52
void hmp_ringbuf_read(MonitorHMP *hmp, const QDict *qdict)
@@ -60,7 +59,7 @@ void hmp_ringbuf_read(MonitorHMP *hmp, const QDict *qdict)
59
int i;
60
61
data = qmp_ringbuf_read(chardev, size, false, 0, &err);
63
- if (hmp_handle_error(mon, err)) {
62
+ if (hmp_handle_error(hmp, err)) {
63
return;
64
}
65
@@ -82,7 +81,6 @@ void hmp_ringbuf_read(MonitorHMP *hmp, const QDict *qdict)
81
82
void hmp_chardev_add(MonitorHMP *hmp, const QDict *qdict)
83
{
85
- Monitor *mon = MONITOR(hmp);
84
const char *args = qdict_get_str(qdict, "args");
85
Error *err = NULL;
86
QemuOpts *opts;
@@ -94,12 +92,11 @@ void hmp_chardev_add(MonitorHMP *hmp, const QDict *qdict)
92
qemu_chr_new_from_opts(opts, NULL, &err);
93
qemu_opts_del(opts);
94
}
97
- hmp_handle_error(mon, err);
95
+ hmp_handle_error(hmp, err);
96
}
97
98
void hmp_chardev_change(MonitorHMP *hmp, const QDict *qdict)
99
{
102
- Monitor *mon = MONITOR(hmp);
100
const char *args = qdict_get_str(qdict, "args");
101
const char *id;
102
Error *err = NULL;
@@ -129,25 +126,23 @@ end:
126
qapi_free_ChardevReturn(ret);
127
qapi_free_ChardevBackend(backend);
128
qemu_opts_del(opts);
132
- hmp_handle_error(mon, err);
129
+ hmp_handle_error(hmp, err);
130
}
131
132
void hmp_chardev_remove(MonitorHMP *hmp, const QDict *qdict)
133
{
137
- Monitor *mon = MONITOR(hmp);
134
Error *local_err = NULL;
135
136
qmp_chardev_remove(qdict_get_str(qdict, "id"), &local_err);
141
- hmp_handle_error(mon, local_err);
137
+ hmp_handle_error(hmp, local_err);
138
}
139
140
void hmp_chardev_send_break(MonitorHMP *hmp, const QDict *qdict)
141
{
146
- Monitor *mon = MONITOR(hmp);
142
Error *local_err = NULL;
143
144
qmp_chardev_send_break(qdict_get_str(qdict, "id"), &local_err);
150
- hmp_handle_error(mon, local_err);
145
+ hmp_handle_error(hmp, local_err);
146
}
147
148
void chardev_add_completion(ReadLineState *rs, int nb_args, const char *str)
dump/dump-hmp-cmds.c
+2
-3
@@ -14,7 +14,6 @@
14
15
void hmp_dump_guest_memory(MonitorHMP *hmp, const QDict *qdict)
16
{
17
- Monitor *mon = MONITOR(hmp);
17
Error *err = NULL;
18
bool win_dmp = qdict_get_try_bool(qdict, "windmp", false);
19
bool paging = qdict_get_try_bool(qdict, "paging", false);
@@ -34,7 +33,7 @@ void hmp_dump_guest_memory(MonitorHMP *hmp, const QDict *qdict)
33
34
if (zlib + lzo + snappy + win_dmp > 1) {
35
error_setg(&err, "only one of '-z|-l|-s|-w' can be set");
37
- hmp_handle_error(mon, err);
36
+ hmp_handle_error(hmp, err);
37
return;
38
}
39
@@ -80,7 +79,7 @@ void hmp_dump_guest_memory(MonitorHMP *hmp, const QDict *qdict)
79
80
qmp_dump_guest_memory(paging, prot, true, detach, has_begin, begin,
81
has_length, length, true, dump_format, &err);
83
- hmp_handle_error(mon, err);
82
+ hmp_handle_error(hmp, err);
83
g_free(prot);
84
}
85
hw/core/machine-hmp-cmds.c
+11
-15
@@ -57,7 +57,7 @@ void hmp_hotpluggable_cpus(MonitorHMP *hmp, const QDict *qdict)
57
HotpluggableCPUList *saved = l;
58
CpuInstanceProperties *c;
59
60
- if (hmp_handle_error(mon, err)) {
60
+ if (hmp_handle_error(hmp, err)) {
61
return;
62
}
63
@@ -147,7 +147,7 @@ void hmp_info_memdev(MonitorHMP *hmp, const QDict *qdict)
147
monitor_printf(mon, "\n");
148
149
qapi_free_MemdevList(memdev_list);
150
- hmp_handle_error(mon, err);
150
+ hmp_handle_error(hmp, err);
151
}
152
153
void hmp_info_kvm(MonitorHMP *hmp, const QDict *qdict)
@@ -202,7 +202,7 @@ void hmp_info_balloon(MonitorHMP *hmp, const QDict *qdict)
202
Error *err = NULL;
203
204
info = qmp_query_balloon(&err);
205
- if (hmp_handle_error(mon, err)) {
205
+ if (hmp_handle_error(hmp, err)) {
206
return;
207
}
208
@@ -236,47 +236,43 @@ void hmp_memsave(MonitorHMP *hmp, const QDict *qdict)
236
}
237
238
qmp_memsave(addr, size, filename, true, cpu_index, &err);
239
- hmp_handle_error(mon, err);
239
+ hmp_handle_error(hmp, err);
240
}
241
242
void hmp_pmemsave(MonitorHMP *hmp, const QDict *qdict)
243
{
244
- Monitor *mon = MONITOR(hmp);
244
uint32_t size = qdict_get_int(qdict, "size");
245
const char *filename = qdict_get_str(qdict, "filename");
246
uint64_t addr = qdict_get_int(qdict, "val");
247
Error *err = NULL;
248
249
qmp_pmemsave(addr, size, filename, &err);
251
- hmp_handle_error(mon, err);
250
+ hmp_handle_error(hmp, err);
251
}
252
253
void hmp_system_wakeup(MonitorHMP *hmp, const QDict *qdict)
254
{
256
- Monitor *mon = MONITOR(hmp);
255
Error *err = NULL;
256
257
qmp_system_wakeup(&err);
260
- hmp_handle_error(mon, err);
258
+ hmp_handle_error(hmp, err);
259
}
260
261
void hmp_nmi(MonitorHMP *hmp, const QDict *qdict)
262
{
265
- Monitor *mon = MONITOR(hmp);
263
Error *err = NULL;
264
265
qmp_inject_nmi(&err);
269
- hmp_handle_error(mon, err);
266
+ hmp_handle_error(hmp, err);
267
}
268
269
void hmp_balloon(MonitorHMP *hmp, const QDict *qdict)
270
{
274
- Monitor *mon = MONITOR(hmp);
271
int64_t value = qdict_get_int(qdict, "value");
272
Error *err = NULL;
273
274
qmp_balloon(value, &err);
279
- hmp_handle_error(mon, err);
275
+ hmp_handle_error(hmp, err);
276
}
277
278
void hmp_info_memory_devices(MonitorHMP *hmp, const QDict *qdict)
@@ -380,7 +376,7 @@ void hmp_info_memory_devices(MonitorHMP *hmp, const QDict *qdict)
376
}
377
378
qapi_free_MemoryDeviceInfoList(info_list);
383
- hmp_handle_error(mon, err);
379
+ hmp_handle_error(hmp, err);
380
}
381
382
void hmp_info_vm_generation_id(MonitorHMP *hmp, const QDict *qdict)
@@ -391,7 +387,7 @@ void hmp_info_vm_generation_id(MonitorHMP *hmp, const QDict *qdict)
387
if (info) {
388
monitor_printf(mon, "%s\n", info->guid);
389
}
394
- hmp_handle_error(mon, err);
390
+ hmp_handle_error(hmp, err);
391
qapi_free_GuidInfo(info);
392
}
393
@@ -411,5 +407,5 @@ void hmp_info_memory_size_summary(MonitorHMP *hmp, const QDict *qdict)
407
408
qapi_free_MemoryInfo(info);
409
}
414
- hmp_handle_error(mon, err);
410
+ hmp_handle_error(hmp, err);
411
}
hw/i386/kvm/xen_evtchn.c
+2
-2
@@ -2352,7 +2352,7 @@ void hmp_xen_event_list(MonitorHMP *hmp, const QDict *qdict)
2352
2353
info_list = qmp_xen_event_list(&err);
2354
if (err) {
2355
- hmp_handle_error(mon, err);
2355
+ hmp_handle_error(hmp, err);
2356
return;
2357
}
2358
@@ -2388,7 +2388,7 @@ void hmp_xen_event_inject(MonitorHMP *hmp, const QDict *qdict)
2388
2389
qmp_xen_event_inject(port, &err);
2390
if (err) {
2391
- hmp_handle_error(mon, err);
2391
+ hmp_handle_error(hmp, err);
2392
} else {
2393
monitor_printf(mon, "Delivered port %d\n", port);
2394
}
hw/misc/mos6522.c
+1
-1
@@ -592,7 +592,7 @@ void hmp_info_via(MonitorHMP *hmp, const QDict *qdict)
592
Error *err = NULL;
593
g_autoptr(HumanReadableText) info = qmp_x_query_via(&err);
594
595
- if (hmp_handle_error(mon, err)) {
595
+ if (hmp_handle_error(hmp, err)) {
596
return;
597
}
598
monitor_puts(mon, info->human_readable_text);
hw/net/rocker/rocker-hmp-cmds.c
+4
-4
@@ -28,7 +28,7 @@ void hmp_rocker(MonitorHMP *hmp, const QDict *qdict)
28
Error *err = NULL;
29
30
rocker = qmp_query_rocker(name, &err);
31
- if (hmp_handle_error(mon, err)) {
31
+ if (hmp_handle_error(hmp, err)) {
32
return;
33
}
34
@@ -47,7 +47,7 @@ void hmp_rocker_ports(MonitorHMP *hmp, const QDict *qdict)
47
Error *err = NULL;
48
49
list = qmp_query_rocker_ports(name, &err);
50
- if (hmp_handle_error(mon, err)) {
50
+ if (hmp_handle_error(hmp, err)) {
51
return;
52
}
53
@@ -76,7 +76,7 @@ void hmp_rocker_of_dpa_flows(MonitorHMP *hmp, const QDict *qdict)
76
Error *err = NULL;
77
78
list = qmp_query_rocker_of_dpa_flows(name, tbl_id != -1, tbl_id, &err);
79
- if (hmp_handle_error(mon, err)) {
79
+ if (hmp_handle_error(hmp, err)) {
80
return;
81
}
82
@@ -226,7 +226,7 @@ void hmp_rocker_of_dpa_groups(MonitorHMP *hmp, const QDict *qdict)
226
Error *err = NULL;
227
228
list = qmp_query_rocker_of_dpa_groups(name, type != 9, type, &err);
229
- if (hmp_handle_error(mon, err)) {
229
+ if (hmp_handle_error(hmp, err)) {
230
return;
231
}
232
hw/pci/pci-hmp-cmds.c
+1
-1
@@ -247,5 +247,5 @@ void hmp_pcie_aer_inject_error(MonitorHMP *hmp, const QDict *qdict)
247
PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
248
249
out:
250
- hmp_handle_error(mon, err);
250
+ hmp_handle_error(hmp, err);
251
}
hw/uefi/ovmf-log.c
+1
-1
@@ -269,7 +269,7 @@ void hmp_info_firmware_log(MonitorHMP *hmp, const QDict *qdict)
269
maxsize = qdict_get_try_int(qdict, "max-size", -1);
270
log = qmp_query_firmware_log(maxsize != -1, (uint64_t)maxsize, &err);
271
if (err) {
272
- hmp_handle_error(mon, err);
272
+ hmp_handle_error(hmp, err);
273
return;
274
}
275
hw/virtio/virtio-hmp-cmds.c
+5
-5
@@ -88,7 +88,7 @@ void hmp_virtio_query(MonitorHMP *hmp, const QDict *qdict)
88
VirtioInfoList *node;
89
90
if (err != NULL) {
91
- hmp_handle_error(mon, err);
91
+ hmp_handle_error(hmp, err);
92
return;
93
}
94
@@ -114,7 +114,7 @@ void hmp_virtio_status(MonitorHMP *hmp, const QDict *qdict)
114
VirtioStatus *s = qmp_x_query_virtio_status(path, &err);
115
116
if (err != NULL) {
117
- hmp_handle_error(mon, err);
117
+ hmp_handle_error(hmp, err);
118
return;
119
}
120
@@ -195,7 +195,7 @@ void hmp_vhost_queue_status(MonitorHMP *hmp, const QDict *qdict)
195
qmp_x_query_virtio_vhost_queue_status(path, queue, &err);
196
197
if (err != NULL) {
198
- hmp_handle_error(mon, err);
198
+ hmp_handle_error(hmp, err);
199
return;
200
}
201
@@ -228,7 +228,7 @@ void hmp_virtio_queue_status(MonitorHMP *hmp, const QDict *qdict)
228
VirtQueueStatus *s = qmp_x_query_virtio_queue_status(path, queue, &err);
229
230
if (err != NULL) {
231
- hmp_handle_error(mon, err);
231
+ hmp_handle_error(hmp, err);
232
return;
233
}
234
@@ -278,7 +278,7 @@ void hmp_virtio_queue_element(MonitorHMP *hmp, const QDict *qdict)
278
e = qmp_x_query_virtio_queue_element(path, queue, index != -1,
279
index, &err);
280
if (err != NULL) {
281
- hmp_handle_error(mon, err);
281
+ hmp_handle_error(hmp, err);
282
return;
283
}
284
include/monitor/hmp.h
+1
-1
@@ -54,7 +54,7 @@ void monitor_register_hmp_info_hrt(const char *name,
54
CPUArchState *mon_get_cpu_env(Monitor *mon);
55
CPUState *mon_get_cpu(Monitor *mon);
56
57
-bool hmp_handle_error(Monitor *mon, Error *err);
57
+bool hmp_handle_error(MonitorHMP *hmp, Error *err);
58
void hmp_help_cmd(Monitor *mon, const char *name);
59
strList *hmp_split_at_comma(const char *str);
60
migration/dirtyrate.c
+1
-1
@@ -926,7 +926,7 @@ void hmp_calc_dirty_rate(MonitorHMP *hmp, const QDict *qdict)
926
true, mode,
927
&err);
928
if (err) {
929
- hmp_handle_error(mon, err);
929
+ hmp_handle_error(hmp, err);
930
return;
931
}
932
migration/migration-hmp-cmds.c
+15
-26
@@ -478,7 +478,6 @@ void hmp_info_migrate_parameters(MonitorHMP *hmp, const QDict *qdict)
478
479
void hmp_loadvm(MonitorHMP *hmp, const QDict *qdict)
480
{
481
- Monitor *mon = MONITOR(hmp);
481
RunState saved_state = runstate_get();
482
483
const char *name = qdict_get_str(qdict, "name");
@@ -490,27 +489,25 @@ void hmp_loadvm(MonitorHMP *hmp, const QDict *qdict)
489
load_snapshot_resume(saved_state);
490
}
491
493
- hmp_handle_error(mon, err);
492
+ hmp_handle_error(hmp, err);
493
}
494
495
void hmp_savevm(MonitorHMP *hmp, const QDict *qdict)
496
{
498
- Monitor *mon = MONITOR(hmp);
497
Error *err = NULL;
498
499
save_snapshot(qdict_get_try_str(qdict, "name"),
500
true, NULL, false, NULL, &err);
503
- hmp_handle_error(mon, err);
501
+ hmp_handle_error(hmp, err);
502
}
503
504
void hmp_delvm(MonitorHMP *hmp, const QDict *qdict)
505
{
508
- Monitor *mon = MONITOR(hmp);
506
Error *err = NULL;
507
const char *name = qdict_get_str(qdict, "name");
508
509
delete_snapshot(name, false, NULL, &err);
513
- hmp_handle_error(mon, err);
510
+ hmp_handle_error(hmp, err);
511
}
512
513
void hmp_migrate_cancel(MonitorHMP *hmp, const QDict *qdict)
@@ -520,7 +517,6 @@ void hmp_migrate_cancel(MonitorHMP *hmp, const QDict *qdict)
517
518
void hmp_migrate_continue(MonitorHMP *hmp, const QDict *qdict)
519
{
523
- Monitor *mon = MONITOR(hmp);
520
Error *err = NULL;
521
const char *state = qdict_get_str(qdict, "state");
522
int val = qapi_enum_parse(&MigrationStatus_lookup, state, -1, &err);
@@ -529,12 +525,11 @@ void hmp_migrate_continue(MonitorHMP *hmp, const QDict *qdict)
525
qmp_migrate_continue(val, &err);
526
}
527
532
- hmp_handle_error(mon, err);
528
+ hmp_handle_error(hmp, err);
529
}
530
531
void hmp_migrate_incoming(MonitorHMP *hmp, const QDict *qdict)
532
{
537
- Monitor *mon = MONITOR(hmp);
533
Error *err = NULL;
534
const char *uri = qdict_get_str(qdict, "uri");
535
MigrationChannelList *caps = NULL;
@@ -549,34 +544,31 @@ void hmp_migrate_incoming(MonitorHMP *hmp, const QDict *qdict)
544
qapi_free_MigrationChannelList(caps);
545
546
end:
552
- hmp_handle_error(mon, err);
547
+ hmp_handle_error(hmp, err);
548
}
549
550
void hmp_migrate_recover(MonitorHMP *hmp, const QDict *qdict)
551
{
557
- Monitor *mon = MONITOR(hmp);
552
Error *err = NULL;
553
const char *uri = qdict_get_str(qdict, "uri");
554
555
qmp_migrate_recover(uri, &err);
556
563
- hmp_handle_error(mon, err);
557
+ hmp_handle_error(hmp, err);
558
}
559
560
void hmp_migrate_pause(MonitorHMP *hmp, const QDict *qdict)
561
{
568
- Monitor *mon = MONITOR(hmp);
562
Error *err = NULL;
563
564
qmp_migrate_pause(&err);
565
573
- hmp_handle_error(mon, err);
566
+ hmp_handle_error(hmp, err);
567
}
568
569
570
void hmp_migrate_set_capability(MonitorHMP *hmp, const QDict *qdict)
571
{
579
- Monitor *mon = MONITOR(hmp);
572
const char *cap = qdict_get_str(qdict, "capability");
573
bool state = qdict_get_bool(qdict, "state");
574
Error *err = NULL;
@@ -597,12 +589,11 @@ void hmp_migrate_set_capability(MonitorHMP *hmp, const QDict *qdict)
589
qapi_free_MigrationCapabilityStatusList(caps);
590
591
end:
600
- hmp_handle_error(mon, err);
592
+ hmp_handle_error(hmp, err);
593
}
594
595
void hmp_migrate_set_parameter(MonitorHMP *hmp, const QDict *qdict)
596
{
605
- Monitor *mon = MONITOR(hmp);
597
const char *param = qdict_get_str(qdict, "parameter");
598
const char *valuestr = qdict_get_str(qdict, "value");
599
Visitor *v = string_input_visitor_new(valuestr);
@@ -799,25 +790,23 @@ void hmp_migrate_set_parameter(MonitorHMP *hmp, const QDict *qdict)
790
cleanup:
791
qapi_free_MigrationParameters(p);
792
visit_free(v);
802
- hmp_handle_error(mon, err);
793
+ hmp_handle_error(hmp, err);
794
}
795
796
void hmp_migrate_start_postcopy(MonitorHMP *hmp, const QDict *qdict)
797
{
807
- Monitor *mon = MONITOR(hmp);
798
Error *err = NULL;
799
qmp_migrate_start_postcopy(&err);
810
- hmp_handle_error(mon, err);
800
+ hmp_handle_error(hmp, err);
801
}
802
803
#ifdef CONFIG_REPLICATION
804
void hmp_x_colo_lost_heartbeat(MonitorHMP *hmp, const QDict *qdict)
805
{
816
- Monitor *mon = MONITOR(hmp);
806
Error *err = NULL;
807
808
qmp_x_colo_lost_heartbeat(&err);
820
- hmp_handle_error(mon, err);
809
+ hmp_handle_error(hmp, err);
810
}
811
#endif
812
@@ -860,7 +849,7 @@ void hmp_migrate(MonitorHMP *hmp, const QDict *qdict)
849
g_autoptr(MigrationChannel) channel_cpr = NULL;
850
851
if (!migrate_uri_parse(uri, &channel, &err)) {
863
- hmp_handle_error(mon, err);
852
+ hmp_handle_error(hmp, err);
853
return;
854
}
855
QAPI_LIST_PREPEND(caps, g_steal_pointer(&channel));
@@ -868,12 +857,12 @@ void hmp_migrate(MonitorHMP *hmp, const QDict *qdict)
857
if (uri_cpr) {
858
if (migrate_mode() != MIG_MODE_CPR_TRANSFER) {
859
error_setg(&err, "-c can only be used in cpr-transfer mode");
871
- hmp_handle_error(mon, err);
860
+ hmp_handle_error(hmp, err);
861
return;
862
}
863
864
if (!migrate_uri_parse(uri_cpr, &channel_cpr, &err)) {
876
- hmp_handle_error(mon, err);
865
+ hmp_handle_error(hmp, err);
866
return;
867
}
868
@@ -882,7 +871,7 @@ void hmp_migrate(MonitorHMP *hmp, const QDict *qdict)
871
}
872
873
qmp_migrate(NULL, true, caps, true, resume, &err);
885
- if (hmp_handle_error(mon, err)) {
874
+ if (hmp_handle_error(hmp, err)) {
875
return;
876
}
877
monitor/hmp-cmds.c
+9
-14
@@ -75,7 +75,7 @@ static void __attribute__((__constructor__)) sortcmdlist(void)
75
compare_mon_cmd);
76
}
77
78
-bool hmp_handle_error(Monitor *mon, Error *err)
78
+bool hmp_handle_error(MonitorHMP *hmp, Error *err)
79
{
80
if (err) {
81
error_reportf_err(err, "Error: ");
@@ -165,17 +165,16 @@ void hmp_sync_profile(MonitorHMP *hmp, const QDict *qdict)
165
166
error_setg(&err, "invalid parameter '%s',"
167
" expecting 'on', 'off', or 'reset'", op);
168
- hmp_handle_error(mon, err);
168
+ hmp_handle_error(hmp, err);
169
}
170
}
171
172
void hmp_exit_preconfig(MonitorHMP *hmp, const QDict *qdict)
173
{
174
- Monitor *mon = MONITOR(hmp);
174
Error *err = NULL;
175
176
qmp_x_exit_preconfig(&err);
178
- hmp_handle_error(mon, err);
177
+ hmp_handle_error(hmp, err);
178
}
179
180
void hmp_cpu(MonitorHMP *hmp, const QDict *qdict)
@@ -193,11 +192,10 @@ void hmp_cpu(MonitorHMP *hmp, const QDict *qdict)
192
193
void hmp_cont(MonitorHMP *hmp, const QDict *qdict)
194
{
196
- Monitor *mon = MONITOR(hmp);
195
Error *err = NULL;
196
197
qmp_cont(&err);
200
- hmp_handle_error(mon, err);
198
+ hmp_handle_error(hmp, err);
199
}
200
201
void hmp_change(MonitorHMP *hmp, const QDict *qdict)
@@ -219,29 +217,27 @@ void hmp_change(MonitorHMP *hmp, const QDict *qdict)
217
hmp_change_medium(mon, device, target, arg, read_only, force, &err);
218
}
219
222
- hmp_handle_error(mon, err);
220
+ hmp_handle_error(hmp, err);
221
}
222
223
#ifdef CONFIG_POSIX
224
void hmp_getfd(MonitorHMP *hmp, const QDict *qdict)
225
{
228
- Monitor *mon = MONITOR(hmp);
226
const char *fdname = qdict_get_str(qdict, "fdname");
227
Error *err = NULL;
228
229
qmp_getfd(fdname, &err);
233
- hmp_handle_error(mon, err);
230
+ hmp_handle_error(hmp, err);
231
}
232
#endif
233
234
void hmp_closefd(MonitorHMP *hmp, const QDict *qdict)
235
{
239
- Monitor *mon = MONITOR(hmp);
236
const char *fdname = qdict_get_str(qdict, "fdname");
237
Error *err = NULL;
238
239
qmp_closefd(fdname, &err);
244
- hmp_handle_error(mon, err);
240
+ hmp_handle_error(hmp, err);
241
}
242
243
void hmp_info_iothreads(MonitorHMP *hmp, const QDict *qdict)
@@ -502,17 +498,16 @@ void hmp_info_mtree(MonitorHMP *hmp, const QDict *qdict)
498
#if defined(CONFIG_FDT)
499
void hmp_dumpdtb(MonitorHMP *hmp, const QDict *qdict)
500
{
505
- Monitor *mon = MONITOR(hmp);
501
const char *filename = qdict_get_str(qdict, "filename");
502
Error *local_err = NULL;
503
504
qmp_dumpdtb(filename, &local_err);
505
511
- if (hmp_handle_error(mon, local_err)) {
506
+ if (hmp_handle_error(hmp, local_err)) {
507
return;
508
}
509
515
- monitor_printf(mon, "DTB dumped to '%s'\n", filename);
510
+ monitor_printf(MONITOR(hmp), "DTB dumped to '%s'\n", filename);
511
}
512
#endif
513
monitor/hmp.c
+6
-6
@@ -1215,28 +1215,28 @@ fail:
1215
return NULL;
1216
}
1217
1218
-static void hmp_info_human_readable_text(Monitor *mon,
1218
+static void hmp_info_human_readable_text(MonitorHMP *hmp,
1219
HumanReadableText *(*handler)(Error **))
1220
{
1221
Error *err = NULL;
1222
g_autoptr(HumanReadableText) info = handler(&err);
1223
1224
- if (hmp_handle_error(mon, err)) {
1224
+ if (hmp_handle_error(hmp, err)) {
1225
return;
1226
}
1227
1228
- monitor_puts(mon, info->human_readable_text);
1228
+ monitor_puts(MONITOR(hmp), info->human_readable_text);
1229
}
1230
1231
-static void handle_hmp_command_exec(MonitorHMP *mon,
1231
+static void handle_hmp_command_exec(MonitorHMP *hmp,
1232
const HMPCommand *cmd,
1233
QDict *qdict)
1234
{
1235
if (cmd->cmd_info_hrt) {
1236
- hmp_info_human_readable_text(MONITOR(mon),
1236
+ hmp_info_human_readable_text(hmp,
1237
cmd->cmd_info_hrt);
1238
} else {
1239
- cmd->cmd(mon, qdict);
1239
+ cmd->cmd(hmp, qdict);
1240
}
1241
}
1242
net/net-hmp-cmds.c
+4
-7
@@ -53,7 +53,7 @@ void hmp_info_network(MonitorHMP *hmp, const QDict *qdict)
53
NetHubInfoList *h;
54
NetworkClientInfoList *entry;
55
56
- if (hmp_handle_error(mon, err)) {
56
+ if (hmp_handle_error(hmp, err)) {
57
return;
58
}
59
@@ -86,13 +86,12 @@ void hmp_info_network(MonitorHMP *hmp, const QDict *qdict)
86
87
void hmp_set_link(MonitorHMP *hmp, const QDict *qdict)
88
{
89
- Monitor *mon = MONITOR(hmp);
89
const char *name = qdict_get_str(qdict, "name");
90
bool up = qdict_get_bool(qdict, "up");
91
Error *err = NULL;
92
93
qmp_set_link(name, up, &err);
95
- hmp_handle_error(mon, err);
94
+ hmp_handle_error(hmp, err);
95
}
96
97
@@ -113,7 +112,6 @@ void hmp_announce_self(MonitorHMP *hmp, const QDict *qdict)
112
113
void hmp_netdev_add(MonitorHMP *hmp, const QDict *qdict)
114
{
116
- Monitor *mon = MONITOR(hmp);
115
Error *err = NULL;
116
QemuOpts *opts;
117
const char *type = qdict_get_try_str(qdict, "type");
@@ -133,17 +131,16 @@ void hmp_netdev_add(MonitorHMP *hmp, const QDict *qdict)
131
}
132
133
out:
136
- hmp_handle_error(mon, err);
134
+ hmp_handle_error(hmp, err);
135
}
136
137
void hmp_netdev_del(MonitorHMP *hmp, const QDict *qdict)
138
{
141
- Monitor *mon = MONITOR(hmp);
139
const char *id = qdict_get_str(qdict, "id");
140
Error *err = NULL;
141
142
qmp_netdev_del(id, &err);
146
- hmp_handle_error(mon, err);
143
+ hmp_handle_error(hmp, err);
144
}
145
146
qom/qom-hmp-cmds.c
+5
-8
@@ -42,12 +42,11 @@ void hmp_qom_list(MonitorHMP *hmp, const QDict *qdict)
42
}
43
qapi_free_ObjectPropertyInfoList(start);
44
}
45
- hmp_handle_error(mon, err);
45
+ hmp_handle_error(hmp, err);
46
}
47
48
void hmp_qom_set(MonitorHMP *hmp, const QDict *qdict)
49
{
50
- Monitor *mon = MONITOR(hmp);
50
const bool json = qdict_get_try_bool(qdict, "json", false);
51
const char *path = qdict_get_str(qdict, "path");
52
const char *property = qdict_get_str(qdict, "property");
@@ -71,7 +70,7 @@ void hmp_qom_set(MonitorHMP *hmp, const QDict *qdict)
70
}
71
}
72
74
- hmp_handle_error(mon, err);
73
+ hmp_handle_error(hmp, err);
74
}
75
76
void hmp_qom_get(MonitorHMP *hmp, const QDict *qdict)
@@ -89,7 +88,7 @@ void hmp_qom_get(MonitorHMP *hmp, const QDict *qdict)
88
}
89
90
qobject_unref(obj);
92
- hmp_handle_error(mon, err);
91
+ hmp_handle_error(hmp, err);
92
}
93
94
typedef struct QOMCompositionState {
@@ -160,22 +159,20 @@ void hmp_info_qom_tree(MonitorHMP *hmp, const QDict *dict)
159
160
void hmp_object_add(MonitorHMP *hmp, const QDict *qdict)
161
{
163
- Monitor *mon = MONITOR(hmp);
162
const char *options = qdict_get_str(qdict, "object");
163
Error *err = NULL;
164
165
user_creatable_add_from_str(options, &err);
168
- hmp_handle_error(mon, err);
166
+ hmp_handle_error(hmp, err);
167
}
168
169
void hmp_object_del(MonitorHMP *hmp, const QDict *qdict)
170
{
173
- Monitor *mon = MONITOR(hmp);
171
const char *id = qdict_get_str(qdict, "id");
172
Error *err = NULL;
173
174
user_creatable_del(id, &err);
178
- hmp_handle_error(mon, err);
175
+ hmp_handle_error(hmp, err);
176
}
177
178
void object_add_completion(ReadLineState *rs, int nb_args, const char *str)
system/dirtylimit-hmp-cmds.c
+3
-4
@@ -23,7 +23,7 @@ void hmp_cancel_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict)
23
24
qmp_cancel_vcpu_dirty_limit(!!(cpu_index != -1), cpu_index, &err);
25
if (err) {
26
- hmp_handle_error(mon, err);
26
+ hmp_handle_error(hmp, err);
27
return;
28
}
29
@@ -33,7 +33,6 @@ void hmp_cancel_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict)
33
34
void hmp_set_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict)
35
{
36
- Monitor *mon = MONITOR(hmp);
36
int64_t dirty_rate = qdict_get_int(qdict, "dirty_rate");
37
int64_t cpu_index = qdict_get_try_int(qdict, "cpu_index", -1);
38
Error *err = NULL;
@@ -46,7 +45,7 @@ void hmp_set_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict)
45
qmp_set_vcpu_dirty_limit(!!(cpu_index != -1), cpu_index, dirty_rate, &err);
46
47
out:
49
- hmp_handle_error(mon, err);
48
+ hmp_handle_error(hmp, err);
49
}
50
51
void hmp_info_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict)
@@ -63,7 +62,7 @@ void hmp_info_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict)
62
63
head = qmp_query_vcpu_dirty_limit(&err);
64
if (err) {
66
- hmp_handle_error(mon, err);
65
+ hmp_handle_error(hmp, err);
66
return;
67
}
68
system/qdev-monitor.c
+2
-4
@@ -1004,7 +1004,6 @@ void qmp_device_sync_config(const char *id, Error **errp)
1004
1005
void hmp_device_add(MonitorHMP *hmp, const QDict *qdict)
1006
{
1007
- Monitor *mon = MONITOR(hmp);
1007
Error *err = NULL;
1008
QemuOpts *opts;
1009
DeviceState *dev;
@@ -1034,17 +1033,16 @@ void hmp_device_add(MonitorHMP *hmp, const QDict *qdict)
1033
}
1034
object_unref(dev);
1035
out:
1037
- hmp_handle_error(mon, err);
1036
+ hmp_handle_error(hmp, err);
1037
}
1038
1039
void hmp_device_del(MonitorHMP *hmp, const QDict *qdict)
1040
{
1042
- Monitor *mon = MONITOR(hmp);
1041
const char *id = qdict_get_str(qdict, "id");
1042
Error *err = NULL;
1043
1044
qmp_device_del(id, &err);
1047
- hmp_handle_error(mon, err);
1045
+ hmp_handle_error(hmp, err);
1046
}
1047
1048
void device_add_completion(ReadLineState *rs, int nb_args, const char *str)
system/runstate-hmp-cmds.c
+1
-2
@@ -70,7 +70,6 @@ void hmp_one_insn_per_tb(MonitorHMP *hmp, const QDict *qdict)
70
71
void hmp_watchdog_action(MonitorHMP *hmp, const QDict *qdict)
72
{
73
- Monitor *mon = MONITOR(hmp);
73
Error *err = NULL;
74
WatchdogAction action;
75
char *qapi_value;
@@ -79,7 +78,7 @@ void hmp_watchdog_action(MonitorHMP *hmp, const QDict *qdict)
78
action = qapi_enum_parse(&WatchdogAction_lookup, qapi_value, -1, &err);
79
g_free(qapi_value);
80
if (err) {
82
- hmp_handle_error(mon, err);
81
+ hmp_handle_error(hmp, err);
82
return;
83
}
84
qmp_watchdog_set_action(action, &error_abort);
target/i386/monitor.c
+1
-2
@@ -573,7 +573,6 @@ void hmp_info_mem(MonitorHMP *hmp, const QDict *qdict)
573
574
void hmp_mce(MonitorHMP *hmp, const QDict *qdict)
575
{
576
- Monitor *mon = MONITOR(hmp);
576
X86CPU *cpu;
577
CPUState *cs;
578
int cpu_index = qdict_get_int(qdict, "cpu_index");
@@ -596,5 +595,5 @@ void hmp_mce(MonitorHMP *hmp, const QDict *qdict)
595
} else {
596
error_setg(&err, "Invalid CPU %d", cpu_index);
597
}
599
- hmp_handle_error(mon, err);
598
+ hmp_handle_error(hmp, err);
599
}
ui/ui-hmp-cmds.c
+7
-12
@@ -73,11 +73,10 @@ void hmp_mouse_button(MonitorHMP *hmp, const QDict *qdict)
73
74
void hmp_mouse_set(MonitorHMP *hmp, const QDict *qdict)
75
{
76
- Monitor *mon = MONITOR(hmp);
76
Error *err = NULL;
77
78
qemu_mouse_set(qdict_get_int(qdict, "index"), &err);
80
- hmp_handle_error(mon, err);
79
+ hmp_handle_error(hmp, err);
80
}
81
82
void hmp_info_mice(MonitorHMP *hmp, const QDict *qdict)
@@ -158,7 +157,7 @@ void hmp_info_vnc(MonitorHMP *hmp, const QDict *qdict)
157
158
info2l = qmp_query_vnc_servers(&err);
159
info2l_head = info2l;
161
- if (hmp_handle_error(mon, err)) {
160
+ if (hmp_handle_error(hmp, err)) {
161
return;
162
}
163
if (!info2l) {
@@ -266,7 +265,6 @@ out:
265
266
void hmp_set_password(MonitorHMP *hmp, const QDict *qdict)
267
{
269
- Monitor *mon = MONITOR(hmp);
268
const char *protocol = qdict_get_str(qdict, "protocol");
269
const char *password = qdict_get_str(qdict, "password");
270
const char *display = qdict_get_try_str(qdict, "display");
@@ -297,12 +295,11 @@ void hmp_set_password(MonitorHMP *hmp, const QDict *qdict)
295
qmp_set_password(&opts, &err);
296
297
out:
300
- hmp_handle_error(mon, err);
298
+ hmp_handle_error(hmp, err);
299
}
300
301
void hmp_expire_password(MonitorHMP *hmp, const QDict *qdict)
302
{
305
- Monitor *mon = MONITOR(hmp);
303
const char *protocol = qdict_get_str(qdict, "protocol");
304
const char *whenstr = qdict_get_str(qdict, "time");
305
const char *display = qdict_get_try_str(qdict, "display");
@@ -325,7 +322,7 @@ void hmp_expire_password(MonitorHMP *hmp, const QDict *qdict)
322
qmp_expire_password(&opts, &err);
323
324
out:
328
- hmp_handle_error(mon, err);
325
+ hmp_handle_error(hmp, err);
326
}
327
328
#ifdef CONFIG_VNC
@@ -427,7 +424,7 @@ void hmp_sendkey(MonitorHMP *hmp, const QDict *qdict)
424
}
425
426
qmp_send_key(head, has_hold_time, hold_time, &err);
430
- hmp_handle_error(mon, err);
427
+ hmp_handle_error(hmp, err);
428
429
out:
430
qapi_free_KeyValue(v);
@@ -465,7 +462,6 @@ void sendkey_completion(ReadLineState *rs, int nb_args, const char *str)
462
void coroutine_fn
463
hmp_screendump(MonitorHMP *hmp, const QDict *qdict)
464
{
468
- Monitor *mon = MONITOR(hmp);
465
const char *filename = qdict_get_str(qdict, "filename");
466
const char *id = qdict_get_try_str(qdict, "device");
467
int64_t head = qdict_get_try_int(qdict, "head", 0);
@@ -482,13 +478,12 @@ hmp_screendump(MonitorHMP *hmp, const QDict *qdict)
478
qmp_screendump(filename, id, id != NULL, head,
479
input_format != NULL, format, &err);
480
end:
485
- hmp_handle_error(mon, err);
481
+ hmp_handle_error(hmp, err);
482
}
483
#endif
484
485
void hmp_client_migrate_info(MonitorHMP *hmp, const QDict *qdict)
486
{
491
- Monitor *mon = MONITOR(hmp);
487
Error *err = NULL;
488
const char *protocol = qdict_get_str(qdict, "protocol");
489
const char *hostname = qdict_get_str(qdict, "hostname");
@@ -501,5 +496,5 @@ void hmp_client_migrate_info(MonitorHMP *hmp, const QDict *qdict)
496
qmp_client_migrate_info(protocol, hostname,
497
has_port, port, has_tls_port, tls_port,
498
cert_subject, &err);
504
- hmp_handle_error(mon, err);
499
+ hmp_handle_error(hmp, err);
500
}