diff options
author | Tim Schumacher <timschumi@gmx.de> | 2023-04-16 20:42:16 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-04-17 01:20:23 +0200 |
commit | d4e114a31e322d96a62f2184f7180f79956bb2bf (patch) | |
tree | eca8d416ad8b896b0b994779e05e4bc916a92edf /Kernel/FileSystem | |
parent | f5010f7263cace61ac04faccc8e3e6b44d498b1e (diff) | |
download | serenity-d4e114a31e322d96a62f2184f7180f79956bb2bf.zip |
Kernel: Remove unused functions related to reading full inodes
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r-- | Kernel/FileSystem/Inode.cpp | 24 | ||||
-rw-r--r-- | Kernel/FileSystem/Inode.h | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/OpenFileDescription.cpp | 8 | ||||
-rw-r--r-- | Kernel/FileSystem/OpenFileDescription.h | 2 |
4 files changed, 0 insertions, 36 deletions
diff --git a/Kernel/FileSystem/Inode.cpp b/Kernel/FileSystem/Inode.cpp index e2467679e8..aab18cf1c3 100644 --- a/Kernel/FileSystem/Inode.cpp +++ b/Kernel/FileSystem/Inode.cpp @@ -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 diff --git a/Kernel/FileSystem/Inode.h b/Kernel/FileSystem/Inode.h index c7fba48caa..938bf86737 100644 --- a/Kernel/FileSystem/Inode.h +++ b/Kernel/FileSystem/Inode.h @@ -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; diff --git a/Kernel/FileSystem/OpenFileDescription.cpp b/Kernel/FileSystem/OpenFileDescription.cpp index c4828c8f5d..9be04714da 100644 --- a/Kernel/FileSystem/OpenFileDescription.cpp +++ b/Kernel/FileSystem/OpenFileDescription.cpp @@ -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()) diff --git a/Kernel/FileSystem/OpenFileDescription.h b/Kernel/FileSystem/OpenFileDescription.h index ca857c9525..5fd82abf92 100644 --- a/Kernel/FileSystem/OpenFileDescription.h +++ b/Kernel/FileSystem/OpenFileDescription.h @@ -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; |