From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VDzAN-0003c7-Vb for qemu-devel@nongnu.org; Mon, 26 Aug 2013 11:57:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VDzAF-0004fX-J8 for qemu-devel@nongnu.org; Mon, 26 Aug 2013 11:57:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34697) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VDzAF-0004fQ-9x for qemu-devel@nongnu.org; Mon, 26 Aug 2013 11:57:11 -0400 Date: Mon, 26 Aug 2013 11:55:20 -0400 From: Luiz Capitulino Message-ID: <20130826115520.60617e53@redhat.com> In-Reply-To: <1377245887-22745-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1377245887-22745-1-git-send-email-xiawenc@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH V9 00/15] monitor: support sub command group in auto completion and help List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com On Fri, 23 Aug 2013 16:17:52 +0800 Wenchao Xia wrote: > This series make auto completion and help functions works normal for sub > command, by using reentrant functions. In order to do that, global variab= les > are not directly used in those functions any more. With this series, cmd_= table > is a member of structure Monitor so it is possible to create a monitor wi= th > different command table now, auto completion will work in that monitor. In > short, "info" is not treated as a special case now, this series ensure he= lp > and auto complete function works normal for any sub command added in the = future. >=20 > Patch 5 replaced cur_mon with rs->mon, it is safe because: > monitor_init() calls readline_init() which initialize mon->rs, result is > mon->rs->mon =3D=3D mon. Then qemu_chr_add_handlers() is called, which ma= ke > monitor_read() function take *mon as its opaque. Later, when user input, > monitor_read() is called, where cur_mon is set to *mon by "cur_mon =3D op= aque". > If qemu's monitors run in one thread, then later in readline_handle_byte() > and readline_comletion(), cur_mon is actually equal to rs->mon, in another > word, it points to the monitor instance, so it is safe to replace *cur_mon > in those functions. >=20 > Thanks for Luiz and Eric for reviewing. This one doesn't even build :( /home/lcapitulino/work/src/upstream/qmp-unstable/monitor.c: In function =E2= =80=98help_cmd=E2=80=99: /home/lcapitulino/work/src/upstream/qmp-unstable/monitor.c:952:1: error: la= bel =E2=80=98cleanup=E2=80=99 defined but not used [-Werror=3Dunused-label] cc1: all warnings being treated as errors make[1]: *** [monitor.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [subdir-x86_64-softmmu] Error 2