Commit cdfaa272 authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2019-06-17-v2' into staging



Monitor patches for 2019-06-17

# gpg: Signature made Tue 18 Jun 2019 07:20:25 BST
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-monitor-2019-06-17-v2:
  vl: Deprecate -mon pretty=... for HMP monitors
  monitor: Replace monitor_init() with monitor_init_{hmp, qmp}()
  monitor: Split Monitor.flags into separate bools
  monitor: Split out monitor/monitor.c
  monitor: Split out monitor/hmp.c
  monitor: Split out monitor/qmp.c
  monitor: Create monitor-internal.h with common definitions
  monitor: Move {hmp, qmp}.c to monitor/{hmp, qmp}-cmds.c
  Move monitor.c to monitor/misc.c
  monitor: Rename HMP command type and tables
  monitor: Remove Monitor.cmd_table indirection
  monitor: Create MonitorHMP with readline state
  monitor: Make MonitorQMP a child class of Monitor
  monitor: Split monitor_init in HMP and QMP function
  monitor: Remove unused password prompting fields
  monitor: Fix return type of monitor_fdset_dup_fd_find

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 076243ff 3c45f625
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -1918,8 +1918,11 @@ F: qapi/run-state.json
Human Monitor (HMP)
M: Dr. David Alan Gilbert <dgilbert@redhat.com>
S: Maintained
F: monitor.c
F: hmp.[ch]
F: monitor/monitor-internal.h
F: monitor/misc.c
F: monitor/monitor.c
F: monitor/hmp*
F: hmp.h
F: hmp-commands*.hx
F: include/monitor/hmp-target.h
F: tests/test-hmp.c
@@ -2039,8 +2042,10 @@ F: tests/check-qom-proplist.c
QMP
M: Markus Armbruster <armbru@redhat.com>
S: Supported
F: qmp.c
F: monitor.c
F: monitor/monitor-internal.h
F: monitor/qmp*
F: monitor/misc.c
F: monitor/monitor.c
F: docs/devel/*qmp-*
F: docs/interop/*qmp-*
F: scripts/qmp/
+3 −1
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ ifeq ($(CONFIG_SOFTMMU),y)
common-obj-y = blockdev.o blockdev-nbd.o block/
common-obj-y += bootdevice.o iothread.o
common-obj-y += job-qmp.o
common-obj-y += monitor/
common-obj-y += net/
common-obj-y += qdev-monitor.o device-hotplug.o
common-obj-$(CONFIG_WIN32) += os-win32.o
@@ -83,8 +84,8 @@ common-obj-$(CONFIG_FDT) += device_tree.o
######################################################################
# qapi

common-obj-y += qmp.o hmp.o
common-obj-y += qapi/
common-obj-y += monitor/
endif

#######################################################################
@@ -130,6 +131,7 @@ trace-events-subdirs =
trace-events-subdirs += accel/kvm
trace-events-subdirs += accel/tcg
trace-events-subdirs += crypto
trace-events-subdirs += monitor
ifeq ($(CONFIG_USER_ONLY),y)
trace-events-subdirs += linux-user
endif
+2 −1
Original line number Diff line number Diff line
@@ -148,9 +148,10 @@ endif #CONFIG_BSD_USER
#########################################################
# System emulator target
ifdef CONFIG_SOFTMMU
obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o numa.o
obj-y += arch_init.o cpus.o gdbstub.o balloon.o ioport.o numa.o
obj-y += qtest.o
obj-y += hw/
obj-y += monitor/
obj-y += qapi/
obj-y += memory.o
obj-y += memory_mapping.o
+1 −1
Original line number Diff line number Diff line
@@ -731,7 +731,7 @@ Chardev *qemu_chr_new_noreplay(const char *label, const char *filename,

    if (qemu_opt_get_bool(opts, "mux", 0)) {
        assert(permit_mux_mon);
        monitor_init(chr, MONITOR_USE_READLINE);
        monitor_init_hmp(chr, true);
    }

out:
+6 −5
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ new QMP command.

2. Write the QMP command itself, which is a regular C function. Preferably,
   the command should be exported by some QEMU subsystem. But it can also be
   added to the qmp.c file
   added to the monitor/qmp-cmds.c file

3. At this point the command can be tested under the QMP protocol

@@ -101,7 +101,8 @@ protocol data.

The next step is to write the "hello-world" implementation. As explained
earlier, it's preferable for commands to live in QEMU subsystems. But
"hello-world" doesn't pertain to any, so we put its implementation in qmp.c:
"hello-world" doesn't pertain to any, so we put its implementation in
monitor/qmp-cmds.c:

void qmp_hello_world(Error **errp)
{
@@ -146,7 +147,7 @@ for mandatory arguments). Finally, 'str' is the argument's type, which
stands for "string". The QAPI also supports integers, booleans, enumerations
and user defined types.

Now, let's update our C implementation in qmp.c:
Now, let's update our C implementation in monitor/qmp-cmds.c:

void qmp_hello_world(bool has_message, const char *message, Error **errp)
{
@@ -267,7 +268,7 @@ monitor (HMP).

With the introduction of the QAPI, HMP commands make QMP calls. Most of the
time HMP commands are simple wrappers. All HMP commands implementation exist in
the hmp.c file.
the monitor/hmp-cmds.c file.

Here's the implementation of the "hello-world" HMP command:

@@ -470,7 +471,7 @@ it's good practice to always check for errors.

Another important detail is that HMP's "info" commands don't go into the
hmp-commands.hx. Instead, they go into the info_cmds[] table, which is defined
in the monitor.c file. The entry for the "info alarmclock" follows:
in the monitor/misc.c file. The entry for the "info alarmclock" follows:

    {
        .name       = "alarmclock",
Loading