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:
Daniel P. Berrange 2010-02-10 09:55:39 +00:00
parent 9f013d5779
commit ce71b8654d
6 changed files with 24 additions and 36 deletions

View File

@ -173,8 +173,7 @@ qemuSecurityDACRestoreSecurityImageLabel(virDomainObjPtr vm ATTRIBUTE_UNUSED,
static int static int
qemuSecurityDACSetSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED, qemuSecurityDACSetSecurityPCILabel(pciDevice *dev ATTRIBUTE_UNUSED,
pciDevice *dev ATTRIBUTE_UNUSED,
const char *file, const char *file,
void *opaque ATTRIBUTE_UNUSED) void *opaque ATTRIBUTE_UNUSED)
{ {
@ -183,8 +182,7 @@ qemuSecurityDACSetSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED,
static int static int
qemuSecurityDACSetSecurityUSBLabel(virConnectPtr conn ATTRIBUTE_UNUSED, qemuSecurityDACSetSecurityUSBLabel(usbDevice *dev ATTRIBUTE_UNUSED,
usbDevice *dev ATTRIBUTE_UNUSED,
const char *file, const char *file,
void *opaque ATTRIBUTE_UNUSED) void *opaque ATTRIBUTE_UNUSED)
{ {
@ -215,7 +213,7 @@ qemuSecurityDACSetSecurityHostdevLabel(virDomainObjPtr vm,
if (!usb) if (!usb)
goto done; goto done;
ret = usbDeviceFileIterate(NULL, usb, qemuSecurityDACSetSecurityUSBLabel, vm); ret = usbDeviceFileIterate(usb, qemuSecurityDACSetSecurityUSBLabel, vm);
usbFreeDevice(usb); usbFreeDevice(usb);
break; break;
} }
@ -229,7 +227,7 @@ qemuSecurityDACSetSecurityHostdevLabel(virDomainObjPtr vm,
if (!pci) if (!pci)
goto done; goto done;
ret = pciDeviceFileIterate(NULL, pci, qemuSecurityDACSetSecurityPCILabel, vm); ret = pciDeviceFileIterate(pci, qemuSecurityDACSetSecurityPCILabel, vm);
pciFreeDevice(pci); pciFreeDevice(pci);
break; break;
@ -246,8 +244,7 @@ done:
static int static int
qemuSecurityDACRestoreSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED, qemuSecurityDACRestoreSecurityPCILabel(pciDevice *dev ATTRIBUTE_UNUSED,
pciDevice *dev ATTRIBUTE_UNUSED,
const char *file, const char *file,
void *opaque ATTRIBUTE_UNUSED) void *opaque ATTRIBUTE_UNUSED)
{ {
@ -256,8 +253,7 @@ qemuSecurityDACRestoreSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED,
static int static int
qemuSecurityDACRestoreSecurityUSBLabel(virConnectPtr conn ATTRIBUTE_UNUSED, qemuSecurityDACRestoreSecurityUSBLabel(usbDevice *dev ATTRIBUTE_UNUSED,
usbDevice *dev ATTRIBUTE_UNUSED,
const char *file, const char *file,
void *opaque ATTRIBUTE_UNUSED) void *opaque ATTRIBUTE_UNUSED)
{ {
@ -288,7 +284,7 @@ qemuSecurityDACRestoreSecurityHostdevLabel(virDomainObjPtr vm ATTRIBUTE_UNUSED,
if (!usb) if (!usb)
goto done; goto done;
ret = usbDeviceFileIterate(NULL, usb, qemuSecurityDACRestoreSecurityUSBLabel, NULL); ret = usbDeviceFileIterate(usb, qemuSecurityDACRestoreSecurityUSBLabel, NULL);
usbFreeDevice(usb); usbFreeDevice(usb);
break; break;
@ -303,7 +299,7 @@ qemuSecurityDACRestoreSecurityHostdevLabel(virDomainObjPtr vm ATTRIBUTE_UNUSED,
if (!pci) if (!pci)
goto done; goto done;
ret = pciDeviceFileIterate(NULL, pci, qemuSecurityDACRestoreSecurityPCILabel, NULL); ret = pciDeviceFileIterate(pci, qemuSecurityDACRestoreSecurityPCILabel, NULL);
pciFreeDevice(pci); pciFreeDevice(pci);
break; break;

View File

@ -455,8 +455,7 @@ SELinuxSetSecurityImageLabel(virDomainObjPtr vm,
static int static int
SELinuxSetSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED, SELinuxSetSecurityPCILabel(pciDevice *dev ATTRIBUTE_UNUSED,
pciDevice *dev ATTRIBUTE_UNUSED,
const char *file, void *opaque) const char *file, void *opaque)
{ {
virDomainObjPtr vm = opaque; virDomainObjPtr vm = opaque;
@ -466,8 +465,7 @@ SELinuxSetSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED,
} }
static int static int
SELinuxSetSecurityUSBLabel(virConnectPtr conn ATTRIBUTE_UNUSED, SELinuxSetSecurityUSBLabel(usbDevice *dev ATTRIBUTE_UNUSED,
usbDevice *dev ATTRIBUTE_UNUSED,
const char *file, void *opaque) const char *file, void *opaque)
{ {
virDomainObjPtr vm = opaque; virDomainObjPtr vm = opaque;
@ -500,7 +498,7 @@ SELinuxSetSecurityHostdevLabel(virDomainObjPtr vm,
if (!usb) if (!usb)
goto done; goto done;
ret = usbDeviceFileIterate(NULL, usb, SELinuxSetSecurityUSBLabel, vm); ret = usbDeviceFileIterate(usb, SELinuxSetSecurityUSBLabel, vm);
usbFreeDevice(usb); usbFreeDevice(usb);
break; break;
} }
@ -514,7 +512,7 @@ SELinuxSetSecurityHostdevLabel(virDomainObjPtr vm,
if (!pci) if (!pci)
goto done; goto done;
ret = pciDeviceFileIterate(NULL, pci, SELinuxSetSecurityPCILabel, vm); ret = pciDeviceFileIterate(pci, SELinuxSetSecurityPCILabel, vm);
pciFreeDevice(pci); pciFreeDevice(pci);
break; break;
@ -531,8 +529,7 @@ done:
static int static int
SELinuxRestoreSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED, SELinuxRestoreSecurityPCILabel(pciDevice *dev ATTRIBUTE_UNUSED,
pciDevice *dev ATTRIBUTE_UNUSED,
const char *file, const char *file,
void *opaque ATTRIBUTE_UNUSED) void *opaque ATTRIBUTE_UNUSED)
{ {
@ -540,8 +537,7 @@ SELinuxRestoreSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED,
} }
static int static int
SELinuxRestoreSecurityUSBLabel(virConnectPtr conn ATTRIBUTE_UNUSED, SELinuxRestoreSecurityUSBLabel(usbDevice *dev ATTRIBUTE_UNUSED,
usbDevice *dev ATTRIBUTE_UNUSED,
const char *file, const char *file,
void *opaque ATTRIBUTE_UNUSED) void *opaque ATTRIBUTE_UNUSED)
{ {
@ -572,7 +568,7 @@ SELinuxRestoreSecurityHostdevLabel(virDomainObjPtr vm,
if (!usb) if (!usb)
goto done; goto done;
ret = usbDeviceFileIterate(NULL, usb, SELinuxRestoreSecurityUSBLabel, NULL); ret = usbDeviceFileIterate(usb, SELinuxRestoreSecurityUSBLabel, NULL);
usbFreeDevice(usb); usbFreeDevice(usb);
break; break;
@ -587,7 +583,7 @@ SELinuxRestoreSecurityHostdevLabel(virDomainObjPtr vm,
if (!pci) if (!pci)
goto done; goto done;
ret = pciDeviceFileIterate(NULL, pci, SELinuxRestoreSecurityPCILabel, NULL); ret = pciDeviceFileIterate(pci, SELinuxRestoreSecurityPCILabel, NULL);
pciFreeDevice(pci); pciFreeDevice(pci);
break; break;

View File

@ -202,10 +202,9 @@ usbFreeDevice(usbDevice *dev)
} }
int usbDeviceFileIterate(virConnectPtr conn, int usbDeviceFileIterate(usbDevice *dev,
usbDevice *dev,
usbDeviceFileActor actor, usbDeviceFileActor actor,
void *opaque) void *opaque)
{ {
return (actor)(conn, dev, dev->path, opaque); return (actor)(dev, dev->path, opaque);
} }

View File

@ -39,11 +39,10 @@ void usbFreeDevice (usbDevice *dev);
* Should return 0 if successfully processed, or * Should return 0 if successfully processed, or
* -1 to indicate error and abort iteration * -1 to indicate error and abort iteration
*/ */
typedef int (*usbDeviceFileActor)(virConnectPtr conn, usbDevice *dev, typedef int (*usbDeviceFileActor)(usbDevice *dev,
const char *path, void *opaque); const char *path, void *opaque);
int usbDeviceFileIterate(virConnectPtr conn, int usbDeviceFileIterate(usbDevice *dev,
usbDevice *dev,
usbDeviceFileActor actor, usbDeviceFileActor actor,
void *opaque); void *opaque);

View File

@ -1194,8 +1194,7 @@ pciDeviceListFind(pciDeviceList *list, pciDevice *dev)
} }
int pciDeviceFileIterate(virConnectPtr conn, int pciDeviceFileIterate(pciDevice *dev,
pciDevice *dev,
pciDeviceFileActor actor, pciDeviceFileActor actor,
void *opaque) void *opaque)
{ {
@ -1228,7 +1227,7 @@ int pciDeviceFileIterate(virConnectPtr conn,
virReportOOMError(); virReportOOMError();
goto cleanup; goto cleanup;
} }
if ((actor)(conn, dev, file, opaque) < 0) if ((actor)(dev, file, opaque) < 0)
goto cleanup; goto cleanup;
VIR_FREE(file); VIR_FREE(file);

View File

@ -61,11 +61,10 @@ pciDevice * pciDeviceListFind (pciDeviceList *list,
* Should return 0 if successfully processed, or * Should return 0 if successfully processed, or
* -1 to indicate error and abort iteration * -1 to indicate error and abort iteration
*/ */
typedef int (*pciDeviceFileActor)(virConnectPtr conn, pciDevice *dev, typedef int (*pciDeviceFileActor)(pciDevice *dev,
const char *path, void *opaque); const char *path, void *opaque);
int pciDeviceFileIterate(virConnectPtr conn, int pciDeviceFileIterate(pciDevice *dev,
pciDevice *dev,
pciDeviceFileActor actor, pciDeviceFileActor actor,
void *opaque); void *opaque);