diff options
author | Anton Kling <anton@kling.gg> | 2023-10-24 14:10:07 +0200 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2023-10-24 14:10:07 +0200 |
commit | 2292b11e82a3d6d70e7bb932c512155dc13c5025 (patch) | |
tree | da7d90e778495bc9a67ee0e09b32813c11dc6fe5 /fs/vfs.h | |
parent | e93a49d1eadf4a4b36369e67f112f8c45a0d567e (diff) |
VFS/LibC: Create ftruncate function and corresponding syscall and libc implementation
Previously this function was only used for shared memory region created
by shm_open because I was lazy. Now exists for all files.
Diffstat (limited to 'fs/vfs.h')
-rw-r--r-- | fs/vfs.h | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -68,6 +68,7 @@ struct vfs_inode { int (*create_directory)(const char *path, int mode); vfs_vm_object_t *(*get_vm_object)(uint64_t length, uint64_t offset, vfs_fd_t *fd); + int (*truncate)(vfs_fd_t *fd, size_t length); }; int vfs_close(int fd); @@ -83,6 +84,7 @@ int vfs_dup2(int org_fd, int new_fd); vfs_inode_t *vfs_internal_open(const char *file); int vfs_mkdir(const char *path, int mode); int vfs_create_fd(int flags, int mode, vfs_inode_t *inode, vfs_fd_t **fd); +int vfs_ftruncate(int fd, size_t length); vfs_inode_t *vfs_create_inode( int inode_num, int type, uint8_t has_data, uint8_t can_write, uint8_t is_open, void *internal_object, uint64_t file_size, @@ -93,5 +95,6 @@ vfs_inode_t *vfs_create_inode( void (*close)(vfs_fd_t *fd), int (*create_directory)(const char *path, int mode), vfs_vm_object_t *(*get_vm_object)(uint64_t length, uint64_t offset, - vfs_fd_t *fd)); + vfs_fd_t *fd), + int (*truncate)(vfs_fd_t *fd, size_t length)); #endif |