mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
Kernel/FileSystem: Funnel calls to Inode::prepare_to_write_data method
Instead of requiring each FileSystem implementation to call this method when trying to write data, do the calls at 2 points to avoid further calls (or lack of them due to not remembering to use it) at other files and locations in the codebase.
This commit is contained in:
@@ -108,12 +108,10 @@ ErrorOr<size_t> TmpFSInode::read_bytes(off_t offset, size_t size, UserOrKernelBu
|
||||
|
||||
ErrorOr<size_t> TmpFSInode::write_bytes(off_t offset, size_t size, UserOrKernelBuffer const& buffer, OpenFileDescription*)
|
||||
{
|
||||
MutexLocker locker(m_inode_lock);
|
||||
VERIFY(m_inode_lock.is_locked());
|
||||
VERIFY(!is_directory());
|
||||
VERIFY(offset >= 0);
|
||||
|
||||
TRY(prepare_to_write_data());
|
||||
|
||||
off_t old_size = m_metadata.size;
|
||||
off_t new_size = m_metadata.size;
|
||||
if (static_cast<off_t>(offset + size) > new_size)
|
||||
|
||||
Reference in New Issue
Block a user