forked from Bananymous/banan-os
Kernel: Start work on making inodes more thread safe
All inode operations are now locked and thread blocked
This commit is contained in:
@@ -72,11 +72,12 @@ namespace Kernel
|
||||
return {};
|
||||
}
|
||||
|
||||
BAN::ErrorOr<size_t> ATADevice::read(size_t offset, void* buffer, size_t bytes)
|
||||
BAN::ErrorOr<size_t> ATADevice::read_impl(off_t offset, void* buffer, size_t bytes)
|
||||
{
|
||||
ASSERT(offset >= 0);
|
||||
if (offset % sector_size() || bytes % sector_size())
|
||||
return BAN::Error::from_errno(EINVAL);
|
||||
if (offset == total_size())
|
||||
if ((size_t)offset == total_size())
|
||||
return 0;
|
||||
TRY(read_sectors(offset / sector_size(), bytes / sector_size(), (uint8_t*)buffer));
|
||||
return bytes;
|
||||
|
||||
@@ -231,8 +231,10 @@ namespace Kernel
|
||||
return {};
|
||||
}
|
||||
|
||||
BAN::ErrorOr<size_t> Partition::read(size_t offset, void* buffer, size_t bytes)
|
||||
BAN::ErrorOr<size_t> Partition::read_impl(off_t offset, void* buffer, size_t bytes)
|
||||
{
|
||||
ASSERT(offset >= 0);
|
||||
|
||||
if (offset % m_device.sector_size() || bytes % m_device.sector_size())
|
||||
return BAN::Error::from_errno(ENOTSUP);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user