From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:50435) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5twN-0007Zc-Nu for qemu-devel@nongnu.org; Tue, 20 Sep 2011 02:36:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R5twM-0007MC-Rh for qemu-devel@nongnu.org; Tue, 20 Sep 2011 02:36:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17892) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5twM-0007M7-JH for qemu-devel@nongnu.org; Tue, 20 Sep 2011 02:36:22 -0400 Message-ID: <4E78345E.5080300@redhat.com> Date: Tue, 20 Sep 2011 08:36:14 +0200 From: Gerd Hoffmann MIME-Version: 1.0 References: <1316188834-13675-1-git-send-email-aliguori@us.ibm.com> <1316188834-13675-5-git-send-email-aliguori@us.ibm.com> <4E76F074.4030801@redhat.com> <4E776D6D.2040702@codemonkey.ws> In-Reply-To: <4E776D6D.2040702@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 04/14] qdev: take ownership of id pointer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Peter Maydell , Anthony Liguori , Jan Kiszka , qemu-devel@nongnu.org, Markus Armbruster , Paolo Bonzini On 09/19/11 18:27, Anthony Liguori wrote: > On 09/19/2011 02:34 AM, Gerd Hoffmann wrote: >> FYI: Keeping the pointer to the QemuOpts has one more reason: It will >> free the >> QemuOpts on hot-unplug, which is needed to free the id from QemuOpts >> point of >> view, which in turn allows to re-use the id when hot-plugging the same >> (or >> another) device later on. > > You mean, tie QemuOpts life cycle to devices life cycle Yes. > such that you > cannot accidentally create a non-device QemuOpts that conflicts with the > id of a device? Device QemuOpts have their own id namespace, so this is just about conflicts within devices. This ... device_add e1000,id=nic1 device_del nic1 device_add e1000,id=nic1 ... will work only if you free the QemuOpts when deleting a device, otherwise QemuOpts will complain that nic1 is used already. cheers, Gerd