mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
Kernel: Fix handful of remaining "return -EFOO" mistakes
Now that all KResult and KResultOr are used consistently throughout the kernel, it's no longer necessary to return negative error codes. However, we were still doing that in some places, so let's fix all those (bugs) by removing the minuses. :^)
This commit is contained in:
parent
3377cc74df
commit
ad3ae7e0e8
Notes:
sideshowbarker
2024-07-18 07:25:37 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/ad3ae7e0e85
8 changed files with 10 additions and 10 deletions
|
@ -35,8 +35,8 @@ protected:
|
|||
virtual bool can_read(const FileDescription&, size_t) const override final { return true; }
|
||||
virtual bool can_write(const FileDescription&, size_t) const override final { return true; }
|
||||
virtual void start_request(AsyncBlockDeviceRequest& request) override final { request.complete(AsyncDeviceRequest::Failure); }
|
||||
virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override { return -EINVAL; }
|
||||
virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return -EINVAL; }
|
||||
virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override { return EINVAL; }
|
||||
virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return EINVAL; }
|
||||
virtual KResult ioctl(FileDescription&, unsigned request, Userspace<void*> arg) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -32,7 +32,7 @@ private:
|
|||
virtual bool can_write(const FileDescription&, size_t) const override { return false; }
|
||||
virtual bool is_seekable() const override { return true; }
|
||||
virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||
virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return -EINVAL; }
|
||||
virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return EINVAL; }
|
||||
|
||||
virtual void did_seek(FileDescription&, off_t) override;
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ KResultOr<size_t> FileDescription::get_dir_entries(UserOrKernelBuffer& output_bu
|
|||
flush_stream_to_output_buffer();
|
||||
|
||||
if (result.is_error()) {
|
||||
// We should only return -EFAULT when the userspace buffer is too small,
|
||||
// We should only return EFAULT when the userspace buffer is too small,
|
||||
// so that userspace can reliably use it as a signal to increase its
|
||||
// buffer size.
|
||||
VERIFY(result != -EFAULT);
|
||||
|
|
|
@ -618,7 +618,7 @@ KResult Plan9FS::post_message_and_wait_for_a_reply(Message& message)
|
|||
return KResult((ErrnoCode)error_code);
|
||||
} else if (reply_type == Message::Type::Rerror) {
|
||||
// Contains an error message. We could attempt to parse it, but for now
|
||||
// we simply return -EIO instead. In 9P200.u, it can also contain a
|
||||
// we simply return EIO instead. In 9P200.u, it can also contain a
|
||||
// numerical errno in an unspecified encoding; we ignore those too.
|
||||
StringView error_name;
|
||||
message >> error_name;
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
virtual KResultOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, FileDescription*) const { VERIFY_NOT_REACHED(); }
|
||||
virtual KResult traverse_as_directory(unsigned, Function<bool(FileSystem::DirectoryEntryView const&)>) const { VERIFY_NOT_REACHED(); }
|
||||
virtual RefPtr<SysFSComponent> lookup(StringView) { VERIFY_NOT_REACHED(); };
|
||||
virtual KResultOr<size_t> write_bytes(off_t, size_t, UserOrKernelBuffer const&, FileDescription*) { return -EROFS; }
|
||||
virtual KResultOr<size_t> write_bytes(off_t, size_t, UserOrKernelBuffer const&, FileDescription*) { return EROFS; }
|
||||
virtual size_t size() const { return 0; }
|
||||
|
||||
virtual NonnullRefPtr<Inode> to_inode(SysFS const&) const;
|
||||
|
|
|
@ -43,8 +43,8 @@ private:
|
|||
virtual bool can_read(const FileDescription&, size_t) const override final { return true; }
|
||||
virtual bool can_write(const FileDescription&, size_t) const override final { return true; }
|
||||
virtual void start_request(AsyncBlockDeviceRequest& request) override final { request.complete(AsyncDeviceRequest::Failure); }
|
||||
virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override { return -EINVAL; }
|
||||
virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return -EINVAL; }
|
||||
virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override { return EINVAL; }
|
||||
virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return EINVAL; }
|
||||
|
||||
FramebufferDevice(const GraphicsDevice&, size_t, PhysicalAddress, size_t, size_t, size_t);
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ KResultOr<size_t> IPv4Socket::receive_packet_buffered(FileDescription& descripti
|
|||
ReceivedPacket packet;
|
||||
{
|
||||
if (m_receive_queue.is_empty()) {
|
||||
// FIXME: Shouldn't this return -ENOTCONN instead of EOF?
|
||||
// FIXME: Shouldn't this return ENOTCONN instead of EOF?
|
||||
// But if so, we still need to deliver at least one EOF read to userspace.. right?
|
||||
if (protocol_is_disconnected())
|
||||
return 0;
|
||||
|
|
|
@ -465,7 +465,7 @@ KResult TTY::ioctl(FileDescription&, unsigned request, Userspace<void*> arg)
|
|||
// FIXME: When should we block things?
|
||||
// How do we make this work together with MasterPTY forwarding to us?
|
||||
if (current_process.tty() && current_process.tty() != this) {
|
||||
return -ENOTTY;
|
||||
return ENOTTY;
|
||||
}
|
||||
#endif
|
||||
switch (request) {
|
||||
|
|
Loading…
Reference in a new issue