Cleanup: Change datatype of hostdev->managed to boolean

This commit is contained in:
Osier Yang 2013-04-10 18:09:23 +08:00
parent 2fff380105
commit 9fda2f5cc9
7 changed files with 10 additions and 10 deletions

View File

@ -3569,7 +3569,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
*/ */
if ((managed = virXMLPropString(node, "managed"))!= NULL) { if ((managed = virXMLPropString(node, "managed"))!= NULL) {
if (STREQ(managed, "yes")) if (STREQ(managed, "yes"))
def->managed = 1; def->managed = true;
} }
/* @type is passed in from the caller rather than read from the /* @type is passed in from the caller rather than read from the

View File

@ -435,7 +435,7 @@ struct _virDomainHostdevDef {
virDomainDeviceDef parent; /* higher level Def containing this */ virDomainDeviceDef parent; /* higher level Def containing this */
int mode; /* enum virDomainHostdevMode */ int mode; /* enum virDomainHostdevMode */
int startupPolicy; /* enum virDomainStartupPolicy */ int startupPolicy; /* enum virDomainStartupPolicy */
unsigned int managed : 1; bool managed;
unsigned int missing : 1; unsigned int missing : 1;
union { union {
virDomainHostdevSubsys subsys; virDomainHostdevSubsys subsys;

View File

@ -8558,7 +8558,7 @@ qemuParseCommandLinePCI(const char *val)
} }
def->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS; 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.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
def->source.subsys.u.pci.bus = bus; def->source.subsys.u.pci.bus = bus;
def->source.subsys.u.pci.slot = slot; def->source.subsys.u.pci.slot = slot;
@ -8619,7 +8619,7 @@ qemuParseCommandLineUSB(const char *val)
} }
def->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS; def->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
def->managed = 0; def->managed = false;
def->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB; def->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB;
if (*end == '.') { if (*end == '.') {
def->source.subsys.u.usb.bus = first; def->source.subsys.u.usb.bus = first;

View File

@ -65,7 +65,7 @@ struct _virPCIDevice {
unsigned pci_pm_cap_pos; unsigned pci_pm_cap_pos;
unsigned has_flr : 1; unsigned has_flr : 1;
unsigned has_pm_reset : 1; unsigned has_pm_reset : 1;
unsigned managed : 1; bool managed;
/* used by reattach function */ /* used by reattach function */
unsigned unbind_from_stub : 1; unsigned unbind_from_stub : 1;
@ -1453,9 +1453,9 @@ virPCIDeviceGetName(virPCIDevicePtr dev)
return dev->name; 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) unsigned virPCIDeviceGetManaged(virPCIDevicePtr dev)

View File

@ -61,7 +61,7 @@ int virPCIDeviceReset(virPCIDevicePtr dev,
virPCIDeviceListPtr inactiveDevs); virPCIDeviceListPtr inactiveDevs);
void virPCIDeviceSetManaged(virPCIDevice *dev, void virPCIDeviceSetManaged(virPCIDevice *dev,
unsigned managed); bool managed);
unsigned virPCIDeviceGetManaged(virPCIDevice *dev); unsigned virPCIDeviceGetManaged(virPCIDevice *dev);
void virPCIDeviceSetUsedBy(virPCIDevice *dev, void virPCIDeviceSetUsedBy(virPCIDevice *dev,
const char *used_by); const char *used_by);

View File

@ -1087,7 +1087,7 @@ xenParseSxprPCI(virDomainDefPtr def,
goto error; goto error;
dev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS; 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.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
dev->source.subsys.u.pci.domain = domainID; dev->source.subsys.u.pci.domain = domainID;
dev->source.subsys.u.pci.bus = busID; dev->source.subsys.u.pci.bus = busID;

View File

@ -875,7 +875,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
if (!(hostdev = virDomainHostdevDefAlloc())) if (!(hostdev = virDomainHostdevDefAlloc()))
goto cleanup; goto cleanup;
hostdev->managed = 0; hostdev->managed = false;
hostdev->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI; hostdev->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
hostdev->source.subsys.u.pci.domain = domainID; hostdev->source.subsys.u.pci.domain = domainID;
hostdev->source.subsys.u.pci.bus = busID; hostdev->source.subsys.u.pci.bus = busID;