[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 06/13] oslib: support futimens() if available
From: |
Greg Kurz |
Subject: |
[Qemu-devel] [PATCH 06/13] oslib: support futimens() if available |
Date: |
Mon, 27 Jun 2016 11:41:45 +0200 |
User-agent: |
StGit/0.17.1-dirty |
Signed-off-by: Greg Kurz <address@hidden>
---
hw/9pfs/9p-handle.c | 7 +------
include/sysemu/os-posix.h | 1 +
util/oslib-posix.c | 10 ++++++++++
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/hw/9pfs/9p-handle.c b/hw/9pfs/9p-handle.c
index e48e48a7145d..197c2c7efbb5 100644
--- a/hw/9pfs/9p-handle.c
+++ b/hw/9pfs/9p-handle.c
@@ -388,7 +388,6 @@ static int handle_utimensat(FsContext *ctx, V9fsPath
*fs_path,
const struct timespec *buf)
{
int ret;
-#ifdef CONFIG_UTIMENSAT
int fd;
struct handle_data *data = (struct handle_data *)ctx->private;
@@ -396,12 +395,8 @@ static int handle_utimensat(FsContext *ctx, V9fsPath
*fs_path,
if (fd < 0) {
return fd;
}
- ret = futimens(fd, buf);
+ ret = qemu_futimens(fd, buf);
close(fd);
-#else
- ret = -1;
- errno = ENOSYS;
-#endif
return ret;
}
diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h
index 9c7dfdfbec69..c2b2288bb3bf 100644
--- a/include/sysemu/os-posix.h
+++ b/include/sysemu/os-posix.h
@@ -57,6 +57,7 @@ typedef struct timeval qemu_timeval;
#endif
typedef struct timespec qemu_timespec;
int qemu_utimens(const char *path, const qemu_timespec *times);
+int qemu_futimens(int fd, const qemu_timespec *times);
bool is_daemonized(void);
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index e2e1d4d39f59..3c9de4ad1d71 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -187,6 +187,16 @@ int qemu_pipe(int pipefd[2])
return ret;
}
+int qemu_futimens(int fd, const struct timespec *times)
+{
+#ifdef CONFIG_UTIMENSAT
+ return futimens(fd, times);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
int qemu_utimens(const char *path, const struct timespec *times)
{
struct timeval tv[2], tv_now;
- [Qemu-devel] [PATCH 00/13] 9p: reconcile virtfs with unlinked files, Greg Kurz, 2016/06/27
- [Qemu-devel] [PATCH 01/13] 9p: synth: drop v9fs_ prefix, Greg Kurz, 2016/06/27
- [Qemu-devel] [PATCH 02/13] 9p: factour out duplicate code from local_fstat() and local_lstat(), Greg Kurz, 2016/06/27
- [Qemu-devel] [PATCH 03/13] 9p: introduce the v9fs_get_fd_fid() helper, Greg Kurz, 2016/06/27
- [Qemu-devel] [PATCH 04/13] 9p: getattr: use fstat if we have a fd, Greg Kurz, 2016/06/27
- [Qemu-devel] [PATCH 05/13] 9p: introduce ftruncate file op, Greg Kurz, 2016/06/27
- [Qemu-devel] [PATCH 06/13] oslib: support futimens() if available,
Greg Kurz <=
- [Qemu-devel] [PATCH 07/13] 9p: introduce futimens file op, Greg Kurz, 2016/06/27
- [Qemu-devel] [PATCH 08/13] 9p: add a fd argument to xattr helpers, Greg Kurz, 2016/06/27
- [Qemu-devel] [PATCH 09/13] 9p: introduce fchown file op, Greg Kurz, 2016/06/27
- [Qemu-devel] [PATCH 10/13] 9p: introduce fchmod file op, Greg Kurz, 2016/06/27
- [Qemu-devel] [PATCH 11/13] 9p: xattr fid to reference file fid, Greg Kurz, 2016/06/27
- [Qemu-devel] [PATCH 12/13] 9p: introduce fgetxattr file op, Greg Kurz, 2016/06/27
- [Qemu-devel] [PATCH 13/13] 9p: introduce flistxattr file op, Greg Kurz, 2016/06/27