[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 09/27] osdep: Introduce qemu_dup
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [PATCH v5 09/27] osdep: Introduce qemu_dup |
Date: |
Tue, 17 May 2016 15:35:18 +0800 |
This takes care both the CLOEXEC flag and fd-path mapping for image
locking.
Signed-off-by: Fam Zheng <address@hidden>
---
include/qemu/osdep.h | 1 +
util/osdep.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 81913a7..0e51279 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -266,6 +266,7 @@ int qemu_madvise(void *addr, size_t len, int advice);
int qemu_open(const char *name, int flags, ...);
int qemu_close(int fd);
int qemu_lock_fd(int fd, int64_t start, int64_t len, bool exclusive);
+int qemu_dup(int fd);
int qemu_unlock_fd(int fd, int64_t start, int64_t len);
#if defined(__HAIKU__) && defined(__i386__)
diff --git a/util/osdep.c b/util/osdep.c
index 9e5d7fa..966bc32 100644
--- a/util/osdep.c
+++ b/util/osdep.c
@@ -267,6 +267,12 @@ int qemu_unlock_fd(int fd, int64_t start, int64_t len)
return qemu_lock_fcntl(fd, start, len, F_UNLCK);
}
+int qemu_dup(int fd)
+{
+ return qemu_dup_flags(fd, 0);
+}
+
+
/*
* A variant of write(2) which handles partial write.
*
--
2.8.2
- Re: [Qemu-devel] [PATCH v5 07/27] block: Handle image locking during reopen, (continued)
- [Qemu-devel] [PATCH v5 05/27] block: Add bdrv_image_locked, Fam Zheng, 2016/05/17
- [Qemu-devel] [PATCH v5 06/27] block: Make bdrv_reopen_{commit, abort} private functions, Fam Zheng, 2016/05/17
- [Qemu-devel] [PATCH v5 08/27] osdep: Add qemu_lock_fd and qemu_unlock_fd, Fam Zheng, 2016/05/17
- [Qemu-devel] [PATCH v5 12/27] gluster: Implement .bdrv_lockf, Fam Zheng, 2016/05/17
- [Qemu-devel] [PATCH v5 09/27] osdep: Introduce qemu_dup,
Fam Zheng <=
- [Qemu-devel] [PATCH v5 11/27] raw-posix: Implement .bdrv_lockf, Fam Zheng, 2016/05/17
- [Qemu-devel] [PATCH v5 10/27] raw-posix: Use qemu_dup, Fam Zheng, 2016/05/17
- [Qemu-devel] [PATCH v5 16/27] qemu-nbd: Add "--no-lock/-L" option, Fam Zheng, 2016/05/17
- [Qemu-devel] [PATCH v5 15/27] qemu-img: Update documentation of "-L" option, Fam Zheng, 2016/05/17