qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org,
	chenwj@iis.sinica.edu.tw,
	Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [PATCH V5 4/6] HMP: filter out space before check of sub-command
Date: Tue, 15 Jan 2013 11:06:27 +0800	[thread overview]
Message-ID: <50F4C7B3.7040303@linux.vnet.ibm.com> (raw)
In-Reply-To: <87zk0bx4g4.fsf@blackfin.pond.sub.org>

于 2013-1-14 21:46, Markus Armbruster 写道:
> Wenchao Xia <xiawenc@linux.vnet.ibm.com> writes:
>
>> 于 2013-1-12 4:12, Luiz Capitulino 写道:
>>> On Fri, 11 Jan 2013 17:14:03 +0800
>>> Wenchao Xia <xiawenc@linux.vnet.ibm.com> wrote:
>>>
>>>>     This fix the case when user input "@command ". Original
>>>> it will return NULL for monitor_parse_command(), now
>>>> it will return the @command related instance.
>>>>
>>>> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
>>>> ---
>>>>    monitor.c |    3 +++
>>>>    1 files changed, 3 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/monitor.c b/monitor.c
>>>> index 5435dc3..7b752a2 100644
>>>> --- a/monitor.c
>>>> +++ b/monitor.c
>>>> @@ -3588,6 +3588,9 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon,
>>>>        if (cmd->sub_table != NULL) {
>>>>            p1 = p;
>>>>            /* check if user set additional command */
>>>> +        while (qemu_isspace(*p1)) {
>>>> +            p1++;
>>>> +        }
>>>
>>> Is there a reason for this to be in a different patch? I mean, why don't
>>> you squash this into the previous patch?
>>>
>>    Markus suggest to do it
>
> Misunderstanding, sorry.  My point was we skip over whitespace twice:
> first here, and then again in monitor_parse_command().  Quote:
>
>      The check whether non-space characters follow is awkward.  We need
>      it only because we want to handle "@cmdline is blank" differently
>      than "it can't be parsed", but monitor_parse_command() returns NULL
>      for both cases.
>
> Merely an observation, not a request to do anything about it in this
> series:
>
>      If we care, we can try to do better in a follow-up patch.
>
> A possible way to do better is to have a handler for command "", to be
> invoked for entirely blank lines.  In table info_cmds, the handler would
> be do_info_help.  Then prefix commands don't need their handler anymore
> (it's in the sub_table), and sub_table can go into the mhandler union.
>
   Thanks for the declaration. Have a handler for command "" seems good,
but need a careful check about the parsing code since '\0' is a key
value. *sub_table plays an extra role of tagging if it have sub-commands
so I think it is better to not folder it into mhandler union.

> We'd need to suppress the "unknown command" error for cmdname "".
>
> If this isn't clear, but you want to understand it, I can write a patch
> on top.
>
>>                            and I think this make things clear. I am OK
>> to merge it and drop p1.
>
> I'm not sure it makes things clearer.  It makes behavior of "info"
> without argument change twice in the series, though, in the preceding
> patch, and in this one.  I think I agree with Luiz it's better to squash
> the two together again.
>
> [...]
>


-- 
Best Regards

Wenchao Xia

  parent reply	other threads:[~2013-01-15  3:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-11  9:13 [Qemu-devel] [PATCH V5 0/6] HMP: allow parsing for sub command Wenchao Xia
2013-01-11  9:14 ` [Qemu-devel] [PATCH V5 1/6] HMP: add QDict to info callback handler Wenchao Xia
2013-01-11  9:14 ` [Qemu-devel] [PATCH V5 2/6] HMP: delete info handler Wenchao Xia
2013-01-11  9:14 ` [Qemu-devel] [PATCH V5 3/6] HMP: add infrastructure for sub command Wenchao Xia
2013-01-11  9:14 ` [Qemu-devel] [PATCH V5 4/6] HMP: filter out space before check of sub-command Wenchao Xia
2013-01-11 20:12   ` Luiz Capitulino
2013-01-14  2:11     ` Wenchao Xia
2013-01-14 13:46       ` Markus Armbruster
2013-01-14 15:33         ` Luiz Capitulino
2013-01-15  3:06         ` Wenchao Xia [this message]
2013-01-11  9:14 ` [Qemu-devel] [PATCH V5 5/6] HMP: move define of mon_cmds Wenchao Xia
2013-01-11  9:14 ` [Qemu-devel] [PATCH V5 6/6] HMP: add sub command table to info Wenchao Xia

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=50F4C7B3.7040303@linux.vnet.ibm.com \
    --to=xiawenc@linux.vnet.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=armbru@redhat.com \
    --cc=chenwj@iis.sinica.edu.tw \
    --cc=lcapitulino@redhat.com \
    --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).