summaryrefslogtreecommitdiffstats
path: root/monitor/hmp.c
Commit message (Collapse)AuthorAgeFilesLines
* chardev: Use QEMUChrEvent enum in IOEventHandler typedefPhilippe Mathieu-Daudé2020-01-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Chardev events are listed in the QEMUChrEvent enum. By using the enum in the IOEventHandler typedef we: - make the IOEventHandler type more explicit (this handler process out-of-band information, while the IOReadHandler is in-band), - help static code analyzers. This patch was produced with the following spatch script: @match@ expression backend, opaque, context, set_open; identifier fd_can_read, fd_read, fd_event, be_change; @@ qemu_chr_fe_set_handlers(backend, fd_can_read, fd_read, fd_event, be_change, opaque, context, set_open); @depends on match@ identifier opaque, event; identifier match.fd_event; @@ static -void fd_event(void *opaque, int event) +void fd_event(void *opaque, QEMUChrEvent event) { ... } Then the typedef was modified manually in include/chardev/char-fe.h. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by: Corey Minyard <cminyard@mvista.com> Acked-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20191218172009.8868-15-philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* monitor/hmp: Explicit we ignore a QEMUChrEvent in IOEventHandlerPhilippe Mathieu-Daudé2020-01-071-0/+4
| | | | | | | | | | | | | | | | | | | | The Chardev events are listed in the QEMUChrEvent enum. To be able to use this enum in the IOEventHandler typedef, we need to explicit an event ignored by this frontend, to silent the following GCC warning: CC monitor/hmp.o monitor/hmp.c: In function ‘monitor_event’: monitor/hmp.c:1330:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch] 1330 | switch (event) { | ^~~~~~ cc1: all warnings being treated as errors Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20191218172009.8868-13-philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* sysemu: Split sysemu/runstate.h off sysemu/sysemu.hMarkus Armbruster2019-08-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | sysemu/sysemu.h is a rather unfocused dumping ground for stuff related to the system-emulator. Evidence: * It's included widely: in my "build everything" tree, changing sysemu/sysemu.h still triggers a recompile of some 1100 out of 6600 objects (not counting tests and objects that don't depend on qemu/osdep.h, down from 5400 due to the previous two commits). * It pulls in more than a dozen additional headers. Split stuff related to run state management into its own header sysemu/runstate.h. Touching sysemu/sysemu.h now recompiles some 850 objects. qemu/uuid.h also drops from 1100 to 850, and qapi/qapi-types-run-state.h from 4400 to 4200. Touching new sysemu/runstate.h recompiles some 500 objects. Since I'm touching MAINTAINERS to add sysemu/runstate.h anyway, also add qemu/main-loop.h. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190812052359.30071-30-armbru@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> [Unbreak OS-X build]
* monitor: Replace monitor_init() with monitor_init_{hmp, qmp}()Kevin Wolf2019-06-181-2/+2
| | | | | | | | | | | | Most callers know which monitor type they want to have. Instead of calling monitor_init() with flags that can describe both types of monitors, make monitor_init_{hmp,qmp}() public interfaces that take specific bools instead of flags and call these functions directly. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20190613153405.24769-15-kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* monitor: Split Monitor.flags into separate boolsKevin Wolf2019-06-181-3/+3
| | | | | | | | | | | | | | | Monitor.flags contains three different flags: One to distinguish HMP from QMP; one specific to HMP (MONITOR_USE_READLINE) that is ignored with QMP; and another one specific to QMP (MONITOR_USE_PRETTY) that is ignored with HMP. Split the flags field into three bools and move them to the right subclass. Flags are still in use for the monitor_init() interface. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20190613153405.24769-14-kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* monitor: Split out monitor/hmp.cKevin Wolf2019-06-181-0/+1417
Move HMP infrastructure from monitor/misc.c to monitor/hmp.c. This is code that can be shared for all targets, so compile it only once. The amount of function and particularly extern variables in monitor_int.h is probably a bit larger than it needs to be, but this way no non-trivial code modifications are needed. The interfaces between HMP and the monitor core can be cleaned up later. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20190613153405.24769-12-kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Comment reformatted to make checkpatch.pl happy, #include <dirent.h> moved to fix Windows build, superfluous #include dropped] Signed-off-by: Markus Armbruster <armbru@redhat.com>