diff options
author | David 'Digit' Turner <digit@android.com> | 2010-05-10 23:47:54 -0700 |
---|---|---|
committer | David 'Digit' Turner <digit@android.com> | 2010-05-11 17:59:35 -0700 |
commit | fd3b1a0e32964436a5259e073857e0c4e2110122 (patch) | |
tree | 6cd005834ebeabf4a46e7b2ec8c65a51c18f0a61 | |
parent | 9251866320b5f8329a043bb56b3a794f78d12849 (diff) | |
download | external_qemu-fd3b1a0e32964436a5259e073857e0c4e2110122.zip external_qemu-fd3b1a0e32964436a5259e073857e0c4e2110122.tar.gz external_qemu-fd3b1a0e32964436a5259e073857e0c4e2110122.tar.bz2 |
Upstream: add qemu_fdatasync()
Change-Id: I232b9c4df372e1fded97694fffcd72ef9ea113c4
-rwxr-xr-x | android-configure.sh | 8 | ||||
-rw-r--r-- | android/config/linux-x86/config-host.h | 1 | ||||
-rw-r--r-- | cutils.c | 16 | ||||
-rw-r--r-- | qemu-common.h | 2 |
4 files changed, 27 insertions, 0 deletions
diff --git a/android-configure.sh b/android-configure.sh index 7a23954..0e95e04 100755 --- a/android-configure.sh +++ b/android-configure.sh @@ -419,6 +419,14 @@ echo "#define CONFIG_GDBSTUB 1" >> $config_h echo "#define CONFIG_SLIRP 1" >> $config_h echo "#define CONFIG_SKINS 1" >> $config_h echo "#define CONFIG_TRACE 1" >> $config_h + +# only Linux has fdatasync() +case "$OS" in + linux-*) + echo "#define CONFIG_FDATASYNC 1" >> $config_h + ;; +esac + # the -nand-limits options can only work on non-windows systems if [ "$OS" != "windows" ] ; then echo "#define CONFIG_NAND_LIMITS 1" >> $config_h diff --git a/android/config/linux-x86/config-host.h b/android/config/linux-x86/config-host.h index a97d2c6..904dbfa 100644 --- a/android/config/linux-x86/config-host.h +++ b/android/config/linux-x86/config-host.h @@ -11,3 +11,4 @@ #define CONFIG_UNAME_RELEASE "" #define CONFIG_IOTHREAD 1 #define CONFIG_IOVEC 1 +#define CONFIG_FDATASYNC 1 @@ -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) diff --git a/qemu-common.h b/qemu-common.h index 1416dfd..664e83f 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -110,8 +110,10 @@ void pstrcpy(char *buf, int buf_size, const char *str); char *pstrcat(char *buf, int buf_size, const char *s); int strstart(const char *str, const char *val, const char **ptr); int stristart(const char *str, const char *val, const char **ptr); +int qemu_strnlen(const char *s, int max_len); time_t mktimegm(struct tm *tm); int qemu_fls(int i); +int qemu_fdatasync(int fd); #define qemu_isalnum(c) isalnum((unsigned char)(c)) #define qemu_isalpha(c) isalpha((unsigned char)(c)) |