Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fs: remove do_sys_truncate

do_sys_truncate ist only used to implement ksys_truncate and the native
truncate syscalls. Merge do_sys_truncate into ksys_truncate and return
int from it as it only returns 0 or negative errnos.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20260323070205.2939118-4-hch@lst.de
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Christoph Hellwig and committed by
Christian Brauner
e8767a31 0924f6b8

+5 -11
+4 -4
fs/open.c
··· 126 126 } 127 127 EXPORT_SYMBOL_GPL(vfs_truncate); 128 128 129 - int do_sys_truncate(const char __user *pathname, loff_t length) 129 + int ksys_truncate(const char __user *pathname, loff_t length) 130 130 { 131 131 unsigned int lookup_flags = LOOKUP_FOLLOW; 132 132 struct path path; ··· 151 151 152 152 SYSCALL_DEFINE2(truncate, const char __user *, path, long, length) 153 153 { 154 - return do_sys_truncate(path, length); 154 + return ksys_truncate(path, length); 155 155 } 156 156 157 157 #ifdef CONFIG_COMPAT 158 158 COMPAT_SYSCALL_DEFINE2(truncate, const char __user *, path, compat_off_t, length) 159 159 { 160 - return do_sys_truncate(path, length); 160 + return ksys_truncate(path, length); 161 161 } 162 162 #endif 163 163 ··· 222 222 #if BITS_PER_LONG == 32 223 223 SYSCALL_DEFINE2(truncate64, const char __user *, path, loff_t, length) 224 224 { 225 - return do_sys_truncate(path, length); 225 + return ksys_truncate(path, length); 226 226 } 227 227 228 228 SYSCALL_DEFINE2(ftruncate64, unsigned int, fd, loff_t, length)
+1 -7
include/linux/syscalls.h
··· 1285 1285 1286 1286 #define FTRUNCATE_LFS (1u << 0) /* allow truncating > 32-bit */ 1287 1287 int ksys_ftruncate(unsigned int fd, loff_t length, unsigned int flags); 1288 - 1289 - int do_sys_truncate(const char __user *pathname, loff_t length); 1290 - 1291 - static inline long ksys_truncate(const char __user *pathname, loff_t length) 1292 - { 1293 - return do_sys_truncate(pathname, length); 1294 - } 1288 + int ksys_truncate(const char __user *pathname, loff_t length); 1295 1289 1296 1290 static inline unsigned int ksys_personality(unsigned int personality) 1297 1291 {