Re: [PATCH v2 1/2] Add __do_ftruncate that truncates a struct file*

Jens Axboe
2024-01-23T15:40:09Z

On 1/23/24 8:38 AM, Jens Axboe wrote:
>> diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
>> index fd9d12de7e92..e8c56986e751 100644
>> --- a/include/linux/syscalls.h
>> +++ b/include/linux/syscalls.h
>> @@ -1229,6 +1229,8 @@ static inline long ksys_lchown(const char __user *filename, uid_t user,
>> AT_SYMLINK_NOFOLLOW);
>> }
>>
>> +extern long __do_ftruncate(struct file *file, loff_t length, int small);
>> +
>> extern long do_sys_ftruncate(unsigned int fd, loff_t length, int small);
>>
>> static inline long ksys_ftruncate(unsigned int fd, loff_t length)
>
> This should go in fs/internal.h, it's not a syscall related thing.

And while at it, let's call it ftruncate_file() as that more accurately
describes what it does.

--
Jens Axboe