[ostree] core: Make OstreeRepoFile "public"



commit 06548f137e90454ada6a4e5414aadf0dac982043
Author: Colin Walters <walters verbum org>
Date:   Wed Dec 21 13:41:38 2011 -0500

    core: Make OstreeRepoFile "public"
    
    * "ls" used it
    * It's not like our internal API is 100% stable anyways
    * The _ is ugly

 src/libostree/ostree-repo-file-enumerator.c |    6 +-
 src/libostree/ostree-repo-file-enumerator.h |    2 +
 src/libostree/ostree-repo-file.c            |   61 +++++++++++++--------------
 src/libostree/ostree-repo-file.h            |   38 ++++++++--------
 src/libostree/ostree-repo.c                 |   14 +++---
 src/libostree/ostree.h                      |    1 +
 src/ostree/ot-builtin-ls.c                  |    8 ++--
 7 files changed, 66 insertions(+), 64 deletions(-)
---
diff --git a/src/libostree/ostree-repo-file-enumerator.c b/src/libostree/ostree-repo-file-enumerator.c
index 7858bde..7f25ec6 100644
--- a/src/libostree/ostree-repo-file-enumerator.c
+++ b/src/libostree/ostree-repo-file-enumerator.c
@@ -120,9 +120,9 @@ ostree_repo_file_enumerator_next_file (GFileEnumerator  *enumerator,
   gboolean ret = FALSE;
   GFileInfo *info = NULL;
 
-  if (!_ostree_repo_file_tree_query_child (self->dir, self->index,
-                                           self->attributes, self->flags,
-                                           &info, cancellable, error))
+  if (!ostree_repo_file_tree_query_child (self->dir, self->index,
+                                          self->attributes, self->flags,
+                                          &info, cancellable, error))
     goto out;
 
   self->index++;
diff --git a/src/libostree/ostree-repo-file-enumerator.h b/src/libostree/ostree-repo-file-enumerator.h
index 499a01b..4c3d224 100644
--- a/src/libostree/ostree-repo-file-enumerator.h
+++ b/src/libostree/ostree-repo-file-enumerator.h
@@ -42,8 +42,10 @@ struct _OstreeRepoFileEnumeratorClass
   GFileEnumeratorClass parent_class;
 };
 
+G_GNUC_INTERNAL
 GType   _ostree_repo_file_enumerator_get_type (void) G_GNUC_CONST;
 
+G_GNUC_INTERNAL
 GFileEnumerator * _ostree_repo_file_enumerator_new      (OstreeRepoFile       *dir,
 							 const char           *attributes,
 							 GFileQueryInfoFlags   flags,
diff --git a/src/libostree/ostree-repo-file.c b/src/libostree/ostree-repo-file.c
index f24f85e..083e770 100644
--- a/src/libostree/ostree-repo-file.c
+++ b/src/libostree/ostree-repo-file.c
@@ -45,7 +45,6 @@ struct _OstreeRepoFile
   GVariant *tree_metadata;
 };
 
-#define ostree_repo_file_get_type _ostree_repo_file_get_type
 G_DEFINE_TYPE_WITH_CODE (OstreeRepoFile, ostree_repo_file, G_TYPE_OBJECT,
 			 G_IMPLEMENT_INTERFACE (G_TYPE_FILE,
 						ostree_repo_file_file_iface_init))
@@ -106,7 +105,7 @@ set_error_noent (GFile *self, GError **error)
 }
 
 GFile * 
-_ostree_repo_file_new_root (OstreeRepo  *repo,
+ostree_repo_file_new_root (OstreeRepo  *repo,
                             const char  *commit)
 {
   OstreeRepoFile *self;
@@ -124,7 +123,7 @@ _ostree_repo_file_new_root (OstreeRepo  *repo,
 
 
 GFile *
-_ostree_repo_file_new_child (OstreeRepoFile *parent,
+ostree_repo_file_new_child (OstreeRepoFile *parent,
                              const char  *name)
 {
   OstreeRepoFile *self;
@@ -198,7 +197,7 @@ do_resolve_nonroot (OstreeRepoFile     *self,
   gboolean is_dir;
   int i;
 
-  i = _ostree_repo_file_tree_find_child (self->parent, self->name, &is_dir, &container);
+  i = ostree_repo_file_tree_find_child (self->parent, self->name, &is_dir, &container);
   
   if (i < 0)
     {
@@ -252,7 +251,7 @@ do_resolve_nonroot (OstreeRepoFile     *self,
 }
 
 gboolean
-_ostree_repo_file_ensure_resolved (OstreeRepoFile  *self,
+ostree_repo_file_ensure_resolved (OstreeRepoFile  *self,
                                    GError         **error)
 {
   if (self->commit_resolve_error != NULL)
@@ -265,7 +264,7 @@ _ostree_repo_file_ensure_resolved (OstreeRepoFile  *self,
     }
   else if (self->index == -1)
     {
-      if (!_ostree_repo_file_ensure_resolved (self->parent, error))
+      if (!ostree_repo_file_ensure_resolved (self->parent, error))
         goto out;
       (void)do_resolve_nonroot (self, &(self->commit_resolve_error));
     }
@@ -282,7 +281,7 @@ _ostree_repo_file_ensure_resolved (OstreeRepoFile  *self,
 }
 
 gboolean
-_ostree_repo_file_get_xattrs (OstreeRepoFile  *self,
+ostree_repo_file_get_xattrs (OstreeRepoFile  *self,
                               GVariant       **out_xattrs,
                               GCancellable    *cancellable,
                               GError         **error)
@@ -292,14 +291,14 @@ _ostree_repo_file_get_xattrs (OstreeRepoFile  *self,
   GVariant *metadata = NULL;
   GFile *local_file = NULL;
 
-  if (!_ostree_repo_file_ensure_resolved (self, error))
+  if (!ostree_repo_file_ensure_resolved (self, error))
     goto out;
 
   if (self->tree_metadata)
     ret_xattrs = g_variant_get_child_value (self->tree_metadata, 4);
   else if (ostree_repo_get_mode (self->repo) == OSTREE_REPO_MODE_ARCHIVE)
     {
-      local_file = _ostree_repo_file_nontree_get_local (self);
+      local_file = ostree_repo_file_nontree_get_local (self);
       
       if (!ostree_map_metadata_file (local_file, OSTREE_OBJECT_TYPE_ARCHIVED_FILE_META,
                                      &metadata, error))
@@ -310,7 +309,7 @@ _ostree_repo_file_get_xattrs (OstreeRepoFile  *self,
     }
   else
     {
-      local_file = _ostree_repo_file_nontree_get_local (self);
+      local_file = ostree_repo_file_nontree_get_local (self);
       ret_xattrs = ostree_get_xattrs_for_file (local_file, error);
     }
 
@@ -324,19 +323,19 @@ _ostree_repo_file_get_xattrs (OstreeRepoFile  *self,
 }
 
 GVariant *
-_ostree_repo_file_tree_get_contents (OstreeRepoFile  *self)
+ostree_repo_file_tree_get_contents (OstreeRepoFile  *self)
 {
   return self->tree_contents;
 }
 
 GVariant *
-_ostree_repo_file_tree_get_metadata (OstreeRepoFile  *self)
+ostree_repo_file_tree_get_metadata (OstreeRepoFile  *self)
 {
   return self->tree_metadata;
 }
 
 void
-_ostree_repo_file_tree_set_metadata (OstreeRepoFile *self,
+ostree_repo_file_tree_set_metadata (OstreeRepoFile *self,
                                      const char     *checksum,
                                      GVariant       *metadata)
 {
@@ -347,25 +346,25 @@ _ostree_repo_file_tree_set_metadata (OstreeRepoFile *self,
 }
 
 const char *
-_ostree_repo_file_tree_get_content_checksum (OstreeRepoFile  *self)
+ostree_repo_file_tree_get_content_checksum (OstreeRepoFile  *self)
 {
   return self->tree_contents_checksum;
 }
 
 GFile *
-_ostree_repo_file_nontree_get_local (OstreeRepoFile  *self)
+ostree_repo_file_nontree_get_local (OstreeRepoFile  *self)
 {
-  return ostree_repo_get_file_object_path (self->repo, _ostree_repo_file_get_checksum (self));
+  return ostree_repo_get_file_object_path (self->repo, ostree_repo_file_get_checksum (self));
 }
 
 OstreeRepo *
-_ostree_repo_file_get_repo (OstreeRepoFile  *self)
+ostree_repo_file_get_repo (OstreeRepoFile  *self)
 {
   return self->repo;
 }
 
 OstreeRepoFile *
-_ostree_repo_file_get_root (OstreeRepoFile  *self)
+ostree_repo_file_get_root (OstreeRepoFile  *self)
 {
   OstreeRepoFile *parent = self;
 
@@ -375,7 +374,7 @@ _ostree_repo_file_get_root (OstreeRepoFile  *self)
 }
 
 const char *
-_ostree_repo_file_get_checksum (OstreeRepoFile  *self)
+ostree_repo_file_get_checksum (OstreeRepoFile  *self)
 {
   int n;
   gboolean is_dir;
@@ -386,7 +385,7 @@ _ostree_repo_file_get_checksum (OstreeRepoFile  *self)
   if (!self->parent)
     return self->tree_metadata_checksum;
 
-  n = _ostree_repo_file_tree_find_child (self->parent, self->name, &is_dir, NULL);
+  n = ostree_repo_file_tree_find_child (self->parent, self->name, &is_dir, NULL);
   g_assert (n >= 0);
 
   files_variant = g_variant_get_child_value (self->parent->tree_contents, 2);
@@ -504,9 +503,9 @@ ostree_repo_file_dup (GFile *file)
   OstreeRepoFile *self = OSTREE_REPO_FILE (file);
 
   if (self->parent)
-    return _ostree_repo_file_new_child (self->parent, self->name);
+    return ostree_repo_file_new_child (self->parent, self->name);
   else
-    return _ostree_repo_file_new_root (self->repo, self->commit);
+    return ostree_repo_file_new_root (self->repo, self->commit);
 }
 
 static guint
@@ -607,10 +606,10 @@ ostree_repo_file_resolve_relative_path (GFile      *file,
       g_assert (*relative_path == '/');
 
       if (strcmp (relative_path, "/") == 0)
-        return g_object_ref (_ostree_repo_file_get_root (self)); 
+        return g_object_ref (ostree_repo_file_get_root (self)); 
 
       if (self->parent)
-        return ostree_repo_file_resolve_relative_path ((GFile*)_ostree_repo_file_get_root (self),
+        return ostree_repo_file_resolve_relative_path ((GFile*)ostree_repo_file_get_root (self),
                                                        relative_path+1);
       else
         relative_path = relative_path+1;
@@ -625,7 +624,7 @@ ostree_repo_file_resolve_relative_path (GFile      *file,
   else
     filename = g_strdup (relative_path);
 
-  parent = (OstreeRepoFile*)_ostree_repo_file_new_child (self, filename);
+  parent = (OstreeRepoFile*)ostree_repo_file_new_child (self, filename);
   g_free (filename);
     
   if (!rest)
@@ -755,7 +754,7 @@ bsearch_in_file_variant (GVariant  *variant,
 }
 
 int
-_ostree_repo_file_tree_find_child  (OstreeRepoFile  *self,
+ostree_repo_file_tree_find_child  (OstreeRepoFile  *self,
                                     const char      *name,
                                     gboolean        *is_dir,
                                     GVariant       **out_container)
@@ -800,7 +799,7 @@ _ostree_repo_file_tree_find_child  (OstreeRepoFile  *self,
 }
 
 gboolean
-_ostree_repo_file_tree_query_child (OstreeRepoFile  *self,
+ostree_repo_file_tree_query_child (OstreeRepoFile  *self,
                                     int              n,
                                     const char      *attributes,
                                     GFileQueryInfoFlags flags,
@@ -819,7 +818,7 @@ _ostree_repo_file_tree_query_child (OstreeRepoFile  *self,
   GFileAttributeMatcher *matcher = NULL;
   int c;
 
-  if (!_ostree_repo_file_ensure_resolved (self, error))
+  if (!ostree_repo_file_ensure_resolved (self, error))
     goto out;
 
   matcher = g_file_attribute_matcher_new (attributes);
@@ -917,7 +916,7 @@ ostree_repo_file_query_info (GFile                *file,
   gboolean ret = FALSE;
   GFileInfo *info = NULL;
 
-  if (!_ostree_repo_file_ensure_resolved (self, error))
+  if (!ostree_repo_file_ensure_resolved (self, error))
     goto out;
 
   if (!self->parent)
@@ -927,7 +926,7 @@ ostree_repo_file_query_info (GFile                *file,
     }
   else
     {
-      if (!_ostree_repo_file_tree_query_child (self->parent, self->index, 
+      if (!ostree_repo_file_tree_query_child (self->parent, self->index, 
                                                attributes, flags, 
                                                &info, cancellable, error))
         goto out;
@@ -984,7 +983,7 @@ ostree_repo_file_read (GFile         *file,
     }
   else
     {
-      local_file = _ostree_repo_file_nontree_get_local (self);
+      local_file = ostree_repo_file_nontree_get_local (self);
       ret_stream = g_file_read (local_file, cancellable, error);
       if (!ret_stream)
 	goto out;
diff --git a/src/libostree/ostree-repo-file.h b/src/libostree/ostree-repo-file.h
index 5a2dd62..1d3f7f4 100644
--- a/src/libostree/ostree-repo-file.h
+++ b/src/libostree/ostree-repo-file.h
@@ -27,7 +27,7 @@
 
 G_BEGIN_DECLS
 
-#define OSTREE_TYPE_REPO_FILE         (_ostree_repo_file_get_type ())
+#define OSTREE_TYPE_REPO_FILE         (ostree_repo_file_get_type ())
 #define OSTREE_REPO_FILE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), OSTREE_TYPE_REPO_FILE, OstreeRepoFile))
 #define OSTREE_REPO_FILE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), OSTREE_TYPE_REPO_FILE, OstreeRepoFileClass))
 #define OSTREE_IS_REPO_FILE(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), OSTREE_TYPE_REPO_FILE))
@@ -42,47 +42,47 @@ struct _OstreeRepoFileClass
   GObjectClass parent_class;
 };
 
-GType   _ostree_repo_file_get_type (void) G_GNUC_CONST;
+GType   ostree_repo_file_get_type (void) G_GNUC_CONST;
 
-GFile * _ostree_repo_file_new_root (OstreeRepo  *repo,
+GFile * ostree_repo_file_new_root (OstreeRepo  *repo,
                                     const char  *commit);
 
-GFile * _ostree_repo_file_new_child (OstreeRepoFile *parent,
+GFile * ostree_repo_file_new_child (OstreeRepoFile *parent,
                                      const char  *name);
 
-gboolean _ostree_repo_file_ensure_resolved (OstreeRepoFile  *self,
+gboolean ostree_repo_file_ensure_resolved (OstreeRepoFile  *self,
                                             GError         **error);
 
-gboolean _ostree_repo_file_get_xattrs (OstreeRepoFile  *self,
+gboolean ostree_repo_file_get_xattrs (OstreeRepoFile  *self,
                                        GVariant       **out_xattrs,
                                        GCancellable    *cancellable,
                                        GError         **error);
 
-OstreeRepo * _ostree_repo_file_get_repo (OstreeRepoFile  *self);
-OstreeRepoFile * _ostree_repo_file_get_root (OstreeRepoFile  *self);
+OstreeRepo * ostree_repo_file_get_repo (OstreeRepoFile  *self);
+OstreeRepoFile * ostree_repo_file_get_root (OstreeRepoFile  *self);
 
-void _ostree_repo_file_make_empty_tree (OstreeRepoFile  *self);
+void ostree_repo_file_make_empty_tree (OstreeRepoFile  *self);
 
-void _ostree_repo_file_tree_set_metadata (OstreeRepoFile *self,
+void ostree_repo_file_tree_set_metadata (OstreeRepoFile *self,
                                           const char     *checksum,
                                           GVariant       *metadata);
 
-void _ostree_repo_file_tree_set_content_checksum (OstreeRepoFile  *self,
+void ostree_repo_file_tree_set_content_checksum (OstreeRepoFile  *self,
                                                   const char      *checksum);
-const char *_ostree_repo_file_tree_get_content_checksum (OstreeRepoFile  *self);
+const char *ostree_repo_file_tree_get_content_checksum (OstreeRepoFile  *self);
 
-gboolean _ostree_repo_file_is_tree (OstreeRepoFile  *self);
+gboolean ostree_repo_file_is_tree (OstreeRepoFile  *self);
 
-const char * _ostree_repo_file_get_checksum (OstreeRepoFile  *self);
+const char * ostree_repo_file_get_checksum (OstreeRepoFile  *self);
 
-GFile *_ostree_repo_file_nontree_get_local (OstreeRepoFile  *self);
+GFile *ostree_repo_file_nontree_get_local (OstreeRepoFile  *self);
 
-int     _ostree_repo_file_tree_find_child  (OstreeRepoFile  *self,
+int     ostree_repo_file_tree_find_child  (OstreeRepoFile  *self,
                                             const char      *name,
                                             gboolean        *is_dir,
                                             GVariant       **out_container);
 
-gboolean _ostree_repo_file_tree_query_child (OstreeRepoFile  *self,
+gboolean ostree_repo_file_tree_query_child (OstreeRepoFile  *self,
                                              int              n,
                                              const char      *attributes,
                                              GFileQueryInfoFlags flags,
@@ -90,8 +90,8 @@ gboolean _ostree_repo_file_tree_query_child (OstreeRepoFile  *self,
                                              GCancellable    *cancellable,
                                              GError         **error);
 
-GVariant *_ostree_repo_file_tree_get_contents (OstreeRepoFile  *self);
-GVariant *_ostree_repo_file_tree_get_metadata (OstreeRepoFile  *self);
+GVariant *ostree_repo_file_tree_get_contents (OstreeRepoFile  *self);
+GVariant *ostree_repo_file_tree_get_metadata (OstreeRepoFile  *self);
 
 G_END_DECLS
 
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index b23391f..19c4774 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -2202,7 +2202,7 @@ checkout_tree (OstreeRepo               *self,
   GFile *content_object_path = NULL;
   GInputStream *content_input = NULL;
 
-  if (!_ostree_repo_file_get_xattrs (source, &xattrs, NULL, error))
+  if (!ostree_repo_file_get_xattrs (source, &xattrs, NULL, error))
     goto out;
 
   if (!checkout_file_from_input (destination, mode, source_info,
@@ -2240,7 +2240,7 @@ checkout_tree (OstreeRepo               *self,
         }
       else
         {
-          const char *checksum = _ostree_repo_file_get_checksum ((OstreeRepoFile*)src_child);
+          const char *checksum = ostree_repo_file_get_checksum ((OstreeRepoFile*)src_child);
 
           if (priv->mode == OSTREE_REPO_MODE_ARCHIVE && mode == OSTREE_REPO_CHECKOUT_MODE_USER)
             {
@@ -2330,8 +2330,8 @@ ostree_repo_checkout (OstreeRepo              *self,
   if (!ostree_repo_resolve_rev (self, ref, FALSE, &resolved, error))
     goto out;
 
-  root = (OstreeRepoFile*)_ostree_repo_file_new_root (self, resolved);
-  if (!_ostree_repo_file_ensure_resolved (root, error))
+  root = (OstreeRepoFile*)ostree_repo_file_new_root (self, resolved);
+  if (!ostree_repo_file_ensure_resolved (root, error))
     goto out;
 
   root_info = g_file_query_info ((GFile*)root, OSTREE_GIO_FAST_QUERYINFO,
@@ -2364,7 +2364,7 @@ get_file_checksum (GFile  *f,
 
   if (OSTREE_IS_REPO_FILE (f))
     {
-      ret_checksum = g_strdup (_ostree_repo_file_get_checksum ((OstreeRepoFile*)f));
+      ret_checksum = g_strdup (ostree_repo_file_get_checksum ((OstreeRepoFile*)f));
     }
   else
     {
@@ -2678,8 +2678,8 @@ ostree_repo_read_commit (OstreeRepo *self,
   if (!ostree_repo_resolve_rev (self, rev, FALSE, &resolved_rev, error))
     goto out;
 
-  ret_root = _ostree_repo_file_new_root (self, resolved_rev);
-  if (!_ostree_repo_file_ensure_resolved ((OstreeRepoFile*)ret_root, error))
+  ret_root = ostree_repo_file_new_root (self, resolved_rev);
+  if (!ostree_repo_file_ensure_resolved ((OstreeRepoFile*)ret_root, error))
     goto out;
 
   ret = TRUE;
diff --git a/src/libostree/ostree.h b/src/libostree/ostree.h
index da42981..abd71a3 100644
--- a/src/libostree/ostree.h
+++ b/src/libostree/ostree.h
@@ -26,5 +26,6 @@
 #include <ostree-repo.h>
 #include <ostree-checkout.h>
 #include <ostree-mutable-tree.h>
+#include <ostree-repo-file.h>
 
 #endif
diff --git a/src/ostree/ot-builtin-ls.c b/src/ostree/ot-builtin-ls.c
index 7784b3a..f50ec07 100644
--- a/src/ostree/ot-builtin-ls.c
+++ b/src/ostree/ot-builtin-ls.c
@@ -47,7 +47,7 @@ print_one_file (GFile     *f,
   guint32 mode;
   guint32 type;
 
-  if (!_ostree_repo_file_ensure_resolved ((OstreeRepoFile*)f, NULL))
+  if (!ostree_repo_file_ensure_resolved ((OstreeRepoFile*)f, NULL))
     g_assert_not_reached ();
   
   buf = g_string_new ("");
@@ -88,8 +88,8 @@ print_one_file (GFile     *f,
   if (checksum)
     {
       if (type == G_FILE_TYPE_DIRECTORY)
-        g_string_append_printf (buf, "%s ", _ostree_repo_file_tree_get_content_checksum ((OstreeRepoFile*)f));
-      g_string_append_printf (buf, "%s ", _ostree_repo_file_get_checksum ((OstreeRepoFile*)f));
+        g_string_append_printf (buf, "%s ", ostree_repo_file_tree_get_content_checksum ((OstreeRepoFile*)f));
+      g_string_append_printf (buf, "%s ", ostree_repo_file_get_checksum ((OstreeRepoFile*)f));
     }
 
   if (xattrs)
@@ -97,7 +97,7 @@ print_one_file (GFile     *f,
       GVariant *xattrs;
       char *formatted;
 
-      if (!_ostree_repo_file_get_xattrs ((OstreeRepoFile*)f, &xattrs, NULL, NULL))
+      if (!ostree_repo_file_get_xattrs ((OstreeRepoFile*)f, &xattrs, NULL, NULL))
         g_assert_not_reached ();
       
       formatted = g_variant_print (xattrs, TRUE);



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