summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-repo-finder-mount.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libostree/ostree-repo-finder-mount.c')
-rw-r--r--src/libostree/ostree-repo-finder-mount.c289
1 files changed, 134 insertions, 155 deletions
diff --git a/src/libostree/ostree-repo-finder-mount.c b/src/libostree/ostree-repo-finder-mount.c
index 628c53c0..19583090 100644
--- a/src/libostree/ostree-repo-finder-mount.c
+++ b/src/libostree/ostree-repo-finder-mount.c
@@ -24,16 +24,16 @@
#include <gio/gio.h>
#include <gio/gunixmounts.h>
-#include <glib.h>
#include <glib-object.h>
+#include <glib.h>
#include <libglnx.h>
#include <stdlib.h>
#include "ostree-autocleanups.h"
#include "ostree-remote-private.h"
-#include "ostree-repo-private.h"
-#include "ostree-repo-finder.h"
#include "ostree-repo-finder-mount.h"
+#include "ostree-repo-finder.h"
+#include "ostree-repo-private.h"
/**
* SECTION:ostree-repo-finder-mount
@@ -69,7 +69,7 @@
* Since: 2018.6
*/
-typedef GList/*<owned GObject>*/ ObjectList;
+typedef GList /*<owned GObject>*/ ObjectList;
static void
object_list_free (ObjectList *list)
@@ -85,16 +85,17 @@ struct _OstreeRepoFinderMount
{
GObject parent_instance;
- GVolumeMonitor *monitor; /* owned */
+ GVolumeMonitor *monitor; /* owned */
};
G_DEFINE_TYPE_WITH_CODE (OstreeRepoFinderMount, ostree_repo_finder_mount, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (OSTREE_TYPE_REPO_FINDER, ostree_repo_finder_mount_iface_init))
+ G_IMPLEMENT_INTERFACE (OSTREE_TYPE_REPO_FINDER,
+ ostree_repo_finder_mount_iface_init))
typedef struct
{
gchar *uri;
- OstreeRemote *keyring_remote; /* (owned) */
+ OstreeRemote *keyring_remote; /* (owned) */
} UriAndKeyring;
static void
@@ -108,10 +109,9 @@ uri_and_keyring_free (UriAndKeyring *data)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UriAndKeyring, uri_and_keyring_free)
static UriAndKeyring *
-uri_and_keyring_new (const gchar *uri,
- OstreeRemote *keyring_remote)
+uri_and_keyring_new (const gchar *uri, OstreeRemote *keyring_remote)
{
- g_autoptr(UriAndKeyring) data = NULL;
+ g_autoptr (UriAndKeyring) data = NULL;
data = g_new0 (UriAndKeyring, 1);
data->uri = g_strdup (uri);
@@ -129,13 +129,12 @@ uri_and_keyring_hash (gconstpointer key)
}
static gboolean
-uri_and_keyring_equal (gconstpointer a,
- gconstpointer b)
+uri_and_keyring_equal (gconstpointer a, gconstpointer b)
{
const UriAndKeyring *_a = a, *_b = b;
- return (g_str_equal (_a->uri, _b->uri) &&
- g_str_equal (_a->keyring_remote->keyring, _b->keyring_remote->keyring));
+ return (g_str_equal (_a->uri, _b->uri)
+ && g_str_equal (_a->keyring_remote->keyring, _b->keyring_remote->keyring));
}
/* This must return a valid remote name (suitable for use in a refspec). */
@@ -143,7 +142,8 @@ static gchar *
uri_and_keyring_to_name (UriAndKeyring *data)
{
g_autofree gchar *escaped_uri = g_uri_escape_string (data->uri, NULL, FALSE);
- g_autofree gchar *escaped_keyring = g_uri_escape_string (data->keyring_remote->keyring, NULL, FALSE);
+ g_autofree gchar *escaped_keyring
+ = g_uri_escape_string (data->keyring_remote->keyring, NULL, FALSE);
/* FIXME: Need a better separator than `_`, since it’s not escaped in the input. */
g_autofree gchar *out = g_strdup_printf ("%s_%s", escaped_uri, escaped_keyring);
@@ -160,20 +160,19 @@ uri_and_keyring_to_name (UriAndKeyring *data)
}
static gint
-results_compare_cb (gconstpointer a,
- gconstpointer b)
+results_compare_cb (gconstpointer a, gconstpointer b)
{
- const OstreeRepoFinderResult *result_a = *((const OstreeRepoFinderResult **) a);
- const OstreeRepoFinderResult *result_b = *((const OstreeRepoFinderResult **) b);
+ const OstreeRepoFinderResult *result_a = *((const OstreeRepoFinderResult **)a);
+ const OstreeRepoFinderResult *result_b = *((const OstreeRepoFinderResult **)b);
return ostree_repo_finder_result_compare (result_a, result_b);
}
typedef struct
{
- char *ordering_name; /* (owned) */
- OstreeRepo *repo; /* (owned) */
- GHashTable *refs; /* (owned) (element-type OstreeCollectionRef utf8) */
+ char *ordering_name; /* (owned) */
+ OstreeRepo *repo; /* (owned) */
+ GHashTable *refs; /* (owned) (element-type OstreeCollectionRef utf8) */
} RepoAndRefs;
static void
@@ -185,8 +184,7 @@ repo_and_refs_clear (RepoAndRefs *data)
}
static gint
-repo_and_refs_compare (gconstpointer a,
- gconstpointer b)
+repo_and_refs_compare (gconstpointer a, gconstpointer b)
{
const RepoAndRefs *_a = a;
const RepoAndRefs *_b = b;
@@ -198,23 +196,17 @@ repo_and_refs_compare (gconstpointer a,
* to the @parent_repo, and can be opened. If so, return it as @out_repo and
* all its collection–refs as @out_refs, to be added into the results. */
static gboolean
-scan_repo (int dfd,
- const char *path,
- const char *mount_name,
- const struct stat *mount_root_stbuf,
- OstreeRepo *parent_repo,
- OstreeRepo **out_repo,
- GHashTable **out_refs,
- GCancellable *cancellable,
- GError **error)
+scan_repo (int dfd, const char *path, const char *mount_name, const struct stat *mount_root_stbuf,
+ OstreeRepo *parent_repo, OstreeRepo **out_repo, GHashTable **out_refs,
+ GCancellable *cancellable, GError **error)
{
- g_autoptr(GError) local_error = NULL;
+ g_autoptr (GError) local_error = NULL;
- g_autoptr(OstreeRepo) repo = ostree_repo_open_at (dfd, path, cancellable, &local_error);
+ g_autoptr (OstreeRepo) repo = ostree_repo_open_at (dfd, path, cancellable, &local_error);
if (repo == NULL)
{
- g_debug ("Ignoring repository ‘%s’ on mount ‘%s’ as it could not be opened: %s",
- path, mount_name, local_error->message);
+ g_debug ("Ignoring repository ‘%s’ on mount ‘%s’ as it could not be opened: %s", path,
+ mount_name, local_error->message);
g_propagate_error (error, g_steal_pointer (&local_error));
return FALSE;
}
@@ -224,8 +216,8 @@ scan_repo (int dfd,
if (!glnx_fstat (repo_dfd, &stbuf, &local_error))
{
- g_debug ("Ignoring repository ‘%s’ on mount ‘%s’ as querying its info failed: %s",
- path, mount_name, local_error->message);
+ g_debug ("Ignoring repository ‘%s’ on mount ‘%s’ as querying its info failed: %s", path,
+ mount_name, local_error->message);
g_propagate_error (error, g_steal_pointer (&local_error));
return FALSE;
}
@@ -234,29 +226,30 @@ scan_repo (int dfd,
* allow ref symlinks to point somewhere outside of the mounted volume. */
if (stbuf.st_dev != mount_root_stbuf->st_dev)
{
- g_debug ("Ignoring repository ‘%s’ on mount ‘%s’ as it’s on a different file system from the mount",
+ g_debug ("Ignoring repository ‘%s’ on mount ‘%s’ as it’s on a different file system from "
+ "the mount",
path, mount_name);
return glnx_throw (error, "Repository is on a different file system from the mount");
}
/* Exclude repositories which resolve to @parent_repo. */
- if (stbuf.st_dev == parent_repo->device &&
- stbuf.st_ino == parent_repo->inode)
+ if (stbuf.st_dev == parent_repo->device && stbuf.st_ino == parent_repo->inode)
{
- g_debug ("Ignoring repository ‘%s’ on mount ‘%s’ as it is the same as the one we are resolving",
- path, mount_name);
+ g_debug (
+ "Ignoring repository ‘%s’ on mount ‘%s’ as it is the same as the one we are resolving",
+ path, mount_name);
return glnx_throw (error, "Repository is the same as the one we are resolving");
}
/* List the repo’s refs and return them. */
- g_autoptr(GHashTable) repo_refs = NULL; /* (element-type OstreeCollectionRef utf8) */
+ g_autoptr (GHashTable) repo_refs = NULL; /* (element-type OstreeCollectionRef utf8) */
if (!ostree_repo_list_collection_refs (repo, NULL, &repo_refs,
- OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES,
- cancellable, &local_error))
+ OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES, cancellable,
+ &local_error))
{
- g_debug ("Ignoring repository ‘%s’ on mount ‘%s’ as its refs could not be listed: %s",
- path, mount_name, local_error->message);
+ g_debug ("Ignoring repository ‘%s’ on mount ‘%s’ as its refs could not be listed: %s", path,
+ mount_name, local_error->message);
g_propagate_error (error, g_steal_pointer (&local_error));
return FALSE;
}
@@ -270,54 +263,43 @@ scan_repo (int dfd,
}
static void
-scan_and_add_repo (int dfd,
- const char *path,
- gboolean sortable,
- const char *mount_name,
- const struct stat *mount_root_stbuf,
- OstreeRepo *parent_repo,
- GArray *inout_repos_refs,
- GCancellable *cancellable)
+scan_and_add_repo (int dfd, const char *path, gboolean sortable, const char *mount_name,
+ const struct stat *mount_root_stbuf, OstreeRepo *parent_repo,
+ GArray *inout_repos_refs, GCancellable *cancellable)
{
- g_autoptr(GHashTable) repo_refs = NULL;
- g_autoptr(OstreeRepo) repo = NULL;
+ g_autoptr (GHashTable) repo_refs = NULL;
+ g_autoptr (OstreeRepo) repo = NULL;
- if (scan_repo (dfd, path,
- mount_name, mount_root_stbuf,
- parent_repo, &repo, &repo_refs, cancellable, NULL))
+ if (scan_repo (dfd, path, mount_name, mount_root_stbuf, parent_repo, &repo, &repo_refs,
+ cancellable, NULL))
{
- RepoAndRefs val = {
- sortable ? g_strdup (path) : NULL,
- g_steal_pointer (&repo),
- g_steal_pointer (&repo_refs)
- };
+ RepoAndRefs val = { sortable ? g_strdup (path) : NULL, g_steal_pointer (&repo),
+ g_steal_pointer (&repo_refs) };
g_array_append_val (inout_repos_refs, val);
- g_debug ("%s: Adding repo ‘%s’ on mount ‘%s’ (%ssortable)",
- G_STRFUNC, path, mount_name, sortable ? "" : "not ");
+ g_debug ("%s: Adding repo ‘%s’ on mount ‘%s’ (%ssortable)", G_STRFUNC, path, mount_name,
+ sortable ? "" : "not ");
}
}
static void
-ostree_repo_finder_mount_resolve_async (OstreeRepoFinder *finder,
- const OstreeCollectionRef * const *refs,
- OstreeRepo *parent_repo,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+ostree_repo_finder_mount_resolve_async (OstreeRepoFinder *finder,
+ const OstreeCollectionRef *const *refs,
+ OstreeRepo *parent_repo, GCancellable *cancellable,
+ GAsyncReadyCallback callback, gpointer user_data)
{
OstreeRepoFinderMount *self = OSTREE_REPO_FINDER_MOUNT (finder);
- g_autoptr(GTask) task = NULL;
- g_autoptr(ObjectList) mounts = NULL;
- g_autoptr(GPtrArray) results = NULL; /* (element-type OstreeRepoFinderResult) */
+ g_autoptr (GTask) task = NULL;
+ g_autoptr (ObjectList) mounts = NULL;
+ g_autoptr (GPtrArray) results = NULL; /* (element-type OstreeRepoFinderResult) */
GList *l;
- const gint priority = 50; /* arbitrarily chosen */
+ const gint priority = 50; /* arbitrarily chosen */
task = g_task_new (finder, cancellable, callback, user_data);
g_task_set_source_tag (task, ostree_repo_finder_mount_resolve_async);
mounts = g_volume_monitor_get_mounts (self->monitor);
- results = g_ptr_array_new_with_free_func ((GDestroyNotify) ostree_repo_finder_result_free);
+ results = g_ptr_array_new_with_free_func ((GDestroyNotify)ostree_repo_finder_result_free);
g_debug ("%s: Found %u mounts", G_STRFUNC, g_list_length (mounts));
@@ -325,16 +307,16 @@ ostree_repo_finder_mount_resolve_async (OstreeRepoFinder *finde
{
GMount *mount = G_MOUNT (l->data);
g_autofree gchar *mount_name = NULL;
- g_autoptr(GFile) mount_root = NULL;
+ g_autoptr (GFile) mount_root = NULL;
g_autofree gchar *mount_root_path = NULL;
glnx_autofd int mount_root_dfd = -1;
struct stat mount_root_stbuf;
glnx_autofd int repos_dfd = -1;
gsize i;
- g_autoptr(GHashTable) repo_to_refs = NULL; /* (element-type UriAndKeyring GHashTable) */
- GHashTable *supported_ref_to_checksum; /* (element-type OstreeCollectionRef utf8) */
+ g_autoptr (GHashTable) repo_to_refs = NULL; /* (element-type UriAndKeyring GHashTable) */
+ GHashTable *supported_ref_to_checksum; /* (element-type OstreeCollectionRef utf8) */
GHashTableIter iter;
- g_autoptr(GError) local_error = NULL;
+ g_autoptr (GError) local_error = NULL;
mount_name = g_mount_get_name (mount);
@@ -350,18 +332,19 @@ ostree_repo_finder_mount_resolve_async (OstreeRepoFinder *finde
if (!glnx_opendirat (AT_FDCWD, mount_root_path, TRUE, &mount_root_dfd, &local_error))
{
- g_debug ("Ignoring mount ‘%s’ as ‘%s’ directory can’t be opened: %s",
- mount_name, mount_root_path, local_error->message);
+ g_debug ("Ignoring mount ‘%s’ as ‘%s’ directory can’t be opened: %s", mount_name,
+ mount_root_path, local_error->message);
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);
+ 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))))
+ 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.",
@@ -369,16 +352,16 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS /* remove once GLIB_VERSION_MAX_ALLOWED ≥ 2.
g_unix_mount_get_device_path (mount_entry));
continue;
}
-G_GNUC_END_IGNORE_DEPRECATIONS
-#endif /* GLib 2.56.0 */
+ 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). */
if (!glnx_fstat (mount_root_dfd, &mount_root_stbuf, &local_error))
{
- g_debug ("Ignoring mount ‘%s’ as querying info of ‘%s’ failed: %s",
- mount_name, mount_root_path, local_error->message);
+ g_debug ("Ignoring mount ‘%s’ as querying info of ‘%s’ failed: %s", mount_name,
+ mount_root_path, local_error->message);
continue;
}
@@ -389,13 +372,13 @@ G_GNUC_END_IGNORE_DEPRECATIONS
/* List all the repositories in the repos.d directory. */
/* (element-type GHashTable (element-type OstreeCollectionRef utf8)) */
- g_autoptr(GArray) repos_refs = g_array_new (FALSE, TRUE, sizeof (RepoAndRefs));
- g_array_set_clear_func (repos_refs, (GDestroyNotify) repo_and_refs_clear);
+ g_autoptr (GArray) repos_refs = g_array_new (FALSE, TRUE, sizeof (RepoAndRefs));
+ g_array_set_clear_func (repos_refs, (GDestroyNotify)repo_and_refs_clear);
GLnxDirFdIterator repos_iter;
- if (repos_dfd >= 0 &&
- !glnx_dirfd_iterator_init_at (repos_dfd, ".", TRUE, &repos_iter, &local_error))
+ if (repos_dfd >= 0
+ && !glnx_dirfd_iterator_init_at (repos_dfd, ".", TRUE, &repos_iter, &local_error))
{
g_debug ("Error iterating over ‘%s/.ostree/repos.d’ directory in mount ‘%s’: %s",
mount_root_path, mount_name, local_error->message);
@@ -408,7 +391,8 @@ G_GNUC_END_IGNORE_DEPRECATIONS
{
struct dirent *repo_dent;
- if (!glnx_dirfd_iterator_next_dent (&repos_iter, &repo_dent, cancellable, &local_error))
+ if (!glnx_dirfd_iterator_next_dent (&repos_iter, &repo_dent, cancellable,
+ &local_error))
{
g_debug ("Error iterating over ‘%s/.ostree/repos.d’ directory in mount ‘%s’: %s",
mount_root_path, mount_name, local_error->message);
@@ -421,8 +405,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
break;
/* Grab the set of collection–refs from the repo if we can open it. */
- scan_and_add_repo (repos_dfd, repo_dent->d_name, TRUE,
- mount_name, &mount_root_stbuf,
+ scan_and_add_repo (repos_dfd, repo_dent->d_name, TRUE, mount_name, &mount_root_stbuf,
parent_repo, repos_refs, cancellable);
}
}
@@ -433,30 +416,29 @@ G_GNUC_END_IGNORE_DEPRECATIONS
/* Also check the well-known special-case directories in the mount.
* Add them after sorting, so they’re always last.
* NOTE: If you change these, update the man page. */
- const gchar * const well_known_repos[] =
- {
- ".ostree/repo",
- "ostree/repo",
- "var/lib/flatpak/repo",
- };
+ const gchar *const well_known_repos[] = {
+ ".ostree/repo",
+ "ostree/repo",
+ "var/lib/flatpak/repo",
+ };
for (i = 0; i < G_N_ELEMENTS (well_known_repos); i++)
- scan_and_add_repo (mount_root_dfd, well_known_repos[i], FALSE,
- mount_name, &mount_root_stbuf,
- parent_repo, repos_refs, cancellable);
+ scan_and_add_repo (mount_root_dfd, well_known_repos[i], FALSE, mount_name,
+ &mount_root_stbuf, parent_repo, repos_refs, cancellable);
/* Check whether a subdirectory exists for any of the @refs we’re looking
* for. If so, and it’s a symbolic link, dereference it so multiple links
* to the same repository (containing multiple refs) are coalesced.
* Otherwise, include it as a result by itself. */
repo_to_refs = g_hash_table_new_full (uri_and_keyring_hash, uri_and_keyring_equal,
- (GDestroyNotify) uri_and_keyring_free, (GDestroyNotify) g_hash_table_unref);
+ (GDestroyNotify)uri_and_keyring_free,
+ (GDestroyNotify)g_hash_table_unref);
for (i = 0; refs[i] != NULL; i++)
{
const OstreeCollectionRef *ref = refs[i];
g_autofree gchar *resolved_repo_uri = NULL;
- g_autoptr(UriAndKeyring) resolved_repo = NULL;
+ g_autoptr (UriAndKeyring) resolved_repo = NULL;
for (gsize j = 0; j < repos_refs->len; j++)
{
@@ -464,27 +446,29 @@ G_GNUC_END_IGNORE_DEPRECATIONS
OstreeRepo *repo = repo_and_refs->repo;
GHashTable *repo_refs = repo_and_refs->refs;
g_autofree char *repo_path = g_file_get_path (ostree_repo_get_path (repo));
- g_autoptr(OstreeRemote) keyring_remote = NULL;
+ g_autoptr (OstreeRemote) keyring_remote = NULL;
const gchar *checksum = g_hash_table_lookup (repo_refs, ref);
if (checksum == NULL)
{
- g_debug ("Ignoring repository ‘%s’ when looking for ref (%s, %s) on mount ‘%s’ as it doesn’t contain the ref.",
+ g_debug ("Ignoring repository ‘%s’ when looking for ref (%s, %s) on mount ‘%s’ "
+ "as it doesn’t contain the ref.",
repo_path, ref->collection_id, ref->ref_name, mount_name);
g_clear_error (&local_error);
continue;
}
/* Finally, look up the GPG keyring for this ref. */
- keyring_remote = ostree_repo_resolve_keyring_for_collection (parent_repo,
- ref->collection_id,
- cancellable, &local_error);
+ keyring_remote = ostree_repo_resolve_keyring_for_collection (
+ parent_repo, ref->collection_id, cancellable, &local_error);
if (keyring_remote == NULL)
{
- g_debug ("Ignoring repository ‘%s’ when looking for ref (%s, %s) on mount ‘%s’ due to missing keyring: %s",
- repo_path, ref->collection_id, ref->ref_name, mount_name, local_error->message);
+ g_debug ("Ignoring repository ‘%s’ when looking for ref (%s, %s) on mount ‘%s’ "
+ "due to missing keyring: %s",
+ repo_path, ref->collection_id, ref->ref_name, mount_name,
+ local_error->message);
g_clear_error (&local_error);
continue;
}
@@ -495,7 +479,8 @@ G_GNUC_END_IGNORE_DEPRECATIONS
* to deduplicate the results. */
g_autofree char *canonical_repo_path = realpath (repo_path, NULL);
resolved_repo_uri = g_strconcat ("file://", canonical_repo_path, NULL);
- g_debug ("Resolved ref (%s, %s) on mount ‘%s’ to repo URI ‘%s’ with keyring ‘%s’ from remote ‘%s’.",
+ g_debug ("Resolved ref (%s, %s) on mount ‘%s’ to repo URI ‘%s’ with keyring ‘%s’ "
+ "from remote ‘%s’.",
ref->collection_id, ref->ref_name, mount_name, resolved_repo_uri,
keyring_remote->keyring, keyring_remote->name);
@@ -505,13 +490,13 @@ G_GNUC_END_IGNORE_DEPRECATIONS
if (supported_ref_to_checksum == NULL)
{
- supported_ref_to_checksum = g_hash_table_new_full (ostree_collection_ref_hash,
- ostree_collection_ref_equal,
- NULL, g_free);
- g_hash_table_insert (repo_to_refs, g_steal_pointer (&resolved_repo), supported_ref_to_checksum /* transfer */);
+ supported_ref_to_checksum = g_hash_table_new_full (
+ ostree_collection_ref_hash, ostree_collection_ref_equal, NULL, g_free);
+ g_hash_table_insert (repo_to_refs, g_steal_pointer (&resolved_repo),
+ supported_ref_to_checksum /* transfer */);
}
- g_hash_table_insert (supported_ref_to_checksum, (gpointer) ref, g_strdup (checksum));
+ g_hash_table_insert (supported_ref_to_checksum, (gpointer)ref, g_strdup (checksum));
/* We’ve found a result for this collection–ref. No point in checking
* the other repos on the mount, since pulling in parallel from them won’t help. */
@@ -523,9 +508,10 @@ G_GNUC_END_IGNORE_DEPRECATIONS
g_hash_table_iter_init (&iter, repo_to_refs);
UriAndKeyring *repo;
- while (g_hash_table_iter_next (&iter, (gpointer *) &repo, (gpointer *) &supported_ref_to_checksum))
+ while (
+ g_hash_table_iter_next (&iter, (gpointer *)&repo, (gpointer *)&supported_ref_to_checksum))
{
- g_autoptr(OstreeRemote) remote = NULL;
+ g_autoptr (OstreeRemote) remote = NULL;
/* Build an #OstreeRemote. Use the escaped URI, since remote->name
* is used in file paths, so needs to not contain special characters. */
@@ -544,19 +530,20 @@ G_GNUC_END_IGNORE_DEPRECATIONS
* the code in ostree_repo_pull_from_remotes_async() will be able to
* check it just as quickly as we can here; so don’t duplicate the
* code. */
- g_ptr_array_add (results, ostree_repo_finder_result_new (remote, finder, priority, supported_ref_to_checksum, NULL, 0));
+ g_ptr_array_add (results,
+ ostree_repo_finder_result_new (remote, finder, priority,
+ supported_ref_to_checksum, NULL, 0));
}
}
g_ptr_array_sort (results, results_compare_cb);
- g_task_return_pointer (task, g_steal_pointer (&results), (GDestroyNotify) g_ptr_array_unref);
+ g_task_return_pointer (task, g_steal_pointer (&results), (GDestroyNotify)g_ptr_array_unref);
}
static GPtrArray *
-ostree_repo_finder_mount_resolve_finish (OstreeRepoFinder *self,
- GAsyncResult *result,
- GError **error)
+ostree_repo_finder_mount_resolve_finish (OstreeRepoFinder *self, GAsyncResult *result,
+ GError **error)
{
g_return_val_if_fail (g_task_is_valid (result, self), NULL);
return g_task_propagate_pointer (G_TASK (result), error);
@@ -585,14 +572,12 @@ typedef enum
} OstreeRepoFinderMountProperty;
static void
-ostree_repo_finder_mount_get_property (GObject *object,
- guint property_id,
- GValue *value,
+ostree_repo_finder_mount_get_property (GObject *object, guint property_id, GValue *value,
GParamSpec *pspec)
{
OstreeRepoFinderMount *self = OSTREE_REPO_FINDER_MOUNT (object);
- switch ((OstreeRepoFinderMountProperty) property_id)
+ switch ((OstreeRepoFinderMountProperty)property_id)
{
case PROP_MONITOR:
g_value_set_object (value, self->monitor);
@@ -603,14 +588,12 @@ ostree_repo_finder_mount_get_property (GObject *object,
}
static void
-ostree_repo_finder_mount_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+ostree_repo_finder_mount_set_property (GObject *object, guint property_id, const GValue *value,
+ GParamSpec *pspec)
{
OstreeRepoFinderMount *self = OSTREE_REPO_FINDER_MOUNT (object);
- switch ((OstreeRepoFinderMountProperty) property_id)
+ switch ((OstreeRepoFinderMountProperty)property_id)
{
case PROP_MONITOR:
/* Construct-only. */
@@ -649,16 +632,14 @@ ostree_repo_finder_mount_class_init (OstreeRepoFinderMountClass *klass)
*
* Since: 2018.6
*/
- g_object_class_install_property (object_class, PROP_MONITOR,
- g_param_spec_object ("monitor",
- "Volume Monitor",
- "Volume monitor to use "
- "to look up mounted "
- "volumes when queried.",
- G_TYPE_VOLUME_MONITOR,
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (
+ object_class, PROP_MONITOR,
+ g_param_spec_object ("monitor", "Volume Monitor",
+ "Volume monitor to use "
+ "to look up mounted "
+ "volumes when queried.",
+ G_TYPE_VOLUME_MONITOR,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
static void
@@ -685,7 +666,5 @@ ostree_repo_finder_mount_new (GVolumeMonitor *monitor)
{
g_return_val_if_fail (monitor == NULL || G_IS_VOLUME_MONITOR (monitor), NULL);
- return g_object_new (OSTREE_TYPE_REPO_FINDER_MOUNT,
- "monitor", monitor,
- NULL);
+ return g_object_new (OSTREE_TYPE_REPO_FINDER_MOUNT, "monitor", monitor, NULL);
}