Kevin Wolf <kw...@redhat.com> writes: > monitor.c mixes a lot of different things in a single file: The core > monitor infrastructure, HMP infrastrcture, QMP infrastructure, and the > implementation of several HMP and QMP commands. Almost worse, struct > Monitor mixes state for HMP, for QMP, and state actually shared between > all monitors. monitor.c must be linked with a system emulator and even > requires per-target compilation because some of the commands it > implements access system emulator state.
Also: it's so fat it hasn't seen its feet in years. > The reason why I care about this is that I'm working on a protoype for a > storage daemon, which wants to use QMP (but probably not HMP) and > obviously doesn't have any system emulator state. So I'm interested in > some core monitor parts that can be linked to non-system-emulator tools. > > This series first creates separate structs MonitorQMP and MonitorHMP > which inherit from Monitor, and then moves the associated infrastructure > code into separate source files. > > While the split is probably not perfect, It's not :) > I think it's an improvement of > the current state even for QEMU proper, It very much is! There are a few issues to address, but nothing structural. Looking forward to v3. > and it's good enough so I can > link my storage daemon against just monitor/core.o and monitor/qmp.o and > get a useless QMP monitor that parses the JSON input and rejects > everything as an unknown command. > > Next I'll try to teach it a subset of QMP commands that can actually be > supported in a tool, but while there will be a few follow-up patches to > achieve this, I don't expect that this work will bring up much that > needs to be changed in the splitting process done in this series.