From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtFlP-0004Bx-TK for qemu-devel@nongnu.org; Thu, 10 Jan 2013 05:53:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TtFlL-0000UG-9S for qemu-devel@nongnu.org; Thu, 10 Jan 2013 05:53:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:4724) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtFlL-0000Ty-25 for qemu-devel@nongnu.org; Thu, 10 Jan 2013 05:53:31 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0AArT0t017164 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 10 Jan 2013 05:53:30 -0500 Message-ID: <50EE9DA7.3040006@redhat.com> Date: Thu, 10 Jan 2013 11:53:27 +0100 From: Gerd Hoffmann MIME-Version: 1.0 References: <1357566928-25361-1-git-send-email-kraxel@redhat.com> <1357566928-25361-6-git-send-email-kraxel@redhat.com> <50EE98FF.3090607@redhat.com> In-Reply-To: <50EE98FF.3090607@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 05/11] chardev: add hmp hotplug commands List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On 01/10/13 11:33, Paolo Bonzini wrote: > Il 07/01/2013 14:55, Gerd Hoffmann ha scritto: >> +void hmp_chardev_add(Monitor *mon, const QDict *qdict) >> +{ >> + const char *args = qdict_get_str(qdict, "args"); >> + Error *err = NULL; >> + QemuOpts *opts; >> + >> + opts = qemu_opts_parse(qemu_find_opts("chardev"), args, 1); >> + if (opts == NULL) { >> + error_setg(&err, "Parsing chardev args failed\n"); >> + } else { >> + qemu_chr_new_from_opts(opts, NULL, &err); > > This ought to use qmp_chardev_add and a generic opts->ChardevBackend > conversion. > > But IMHO, this kind of intermediate conversion is okay, with the > "correct" thing deferred; being able to play with hotplug from HMP is > worth the small wart. It's really Luiz's decision, so I'm not giving > the reviewed-by (yet). Once qmp_chardev_add() can handle everything supported by qemu_chr_new_from_opts we can flip over, make qmp_chardev_add the primary interface and qemu_chr_new_from_opts legacy (which then does the opts->ChardevBackend conversion and calls qmp_chardev_add). We are not there yet, even with the full series applied. And even when we arrive there some day we don't have to touch hmp_chardev_add when making the switch ;) cheers, Gerd