Commit 53ed1804 authored by Ondrej Holy's avatar Ondrej Holy

gunixmounts: Speed up mtab processing with libmount

libmnt_context is useless. It contains cache which is useful for searching,
but it isn't used in our case. Let's use mnt_context_parse_mtab instead
directly and the mtab processing will be faster.

https://bugzilla.gnome.org/show_bug.cgi?id=781867
parent b7ffc07d
......@@ -391,15 +391,13 @@ static GList *
_g_get_unix_mounts (void)
{
struct libmnt_table *table = NULL;
struct libmnt_context *ctxt = NULL;
struct libmnt_iter* iter = NULL;
struct libmnt_fs *fs = NULL;
GUnixMountEntry *mount_entry = NULL;
GList *return_list = NULL;
ctxt = mnt_new_context ();
mnt_context_get_mtab (ctxt, &table);
if (!table)
table = mnt_new_table ();
if (mnt_table_parse_mtab (table, NULL) < 0)
goto out;
iter = mnt_new_iter (MNT_ITER_FORWARD);
......@@ -435,7 +433,7 @@ _g_get_unix_mounts (void)
mnt_free_iter (iter);
out:
mnt_free_context (ctxt);
mnt_unref_table (table);
return g_list_reverse (return_list);
}
......@@ -875,15 +873,13 @@ static GList *
_g_get_unix_mount_points (void)
{
struct libmnt_table *table = NULL;
struct libmnt_context *ctxt = NULL;
struct libmnt_iter* iter = NULL;
struct libmnt_fs *fs = NULL;
GUnixMountPoint *mount_point = NULL;
GList *return_list = NULL;
ctxt = mnt_new_context ();
mnt_context_get_fstab (ctxt, &table);
if (!table)
table = mnt_new_table ();
if (mnt_table_parse_mtab (table, NULL) < 0)
goto out;
iter = mnt_new_iter (MNT_ITER_FORWARD);
......@@ -953,7 +949,7 @@ _g_get_unix_mount_points (void)
mnt_free_iter (iter);
out:
mnt_free_context (ctxt);
mnt_unref_table (table);
return g_list_reverse (return_list);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment