From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=50609 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJ2vF-00031W-5Y for qemu-devel@nongnu.org; Mon, 31 May 2010 07:12:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJ2vD-0000xb-Vl for qemu-devel@nongnu.org; Mon, 31 May 2010 07:12:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17771) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJ2vD-0000xW-OS for qemu-devel@nongnu.org; Mon, 31 May 2010 07:12:43 -0400 From: Markus Armbruster Subject: Re: [Qemu-devel] [PATCH v3 04/17] qdev: Give qtree names precedence over user-assigned IDs References: <3715da16813f7cdcb7ec023167a84a94e8a37089.1274612367.git.jan.kiszka@web.de> <4C021ED5.1080703@redhat.com> <4C038882.3080007@redhat.com> Date: Mon, 31 May 2010 13:12:40 +0200 In-Reply-To: <4C038882.3080007@redhat.com> (Gerd Hoffmann's message of "Mon, 31 May 2010 11:59:30 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Anthony Liguori , Juan Quintela , Jan Kiszka , qemu-devel@nongnu.org, Luiz Capitulino , Blue Swirl , Jan Kiszka , Avi Kivity Gerd Hoffmann writes: >> pci_add nic -net use either the ID or option "name" of qemu_net_opts. >> And there's our hole. Reproducible with "-net user -net nic,id=foo >> -device lsi,id=foo". > > Oh. Well. Yes, better plug that. > >> @@ -242,6 +243,10 @@ DeviceState *qdev_device_add(QemuOpts *opts) >> qdev = qdev_create_from_info(bus, info); >> id = qemu_opts_id(opts); >> if (id) { >> + if (qdev_find_recursive(main_system_bus, id)) { >> + qerror_report(QERR_DUPLICATE_ID, id, "device"); >> + return NULL; >> + } >> qdev->id = id; >> } >> if (qemu_opt_foreach(opts, set_property, qdev, 1) != 0) { > > Looks good.. > > Acked-by: Gerd Hoffmann I'll repost it as a well-formed patch. While there, I'll outlaw "/". What about requiring IDs to start with a letter? Just in case we ever want to add alias names that must not clash with user-specified IDs.