Received: from eggs.gnu.org ([2001:4830:134:3::10]:50070) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZyvF-0004Cm-Ks for qemu-devel@nongnu.org; Wed, 17 Aug 2016 07:22:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bZyvA-00088A-Qv for qemu-devel@nongnu.org; Wed, 17 Aug 2016 07:22:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56204) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZyvA-000885-Lc for qemu-devel@nongnu.org; Wed, 17 Aug 2016 07:22:08 -0400 References: <1471149312-28148-1-git-send-email-ashish.mittal@veritas.com> <20160815102046.GC13261@redhat.com> From: Paolo Bonzini Message-ID: <23ea8348-7ed9-7e45-1079-235614dc90c2@redhat.com> Date: Wed, 17 Aug 2016 13:22:01 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 RFC] block/vxhs: Initial commit to add Veritas HyperScale VxHS block device support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: ashish mittal , "Daniel P. Berrange" Cc: qemu-devel@nongnu.org, kwolf@redhat.com, armbru@redhat.com, Ashish Mittal , Stefan Hajnoczi , Ketan.Nilangekar@veritas.com, Abhijit.Dey@veritas.com On 15/08/2016 18:29, ashish mittal wrote: >>> +/* >>> + * Convert the json formatted command line into qapi. >>> +*/ >>> + >>> +static int vxhs_parse_json(BlockdevOptionsVxHS *conf, >>> + QDict *options, Error **errp) >>> +{ > ... >>> + errno = EINVAL; >>> + return -errno; >>> +} >> >> Ewww this is really horrible code. It is open-coding a special purpose >> conversion of QemuOpts -> QDict -> QAPI scheme. We should really put >> my qdict_crumple() API impl as a pre-requisite of this, so you can then >> use qdict_crumple + qmp_input_visitor to do this conversion in a generic >> manner removing all this code. >> >> https://lists.gnu.org/archive/html/qemu-devel/2016-07/msg03118.html >> > > Thanks for the suggestions. I will try to incorporate them in the next > version. Actually, I used block/gluster.c for reference (as advised). > This is exactly how it parses json CLI options. It also implements the > *parse_uri() in a similar way. I think I pointed you to block/nbd.c instead, which works as Kevin suggested. Paolo