core: Use linkat() for hardlink checkouts too

Clean up how we deal with the uncompressed object cache; we now use
openat()/linkat() and such just like we do for the main objects/.

Use linkat() between the objects and the destination, if possible.

https://bugzilla.gnome.org/show_bug.cgi?id=707733
This commit is contained in:
Colin Walters committed 2013-09-08 14:40:09 -04:00
1 parent db148cc9ba
commit 9846fb27fd
6 files changed
+227 -162

No files matched your search

+37
View File
@@ -1036,6 +1036,43 @@ ostree_create_directory_metadata (GFileInfo *dir_info,
return ret_metadata;
}
gboolean
_ostree_set_xattrs_fd (int fd,
GVariant *xattrs,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
int i, n;
n = g_variant_n_children (xattrs);
for (i = 0; i < n; i++)
{
const guint8* name;
gs_unref_variant GVariant *value = NULL;
const guint8* value_data;
gsize value_len;
int res;
g_variant_get_child (xattrs, i, "(^&ay@ay)",
&name, &value);
value_data = g_variant_get_fixed_array (value, &value_len, 1);
do
res = fsetxattr (fd, (char*)name, (char*)value_data, value_len, 0);
while (G_UNLIKELY (res == -1 && errno == EINTR));
if (G_UNLIKELY (res == -1))
{
ot_util_set_error_from_errno (error, errno);
goto out;
}
}
ret = TRUE;
out:
return ret;
}
/**
* ostree_set_xattrs:
* @f: a file