From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYh5Q-0001le-IU for qemu-devel@nongnu.org; Thu, 08 Dec 2011 11:44:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RYh5P-0001Ef-GC for qemu-devel@nongnu.org; Thu, 08 Dec 2011 11:44:44 -0500 Received: from mail-iy0-f173.google.com ([209.85.210.173]:46623) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYh5P-0001EX-DC for qemu-devel@nongnu.org; Thu, 08 Dec 2011 11:44:43 -0500 Received: by iafj26 with SMTP id j26so3205801iaf.4 for ; Thu, 08 Dec 2011 08:44:42 -0800 (PST) Message-ID: <4EE0E974.2050908@codemonkey.ws> Date: Thu, 08 Dec 2011 10:44:36 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1322857256-14951-1-git-send-email-aliguori@us.ibm.com> <1322857256-14951-14-git-send-email-aliguori@us.ibm.com> <4EE0E578.10905@redhat.com> In-Reply-To: <4EE0E578.10905@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 13/18] dev: add an anonymous peripheral container List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Peter Maydell , Anthony Liguori , Stefan Hajnoczi , Jan Kiszka , qemu-devel@nongnu.org, Luiz Capitulino , Gerd Hoffman , Markus Armbruster On 12/08/2011 10:27 AM, Kevin Wolf wrote: > Am 02.12.2011 21:20, schrieb Anthony Liguori: >> Signed-off-by: Anthony Liguori >> --- >> hw/qdev.c | 21 ++++++++++++++++++++- >> 1 files changed, 20 insertions(+), 1 deletions(-) >> >> diff --git a/hw/qdev.c b/hw/qdev.c >> index af4c6a2..5348f26 100644 >> --- a/hw/qdev.c >> +++ b/hw/qdev.c >> @@ -240,6 +240,19 @@ static DeviceState *qdev_get_peripheral(void) >> return dev; >> } >> >> +static DeviceState *qdev_get_peripheral_anon(void) >> +{ >> + static DeviceState *dev; >> + >> + if (dev == NULL) { >> + dev = qdev_create(NULL, "container"); >> + qdev_property_add_child(qdev_get_root(), "peripheral-anon", dev, NULL); >> + qdev_init_nofail(dev); >> + } >> + >> + return dev; >> +} >> + >> DeviceState *qdev_device_add(QemuOpts *opts) >> { >> const char *driver, *path, *id; >> @@ -292,7 +305,13 @@ DeviceState *qdev_device_add(QemuOpts *opts) >> if (id) { >> qdev->id = id; >> qdev_property_add_child(qdev_get_peripheral(), qdev->id, qdev, NULL); >> - } >> + } else { >> + static int anon_count; >> + gchar *name = g_strdup_printf("device[%d]", anon_count++); > > Does any code depend on this name? If not, I would suggest making it a > bit more convenient for users: g_strdump_printf("%s[%d]", info->name, > info->anon_count++) Nothing does and that's a great suggestion, thanks! Regards, Anthony Liguori > > Kevin >