Received: from eggs.gnu.org ([208.118.235.92]:38580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5m5F-0004gZ-FC for qemu-devel@nongnu.org; Sun, 26 Aug 2012 19:17:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T5m5D-0003cf-Hu for qemu-devel@nongnu.org; Sun, 26 Aug 2012 19:17:33 -0400 Received: from cpe-70-123-140-180.austin.res.rr.com ([70.123.140.180]:50521 helo=localhost6.localdomain6) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5m5D-0003cZ-Bi for qemu-devel@nongnu.org; Sun, 26 Aug 2012 19:17:31 -0400 From: Anthony Liguori Date: Sun, 26 Aug 2012 10:51:36 -0500 Message-Id: <1345996298-4892-8-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1345996298-4892-1-git-send-email-aliguori@us.ibm.com> References: <1345996298-4892-1-git-send-email-aliguori@us.ibm.com> Subject: [Qemu-devel] [PATCH 7/9] qdev: add notifier for when the device loses its parent bus (eject) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Anthony Liguori , Liu Ping Fan , Andreas Faerber Signed-off-by: Anthony Liguori --- hw/qdev.c | 2 ++ hw/qdev.h | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index fdee91f..86e1337 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -672,6 +672,8 @@ static void device_initfn(Object *obj) object_property_add_link(OBJECT(dev), "parent_bus", TYPE_BUS, (Object **)&dev->parent_bus, NULL); + + notifier_list_init(&dev->eject_notifier); } /* Unlink device from bus and free the structure. */ diff --git a/hw/qdev.h b/hw/qdev.h index 3561e3a..5009072 100644 --- a/hw/qdev.h +++ b/hw/qdev.h @@ -8,6 +8,7 @@ #include "qapi/qapi-visit-core.h" #include "qemu/object.h" #include "error.h" +#include "notify.h" typedef struct Property Property; @@ -76,6 +77,8 @@ struct DeviceState { int num_child_bus; int instance_id_alias; int alias_required_for_version; + + NotifierList eject_notifier; }; #define TYPE_BUS "bus" -- 1.7.5.4