Revert "Bug 34710 — CD-ROM polling failed due to O_EXCL flag"
authorDavid Zeuthen <davidz@redhat.com>
Fri, 26 Aug 2011 17:09:40 +0000 (13:09 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Fri, 26 Aug 2011 17:09:40 +0000 (13:09 -0400)
This reverts commit 2d0272eb3be71f6ee3f52c55a3d608764b675fb0.

src/device-private.h
src/device.c
src/poller.c

index e519083..a6db7f2 100644 (file)
@@ -59,9 +59,6 @@ struct DevicePrivate
   gboolean job_is_cancellable;
   double job_percentage;
 
-  gboolean checked_in_kernel_polling;
-  gboolean using_in_kernel_polling;
-
   guint linux_md_poll_timeout_id;
 
   /* A list of current polling inhibitors (Inhibitor objects) */
index c4b4ab3..b30fe1c 100644 (file)
@@ -6213,12 +6213,7 @@ filesystem_mount_completed_cb (DBusGMethodInvocation *context,
 
       update_info (device);
       drain_pending_changes (device, FALSE);
-      /* If the kernel and device support sending EJECT_REQUEST change uevents
-       * and we use in-kernel polling, keep the door locked, as udev calls
-       * eject on pressing the button.  Otherwise unlock it, to keep the
-       * hardware button working without userspace support */
-      if (!device->priv->using_in_kernel_polling)
-        unlock_cd_tray (device);
+      unlock_cd_tray (device);
 
       dbus_g_method_return (context, data->mount_point);
     }
index cc807d8..9517b5d 100644 (file)
@@ -31,7 +31,6 @@
 #include <fcntl.h>
 #include <string.h>
 #include <errno.h>
-#include <gudev/gudev.h>
 
 #include "poller.h"
 #include "device.h"
@@ -305,52 +304,6 @@ poller_setup (int argc,
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static gboolean
-check_in_kernel_polling (Device* d)
-{
-  /* only check once */
-  if (!d->priv->checked_in_kernel_polling)
-    {
-      int poll_time;
-      int fd;
-      char c;
-
-      d->priv->checked_in_kernel_polling = TRUE;
-
-      poll_time = g_udev_device_get_sysfs_attr_as_int (d->priv->d, "events_poll_msecs");
-#ifdef POLL_SHOW_DEBUG
-      g_print("**** POLLER (%d): per-device poll time for %s: %i\n", getpid (), d->priv->device_file, poll_time);
-#endif
-
-      if (poll_time >= 0)
-       {
-         d->priv->using_in_kernel_polling = (poll_time > 0);
-         goto out;
-       }
-
-      /* -1 means using global polling interval, so check the global default */
-      /* check global default */
-      fd = open("/sys/module/block/parameters/events_dfl_poll_msecs", O_RDONLY);
-      if (fd > 0)
-       {
-         if (read (fd, &c, 1) > 0)
-           {
-#ifdef POLL_SHOW_DEBUG
-             g_print("**** POLLER (%d): global poll time first char: %c\n", getpid (), c);
-#endif
-             /* if this is positive, we use in-kernel polling */
-             d->priv->using_in_kernel_polling = (c != '0' && c != '-');
-           }
-         close (fd);
-       }
-    }
-
-out:
-  return d->priv->using_in_kernel_polling;
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
 void
 poller_set_devices (GList *devices)
 {
@@ -367,14 +320,6 @@ poller_set_devices (GList *devices)
     {
       Device *device = DEVICE (l->data);
 
-      if (check_in_kernel_polling (device))
-       {
-#ifdef POLL_SHOW_DEBUG
-         g_print("**** POLLER (%d): Kernel is polling %s already, ignoring\n", getpid (), device->priv->device_file);
-#endif
-         continue;
-       }
-
       device_array[n++] = device->priv->device_file;
     }