Blame SOURCES/udisks-2.9.2-udisksdaemonutil-Refactor-udisks_daemon_util_trigger.patch

20ccde
From 8d5c90a1f4bbe548a1ae361f8d69970669d6e72e Mon Sep 17 00:00:00 2001
20ccde
From: Tomas Bzatek <tbzatek@redhat.com>
20ccde
Date: Fri, 13 Nov 2020 16:52:11 +0100
20ccde
Subject: [PATCH 1/2] udisksdaemonutil: Refactor
20ccde
 udisks_daemon_util_trigger_uevent() out of UDisksLinuxBlockObject
20ccde
20ccde
This decouples uevent triggering from UDisksLinuxBlockObject as sometimes
20ccde
we don't have a block object yet or it's outdated.
20ccde
---
20ccde
 doc/udisks2-sections.txt.daemon.sections.in |   2 +
20ccde
 src/udisksdaemonutil.c                      | 230 ++++++++++++++++++++
20ccde
 src/udisksdaemonutil.h                      |   7 +
20ccde
 src/udiskslinuxblockobject.c                | 180 ++-------------
20ccde
 4 files changed, 253 insertions(+), 166 deletions(-)
20ccde
20ccde
diff --git a/doc/udisks2-sections.txt.daemon.sections.in b/doc/udisks2-sections.txt.daemon.sections.in
20ccde
index 26c3c2cd..3030fa95 100644
20ccde
--- a/doc/udisks2-sections.txt.daemon.sections.in
20ccde
+++ b/doc/udisks2-sections.txt.daemon.sections.in
20ccde
@@ -307,6 +307,8 @@ udisks_daemon_util_file_set_contents
20ccde
 udisks_daemon_util_on_user_seat
20ccde
 udisks_daemon_util_get_free_mdraid_device
20ccde
 udisks_ata_identify_get_word
20ccde
+udisks_daemon_util_trigger_uevent
20ccde
+udisks_daemon_util_trigger_uevent_sync
20ccde
 </SECTION>
20ccde
 
20ccde
 <SECTION>
20ccde
diff --git a/src/udisksdaemonutil.c b/src/udisksdaemonutil.c
20ccde
index 75b877a0..d16c0766 100644
20ccde
--- a/src/udisksdaemonutil.c
20ccde
+++ b/src/udisksdaemonutil.c
20ccde
@@ -34,10 +34,14 @@
20ccde
 #include <limits.h>
20ccde
 #include <stdlib.h>
20ccde
 
20ccde
+#include <blockdev/blockdev.h>
20ccde
+
20ccde
 #include "udisksdaemon.h"
20ccde
 #include "udisksdaemonutil.h"
20ccde
 #include "udisksstate.h"
20ccde
 #include "udiskslogging.h"
20ccde
+#include "udiskslinuxdevice.h"
20ccde
+#include "udiskslinuxprovider.h"
20ccde
 #include "udiskslinuxblockobject.h"
20ccde
 #include "udiskslinuxdriveobject.h"
20ccde
 
20ccde
@@ -1626,3 +1630,229 @@ udisks_ata_identify_get_word (const guchar *identify_data, guint word_number)
20ccde
  out:
20ccde
   return ret;
20ccde
 }
20ccde
+
20ccde
+
20ccde
+/* ---------------------------------------------------------------------------------------------------- */
20ccde
+
20ccde
+static volatile guint uevent_serial = 0;
20ccde
+
20ccde
+static gboolean
20ccde
+trigger_uevent (const gchar *path, const gchar *str)
20ccde
+{
20ccde
+  gint fd;
20ccde
+
20ccde
+  fd = open (path, O_WRONLY);
20ccde
+  if (fd < 0)
20ccde
+    {
20ccde
+      udisks_warning ("Error opening %s while triggering uevent: %m", path);
20ccde
+      return FALSE;
20ccde
+    }
20ccde
+
20ccde
+  if (write (fd, str, strlen (str)) != (ssize_t) strlen (str))
20ccde
+    {
20ccde
+      udisks_warning ("Error writing '%s' to file %s: %m", str, path);
20ccde
+      close (fd);
20ccde
+      return FALSE;
20ccde
+    }
20ccde
+
20ccde
+  close (fd);
20ccde
+  return TRUE;
20ccde
+}
20ccde
+
20ccde
+typedef struct
20ccde
+{
20ccde
+  UDisksDaemon *daemon;
20ccde
+  GMainLoop *main_loop;
20ccde
+  guint serial;
20ccde
+  gchar *uevent_path;
20ccde
+  gboolean success;
20ccde
+} SynthUeventData;
20ccde
+
20ccde
+static gboolean
20ccde
+trigger_uevent_idle_cb (gpointer user_data)
20ccde
+{
20ccde
+  SynthUeventData *data = user_data;
20ccde
+  gchar *str;
20ccde
+
20ccde
+  str = g_strdup_printf ("change %s UDISKSSERIAL=%u", udisks_daemon_get_uuid (data->daemon), data->serial);
20ccde
+
20ccde
+  if (! trigger_uevent (data->uevent_path, str))
20ccde
+    {
20ccde
+      /* kernel refused our string, try simple "change" but don't wait for it */
20ccde
+      trigger_uevent (data->uevent_path, "change");
20ccde
+      data->success = FALSE;
20ccde
+      g_main_loop_quit (data->main_loop);
20ccde
+    }
20ccde
+  g_free (str);
20ccde
+
20ccde
+  /* remove the source */
20ccde
+  return FALSE;
20ccde
+}
20ccde
+
20ccde
+static gboolean
20ccde
+uevent_wait_timeout_cb (gpointer user_data)
20ccde
+{
20ccde
+  SynthUeventData *data = user_data;
20ccde
+
20ccde
+  data->success = FALSE;
20ccde
+  g_main_loop_quit (data->main_loop);
20ccde
+
20ccde
+  /* remove the source */
20ccde
+  return FALSE;
20ccde
+}
20ccde
+
20ccde
+static void
20ccde
+uevent_probed_cb (UDisksLinuxProvider *provider,
20ccde
+                  const gchar         *action,
20ccde
+                  UDisksLinuxDevice   *device,
20ccde
+                  gpointer             user_data)
20ccde
+{
20ccde
+  SynthUeventData *data = user_data;
20ccde
+  const gchar *received_serial_str;
20ccde
+  gint64 received_serial;
20ccde
+  gchar *endptr;
20ccde
+
20ccde
+  received_serial_str = g_udev_device_get_property (device->udev_device, "SYNTH_ARG_UDISKSSERIAL");
20ccde
+  if (received_serial_str != NULL)
20ccde
+    {
20ccde
+      endptr = (gchar *) received_serial_str;
20ccde
+      received_serial = g_ascii_strtoll (received_serial_str, &endptr, 0);
20ccde
+      if (endptr != received_serial_str && received_serial == data->serial)
20ccde
+        {
20ccde
+          data->success = TRUE;
20ccde
+          g_main_loop_quit (data->main_loop);
20ccde
+        }
20ccde
+    }
20ccde
+}
20ccde
+
20ccde
+/**
20ccde
+ * udisks_daemon_util_trigger_uevent:
20ccde
+ * @daemon: A #UDisksDaemon.
20ccde
+ * @device_path: Block device path.
20ccde
+ *
20ccde
+ * Triggers a 'change' uevent in the kernel.
20ccde
+ *
20ccde
+ * The triggered event will bubble up from the kernel through the udev
20ccde
+ * stack and will eventually be received by the udisks daemon process
20ccde
+ * itself. This method does not wait for the event to be received.
20ccde
+ */
20ccde
+void
20ccde
+udisks_daemon_util_trigger_uevent (UDisksDaemon *daemon,
20ccde
+                                   const gchar  *device_path)
20ccde
+{
20ccde
+  GUdevClient *gudev_client;
20ccde
+  GUdevDevice *gudev_device;
20ccde
+  gchar *path;
20ccde
+
20ccde
+  g_return_if_fail (UDISKS_IS_DAEMON (daemon));
20ccde
+  g_return_if_fail (device_path != NULL);
20ccde
+
20ccde
+  gudev_client = udisks_linux_provider_get_udev_client (udisks_daemon_get_linux_provider (daemon));
20ccde
+  gudev_device = g_udev_client_query_by_device_file (gudev_client, device_path);
20ccde
+  if (gudev_device == NULL)
20ccde
+    {
20ccde
+      udisks_critical ("Device %s not found in udev database, skipping uevent trigger", device_path);
20ccde
+      return;
20ccde
+    }
20ccde
+
20ccde
+  path = g_build_filename (g_udev_device_get_sysfs_path (gudev_device), "uevent", NULL);
20ccde
+  trigger_uevent (path, "change");
20ccde
+  g_free (path);
20ccde
+
20ccde
+  g_object_unref (gudev_device);
20ccde
+}
20ccde
+
20ccde
+/**
20ccde
+ * udisks_daemon_util_trigger_uevent_sync:
20ccde
+ * @daemon: A #UDisksDaemon.
20ccde
+ * @device_path: Block device path.
20ccde
+ * @timeout_seconds: Maximum time to wait for the uevent (in seconds).
20ccde
+ *
20ccde
+ * Triggers a 'change' uevent in the kernel and waits until it's received and
20ccde
+ * processed by udisks.
20ccde
+ *
20ccde
+ * Unlike udisks_daemon_util_trigger_uevent() that just triggers
20ccde
+ * a synthetic uevent to the kernel, this call will actually block and wait until
20ccde
+ * the #UDisksLinuxProvider receives the uevent, performs probing and processes
20ccde
+ * the uevent further down the UDisks object stack. Upon returning from this
20ccde
+ * function call the caller may assume the event has been fully processed, all
20ccde
+ * D-Bus objects are updated and settled. Typically used in busy wait for
20ccde
+ * a particular D-Bus interface.
20ccde
+ *
20ccde
+ * Note that this uses synthetic uevent tagging and only works on linux kernel
20ccde
+ * 4.13 and higher. In case an older kernel is detected this acts like the classic
20ccde
+ * udisks_daemon_util_trigger_uevent() call and %FALSE is returned.
20ccde
+ *
20ccde
+ * Returns: %TRUE if the uevent has been successfully received, %FALSE otherwise
20ccde
+ * or when the kernel version is too old.
20ccde
+ */
20ccde
+gboolean
20ccde
+udisks_daemon_util_trigger_uevent_sync (UDisksDaemon *daemon,
20ccde
+                                        const gchar  *device_path,
20ccde
+                                        guint         timeout_seconds)
20ccde
+{
20ccde
+  UDisksLinuxProvider *provider;
20ccde
+  GUdevClient *gudev_client;
20ccde
+  GUdevDevice *gudev_device;
20ccde
+  SynthUeventData data;
20ccde
+  GMainContext *main_context;
20ccde
+  GSource *idle_source;
20ccde
+  GSource *timeout_source;
20ccde
+
20ccde
+  g_return_val_if_fail (UDISKS_IS_DAEMON (daemon), FALSE);
20ccde
+  g_return_val_if_fail (device_path != NULL, FALSE);
20ccde
+
20ccde
+  if (bd_utils_check_linux_version (4, 13, 0) < 0)
20ccde
+    {
20ccde
+      udisks_daemon_util_trigger_uevent (daemon, device_path);
20ccde
+      return FALSE;
20ccde
+    }
20ccde
+
20ccde
+  provider = udisks_daemon_get_linux_provider (daemon);
20ccde
+  gudev_client = udisks_linux_provider_get_udev_client (provider);
20ccde
+  gudev_device = g_udev_client_query_by_device_file (gudev_client, device_path);
20ccde
+  if (gudev_device == NULL)
20ccde
+    {
20ccde
+      udisks_critical ("Device %s not found in udev database, skipping uevent trigger", device_path);
20ccde
+      return FALSE;
20ccde
+    }
20ccde
+
20ccde
+  data.daemon = daemon;
20ccde
+  data.uevent_path = g_build_filename (g_udev_device_get_sysfs_path (gudev_device), "uevent", NULL);
20ccde
+  data.serial = g_atomic_int_add (&uevent_serial, 1);
20ccde
+
20ccde
+  main_context = g_main_context_new ();
20ccde
+  g_main_context_push_thread_default (main_context);
20ccde
+  data.main_loop = g_main_loop_new (main_context, FALSE);
20ccde
+
20ccde
+  /* queue the actual trigger in the loop */
20ccde
+  idle_source = g_idle_source_new ();
20ccde
+  g_source_set_callback (idle_source, (GSourceFunc) trigger_uevent_idle_cb, &data, NULL);
20ccde
+  g_source_attach (idle_source, main_context);
20ccde
+  g_source_unref (idle_source);
20ccde
+
20ccde
+  /* add timeout as a fallback */
20ccde
+  timeout_source = g_timeout_source_new_seconds (timeout_seconds);
20ccde
+  g_source_set_callback (timeout_source, (GSourceFunc) uevent_wait_timeout_cb, &data, NULL);
20ccde
+  g_source_attach (timeout_source, main_context);
20ccde
+  g_source_unref (timeout_source);
20ccde
+
20ccde
+  /* catch incoming uevents */
20ccde
+  g_signal_connect (provider, "uevent-probed", G_CALLBACK (uevent_probed_cb), &data);
20ccde
+
20ccde
+  data.success = FALSE;
20ccde
+  g_main_loop_run (data.main_loop);
20ccde
+
20ccde
+  g_signal_handlers_disconnect_by_func (provider, uevent_probed_cb, &data);
20ccde
+  g_main_context_pop_thread_default (main_context);
20ccde
+
20ccde
+  g_main_loop_unref (data.main_loop);
20ccde
+  g_main_context_unref (main_context);
20ccde
+
20ccde
+  g_free (data.uevent_path);
20ccde
+  g_object_unref (gudev_device);
20ccde
+
20ccde
+  return data.success;
20ccde
+}
20ccde
+
20ccde
+/* ---------------------------------------------------------------------------------------------------- */
20ccde
diff --git a/src/udisksdaemonutil.h b/src/udisksdaemonutil.h
20ccde
index 4fe36214..2edf2122 100644
20ccde
--- a/src/udisksdaemonutil.h
20ccde
+++ b/src/udisksdaemonutil.h
20ccde
@@ -51,6 +51,13 @@ guint64 udisks_daemon_util_block_get_size (GUdevDevice *device,
20ccde
                                            gboolean    *out_media_available,
20ccde
                                            gboolean    *out_media_change_detected);
20ccde
 
20ccde
+void udisks_daemon_util_trigger_uevent (UDisksDaemon *daemon,
20ccde
+                                        const gchar  *device_path);
20ccde
+
20ccde
+gboolean udisks_daemon_util_trigger_uevent_sync (UDisksDaemon *daemon,
20ccde
+                                                 const gchar  *device_path,
20ccde
+                                                 guint         timeout_seconds);
20ccde
+
20ccde
 gchar *udisks_daemon_util_resolve_link (const gchar *path,
20ccde
                                         const gchar *name);
20ccde
 
20ccde
diff --git a/src/udiskslinuxblockobject.c b/src/udiskslinuxblockobject.c
20ccde
index 42ab17d7..5a68c84b 100644
20ccde
--- a/src/udiskslinuxblockobject.c
20ccde
+++ b/src/udiskslinuxblockobject.c
20ccde
@@ -38,8 +38,6 @@
20ccde
 #include <stdlib.h>
20ccde
 #include <glib/gstdio.h>
20ccde
 
20ccde
-#include <blockdev/blockdev.h>
20ccde
-
20ccde
 #include "udiskslogging.h"
20ccde
 #include "udisksdaemon.h"
20ccde
 #include "udisksdaemonutil.h"
20ccde
@@ -959,122 +957,24 @@ on_mount_monitor_mount_removed (UDisksMountMonitor  *monitor,
20ccde
 
20ccde
 /* ---------------------------------------------------------------------------------------------------- */
20ccde
 
20ccde
-static volatile guint uevent_serial = 0;
20ccde
-
20ccde
-static gboolean
20ccde
-trigger_uevent (const gchar *path, const gchar *str)
20ccde
-{
20ccde
-  gint fd;
20ccde
-
20ccde
-  fd = open (path, O_WRONLY);
20ccde
-  if (fd < 0)
20ccde
-    {
20ccde
-      udisks_warning ("Error opening %s while triggering uevent: %m", path);
20ccde
-      return FALSE;
20ccde
-    }
20ccde
-
20ccde
-  if (write (fd, str, strlen (str)) != (ssize_t) strlen (str))
20ccde
-    {
20ccde
-      udisks_warning ("Error writing '%s' to file %s: %m", str, path);
20ccde
-      close (fd);
20ccde
-      return FALSE;
20ccde
-    }
20ccde
-
20ccde
-  close (fd);
20ccde
-  return TRUE;
20ccde
-}
20ccde
-
20ccde
-typedef struct
20ccde
-{
20ccde
-  UDisksLinuxBlockObject *object;
20ccde
-  GMainLoop *main_loop;
20ccde
-  guint serial;
20ccde
-  gchar *uevent_path;
20ccde
-  gboolean success;
20ccde
-} SynthUeventData;
20ccde
-
20ccde
-static gboolean
20ccde
-trigger_uevent_idle_cb (gpointer user_data)
20ccde
-{
20ccde
-  SynthUeventData *data = user_data;
20ccde
-  gchar *str;
20ccde
-
20ccde
-  str = g_strdup_printf ("change %s UDISKSSERIAL=%u", udisks_daemon_get_uuid (data->object->daemon), data->serial);
20ccde
-
20ccde
-  if (! trigger_uevent (data->uevent_path, str))
20ccde
-    {
20ccde
-      /* kernel refused our string, try simple "change" but don't wait for it */
20ccde
-      trigger_uevent (data->uevent_path, "change");
20ccde
-      data->success = FALSE;
20ccde
-      g_main_loop_quit (data->main_loop);
20ccde
-    }
20ccde
-  g_free (str);
20ccde
-
20ccde
-  /* remove the source */
20ccde
-  return FALSE;
20ccde
-}
20ccde
-
20ccde
-static gboolean
20ccde
-uevent_wait_timeout_cb (gpointer user_data)
20ccde
-{
20ccde
-  SynthUeventData *data = user_data;
20ccde
-
20ccde
-  data->success = FALSE;
20ccde
-  g_main_loop_quit (data->main_loop);
20ccde
-
20ccde
-  /* remove the source */
20ccde
-  return FALSE;
20ccde
-}
20ccde
-
20ccde
-static void
20ccde
-uevent_probed_cb (UDisksLinuxProvider *provider,
20ccde
-                  const gchar         *action,
20ccde
-                  UDisksLinuxDevice   *device,
20ccde
-                  gpointer             user_data)
20ccde
-{
20ccde
-  SynthUeventData *data = user_data;
20ccde
-  const gchar *received_serial_str;
20ccde
-  gint64 received_serial;
20ccde
-  gchar *endptr;
20ccde
-
20ccde
-  received_serial_str = g_udev_device_get_property (device->udev_device, "SYNTH_ARG_UDISKSSERIAL");
20ccde
-  if (received_serial_str != NULL)
20ccde
-    {
20ccde
-      endptr = (gchar *) received_serial_str;
20ccde
-      received_serial = g_ascii_strtoll (received_serial_str, &endptr, 0);
20ccde
-      if (endptr != received_serial_str && received_serial == data->serial)
20ccde
-        {
20ccde
-          data->success = TRUE;
20ccde
-          g_main_loop_quit (data->main_loop);
20ccde
-        }
20ccde
-    }
20ccde
-}
20ccde
-
20ccde
 /**
20ccde
  * udisks_linux_block_object_trigger_uevent:
20ccde
  * @object: A #UDisksLinuxBlockObject.
20ccde
  *
20ccde
  * Triggers a 'change' uevent in the kernel.
20ccde
  *
20ccde
- * The triggered event will bubble up from the kernel through the udev
20ccde
- * stack and will eventually be received by the udisks daemon process
20ccde
- * itself. This method does not wait for the event to be received.
20ccde
+ * Refer to udisks_daemon_util_trigger_uevent() for detailed description.
20ccde
  */
20ccde
 void
20ccde
 udisks_linux_block_object_trigger_uevent (UDisksLinuxBlockObject *object)
20ccde
 {
20ccde
-  UDisksLinuxDevice *device;
20ccde
-  gchar *path;
20ccde
+  gchar *device_file;
20ccde
 
20ccde
   g_return_if_fail (UDISKS_IS_LINUX_BLOCK_OBJECT (object));
20ccde
 
20ccde
-  device = udisks_linux_block_object_get_device (object);
20ccde
-  path = g_strconcat (g_udev_device_get_sysfs_path (device->udev_device), "/uevent", NULL);
20ccde
-
20ccde
-  trigger_uevent (path, "change");
20ccde
-
20ccde
-  g_free (path);
20ccde
-  g_object_unref (device);
20ccde
+  device_file = udisks_linux_block_object_get_device_file (object);
20ccde
+  udisks_daemon_util_trigger_uevent (object->daemon, device_file);
20ccde
+  g_free (device_file);
20ccde
 }
20ccde
 
20ccde
 /**
20ccde
@@ -1083,19 +983,10 @@ udisks_linux_block_object_trigger_uevent (UDisksLinuxBlockObject *object)
20ccde
  * @timeout_seconds: Maximum time to wait for the uevent (in seconds).
20ccde
  *
20ccde
  * Triggers a 'change' uevent in the kernel and waits until it's received and
20ccde
- * processed by udisks.
20ccde
- *
20ccde
- * Unlike udisks_linux_block_object_trigger_uevent() that just triggers
20ccde
- * a synthetic uevent to the kernel, this call will actually block and wait until
20ccde
- * the #UDisksLinuxProvider receives the uevent, performs probing and processes
20ccde
- * the uevent further down the UDisks object stack. Upon returning from this
20ccde
- * function call the caller may assume the event has been fully processed, all
20ccde
- * D-Bus objects are updated and settled. Typically used in busy wait for
20ccde
- * a particular D-Bus interface.
20ccde
+ * processed through the uevent queue.
20ccde
  *
20ccde
- * Note that this uses synthetic uevent tagging and only works on linux kernel
20ccde
- * 4.13 and higher. In case an older kernel is detected this acts like the classic
20ccde
- * udisks_linux_block_object_trigger_uevent() call and %FALSE is returned.
20ccde
+ * This is a convenient wrapper around udisks_daemon_util_trigger_uevent_sync().
20ccde
+ * Refer to this function for detailed documentation.
20ccde
  *
20ccde
  * Returns: %TRUE if the uevent has been successfully received, %FALSE otherwise
20ccde
  * or when the kernel version is too old.
20ccde
@@ -1104,59 +995,16 @@ gboolean
20ccde
 udisks_linux_block_object_trigger_uevent_sync (UDisksLinuxBlockObject *object,
20ccde
                                                guint                   timeout_seconds)
20ccde
 {
20ccde
-  UDisksLinuxDevice *device;
20ccde
-  UDisksLinuxProvider *provider;
20ccde
-  SynthUeventData data;
20ccde
-  GMainContext *main_context;
20ccde
-  GSource *idle_source;
20ccde
-  GSource *timeout_source;
20ccde
+  gchar *device_file;
20ccde
+  gboolean ret;
20ccde
 
20ccde
   g_return_val_if_fail (UDISKS_IS_LINUX_BLOCK_OBJECT (object), FALSE);
20ccde
 
20ccde
-  if (bd_utils_check_linux_version (4, 13, 0) < 0)
20ccde
-    {
20ccde
-      udisks_linux_block_object_trigger_uevent (object);
20ccde
-      return FALSE;
20ccde
-    }
20ccde
-
20ccde
-  data.object = object;
20ccde
-  device = udisks_linux_block_object_get_device (object);
20ccde
-  data.uevent_path = g_strconcat (g_udev_device_get_sysfs_path (device->udev_device), "/uevent", NULL);
20ccde
-  data.serial = g_atomic_int_add (&uevent_serial, 1);
20ccde
-
20ccde
-  main_context = g_main_context_new ();
20ccde
-  g_main_context_push_thread_default (main_context);
20ccde
-  data.main_loop = g_main_loop_new (main_context, FALSE);
20ccde
-
20ccde
-  /* queue the actual trigger in the loop */
20ccde
-  idle_source = g_idle_source_new ();
20ccde
-  g_source_set_callback (idle_source, (GSourceFunc) trigger_uevent_idle_cb, &data, NULL);
20ccde
-  g_source_attach (idle_source, main_context);
20ccde
-  g_source_unref (idle_source);
20ccde
+  device_file = udisks_linux_block_object_get_device_file (object);
20ccde
+  ret = udisks_daemon_util_trigger_uevent_sync (object->daemon, device_file, timeout_seconds);
20ccde
+  g_free (device_file);
20ccde
 
20ccde
-  /* add timeout as a fallback */
20ccde
-  timeout_source = g_timeout_source_new_seconds (timeout_seconds);
20ccde
-  g_source_set_callback (timeout_source, (GSourceFunc) uevent_wait_timeout_cb, &data, NULL);
20ccde
-  g_source_attach (timeout_source, main_context);
20ccde
-  g_source_unref (timeout_source);
20ccde
-
20ccde
-  /* catch incoming uevents */
20ccde
-  provider = udisks_daemon_get_linux_provider (object->daemon);
20ccde
-  g_signal_connect (provider, "uevent-probed", G_CALLBACK (uevent_probed_cb), &data);
20ccde
-
20ccde
-  data.success = FALSE;
20ccde
-  g_main_loop_run (data.main_loop);
20ccde
-
20ccde
-  g_signal_handlers_disconnect_by_func (provider, uevent_probed_cb, &data);
20ccde
-  g_main_context_pop_thread_default (main_context);
20ccde
-
20ccde
-  g_main_loop_unref (data.main_loop);
20ccde
-  g_main_context_unref (main_context);
20ccde
-
20ccde
-  g_free (data.uevent_path);
20ccde
-  g_object_unref (device);
20ccde
-
20ccde
-  return data.success;
20ccde
+  return ret;
20ccde
 }
20ccde
 
20ccde
 /* ---------------------------------------------------------------------------------------------------- */
20ccde
-- 
20ccde
2.26.2
20ccde