diff options
author | trasz <trasz@FreeBSD.org> | 2017-03-19 14:46:40 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2017-03-19 14:46:40 +0000 |
commit | a43cc8b98dc6738add7832af5e872a83d666a0de (patch) | |
tree | ebc11897e21564e3a9bc83f4d97b95455175defa /sys/compat | |
parent | dda33d70766a6fd935229fd6293181d7dae494f7 (diff) | |
download | FreeBSD-src-a43cc8b98dc6738add7832af5e872a83d666a0de.zip FreeBSD-src-a43cc8b98dc6738add7832af5e872a83d666a0de.tar.gz |
MFC r313018:
Add kern_pread() and kern_pwrite(), and use it in compats instead
of their sys_*() counterparts. The svr4 is left unchanged.
Sponsored by: DARPA, AFRL
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/freebsd32/freebsd32_misc.c | 32 | ||||
-rw-r--r-- | sys/compat/linux/linux_file.c | 22 |
2 files changed, 12 insertions, 42 deletions
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 7c354c8..8857e91 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -1442,25 +1442,17 @@ freebsd4_freebsd32_fhstatfs(struct thread *td, struct freebsd4_freebsd32_fhstatf int freebsd32_pread(struct thread *td, struct freebsd32_pread_args *uap) { - struct pread_args ap; - ap.fd = uap->fd; - ap.buf = uap->buf; - ap.nbyte = uap->nbyte; - ap.offset = PAIR32TO64(off_t,uap->offset); - return (sys_pread(td, &ap)); + return (kern_pread(td, uap->fd, uap->buf, uap->nbyte, + PAIR32TO64(off_t, uap->offset))); } int freebsd32_pwrite(struct thread *td, struct freebsd32_pwrite_args *uap) { - struct pwrite_args ap; - ap.fd = uap->fd; - ap.buf = uap->buf; - ap.nbyte = uap->nbyte; - ap.offset = PAIR32TO64(off_t,uap->offset); - return (sys_pwrite(td, &ap)); + return (kern_pwrite(td, uap->fd, uap->buf, uap->nbyte, + PAIR32TO64(off_t, uap->offset))); } #ifdef COMPAT_43 @@ -1549,25 +1541,17 @@ freebsd32_getdirentries(struct thread *td, int freebsd6_freebsd32_pread(struct thread *td, struct freebsd6_freebsd32_pread_args *uap) { - struct pread_args ap; - ap.fd = uap->fd; - ap.buf = uap->buf; - ap.nbyte = uap->nbyte; - ap.offset = PAIR32TO64(off_t,uap->offset); - return (sys_pread(td, &ap)); + return (kern_pread(td, uap->fd, uap->buf, uap->nbyte, + PAIR32TO64(off_t, uap->offset))); } int freebsd6_freebsd32_pwrite(struct thread *td, struct freebsd6_freebsd32_pwrite_args *uap) { - struct pwrite_args ap; - ap.fd = uap->fd; - ap.buf = uap->buf; - ap.nbyte = uap->nbyte; - ap.offset = PAIR32TO64(off_t,uap->offset); - return (sys_pwrite(td, &ap)); + return (kern_pwrite(td, uap->fd, uap->buf, uap->nbyte, + PAIR32TO64(off_t, uap->offset))); } int diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index b549274..37b8595 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -998,20 +998,13 @@ linux_fdatasync(td, uap) } int -linux_pread(td, uap) - struct thread *td; - struct linux_pread_args *uap; +linux_pread(struct thread *td, struct linux_pread_args *uap) { - struct pread_args bsd; cap_rights_t rights; struct vnode *vp; int error; - bsd.fd = uap->fd; - bsd.buf = uap->buf; - bsd.nbyte = uap->nbyte; - bsd.offset = uap->offset; - error = sys_pread(td, &bsd); + error = kern_pread(td, uap->fd, uap->buf, uap->nbyte, uap->offset); if (error == 0) { /* This seems to violate POSIX but linux does it */ error = fgetvp(td, uap->fd, @@ -1028,17 +1021,10 @@ linux_pread(td, uap) } int -linux_pwrite(td, uap) - struct thread *td; - struct linux_pwrite_args *uap; +linux_pwrite(struct thread *td, struct linux_pwrite_args *uap) { - struct pwrite_args bsd; - bsd.fd = uap->fd; - bsd.buf = uap->buf; - bsd.nbyte = uap->nbyte; - bsd.offset = uap->offset; - return (sys_pwrite(td, &bsd)); + return (kern_pwrite(td, uap->fd, uap->buf, uap->nbyte, uap->offset)); } int |