qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH 0/8] Remove stub mon-protocol-event for bloc


From: Wenchao Xia
Subject: Re: [Qemu-devel] [RFC PATCH 0/8] Remove stub mon-protocol-event for block
Date: Mon, 16 Sep 2013 12:59:55 +0800
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9

于 2013/9/12 17:31, Paolo Bonzini 写道:
Il 12/09/2013 11:15, Wenchao Xia ha scritto:
This series will remove the usage of symbols of mon-protocol-event in
qemu-img, qemu-nbd and qemu-io, in short remove the connetion for block
layer.

Background:
   I am tring to decouple block layer code with other unnnessary components,
and in ./stub there many symbols that qemu-img linked as fake implemtion.
As a first step, I am decouple monitor with block layer code, this is the
first part of it.
   There are still other stub symbols for monitor, which will be solved later.
It seems error handlering is also link with those symbols, and will adjust
that.

Wenchao Xia (8):
   1 block: use type MonitorEvent directly
   2 block: do not include monitor.h in block.c
   3 qapi: move MonitorEvent define
   4 qapi: rename MonitorEvent to QEvent
   5 block: add a callback layer for common functions
   6 block: replace monitor_protocol_event() with callback
   7 block: do not include monitor.h
   7 stubs: remove mon-protocol-event.o in stub obj

  block.c                    |   22 ++++++++++++++++++----
  block/qcow2-refcount.c     |    4 +++-
  blockjob.c                 |   10 ++++++++--
  include/block/block.h      |   12 ++++++++++++
  include/block/block_int.h  |    3 +--
  include/monitor/monitor.h  |   40 ++--------------------------------------
  include/qapi/qmp/qevent.h  |   41 +++++++++++++++++++++++++++++++++++++++++
  include/qapi/qmp/types.h   |    1 +
  monitor.c                  |   12 ++++++------
  stubs/Makefile.objs        |    1 -
  stubs/mon-protocol-event.c |    2 +-
  tests/Makefile             |    3 ++-
  ui/vnc.c                   |    2 +-
  vl.c                       |    4 ++++
  14 files changed, 100 insertions(+), 57 deletions(-)
  create mode 100644 include/qapi/qmp/qevent.h

Patches 1-4 look good.  I'm not sure of the advantage of the last four,
however.  The ugly part of monitor_protocol_event is not really the
stub, but the dependency on QObject.
I think replacing QObject with QAPI types is another issue we could improve. The last foure patches tries decouple monitor code with block layer code from build time. The files in ./stubs is needed since some symbols are needed in some program which don't need it really, and I think, that tips the code are not organized very well in .c file level. After removing ./stubs, the code will be more clear. And as a by- prodcut, the components in qemu will have a clear boundary, and I can select several components to form library,
and qemu can naturlly link with it.

So, in my opinion a more interesting approach would be to describe
events using QAPI types.  Generating the events would require a small
amount of code to build QObjects manually, because the event syntax
doesn't match exactly a QAPI union, but that is only a technical detail.

Paolo





reply via email to

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