[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/23] block: move fcntl_setfl()
From: |
marcandre . lureau |
Subject: |
[PULL 06/23] block: move fcntl_setfl() |
Date: |
Tue, 3 May 2022 17:00:06 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
It is only used by block/file-posix.c, move it there.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
include/sysemu/os-posix.h | 2 --
block/file-posix.c | 15 +++++++++++++++
util/oslib-posix.c | 15 ---------------
3 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h
index adbe19d3e468..58de7c994d85 100644
--- a/include/sysemu/os-posix.h
+++ b/include/sysemu/os-posix.h
@@ -96,8 +96,6 @@ static inline void qemu_funlockfile(FILE *f)
funlockfile(f);
}
-int fcntl_setfl(int fd, int flag);
-
#ifdef __cplusplus
}
#endif
diff --git a/block/file-posix.c b/block/file-posix.c
index bfd9b2111143..48cd0966249d 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1022,6 +1022,21 @@ static int raw_handle_perm_lock(BlockDriverState *bs,
return ret;
}
+/* Sets a specific flag */
+static int fcntl_setfl(int fd, int flag)
+{
+ int flags;
+
+ flags = fcntl(fd, F_GETFL);
+ if (flags == -1) {
+ return -errno;
+ }
+ if (fcntl(fd, F_SETFL, flags | flag) == -1) {
+ return -errno;
+ }
+ return 0;
+}
+
static int raw_reconfigure_getfd(BlockDriverState *bs, int flags,
int *open_flags, uint64_t perm, bool
force_dup,
Error **errp)
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index b8bf7d4070ce..289efca3fae1 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -897,21 +897,6 @@ size_t qemu_get_host_physmem(void)
return 0;
}
-/* Sets a specific flag */
-int fcntl_setfl(int fd, int flag)
-{
- int flags;
-
- flags = fcntl(fd, F_GETFL);
- if (flags == -1) {
- return -errno;
- }
- if (fcntl(fd, F_SETFL, flags | flag) == -1) {
- return -errno;
- }
- return 0;
-}
-
int qemu_msync(void *addr, size_t length, int fd)
{
size_t align_mask = ~(qemu_real_host_page_size() - 1);
--
2.36.0.44.g0f828332d5ac
- [PULL 04/23] libqtest: split QMP part in libqmp, (continued)
- [PULL 04/23] libqtest: split QMP part in libqmp, marcandre . lureau, 2022/05/03
- [PULL 13/23] io: replace pipe() with g_unix_open_pipe(CLOEXEC), marcandre . lureau, 2022/05/03
- [PULL 08/23] util: replace pipe()+cloexec with g_unix_open_pipe(), marcandre . lureau, 2022/05/03
- [PULL 05/23] Use g_unix_set_fd_nonblocking(), marcandre . lureau, 2022/05/03
- [PULL 02/23] Use QEMU_SANITIZE_ADDRESS, marcandre . lureau, 2022/05/03
- [PULL 12/23] virtiofsd: replace pipe() with g_unix_open_pipe(CLOEXEC), marcandre . lureau, 2022/05/03
- [PULL 10/23] tests: replace pipe() with g_unix_open_pipe(CLOEXEC), marcandre . lureau, 2022/05/03
- [PULL 01/23] Use QEMU_SANITIZE_THREAD, marcandre . lureau, 2022/05/03
- [PULL 07/23] Replace qemu_pipe() with g_unix_open_pipe(), marcandre . lureau, 2022/05/03
- [PULL 19/23] hw: replace qemu_set_nonblock(), marcandre . lureau, 2022/05/03
- [PULL 06/23] block: move fcntl_setfl(),
marcandre . lureau <=
- [PULL 09/23] qga: replace pipe() with g_unix_open_pipe(CLOEXEC), marcandre . lureau, 2022/05/03
- [PULL 20/23] ui: replace qemu_set_nonblock(), marcandre . lureau, 2022/05/03
- [PULL 03/23] tests: move libqtest.h back under qtest/, marcandre . lureau, 2022/05/03
- [PULL 17/23] io: replace qemu_set{_non}block(), marcandre . lureau, 2022/05/03
- [PULL 23/23] util: rename qemu_*block() socket functions, marcandre . lureau, 2022/05/03
- [PULL 21/23] net: replace qemu_set_nonblock(), marcandre . lureau, 2022/05/03
- [PULL 18/23] qga: replace qemu_set_nonblock(), marcandre . lureau, 2022/05/03
- [PULL 15/23] io: make qio_channel_command_new_pid() static, marcandre . lureau, 2022/05/03
- [PULL 11/23] os-posix: replace pipe()+cloexec with g_unix_open_pipe(CLOEXEC), marcandre . lureau, 2022/05/03
- [PULL 00/23] Misc patches, marcandre . lureau, 2022/05/03