lib/repo: More cleanup of load_file() internals

This is followon work from previous cleanups.  Basically
`stat_bare_content_object()` was the `fstatat()` logic
and `ostree_repo_read_bare_fd()` was the `openat()` implementation;
they duplicated some bits to find the object in staging, recurse
into parent etc.

Further, I wanted an internal-only version of this API which didn't allocate
`GFileInfo`/`GInputStream` but used a plain `fd` and `struct stat` to avoid
mallocs.

The end version here I think looks a lot nicer, since we deduplicate the various
`open()` calls in the different cases for example.

Closes: #952
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2017-06-23 18:29:51 +00:00
1 parent 63ad289a9c
commit 612c8a5fa8
3 files changed
+148 -207

No files matched your search

+8 -5
View File
@@ -321,11 +321,14 @@ _ostree_repo_commit_trusted_content_bare (OstreeRepo *self,
GError **error);
gboolean
_ostree_repo_read_bare_fd (OstreeRepo *self,
const char *checksum,
int *out_fd,
GCancellable *cancellable,
GError **error);
_ostree_repo_load_file_bare (OstreeRepo *self,
const char *checksum,
int *out_fd,
struct stat *out_stbuf,
char **out_symlink,
GVariant **out_xattrs,
GCancellable *cancellable,
GError **error);
gboolean
_ostree_repo_update_mtime (OstreeRepo *self,