mirror of
https://github.com/ostreedev/ostree.git
synced 2025-01-11 09:18:20 +03:00
src: Only use local VFS - this avoids hitting up the session bus
We are designed to run in the "unix model" of being forked a lot, so startup time matters a lot, and hitting the session bus adds unnecessary DBus traffic, shows up in strace etc. It's a microoptimization I admit.
This commit is contained in:
parent
aaae116f8e
commit
a06f724b72
@ -52,7 +52,7 @@ hacktree_builtin_init (int argc, char **argv, const char *prefix, GError **error
|
||||
repo_path = ".";
|
||||
|
||||
htdir_path = g_build_filename (repo_path, HACKTREE_REPO_DIR, NULL);
|
||||
htdir = g_file_new_for_path (htdir_path);
|
||||
htdir = ht_util_new_file_for_path (htdir_path);
|
||||
|
||||
if (!g_file_make_directory (htdir, NULL, error))
|
||||
goto out;
|
||||
|
@ -132,7 +132,7 @@ hacktree_repo_constructor (GType gtype,
|
||||
|
||||
g_assert (priv->path != NULL);
|
||||
|
||||
priv->repo_file = g_file_new_for_path (priv->path);
|
||||
priv->repo_file = ht_util_new_file_for_path (priv->path);
|
||||
priv->head_ref_path = g_build_filename (priv->path, HACKTREE_REPO_DIR, "HEAD", NULL);
|
||||
priv->objects_path = g_build_filename (priv->path, HACKTREE_REPO_DIR, "objects", NULL);
|
||||
|
||||
@ -1534,7 +1534,7 @@ hacktree_repo_iter_objects (HacktreeRepo *self,
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
g_return_val_if_fail (priv->inited, FALSE);
|
||||
|
||||
objectdir = g_file_new_for_path (priv->objects_path);
|
||||
objectdir = ht_util_new_file_for_path (priv->objects_path);
|
||||
enumerator = g_file_enumerate_children (objectdir, "standard::name,standard::type,unix::*",
|
||||
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
||||
NULL,
|
||||
|
@ -105,3 +105,10 @@ ht_util_read_file_noatime (GFile *file, GCancellable *cancellable, GError **erro
|
||||
g_free (path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Like g_file_new_for_path, but only do local stuff, not GVFS */
|
||||
GFile *
|
||||
ht_util_new_file_for_path (const char *path)
|
||||
{
|
||||
return g_vfs_get_file_for_path (g_vfs_get_local (), path);
|
||||
}
|
||||
|
@ -26,6 +26,8 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GFile *ht_util_new_file_for_path (const char *path);
|
||||
|
||||
gboolean ht_util_ensure_directory (const char *path, gboolean with_parents, GError **error);
|
||||
|
||||
char * ht_util_get_file_contents_utf8 (const char *path, GError **error);
|
||||
|
Loading…
Reference in New Issue
Block a user