From 93d9ebd82ebb0ac1507706f865cb39690980a2aa Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Mon, 15 Aug 2016 20:11:52 +0000 Subject: [PATCH] Eliminate use of sys_fsync() and sys_fdatasync(). Make the kern_fsync() function public, so that it can be used by other parts of the kernel. Fix up existing consumers to make use of it. Requested by: kib --- sys/compat/cloudabi/cloudabi_fd.c | 10 ++-------- sys/compat/linux/linux_file.c | 4 +--- sys/kern/vfs_syscalls.c | 2 +- sys/sys/syscallsubr.h | 1 + 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/sys/compat/cloudabi/cloudabi_fd.c b/sys/compat/cloudabi/cloudabi_fd.c index ae99bb410dc1..5500e3920e17 100644 --- a/sys/compat/cloudabi/cloudabi_fd.c +++ b/sys/compat/cloudabi/cloudabi_fd.c @@ -172,11 +172,8 @@ int cloudabi_sys_fd_datasync(struct thread *td, struct cloudabi_sys_fd_datasync_args *uap) { - struct fdatasync_args fdatasync_args = { - .fd = uap->fd - }; - return (sys_fdatasync(td, &fdatasync_args)); + return (kern_fsync(td, uap->fd, false)); } int @@ -556,9 +553,6 @@ cloudabi_sys_fd_stat_put(struct thread *td, int cloudabi_sys_fd_sync(struct thread *td, struct cloudabi_sys_fd_sync_args *uap) { - struct fsync_args fsync_args = { - .fd = uap->fd - }; - return (sys_fsync(td, &fsync_args)); + return (kern_fsync(td, uap->fd, true)); } diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index d3af86093db7..b5126f4b6cbc 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -1013,10 +1013,8 @@ linux_fdatasync(td, uap) struct thread *td; struct linux_fdatasync_args *uap; { - struct fsync_args bsd; - bsd.fd = uap->fd; - return (sys_fsync(td, &bsd)); + return (kern_fsync(td, uap->fd, false)); } int diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 8419e360e559..bcf74853b823 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -3354,7 +3354,7 @@ freebsd6_ftruncate(struct thread *td, struct freebsd6_ftruncate_args *uap) } #endif -static int +int kern_fsync(struct thread *td, int fd, bool fullsync) { struct vnode *vp; diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h index a0e58e9e79c1..42ee5159e977 100644 --- a/sys/sys/syscallsubr.h +++ b/sys/sys/syscallsubr.h @@ -100,6 +100,7 @@ int kern_fhstat(struct thread *td, fhandle_t fh, struct stat *buf); int kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf); int kern_fstat(struct thread *td, int fd, struct stat *sbp); int kern_fstatfs(struct thread *td, int fd, struct statfs *buf); +int kern_fsync(struct thread *td, int fd, bool fullsync); int kern_ftruncate(struct thread *td, int fd, off_t length); int kern_futimes(struct thread *td, int fd, struct timeval *tptr, enum uio_seg tptrseg);