summaryrefslogtreecommitdiff
path: root/VirtualFileSystem/SyntheticFileSystem.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-12-21 17:28:16 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-12-21 17:28:16 +0100
commit8a713038274208eadfcc14df9a8d78e94757551b (patch)
treec457d1457fe4bcfed27ac633a607c77c950e16c9 /VirtualFileSystem/SyntheticFileSystem.cpp
parent951ed6692bfda00735e6d2e98c7ca34def02c47d (diff)
downloadserenity-8a713038274208eadfcc14df9a8d78e94757551b.zip
Get rid of FS::read_inode_bytes() and use Inode::read_bytes() everywhere.
Diffstat (limited to 'VirtualFileSystem/SyntheticFileSystem.cpp')
-rw-r--r--VirtualFileSystem/SyntheticFileSystem.cpp37
1 files changed, 0 insertions, 37 deletions
diff --git a/VirtualFileSystem/SyntheticFileSystem.cpp b/VirtualFileSystem/SyntheticFileSystem.cpp
index e4dde9e205..bc427d9926 100644
--- a/VirtualFileSystem/SyntheticFileSystem.cpp
+++ b/VirtualFileSystem/SyntheticFileSystem.cpp
@@ -163,43 +163,6 @@ bool SynthFS::write_inode(InodeIdentifier, const ByteBuffer&)
return false;
}
-ssize_t SynthFS::read_inode_bytes(InodeIdentifier inode, Unix::off_t offset, size_t count, byte* buffer, FileDescriptor* handle) const
-{
- ASSERT(inode.fsid() == id());
-#ifdef SYNTHFS_DEBUG
- kprintf("SynthFS: readInode %u\n", inode.index());
-#endif
- ASSERT(offset >= 0);
- ASSERT(buffer);
-
- const SynthFSInode* found_file;
- {
- InterruptDisabler disabler;
- auto it = m_inodes.find(inode.index());
- if (it == m_inodes.end())
- return false;
- found_file = (*it).value.ptr();
- }
- const SynthFSInode& file = *found_file;
- ByteBuffer generatedData;
- if (file.m_generator) {
- if (!handle) {
- generatedData = file.m_generator();
- } else {
- if (!handle->generator_cache())
- handle->generator_cache() = file.m_generator();
- generatedData = handle->generator_cache();
- }
- }
-
- auto* data = generatedData ? &generatedData : &file.m_data;
- ssize_t nread = min(static_cast<Unix::off_t>(data->size() - offset), static_cast<Unix::off_t>(count));
- memcpy(buffer, data->pointer() + offset, nread);
- if (nread == 0 && handle && handle->generator_cache())
- handle->generator_cache().clear();
- return nread;
-}
-
InodeIdentifier SynthFS::create_directory(InodeIdentifier, const String&, Unix::mode_t, int& error)
{
error = -EROFS;