From 9fda2f5cc9f02cac28f6564580a7243821ee0de3 Mon Sep 17 00:00:00 2001 From: Osier Yang Date: Wed, 10 Apr 2013 18:09:23 +0800 Subject: [PATCH] Cleanup: Change datatype of hostdev->managed to boolean --- src/conf/domain_conf.c | 2 +- src/conf/domain_conf.h | 2 +- src/qemu/qemu_command.c | 4 ++-- src/util/virpci.c | 6 +++--- src/util/virpci.h | 2 +- src/xenxs/xen_sxpr.c | 2 +- src/xenxs/xen_xm.c | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e00a5321f9..c08d4b9d2d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3569,7 +3569,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, */ if ((managed = virXMLPropString(node, "managed"))!= NULL) { if (STREQ(managed, "yes")) - def->managed = 1; + def->managed = true; } /* @type is passed in from the caller rather than read from the diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 08b8e48d17..8a4361967d 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -435,7 +435,7 @@ struct _virDomainHostdevDef { virDomainDeviceDef parent; /* higher level Def containing this */ int mode; /* enum virDomainHostdevMode */ int startupPolicy; /* enum virDomainStartupPolicy */ - unsigned int managed : 1; + bool managed; unsigned int missing : 1; union { virDomainHostdevSubsys subsys; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 41a2dfdd86..3ba989d2bd 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8558,7 +8558,7 @@ qemuParseCommandLinePCI(const char *val) } def->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS; - def->managed = 1; + def->managed = true; def->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI; def->source.subsys.u.pci.bus = bus; def->source.subsys.u.pci.slot = slot; @@ -8619,7 +8619,7 @@ qemuParseCommandLineUSB(const char *val) } def->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS; - def->managed = 0; + def->managed = false; def->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB; if (*end == '.') { def->source.subsys.u.usb.bus = first; diff --git a/src/util/virpci.c b/src/util/virpci.c index 85cd6948d7..fafede0c1b 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -65,7 +65,7 @@ struct _virPCIDevice { unsigned pci_pm_cap_pos; unsigned has_flr : 1; unsigned has_pm_reset : 1; - unsigned managed : 1; + bool managed; /* used by reattach function */ unsigned unbind_from_stub : 1; @@ -1453,9 +1453,9 @@ virPCIDeviceGetName(virPCIDevicePtr dev) return dev->name; } -void virPCIDeviceSetManaged(virPCIDevicePtr dev, unsigned managed) +void virPCIDeviceSetManaged(virPCIDevicePtr dev, bool managed) { - dev->managed = !!managed; + dev->managed = managed; } unsigned virPCIDeviceGetManaged(virPCIDevicePtr dev) diff --git a/src/util/virpci.h b/src/util/virpci.h index cf2aecd4bf..9ea721a433 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -61,7 +61,7 @@ int virPCIDeviceReset(virPCIDevicePtr dev, virPCIDeviceListPtr inactiveDevs); void virPCIDeviceSetManaged(virPCIDevice *dev, - unsigned managed); + bool managed); unsigned virPCIDeviceGetManaged(virPCIDevice *dev); void virPCIDeviceSetUsedBy(virPCIDevice *dev, const char *used_by); diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c index cc4225b49f..7ed148276a 100644 --- a/src/xenxs/xen_sxpr.c +++ b/src/xenxs/xen_sxpr.c @@ -1087,7 +1087,7 @@ xenParseSxprPCI(virDomainDefPtr def, goto error; dev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS; - dev->managed = 0; + dev->managed = false; dev->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI; dev->source.subsys.u.pci.domain = domainID; dev->source.subsys.u.pci.bus = busID; diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c index 34103b9bb0..14e26c3130 100644 --- a/src/xenxs/xen_xm.c +++ b/src/xenxs/xen_xm.c @@ -875,7 +875,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, if (!(hostdev = virDomainHostdevDefAlloc())) goto cleanup; - hostdev->managed = 0; + hostdev->managed = false; hostdev->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI; hostdev->source.subsys.u.pci.domain = domainID; hostdev->source.subsys.u.pci.bus = busID; -- GitLab