diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2012-03-14 17:37:38 -0300 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2012-04-09 14:35:25 -0300 |
commit | 56f9107e439c32aa00d58d117a9b664551328f1e (patch) | |
tree | edd83ebd19c90a406e1d23c5dc5220593cbf5673 /hw/xen_platform.c | |
parent | 7914cb3c738a03a5d5f7cb32c3768bc62eb1e944 (diff) | |
download | qemu-56f9107e439c32aa00d58d117a9b664551328f1e.zip qemu-56f9107e439c32aa00d58d117a9b664551328f1e.tar.gz qemu-56f9107e439c32aa00d58d117a9b664551328f1e.tar.bz2 |
qdev: qdev_unplug(): use error_set()
It currently uses qerror_report(), but next commit will convert
the drive_del command to the QAPI and this requires using
error_set().
One particularity of qerror_report() is that it knows when it's
running on monitor context or command-line context and prints the
error message accordingly. error_set() doesn't do this, so we
have to be careful not to drop error messages.
qdev_unplug() has three kinds of usages:
1. It's called when hot adding a device fails, to undo anything
that has been done before hitting the error
2. It's called by function monitor functions like device_del(),
to unplug a device
3. It's used by xen_platform.c in a way that doesn't _seem_ to
be in monitor context
Only item 2 can print an error message to the user, this commit
maintains that.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Diffstat (limited to 'hw/xen_platform.c')
-rw-r--r-- | hw/xen_platform.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/xen_platform.c b/hw/xen_platform.c index 5a7c4cc..a9c52a6 100644 --- a/hw/xen_platform.c +++ b/hw/xen_platform.c @@ -87,7 +87,7 @@ static void unplug_nic(PCIBus *b, PCIDevice *d) { if (pci_get_word(d->config + PCI_CLASS_DEVICE) == PCI_CLASS_NETWORK_ETHERNET) { - qdev_unplug(&(d->qdev)); + qdev_unplug(&(d->qdev), NULL); } } @@ -100,7 +100,7 @@ static void unplug_disks(PCIBus *b, PCIDevice *d) { if (pci_get_word(d->config + PCI_CLASS_DEVICE) == PCI_CLASS_STORAGE_IDE) { - qdev_unplug(&(d->qdev)); + qdev_unplug(&(d->qdev), NULL); } } |