diff options
author | Tony Solomonik <tony.solomonik@gmail.com> | 2024-02-02 14:17:23 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-02-09 08:57:56 -0700 |
commit | 5f0d594c602f870e3a3872f7ea42bf846a1d26cf (patch) | |
tree | 5efd86c12d353c1d26b30944ce7fbc2768ecf169 /fs/internal.h | |
parent | a6e959bd3d6bfe8a3daeeacb714a299b9094a6cb (diff) |
Add do_ftruncate that truncates a struct file
do_sys_ftruncate receives a file descriptor, fgets the struct file, and
finally actually truncates the file.
do_ftruncate allows for passing in a file directly, with the caller
already holding a reference to it.
Signed-off-by: Tony Solomonik <tony.solomonik@gmail.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Link: https://lore.kernel.org/r/20240202121724.17461-2-tony.solomonik@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/internal.h')
-rw-r--r-- | fs/internal.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/internal.h b/fs/internal.h index b67406435fc0..8509cbd6d115 100644 --- a/fs/internal.h +++ b/fs/internal.h @@ -183,6 +183,7 @@ extern struct open_how build_open_how(int flags, umode_t mode); extern int build_open_flags(const struct open_how *how, struct open_flags *op); struct file *file_close_fd_locked(struct files_struct *files, unsigned fd); +long do_ftruncate(struct file *file, loff_t length, int small); long do_sys_ftruncate(unsigned int fd, loff_t length, int small); int chmod_common(const struct path *path, umode_t mode); int do_fchownat(int dfd, const char __user *filename, uid_t user, gid_t group, |