1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 11:45:06 +00:00

Kernel: Change Ext2FS to be backed by a file instead of a block device

In contrast to the previous patchset that was reverted, this time we use
a "special" method to access a file with block size of 512 bytes (like
a harddrive essentially).
This commit is contained in:
Liav A 2020-04-06 11:54:21 +03:00 committed by Andreas Kling
parent 1d6c8724b9
commit ecee76b741
10 changed files with 104 additions and 77 deletions

View file

@ -98,13 +98,6 @@ off_t FileDescription::seek(off_t offset, int whence)
if (!m_file->is_seekable())
return -EINVAL;
auto metadata = this->metadata();
if (!metadata.is_valid())
return -EIO;
if (metadata.is_socket() || metadata.is_fifo())
return -ESPIPE;
off_t new_offset;
switch (whence) {
@ -115,7 +108,9 @@ off_t FileDescription::seek(off_t offset, int whence)
new_offset = m_current_offset + offset;
break;
case SEEK_END:
new_offset = metadata.size;
if (!metadata().is_valid())
return -EIO;
new_offset = metadata().size;
break;
default:
return -EINVAL;