Kernel: Start work on making inodes more thread safe

All inode operations are now locked and thread blocked
This commit is contained in:
Bananymous
2023-09-09 22:45:27 +03:00
parent 39a5c52088
commit dd9af56e21
23 changed files with 229 additions and 105 deletions

View File

@@ -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;

View File

@@ -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);