From: Liu Ping Fan <qemulist@gmail.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Liu Ping Fan <pingfank@linux.vnet.ibm.com>,
Avi Kivity <avi@redhat.com>,
Anthony Liguori <anthony@codemonkey.ws>
Subject: [Qemu-devel] [PATCH 08/10] qdev: rename qdev_unplug to qdev_unplug_req
Date: Fri, 24 Aug 2012 17:49:21 +0800 [thread overview]
Message-ID: <1345801763-24227-9-git-send-email-qemulist@gmail.com> (raw)
In-Reply-To: <1345801763-24227-1-git-send-email-qemulist@gmail.com>
From: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
Unplug divides into two steps: request and complete
The name "req" show more clearly about its meaning
and as to the complete, it is qdev_delete_subtree()
Also adding ret to indicate the request can be eject or not
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
hw/pci-hotplug.c | 4 ++--
hw/qdev-monitor.c | 2 +-
hw/qdev.c | 7 ++++---
hw/qdev.h | 2 +-
hw/scsi-bus.c | 4 ++--
hw/usb/dev-storage.c | 2 +-
hw/xen_platform.c | 2 +-
7 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c
index e7fb780..6faff33 100644
--- a/hw/pci-hotplug.c
+++ b/hw/pci-hotplug.c
@@ -192,7 +192,7 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
dev = NULL;
if (dev && dinfo) {
if (scsi_hot_add(mon, &dev->qdev, dinfo, 0) != 0) {
- qdev_unplug(&dev->qdev, NULL);
+ qdev_unplug_req(&dev->qdev, NULL);
dev = NULL;
}
}
@@ -271,7 +271,7 @@ static int pci_device_hot_remove(Monitor *mon, const char *pci_addr)
return -1;
}
- qdev_unplug(&d->qdev, &local_err);
+ qdev_unplug_req(&d->qdev, &local_err);
if (error_is_set(&local_err)) {
monitor_printf(mon, "%s\n", error_get_pretty(local_err));
error_free(local_err);
diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c
index 018b386..fdd9539 100644
--- a/hw/qdev-monitor.c
+++ b/hw/qdev-monitor.c
@@ -606,7 +606,7 @@ void qmp_device_del(const char *id, Error **errp)
return;
}
- qdev_unplug(dev, errp);
+ qdev_unplug_req(dev, errp);
}
void qdev_machine_init(void)
diff --git a/hw/qdev.c b/hw/qdev.c
index d6c8130..e2339a1 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -194,13 +194,13 @@ void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id,
dev->alias_required_for_version = required_for_version;
}
-void qdev_unplug(DeviceState *dev, Error **errp)
+int qdev_unplug_req(DeviceState *dev, Error **errp)
{
DeviceClass *dc = DEVICE_GET_CLASS(dev);
if (!dev->parent_bus->allow_hotplug) {
error_set(errp, QERR_BUS_NO_HOTPLUG, dev->parent_bus->name);
- return;
+ return -1;
}
assert(dc->unplug != NULL);
@@ -208,8 +208,9 @@ void qdev_unplug(DeviceState *dev, Error **errp)
if (dc->unplug(dev) < 0) {
error_set(errp, QERR_UNDEFINED_ERROR);
- return;
+ return -1;
}
+ return 0;
}
static int qdev_reset_one(DeviceState *dev, void *opaque)
diff --git a/hw/qdev.h b/hw/qdev.h
index 6f97990..182cfa5 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -160,7 +160,7 @@ int qdev_init(DeviceState *dev) QEMU_WARN_UNUSED_RESULT;
void qdev_init_nofail(DeviceState *dev);
void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id,
int required_for_version);
-void qdev_unplug(DeviceState *dev, Error **errp);
+int qdev_unplug_req(DeviceState *dev, Error **errp);
void qdev_free(DeviceState *dev);
void qdev_delete_subtree(DeviceState *dev);
int qdev_simple_unplug_cb(DeviceState *dev);
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index 4981a02..023211a 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -1802,7 +1802,7 @@ static int get_scsi_requests(QEMUFile *f, void *pv, size_t size)
return 0;
}
-static int scsi_qdev_unplug(DeviceState *qdev)
+static int scsi_qdev_unplug_req(DeviceState *qdev)
{
SCSIDevice *dev = SCSI_DEVICE(qdev);
SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, dev->qdev.parent_bus);
@@ -1849,7 +1849,7 @@ static void scsi_device_class_init(ObjectClass *klass, void *data)
DeviceClass *k = DEVICE_CLASS(klass);
k->bus_type = TYPE_SCSI_BUS;
k->init = scsi_qdev_init;
- k->unplug = scsi_qdev_unplug;
+ k->unplug = scsi_qdev_unplug_req;
k->exit = scsi_qdev_exit;
k->props = scsi_props;
}
diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index ff48d91..8871b2b 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -510,7 +510,7 @@ static void usb_msd_password_cb(void *opaque, int err)
err = usb_device_attach(&s->dev);
if (err)
- qdev_unplug(&s->dev.qdev, NULL);
+ qdev_unplug_req(&s->dev.qdev, NULL);
}
static void *usb_msd_load_request(QEMUFile *f, SCSIRequest *req)
diff --git a/hw/xen_platform.c b/hw/xen_platform.c
index c1fe984..0231a40 100644
--- a/hw/xen_platform.c
+++ b/hw/xen_platform.c
@@ -103,7 +103,7 @@ static void unplug_disks(PCIBus *b, PCIDevice *d, void *o)
{
if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
PCI_CLASS_STORAGE_IDE) {
- qdev_unplug(&(d->qdev), NULL);
+ qdev_unplug_req(&(d->qdev), NULL);
}
}
--
1.7.4.4
next prev parent reply other threads:[~2012-08-24 9:51 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-24 9:49 [Qemu-devel] [PATCH 0/10] rework on hot unplug Liu Ping Fan
2012-08-24 9:49 ` [Qemu-devel] [PATCH 01/10] qom: add, remove of link property need to ref, unref its target Liu Ping Fan
2012-08-24 14:52 ` Paolo Bonzini
2012-08-24 9:49 ` [Qemu-devel] [PATCH 02/10] qdev: change iterator callback seq Liu Ping Fan
2012-08-24 9:49 ` [Qemu-devel] [PATCH 03/10] qom: export object_property_is_child, object_property_is_link Liu Ping Fan
2012-08-24 14:51 ` Paolo Bonzini
2012-08-25 7:43 ` liu ping fan
2012-08-25 8:04 ` Blue Swirl
2012-08-24 9:49 ` [Qemu-devel] [PATCH 04/10] qdev: introduce new interface to remove composite sub-tree Liu Ping Fan
2012-08-24 9:49 ` [Qemu-devel] [PATCH 05/10] qdev: finalize of qbus, qdev will not the right place to free children Liu Ping Fan
2012-08-24 14:50 ` Paolo Bonzini
2012-08-24 9:49 ` [Qemu-devel] [PATCH 06/10] qom: expose object_property_del_child Liu Ping Fan
2012-08-24 14:44 ` Paolo Bonzini
2012-08-24 9:49 ` [Qemu-devel] [PATCH 07/10] unplug: using new intf qdev_delete_subtree in acpi_piix_eject_slot Liu Ping Fan
2012-08-24 10:24 ` Paolo Bonzini
2012-08-25 7:05 ` liu ping fan
2012-08-24 9:49 ` Liu Ping Fan [this message]
2012-08-24 14:48 ` [Qemu-devel] [PATCH 08/10] qdev: rename qdev_unplug to qdev_unplug_req Paolo Bonzini
2012-08-24 9:49 ` [Qemu-devel] [PATCH 09/10] mon: release dev's ref hold by qdev_get_peripheral Liu Ping Fan
2012-08-24 9:49 ` [Qemu-devel] [PATCH 10/10] qdev: fix create in place obj's life cycle problem Liu Ping Fan
2012-08-24 14:42 ` Paolo Bonzini
2012-08-25 7:42 ` liu ping fan
2012-08-27 7:01 ` Paolo Bonzini
2012-08-27 7:47 ` Jan Kiszka
2012-08-27 8:17 ` liu ping fan
2012-08-27 8:27 ` Jan Kiszka
2012-08-27 17:09 ` Avi Kivity
2012-08-27 17:14 ` Jan Kiszka
2012-08-27 18:09 ` Avi Kivity
2012-08-27 18:17 ` Jan Kiszka
2012-08-27 18:20 ` Avi Kivity
2012-08-27 18:39 ` Jan Kiszka
2012-08-27 18:52 ` Avi Kivity
2012-08-27 19:38 ` Jan Kiszka
2012-08-27 20:53 ` Avi Kivity
2012-08-28 1:01 ` Jan Kiszka
2012-08-29 17:13 ` Avi Kivity
2012-08-29 17:21 ` Jan Kiszka
2012-08-29 17:27 ` Avi Kivity
2012-08-29 17:41 ` Jan Kiszka
2012-09-03 9:09 ` Avi Kivity
2012-08-28 3:09 ` liu ping fan
2012-08-28 3:38 ` liu ping fan
2012-08-28 9:42 ` Jan Kiszka
2012-08-28 10:05 ` Paolo Bonzini
2012-08-29 17:23 ` Avi Kivity
2012-08-29 17:30 ` Jan Kiszka
2012-08-29 17:40 ` Avi Kivity
2012-08-29 17:49 ` Jan Kiszka
2012-09-01 8:31 ` Avi Kivity
2012-09-01 8:57 ` Jan Kiszka
2012-09-01 9:30 ` Avi Kivity
2012-08-30 5:54 ` liu ping fan
2012-08-30 7:08 ` Jan Kiszka
2012-08-30 7:47 ` liu ping fan
2012-09-01 8:46 ` Avi Kivity
2012-09-03 7:44 ` liu ping fan
2012-09-03 8:52 ` Avi Kivity
2012-09-03 10:06 ` liu ping fan
2012-09-03 10:16 ` Avi Kivity
2012-09-04 2:33 ` liu ping fan
2012-09-04 2:34 ` liu ping fan
2012-09-05 8:19 ` liu ping fan
2012-09-05 9:52 ` Avi Kivity
2012-09-05 10:36 ` Jan Kiszka
2012-09-05 10:53 ` Avi Kivity
2012-09-05 11:11 ` Jan Kiszka
2012-09-05 11:25 ` Avi Kivity
2012-09-05 12:02 ` Jan Kiszka
2012-09-05 12:17 ` Avi Kivity
2012-08-27 13:19 ` Anthony Liguori
2012-08-27 15:02 ` Jan Kiszka
2012-08-27 15:14 ` Anthony Liguori
2012-08-27 15:26 ` Jan Kiszka
2012-08-27 16:24 ` Anthony Liguori
2012-08-27 16:59 ` Jan Kiszka
2012-08-27 18:35 ` Avi Kivity
2012-08-27 19:17 ` Anthony Liguori
2012-08-27 19:22 ` Jan Kiszka
2012-08-27 20:58 ` Avi Kivity
2012-08-27 21:34 ` Paolo Bonzini
2012-08-27 18:27 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1345801763-24227-9-git-send-email-qemulist@gmail.com \
--to=qemulist@gmail.com \
--cc=anthony@codemonkey.ws \
--cc=avi@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pingfank@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).