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

@@ -830,11 +830,13 @@ dispatch_set_read_source (OstreeRepo *repo,
g_free (state->read_source_object);
state->read_source_object = ostree_checksum_from_bytes (state->payload_data + source_offset);
if (!_ostree_repo_read_bare_fd (repo, state->read_source_object, &state->read_source_fd,
cancellable, error))
if (!_ostree_repo_load_file_bare (repo, state->read_source_object,
&state->read_source_fd,
NULL, NULL, NULL,
cancellable, error))
goto out;
ret = TRUE;
out:
if (!ret)