From 73991a922217a499ffb19fa254b1fda8bfac42c4 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Wed, 20 Apr 2022 17:26:03 +0400 Subject: include: move qemu_msync() to osdep The implementation depends on the OS. (and longer-term goal is to move cutils to a common subproject) Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé Message-Id: <20220420132624.2439741-21-marcandre.lureau@redhat.com> --- include/qemu/cutils.h | 1 - include/qemu/osdep.h | 13 +++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h index e873bad366..fb47ec9318 100644 --- a/include/qemu/cutils.h +++ b/include/qemu/cutils.h @@ -130,7 +130,6 @@ const char *qemu_strchrnul(const char *s, int c); #endif time_t mktimegm(struct tm *tm); int qemu_fdatasync(int fd); -int qemu_msync(void *addr, size_t length, int fd); int qemu_parse_fd(const char *param); int qemu_strtoi(const char *nptr, const char **endptr, int base, int *result); diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 14b6b65a5f..bf4f75dcde 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -641,6 +641,19 @@ static inline void qemu_reset_optind(void) #endif } +/** + * Sync changes made to the memory mapped file back to the backing + * storage. For POSIX compliant systems this will fallback + * to regular msync call. Otherwise it will trigger whole file sync + * (including the metadata case there is no support to skip that otherwise) + * + * @addr - start of the memory area to be synced + * @length - length of the are to be synced + * @fd - file descriptor for the file to be synced + * (mandatory only for POSIX non-compliant systems) + */ +int qemu_msync(void *addr, size_t length, int fd); + /** * qemu_get_host_name: * @errp: Error object -- cgit v1.2.3-55-g7522