qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [RFC PATCH 00/10] monitor: Split monitor.c


From: Daniel P . Berrangé
Subject: Re: [Qemu-block] [Qemu-devel] [RFC PATCH 00/10] monitor: Split monitor.c in core/HMP/QMP/misc
Date: Fri, 7 Jun 2019 15:03:57 +0100
User-agent: Mutt/1.11.4 (2019-03-13)

On Fri, Jun 07, 2019 at 03:54:20PM +0200, Kevin Wolf wrote:
> 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.
> 
> 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, I think it's an improvement of
> the current state even for QEMU proper, 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.
> 
> Kevin Wolf (10):
>   monitor: Remove unused password prompting fields
>   monitor: Split monitor_init in HMP and QMP function
>   monitor: Make MonitorQMP a child class of Monitor
>   monitor: Create MonitorHMP with readline state
>   monitor: Move cmd_table to MonitorHMP
>   Move monitor.c to monitor/misc.c
>   monitor: Create monitor_int.h with common definitions
>   monitor: Split out monitor/qmp.c
>   monitor: Split out monitor/hmp.c
>   monitor: Split out monitor/core.c
> 
>  include/monitor/monitor.h |    8 +-
>  monitor/monitor_int.h     |  207 ++
>  hmp.c                     |    4 +-
>  monitor.c                 | 4727 -------------------------------------
>  monitor/core.c            |  604 +++++
>  monitor/hmp.c             | 1351 +++++++++++
>  monitor/misc.c            | 2406 +++++++++++++++++++
>  monitor/qmp.c             |  404 ++++
>  Makefile.objs             |    1 +
>  Makefile.target           |    3 +-
>  monitor/Makefile.objs     |    2 +

It will be nice to have the monitor code split up a bit more.

I'm not a fan, however, of having both $ROOT/qmp.c and $ROOT/monitor/qmp.c
Likwise  $ROOT/hmp.c and $ROOT/monitor/hmp.c.  Can we move those other
existing files out of the root dir, into monitor/, so we don't have two
files with the same name in different dirs.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



reply via email to

[Prev in Thread] Current Thread [Next in Thread]