[PATCH 2/3] nodedev: Move the udevPCITranslate{Init|Deinit}

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Move the functions to the top - about to change where/when the Init
helper gets called away from the main StateInitialize.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/node_device/node_device_udev.c | 74 +++++++++++++++++++-------------------
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index e0fca6159..ca5b47767 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -126,6 +126,43 @@ udevEventDataNew(void)
 }
 
 
+static int
+udevPCITranslateInit(bool privileged ATTRIBUTE_UNUSED)
+{
+#if defined __s390__ || defined __s390x_
+    /* On s390(x) system there is no PCI bus.
+     * Therefore there is nothing to initialize here. */
+#else
+    int rc;
+
+    if ((rc = pci_system_init()) != 0) {
+        /* Ignore failure as non-root; udev is not as helpful in that
+         * situation, but a non-privileged user won't benefit much
+         * from udev in the first place.  */
+        if (errno != ENOENT && (privileged  || errno != EACCES)) {
+            virReportSystemError(rc, "%s",
+                                 _("Failed to initialize libpciaccess"));
+            return -1;
+        }
+    }
+#endif
+    return 0;
+}
+
+
+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 bool
 udevHasDeviceProperty(struct udev_device *dev,
                       const char *key)
@@ -1627,19 +1664,6 @@ 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)
 {
@@ -1911,30 +1935,6 @@ nodeStateInitializeEnumerate(void *opaque)
 
 
 static int
-udevPCITranslateInit(bool privileged ATTRIBUTE_UNUSED)
-{
-#if defined __s390__ || defined __s390x_
-    /* On s390(x) system there is no PCI bus.
-     * Therefore there is nothing to initialize here. */
-#else
-    int rc;
-
-    if ((rc = pci_system_init()) != 0) {
-        /* Ignore failure as non-root; udev is not as helpful in that
-         * situation, but a non-privileged user won't benefit much
-         * from udev in the first place.  */
-        if (errno != ENOENT && (privileged  || errno != EACCES)) {
-            virReportSystemError(rc, "%s",
-                                 _("Failed to initialize libpciaccess"));
-            return -1;
-        }
-    }
-#endif
-    return 0;
-}
-
-
-static int
 nodeStateInitialize(bool privileged,
                     virStateInhibitCallback callback ATTRIBUTE_UNUSED,
                     void *opaque ATTRIBUTE_UNUSED)
-- 
2.13.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux