Message ID | 1253132733-10409-2-git-send-email-kraxel@redhat.com |
---|---|
State | Superseded |
Headers | show |
On 09/16/2009 10:25 PM, Gerd Hoffmann wrote:
> +void qbus_create_inplace(BusState *bus, BusInfo *info,
qbus_init?
Paolo
On 09/16/2009 10:25 PM, Gerd Hoffmann wrote:
> + int qdev_allocated;
Also, this member seems write-only.
Paolo
On 09/17/09 08:41, Paolo Bonzini wrote: > On 09/16/2009 10:25 PM, Gerd Hoffmann wrote: >> +void qbus_create_inplace(BusState *bus, BusInfo *info, > > qbus_init? I'd prefer to keep it named simliar to the allocating version to avoid confusion ... cheers, Gerd
On 09/17/09 08:42, Paolo Bonzini wrote: > On 09/16/2009 10:25 PM, Gerd Hoffmann wrote: >> + int qdev_allocated; > > Also, this member seems write-only. Yes, there is no qbus_destroy yet. So now this just serves as reminder that we'll need to keep track of it ;) cheers, Gerd
On 09/17/09 09:58, Gerd Hoffmann wrote: > On 09/17/09 08:42, Paolo Bonzini wrote: >> On 09/16/2009 10:25 PM, Gerd Hoffmann wrote: >>> + int qdev_allocated; >> >> Also, this member seems write-only. > > Yes, there is no qbus_destroy yet. Which is actually a bug. If you hot-unplug a virtual usb mass storage device the associated scsi bus should go away. It doesn't though. Will include a fix when respinning the series. cheers, Gerd
On 09/17/2009 09:51 AM, Gerd Hoffmann wrote: > On 09/17/09 08:41, Paolo Bonzini wrote: >> On 09/16/2009 10:25 PM, Gerd Hoffmann wrote: >>> +void qbus_create_inplace(BusState *bus, BusInfo *info, >> >> qbus_init? > > I'd prefer to keep it named simliar to the allocating version to avoid > confusion ... Yeah, since you're going to destroy both of them with the same function it makes sense. Paolo
diff --git a/hw/qdev.c b/hw/qdev.c index 43b1beb..43372c1 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -502,13 +502,12 @@ static BusState *qbus_find(const char *path) } } -BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name) +void qbus_create_inplace(BusState *bus, BusInfo *info, + DeviceState *parent, const char *name) { - BusState *bus; char *buf; int i,len; - bus = qemu_mallocz(info->size); bus->info = info; bus->parent = parent; @@ -537,6 +536,16 @@ BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name) QLIST_INSERT_HEAD(&parent->child_bus, bus, sibling); parent->num_child_bus++; } + +} + +BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name) +{ + BusState *bus; + + bus = qemu_mallocz(info->size); + bus->qdev_allocated = 1; + qbus_create_inplace(bus, info, parent, name); return bus; } diff --git a/hw/qdev.h b/hw/qdev.h index 623ded5..ccc45b9 100644 --- a/hw/qdev.h +++ b/hw/qdev.h @@ -47,6 +47,7 @@ struct BusState { DeviceState *parent; BusInfo *info; const char *name; + int qdev_allocated; QLIST_HEAD(, DeviceState) children; QLIST_ENTRY(BusState) sibling; }; @@ -144,6 +145,8 @@ BusState *qdev_get_parent_bus(DeviceState *dev); /*** BUS API. ***/ +void qbus_create_inplace(BusState *bus, BusInfo *info, + DeviceState *parent, const char *name); BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name); #define FROM_QBUS(type, dev) DO_UPCAST(type, qbus, dev)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- hw/qdev.c | 15 ++++++++++++--- hw/qdev.h | 3 +++ 2 files changed, 15 insertions(+), 3 deletions(-)