get rid of qemu_utimens()
cover get rid of qemu_utimens()
It is currently only used by 9pfs and virtfs-proxy-helper. This series convert them to utimensat() and futimens().
--
Greg
---
Greg Kurz (2):
9pfs: assume utimensat() and futimens() are present
util: drop old utimensat() compat code
configure | 22 -------------------- fsdev/virtfs-proxy-helper.c | 3 ++- hw/9pfs/9p-handle.c | 5 ----- include/sysemu/os-posix.h | 11 ---------- util/oslib-posix.c | 47 ------------------------------------------- 5 files changed, 2 insertions(+), 86 deletions(-)
PATCH 1/2 9pfs: assume utimensat() and futimens() are present
The utimensat() and futimens() syscalls have been around for ages (ie, glibc 2.6 and linux 2.6.22), and the decision was already taken to switch to utimensat() anyway when fixing CVE-2016-9602 in 2.9.
--- fsdev/virtfs-proxy-helper.c | 3 ++- hw/9pfs/9p-handle.c | 5 ----- 2 files changed, 2 insertions(+), 6 deletions(-)
fsdev/virtfs-proxy-helper.c +2 -1
@@ -945,7 +945,8 @@ static int process_requests(int sock) &spec[0 ].tv_sec, &spec[0 ].tv_nsec, &spec[1].tv_sec, &spec[1].tv_nsec);if (retval >0 ) { - retval =qemu_utimens (path.data, spec); + retval =utimensat (AT_FDCWD , path.data, spec, +AT_SYMLINK_NOFOLLOW );if (retval <0 ) { retval = -errno; }
hw/9pfs/9p-handle.c +0 -5
@@ -378,7 +378,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;
@@ -388,10 +387,6 @@ static int handle_utimensat(FsContext *ctx, V9fsPath *fs_path, } ret =futimens (fd, buf);close (fd); -#else - ret =-1 ; - errno =ENOSYS ; -#endif return ret; }
PATCH 2/2 util: drop old utimensat() compat code
In reply to Greg KurzNow that 9pfs and virtfs-proxy-helper have been converted to utimensat(), we don't need to keep qemu_utimens() anymore.
--- configure | 22 --------------------- include/sysemu/os-posix.h | 11 ----------- util/oslib-posix.c | 47 --------------------------------------------- 3 files changed, 80 deletions(-)
configure +0 -22
@@ -3623,25 +3623,6 @@ if compile_prog "" "" ; then inotify1=yes fi -# check if utimensat and futimens are supported -utimens=no -cat > $TMPC << EOF -#define _ATFILE_SOURCE -#include <stddef.h> -#include <fcntl.h> -#include <sys/stat.h> - -int main(void) -{ - utimensat(AT_FDCWD, "foo", NULL, 0); - futimens(0, NULL); - return 0; -} -EOF -if compile_prog "" "" ; then - utimens=yes -fi - # check if pipe2 is there pipe2=no cat > $TMPC << EOF
@@ -5427,9 +5408,6 @@ fi if test "$curses" = "yes" ; then echo "CONFIG_CURSES=y" >> $config_host_mak fi -if test "$utimens" = "yes" ; then - echo "CONFIG_UTIMENSAT=y" >> $config_host_mak -fi if test "$pipe2" = "yes" ; then echo "CONFIG_PIPE2=y" >> $config_host_mak fi
include/sysemu/os-posix.h +0 -11
@@ -51,17 +51,6 @@ int os_mlock(void);typedef struct timeval qemu_timeval ;#define qemu_gettimeofday (tp) gettimeofday(tp, NULL) -#ifndef CONFIG_UTIMENSAT -#ifndef UTIME_NOW -# define UTIME_NOW ((1l << 30) - 1l) -#endif -#ifndef UTIME_OMIT -# define UTIME_OMIT ((1l << 30) - 2l) -#endif -#endif -typedef struct timespec qemu_timespec ; -int qemu_utimens (const char *path,const qemu_timespec *times); -bool is_daemonized (void );/**
util/oslib-posix.c +0 -47
53 lines not on this page · raw message
Quoted 11 lines · Greg Kurz
It is currently only used by 9pfs and virtfs-proxy-helper. This series convert them to
utimensat()andfutimens().--
Greg---
Greg Kurz (2):
9pfs: assumeutimensat()andfutimens()are present
util: drop oldutimensat()compat code
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org