diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-10-16 14:11:58 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-10-16 14:13:32 +0200 |
commit | 8293a0ff36859aafb2b95835a6c2651659fa3ab9 (patch) | |
tree | a21c855ecc134e0c33b2b683089a072e2cfb962b /VirtualFileSystem/FileBackedDiskDevice.cpp | |
parent | cafb5b2ad6b09cf3317e5f8e9c470aaaa26c20b1 (diff) | |
download | serenity-8293a0ff36859aafb2b95835a6c2651659fa3ab9.zip |
Rework DiskDevice's read() and write() to be non-virtual wrappers.
This way subclasses only have to implement readBlock() and writeBlock().
read() and write() require that the offset and length are both divisible
by the blockSize().
Diffstat (limited to 'VirtualFileSystem/FileBackedDiskDevice.cpp')
-rw-r--r-- | VirtualFileSystem/FileBackedDiskDevice.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/VirtualFileSystem/FileBackedDiskDevice.cpp b/VirtualFileSystem/FileBackedDiskDevice.cpp index d857ff502e..854b932900 100644 --- a/VirtualFileSystem/FileBackedDiskDevice.cpp +++ b/VirtualFileSystem/FileBackedDiskDevice.cpp @@ -35,16 +35,16 @@ unsigned FileBackedDiskDevice::blockSize() const bool FileBackedDiskDevice::readBlock(unsigned index, byte* out) const { qword offset = index * m_blockSize; - return read(offset, blockSize(), out); + return readInternal(offset, blockSize(), out); } bool FileBackedDiskDevice::writeBlock(unsigned index, const byte* data) { qword offset = index * m_blockSize; - return write(offset, blockSize(), data); + return writeInternal(offset, blockSize(), data); } -bool FileBackedDiskDevice::read(qword offset, unsigned length, byte* out) const +bool FileBackedDiskDevice::readInternal(qword offset, unsigned length, byte* out) const { #ifndef IGNORE_FILE_LENGTH if (offset + length >= m_fileLength) @@ -59,7 +59,7 @@ bool FileBackedDiskDevice::read(qword offset, unsigned length, byte* out) const return true; } -bool FileBackedDiskDevice::write(qword offset, unsigned length, const byte* data) +bool FileBackedDiskDevice::writeInternal(qword offset, unsigned length, const byte* data) { #ifndef IGNORE_FILE_LENGTH if (offset + length >= m_fileLength) |