summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-repo-finder-mount.c
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2017-10-25 15:49:49 +0100
committerAtomic Bot <atomic-devel@projectatomic.io>2017-10-26 01:34:14 +0000
commit0760ce128183e1bdaaa08bd3d6b17e275b81418a (patch)
tree5e205a7da7e02c47a5b364bdf844ecf5687dc064 /src/libostree/ostree-repo-finder-mount.c
parentd76840d0c1e6e23ab54cee7a5142671e2cc4fae2 (diff)
downloadostree-0760ce128183e1bdaaa08bd3d6b17e275b81418a.tar.gz
lib/repo-finder-mount: Ignore mounts which have a ‘system’ file system
For example, tmpfs or a cgroup file system. This is basically an optimisation of the list of file systems we check for repositories, since we would never expect any of these file systems to be capable of containing a repository. Depends on the new API from https://bugzilla.gnome.org/show_bug.cgi?id=788927. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1307 Approved by: cgwalters
Diffstat (limited to 'src/libostree/ostree-repo-finder-mount.c')
-rw-r--r--src/libostree/ostree-repo-finder-mount.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libostree/ostree-repo-finder-mount.c b/src/libostree/ostree-repo-finder-mount.c
index bae3664e..bc01f913 100644
--- a/src/libostree/ostree-repo-finder-mount.c
+++ b/src/libostree/ostree-repo-finder-mount.c
@@ -23,6 +23,7 @@
#include "config.h"
#include <gio/gio.h>
+#include <gio/gunixmounts.h>
#include <glib.h>
#include <glib-object.h>
#include <libglnx.h>
@@ -355,6 +356,23 @@ ostree_repo_finder_mount_resolve_async (OstreeRepoFinder *finde
continue;
}
+#if GLIB_CHECK_VERSION(2, 55, 0)
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS /* remove once GLIB_VERSION_MAX_ALLOWED ≥ 2.56 */
+ g_autoptr(GUnixMountEntry) mount_entry = g_unix_mount_at (mount_root_path, NULL);
+
+ if (mount_entry != NULL &&
+ (g_unix_is_system_fs_type (g_unix_mount_get_fs_type (mount_entry)) ||
+ g_unix_is_system_device_path (g_unix_mount_get_device_path (mount_entry))))
+ {
+ g_debug ("Ignoring mount ‘%s’ as its file system type (%s) or device "
+ "path (%s) indicate it’s a system mount.",
+ mount_name, g_unix_mount_get_fs_type (mount_entry),
+ g_unix_mount_get_device_path (mount_entry));
+ continue;
+ }
+G_GNUC_END_IGNORE_DEPRECATIONS
+#endif /* GLib 2.56.0 */
+
/* stat() the mount root so we can later check whether the resolved
* repositories for individual refs are on the same device (to avoid the
* symlinks for them pointing outside the mount root). */