summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/FileBackedFileSystem.cpp
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2020-04-06 16:50:24 +0300
committerAndreas Kling <kling@serenityos.org>2020-04-06 17:18:36 +0200
commit65dd9d5ad3024d843c47073175546a509e12b336 (patch)
tree1b37254cead326e73e8d912bb9f5f1650b5acc6c /Kernel/FileSystem/FileBackedFileSystem.cpp
parent061badeaeae4d28dc5f07cf9f6be6fcfa6af6494 (diff)
downloadserenity-65dd9d5ad3024d843c47073175546a509e12b336.zip
Kernel: Ensure we flush the entire ext2 superblock
Diffstat (limited to 'Kernel/FileSystem/FileBackedFileSystem.cpp')
-rw-r--r--Kernel/FileSystem/FileBackedFileSystem.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/Kernel/FileSystem/FileBackedFileSystem.cpp b/Kernel/FileSystem/FileBackedFileSystem.cpp
index a3d30b90c9..3ee5c09a51 100644
--- a/Kernel/FileSystem/FileBackedFileSystem.cpp
+++ b/Kernel/FileSystem/FileBackedFileSystem.cpp
@@ -168,6 +168,25 @@ bool FileBackedFS::raw_write(unsigned index, const u8* buffer)
return true;
}
+bool FileBackedFS::raw_read_blocks(unsigned index, size_t count, u8* buffer)
+{
+ for (unsigned block = index; block < (index + count); block++) {
+ if (!raw_read(block, buffer))
+ return false;
+ buffer += logical_block_size();
+ }
+ return true;
+}
+bool FileBackedFS::raw_write_blocks(unsigned index, size_t count, const u8* buffer)
+{
+ for (unsigned block = index; block < (index + count); block++) {
+ if (!raw_write(block, buffer))
+ return false;
+ buffer += logical_block_size();
+ }
+ return true;
+}
+
bool FileBackedFS::write_blocks(unsigned index, unsigned count, const u8* data, FileDescription* description)
{
ASSERT(m_logical_block_size);