summaryrefslogtreecommitdiff
path: root/glnx-fdio.h
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2015-04-08 21:04:15 -0400
committerColin Walters <walters@verbum.org>2015-04-08 21:13:05 -0400
commitdc47528f51427f8fbb274929bdbf5a8c1380e8d8 (patch)
treec2012daa290578d86f6fcc2d95d2efd3a68b702a /glnx-fdio.h
parent55220bdbf2363b9826ad05c7537abe057e69bacc (diff)
downloadlibglnx-dc47528f51427f8fbb274929bdbf5a8c1380e8d8.tar.gz
fdio: Add glnx_file_replace_contents_at()
Sort of similar to `g_file_replace_contents()` but `*at()`. Will be used for further conversion of OSTree to `*at()`.
Diffstat (limited to 'glnx-fdio.h')
-rw-r--r--glnx-fdio.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/glnx-fdio.h b/glnx-fdio.h
index 47368df..a380c1f 100644
--- a/glnx-fdio.h
+++ b/glnx-fdio.h
@@ -63,6 +63,28 @@ glnx_file_get_contents_utf8_at (int dfd,
GCancellable *cancellable,
GError **error);
+/**
+ * GLnxFileReplaceFlags:
+ * @GLNX_FILE_REPLACE_DATASYNC_NEW: Call fdatasync() even if the file did not exist
+ * @GLNX_FILE_REPLACE_NODATASYNC: Never call fdatasync()
+ *
+ * Flags controlling file replacement.
+ */
+typedef enum {
+ GLNX_FILE_REPLACE_DATASYNC_NEW = (1 << 0),
+ GLNX_FILE_REPLACE_NODATASYNC = (1 << 1),
+} GLnxFileReplaceFlags;
+
+gboolean
+glnx_file_replace_contents_at (int dfd,
+ const char *subpath,
+ const guint8 *buf,
+ gsize len,
+ int mode,
+ GLnxFileReplaceFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+
char *
glnx_readlinkat_malloc (int dfd,
const char *subpath,