All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Butsykin <pbutsykin@odin.com>
To: Peter Maydell <peter.maydell@linaro.org>,
	"Denis V. Lunev" <den@openvz.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Luiz Capitulino <lcapitulino@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Pavel Butsykin <pbutsykin@virtuozzo.com>
Subject: Re: [Qemu-devel] [PATCH 2/3] monitor: remove target-specific code from monitor.c
Date: Fri, 28 Aug 2015 12:21:45 +0300	[thread overview]
Message-ID: <55E02829.6040805@odin.com> (raw)
In-Reply-To: <CAFEAcA8ZQGG23brMj_AU87wGLAueLWJbkiBy5DZePW7LyVbFVg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3184 bytes --]



On 27.08.2015 20:31, Peter Maydell wrote:
> On 12 August 2015 at 12:50, Denis V. Lunev <den@openvz.org> wrote:
>> From: Pavel Butsykin <pbutsykin@virtuozzo.com>
>>
>> Move target-specific code out of /monitor.c to /target-*/monitor.c,
>> this will avoid code cluttering and using random ifdeffery.  The solution
>> is quite simple, but solves the issue of the separation of target-specific
>> code from monitor
>>
>> Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
>> Signed-off-by: Denis V. Lunev <den@openvz.org>
>> CC: Luiz Capitulino <lcapitulino@redhat.com>
>> CC: Paolo Bonzini <pbonzini@redhat.com>
>> CC: Peter Maydell <peter.maydell@linaro.org>
>> ---
>>   include/monitor/monitor-common.h |  43 ++
>>   monitor.c                        | 854 +--------------------------------------
>>   target-i386/Makefile.objs        |   2 +-
>>   target-i386/monitor.c            | 489 ++++++++++++++++++++++
>>   target-ppc/Makefile.objs         |   2 +-
>>   target-ppc/monitor.c             | 250 ++++++++++++
>>   target-sh4/Makefile.objs         |   1 +
>>   target-sh4/monitor.c             |  52 +++
>>   target-sparc/Makefile.objs       |   2 +-
>>   target-sparc/monitor.c           | 153 +++++++
>>   target-xtensa/Makefile.objs      |   1 +
>>   target-xtensa/monitor.c          |  34 ++
>>   12 files changed, 1032 insertions(+), 851 deletions(-)
>>   create mode 100644 include/monitor/monitor-common.h
>>   create mode 100644 target-i386/monitor.c
>>   create mode 100644 target-ppc/monitor.c
>>   create mode 100644 target-sh4/monitor.c
>>   create mode 100644 target-sparc/monitor.c
>>   create mode 100644 target-xtensa/monitor.c
>> +#if defined(TARGET_SPARC) || defined(TARGET_PPC) || defined(TARGET_I386)
>> +extern const MonitorDef monitor_defs[];
>> +#else
>> +const MonitorDef monitor_defs[] = {};
>>   #endif
> So, rather than having to have a list of which targets provide
> a monitor_defs[], I would suggest that we make the API implemented
> by the target be a function, like:
>     const MonitorDef *target_monitor_defs(void);
> (which just returns a pointer to a static const array in
> the target-*/monitor.c file). Then you can add a file
> stubs/target-monitor-defs.c which provides the "stub" version
> of this function (just returns a pointer to the no-commands
> array). The link process will arrange that the stub version
> is pulled in for any target that doesn't provide its own
> implementation of the function.
>
> Other than that, I suspect we can improve the separation
> out of target-specific things, but this is a good
> improvement and it'll be easier to do the rest as
> incremental fixes on top of this later.
>
> thanks
> -- PMM
Yes, this is a good way if we make the interface: const MonitorDef 
*target_monitor_defs(void);
But we can't include the 'monitor/monitor-common.h' to 
stubs/target-monitor-defs.c, because
there is a dependency with a target-specific headers( such as 
cpu.h:CPUArchState, cpu-defs.h:target_long).
Make a copy of the struct MonitorDef not a good way because we can miss 
the change of copied MonitorDef
in stubs/target-monitor-defs.c and this will result in an bug. Can this 
be solved somehow else?


[-- Attachment #2: Type: text/html, Size: 4439 bytes --]

  parent reply	other threads:[~2015-08-28  9:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12 11:50 [Qemu-devel] [PATCH v2 for 2.5 0/3] Move target- and device specific code from monitor Denis V. Lunev
2015-08-12 11:50 ` [Qemu-devel] [PATCH 1/3] hmp-commands-info: move info_cmds content out of monitor.c Denis V. Lunev
2015-08-27 17:40   ` Peter Maydell
2015-08-12 11:50 ` [Qemu-devel] [PATCH 2/3] monitor: remove target-specific code from monitor.c Denis V. Lunev
2015-08-27 17:31   ` Peter Maydell
2015-08-27 17:37     ` Denis V. Lunev
2015-08-28  9:21     ` Pavel Butsykin [this message]
2015-08-28 10:12       ` Peter Maydell
2015-08-28 14:58         ` Pavel Butsykin
2015-08-12 11:50 ` [Qemu-devel] [PATCH 3/3] monitor: added generation of documentation for hmp-commands-info.hx Denis V. Lunev
2015-08-27 17:39   ` Peter Maydell
2015-08-28  7:00     ` Pavel Butsykin
2015-08-28  8:19       ` Peter Maydell
2015-08-28 14:53         ` Pavel Butsykin
2015-08-18 23:50 ` [Qemu-devel] [PATCH v2 for 2.5 0/3] Move target- and device specific code from monitor Denis V. Lunev
2015-08-25  9:54 ` Denis V. Lunev
2015-08-27 11:27   ` Denis V. Lunev
2015-08-27 12:13     ` Peter Maydell
2015-08-27 12:34       ` Denis V. Lunev
2015-08-28 11:25 ` Markus Armbruster
  -- strict thread matches above, loose matches on Subject: below --
2015-07-02 16:18 [Qemu-devel] (no subject) Denis V. Lunev
2015-07-02 16:18 ` [Qemu-devel] [PATCH 2/3] monitor: remove target-specific code from monitor.c Denis V. Lunev

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=55E02829.6040805@odin.com \
    --to=pbutsykin@odin.com \
    --cc=den@openvz.org \
    --cc=lcapitulino@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pbutsykin@virtuozzo.com \
    --cc=peter.maydell@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.