return 0;
if (!(usb = virUSBDeviceNew(usbsrc->bus, usbsrc->device, vroot)))
- goto done;
+ return -1;
ret = virUSBDeviceFileIterate(usb,
virSecurityDACSetUSBLabel,
pcisrc->addr.slot, pcisrc->addr.function);
if (!pci)
- goto done;
+ return -1;
if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
if (!vfioGroupDev) {
virPCIDeviceFree(pci);
- goto done;
+ return -1;
}
ret = virSecurityDACSetPCILabel(pci, vfioGroupDev, &cbdata);
VIR_FREE(vfioGroupDev);
dev->readonly, dev->shareable);
if (!scsi)
- goto done;
+ return -1;
ret = virSCSIDeviceFileIterate(scsi,
virSecurityDACSetSCSILabel,
virSCSIVHostDevicePtr host = virSCSIVHostDeviceNew(hostsrc->wwpn);
if (!host)
- goto done;
+ return -1;
ret = virSCSIVHostDeviceFileIterate(host,
virSecurityDACSetHostLabel,
char *vfiodev = NULL;
if (!(vfiodev = virMediatedDeviceGetIOMMUGroupDev(mdevsrc->uuidstr)))
- goto done;
+ return -1;
ret = virSecurityDACSetHostdevLabelHelper(vfiodev, &cbdata);
break;
}
- done:
return ret;
}
return 0;
if (!(usb = virUSBDeviceNew(usbsrc->bus, usbsrc->device, vroot)))
- goto done;
+ return -1;
ret = virUSBDeviceFileIterate(usb, virSecurityDACRestoreUSBLabel, mgr);
virUSBDeviceFree(usb);
pcisrc->addr.slot, pcisrc->addr.function);
if (!pci)
- goto done;
+ return -1;
if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
if (!vfioGroupDev) {
virPCIDeviceFree(pci);
- goto done;
+ return -1;
}
ret = virSecurityDACRestorePCILabel(pci, vfioGroupDev, mgr);
VIR_FREE(vfioGroupDev);
dev->readonly, dev->shareable);
if (!scsi)
- goto done;
+ return -1;
ret = virSCSIDeviceFileIterate(scsi, virSecurityDACRestoreSCSILabel, mgr);
virSCSIDeviceFree(scsi);
virSCSIVHostDevicePtr host = virSCSIVHostDeviceNew(hostsrc->wwpn);
if (!host)
- goto done;
+ return -1;
ret = virSCSIVHostDeviceFileIterate(host,
virSecurityDACRestoreHostLabel,
char *vfiodev = NULL;
if (!(vfiodev = virMediatedDeviceGetIOMMUGroupDev(mdevsrc->uuidstr)))
- goto done;
+ return -1;
ret = virSecurityDACRestoreFileLabel(mgr, vfiodev);
VIR_FREE(vfiodev);
break;
}
- done:
return ret;
}
usbsrc->device,
vroot);
if (!usb)
- goto done;
+ return -1;
ret = virUSBDeviceFileIterate(usb, virSecuritySELinuxSetUSBLabel, &data);
virUSBDeviceFree(usb);
pcisrc->addr.slot, pcisrc->addr.function);
if (!pci)
- goto done;
+ return -1;
if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
if (!vfioGroupDev) {
virPCIDeviceFree(pci);
- goto done;
+ return -1;
}
ret = virSecuritySELinuxSetPCILabel(pci, vfioGroupDev, &data);
VIR_FREE(vfioGroupDev);
dev->readonly, dev->shareable);
if (!scsi)
- goto done;
+ return -1;
ret = virSCSIDeviceFileIterate(scsi,
virSecuritySELinuxSetSCSILabel,
virSCSIVHostDevicePtr host = virSCSIVHostDeviceNew(hostsrc->wwpn);
if (!host)
- goto done;
+ return -1;
ret = virSCSIVHostDeviceFileIterate(host,
virSecuritySELinuxSetHostLabel,
char *vfiodev = NULL;
if (!(vfiodev = virMediatedDeviceGetIOMMUGroupDev(mdevsrc->uuidstr)))
- goto done;
+ return ret;
ret = virSecuritySELinuxSetHostdevLabelHelper(vfiodev, &data);
break;
}
- done:
return ret;
}
usbsrc->device,
vroot);
if (!usb)
- goto done;
+ return -1;
ret = virUSBDeviceFileIterate(usb, virSecuritySELinuxRestoreUSBLabel, mgr);
virUSBDeviceFree(usb);
pcisrc->addr.slot, pcisrc->addr.function);
if (!pci)
- goto done;
+ return -1;
if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
if (!vfioGroupDev) {
virPCIDeviceFree(pci);
- goto done;
+ return -1;
}
ret = virSecuritySELinuxRestorePCILabel(pci, vfioGroupDev, mgr);
VIR_FREE(vfioGroupDev);
dev->readonly, dev->shareable);
if (!scsi)
- goto done;
+ return -1;
ret = virSCSIDeviceFileIterate(scsi, virSecuritySELinuxRestoreSCSILabel, mgr);
virSCSIDeviceFree(scsi);
virSCSIVHostDevicePtr host = virSCSIVHostDeviceNew(hostsrc->wwpn);
if (!host)
- goto done;
+ return -1;
ret = virSCSIVHostDeviceFileIterate(host,
virSecuritySELinuxRestoreHostLabel,
char *vfiodev = NULL;
if (!(vfiodev = virMediatedDeviceGetIOMMUGroupDev(mdevsrc->uuidstr)))
- goto done;
+ return -1;
ret = virSecuritySELinuxRestoreFileLabel(mgr, vfiodev, true);
break;
}
- done:
return ret;
}
if (!ctxt) {
vah_warning(_("Invalid context"));
- goto error;
+ return -1;
}
/* check if have <name> */
if (!(tmp = virXPathString("string(./name[1])", ctxt))) {
vah_warning(_("Could not find <name>"));
- goto error;
+ return -1;
}
VIR_FREE(tmp);
/* check if have <uuid> */
if (!(tmp = virXPathString("string(./uuid[1])", ctxt))) {
vah_warning(_("Could not find <uuid>"));
- goto error;
+ return -1;
}
VIR_FREE(tmp);
- rc = 0;
-
- error:
- return rc;
+ return 0;
}
/*
static int
get_definition(vahControl * ctl, const char *xmlStr)
{
- int rc = -1, ostype, virtType;
+ int ostype, virtType;
virCapsGuestPtr guest; /* this is freed when caps is freed */
/*
* but need them for virDomainDefParseString().
*/
if (caps_mockup(ctl, xmlStr) != 0)
- goto exit;
+ return -1;
if ((ctl->caps = virCapabilitiesNew(ctl->arch, true, true)) == NULL) {
vah_error(ctl, 0, _("could not allocate memory"));
- goto exit;
+ return -1;
}
if (!(ctl->xmlopt = virDomainXMLOptionNew(&virAAHelperDomainDefParserConfig,
NULL, NULL, NULL, NULL))) {
vah_error(ctl, 0, _("Failed to create XML config object"));
- goto exit;
+ return -1;
}
if ((ostype = virDomainOSTypeFromString(ctl->os)) < 0) {
vah_error(ctl, 0, _("unknown OS type"));
- goto exit;
+ return -1;
}
if ((guest = virCapabilitiesAddGuest(ctl->caps,
0,
NULL)) == NULL) {
vah_error(ctl, 0, _("could not allocate memory"));
- goto exit;
+ return -1;
}
if ((virtType = virDomainVirtTypeFromString(ctl->virtType)) < 0) {
vah_error(ctl, 0, _("unknown virtualization type"));
- goto exit;
+ return -1;
}
if (virCapabilitiesAddGuestDomain(guest,
0,
NULL) == NULL) {
vah_error(ctl, 0, _("could not allocate memory"));
- goto exit;
+ return -1;
}
ctl->def = virDomainDefParseString(xmlStr,
if (ctl->def == NULL) {
vah_error(ctl, 0, _("could not parse XML"));
- goto exit;
+ return -1;
}
if (!ctl->def->name) {
vah_error(ctl, 0, _("could not find name in XML"));
- goto exit;
+ return -1;
}
if (valid_name(ctl->def->name) != 0) {
vah_error(ctl, 0, _("bad name"));
- goto exit;
+ return -1;
}
- rc = 0;
-
- exit:
- return rc;
+ return 0;
}
/**
} else {
/* add the file */
if (vah_add_file(buf, path, perms) != 0)
- goto cleanup;
+ return -1;
rc = 0;
}
- cleanup:
return rc;
}