[ostree] Add an internal API to get a read fd for a content object



commit be4ad54800514af60b2ed8d4ad7f1b4774525493
Author: Colin Walters <walters verbum org>
Date:   Thu Feb 5 21:49:49 2015 -0500

    Add an internal API to get a read fd for a content object
    
    This will be used by the static deltas work.

 src/libostree/ostree-repo-private.h |    7 +++++++
 src/libostree/ostree-repo.c         |   18 ++++++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/libostree/ostree-repo-private.h b/src/libostree/ostree-repo-private.h
index e55ed60..f3f1cfe 100644
--- a/src/libostree/ostree-repo-private.h
+++ b/src/libostree/ostree-repo-private.h
@@ -229,4 +229,11 @@ _ostree_repo_commit_trusted_content_bare (OstreeRepo          *self,
                                           GCancellable        *cancellable,
                                           GError             **error);
 
+gboolean
+_ostree_repo_read_bare_fd (OstreeRepo           *self,
+                           const char           *checksum,
+                           int                  *out_fd,
+                           GCancellable        *cancellable,
+                           GError             **error);
+                           
 G_END_DECLS
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 1de17a8..accb011 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -1875,6 +1875,24 @@ set_info_from_filemeta (GFileInfo  *info,
   return xattrs;
 }
 
+gboolean
+_ostree_repo_read_bare_fd (OstreeRepo           *self,
+                           const char           *checksum,
+                           int                  *out_fd,
+                           GCancellable        *cancellable,
+                           GError             **error)
+{
+  char loose_path_buf[_OSTREE_LOOSE_PATH_MAX];
+  
+  g_assert (self->mode == OSTREE_REPO_MODE_BARE ||
+            self->mode == OSTREE_REPO_MODE_BARE_USER);
+
+  _ostree_loose_path (loose_path_buf, checksum, OSTREE_OBJECT_TYPE_FILE, self->mode);
+  
+  return gs_file_openat_noatime (self->objects_dir_fd, loose_path_buf, out_fd,
+                               cancellable, error);
+}
+
 /**
  * ostree_repo_load_file:
  * @self: Repo


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