summaryrefslogtreecommitdiff
path: root/VirtualFileSystem/SyntheticFileSystem.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-01-23 04:29:56 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-01-23 04:29:56 +0100
commit906685e238f113c94c32e46b55a07e71ef904ba5 (patch)
tree717e6550ddd782c8b301f35fc489fbcf9f3a3d7a /VirtualFileSystem/SyntheticFileSystem.cpp
parent29dfb4ae13f27f0c1af114103f15ad5d29aa4882 (diff)
downloadserenity-906685e238f113c94c32e46b55a07e71ef904ba5.zip
Ext2FS: Implement writing into inodes with arbitrary offset and length.
Okay, this is pretty cool. :^) There are some issues and limitations for sure but the basic functionality is there.
Diffstat (limited to 'VirtualFileSystem/SyntheticFileSystem.cpp')
-rw-r--r--VirtualFileSystem/SyntheticFileSystem.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/VirtualFileSystem/SyntheticFileSystem.cpp b/VirtualFileSystem/SyntheticFileSystem.cpp
index eec8f6ec24..95558236c9 100644
--- a/VirtualFileSystem/SyntheticFileSystem.cpp
+++ b/VirtualFileSystem/SyntheticFileSystem.cpp
@@ -280,6 +280,17 @@ bool SynthFSInode::write(const ByteBuffer& data)
return m_write_callback(*this, data);
}
+ssize_t SynthFSInode::write_bytes(Unix::off_t offset, size_t size, const byte* buffer, FileDescriptor*)
+{
+ if (!m_write_callback)
+ return -EPERM;
+ // FIXME: Being able to write into SynthFS at a non-zero offset seems like something we should support..
+ ASSERT(offset == 0);
+ bool success = m_write_callback(*this, ByteBuffer::wrap((byte*)buffer, size));
+ ASSERT(success);
+ return 0;
+}
+
bool SynthFSInode::add_child(InodeIdentifier child_id, const String& name, byte file_type, int& error)
{
(void) child_id;