aboutsummaryrefslogtreecommitdiffstats
path: root/cutils.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2010-05-10 23:47:54 -0700
committerDavid 'Digit' Turner <digit@android.com>2010-05-11 17:59:35 -0700
commitfd3b1a0e32964436a5259e073857e0c4e2110122 (patch)
tree6cd005834ebeabf4a46e7b2ec8c65a51c18f0a61 /cutils.c
parent9251866320b5f8329a043bb56b3a794f78d12849 (diff)
downloadexternal_qemu-fd3b1a0e32964436a5259e073857e0c4e2110122.zip
external_qemu-fd3b1a0e32964436a5259e073857e0c4e2110122.tar.gz
external_qemu-fd3b1a0e32964436a5259e073857e0c4e2110122.tar.bz2
Upstream: add qemu_fdatasync()
Change-Id: I232b9c4df372e1fded97694fffcd72ef9ea113c4
Diffstat (limited to 'cutils.c')
-rw-r--r--cutils.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/cutils.c b/cutils.c
index ffe5c71..2365e68 100644
--- a/cutils.c
+++ b/cutils.c
@@ -115,6 +115,22 @@ int qemu_fls(int i)
return 32 - clz32(i);
}
+/*
+ * Make sure data goes on disk, but if possible do not bother to
+ * write out the inode just for timestamp updates.
+ *
+ * Unfortunately even in 2009 many operating systems do not support
+ * fdatasync and have to fall back to fsync.
+ */
+int qemu_fdatasync(int fd)
+{
+#ifdef CONFIG_FDATASYNC
+ return fdatasync(fd);
+#else
+ return fsync(fd);
+#endif
+}
+
/* io vectors */
void qemu_iovec_init(QEMUIOVector *qiov, int alloc_hint)