From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MzC1S-0004xp-0q for qemu-devel@nongnu.org; Sat, 17 Oct 2009 12:20:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MzC1N-0004ty-Eb for qemu-devel@nongnu.org; Sat, 17 Oct 2009 12:20:49 -0400 Received: from [199.232.76.173] (port=56723 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MzC1N-0004ts-6r for qemu-devel@nongnu.org; Sat, 17 Oct 2009 12:20:45 -0400 Received: from mail-pw0-f43.google.com ([209.85.160.43]:39867) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MzC1M-0005KH-SU for qemu-devel@nongnu.org; Sat, 17 Oct 2009 12:20:45 -0400 Received: by pwj1 with SMTP id 1so429503pwj.2 for ; Sat, 17 Oct 2009 09:20:42 -0700 (PDT) Message-ID: <4AD9EED7.7090103@codemonkey.ws> Date: Sat, 17 Oct 2009 11:20:39 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 5/7] add json encoder for qobjects References: <1255766136-3028-1-git-send-email-pbonzini@redhat.com> <1255766136-3028-6-git-send-email-pbonzini@redhat.com> <4AD9C0B0.4050804@codemonkey.ws> <4AD9CA39.8060307@redhat.com> In-Reply-To: <4AD9CA39.8060307@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, Luiz Capitulino Paolo Bonzini wrote: > On 10/17/2009 03:03 PM, Anthony Liguori wrote: >> >> I think it makes more sense as an external entity. > > Maybe... I just thought of it as a toString method that happens to > emit JSON. json is one representation of the monitor protocol. I think we should attempt to design things so that there is a clear separate of representation from the implementation. BTW, the next thing I'd like to do this weekend is write a QObject decoded based on the json parser. So that you can do something like: int locked, readonly; char *file; err = qobject_unmarshal(obj, "{'locked': %i, 'file': %s, 'readonly': %i}", &locked, &file, &readonly); I think this would tremendously simplify the monitor command implementations. Regards, Anthony Liguori