From cbe3989b2bd0ec93f9878c2d9a79fcb72d477d11 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 28 Apr 2017 19:32:17 +0100 Subject: [PATCH] libostree: Get and set OstreeAsyncProgress:status atomically Use the new well-known `status` key for OstreeAsyncProgress to get and set the status atomically with other keys in an OstreeAsyncProgress instance. Signed-off-by: Philip Withnall Closes: #819 Approved by: cgwalters --- src/libostree/ostree-repo-pull.c | 4 ++-- src/libostree/ostree-repo.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index f7dbd79e79..c6b636692e 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -240,10 +240,10 @@ update_progress (gpointer user_data) /* We fetch metadata before content. These allow us to report metadata fetch progress specifically. */ "outstanding-metadata-fetches", "u", pull_data->n_outstanding_metadata_fetches, "metadata-fetched", "u", pull_data->n_fetched_metadata, + /* Overall status. */ + "status", "s", "", NULL); - ostree_async_progress_set_status (pull_data->progress, NULL); - if (pull_data->dry_run) pull_data->dry_run_emitted_progress = TRUE; diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 8e2b1c21d3..1bb4d3c34b 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -3748,8 +3748,6 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress buf = g_string_new (""); - status = ostree_async_progress_get_status (progress); - ostree_async_progress_get (progress, "outstanding-fetches", "u", &outstanding_fetches, "outstanding-metadata-fetches", "u", &outstanding_metadata_fetches, @@ -3760,9 +3758,10 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress "total-delta-parts", "u", &total_delta_parts, "fetched-delta-fallbacks", "u", &fetched_delta_part_fallbacks, "total-delta-fallbacks", "u", &total_delta_part_fallbacks, + "status", "s", &status, NULL); - if (status) + if (*status != '\0') { g_string_append (buf, status); }