[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 09/13] osdep: move O_DSYNC and O_DIRECT defines from file-posi
From: |
Stefano Garzarella |
Subject: |
[PATCH v5 09/13] osdep: move O_DSYNC and O_DIRECT defines from file-posix |
Date: |
Thu, 23 May 2024 16:55:18 +0200 |
These defines are also useful for vhost-user-blk when it is compiled
in some POSIX systems that do not define them, so let's move them to
“qemu/osdep.h”.
Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
---
include/qemu/osdep.h | 14 ++++++++++++++
block/file-posix.c | 14 --------------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index f61edcfdc2..e165b5cb1b 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -325,6 +325,20 @@ void QEMU_ERROR("code path is reachable")
#define ESHUTDOWN 4099
#endif
+/* OS X does not have O_DSYNC */
+#ifndef O_DSYNC
+#ifdef O_SYNC
+#define O_DSYNC O_SYNC
+#elif defined(O_FSYNC)
+#define O_DSYNC O_FSYNC
+#endif
+#endif
+
+/* Approximate O_DIRECT with O_DSYNC if O_DIRECT isn't available */
+#ifndef O_DIRECT
+#define O_DIRECT O_DSYNC
+#endif
+
#define RETRY_ON_EINTR(expr) \
(__extension__ \
({ typeof(expr) __result; \
diff --git a/block/file-posix.c b/block/file-posix.c
index 35684f7e21..7a196a2abf 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -110,20 +110,6 @@
#include <sys/diskslice.h>
#endif
-/* OS X does not have O_DSYNC */
-#ifndef O_DSYNC
-#ifdef O_SYNC
-#define O_DSYNC O_SYNC
-#elif defined(O_FSYNC)
-#define O_DSYNC O_FSYNC
-#endif
-#endif
-
-/* Approximate O_DIRECT with O_DSYNC if O_DIRECT isn't available */
-#ifndef O_DIRECT
-#define O_DIRECT O_DSYNC
-#endif
-
#define FTYPE_FILE 0
#define FTYPE_CD 1
--
2.45.1
- Re: [PATCH v5 04/13] vhost-user-server: do not set memory fd non-blocking, (continued)
- [PATCH v5 02/13] libvhost-user: fail vu_message_write() if sendmsg() is failing, Stefano Garzarella, 2024/05/23
- [PATCH v5 05/13] contrib/vhost-user-blk: fix bind() using the right size of the address, Stefano Garzarella, 2024/05/23
- [PATCH v5 06/13] contrib/vhost-user-*: use QEMU bswap helper functions, Stefano Garzarella, 2024/05/23
- [PATCH v5 07/13] vhost-user: enable frontends on any POSIX system, Stefano Garzarella, 2024/05/23
- [PATCH v5 08/13] libvhost-user: enable it on any POSIX system, Stefano Garzarella, 2024/05/23
- [PATCH v5 09/13] osdep: move O_DSYNC and O_DIRECT defines from file-posix,
Stefano Garzarella <=
- [PATCH v5 10/13] contrib/vhost-user-blk: enable it on any POSIX system, Stefano Garzarella, 2024/05/23
- [PATCH v5 11/13] hostmem: add a new memory backend based on POSIX shm_open(), Stefano Garzarella, 2024/05/23
- [PATCH v5 12/13] tests/qtest/vhost-user-blk-test: use memory-backend-shm, Stefano Garzarella, 2024/05/23
- [PATCH v5 13/13] tests/qtest/vhost-user-test: add a test case for memory-backend-shm, Stefano Garzarella, 2024/05/23