[gnome-settings-daemon] housekeeping: Use g_unix_is_system_fs_type() to determine FS type



commit 6f8b69ea9c24fc08fa9a718c591a4cfd3500fb02
Author: Philip Withnall <withnall endlessm com>
Date:   Wed Jun 20 12:05:47 2018 +0100

    housekeeping: Use g_unix_is_system_fs_type() to determine FS type
    
    Remove the duplicate list of system file system types from g-s-d in
    favour of the one in GLib, as long as we depend on a suitable GLib
    version (2.56.0). In time, this conditional check can be dropped.
    
    GLib doesn’t list network file systems in its list, so check those
    separately.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 plugins/housekeeping/gsd-disk-space-helper.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/plugins/housekeeping/gsd-disk-space-helper.c b/plugins/housekeeping/gsd-disk-space-helper.c
index ba7e90f6..56e054ca 100644
--- a/plugins/housekeeping/gsd-disk-space-helper.c
+++ b/plugins/housekeeping/gsd-disk-space-helper.c
@@ -43,7 +43,7 @@ gsd_should_ignore_unix_mount (GUnixMountEntry *mount)
          */
 
          /* We also ignore network filesystems */
-
+#if !GLIB_CHECK_VERSION(2, 56, 0)
         const gchar *ignore_fs[] = {
                 "adfs",
                 "afs",
@@ -51,7 +51,6 @@ gsd_should_ignore_unix_mount (GUnixMountEntry *mount)
                 "autofs",
                 "autofs4",
                 "cgroup",
-                "cifs",
                 "configfs",
                 "cxfs",
                 "debugfs",
@@ -73,8 +72,6 @@ gsd_should_ignore_unix_mount (GUnixMountEntry *mount)
                 "mfs",
                 "mqueue",
                 "ncpfs",
-                "nfs",
-                "nfs4",
                 "nfsd",
                 "nullfs",
                 "ocfs2",
@@ -87,13 +84,20 @@ gsd_should_ignore_unix_mount (GUnixMountEntry *mount)
                 "rpc_pipefs",
                 "securityfs",
                 "selinuxfs",
-                "smbfs",
                 "sysfs",
                 "tmpfs",
                 "usbfs",
                 "zfs",
                 NULL
         };
+#endif  /* GLIB < 2.56.0 */
+        const gchar *ignore_network_fs[] = {
+                "cifs",
+                "nfs",
+                "nfs4",
+                "smbfs",
+                NULL
+        };
         const gchar *ignore_devices[] = {
                 "none",
                 "sunrpc",
@@ -109,9 +113,17 @@ gsd_should_ignore_unix_mount (GUnixMountEntry *mount)
         };
 
         fs = g_unix_mount_get_fs_type (mount);
+#if GLIB_CHECK_VERSION(2, 56, 0)
+        if (g_unix_is_system_fs_type (fs))
+                return TRUE;
+#else
         for (i = 0; ignore_fs[i] != NULL; i++)
                 if (g_str_equal (ignore_fs[i], fs))
                         return TRUE;
+#endif
+        for (i = 0; ignore_network_fs[i] != NULL; i++)
+                if (g_str_equal (ignore_network_fs[i], fs))
+                        return TRUE;
 
         device = g_unix_mount_get_device_path (mount);
         for (i = 0; ignore_devices[i] != NULL; i++)


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