Kernel: Remove unused functions related to reading full inodes

This commit is contained in:
Tim Schumacher 2023-04-16 20:42:16 +02:00 committed by Linus Groh
parent f5010f7263
commit d4e114a31e
4 changed files with 0 additions and 36 deletions

View file

@ -51,30 +51,6 @@ void Inode::sync()
fs().flush_writes();
}
ErrorOr<NonnullOwnPtr<KBuffer>> Inode::read_entire(OpenFileDescription* description) const
{
auto builder = TRY(KBufferBuilder::try_create());
u8 buffer[4096];
off_t offset = 0;
for (;;) {
auto buf = UserOrKernelBuffer::for_kernel_buffer(buffer);
auto nread = TRY(read_bytes(offset, sizeof(buffer), buf, description));
VERIFY(nread <= sizeof(buffer));
if (nread == 0)
break;
TRY(builder.append((char const*)buffer, nread));
offset += nread;
if (nread < sizeof(buffer))
break;
}
auto entire_file = builder.build();
if (!entire_file)
return ENOMEM;
return entire_file.release_nonnull();
}
ErrorOr<NonnullRefPtr<Custody>> Inode::resolve_as_link(Credentials const& credentials, Custody& base, RefPtr<Custody>* out_parent, int options, int symlink_recursion_level) const
{
// The default implementation simply treats the stored

View file

@ -53,8 +53,6 @@ public:
InodeIdentifier identifier() const { return { fsid(), index() }; }
virtual InodeMetadata metadata() const = 0;
ErrorOr<NonnullOwnPtr<KBuffer>> read_entire(OpenFileDescription* = nullptr) const;
ErrorOr<size_t> write_bytes(off_t, size_t, UserOrKernelBuffer const& data, OpenFileDescription*);
ErrorOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer& buffer, OpenFileDescription*) const;
ErrorOr<size_t> read_until_filled_or_end(off_t, size_t, UserOrKernelBuffer buffer, OpenFileDescription*) const;

View file

@ -202,14 +202,6 @@ bool OpenFileDescription::can_read() const
return m_file->can_read(*this, offset());
}
ErrorOr<NonnullOwnPtr<KBuffer>> OpenFileDescription::read_entire_file()
{
// HACK ALERT: (This entire function)
VERIFY(m_file->is_inode());
VERIFY(m_inode);
return m_inode->read_entire(this);
}
ErrorOr<size_t> OpenFileDescription::get_dir_entries(UserOrKernelBuffer& output_buffer, size_t size)
{
if (!is_directory())

View file

@ -58,8 +58,6 @@ public:
ErrorOr<size_t> get_dir_entries(UserOrKernelBuffer& buffer, size_t);
ErrorOr<NonnullOwnPtr<KBuffer>> read_entire_file();
ErrorOr<NonnullOwnPtr<KString>> original_absolute_path() const;
ErrorOr<NonnullOwnPtr<KString>> pseudo_path() const;