[glib/wip/oholy/bind-mounts: 2/2] gunixmounts: Mark mounts as system internal instead of filtering out
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/oholy/bind-mounts: 2/2] gunixmounts: Mark mounts as system internal instead of filtering out
- Date: Mon, 1 Oct 2018 13:45:08 +0000 (UTC)
commit 4ffad004ed2afc128bd28e7f2f3c222cee5da779
Author: Ondrej Holy <oholy redhat com>
Date: Thu Apr 26 16:22:36 2018 +0200
gunixmounts: Mark mounts as system internal instead of filtering out
mntent-based implementation filter out mounts with device path that was
repeated. Consequently, it is not possible to show such mounts in UI even
with x-gvfs-show, because they are not returned from g_unix_mounts_get.
libmount-based implementation currently doesn't filter out any mounts
which causes issues to our volume monitors. Let's rather mark mounts
which don't point into fs root as system_internal. This approach won't be
affected by mount order as is mntent-based implementation. It will mark
more mounts as system_internal than it is filtered out with mntend-based
implementation, but there will be always possibility to show them in UI
over x-gvfs-show, which was not possible with mntend-based. We can
probably introduce some improvements later to not mark unique mounts as
system internal even if they don't point into fs root...
https://bugzilla.gnome.org/show_bug.cgi?id=782814
gio/gunixmounts.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c
index 452b686d5..6b50f58b1 100644
--- a/gio/gunixmounts.c
+++ b/gio/gunixmounts.c
@@ -389,8 +389,9 @@ g_unix_is_system_device_path (const char *device_path)
static gboolean
guess_system_internal (const char *mountpoint,
- const char *fs,
- const char *device)
+ const char *fs,
+ const char *device,
+ const char *root)
{
if (g_unix_is_system_fs_type (fs))
return TRUE;
@@ -400,7 +401,14 @@ guess_system_internal (const char *mountpoint,
if (g_unix_is_mount_path_system_internal (mountpoint))
return TRUE;
-
+
+ /* Mounts created by bind operation, or btrfs subvolumes just usually
+ * duplicate content of other mounts, so let's mark them as system internal
+ * by default.
+ */
+ if (root != NULL && g_strcmp0 (root, "/") != 0)
+ return TRUE;
+
return FALSE;
}
@@ -427,7 +435,9 @@ create_unix_mount_entry (const char *device_path,
mount_entry->is_system_internal =
guess_system_internal (mount_entry->mount_path,
mount_entry->filesystem_type,
- mount_entry->device_path);
+ mount_entry->device_path,
+ mount_entry->root_path);
+
return mount_entry;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]