repo: Add a private helper to replace a file, honoring fsync policy

Extracted from discussion in https://github.com/GNOME/ostree/pull/83
This commit is contained in:
Colin Walters committed 2015-04-13 13:28:02 -04:00
1 parent 1892a6fe13
commit fff8ffdd2f
3 files changed
+28 -3

No files matched your search

+17
View File
@@ -1502,6 +1502,23 @@ ostree_repo_set_disable_fsync (OstreeRepo *self,
}
/* Replace the contents of a file, honoring the repository's fsync
* policy.
*/
gboolean
_ostree_repo_file_replace_contents (OstreeRepo *self,
int dfd,
const char *path,
guint8 *buf,
gsize len,
GCancellable *cancellable,
GError **error)
{
return glnx_file_replace_contents_at (dfd, path, buf, len,
self->disable_fsync ? GLNX_FILE_REPLACE_NODATASYNC : GLNX_FILE_REPLACE_DATASYNC_NEW,
cancellable, error);
}
/**
* ostree_repo_get_path:
* @self: