mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Split out pciaccess (de)initialization
Move pci_system_init and pci_system_cleanup into separate functions, to make the conditional compilation easier to read.
This commit is contained in:
parent
b2a55dfd1f
commit
feb876660e
@ -1474,6 +1474,18 @@ static int udevEnumerateDevices(struct udev *udev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void udevPCITranslateDeinit(void)
|
||||||
|
{
|
||||||
|
#if defined __s390__ || defined __s390x_
|
||||||
|
/* Nothing was initialized, nothing needs to be cleaned up */
|
||||||
|
#else
|
||||||
|
/* pci_system_cleanup returns void */
|
||||||
|
pci_system_cleanup();
|
||||||
|
#endif
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int nodeStateCleanup(void)
|
static int nodeStateCleanup(void)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -1509,13 +1521,7 @@ static int nodeStateCleanup(void)
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined __s390__ || defined __s390x_
|
udevPCITranslateDeinit();
|
||||||
/* Nothing was initialized, nothing needs to be cleaned up */
|
|
||||||
#else
|
|
||||||
/* pci_system_cleanup returns void */
|
|
||||||
pci_system_cleanup();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1674,14 +1680,8 @@ static int udevSetupSystemDev(void)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nodeStateInitialize(bool privileged,
|
static int udevPCITranslateInit(bool privileged ATTRIBUTE_UNUSED)
|
||||||
virStateInhibitCallback callback ATTRIBUTE_UNUSED,
|
|
||||||
void *opaque ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
udevPrivate *priv = NULL;
|
|
||||||
struct udev *udev = NULL;
|
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
#if defined __s390__ || defined __s390x_
|
#if defined __s390__ || defined __s390x_
|
||||||
/* On s390(x) system there is no PCI bus.
|
/* On s390(x) system there is no PCI bus.
|
||||||
* Therefore there is nothing to initialize here. */
|
* Therefore there is nothing to initialize here. */
|
||||||
@ -1696,10 +1696,23 @@ static int nodeStateInitialize(bool privileged,
|
|||||||
char ebuf[256];
|
char ebuf[256];
|
||||||
VIR_ERROR(_("Failed to initialize libpciaccess: %s"),
|
VIR_ERROR(_("Failed to initialize libpciaccess: %s"),
|
||||||
virStrerror(pciret, ebuf, sizeof(ebuf)));
|
virStrerror(pciret, ebuf, sizeof(ebuf)));
|
||||||
goto out;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int nodeStateInitialize(bool privileged,
|
||||||
|
virStateInhibitCallback callback ATTRIBUTE_UNUSED,
|
||||||
|
void *opaque ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
udevPrivate *priv = NULL;
|
||||||
|
struct udev *udev = NULL;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
if (udevPCITranslateInit(privileged) < 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
if (VIR_ALLOC(priv) < 0)
|
if (VIR_ALLOC(priv) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
Loading…
Reference in New Issue
Block a user