On Sat, Mar 01, 2014 at 02:29:03PM +0800, Chunyan Liu wrote:
For extracting hostdev codes from qemu_hostdev.c to common library,
change qemu
specific COLD_BOOT handling to be a flag, and pass it to hostdev functions.
Signed-off-by: Chunyan Liu <cyliu(a)suse.com>
---
src/qemu/qemu_hostdev.c | 6 +++---
src/qemu/qemu_hostdev.h | 4 ++--
src/qemu/qemu_process.c | 4 +++-
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index 5f2dc44..6be58ef 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -1010,7 +1010,7 @@ out:
int
qemuPrepareHostUSBDevices(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
virDomainDefPtr def,
- bool coldBoot)
+ unsigned int flags)
{
size_t i;
int ret = -1;
@@ -1019,6 +1019,7 @@ qemuPrepareHostUSBDevices(virQEMUDriverPtr driver
ATTRIBUTE_UNUSED,
virDomainHostdevDefPtr *hostdevs = def->hostdevs;
int nhostdevs = def->nhostdevs;
virHostdevManagerPtr hostdev_mgr;
+ bool coldBoot = !!(flags & VIR_COLD_BOOT);
/* To prevent situation where USB device is assigned to two domains
* we need to keep a list of currently assigned USB devices.
@@ -1216,7 +1217,6 @@ int
qemuPrepareHostDevices(virQEMUDriverPtr driver,
virDomainDefPtr def,
virQEMUCapsPtr qemuCaps,
- bool coldBoot,
unsigned int flags)
{
if (!def->nhostdevs)
@@ -1227,7 +1227,7 @@ qemuPrepareHostDevices(virQEMUDriverPtr driver,
qemuCaps, flags) < 0)
return -1;
- if (qemuPrepareHostUSBDevices(driver, def, coldBoot) < 0)
+ if (qemuPrepareHostUSBDevices(driver, def, flags) < 0)
return -1;
if (qemuPrepareHostdevSCSIDevices(driver, def->name,
diff --git a/src/qemu/qemu_hostdev.h b/src/qemu/qemu_hostdev.h
index 48ca610..c137302 100644
--- a/src/qemu/qemu_hostdev.h
+++ b/src/qemu/qemu_hostdev.h
@@ -29,6 +29,7 @@
typedef enum {
VIR_STRICT_ACS_CHECK = (1 << 0), /* strict acs check */
+ VIR_COLD_BOOT = (1 << 1), /* cold boot */
} virHostdevFlag;
Hmm, please namespace these flags properly eg
VIR_HOSTDEV_STRICT_ACS_CHECK
VIR_HOSTDEV_COLD_BOOT
Regards,
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|