From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtCFR-0002tz-5M for qemu-devel@nongnu.org; Thu, 10 Jan 2013 02:08:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TtCFP-0008Hd-Ur for qemu-devel@nongnu.org; Thu, 10 Jan 2013 02:08:21 -0500 Received: from [220.181.12.15] (port=48881 helo=m12-15.163.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtCFO-0008G1-Ob for qemu-devel@nongnu.org; Thu, 10 Jan 2013 02:08:19 -0500 Message-ID: <50EE68C7.9060606@163.com> Date: Thu, 10 Jan 2013 15:07:51 +0800 From: wenchao xia MIME-Version: 1.0 References: <1356601227-8707-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1356601227-8707-3-git-send-email-xiawenc@linux.vnet.ibm.com> <20130109105758.47a2923b@doriath.home> <50EE35C9.8010904@linux.vnet.ibm.com> In-Reply-To: <50EE35C9.8010904@linux.vnet.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH V3 2/4] HMP: add infrastructure for sub command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: aliguori@us.ibm.com, chenwj@iis.sinica.edu.tw, armbru@redhat.com, qemu-devel@nongnu.org, pbonzini@redhat.com, Luiz Capitulino 于 2013-1-10 11:30, Wenchao Xia 写道: >>> -static const mon_cmd_t *qmp_find_cmd(const char *cmdname) >>> -{ >>> - return search_dispatch_table(qmp_cmds, cmdname); >>> -} >> >> Touching qmp_find_cmd() is unrelated to this series. >> > OK. > >>> - >>> -static const mon_cmd_t *monitor_parse_command(Monitor *mon, >>> - const char *cmdline, >>> - QDict *qdict) >>> +/* >>> + * Try find the target mon_cmd_t instance, if it have sub_table and >>> have string >>> + * for it, this function will try search it with remain string, and >>> if not >>> + * found it return NULL. >>> + */ >>> +static const mon_cmd_t *hmp_parse_command(Monitor *mon, >>> + const char *cmdline, >>> + mon_cmd_t *table, >>> + QDict *qdict) >> >> Renaming is also not necessary, but if you do it please do in a different >> patch. >> > OK. > >>> { >>> + } >>> + return hmp_parse_command(mon, p, cmd->sub_table, qdict); >> >> This works, and seems less hack then the previous attempt. >> >> Except for a small detail. This: >> >> (qemu) info bla >> >> Currently returns a list of info commands, but with this series it >> returns >> an error. >> > Yep, I think command completion is another topic, but I am pretty > sure it can be solved in this framework, for that it is not hack and > what need to do is, let command completion function knows there may be > another sub layer too. > Sorry I missed your point. Returning an error instead of info commands, is made on purpose. IMHO always print the commands make user confused, message tipping what is wrong is better. >> I'd like to get a reviewed-by from Markus before applying this as, >> besides >> this being his idea, I honestly have a very hard time knowing how to >> move old >> hmp hackery forward. >>