Re: [RFC PATCH v1 09/15] node_device_udev: Add prefix `udev` for udev related data

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

 



On 4/12/24 8:36 AM, Marc Hartmayer wrote:
The new names make it easier to understand the purpose of the data.

Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx>
Signed-off-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxx>
---
  src/node_device/node_device_udev.c | 48 +++++++++++++++---------------
  1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 0c393b6233a4..a121ad99a676 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -63,11 +63,11 @@ struct _udevEventData {
      struct udev_monitor *udev_monitor;
      int watch;
- /* Thread data */
-    virThread *th;
-    virCond threadCond;
-    bool threadQuit;
-    bool dataReady;
+    /* Udev thread data */
+    virThread *udevThread;
+    virCond udevThreadCond;
+    bool udevThreadQuit;
+    bool udevDataReady;
/* init thread */
      virThread *initThread;
@@ -105,7 +105,7 @@ udevEventDataDispose(void *obj)
      }
      virMutexDestroy(&priv->mdevctlLock);
- virCondDestroy(&priv->threadCond);
+    virCondDestroy(&priv->udevThreadCond);
  }
@@ -131,7 +131,7 @@ udevEventDataNew(void)
      if (!(ret = virObjectLockableNew(udevEventDataClass)))
          return NULL;
- if (virCondInit(&ret->threadCond) < 0) {
+    if (virCondInit(&ret->udevThreadCond) < 0) {
          virObjectUnref(ret);
          return NULL;
      }
@@ -1747,16 +1747,16 @@ nodeStateCleanup(void)
      priv = driver->privateData;
      if (priv) {
          VIR_WITH_OBJECT_LOCK_GUARD(priv) {
-            priv->threadQuit = true;
-            virCondSignal(&priv->threadCond);
+            priv->udevThreadQuit = true;
+            virCondSignal(&priv->udevThreadCond);
          }
          if (priv->initThread) {
              virThreadJoin(priv->initThread);
              g_clear_pointer(&priv->initThread, g_free);
          }
-        if (priv->th) {
-            virThreadJoin(priv->th);
-            g_clear_pointer(&priv->th, g_free);
+        if (priv->udevThread) {
+            virThreadJoin(priv->udevThread);
+            g_clear_pointer(&priv->udevThread, g_free);
          }
      }
@@ -1865,15 +1865,15 @@ udevEventHandleThread(void *opaque G_GNUC_UNUSED)
      /* continue rather than break from the loop on non-fatal errors */
      while (1) {
          VIR_WITH_OBJECT_LOCK_GUARD(priv) {
-            while (!priv->dataReady && !priv->threadQuit) {
-                if (virCondWait(&priv->threadCond, &priv->parent.lock)) {
+            while (!priv->udevDataReady && !priv->udevThreadQuit) {
+                if (virCondWait(&priv->udevThreadCond, &priv->parent.lock)) {
                      virReportSystemError(errno, "%s",
                                           _("handler failed to wait on condition"));
                      return;
                  }
              }
- if (priv->threadQuit)
+            if (priv->udevThreadQuit)
                  return;
errno = 0;
@@ -1904,7 +1904,7 @@ udevEventHandleThread(void *opaque G_GNUC_UNUSED)
               * after the udev_monitor_receive_device wouldn't help much
               * due to event mgmt and scheduler timing. */
              VIR_WITH_OBJECT_LOCK_GUARD(priv) {
-                priv->dataReady = false;
+                priv->udevDataReady = false;
              }
continue;
@@ -1931,11 +1931,11 @@ udevEventHandleCallback(int watch G_GNUC_UNUSED,
      VIR_LOCK_GUARD lock = virObjectLockGuard(priv);
if (!udevEventMonitorSanityCheck(priv, fd))
-        priv->threadQuit = true;
+        priv->udevThreadQuit = true;
      else
-        priv->dataReady = true;
+        priv->udevDataReady = true;
- virCondSignal(&priv->threadCond);
+    virCondSignal(&priv->udevThreadCond);
  }
@@ -2045,8 +2045,8 @@ nodeStateInitializeEnumerate(void *opaque)
      VIR_WITH_OBJECT_LOCK_GUARD(priv) {
          ignore_value(virEventRemoveHandle(priv->watch));
          priv->watch = -1;
-        priv->threadQuit = true;
-        virCondSignal(&priv->threadCond);
+        priv->udevThreadQuit = true;
+        virCondSignal(&priv->udevThreadCond);
      }
goto cleanup;
@@ -2344,12 +2344,12 @@ nodeStateInitialize(bool privileged,
          udev_monitor_set_receive_buffer_size(priv->udev_monitor,
                                               128 * 1024 * 1024);
- priv->th = g_new0(virThread, 1);
-    if (virThreadCreateFull(priv->th, true, udevEventHandleThread,
+    priv->udevThread = g_new0(virThread, 1);
+    if (virThreadCreateFull(priv->udevThread, true, udevEventHandleThread,
                              "udev-event", false, NULL) < 0) {
          virReportSystemError(errno, "%s",
                               _("failed to create udev handler thread"));
-        g_clear_pointer(&priv->th, g_free);
+        g_clear_pointer(&priv->udevThread, g_free);
          goto unlock;
      }


Sure.

Reviewed-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[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