[gvfs] udisks2: Handle x-gvfs- options not only for fstab entries



commit 959db3e0d89947bca27c5e820314effca6e818aa
Author: Ondrej Holy <oholy redhat com>
Date:   Thu Apr 26 13:37:01 2018 +0200

    udisks2: Handle x-gvfs- options not only for fstab entries
    
    GVfsUDisks2VolumeMonitor handles x-gvfs-hide/x-gvfs-show mount options
    used to overwrite our heuristics whether the mount should be shown, or
    hidden. Unfortunately, it works currently only for mounts with
    corresponding fstab entries, because the options are read over
    g_unix_mount_point_get_options. Let's use the newly introduced
    g_unix_mount_get_options to allow reading of the options for all sort
    of mounts (e.g. created over pam_mount, or manually mounted).
    
    Update GLib dependency accordingly.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=795578

 meson.build                                |    2 +-
 monitor/udisks2/gvfsudisks2volumemonitor.c |   16 +++++++++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index 9e83174..f171ea5 100644
--- a/meson.build
+++ b/meson.build
@@ -224,7 +224,7 @@ have_version_script = host_machine.system().contains('linux') and cc.has_argumen
 
 gio_dep = dependency('gio-2.0')
 gio_unix_dep = dependency('gio-unix-2.0')
-glib_dep = dependency('glib-2.0', version: '>= 2.51.0')
+glib_dep = dependency('glib-2.0', version: '>= 2.57.1')
 gobject_dep = dependency('gobject-2.0')
 
 # *** Check for libXML ***
diff --git a/monitor/udisks2/gvfsudisks2volumemonitor.c b/monitor/udisks2/gvfsudisks2volumemonitor.c
index aab30c3..e1d67fb 100644
--- a/monitor/udisks2/gvfsudisks2volumemonitor.c
+++ b/monitor/udisks2/gvfsudisks2volumemonitor.c
@@ -698,8 +698,20 @@ should_include_mount (GVfsUDisks2VolumeMonitor  *monitor,
                       GUnixMountEntry           *mount_entry)
 {
   GUnixMountPoint *mount_point;
+  const gchar *options;
   gboolean ret;
 
+  /* g_unix_mount_get_options works only with libmount,
+   * see https://bugzilla.gnome.org/show_bug.cgi?id=668132
+   */
+  options = g_unix_mount_get_options (mount_entry);
+  if (options != NULL)
+    {
+      ret = should_include (g_unix_mount_get_mount_path (mount_entry),
+                            options);
+      goto out;
+    }
+
   /* if mounted at the designated mount point, use that info to decide */
   mount_point = get_mount_point_for_mount (mount_entry);
   if (mount_point != NULL)
@@ -709,9 +721,7 @@ should_include_mount (GVfsUDisks2VolumeMonitor  *monitor,
       goto out;
     }
 
-  /* otherwise, use the mount's info */
-  ret = should_include (g_unix_mount_get_mount_path (mount_entry),
-                        NULL); /* no mount options yet - see bug 668132 */
+  ret = should_include (g_unix_mount_get_mount_path (mount_entry), NULL);
 
  out:
   return ret;


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