diff options
| author | Marc-André Lureau | 2022-03-29 13:27:12 +0200 |
|---|---|---|
| committer | Marc-André Lureau | 2022-05-03 13:17:53 +0200 |
| commit | ad24b679d215c2f8eaab6125a68e864c2a5d7dde (patch) | |
| tree | 194050ff45006904a395cf6fd7bae9471376d01d /block | |
| parent | Use g_unix_set_fd_nonblocking() (diff) | |
| download | qemu-ad24b679d215c2f8eaab6125a68e864c2a5d7dde.tar.gz qemu-ad24b679d215c2f8eaab6125a68e864c2a5d7dde.tar.xz qemu-ad24b679d215c2f8eaab6125a68e864c2a5d7dde.zip | |
block: move fcntl_setfl()
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>
Diffstat (limited to 'block')
| -rw-r--r-- | block/file-posix.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/block/file-posix.c b/block/file-posix.c index bfd9b21111..48cd096624 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) |
