monitor: Reduce headers included in 'monitor/monitor.h'
Subsystems (2)
v3 cover monitor: Reduce headers included in 'monitor/monitor.h'
Missing review: 2, 11, 17+
Since v2:
- Fixed net/vhost-vdpa (new patch)
- Use QOM-cast macros (bonus)
Since v1:
- extract QMP inject_nmi/memsave/pmemsave out of cpus.c (first 12 patches left unchanged).
Another HMP cleanup series to help Marc-André with his 'Make HMP optional' series [*].
We could also remove "exec/hwaddr.h" by moving gpa2hva() declaration elsewhere, and "qapi/qapi-types-misc.h" by moving monitor_fdset_add_fd() out to some "monitor/fdset.h" header.
[*] [email protected]
Based-on: <[email protected]>
Philippe Mathieu-Daudé (23):
hexagon: Remove unnecessary 'monitor/monitor.h' header net/vhost-vdpa: Include missing 'qemu/iov.h' header tests/unit: Include 'qemu/main-loop.h' header in test-util-sockets.c qapi/qmp-dispatch: Include 'qemu/aio-wait.h' and 'monitor/monitor.h' qapi/qmp-registry: Remove unnecessary 'monitor/monitor.h' header migration/hmp-cmds: Include 'block/block-global-state.h' header
monitor: Include missing 'qemu/aio-wait.h' header
monitor: Include missing 'qemu/lockable.h' header
monitor: Include missing 'qemu/coroutine-core.h' header
monitor: Reduce inclusion of 'qapi/qapi-emit-events.h' header
monitor: Remove unnecessary 'block/block.h' header
system: Remove unnecessary 'monitor/monitor.h' header system/dirtylimit: Extract HMP code to dirtylimit-hmp-cmds.c
system: Move qmp_inject_nmi() to hw/core/machine-qmp-cmds.c
system: Extract QMP memsave/pmemsave commands to physmem-qmp-cmds.c
system: Move runstate-related code from cpus.c to runstate.c
monitor: Rename MonitorQMP @mon -> @qmon
monitor: Rename MonitorHMP @mon -> @hmon
monitor: Better express monitor_read()'s opaque arg is of Monitor type
monitor: Use QOM MONITOR() macro to access MonitorQMP->parent_obj
monitor: Use QOM MONITOR() macro to access MonitorHMP->parent_obj
monitor: Replace container_of(MonitorHMP, parent_obj) -> MONITOR_HMP() monitor/hmp: Remove unnecessary 'monitor/monitor.h' header
MAINTAINERS | 2 + include/hw/hexagon/hexagon_tlb.h | 2 +- include/monitor/hmp.h | 1 - include/monitor/monitor.h | 7 +- include/qapi/qmp-registry.h | 1 - monitor/monitor-internal.h | 7 +- target/hexagon/hex_mmu.h | 3 +- hw/core/machine-qmp-cmds.c | 6 + migration/migration-hmp-cmds.c | 5 +- monitor/fds.c | 1 + monitor/hmp-cmds.c | 10 +- monitor/hmp.c | 164 ++++++++++--------- monitor/monitor.c | 2 + monitor/qmp-cmds-control.c | 18 +-- monitor/qmp-cmds.c | 13 +- monitor/qmp.c | 270 ++++++++++++++++--------------- net/vhost-vdpa.c | 1 + qapi/qmp-dispatch.c | 2 + system/cpus.c | 247 ---------------------------- system/device_tree.c | 1 - system/dirtylimit-hmp-cmds.c | 74 +++++++++ system/dirtylimit.c | 60 ------- system/physmem-qmp-cmds.c | 107 ++++++++++++ system/physmem.c | 2 - system/runstate.c | 154 ++++++++++++++++++ tests/unit/test-util-sockets.c | 1 + ui/ui-hmp-cmds.c | 6 +- system/meson.build | 2 + 28 files changed, 617 insertions(+), 552 deletions(-) create mode 100644 system/dirtylimit-hmp-cmds.c create mode 100644 system/physmem-qmp-cmds.c
Signature · 1 line
2.53.0
PATCH v3 1/23 hexagon: Remove unnecessary 'monitor/monitor.h' header
The Monitor type is used in these 2 files, as a pointer. Since the type is forward-declared in "qemu/typedefs.h", which all source files include via "qemu/osdep.h", we do not need to include it.
Do however include "exec/hwaddr.h" and "exec/mmu-access-type.h" which declare the types used by hex_tlb_find_match prototype:
extern bool hex_tlb_find_match(CPUHexagonState *env, uint32_t VA,
MMUAccessType access_type, hwaddr *PA, int *prot,
^^^^^^^^^^^^^ ^^^^^^
uint64_t *size, int32_t *excp, int mmu_idx);--- include/hw/hexagon/hexagon_tlb.h | 2 +- target/hexagon/hex_mmu.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
include/hw/hexagon/hexagon_tlb.h +1 -1
@@ -12,7 +12,7 @@#include "qom/object.h" #include "exec/hwaddr.h" #include "exec/mmu-access-type.h" -#include "monitor/monitor.h" +#define TYPE_HEXAGON_TLB "hexagon-tlb"OBJECT_DECLARE_SIMPLE_TYPE (HexagonTLBState,HEXAGON_TLB )
target/hexagon/hex_mmu.h +2 -1
@@ -7,8 +7,9 @@#ifndef HEXAGON_MMU_H #define HEXAGON_MMU_H +#include "exec/hwaddr.h" +#include "exec/mmu-access-type.h" #include "cpu.h" -#include "monitor/monitor.h" extern void hex_tlbw (CPUHexagonState *env,uint32_t index,uint64_t value);extern uint32_t hex_tlb_lookup (CPUHexagonState *env,uint32_t ssr,uint32_t VA );
Signature · 1 line
2.53.0
PATCH v3 2/23 net/vhost-vdpa: Include missing 'qemu/iov.h' header
In reply to Philippe Mathieu-Daudévhost-vdpa.c uses methods declared in the "qemu/iov." header. Include it otherwise we get when refactoring unrelated headers:
../net/vhost-vdpa.c: In function ‘vhost_vdpa_net_load_cmd’:
../net/vhost-vdpa.c:714:24: error: implicit declaration of function ‘iov_size’
714 | size_t data_size = iov_size(data_sg, data_num), cmd_size;
| ^~~~~~~~
../net/vhost-vdpa.c:714:24: error: nested extern declaration of ‘iov_size’
../net/vhost-vdpa.c:742:5: error: implicit declaration of function ‘iov_from_buf’
742 | iov_from_buf(out_cursor, 1, 0, &ctrl, sizeof(ctrl));
| ^~~~~~~~~~~~
../net/vhost-vdpa.c:742:5: error: nested extern declaration of ‘iov_from_buf’
../net/vhost-vdpa.c:744:5: error: implicit declaration of function ‘iov_to_buf’
744 | iov_to_buf(data_sg, data_num, 0,
| ^~~~~~~~~~
../net/vhost-vdpa.c:744:5: error: nested extern declaration of ‘iov_to_buf’
../net/vhost-vdpa.c:748:5: error: implicit declaration of function ‘iov_copy’
748 | iov_copy(&out, 1, out_cursor, 1, 0, cmd_size);
| ^~~~~~~~--- net/vhost-vdpa.c | 1 + 1 file changed, 1 insertion(+)
net/vhost-vdpa.c +1 -0
@@ -17,6 +17,7 @@#include "hw/virtio/vhost-vdpa.h" #include "qemu/config-file.h" #include "qemu/error-report.h" +#include "qemu/iov.h" #include "qemu/log.h" #include "qemu/memalign.h" #include "qemu/option.h"
Signature · 1 line
2.53.0
Re: [PATCH v3 02/23] net/vhost-vdpa: Include missing 'qemu/iov.h' header
Quoted 20 lines · Philippe Mathieu-Daudé
vhost-vdpa.cuses methods declared in the "qemu/iov." header. Include it otherwise we get when refactoring unrelated headers:
../net/vhost-vdpa.c: In function ‘vhost_vdpa_net_load_cmd’:
../net/vhost-vdpa.c:714:24: error: implicit declaration of function ‘iov_size’714 | size_t data_size = iov_size(data_sg, data_num), cmd_size; | ^~~~~~~~ ../net/vhost-vdpa.c:714:24: error: nested extern declaration of ‘iov_size’ ../net/vhost-vdpa.c:742:5: error: implicit declaration of function ‘iov_from_buf’ 742 | iov_from_buf(out_cursor, 1, 0, &ctrl, sizeof(ctrl)); | ^~~~~~~~~~~~ ../net/vhost-vdpa.c:742:5: error: nested extern declaration of ‘iov_from_buf’ ../net/vhost-vdpa.c:744:5: error: implicit declaration of function ‘iov_to_buf’ 744 | iov_to_buf(data_sg, data_num, 0, | ^~~~~~~~~~ ../net/vhost-vdpa.c:744:5: error: nested extern declaration of ‘iov_to_buf’ ../net/vhost-vdpa.c:748:5: error: implicit declaration of function ‘iov_copy’ 748 | iov_copy(&out, 1, out_cursor, 1, 0, cmd_size); | ^~~~~~~~
Quoted 2 lines
Fixes bd907ae4b00 ("vdpa: manual forward CVQ buffers")Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 18 lines
--- net/vhost-vdpa.c | 1 + 1 file changed, 1 insertion(+)net/vhost-vdpa.c +1
-0@@ -17,6 +17,7 @@#include "hw/virtio/vhost-vdpa.h" #include "qemu/config-file.h" #include "qemu/error-report.h" +#include "qemu/iov.h" #include "qemu/log.h" #include "qemu/memalign.h" #include "qemu/option.h" Signature · 1 line
2.53.0
Re: [PATCH v3 02/23] net/vhost-vdpa: Include missing 'qemu/iov.h' header
In reply to Philippe Mathieu-DaudéQuoted 20 lines · Philippe Mathieu-Daudé
vhost-vdpa.cuses methods declared in the "qemu/iov." header. Include it otherwise we get when refactoring unrelated headers:
../net/vhost-vdpa.c: In function ‘vhost_vdpa_net_load_cmd’:
../net/vhost-vdpa.c:714:24: error: implicit declaration of function ‘iov_size’714 | size_t data_size = iov_size(data_sg, data_num), cmd_size; | ^~~~~~~~ ../net/vhost-vdpa.c:714:24: error: nested extern declaration of ‘iov_size’ ../net/vhost-vdpa.c:742:5: error: implicit declaration of function ‘iov_from_buf’ 742 | iov_from_buf(out_cursor, 1, 0, &ctrl, sizeof(ctrl)); | ^~~~~~~~~~~~ ../net/vhost-vdpa.c:742:5: error: nested extern declaration of ‘iov_from_buf’ ../net/vhost-vdpa.c:744:5: error: implicit declaration of function ‘iov_to_buf’ 744 | iov_to_buf(data_sg, data_num, 0, | ^~~~~~~~~~ ../net/vhost-vdpa.c:744:5: error: nested extern declaration of ‘iov_to_buf’ ../net/vhost-vdpa.c:748:5: error: implicit declaration of function ‘iov_copy’ 748 | iov_copy(&out, 1, out_cursor, 1, 0, cmd_size); | ^~~~~~~~
Quoted 1 line
[...]
Signature · 1 line
Marc-André Lureau <[email protected]>
PATCH v3 3/23 tests/unit: Include 'qemu/main-loop.h' header in test-util-sockets.c
In reply to Philippe Mathieu-Daudétest-util-sockets.c calls qemu_init_main_loop(), itself declared in the "qemu/main-loop.h" header. Include the latter to avoid when refactoring unrelated headers:
../tests/unit/test-util-sockets.c:553:5: error: call to undeclared function 'qemu_init_main_loop'
553 | qemu_init_main_loop(&error_abort);
| ^--- tests/unit/test-util-sockets.c | 1 + 1 file changed, 1 insertion(+)
tests/unit/test-util-sockets.c +1 -0
@@ -19,6 +19,7 @@*/ #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "qemu/sockets.h" #include "qapi/error.h" #include "socket-helpers.h"
Signature · 1 line
2.53.0
PATCH v3 4/23 qapi/qmp-dispatch: Include 'qemu/aio-wait.h' and 'monitor/monitor.h'
In reply to Philippe Mathieu-Daudéqmp-dispatch.c calls aio_wait_kick() and monitor_cur(). Include the header declaring them in order to avoid the following build failure when refactoring unrelated headers:
../qapi/qmp-dispatch.c:126:12: error: call to undeclared function 'monitor_cur'
126 | assert(monitor_cur() == NULL);
| ^
../qapi/qmp-dispatch.c:141:5: error: call to undeclared function 'aio_wait_kick'
141 | aio_wait_kick();
| ^--- qapi/qmp-dispatch.c | 2 ++ 1 file changed, 2 insertions(+)
qapi/qmp-dispatch.c +2 -0
@@ -14,6 +14,7 @@#include "qemu/osdep.h" #include "qemu/aio.h" +#include "qemu/aio-wait.h" #include "qapi/compat-policy.h" #include "qapi/error.h" #include "qapi/qmp-registry.h"
@@ -24,6 +25,7 @@#include "qobject/qbool.h" #include "qemu/coroutine.h" #include "qemu/main-loop.h" +#include "monitor/monitor.h" Visitor *qobject_input_visitor_new_qmp (QObject *obj) {
Signature · 1 line
2.53.0
PATCH v3 5/23 qapi/qmp-registry: Remove unnecessary 'monitor/monitor.h' header
In reply to Philippe Mathieu-Daudé--- include/qapi/qmp-registry.h | 1 - 1 file changed, 1 deletion(-)
include/qapi/qmp-registry.h +0 -1
@@ -14,7 +14,6 @@#ifndef QAPI_QMP_DISPATCH_H #define QAPI_QMP_DISPATCH_H -#include "monitor/monitor.h" #include "qemu/queue.h" typedef void (QmpCommandFunc )(QDict *,QObject **,Error **);
Signature · 1 line
2.53.0
PATCH v3 6/23 migration/hmp-cmds: Include 'block/block-global-state.h' header
In reply to Philippe Mathieu-Daudémigration-hmp-cmds.c uses types / methods declared in "block/block-global-state.h". Include the latter otherwise we get when refactoring unrelated headers:
../migration/migration-hmp-cmds.c:911:5: error: use of undeclared identifier 'BdrvNextIterator'
911 | BdrvNextIterator it;
| ^
../migration/migration-hmp-cmds.c:918:15: error: call to undeclared function 'bdrv_first'
918 | for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
| ^--- migration/migration-hmp-cmds.c | 1 + 1 file changed, 1 insertion(+)
migration/migration-hmp-cmds.c +1 -0
@@ -15,6 +15,7 @@#include "qemu/osdep.h" #include "block/qapi.h" +#include "block/block-global-state.h" #include "migration/snapshot.h" #include "monitor/hmp.h" #include "monitor/hmp-completion.h"
Signature · 1 line
2.53.0
Re: [PATCH v3 06/23] migration/hmp-cmds: Include 'block/block-global-state.h' header
Quoted 5 lines · * Philippe Mathieu-Daudé ([email protected]) wrote:
migration-hmp-cmds.cuses types / methods declared in "block/block-global-state.h". Include the latter otherwise we get when refactoring unrelated headers:
../migration/migration-hmp-cmds.c:911:5: error: use of undeclared identifier 'BdrvNextIterator'
Quoted 8 lines
911 | BdrvNextIterator it; | ^ ../migration/migration-hmp-cmds.c:918:15: error: call to undeclared function 'bdrv_first' 918 | for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) { | ^Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Marc-André Lureau <[email protected]>
Quoted 19 lines
--- migration/migration-hmp-cmds.c | 1 + 1 file changed, 1 insertion(+)migration/migration-hmp-cmds.c +1
-0@@ -15,6 +15,7 @@#include "qemu/osdep.h" #include "block/qapi.h" +#include "block/block-global-state.h" #include "migration/snapshot.h" #include "monitor/hmp.h" #include "monitor/hmp-completion.h" Signature · 1 line
2.53.0
Signature · 4 lines
-----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ dave @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/
PATCH v3 7/23 monitor: Include missing 'qemu/aio-wait.h' header
In reply to Philippe Mathieu-DaudéBoth monitor.c and qmp.c use types / methods declared in "qemu/aio-wait.h". Include the latter to avoid the following errors when refactoring unrelated headers:
../monitor/monitor.c:648:5: error: call to undeclared function 'AIO_WAIT_WHILE_UNLOCKED'
648 | AIO_WAIT_WHILE_UNLOCKED(NULL,
| ^
../monitor/qmp.c:792:9: error: call to undeclared function 'aio_wait_bh_oneshot'
792 | aio_wait_bh_oneshot(iothread_get_aio_context(mon_iothread),
| ^--- monitor/monitor.c | 1 + monitor/qmp.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
monitor/monitor.c +1 -0
@@ -30,6 +30,7 @@#include "qapi/qapi-visit-control.h" #include "qobject/qdict.h" #include "qom/object_interfaces.h" +#include "qemu/aio-wait.h" #include "qemu/error-report.h" #include "qemu/option.h" #include "system/qtest.h"
monitor/qmp.c +1 -1
@@ -23,7 +23,7 @@*/ #include "qemu/osdep.h" - +#include "qemu/aio-wait.h" #include "chardev/char-io.h" #include "monitor-internal.h" #include "qapi/error.h"
Signature · 1 line
2.53.0
PATCH v3 8/23 monitor: Include missing 'qemu/lockable.h' header
In reply to Philippe Mathieu-DaudéFiles in monitor/ use the QEMU_LOCK_GUARD() macros, which are declared in "qemu/lockable.h". Include the latter to avoid when refactoring unrelated headers:
../monitor/fds.c:146:5: error: call to undeclared function 'QEMU_LOCK_GUARD'
146 | QEMU_LOCK_GUARD(&mon->mon_lock);
| ^
../monitor/monitor.c:176:5: error: call to undeclared function 'QEMU_LOCK_GUARD'
176 | QEMU_LOCK_GUARD(&mon->mon_lock);
| ^
../monitor/qmp.c:164:5: error: call to undeclared function 'WITH_QEMU_LOCK_GUARD'
164 | WITH_QEMU_LOCK_GUARD(&mon->mon_lock) {
| ^--- monitor/fds.c | 1 + monitor/monitor.c | 1 + monitor/qmp.c | 1 + 3 files changed, 3 insertions(+)
monitor/fds.c +1 -0
@@ -29,6 +29,7 @@#include "qapi/qmp/qerror.h" #include "qemu/ctype.h" #include "qemu/cutils.h" +#include "qemu/lockable.h" #include "system/runstate.h" /* file descriptors passed via SCM_RIGHTS */
monitor/monitor.c +1 -0
@@ -32,6 +32,7 @@#include "qom/object_interfaces.h" #include "qemu/aio-wait.h" #include "qemu/error-report.h" +#include "qemu/lockable.h" #include "qemu/option.h" #include "system/qtest.h" #include "trace.h"
monitor/qmp.c +1 -0
@@ -24,6 +24,7 @@#include "qemu/osdep.h" #include "qemu/aio-wait.h" +#include "qemu/lockable.h" #include "chardev/char-io.h" #include "monitor-internal.h" #include "qapi/error.h"
Signature · 1 line
2.53.0
PATCH v3 9/23 monitor: Include missing 'qemu/coroutine-core.h' header
In reply to Philippe Mathieu-Daudé"monitor/monitor.h" declares monitor_set_cur() which use the 'Coroutine' type, itself declared in "qemu/coroutine-core.h". Include the latter to avoid when refactoring unrelated headers:
In file included from ../../target/sh4/monitor.c:26:
qemu/include/monitor/monitor.h:32:26: error: unknown type name 'Coroutine'
32 | Monitor *monitor_set_cur(Coroutine *co, Monitor *mon);
| ^--- include/monitor/monitor.h | 1 + 1 file changed, 1 insertion(+)
include/monitor/monitor.h +1 -0
@@ -4,6 +4,7 @@#include "block/block.h" #include "qapi/qapi-types-misc.h" #include "qapi/qapi-emit-events.h" +#include "qemu/coroutine-core.h" #include "qemu/readline.h" #include "exec/hwaddr.h" #include "qom/object.h"
Signature · 1 line
2.53.0
PATCH v3 10/23 monitor: Reduce inclusion of 'qapi/qapi-emit-events.h' header
In reply to Philippe Mathieu-Daudé"monitor/monitor.h" don't use anything declared in the generated "qapi/qapi-emit-events.h" header.
However the "monitor/monitor-internal.h" do:
107 struct MonitorClass {
...
116 /*
117 * If non-NULL, the monitor is able to send event
118 * notifications back to the client
119 */
120 void (*emit_event)(Monitor *mon, QAPIEvent event, QDict *qdict);
^^^^^^^^^Move the header inclusion to "monitor/monitor-internal.h" to avoid including / re-exposing unnecessary declarations in the global "monitor/monitor.h" header.
--- include/monitor/monitor.h | 1 - monitor/monitor-internal.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
include/monitor/monitor.h +0 -1
@@ -3,7 +3,6 @@#include "block/block.h" #include "qapi/qapi-types-misc.h" -#include "qapi/qapi-emit-events.h" #include "qemu/coroutine-core.h" #include "qemu/readline.h" #include "exec/hwaddr.h"
monitor/monitor-internal.h +1 -0
@@ -27,6 +27,7 @@#include "chardev/char-fe.h" #include "monitor/monitor.h" +#include "qapi/qapi-emit-events.h" #include "qapi/qapi-types-control.h" #include "qapi/qapi-types-qom.h" #include "qapi/qmp-registry.h"
Signature · 1 line
2.53.0
PATCH v3 11/23 monitor: Remove unnecessary 'block/block.h' header
In reply to Philippe Mathieu-DaudéNothing here requires declarations from "block/block.h" anymore.
--- include/monitor/monitor.h | 1 - 1 file changed, 1 deletion(-)
include/monitor/monitor.h +0 -1
@@ -1,7 +1,6 @@#ifndef MONITOR_H #define MONITOR_H -#include "block/block.h" #include "qapi/qapi-types-misc.h" #include "qemu/coroutine-core.h" #include "qemu/readline.h"
Signature · 1 line
2.53.0
Re: [PATCH v3 11/23] monitor: Remove unnecessary 'block/block.h' header
Quoted 1 line · Philippe Mathieu-Daudé
Nothing here requires declarations from "
block/block.h" anymore.
Signature · 1 line
Marc-André Lureau <[email protected]>
PATCH v3 12/23 system: Remove unnecessary 'monitor/monitor.h' header
In reply to Philippe Mathieu-DaudéNo code in device_tree.c or physmem.c require declarations from "monitor/monitor.h".
--- system/device_tree.c | 1 - system/physmem.c | 2 -- 2 files changed, 3 deletions(-)
system/device_tree.c +0 -1
@@ -29,7 +29,6 @@#include "qemu/config-file.h" #include "qapi/qapi-commands-machine.h" #include "qobject/qdict.h" -#include "monitor/hmp.h" #include <libfdt.h>
system/physmem.c +0 -2
@@ -84,8 +84,6 @@#include "qemu/mmap-alloc.h" #endif -#include "monitor/monitor.h" -#ifdef CONFIG_LIBDAXCTL #include <daxctl/libdaxctl.h> #endif
Signature · 1 line
2.53.0
PATCH v3 13/23 system/dirtylimit: Extract HMP code to dirtylimit-hmp-cmds.c
In reply to Philippe Mathieu-Daudé--- MAINTAINERS | 1 + system/dirtylimit-hmp-cmds.c | 74 ++++++++++++++++++++++++++++++++++++ system/dirtylimit.c | 60 ----------------------------- system/meson.build | 1 + 4 files changed, 76 insertions(+), 60 deletions(-) create mode 100644 system/dirtylimit-hmp-cmds.c
MAINTAINERS +1 -0
@@ -3858,6 +3858,7 @@ Migration dirty limit and dirty page rate M: Hyman Huang <[email protected]> S: Maintained F: system/dirtylimit.c +F: system/dirtylimit-hmp-cmds.c F: include/system/dirtylimit.h F: migration/dirtyrate.c F: migration/dirtyrate.h
system/dirtylimit-hmp-cmds.c new file +74 -0
74 lines not on this page · raw message
system/dirtylimit.c +0 -60
81 lines not on this page · raw message
system/meson.build +1 -0
@@ -9,6 +9,7 @@ system_ss.add(files( 'cpus.c', 'cpu-timers.c', 'dirtylimit.c', + 'dirtylimit-hmp-cmds.c', 'dma-helpers.c', 'exit-with-parent.c', 'globals.c',
Signature · 1 line
2.53.0
Re: [PATCH v3 13/23] system/dirtylimit: Extract HMP code to dirtylimit-hmp-cmds.c
Quoted 207 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Marc-André Lureau <[email protected]>--- MAINTAINERS | 1 + system/dirtylimit-hmp-cmds.c | 74 ++++++++++++++++++++++++++++++++++++ system/dirtylimit.c | 60 ----------------------------- system/meson.build | 1 + 4 files changed, 76 insertions(+), 60 deletions(-) create mode 100644 system/dirtylimit-hmp-cmds.cMAINTAINERS +1
-0@@ -3858,6 +3858,7 @@ Migration dirty limit and dirty page rate M: Hyman Huang <[email protected]> S: Maintained F: system/dirtylimit.c +F: system/dirtylimit-hmp-cmds.c F: include/system/dirtylimit.h F: migration/dirtyrate.c F: migration/dirtyrate.hsystem/dirtylimit-hmp-cmds.c new file +74
-0@@ -0,0 +1,74 @@ +/* +* HMP commands related to migration dirty page rate limit +* +* Copyright (c) 2022 CHINA TELECOM CO.,LTD. +* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-migration.h" +#include "qobject/qdict.h" +#include "monitor/hmp.h" +#include "monitor/monitor.h" +#include "system/dirtylimit.h" + +void hmp_cancel_vcpu_dirty_limit (Monitor *mon,const QDict *qdict) +{ +int64_t cpu_index =qdict_get_try_int (qdict,"cpu_index" ,-1 ); +Error *err =NULL ; + +qmp_cancel_vcpu_dirty_limit (!!(cpu_index !=-1 ), cpu_index, &err); +if (err) { +hmp_handle_error (mon, err); +return ; + } + +monitor_printf (mon,"[Please use 'info vcpu_dirty_limit' to query " +"dirty limit for virtual CPU]\n" ); +} + +void hmp_set_vcpu_dirty_limit (Monitor *mon,const QDict *qdict) +{ +int64_t dirty_rate =qdict_get_int (qdict,"dirty_rate" ); +int64_t cpu_index =qdict_get_try_int (qdict,"cpu_index" ,-1 ); +Error *err =NULL ; + +if (dirty_rate <0 ) { +error_setg (&err,"invalid dirty page limit %" PRId64, dirty_rate); + goto out; + } + +qmp_set_vcpu_dirty_limit (!!(cpu_index !=-1 ), cpu_index, dirty_rate, &err); + +out: +hmp_handle_error (mon, err); +} + +void hmp_info_vcpu_dirty_limit (Monitor *mon,const QDict *qdict) +{ +DirtyLimitInfoList *info; +g_autoptr (DirtyLimitInfoList) head =NULL ; +Error *err =NULL ; + +if (!dirtylimit_in_service ()) { +monitor_printf (mon,"Dirty page limit not enabled!\n" ); +return ; + } + + head =qmp_query_vcpu_dirty_limit (&err); +if (err) { +hmp_handle_error (mon, err); +return ; + } + +for (info = head; info !=NULL ; info = info->next) { +monitor_printf (mon,"vcpu[%" PRIi64"], limit rate %" PRIi64" (MB/s)," +" current rate %" PRIi64" (MB/s)\n" , + info->value->cpu_index, + info->value->limit_rate, + info->value->current_rate); + } +}system/dirtylimit.c +0
-60@@ -17,8 +17,6 @@#include "qapi/error.h" #include "system/dirtyrate.h" #include "system/dirtylimit.h" -#include "monitor/hmp.h" -#include "monitor/monitor.h" #include "system/memory.h" #include "exec/target_page.h" #include "hw/core/boards.h" @@ -491,21 +489,6 @@ void qmp_cancel_vcpu_dirty_limit(bool has_cpu_index,dirtylimit_state_unlock (); } -void hmp_cancel_vcpu_dirty_limit (Monitor *mon,const QDict *qdict) -{ -int64_t cpu_index =qdict_get_try_int (qdict,"cpu_index" ,-1 ); -Error *err =NULL ; - -qmp_cancel_vcpu_dirty_limit (!!(cpu_index !=-1 ), cpu_index, &err); -if (err) { -hmp_handle_error (mon, err); -return ; - } - -monitor_printf (mon,"[Please use 'info vcpu_dirty_limit' to query " -"dirty limit for virtual CPU]\n" ); -} - void qmp_set_vcpu_dirty_limit(bool has_cpu_index, int64_t cpu_index, uint64_t dirty_rate,@@ -548,23 +531,6 @@ void qmp_set_vcpu_dirty_limit(bool has_cpu_index,dirtylimit_state_unlock (); } -void hmp_set_vcpu_dirty_limit (Monitor *mon,const QDict *qdict) -{ -int64_t dirty_rate =qdict_get_int (qdict,"dirty_rate" ); -int64_t cpu_index =qdict_get_try_int (qdict,"cpu_index" ,-1 ); -Error *err =NULL ; - -if (dirty_rate <0 ) { -error_setg (&err,"invalid dirty page limit %" PRId64, dirty_rate); - goto out; - } - -qmp_set_vcpu_dirty_limit (!!(cpu_index !=-1 ), cpu_index, dirty_rate, &err); - -out: -hmp_handle_error (mon, err); -} -/* Return the max throttle time of each virtual CPU */ uint64_t dirtylimit_throttle_time_per_round (void ) {@@ -646,29 +612,3 @@ struct DirtyLimitInfoList *qmp_query_vcpu_dirty_limit(Error **errp) {return dirtylimit_query_all (); } - -void hmp_info_vcpu_dirty_limit (Monitor *mon,const QDict *qdict) -{ -DirtyLimitInfoList *info; -g_autoptr (DirtyLimitInfoList) head =NULL ; -Error *err =NULL ; - -if (!dirtylimit_in_service ()) { -monitor_printf (mon,"Dirty page limit not enabled!\n" ); -return ; - } - - head =qmp_query_vcpu_dirty_limit (&err); -if (err) { -hmp_handle_error (mon, err); -return ; - } - -for (info = head; info !=NULL ; info = info->next) { -monitor_printf (mon,"vcpu[%" PRIi64"], limit rate %" PRIi64" (MB/s)," -" current rate %" PRIi64" (MB/s)\n" , - info->value->cpu_index, - info->value->limit_rate, - info->value->current_rate); - } -}system/meson.build +1
-1@@ -9,6 +9,7 @@ system_ss.add(files( 'cpus.c', 'cpu-timers.c', 'dirtylimit.c', + 'dirtylimit-hmp-cmds.c', 'dma-helpers.c', 'exit-with-parent.c', 'globals.c', --2.53.0
PATCH v3 14/23 system: Move qmp_inject_nmi() to hw/core/machine-qmp-cmds.c
In reply to Philippe Mathieu-DaudéWe figured NMI relates to machines (for their machine-specific handling), so move the 'inject-nmi' QMP handler with the rest of machine ones, in hw/core/machine-qmp-cmds.c.
--- hw/core/machine-qmp-cmds.c | 6 ++++++ system/cpus.c | 8 -------- 2 files changed, 6 insertions(+), 8 deletions(-)
hw/core/machine-qmp-cmds.c +6 -0
@@ -10,6 +10,7 @@#include "qemu/osdep.h" #include "hw/acpi/vmgenid.h" #include "hw/core/boards.h" +#include "hw/core/nmi.h" #include "hw/intc/intc.h" #include "hw/mem/memory-device.h" #include "qapi/error.h"
@@ -448,3 +449,8 @@ void qmp_dump_skeys(const char *filename, Error **errp) }DUMP_SKEYS_INTERFACE_CLASS (oc)->qmp_dump_skeys (filename, errp); } + +void qmp_inject_nmi (Error **errp) +{ +nmi_inject (errp); +}
system/cpus.c +0 -8
@@ -26,7 +26,6 @@#include "qemu/coroutine-tls.h" #include "qapi/error.h" #include "qapi/qapi-commands-machine.h" -#include "qapi/qapi-commands-misc.h" #include "qapi/qapi-events-run-state.h" #include "qapi/qmp/qerror.h" #include "exec/gdbstub.h"
@@ -38,7 +37,6 @@#include "qemu/plugin.h" #include "system/cpus.h" #include "qemu/guest-random.h" -#include "hw/core/nmi.h" #include "system/physmem.h" #include "system/replay.h" #include "system/runstate.h"
@@ -922,9 +920,3 @@ void qmp_pmemsave(uint64_t addr, uint64_t size, const char *filename, exit:fclose (f); } - -void qmp_inject_nmi (Error **errp) -{ -nmi_inject (errp); -} -
Signature · 1 line
2.53.0
PATCH v3 15/23 system: Extract QMP memsave/pmemsave commands to physmem-qmp-cmds.c
In reply to Philippe Mathieu-DaudéKeep cpus.c related to vCPU scheduling, move the QMP handlers related to dumping physical memory to file to their own unit. Fix a pair of checkpatch.pl errors doing so:
ERROR: braces {} are necessary for all arms of this statement #185: FILE: system/physmem-qmp-cmds.c:51:
+ if (l > size)
[...]
--- MAINTAINERS | 1 + system/cpus.c | 92 -------------------------------- system/physmem-qmp-cmds.c | 107 ++++++++++++++++++++++++++++++++++++++ system/meson.build | 1 + 4 files changed, 109 insertions(+), 92 deletions(-) create mode 100644 system/physmem-qmp-cmds.c
MAINTAINERS +1 -0
@@ -3419,6 +3419,7 @@ F: system/ioport.c F: system/memory.c F: system/memory_mapping.c F: system/physmem.c +F: system/physmem-qmp-cmds.c F: system/memory_ldst* F: system/memory-internal.h F: system/ram-block-attributes.c
system/cpus.c +0 -92
108 lines not on this page · raw message
system/physmem-qmp-cmds.c new file +107 -0
107 lines not on this page · raw message
system/meson.build +1 -0
@@ -19,6 +19,7 @@ system_ss.add(files( 'memory_mapping.c', 'memory.c', 'physmem.c', + 'physmem-qmp-cmds.c', 'qdev-monitor.c', 'qtest.c', 'rtc.c',
Signature · 1 line
2.53.0
PATCH v3 16/23 system: Move runstate-related code from cpus.c to runstate.c
In reply to Philippe Mathieu-DaudéKeep cpus.c focused on vCPUs handling, move code related to VM state to runstate.c where similar code lives.
Fix few checkpatch.pl warnings:
WARNING: Block comments use a leading /* on a separate line
WARNING: Block comments use * on subsequent lines #327: FILE: system/runstate.c:541:
+/* does a state transition even if the VM is already stopped,
+ current state is forgotten forever */
--- system/cpus.c | 147 ------------------------------------------- system/runstate.c | 154 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 154 insertions(+), 147 deletions(-)
system/cpus.c +0 -147
@@ -25,7 +25,6 @@#include "qemu/osdep.h" #include "qemu/coroutine-tls.h" #include "qapi/error.h" -#include "qapi/qapi-events-run-state.h" #include "exec/gdbstub.h" #include "accel/accel-cpu-ops.h" #include "system/hw_accel.h"
@@ -272,58 +271,6 @@ void cpu_interrupt(CPUState *cpu, int mask) cpus_accel->handle_interrupt (cpu, mask); } -/* -* True if the vm was previously suspended, and has not been woken or reset. -*/ -static int vm_was_suspended; - -void vm_set_suspended (bool suspended) -{ - vm_was_suspended = suspended; -} - -bool vm_get_suspended (void ) -{ -return vm_was_suspended; -} - -static int do_vm_stop (RunState state,bool send_stop) -{ -int ret =0 ; -RunState oldstate =runstate_get (); - -if (runstate_is_live (oldstate)) { - vm_was_suspended = (oldstate ==RUN_STATE_SUSPENDED ); -runstate_set (state); -cpu_disable_ticks (); -if (oldstate ==RUN_STATE_RUNNING ) { -pause_all_vcpus (); - } - ret =vm_state_notify (0 , state); -if (send_stop) { -qapi_event_send_stop (); - } - } - -bdrv_drain_all (); -/* -* Even if vm_state_notify() return failure, -* it would be better to flush as before. -*/ - ret |=bdrv_flush_all (); -trace_vm_stop_flush_all (ret); - -return ret; -} - -/* Special vm_stop() variant for terminating the process. Historically clients -* did not expect a QMP STOP event and so we need to retain compatibility. -*/ -int vm_shutdown (void ) -{ -return do_vm_stop (RUN_STATE_SHUTDOWN , false); -} -bool cpu_can_run (CPUState *cpu) {if (cpu->stop) {
@@ -734,97 +681,3 @@ void cpu_stop_current(void)cpu_exit (current_cpu); } } - -int vm_stop (RunState state) -{ -if (qemu_in_vcpu_thread ()) { -qemu_system_vmstop_request_prepare (); -qemu_system_vmstop_request (state); -/* -* FIXME: should not return to device code in case -* vm_stop() has been requested. -*/ -cpu_stop_current (); -return 0 ; - } - -return do_vm_stop (state, true); -} - -/** -* Prepare for (re)starting the VM. -* Returns 0 if the vCPUs should be restarted, -1 on an error condition, -* and 1 otherwise. -*/ -int vm_prepare_start (bool step_pending) -{ -int ret = vm_was_suspended ?1 :0 ; -RunState state = vm_was_suspended ?RUN_STATE_SUSPENDED :RUN_STATE_RUNNING ; -RunState requested; - -qemu_vmstop_requested (&requested); -if (runstate_is_running () && requested ==RUN_STATE__MAX ) { -return -1 ; - } - -/* Ensure that a STOP/RESUME pair of events is emitted if a -* vmstop request was pending. The BLOCK_IO_ERROR event, for -* example, according to documentation is always followed by -* the STOP event. -*/ -if (runstate_is_running ()) { -qapi_event_send_stop (); -qapi_event_send_resume (); -return -1 ; - } - -/* -* WHPX accelerator needs to know whether we are going to step -* any CPUs, before starting the first one. -*/ -accel_pre_resume (MACHINE (qdev_get_machine ()), step_pending); - -/* We are sending this now, but the CPUs will be resumed shortly later */ -qapi_event_send_resume (); - -cpu_enable_ticks (); -runstate_set (state); -vm_state_notify (1 , state); - vm_was_suspended = false; -return ret; -} - -void vm_start (void ) -{ -if (!vm_prepare_start (false)) { -resume_all_vcpus (); - } -} - -void vm_resume (RunState state) -{ -if (runstate_is_live (state)) { -vm_start (); - }else { -runstate_set (state); - } -} - -/* does a state transition even if the VM is already stopped, -current state is forgotten forever */ -int vm_stop_force_state (RunState state) -{ -if (runstate_is_live (runstate_get ())) { -return vm_stop (state); - }else { -int ret; -runstate_set (state); - -bdrv_drain_all (); -/* Make sure to return an error if the flush in a previous vm_stop() -* failed. */ - ret =bdrv_flush_all (); -trace_vm_stop_flush_all (ret); -return ret; - } -}
system/runstate.c +154 -0
166 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v3 17/23 monitor: Rename MonitorQMP @mon -> @qmon
In reply to Philippe Mathieu-DaudéMechanical change to sanitize using the following patterns:
MonitorQMP *qmon (this patch)
MonitorHMP *hmon (following one)
Monitor *mon
Rename @mon (and @qmp_mon) as @qmon when the type is MonitorQMP.
--- monitor/monitor-internal.h | 4 +- monitor/qmp-cmds-control.c | 18 +-- monitor/qmp.c | 256 ++++++++++++++++++------------------- 3 files changed, 139 insertions(+), 139 deletions(-)
monitor/monitor-internal.h +2 -2
@@ -216,8 +216,8 @@ void monitor_list_append(Monitor *mon);void monitor_fdsets_cleanup (void );int monitor_set_cpu (Monitor *mon,int cpu_index); -void qmp_send_response (MonitorQMP *mon,const QDict *rsp); -void monitor_data_destroy_qmp (MonitorQMP *mon); +void qmp_send_response (MonitorQMP *qmon,const QDict *rsp); +void monitor_data_destroy_qmp (MonitorQMP *qmon); void coroutine_fn monitor_qmp_dispatcher_co(void *data);void qmp_dispatcher_co_wake (void );
monitor/qmp-cmds-control.c +9 -9
@@ -39,7 +39,7 @@* On success, set mon->qmp.capab[], and return true. * On error, set @errp, and return false. */ -static bool qmp_caps_accept (MonitorQMP *mon,QMPCapabilityList *list, +static bool qmp_caps_accept (MonitorQMP *qmon,QMPCapabilityList *list,Error **errp) {GString *unavailable =NULL ;
@@ -48,7 +48,7 @@ static bool qmp_caps_accept(MonitorQMP *mon, QMPCapabilityList *list,memset (capab,0 ,sizeof (capab));for (; list; list = list->next) { -if (!mon->capab_offered[list->value]) { +if (!qmon->capab_offered[list->value]) {if (!unavailable) { unavailable =g_string_new (QMPCapability_str (list->value)); }else {
@@ -65,27 +65,27 @@ static bool qmp_caps_accept(MonitorQMP *mon, QMPCapabilityList *list,return false; } -memcpy (mon->capab, capab,sizeof (capab)); +memcpy (qmon->capab, capab,sizeof (capab));return true; }void qmp_qmp_capabilities (bool has_enable,QMPCapabilityList *enable,Error **errp) { -MonitorQMP *mon =MONITOR_QMP (monitor_cur ()); +MonitorQMP *qmon =MONITOR_QMP (monitor_cur ()); -if (mon->commands == &qmp_commands) { +if (qmon->commands == &qmp_commands) {error_set (errp,ERROR_CLASS_COMMAND_NOT_FOUND ,"Capabilities negotiation is already complete, command " "ignored" );return ; } -if (!qmp_caps_accept (mon, enable, errp)) { +if (!qmp_caps_accept (qmon, enable, errp)) {return ; } - mon->commands = &qmp_commands; + qmon->commands = &qmp_commands; }VersionInfo *qmp_query_version (Error **errp)
@@ -118,9 +118,9 @@ static void query_commands_cb(const QmpCommand *cmd, void *opaque)CommandInfoList *qmp_query_commands (Error **errp) {CommandInfoList *list =NULL ; -MonitorQMP *mon =MONITOR_QMP (monitor_cur ()); +MonitorQMP *qmon =MONITOR_QMP (monitor_cur ()); -qmp_for_each_command (mon->commands, query_commands_cb, &list); +qmp_for_each_command (qmon->commands, query_commands_cb, &list);return list; }
monitor/qmp.c +128 -128
612 lines not on this page · raw message
Signature · 1 line
2.53.0
Re: [PATCH v3 17/23] monitor: Rename MonitorQMP @mon -> @qmon
Quoted 7 lines
Mechanical change to sanitize using the following patterns:
MonitorQMP *qmon (this patch)
MonitorHMP *hmon (following one)
Monitor *monRename @mon (and @qmp_mon) as @qmon when the type is MonitorQMP.
This patch and the following are conflicting quite directly with the work I have for --disable-hmp.
(https://gitlab.com/marcandre.lureau/qemu/-/tree/no-hmp)
Can we delay them?
fwiw, I picked Monitor *mon, MonitorHMP *hmp. I didn't touch MonitorQMP*.
Signature · 1 line
Marc-André Lureau <[email protected]>
Re: [PATCH v3 17/23] monitor: Rename MonitorQMP @mon -> @qmon
Quoted 6 lines · On 13/8/26 08:22, [email protected] wrote:
Quoted 6 lines
Mechanical change to sanitize using the following patterns:
MonitorQMP *qmon (this patch)
MonitorHMP *hmon (following one)
Monitor *mon
Quoted 7 lines
Quoted 1 line
Rename @mon (and @qmp_mon) as @qmon when the type is MonitorQMP.
This patch and the following are conflicting quite directly with the work I have for --disable-hmp.
(https://gitlab.com/marcandre.lureau/qemu/-/tree/no-hmp)Can we delay them?
I was expecting something like that, sure, no problem.
Quoted 3 lines
fwiw, I picked Monitor *mon, MonitorHMP *hmp. I didn't touch MonitorQMP*.
Are you OK I merge patches 1-16 (now all reviewed) in my next misc PR?
I'd like to put #19 and #22 also, which are both HMP and removing the "monitor/monitor-internal.h" use out of monitor/ is a good cleanup IMHO. If you agree do you mind reviewing them, then I'll update the thread mentioning the queued patches.
Re: [PATCH v3 17/23] monitor: Rename MonitorQMP @mon -> @qmon
Hi
Quoted 16 lines · Philippe Mathieu-Daudé
Quoted 6 lines · On 13/8/26 08:22, [email protected] wrote:
Quoted 6 lines
Mechanical change to sanitize using the following patterns:
MonitorQMP *qmon (this patch)
MonitorHMP *hmon (following one)
Monitor *monQuoted 7 lines
Quoted 1 line
Rename @mon (and @qmp_mon) as @qmon when the type is MonitorQMP.
This patch and the following are conflicting quite directly with the work I have for --disable-hmp.
(https://gitlab.com/marcandre.lureau/qemu/-/tree/no-hmp)Can we delay them?
Quoted 7 lines
I was expecting something like that, sure, no problem.
Quoted 3 lines
fwiw, I picked Monitor *mon, MonitorHMP *hmp. I didn't touch MonitorQMP*.
Are you OK I merge patches 1-16 (now all reviewed) in my next misc PR?
yes please, asap :)
Quoted 4 lines
I'd like to put #19 and #22 also, which are both HMP and removing the "
monitor/monitor-internal.h" use out of monitor/ is a good cleanup IMHO. If you agree do you mind reviewing them, then I'll update the thread mentioning the queued patches.
ok
Re: [PATCH v3 17/23] monitor: Rename MonitorQMP @mon -> @qmon
In reply to [email protected]Quoted 8 lines · On 13/8/26 08:22, [email protected] wrote:
Quoted 7 lines
Mechanical change to sanitize using the following patterns:
MonitorQMP *qmon (this patch)
MonitorHMP *hmon (following one)
Monitor *monRename @mon (and @qmp_mon) as @qmon when the type is MonitorQMP.
Quoted 7 lines
This patch and the following are conflicting quite directly with the work I have for --disable-hmp.
(https://gitlab.com/marcandre.lureau/qemu/-/tree/no-hmp)Can we delay them?
fwiw, I picked Monitor *mon, MonitorHMP *hmp. I didn't touch MonitorQMP*.
I'm interpreting that as a Acked-by tag for the patch [email protected] so I'm including it (after renaming hmon -> hmp as recommended by Daniel).
Re: [PATCH v3 17/23] monitor: Rename MonitorQMP @mon -> @qmon
In reply to Philippe Mathieu-DaudéQuoted 7 lines · Philippe Mathieu-Daudé
Mechanical change to sanitize using the following patterns:
MonitorQMP *qmon (this patch)
MonitorHMP *hmon (following one)
Monitor *monRename @mon (and @qmp_mon) as @qmon when the type is MonitorQMP.
The more suitable names to me feel like 'mon', 'qmp' and 'hmp', not least because we already use them, whereas as have no use of qmon/hmon currently.
Quoted 7 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- monitor/monitor-internal.h | 4 +- monitor/qmp-cmds-control.c | 18 +-- monitor/qmp.c | 256 ++++++++++++++++++------------------- 3 files changed, 139 insertions(+), 139 deletions(-)
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
Re: [PATCH v3 17/23] monitor: Rename MonitorQMP @mon -> @qmon
Quoted 7 lines · Daniel P. Berrangé
Quoted 6 lines · Philippe Mathieu-Daudé
Mechanical change to sanitize using the following patterns:
MonitorQMP *qmon (this patch)
MonitorHMP *hmon (following one)
Monitor *mon
Quoted 5 lines
Quoted 1 line
Rename @mon (and @qmp_mon) as @qmon when the type is MonitorQMP.
The more suitable names to me feel like 'mon', 'qmp' and 'hmp', not least because we already use them, whereas as have no use of qmon/hmon currently.
Interesting, this is what I chose first, then thought I'd receive comments that this the monitor state being named the same as the interface used would be confusing. I'll happily redo the rename (but after Marc-André 'Make HMP optional' series lands).
Quoted 12 lines
Quoted 9 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- monitor/monitor-internal.h | 4 +- monitor/qmp-cmds-control.c | 18 +-- monitor/qmp.c | 256 ++++++++++++++++++------------------- 3 files changed, 139 insertions(+), 139 deletions(-)With regards,
Daniel
PATCH v3 18/23 monitor: Rename MonitorHMP @mon -> @hmon
In reply to Philippe Mathieu-DaudéMechanical change to sanitize using the following patterns:
MonitorQMP *qmon (previous patch)
MonitorHMP *hmon (this patch)
Monitor *mon
Rename @mon (and @hmp_mon) as @hmon when the type is MonitorHMP.
--- include/monitor/monitor.h | 4 +- monitor/monitor-internal.h | 2 +- migration/migration-hmp-cmds.c | 4 +- monitor/hmp-cmds.c | 10 +-- monitor/hmp.c | 155 +++++++++++++++++---------------- monitor/qmp-cmds.c | 12 +-- ui/ui-hmp-cmds.c | 4 +- 7 files changed, 96 insertions(+), 95 deletions(-)
include/monitor/monitor.h +2 -2
@@ -55,8 +55,8 @@ void monitor_flush_locked(Monitor *mon);void *gpa2hva (MemoryRegion **p_mr,hwaddr addr,uint64_t size,Error **errp); -void monitor_read_command (MonitorHMP *mon,int show_prompt); -int monitor_read_password (MonitorHMP *mon,ReadLineFunc *readline_func, +void monitor_read_command (MonitorHMP *hmon,int show_prompt); +int monitor_read_password (MonitorHMP *hmon,ReadLineFunc *readline_func,void *opaque); AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_id,
monitor/monitor-internal.h +1 -1
@@ -221,7 +221,7 @@ void monitor_data_destroy_qmp(MonitorQMP *qmon); void coroutine_fn monitor_qmp_dispatcher_co(void *data);void qmp_dispatcher_co_wake (void ); -void handle_hmp_command (MonitorHMP *mon,const char *cmdline); +void handle_hmp_command (MonitorHMP *hmon,const char *cmdline);int hmp_compare_cmd (const char *name,const char *list);/*
migration/migration-hmp-cmds.c +2 -2
@@ -855,9 +855,9 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)if (!detach) {HMPMigrationStatus *status; -MonitorHMP *hmp =MONITOR_HMP (mon); +MonitorHMP *hmon =MONITOR_HMP (mon); -if (!hmp->use_readline) { +if (!hmon->use_readline) {monitor_printf (mon,"terminal does not allow synchronous " "migration, continuing detached\n" );return ;
monitor/hmp-cmds.c +5 -5
@@ -129,8 +129,8 @@ void hmp_info_version(Monitor *mon, const QDict *qdict)void hmp_quit (Monitor *mon,const QDict *qdict) { -MonitorHMP *hmp =MONITOR_HMP (mon); -if (hmp->use_readline) { +MonitorHMP *hmon =MONITOR_HMP (mon); +if (hmon->use_readline) {monitor_suspend (mon); }qmp_quit (NULL );
@@ -290,16 +290,16 @@ void hmp_info_sync_profile(Monitor *mon, const QDict *qdict)void hmp_info_history (Monitor *mon,const QDict *qdict) { -MonitorHMP *hmp_mon =container_of (mon, MonitorHMP, parent_obj); +MonitorHMP *hmon =container_of (mon, MonitorHMP, parent_obj);int i;const char *str; -if (!hmp_mon->rs) { +if (!hmon->rs) {return ; } i =0 ;for (;;) { - str =readline_get_history (hmp_mon->rs, i); + str =readline_get_history (hmon->rs, i);if (!str) {break ; }
monitor/hmp.c +78 -77
417 lines not on this page · raw message
monitor/qmp-cmds.c +6 -6
@@ -166,10 +166,10 @@ char *qmp_human_monitor_command(const char *command_line, bool has_cpu_index, int64_t cpu_index, Error **errp) { char *output = NULL; -MonitorHMP *hmp =MONITOR_HMP (object_new (TYPE_MONITOR_HMP )); +MonitorHMP *hmon =MONITOR_HMP (object_new (TYPE_MONITOR_HMP ));if (has_cpu_index) { -int ret =monitor_set_cpu (&hmp->parent_obj, cpu_index); +int ret =monitor_set_cpu (&hmon->parent_obj, cpu_index);if (ret <0 ) {error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"cpu-index" ,"a CPU number" );
@@ -177,14 +177,14 @@ char *qmp_human_monitor_command(const char *command_line, bool has_cpu_index, } } -handle_hmp_command (hmp, command_line); +handle_hmp_command (hmon, command_line); - WITH_QEMU_LOCK_GUARD(&hmp->parent_obj.mon_lock) { - output =g_strdup (hmp->parent_obj.outbuf->str); + WITH_QEMU_LOCK_GUARD(&hmon->parent_obj.mon_lock) { + output =g_strdup (hmon->parent_obj.outbuf->str); } out: -object_unref (hmp); +object_unref (hmon);return output; }
ui/ui-hmp-cmds.c +2 -2
@@ -343,8 +343,8 @@ void hmp_change_vnc(Monitor *mon, const char *device, const char *target,return ; }if (!arg) { -MonitorHMP *hmp_mon =container_of (mon, MonitorHMP, parent_obj); -monitor_read_password (hmp_mon, hmp_change_read_arg,NULL ); +MonitorHMP *hmon =container_of (mon, MonitorHMP, parent_obj); +monitor_read_password (hmon, hmp_change_read_arg,NULL ); }else {qmp_change_vnc_password (arg, errp); }
Signature · 1 line
2.53.0
PATCH v3 19/23 monitor: Better express monitor_read()'s opaque arg is of Monitor type
In reply to Philippe Mathieu-Daudémonitor_read() is a IOReadHandler handler, called by qemu_chr_fe_set_handlers() with a Monitor* opaque argument.
--- monitor/hmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
monitor/hmp.c +2 -1
@@ -1519,7 +1519,8 @@ cleanup:static void monitor_read (void *opaque,const uint8_t *buf,int size) { -MonitorHMP *hmon =container_of (opaque, MonitorHMP, parent_obj); +Monitor *mon = opaque; +MonitorHMP *hmon =container_of (mon, MonitorHMP, parent_obj);int i;if (hmon->rs) {
Signature · 1 line
2.53.0
Re: [PATCH v3 19/23] monitor: Better express monitor_read()'s opaque arg is of Monitor type
Quoted 2 lines · Philippe Mathieu-Daudé
monitor_read()is a IOReadHandler handler, called byqemu_chr_fe_set_handlers()with a Monitor* opaque argument.
Signature · 1 line
Marc-André Lureau <[email protected]>
PATCH v3 20/23 monitor: Use QOM MONITOR() macro to access MonitorQMP->parent_obj
In reply to Philippe Mathieu-DaudéMonitorQMP QOM parent is Monitor, so we can use the following QOM-cast macro:
MONITOR(qmon) == &qmon->parent_obj
When introducing a Monitor variable, name it @mon.
--- monitor/qmp.c | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-)
monitor/qmp.c +28 -17
@@ -213,6 +213,8 @@ static void monitor_qmp_drain_queue(MonitorQMP *qmon)static void monitor_qmp_cleanup_queue_and_resume (MonitorQMP *qmon) { +Monitor *mon =MONITOR (qmon); +QEMU_LOCK_GUARD (&qmon->qmp_queue_lock);/*
@@ -237,7 +239,7 @@ static void monitor_qmp_cleanup_queue_and_resume(MonitorQMP *qmon)* when we get here while the monitor is suspended. An * unfortunately timed CHR_EVENT_CLOSED can do the trick. */ -monitor_resume (&qmon->parent_obj); +monitor_resume (mon); } }
@@ -245,6 +247,7 @@ static void monitor_qmp_cleanup_queue_and_resume(MonitorQMP *qmon)void qmp_send_response (MonitorQMP *qmon,const QDict *rsp) {const QObject *data =QOBJECT (rsp); +Monitor *mon =MONITOR (qmon);GString *json; json =qobject_to_json_pretty (data, qmon->pretty);
@@ -252,7 +255,7 @@ void qmp_send_response(MonitorQMP *qmon, const QDict *rsp)trace_monitor_qmp_respond (qmon, json->str);g_string_append_c (json,'\n' ); -monitor_puts (&qmon->parent_obj, json->str); +monitor_puts (mon, json->str);g_string_free (json, true); }
@@ -277,9 +280,10 @@ static void monitor_qmp_dispatch(MonitorQMP *qmon, QObject *req) {QDict *rsp;QDict *error; +Monitor *mon =MONITOR (qmon); rsp =qmp_dispatch (qmon->commands, req,qmp_oob_enabled (qmon), - &qmon->parent_obj); + mon);if (qmon->commands == &qmp_cap_negotiation_commands) { error =qdict_get_qdict (rsp,"error" );
@@ -392,6 +396,7 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data)QDict *rsp;bool oob_enabled;MonitorQMP *qmon; +Monitor *mon;while ((req_obj =monitor_qmp_dispatcher_pop_any ()) !=NULL ) { trace_monitor_qmp_in_band_dequeue(req_obj,
@@ -402,6 +407,7 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data)*/ qmon = req_obj->mon; + mon =MONITOR (qmon); qmp_dispatcher_current_mon = qmon;/*
@@ -418,7 +424,7 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data) oob_enabled =qmp_oob_enabled (qmon);if (oob_enabled && qmon->qmp_requests->length ==QMP_REQ_QUEUE_LEN_MAX -1 ) { -monitor_resume (&qmon->parent_obj); +monitor_resume (mon); }/*
@@ -459,7 +465,7 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data) }if (!oob_enabled) { -monitor_resume (&qmon->parent_obj); +monitor_resume (mon); }qmp_request_free (req_obj);
@@ -482,6 +488,7 @@ void qmp_dispatcher_co_wake(void)static void handle_qmp_command (void *opaque,QObject *req,Error *err) {MonitorQMP *qmon = opaque; +Monitor *mon =MONITOR (qmon);QDict *qdict =qobject_to (QDict, req);QMPRequest *req_obj;
@@ -525,7 +532,7 @@ static void handle_qmp_command(void *opaque, QObject *req, Error *err)*/ if (!qmp_oob_enabled (qmon) || qmon->qmp_requests->length ==QMP_REQ_QUEUE_LEN_MAX -1 ) { -monitor_suspend (&qmon->parent_obj); +monitor_suspend (mon); }/*
@@ -575,9 +582,10 @@ static QDict *qmp_greeting(MonitorQMP *qmon)static void monitor_qmp_self_delete_bh (void *opaque) {MonitorQMP *qmon = opaque; +Monitor *mon =MONITOR (qmon);const char *mon_id =object_get_canonical_path_component (OBJECT (qmon)); - g_autofree char *chardev_id = g_strdup(qmon->parent_obj.chardev_id); + g_autofree char *chardev_id = g_strdup(mon->chardev_id);Error *local_error =NULL ;if (!mon_id) {
@@ -605,6 +613,7 @@ static void monitor_qmp_event(void *opaque, QEMUChrEvent event) {QDict *data;MonitorQMP *qmon = opaque; +Monitor *mon =MONITOR (qmon);/* * Protect against race if a client drops & quickly
@@ -617,7 +626,7 @@ static void monitor_qmp_event(void *opaque, QEMUChrEvent event)switch (event) {case CHR_EVENT_OPENED : - WITH_QEMU_LOCK_GUARD(&qmon->parent_obj.mon_lock) { + WITH_QEMU_LOCK_GUARD(&mon->mon_lock) { qmon->commands = &qmp_cap_negotiation_commands;monitor_qmp_caps_reset (qmon); }
@@ -676,15 +685,16 @@ static bool monitor_qmp_dispatcher_is_servicing(MonitorQMP *qmon)static void monitor_qmp_setup_handlers_bh (void *opaque) {MonitorQMP *qmon = opaque; +Monitor *mon =MONITOR (qmon);GMainContext *context;assert (monitor_requires_iothread (MONITOR (qmon))); context =iothread_get_g_main_context (mon_iothread);assert (context); -qemu_chr_fe_set_handlers (&qmon->parent_obj.chr, monitor_can_read, +qemu_chr_fe_set_handlers (&mon->chr, monitor_can_read, monitor_qmp_read, monitor_qmp_event, -NULL , &qmon->parent_obj, context, true); -monitor_list_append (&qmon->parent_obj); +NULL , mon, context, true); +monitor_list_append (mon);qatomic_set (&qmon->setup_pending, false); }
@@ -704,6 +714,7 @@ void monitor_new_qmp(const char *id, const char *chardev_id,static void monitor_qmp_complete (UserCreatable *uc,Error **errp) {MonitorQMP *qmon =MONITOR_QMP (uc); +Monitor *mon =MONITOR (qmon);UserCreatableClass *ucc_parent = USER_CREATABLE_CLASS( object_class_get_parent(
@@ -715,19 +726,19 @@ static void monitor_qmp_complete(UserCreatable *uc, Error **errp)return ; } -qemu_chr_fe_set_echo (&qmon->parent_obj.chr, true); +qemu_chr_fe_set_echo (&mon->chr, true);if (monitor_requires_iothread (MONITOR (qmon))) {/* * Make sure the old iowatch is gone. It's possible when * e.g. the chardev is in client mode, with wait=on. */ -remove_fd_in_watch (qmon->parent_obj.chr.chr); +remove_fd_in_watch (mon->chr.chr);/* * Clean up listener IO sources early to prevent racy fd * handling between the main thread and the I/O thread. */ -remove_listener_fd_in_watch (qmon->parent_obj.chr.chr); +remove_listener_fd_in_watch (mon->chr.chr);/* * We can't call qemu_chr_fe_set_handlers() directly here * since chardev might be running in the monitor I/O
@@ -738,10 +749,10 @@ static void monitor_qmp_complete(UserCreatable *uc, Error **errp) monitor_qmp_setup_handlers_bh, qmon);/* The bottom half will add @mon to @mon_list */ }else { -qemu_chr_fe_set_handlers (&qmon->parent_obj.chr, monitor_can_read, +qemu_chr_fe_set_handlers (&mon->chr, monitor_can_read, monitor_qmp_read, monitor_qmp_event, -NULL , &qmon->parent_obj,NULL , true); -monitor_list_append (&qmon->parent_obj); +NULL , mon,NULL , true); +monitor_list_append (mon); } }
Signature · 1 line
2.53.0
PATCH v3 21/23 monitor: Use QOM MONITOR() macro to access MonitorHMP->parent_obj
In reply to Philippe Mathieu-DaudéMonitorHMP QOM parent is Monitor, so we can use the following QOM-cast macro:
MONITOR(hmon) == &hmon->parent_obj
When introducing a Monitor variable, name it @mon.
--- monitor/hmp.c | 44 ++++++++++++++++++++++++++------------------ monitor/qmp-cmds.c | 7 ++++--- 2 files changed, 30 insertions(+), 21 deletions(-)
monitor/hmp.c +26 -18
@@ -129,10 +129,11 @@ static void monitor_command_cb(void *opaque, const char *cmdline, void *readline_opaque) {MonitorHMP *hmon = opaque; +Monitor *mon =MONITOR (hmon); -monitor_suspend (&hmon->parent_obj); +monitor_suspend (mon);handle_hmp_command (hmon, cmdline); -monitor_resume (&hmon->parent_obj); +monitor_resume (mon); }void monitor_read_command (MonitorHMP *hmon,int show_prompt)
@@ -155,7 +156,8 @@ int monitor_read_password(MonitorHMP *hmon, ReadLineFunc *readline_func,/* prompt is printed on return from the command handler */ return 0 ; }else { -monitor_printf (&hmon->parent_obj, +Monitor *mon =MONITOR (hmon); +monitor_printf (mon,"terminal does not support password prompting\n" );return -ENOTTY ; }
@@ -777,7 +779,7 @@ static const HMPCommand *monitor_parse_command(MonitorHMP *hmon,const char **cmdp, HMPCommand *table) { - Monitor *mon = &hmon->parent_obj; + Monitor *mon = MONITOR(hmon);const char *p;const HMPCommand *cmd;char cmdname[256 ];
@@ -1257,6 +1259,7 @@ static void handle_hmp_command_co(void *opaque)void handle_hmp_command (MonitorHMP *hmon,const char *cmdline) {QDict *qdict; +Monitor *mon =MONITOR (hmon);const HMPCommand *cmd;const char *cmd_start = cmdline;
@@ -1270,17 +1273,17 @@ void handle_hmp_command(MonitorHMP *hmon, const char *cmdline)if (!cmd->cmd && !cmd->cmd_info_hrt) {/* FIXME: is it useful to try autoload modules here ??? */ -monitor_printf (&hmon->parent_obj,"Command \"%.*s\" is not available.\n" , +monitor_printf (mon,"Command \"%.*s\" is not available.\n" , (int )(cmdline - cmd_start), cmd_start);return ; } - qdict =monitor_parse_arguments (&hmon->parent_obj, &cmdline, cmd); + qdict =monitor_parse_arguments (mon, &cmdline, cmd);if (!qdict) {while (cmdline > cmd_start &&qemu_isspace (cmdline[-1 ])) { cmdline--; } -monitor_printf (&hmon->parent_obj, +monitor_printf (mon,"Try \"help %.*s\" for more information\n" , (int )(cmdline - cmd_start), cmd_start);return ;
@@ -1289,18 +1292,18 @@ void handle_hmp_command(MonitorHMP *hmon, const char *cmdline)if (!cmd->coroutine) {/* old_mon is non-NULL when called from qmp_human_monitor_command() */ Monitor *old_mon =monitor_set_cur (qemu_coroutine_self (), - &hmon->parent_obj); -handle_hmp_command_exec (&hmon->parent_obj, cmd, qdict); + mon); +handle_hmp_command_exec (mon, cmd, qdict);monitor_set_cur (qemu_coroutine_self (), old_mon); }else {HandleHmpCommandCo data = { - .mon = &hmon->parent_obj, + .mon = mon, .cmd = cmd, .qdict = qdict, .done = false, };Coroutine *co =qemu_coroutine_create (handle_hmp_command_co, &data); -monitor_set_cur (co, &hmon->parent_obj); +monitor_set_cur (co, mon);aio_co_enter (qemu_get_aio_context (), co);AIO_WAIT_WHILE_UNLOCKED (NULL , !data.done); }
@@ -1529,7 +1532,7 @@ static void monitor_read(void *opaque, const uint8_t *buf, int size) } }else {if (size ==0 || buf[size -1 ] !=0 ) { -monitor_printf (&hmon->parent_obj,"corrupted command\n" ); +monitor_printf (mon,"corrupted command\n" ); }else {handle_hmp_command (hmon, (char *)buf); }
@@ -1601,16 +1604,20 @@ static void G_GNUC_PRINTF(2, 3) monitor_readline_printf(void *opaque, const char *fmt, ...) {MonitorHMP *hmon = opaque; +Monitor *mon =MONITOR (hmon); +va_list ap;va_start (ap, fmt); -monitor_vprintf (&hmon->parent_obj, fmt, ap); +monitor_vprintf (mon, fmt, ap);va_end (ap); }static void monitor_readline_flush (void *opaque) {MonitorHMP *hmon = opaque; -monitor_flush (&hmon->parent_obj); +Monitor *mon =MONITOR (hmon); + +monitor_flush (mon); } void monitor_new_hmp(const char *id, const char *chardev_id,
@@ -1629,6 +1636,7 @@ void monitor_new_hmp(const char *id, const char *chardev_id,static void monitor_hmp_complete (UserCreatable *uc,Error **errp) {MonitorHMP *hmon =MONITOR_HMP (uc); +Monitor *mon =MONITOR (hmon);UserCreatableClass *ucc_parent = USER_CREATABLE_CLASS( object_class_get_parent(
@@ -1640,7 +1648,7 @@ static void monitor_hmp_complete(UserCreatable *uc, Error **errp)return ; } -if (hmon->parent_obj.chardev_id) { +if (mon->chardev_id) {if (hmon->use_readline) { hmon->rs = readline_init(monitor_readline_printf, monitor_readline_flush,
@@ -1649,12 +1657,12 @@ static void monitor_hmp_complete(UserCreatable *uc, Error **errp)monitor_read_command (hmon,0 ); } -qemu_chr_fe_set_handlers (&hmon->parent_obj.chr, +qemu_chr_fe_set_handlers (&mon->chr, monitor_can_read, monitor_read, monitor_event,NULL , - &hmon->parent_obj,NULL , true); -monitor_list_append (&hmon->parent_obj); + mon,NULL , true); +monitor_list_append (mon); } }
monitor/qmp-cmds.c +4 -3
@@ -167,9 +167,10 @@ char *qmp_human_monitor_command(const char *command_line, bool has_cpu_index, {char *output =NULL ;MonitorHMP *hmon =MONITOR_HMP (object_new (TYPE_MONITOR_HMP )); +Monitor *mon =MONITOR (hmon);if (has_cpu_index) { -int ret =monitor_set_cpu (&hmon->parent_obj, cpu_index); +int ret =monitor_set_cpu (mon, cpu_index);if (ret <0 ) {error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"cpu-index" ,"a CPU number" );
@@ -179,8 +180,8 @@ char *qmp_human_monitor_command(const char *command_line, bool has_cpu_index,handle_hmp_command (hmon, command_line); - WITH_QEMU_LOCK_GUARD(&hmon->parent_obj.mon_lock) { - output =g_strdup (hmon->parent_obj.outbuf->str); + WITH_QEMU_LOCK_GUARD(&mon->mon_lock) { + output =g_strdup (mon->outbuf->str); } out:
Signature · 1 line
2.53.0
PATCH v3 22/23 monitor: Replace container_of(MonitorHMP, parent_obj) -> MONITOR_HMP()
In reply to Philippe Mathieu-DaudéBy replacing the container_of(MonitorHMP) use in ui/ui-hmp-cmds.c we can remove its incorrect inclusion of "monitor/monitor-internal.h" header, using the public "monitor/monitor.h" instead.
--- monitor/hmp-cmds.c | 2 +- monitor/hmp.c | 2 +- ui/ui-hmp-cmds.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
monitor/hmp-cmds.c +1 -1
@@ -290,7 +290,7 @@ void hmp_info_sync_profile(Monitor *mon, const QDict *qdict)void hmp_info_history (Monitor *mon,const QDict *qdict) { -MonitorHMP *hmon =container_of (mon, MonitorHMP, parent_obj); +MonitorHMP *hmon =MONITOR_HMP (mon);int i;const char *str;
monitor/hmp.c +1 -1
@@ -1523,7 +1523,7 @@ cleanup:static void monitor_read (void *opaque,const uint8_t *buf,int size) {Monitor *mon = opaque; -MonitorHMP *hmon =container_of (mon, MonitorHMP, parent_obj); +MonitorHMP *hmon =MONITOR_HMP (mon);int i;if (hmon->rs) {
ui/ui-hmp-cmds.c +2 -2
@@ -19,7 +19,7 @@#endif #include "monitor/hmp.h" #include "monitor/hmp-completion.h" -#include "monitor/monitor-internal.h" +#include "monitor/monitor.h" #include "qapi/error.h" #include "qapi/qapi-commands-ui.h" #include "qobject/qdict.h"
@@ -343,7 +343,7 @@ void hmp_change_vnc(Monitor *mon, const char *device, const char *target,return ; }if (!arg) { -MonitorHMP *hmon =container_of (mon, MonitorHMP, parent_obj); +MonitorHMP *hmon =MONITOR_HMP (mon);monitor_read_password (hmon, hmp_change_read_arg,NULL ); }else {qmp_change_vnc_password (arg, errp);
Signature · 1 line
2.53.0
Re: [PATCH v3 22/23] monitor: Replace container_of(MonitorHMP, parent_obj) -> MONITOR_HMP()
Quoted 3 lines · Philippe Mathieu-Daudé
By replacing the
container_of(MonitorHMP)use inui/ui-hmp-cmds.cwe can remove its incorrect inclusion of "monitor/monitor-internal.h" header, using the public "monitor/monitor.h" instead.
Signature · 1 line
Marc-André Lureau <[email protected]>
PATCH v3 23/23 monitor/hmp: Remove unnecessary 'monitor/monitor.h' header
In reply to Philippe Mathieu-DaudéNothing here requires declarations from "monitor/monitor.h".
--- include/monitor/hmp.h | 1 - 1 file changed, 1 deletion(-)
include/monitor/hmp.h +0 -1
@@ -16,7 +16,6 @@#include "qemu/readline.h" #include "qapi/qapi-types-common.h" -#include "monitor/monitor.h" #define HMP_STUB (cmd) \ void hmp_##cmd(Monitor *mon, const QDict *qdict) \
Signature · 1 line
2.53.0