mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
Kernel: Add Inode::truncate(size).
- Use this to implement the O_TRUNC open flag. - Fix creat() to pass O_CREAT | O_TRUNC | O_WRONLY. - Make sure we truncate wherever appropriate.
This commit is contained in:
parent
e9f2cc3595
commit
0058da734e
Notes:
sideshowbarker
2024-07-19 14:55:24 +09:00
Author: https://github.com/awesomekling
Commit: 0058da734e
8 changed files with 26 additions and 8 deletions
|
@ -1391,6 +1391,16 @@ KResult Ext2FSInode::chown(uid_t uid, gid_t gid)
|
|||
return KSuccess;
|
||||
}
|
||||
|
||||
KResult Ext2FSInode::truncate(int size)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
if (m_raw_inode.i_size == size)
|
||||
return KSuccess;
|
||||
m_raw_inode.i_size = size;
|
||||
set_metadata_dirty(true);
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
unsigned Ext2FS::total_block_count() const
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue