mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
Remove virConnectPtr from USB/PCI device iterators
All callers now pass a NULL virConnectPtr into the USB/PCi device iterator functions. Therefore the virConnectPtr arg can now be removed from these functions * src/util/hostusb.h, src/util/hostusb.c: Remove virConnectPtr from usbDeviceFileIterate * src/util/pci.c, src/util/pci.h: Remove virConnectPtr arg from pciDeviceFileIterate * src/qemu/qemu_security_dac.c, src/security/security_selinux.c: Update to drop redundant virConnectPtr arg
This commit is contained in:
parent
9f013d5779
commit
ce71b8654d
@ -173,8 +173,7 @@ qemuSecurityDACRestoreSecurityImageLabel(virDomainObjPtr vm ATTRIBUTE_UNUSED,
|
||||
|
||||
|
||||
static int
|
||||
qemuSecurityDACSetSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
pciDevice *dev ATTRIBUTE_UNUSED,
|
||||
qemuSecurityDACSetSecurityPCILabel(pciDevice *dev ATTRIBUTE_UNUSED,
|
||||
const char *file,
|
||||
void *opaque ATTRIBUTE_UNUSED)
|
||||
{
|
||||
@ -183,8 +182,7 @@ qemuSecurityDACSetSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
|
||||
|
||||
static int
|
||||
qemuSecurityDACSetSecurityUSBLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
usbDevice *dev ATTRIBUTE_UNUSED,
|
||||
qemuSecurityDACSetSecurityUSBLabel(usbDevice *dev ATTRIBUTE_UNUSED,
|
||||
const char *file,
|
||||
void *opaque ATTRIBUTE_UNUSED)
|
||||
{
|
||||
@ -215,7 +213,7 @@ qemuSecurityDACSetSecurityHostdevLabel(virDomainObjPtr vm,
|
||||
if (!usb)
|
||||
goto done;
|
||||
|
||||
ret = usbDeviceFileIterate(NULL, usb, qemuSecurityDACSetSecurityUSBLabel, vm);
|
||||
ret = usbDeviceFileIterate(usb, qemuSecurityDACSetSecurityUSBLabel, vm);
|
||||
usbFreeDevice(usb);
|
||||
break;
|
||||
}
|
||||
@ -229,7 +227,7 @@ qemuSecurityDACSetSecurityHostdevLabel(virDomainObjPtr vm,
|
||||
if (!pci)
|
||||
goto done;
|
||||
|
||||
ret = pciDeviceFileIterate(NULL, pci, qemuSecurityDACSetSecurityPCILabel, vm);
|
||||
ret = pciDeviceFileIterate(pci, qemuSecurityDACSetSecurityPCILabel, vm);
|
||||
pciFreeDevice(pci);
|
||||
|
||||
break;
|
||||
@ -246,8 +244,7 @@ done:
|
||||
|
||||
|
||||
static int
|
||||
qemuSecurityDACRestoreSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
pciDevice *dev ATTRIBUTE_UNUSED,
|
||||
qemuSecurityDACRestoreSecurityPCILabel(pciDevice *dev ATTRIBUTE_UNUSED,
|
||||
const char *file,
|
||||
void *opaque ATTRIBUTE_UNUSED)
|
||||
{
|
||||
@ -256,8 +253,7 @@ qemuSecurityDACRestoreSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
|
||||
|
||||
static int
|
||||
qemuSecurityDACRestoreSecurityUSBLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
usbDevice *dev ATTRIBUTE_UNUSED,
|
||||
qemuSecurityDACRestoreSecurityUSBLabel(usbDevice *dev ATTRIBUTE_UNUSED,
|
||||
const char *file,
|
||||
void *opaque ATTRIBUTE_UNUSED)
|
||||
{
|
||||
@ -288,7 +284,7 @@ qemuSecurityDACRestoreSecurityHostdevLabel(virDomainObjPtr vm ATTRIBUTE_UNUSED,
|
||||
if (!usb)
|
||||
goto done;
|
||||
|
||||
ret = usbDeviceFileIterate(NULL, usb, qemuSecurityDACRestoreSecurityUSBLabel, NULL);
|
||||
ret = usbDeviceFileIterate(usb, qemuSecurityDACRestoreSecurityUSBLabel, NULL);
|
||||
usbFreeDevice(usb);
|
||||
|
||||
break;
|
||||
@ -303,7 +299,7 @@ qemuSecurityDACRestoreSecurityHostdevLabel(virDomainObjPtr vm ATTRIBUTE_UNUSED,
|
||||
if (!pci)
|
||||
goto done;
|
||||
|
||||
ret = pciDeviceFileIterate(NULL, pci, qemuSecurityDACRestoreSecurityPCILabel, NULL);
|
||||
ret = pciDeviceFileIterate(pci, qemuSecurityDACRestoreSecurityPCILabel, NULL);
|
||||
pciFreeDevice(pci);
|
||||
|
||||
break;
|
||||
|
@ -455,8 +455,7 @@ SELinuxSetSecurityImageLabel(virDomainObjPtr vm,
|
||||
|
||||
|
||||
static int
|
||||
SELinuxSetSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
pciDevice *dev ATTRIBUTE_UNUSED,
|
||||
SELinuxSetSecurityPCILabel(pciDevice *dev ATTRIBUTE_UNUSED,
|
||||
const char *file, void *opaque)
|
||||
{
|
||||
virDomainObjPtr vm = opaque;
|
||||
@ -466,8 +465,7 @@ SELinuxSetSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
static int
|
||||
SELinuxSetSecurityUSBLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
usbDevice *dev ATTRIBUTE_UNUSED,
|
||||
SELinuxSetSecurityUSBLabel(usbDevice *dev ATTRIBUTE_UNUSED,
|
||||
const char *file, void *opaque)
|
||||
{
|
||||
virDomainObjPtr vm = opaque;
|
||||
@ -500,7 +498,7 @@ SELinuxSetSecurityHostdevLabel(virDomainObjPtr vm,
|
||||
if (!usb)
|
||||
goto done;
|
||||
|
||||
ret = usbDeviceFileIterate(NULL, usb, SELinuxSetSecurityUSBLabel, vm);
|
||||
ret = usbDeviceFileIterate(usb, SELinuxSetSecurityUSBLabel, vm);
|
||||
usbFreeDevice(usb);
|
||||
break;
|
||||
}
|
||||
@ -514,7 +512,7 @@ SELinuxSetSecurityHostdevLabel(virDomainObjPtr vm,
|
||||
if (!pci)
|
||||
goto done;
|
||||
|
||||
ret = pciDeviceFileIterate(NULL, pci, SELinuxSetSecurityPCILabel, vm);
|
||||
ret = pciDeviceFileIterate(pci, SELinuxSetSecurityPCILabel, vm);
|
||||
pciFreeDevice(pci);
|
||||
|
||||
break;
|
||||
@ -531,8 +529,7 @@ done:
|
||||
|
||||
|
||||
static int
|
||||
SELinuxRestoreSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
pciDevice *dev ATTRIBUTE_UNUSED,
|
||||
SELinuxRestoreSecurityPCILabel(pciDevice *dev ATTRIBUTE_UNUSED,
|
||||
const char *file,
|
||||
void *opaque ATTRIBUTE_UNUSED)
|
||||
{
|
||||
@ -540,8 +537,7 @@ SELinuxRestoreSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
static int
|
||||
SELinuxRestoreSecurityUSBLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
usbDevice *dev ATTRIBUTE_UNUSED,
|
||||
SELinuxRestoreSecurityUSBLabel(usbDevice *dev ATTRIBUTE_UNUSED,
|
||||
const char *file,
|
||||
void *opaque ATTRIBUTE_UNUSED)
|
||||
{
|
||||
@ -572,7 +568,7 @@ SELinuxRestoreSecurityHostdevLabel(virDomainObjPtr vm,
|
||||
if (!usb)
|
||||
goto done;
|
||||
|
||||
ret = usbDeviceFileIterate(NULL, usb, SELinuxRestoreSecurityUSBLabel, NULL);
|
||||
ret = usbDeviceFileIterate(usb, SELinuxRestoreSecurityUSBLabel, NULL);
|
||||
usbFreeDevice(usb);
|
||||
|
||||
break;
|
||||
@ -587,7 +583,7 @@ SELinuxRestoreSecurityHostdevLabel(virDomainObjPtr vm,
|
||||
if (!pci)
|
||||
goto done;
|
||||
|
||||
ret = pciDeviceFileIterate(NULL, pci, SELinuxRestoreSecurityPCILabel, NULL);
|
||||
ret = pciDeviceFileIterate(pci, SELinuxRestoreSecurityPCILabel, NULL);
|
||||
pciFreeDevice(pci);
|
||||
|
||||
break;
|
||||
|
@ -202,10 +202,9 @@ usbFreeDevice(usbDevice *dev)
|
||||
}
|
||||
|
||||
|
||||
int usbDeviceFileIterate(virConnectPtr conn,
|
||||
usbDevice *dev,
|
||||
int usbDeviceFileIterate(usbDevice *dev,
|
||||
usbDeviceFileActor actor,
|
||||
void *opaque)
|
||||
{
|
||||
return (actor)(conn, dev, dev->path, opaque);
|
||||
return (actor)(dev, dev->path, opaque);
|
||||
}
|
||||
|
@ -39,11 +39,10 @@ void usbFreeDevice (usbDevice *dev);
|
||||
* Should return 0 if successfully processed, or
|
||||
* -1 to indicate error and abort iteration
|
||||
*/
|
||||
typedef int (*usbDeviceFileActor)(virConnectPtr conn, usbDevice *dev,
|
||||
typedef int (*usbDeviceFileActor)(usbDevice *dev,
|
||||
const char *path, void *opaque);
|
||||
|
||||
int usbDeviceFileIterate(virConnectPtr conn,
|
||||
usbDevice *dev,
|
||||
int usbDeviceFileIterate(usbDevice *dev,
|
||||
usbDeviceFileActor actor,
|
||||
void *opaque);
|
||||
|
||||
|
@ -1194,8 +1194,7 @@ pciDeviceListFind(pciDeviceList *list, pciDevice *dev)
|
||||
}
|
||||
|
||||
|
||||
int pciDeviceFileIterate(virConnectPtr conn,
|
||||
pciDevice *dev,
|
||||
int pciDeviceFileIterate(pciDevice *dev,
|
||||
pciDeviceFileActor actor,
|
||||
void *opaque)
|
||||
{
|
||||
@ -1228,7 +1227,7 @@ int pciDeviceFileIterate(virConnectPtr conn,
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
if ((actor)(conn, dev, file, opaque) < 0)
|
||||
if ((actor)(dev, file, opaque) < 0)
|
||||
goto cleanup;
|
||||
|
||||
VIR_FREE(file);
|
||||
|
@ -61,11 +61,10 @@ pciDevice * pciDeviceListFind (pciDeviceList *list,
|
||||
* Should return 0 if successfully processed, or
|
||||
* -1 to indicate error and abort iteration
|
||||
*/
|
||||
typedef int (*pciDeviceFileActor)(virConnectPtr conn, pciDevice *dev,
|
||||
typedef int (*pciDeviceFileActor)(pciDevice *dev,
|
||||
const char *path, void *opaque);
|
||||
|
||||
int pciDeviceFileIterate(virConnectPtr conn,
|
||||
pciDevice *dev,
|
||||
int pciDeviceFileIterate(pciDevice *dev,
|
||||
pciDeviceFileActor actor,
|
||||
void *opaque);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user