Add do_ftruncate that truncates a struct file
authorTony Solomonik <tony.solomonik@gmail.com>
Fri, 2 Feb 2024 12:17:23 +0000 (14:17 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 9 Feb 2024 15:57:56 +0000 (08:57 -0700)
commit5f0d594c602f870e3a3872f7ea42bf846a1d26cf
tree5efd86c12d353c1d26b30944ce7fbc2768ecf169
parenta6e959bd3d6bfe8a3daeeacb714a299b9094a6cb
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>
fs/internal.h
fs/open.c