mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 13:25:08 +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:
parent
38bf7863d0
commit
fcc0e4d538
6 changed files with 12 additions and 11 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue