block: move fcntl_setfl()
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 29 Mar 2022 11:27:12 +0000 (15:27 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 3 May 2022 11:17:53 +0000 (15:17 +0400)
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>
block/file-posix.c
include/sysemu/os-posix.h
util/oslib-posix.c

index bfd9b21111438271096f4ed40ca5a39ca9587720..48cd0966249dbbff7a2bc1e805cefd8503be8957 100644 (file)
@@ -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)
index adbe19d3e468f7f33607f829be4fa2c9fb130885..58de7c994d851d6331792256848c0666f7fb0f0e 100644 (file)
@@ -96,8 +96,6 @@ static inline void qemu_funlockfile(FILE *f)
     funlockfile(f);
 }
 
-int fcntl_setfl(int fd, int flag);
-
 #ifdef __cplusplus
 }
 #endif
index b8bf7d4070ce2f5a9b47e90e26378bf29195f7ba..289efca3fae1e39cbe0b9ebbb0cf8dad7e28fe91 100644 (file)
@@ -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);