From: Luiz Capitulino <lcapitulino@redhat.com>
To: Zhou Yuan <zhouyuan.fnst@cn.fujitsu.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] monitor.c : fix the monitor_user_noop function for hmp-commands calling user_print conveniently
Date: Thu, 31 Oct 2013 15:22:10 -0400 [thread overview]
Message-ID: <20131031152210.2e0317bd@redhat.com> (raw)
In-Reply-To: <201310301710276996796@cn.fujitsu.com>
On Wed, 30 Oct 2013 17:10:29 +0800
"Zhou Yuan" <zhouyuan.fnst@cn.fujitsu.com> wrote:
> From: zhouy <zhouyuan.fnst@cn.fujitsu.com>
> To: qemu-devel@nongnu.org
> Date: Wed, 30 Oct 2013 12:37:51 -0400
> Subject: [PATCH] fix the monitor_user_noop function for hmp-commands calling user_print conveniently
> If a new hmp command added,just using the function call "monitor_user_noop" to print the result in the monitor model.
> The function is alreadly existed but not have been fixed.
Not sure what you're trying to accomplish here, but monitor_user_noop() is
legacy and shouldn't be touched. If you to add a new command, taking a
look at docs/writing-qmp-commands.txt may be helpful.
>
> Cc: Luiz Capitulino <lcapitulino@redhat.com>
> Signed-off-by: zhouy <zhouyuan.fnst@cn.fujitsu.com>
> ---
> qemu-master/monitor.c | 23 ++++++++++++++++++++++-
> 1 files changed, 22 insertions(+), 1 deletions(-)
>
> diff --git a/qemu-master/monitor.c b/qemu-master/monitor.c
> index 0aeaf6c..8aa24da 100644
> --- a/qemu-master/monitor.c
> +++ b/qemu-master/monitor.c
> @@ -387,7 +387,28 @@ static int GCC_FMT_ATTR(2, 3) monitor_fprintf(FILE *stream,
> return 0;
> }
>
> -static void monitor_user_noop(Monitor *mon, const QObject *data) { }
> +static void monitor_user_noop(Monitor *mon, const QObject *data)
> +{
> + switch ((*data->type).code) {
> + case QTYPE_QSTRING:{
> + const char *result = qstring_get_str(qobject_to_qstring(data));
> + monitor_printf(mon, "%s\n", result);
> + break;
> + }
> + case QTYPE_QINT:{
> + int result = qint_get_int(qobject_to_qint(data));
> + monitor_printf(mon, "%d\n", result);
> + break;
> + }
> + case QTYPE_QFLOAT:{
> + double result = qfloat_get_double(qobject_to_qfloat(data));
> + monitor_printf(mon, "%.3f\n", result);
> + break;
> + }
> + default:
> + break;
> + }
> +}
>
> static inline int handler_is_qobject(const mon_cmd_t *cmd)
> {
prev parent reply other threads:[~2013-10-31 19:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-30 9:10 [Qemu-devel] [PATCH] monitor.c : fix the monitor_user_noop function for hmp-commands calling user_print conveniently Zhou Yuan
2013-10-31 19:22 ` Luiz Capitulino [this message]
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=20131031152210.2e0317bd@redhat.com \
--to=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=zhouyuan.fnst@cn.fujitsu.com \
/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.