[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 37/36] qdev: device_del: search for to be unp
From: |
Igor Mammedov |
Subject: |
Re: [Qemu-devel] [PATCH v2 37/36] qdev: device_del: search for to be unplugged device in 'peripheral' container |
Date: |
Tue, 7 Oct 2014 14:10:18 +0200 |
On Tue, 7 Oct 2014 19:59:51 +0800
Zhu Guihua <address@hidden> wrote:
> On Thu, 2014-10-02 at 10:08 +0000, Igor Mammedov wrote:
> > device_add puts every device with 'id' inside of 'peripheral'
> > container using id's value as the last component name.
> > Use it by replacing recursive search on sysbus with path
> > lookup in 'peripheral' container, which could handle both
> > BUS and BUS-less device cases.
> >
>
> If I want to delete device without id inside of 'peripheral-anon'
> container, the command 'device_del' does not work.
> My suggestion is deleting device by the last component name, is this
> feasiable?
So far device_del was designed to work only with id-ed devices.
What's a use-case for unplugging unnamed device from peripheral-anon?
> Thanks.
>
> Zhu
>
> > Signed-off-by: Igor Mammedov <address@hidden>
> > ---
> > qdev-monitor.c | 13 +++++++++----
> > 1 file changed, 9 insertions(+), 4 deletions(-)
> >
> > diff --git a/qdev-monitor.c b/qdev-monitor.c
> > index c721451..754437b 100644
> > --- a/qdev-monitor.c
> > +++ b/qdev-monitor.c
> > @@ -686,15 +686,20 @@ int do_device_add(Monitor *mon, const QDict *qdict,
> > QObject **ret_data)
> >
> > void qmp_device_del(const char *id, Error **errp)
> > {
> > - DeviceState *dev;
> > + Object *obj;
> > + char *root_path = object_get_canonical_path(qdev_get_peripheral());
> > + char *path = g_strdup_printf("%s/%s", root_path, id);
> >
> > - dev = qdev_find_recursive(sysbus_get_default(), id);
> > - if (!dev) {
> > + g_free(root_path);
> > + obj = object_resolve_path_type(path, TYPE_DEVICE, NULL);
> > + g_free(path);
> > +
> > + if (!obj) {
> > error_set(errp, QERR_DEVICE_NOT_FOUND, id);
> > return;
> > }
> >
> > - qdev_unplug(dev, errp);
> > + qdev_unplug(DEVICE(obj), errp);
> > }
> >
> > void qdev_machine_init(void)
>
>
- [Qemu-devel] [PATCH v2 37/36] qdev: device_del: search for to be unplugged device in 'peripheral' container, Igor Mammedov, 2014/10/02
- Re: [Qemu-devel] [PATCH v2 37/36] qdev: device_del: search for to be unplugged device in 'peripheral' container, Zhu Guihua, 2014/10/07
- Re: [Qemu-devel] [PATCH v2 37/36] qdev: device_del: search for to be unplugged device in 'peripheral' container,
Igor Mammedov <=
- Re: [Qemu-devel] [PATCH v2 37/36] qdev: device_del: search for to be unplugged device in 'peripheral' container, Andreas Färber, 2014/10/07
- Re: [Qemu-devel] [PATCH v2 37/36] qdev: device_del: search for to be unplugged device in 'peripheral' container, Igor Mammedov, 2014/10/07
- Re: [Qemu-devel] [PATCH v2 37/36] qdev: device_del: search for to be unplugged device in 'peripheral' container, Zhu Guihua, 2014/10/07
- Re: [Qemu-devel] [PATCH v2 37/36] qdev: device_del: search for to be unplugged device in 'peripheral' container, Paolo Bonzini, 2014/10/08
- Re: [Qemu-devel] [PATCH v2 37/36] qdev: device_del: search for to be unplugged device in 'peripheral' container, Zhu Guihua, 2014/10/08
- Re: [Qemu-devel] [PATCH v2 37/36] qdev: device_del: search for to be unplugged device in 'peripheral' container, Markus Armbruster, 2014/10/09