while (cur != NULL) {
if (cur->type == XML_ELEMENT_NODE) {
if (xmlStrEqual(cur->name, BAD_CAST "unbind")) {
- def->states.pci.unbind_from_stub = 1;
+ def->states.pci.unbind_from_stub = true;
} else if (xmlStrEqual(cur->name, BAD_CAST "removeslot")) {
- def->states.pci.remove_slot = 1;
+ def->states.pci.remove_slot = true;
} else if (xmlStrEqual(cur->name, BAD_CAST "reprobe")) {
- def->states.pci.reprobe = 1;
+ def->states.pci.reprobe = true;
} else {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported element '%s' of 'origstates'"),
unsigned pcie_cap_pos;
unsigned pci_pm_cap_pos;
- unsigned has_flr : 1;
- unsigned has_pm_reset : 1;
+ bool has_flr;
+ bool has_pm_reset;
bool managed;
/* used by reattach function */
- unsigned unbind_from_stub : 1;
- unsigned remove_slot : 1;
- unsigned reprobe : 1;
+ bool unbind_from_stub;
+ bool remove_slot;
+ bool reprobe;
};
struct _virPCIDeviceList {
flr = virPCIDeviceDetectFunctionLevelReset(dev, cfgfd);
if (flr < 0)
return flr;
- dev->has_flr = flr;
- dev->has_pm_reset = virPCIDeviceDetectPowerManagementReset(dev, cfgfd);
+ dev->has_flr = !!flr;
+ dev->has_pm_reset = !!virPCIDeviceDetectPowerManagementReset(dev, cfgfd);
return 0;
}
goto cleanup;
}
}
- dev->unbind_from_stub = 0;
+ dev->unbind_from_stub = false;
remove_slot:
if (!dev->remove_slot)
dev->name, driver);
goto cleanup;
}
- dev->remove_slot = 0;
+ dev->remove_slot = false;
reprobe:
if (!dev->reprobe) {
cleanup:
/* do not do it again */
- dev->unbind_from_stub = 0;
- dev->remove_slot = 0;
- dev->reprobe = 0;
+ dev->unbind_from_stub = false;
+ dev->remove_slot = false;
+ dev->reprobe = false;
VIR_FREE(drvdir);
VIR_FREE(path);
int result = -1;
char *drvdir = NULL;
char *path = NULL;
- int reprobe = 0;
+ int reprobe = false;
/* check whether the device is already bound to a driver */
if (virPCIDriverDir(&drvdir, driver) < 0 ||
result = 0;
goto cleanup;
}
- reprobe = 1;
+ reprobe = true;
}
/* Add the PCI device ID to the stub's dynamic ID table;
}
if (virFileLinkPointsTo(path, drvdir)) {
- dev->unbind_from_stub = 1;
- dev->remove_slot = 1;
+ dev->unbind_from_stub = true;
+ dev->remove_slot = true;
goto remove_id;
}
dev->name, driver);
goto remove_id;
}
- dev->remove_slot = 1;
+ dev->remove_slot = true;
if (virPCIDriverFile(&path, driver, "bind") < 0) {
goto remove_id;
dev->name, driver);
goto remove_id;
}
- dev->unbind_from_stub = 1;
+ dev->unbind_from_stub = true;
}
remove_id:
VIR_WARN("Could not remove PCI ID '%s' from %s, and the device "
"cannot be probed again.", dev->id, driver);
}
- dev->reprobe = 0;
+ dev->reprobe = false;
goto cleanup;
}
VIR_WARN("Failed to remove PCI ID '%s' from %s, and the device "
"cannot be probed again.", dev->id, driver);
}
- dev->reprobe = 0;
+ dev->reprobe = false;
goto cleanup;
}
}
void
-virPCIDeviceSetUnbindFromStub(virPCIDevicePtr dev, unsigned unbind)
+virPCIDeviceSetUnbindFromStub(virPCIDevicePtr dev, bool unbind)
{
- dev->unbind_from_stub = !!unbind;
+ dev->unbind_from_stub = unbind;
}
unsigned
}
void
-virPCIDeviceSetRemoveSlot(virPCIDevicePtr dev, unsigned remove_slot)
+virPCIDeviceSetRemoveSlot(virPCIDevicePtr dev, bool remove_slot)
{
- dev->remove_slot = !!remove_slot;
+ dev->remove_slot = remove_slot;
}
unsigned
}
void
-virPCIDeviceSetReprobe(virPCIDevicePtr dev, unsigned reprobe)
+virPCIDeviceSetReprobe(virPCIDevicePtr dev, bool reprobe)
{
- dev->reprobe = !!reprobe;
+ dev->reprobe = reprobe;
}
void
void virPCIDeviceReattachInit(virPCIDevicePtr pci)
{
- pci->unbind_from_stub = 1;
- pci->remove_slot = 1;
- pci->reprobe = 1;
+ pci->unbind_from_stub = true;
+ pci->remove_slot = true;
+ pci->reprobe = true;
}
const char *virPCIDeviceGetUsedBy(virPCIDevice *dev);
unsigned virPCIDeviceGetUnbindFromStub(virPCIDevicePtr dev);
void virPCIDeviceSetUnbindFromStub(virPCIDevice *dev,
- unsigned unbind);
+ bool unbind);
unsigned virPCIDeviceGetRemoveSlot(virPCIDevicePtr dev);
void virPCIDeviceSetRemoveSlot(virPCIDevice *dev,
- unsigned remove_slot);
+ bool remove_slot);
unsigned virPCIDeviceGetReprobe(virPCIDevicePtr dev);
void virPCIDeviceSetReprobe(virPCIDevice *dev,
- unsigned reprobe);
+ bool reprobe);
void virPCIDeviceReattachInit(virPCIDevice *dev);