summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca BRUNO <luca.bruno@coreos.com>2022-03-02 16:45:01 +0000
committerLuca BRUNO <luca.bruno@coreos.com>2022-03-02 16:45:01 +0000
commit14a6e6d8d081b11217785d7c37b0c0a8c661000c (patch)
tree4c660df52dcc98a4b3e56b22d2c6ff0f8864d379
parent08e98e904289464e00cd68ac7aa675d23d78971f (diff)
downloadostree-14a6e6d8d081b11217785d7c37b0c0a8c661000c.tar.gz
lib/repo: read split xattrs content from file-xattrs-link objects
-rw-r--r--src/libostree/ostree-repo.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 71a01d59..a27591b3 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -4176,6 +4176,32 @@ repo_load_file_archive (OstreeRepo *self,
}
}
+static GVariant *
+_ostree_repo_read_xattrs_file_link (OstreeRepo *self,
+ const char *checksum,
+ GCancellable *cancellable,
+ GError **error)
+{
+ g_assert (self != NULL);
+ g_assert (checksum != NULL);
+
+ char xattr_path[_OSTREE_LOOSE_PATH_MAX];
+ _ostree_loose_path (xattr_path, checksum, OSTREE_OBJECT_TYPE_FILE_XATTRS_LINK, self->mode);
+
+ g_autoptr(GVariant) xattrs = NULL;
+ glnx_autofd int fd = -1;
+ if (!glnx_openat_rdonly (self->objects_dir_fd, xattr_path, FALSE, &fd, error))
+ return FALSE;
+
+ g_assert (fd >= 0);
+ if (!ot_variant_read_fd (fd, 0, G_VARIANT_TYPE ("a(ayay)"), TRUE,
+ &xattrs, error))
+ return glnx_prefix_error_null (error, "Deserializing xattrs content");
+
+ g_assert (xattrs != NULL);
+ return g_steal_pointer (&xattrs);
+}
+
gboolean
_ostree_repo_load_file_bare (OstreeRepo *self,
const char *checksum,
@@ -4310,6 +4336,15 @@ _ostree_repo_load_file_bare (OstreeRepo *self,
return FALSE;
}
}
+ else if (self->mode == OSTREE_REPO_MODE_BARE_SPLIT_XATTRS)
+ {
+ if (out_xattrs)
+ {
+ ret_xattrs = _ostree_repo_read_xattrs_file_link(self, checksum, cancellable, error);
+ if (ret_xattrs == NULL)
+ return FALSE;
+ }
+ }
else
{
g_assert_not_reached ();