[ostree/wip/init-api: 3/3] repo: Rename ostree_repo_check to ostree_repo_open



commit e5d265227c3f51894167397cc4159443c15e0b29
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Sep 5 13:41:46 2013 -0400

    repo: Rename ostree_repo_check to ostree_repo_open
    
    And add a cancellable parameter.

 src/libostree/ostree-repo.c           |   12 +++++++-----
 src/libostree/ostree-repo.h           |    4 +++-
 src/ostree/ot-admin-builtin-upgrade.c |    2 +-
 src/ostree/ot-admin-functions.c       |    2 +-
 src/ostree/ot-builtin-pull-local.c    |    2 +-
 src/ostree/ot-main.c                  |    4 ++--
 6 files changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 0c7810d..e951ce6 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -54,7 +54,7 @@
  *
  * An #OstreeRepo object is just a wrapper around a file path; creating
  * an ostree_repo_new() does not load any contents from disk. If you have
- * an existing repo, use ostree_repo_check() to load it from disk and
+ * an existing repo, use ostree_repo_open() to load it from disk and
  * check its validity. To initialize a new repository in the given
  * filepath, use ostree_repo_create() instead.
  *
@@ -447,7 +447,7 @@ ostree_repo_create (OstreeRepo     *self,
   if (!g_file_make_directory (child, cancellable, error))
     goto out;
 
-  if (!ostree_repo_check (self, error))
+  if (!ostree_repo_open (self, cancellable, error))
     goto out;
 
   ret = TRUE;
@@ -459,7 +459,9 @@ ostree_repo_create (OstreeRepo     *self,
 }
 
 gboolean
-ostree_repo_check (OstreeRepo *self, GError **error)
+ostree_repo_open (OstreeRepo    *self,
+                  GCancellable  *cancellable,
+                  GError       **error)
 {
   gboolean ret = FALSE;
   gboolean is_archive;
@@ -480,7 +482,7 @@ ostree_repo_check (OstreeRepo *self, GError **error)
       goto out;
     }
 
-  if (!gs_file_ensure_directory (self->pending_dir, FALSE, NULL, error))
+  if (!gs_file_ensure_directory (self->pending_dir, FALSE, cancellable, error))
     goto out;
   
   self->config = g_key_file_new ();
@@ -527,7 +529,7 @@ ostree_repo_check (OstreeRepo *self, GError **error)
 
       self->parent_repo = ostree_repo_new (parent_repo_f);
 
-      if (!ostree_repo_check (self->parent_repo, error))
+      if (!ostree_repo_open (self->parent_repo, cancellable, error))
         {
           g_prefix_error (error, "While checking parent repository '%s': ",
                           gs_file_get_path_cached (parent_repo_f));
diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h
index 1aea784..94e11e9 100644
--- a/src/libostree/ostree-repo.h
+++ b/src/libostree/ostree-repo.h
@@ -56,7 +56,9 @@ OstreeRepo* ostree_repo_new (GFile *path);
 
 OstreeRepo* ostree_repo_new_default (void);
 
-gboolean      ostree_repo_check (OstreeRepo  *self, GError **error);
+gboolean      ostree_repo_open   (OstreeRepo     *self,
+                                  GCancellable   *cancellable,
+                                  GError        **error);
 
 gboolean      ostree_repo_create (OstreeRepo     *self,
                                   OstreeRepoMode  mode,
diff --git a/src/ostree/ot-admin-builtin-upgrade.c b/src/ostree/ot-admin-builtin-upgrade.c
index f16edd3..882c41a 100644
--- a/src/ostree/ot-admin-builtin-upgrade.c
+++ b/src/ostree/ot-admin-builtin-upgrade.c
@@ -93,7 +93,7 @@ ot_admin_builtin_upgrade (int argc, char **argv, GFile *sysroot, GCancellable *c
 
   repo_path = g_file_resolve_relative_path (sysroot, "ostree/repo");
   repo = ostree_repo_new (repo_path);
-  if (!ostree_repo_check (repo, error))
+  if (!ostree_repo_open (repo, cancellable, error))
     goto out;
 
   origin = ot_deployment_get_origin (merge_deployment);
diff --git a/src/ostree/ot-admin-functions.c b/src/ostree/ot-admin-functions.c
index 8aca881..a3f3902 100644
--- a/src/ostree/ot-admin-functions.c
+++ b/src/ostree/ot-admin-functions.c
@@ -829,7 +829,7 @@ ot_admin_get_repo (GFile         *sysroot,
   gs_unref_object GFile *repo_path = g_file_resolve_relative_path (sysroot, "ostree/repo");
 
   ret_repo = ostree_repo_new (repo_path);
-  if (!ostree_repo_check (ret_repo, error))
+  if (!ostree_repo_open (ret_repo, cancellable, error))
     goto out;
     
   ret = TRUE;
diff --git a/src/ostree/ot-builtin-pull-local.c b/src/ostree/ot-builtin-pull-local.c
index 2406594..090b9b5 100644
--- a/src/ostree/ot-builtin-pull-local.c
+++ b/src/ostree/ot-builtin-pull-local.c
@@ -192,7 +192,7 @@ ostree_builtin_pull_local (int argc, char **argv, OstreeRepo *repo, GCancellable
   src_f = g_file_new_for_path (src_repo_path);
 
   data->src_repo = ostree_repo_new (src_f);
-  if (!ostree_repo_check (data->src_repo, error))
+  if (!ostree_repo_open (data->src_repo, cancellable, error))
     goto out;
 
   data->threadpool = ot_thread_pool_new_nproc (import_one_object_thread, data);
diff --git a/src/ostree/ot-main.c b/src/ostree/ot-main.c
index 9e1b4fa..1138f86 100644
--- a/src/ostree/ot-main.c
+++ b/src/ostree/ot-main.c
@@ -224,7 +224,7 @@ ostree_run (int    argc,
     {
       GError *temp_error = NULL;
       repo = ostree_repo_new_default ();
-      if (!ostree_repo_check (repo, &temp_error))
+      if (!ostree_repo_open (repo, cancellable, &temp_error))
         {
           if (g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
             {
@@ -246,7 +246,7 @@ ostree_run (int    argc,
       repo = ostree_repo_new (repo_file);
       if (!(command->flags & OSTREE_BUILTIN_FLAG_NO_CHECK))
         {
-          if (!ostree_repo_check (repo, &error))
+          if (!ostree_repo_open (repo, cancellable, &error))
             goto out;
         }
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]