Author: ed
Date: Mon Aug 15 20:11:52 2016
New Revision: 304185
URL: https://svnweb.freebsd.org/changeset/base/304185

Log:
  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

Modified:
  head/sys/compat/cloudabi/cloudabi_fd.c
  head/sys/compat/linux/linux_file.c
  head/sys/kern/vfs_syscalls.c
  head/sys/sys/syscallsubr.h

Modified: head/sys/compat/cloudabi/cloudabi_fd.c
==============================================================================
--- head/sys/compat/cloudabi/cloudabi_fd.c      Mon Aug 15 20:09:09 2016        
(r304184)
+++ head/sys/compat/cloudabi/cloudabi_fd.c      Mon Aug 15 20:11:52 2016        
(r304185)
@@ -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 *
 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));
 }

Modified: head/sys/compat/linux/linux_file.c
==============================================================================
--- head/sys/compat/linux/linux_file.c  Mon Aug 15 20:09:09 2016        
(r304184)
+++ head/sys/compat/linux/linux_file.c  Mon Aug 15 20:11:52 2016        
(r304185)
@@ -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

Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c        Mon Aug 15 20:09:09 2016        
(r304184)
+++ head/sys/kern/vfs_syscalls.c        Mon Aug 15 20:11:52 2016        
(r304185)
@@ -3354,7 +3354,7 @@ freebsd6_ftruncate(struct thread *td, st
 }
 #endif
 
-static int
+int
 kern_fsync(struct thread *td, int fd, bool fullsync)
 {
        struct vnode *vp;

Modified: head/sys/sys/syscallsubr.h
==============================================================================
--- head/sys/sys/syscallsubr.h  Mon Aug 15 20:09:09 2016        (r304184)
+++ head/sys/sys/syscallsubr.h  Mon Aug 15 20:11:52 2016        (r304185)
@@ -100,6 +100,7 @@ int kern_fhstat(struct thread *td, fhand
 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);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to