Skip to content

Commit e8767a3

Browse files
Christoph Hellwigbrauner
authored andcommitted
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>
1 parent 0924f6b commit e8767a3

2 files changed

Lines changed: 5 additions & 11 deletions

File tree

fs/open.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ int vfs_truncate(const struct path *path, loff_t length)
126126
}
127127
EXPORT_SYMBOL_GPL(vfs_truncate);
128128

129-
int do_sys_truncate(const char __user *pathname, loff_t length)
129+
int ksys_truncate(const char __user *pathname, loff_t length)
130130
{
131131
unsigned int lookup_flags = LOOKUP_FOLLOW;
132132
struct path path;
@@ -151,13 +151,13 @@ int do_sys_truncate(const char __user *pathname, loff_t length)
151151

152152
SYSCALL_DEFINE2(truncate, const char __user *, path, long, length)
153153
{
154-
return do_sys_truncate(path, length);
154+
return ksys_truncate(path, length);
155155
}
156156

157157
#ifdef CONFIG_COMPAT
158158
COMPAT_SYSCALL_DEFINE2(truncate, const char __user *, path, compat_off_t, length)
159159
{
160-
return do_sys_truncate(path, length);
160+
return ksys_truncate(path, length);
161161
}
162162
#endif
163163

@@ -222,7 +222,7 @@ COMPAT_SYSCALL_DEFINE2(ftruncate, unsigned int, fd, compat_off_t, length)
222222
#if BITS_PER_LONG == 32
223223
SYSCALL_DEFINE2(truncate64, const char __user *, path, loff_t, length)
224224
{
225-
return do_sys_truncate(path, length);
225+
return ksys_truncate(path, length);
226226
}
227227

228228
SYSCALL_DEFINE2(ftruncate64, unsigned int, fd, loff_t, length)

include/linux/syscalls.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,13 +1285,7 @@ static inline long ksys_lchown(const char __user *filename, uid_t user,
12851285

12861286
#define FTRUNCATE_LFS (1u << 0) /* allow truncating > 32-bit */
12871287
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);
12951289

12961290
static inline unsigned int ksys_personality(unsigned int personality)
12971291
{

0 commit comments

Comments
 (0)