diff options
author | Philip Withnall <withnall@endlessm.com> | 2018-06-20 12:12:34 +0100 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2018-06-29 06:49:45 +0000 |
commit | 7b3cd630c01753c15d02807294db43ce8dbaa279 (patch) | |
tree | bfffc69efa0d125fa4a9d3be2c366b61e0a2130d | |
parent | 0b3555d636c344db053b8b557431c4bc3fa36267 (diff) | |
download | gnome-control-center-7b3cd630c01753c15d02807294db43ce8dbaa279.tar.gz |
info: Update gsd_should_ignore_unix_mount() from g-s-d master
• Use g_unix_is_system_fs_type() if a new enough GLib is available,
rather than maintaining our own list of system file system types.
• List network file systems separately, since GLib doesn’t ignore them.
• Ignore some file systems by label too.
See
https://gitlab.gnome.org/GNOME/gnome-settings-daemon/merge_requests/24.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
-rw-r--r-- | panels/info/gsd-disk-space-helper.c | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/panels/info/gsd-disk-space-helper.c b/panels/info/gsd-disk-space-helper.c index faa7d33ff..fe56a5132 100644 --- a/panels/info/gsd-disk-space-helper.c +++ b/panels/info/gsd-disk-space-helper.c @@ -33,6 +33,7 @@ gboolean gsd_should_ignore_unix_mount (GUnixMountEntry *mount) { const char *fs, *device; + g_autofree char *label = NULL; guint i; /* This is borrowed from GLib and used as a way to determine @@ -42,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", @@ -50,7 +51,6 @@ gsd_should_ignore_unix_mount (GUnixMountEntry *mount) "autofs", "autofs4", "cgroup", - "cifs", "configfs", "cxfs", "debugfs", @@ -72,8 +72,6 @@ gsd_should_ignore_unix_mount (GUnixMountEntry *mount) "mfs", "mqueue", "ncpfs", - "nfs", - "nfs4", "nfsd", "nullfs", "ocfs2", @@ -86,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", @@ -102,18 +107,34 @@ gsd_should_ignore_unix_mount (GUnixMountEntry *mount) "/dev/vn", NULL }; + const gchar *ignore_labels[] = { + "RETRODE", + NULL + }; fs = g_unix_mount_get_fs_type (mount); - device = g_unix_mount_get_device_path (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++) if (g_str_equal (ignore_devices[i], device)) return TRUE; + label = g_unix_mount_guess_name (mount); + for (i = 0; ignore_labels[i] != NULL; i++) + if (g_str_equal (ignore_labels[i], label)) + return TRUE; + return FALSE; } |