From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCtS9-0005en-F9 for qemu-devel@nongnu.org; Thu, 21 Apr 2011 08:57:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QCtS8-0006N9-Kl for qemu-devel@nongnu.org; Thu, 21 Apr 2011 08:57:49 -0400 Received: from e35.co.us.ibm.com ([32.97.110.153]:53946) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCtS8-0006N3-Fj for qemu-devel@nongnu.org; Thu, 21 Apr 2011 08:57:48 -0400 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e35.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p3LCfVbT005475 for ; Thu, 21 Apr 2011 06:41:31 -0600 Received: from d03av05.boulder.ibm.com (d03av05.boulder.ibm.com [9.17.195.85]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id A01ED7M0072992 for ; Thu, 1 Jan 1970 07:13:07 -0700 Received: from d03av05.boulder.ibm.com (loopback [127.0.0.1]) by d03av05.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p3LCvkHt014064 for ; Thu, 21 Apr 2011 06:57:46 -0600 Message-ID: <4DB029C8.9030009@linux.vnet.ibm.com> Date: Thu, 21 Apr 2011 07:57:44 -0500 From: Michael Roth MIME-Version: 1.0 References: <1303138953-1334-1-git-send-email-mdroth@linux.vnet.ibm.com> <1303138953-1334-10-git-send-email-mdroth@linux.vnet.ibm.com> <4DAFEB3B.5070109@redhat.com> In-Reply-To: <4DAFEB3B.5070109@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC][PATCH v2 09/17] qmp proxy: core code for proxying qmp requests to guest List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jes Sorensen Cc: aliguori@linux.vnet.ibm.com, agl@linux.vnet.ibm.com, qemu-devel@nongnu.org On 04/21/2011 03:30 AM, Jes Sorensen wrote: > On 04/18/11 17:02, Michael Roth wrote: >> diff --git a/qmp-core.c b/qmp-core.c >> index 9f3d182..dab50a1 100644 >> --- a/qmp-core.c >> +++ b/qmp-core.c >> @@ -937,7 +937,15 @@ void qmp_async_complete_command(QmpCommandState *cmd, QObject *retval, Error *er >> qemu_free(cmd); >> } >> >> +extern QmpProxy *qmp_proxy_default; > > Please put this in a header file. > >> +static void qmp_proxy_process_control_event(QmpProxy *p, const QDict *evt) >> +{ >> + const char *cmd; >> + int host_sid, guest_sid; >> + >> + cmd = qdict_get_try_str(evt, "_control_event"); >> + if (!cmd) { >> + fprintf(stderr, "received NULL control event\n"); >> + } else if (strcmp(cmd, "guest_ack") == 0) { >> + host_sid = qdict_get_try_int(evt, "_control_arg_host_sid", 0); >> + if (!host_sid) { >> + fprintf(stderr, "invalid guest_ack: wrong host sid\n"); >> + return; >> + } >> + /* guest responded to host_init, return a host_ack */ >> + /* reset outstanding requests, then send an ack with the >> + * session id they passed us >> + */ >> + guest_sid = qdict_get_try_int(evt, "_control_arg_guest_sid", 0); > > I am wondering if it would make sense to put these arguments in a header > file as #define's to make sure you don't have to chase down a typo on > one side at some point? Just an idea, dunno if it is worth it. That's probably a good idea. > > Cheers, > Jes