From fc8bde8ffe6e9b08a92227675ebaf367881f06f6 Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Tue, 31 Jan 2017 15:19:44 +0000 Subject: [PATCH] Replace calls to sys_truncate() with kern_truncate(). Reviewed by: kib@ MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D9371 --- sys/compat/freebsd32/freebsd32_misc.c | 12 ++++-------- sys/kern/vfs_syscalls.c | 21 +++------------------ 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 08ef67e7d7b8..8f1494dd3f63 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -1500,11 +1500,9 @@ freebsd32_lseek(struct thread *td, struct freebsd32_lseek_args *uap) int freebsd32_truncate(struct thread *td, struct freebsd32_truncate_args *uap) { - struct truncate_args ap; - ap.path = uap->path; - ap.length = PAIR32TO64(off_t,uap->length); - return (sys_truncate(td, &ap)); + return (kern_truncate(td, uap->path, UIO_USERSPACE, + PAIR32TO64(off_t, uap->length))); } int @@ -1600,11 +1598,9 @@ freebsd6_freebsd32_lseek(struct thread *td, struct freebsd6_freebsd32_lseek_args int freebsd6_freebsd32_truncate(struct thread *td, struct freebsd6_freebsd32_truncate_args *uap) { - struct truncate_args ap; - ap.path = uap->path; - ap.length = PAIR32TO64(off_t,uap->length); - return (sys_truncate(td, &ap)); + return (kern_truncate(td, uap->path, UIO_USERSPACE, + PAIR32TO64(off_t, uap->length))); } int diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 7420203e4b60..67baefc3d06f 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -3310,22 +3310,10 @@ struct otruncate_args { }; #endif int -otruncate(td, uap) - struct thread *td; - register struct otruncate_args /* { - char *path; - long length; - } */ *uap; +otruncate(struct thread *td, struct otruncate_args *uap) { - struct truncate_args /* { - char *path; - int pad; - off_t length; - } */ nuap; - nuap.path = uap->path; - nuap.length = uap->length; - return (sys_truncate(td, &nuap)); + return (kern_truncate(td, uap->path, UIO_USERSPACE, uap->length)); } #endif /* COMPAT_43 */ @@ -3334,11 +3322,8 @@ otruncate(td, uap) int freebsd6_truncate(struct thread *td, struct freebsd6_truncate_args *uap) { - struct truncate_args ouap; - ouap.path = uap->path; - ouap.length = uap->length; - return (sys_truncate(td, &ouap)); + return (kern_truncate(td, uap->path, UIO_USERSPACE, uap->length)); } int