qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: dgilbert@redhat.com, qemu-devel@nongnu.org,
	qemu-block@nongnu.org, armbru@redhat.com
Subject: Re: [Qemu-devel] [RFC PATCH 00/10] monitor: Split monitor.c in core/HMP/QMP/misc
Date: Fri, 7 Jun 2019 16:25:14 +0200	[thread overview]
Message-ID: <20190607142514.GE5055@dhcp-200-226.str.redhat.com> (raw)
In-Reply-To: <20190607140357.GK28838@redhat.com>

Am 07.06.2019 um 16:03 hat Daniel P. Berrangé geschrieben:
> 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.

$ROOT/hmp.c and $ROOT/qmp.c contain various command implementations,
just as $ROOT/monitor/misc.c. This is still a bit of a mess. I'll have
to address this at least partially in the next step because I need to
separate commands that can be linked with tools from those that require
a system emulator.

My plan involves at least creating some monitor/qmp-cmds-*.c, which
might already make $ROOT/qmp.c empty. Even though I don't strictly need
it, there's no reason not to do the same for HMP, too. In any case, I'd
rather address this in a separate follow-up series.

But if people prefer, I can move the existing files in the root
directory to monitor/{qmp,hmp}-cmds.c temporarily in this series and
then work from there with follow-ups until they are empty (or maybe I
don't even have to make them completely empty then).

Kevin


  reply	other threads:[~2019-06-07 15:23 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-07 13:54 [Qemu-devel] [RFC PATCH 00/10] monitor: Split monitor.c in core/HMP/QMP/misc Kevin Wolf
2019-06-07 13:54 ` [Qemu-devel] [RFC PATCH 01/10] monitor: Remove unused password prompting fields Kevin Wolf
2019-06-07 15:39   ` Dr. David Alan Gilbert
2019-06-07 13:54 ` [Qemu-devel] [RFC PATCH 02/10] monitor: Split monitor_init in HMP and QMP function Kevin Wolf
2019-06-07 15:46   ` Dr. David Alan Gilbert
2019-06-07 13:54 ` [Qemu-devel] [RFC PATCH 03/10] monitor: Make MonitorQMP a child class of Monitor Kevin Wolf
2019-06-07 16:17   ` Dr. David Alan Gilbert
2019-06-07 13:54 ` [Qemu-devel] [RFC PATCH 04/10] monitor: Create MonitorHMP with readline state Kevin Wolf
2019-06-07 16:32   ` Dr. David Alan Gilbert
2019-06-07 13:54 ` [Qemu-devel] [RFC PATCH 05/10] monitor: Move cmd_table to MonitorHMP Kevin Wolf
2019-06-07 16:35   ` Dr. David Alan Gilbert
2019-06-07 13:54 ` [Qemu-devel] [RFC PATCH 06/10] Move monitor.c to monitor/misc.c Kevin Wolf
2019-06-07 16:39   ` Dr. David Alan Gilbert
2019-06-07 13:54 ` [Qemu-devel] [RFC PATCH 07/10] monitor: Create monitor_int.h with common definitions Kevin Wolf
2019-06-07 16:52   ` Dr. David Alan Gilbert
2019-06-07 13:54 ` [Qemu-devel] [RFC PATCH 08/10] monitor: Split out monitor/qmp.c Kevin Wolf
2019-06-07 16:59   ` Dr. David Alan Gilbert
2019-06-07 13:54 ` [Qemu-devel] [RFC PATCH 09/10] monitor: Split out monitor/hmp.c Kevin Wolf
2019-06-07 17:21   ` Dr. David Alan Gilbert
2019-06-07 13:54 ` [Qemu-devel] [RFC PATCH 10/10] monitor: Split out monitor/core.c Kevin Wolf
2019-06-07 17:29   ` Dr. David Alan Gilbert
2019-06-11  9:22     ` Kevin Wolf
2019-06-11  9:25       ` Dr. David Alan Gilbert
2019-06-07 17:30   ` Dr. David Alan Gilbert
2019-06-07 14:03 ` [Qemu-devel] [RFC PATCH 00/10] monitor: Split monitor.c in core/HMP/QMP/misc Daniel P. Berrangé
2019-06-07 14:25   ` Kevin Wolf [this message]
2019-06-07 14:31     ` Daniel P. Berrangé
2019-06-07 15:35       ` Dr. David Alan Gilbert
2019-06-07 18:11         ` [Qemu-devel] [Qemu-block] " Eric Blake
2019-06-07 16:48 ` [Qemu-devel] " no-reply
2019-06-07 20:42 ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190607142514.GE5055@dhcp-200-226.str.redhat.com \
    --to=kwolf@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).