提交 9fda2f5c 编写于 作者: O Osier Yang

Cleanup: Change datatype of hostdev->managed to boolean

上级 2fff3801
...@@ -3569,7 +3569,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, ...@@ -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
......
...@@ -435,7 +435,7 @@ struct _virDomainHostdevDef { ...@@ -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;
......
...@@ -8558,7 +8558,7 @@ qemuParseCommandLinePCI(const char *val) ...@@ -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) ...@@ -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;
......
...@@ -65,7 +65,7 @@ struct _virPCIDevice { ...@@ -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) ...@@ -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)
......
...@@ -61,7 +61,7 @@ int virPCIDeviceReset(virPCIDevicePtr dev, ...@@ -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);
......
...@@ -1087,7 +1087,7 @@ xenParseSxprPCI(virDomainDefPtr def, ...@@ -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;
......
...@@ -875,7 +875,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, ...@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册