Use *at() functions for native filesystem commits

This is just an efficiency optimization.  We're getting fairly close
to all of the hot code paths using `*at()`.

Note that we end up maintaining a half-duplicate code path set here,
because we still need to support commits from an arbitrary GFile *,
which in a possible common case is an OSTree commit.

I think it's worth it though.
This commit is contained in:
Colin Walters committed 2015-01-06 22:43:14 -05:00
1 parent cf8d6848b3
commit 026c5c60d3
4 files changed
+250 -34

No files matched your search

+28
View File
@@ -115,3 +115,31 @@ ot_lsetxattrat (int dfd,
return TRUE;
}
gboolean
ot_readlinkat_gfile_info (int dfd,
const char *path,
GFileInfo *target_info,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
char targetbuf[PATH_MAX+1];
ssize_t len;
do
len = readlinkat (dfd, path, targetbuf, sizeof (targetbuf) - 1);
while (G_UNLIKELY (len == -1 && errno == EINTR));
if (len == -1)
{
gs_set_error_from_errno (error, errno);
goto out;
}
targetbuf[len] = '\0';
g_file_info_set_symlink_target (target_info, targetbuf);
ret = TRUE;
out:
return ret;
}
+6
View File
@@ -44,5 +44,11 @@ gboolean ot_lsetxattrat (int dfd,
int flags,
GError **error);
gboolean ot_readlinkat_gfile_info (int dfd,
const char *path,
GFileInfo *target_info,
GCancellable *cancellable,
GError **error);
G_END_DECLS