Compare commits
No commits in common. "51f0bdff0e8c4f74cd91c4c5fc4e14f9cd95fc73" and "cd00e41f5934d97f1f58b0aeb761394a7903a327" have entirely different histories.
51f0bdff0e
...
cd00e41f59
@ -32,8 +32,6 @@ namespace VFS
|
||||
|
||||
virtual Result<void> truncate(usize size) = 0;
|
||||
|
||||
virtual bool blocking() const = 0;
|
||||
|
||||
// Metadata accessors
|
||||
virtual usize size() = 0;
|
||||
|
||||
@ -75,11 +73,6 @@ namespace VFS
|
||||
return err(ENOTDIR);
|
||||
}
|
||||
|
||||
bool blocking() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
InodeType type() const override
|
||||
{
|
||||
return InodeType::RegularFile;
|
||||
|
@ -17,8 +17,3 @@ Result<usize> ConsoleDevice::write(const u8* buf, usize, usize length)
|
||||
TextConsole::write((const char*)buf, length);
|
||||
return length;
|
||||
}
|
||||
|
||||
bool ConsoleDevice::blocking() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -11,7 +11,5 @@ class ConsoleDevice : public Device
|
||||
|
||||
Result<usize> write(const u8*, usize, usize) override;
|
||||
|
||||
bool blocking() const override;
|
||||
|
||||
virtual ~ConsoleDevice() = default;
|
||||
};
|
||||
|
@ -8,7 +8,5 @@ class Device
|
||||
|
||||
virtual Result<usize> write(const u8* buf, usize offset, usize length) = 0;
|
||||
|
||||
virtual bool blocking() const = 0;
|
||||
|
||||
virtual ~Device() = default;
|
||||
};
|
||||
|
@ -17,10 +17,5 @@ class NullDevice : public Device
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool blocking() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual ~NullDevice() = default;
|
||||
};
|
||||
|
@ -134,11 +134,6 @@ namespace TmpFS
|
||||
return err(EINVAL);
|
||||
}
|
||||
|
||||
bool blocking() const override
|
||||
{
|
||||
return m_device->blocking();
|
||||
}
|
||||
|
||||
usize size() override
|
||||
{
|
||||
return 0;
|
||||
@ -201,11 +196,6 @@ namespace TmpFS
|
||||
return err(EISDIR);
|
||||
}
|
||||
|
||||
bool blocking() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
usize size() override
|
||||
{
|
||||
return 0;
|
||||
|
@ -21,13 +21,6 @@ Result<u64> sys_read(Registers*, SyscallArgs args)
|
||||
|
||||
if (!descriptor.is_readable()) return err(EBADF);
|
||||
|
||||
while (descriptor.inode->blocking())
|
||||
{
|
||||
if (descriptor.should_block()) kernel_sleep(10);
|
||||
else
|
||||
return err(EAGAIN);
|
||||
}
|
||||
|
||||
usize nread = TRY(descriptor.inode->read(buf, descriptor.offset, size));
|
||||
|
||||
descriptor.offset += nread;
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <bits/open-flags.h>
|
||||
|
||||
// These flags are needed after open(), the rest only affect open().
|
||||
constexpr int FLAGS_TO_KEEP = O_RDWR | O_APPEND | O_NONBLOCK;
|
||||
constexpr int FLAGS_TO_KEEP = O_RDWR | O_APPEND;
|
||||
|
||||
Result<u64> sys_open(Registers*, SyscallArgs args)
|
||||
{
|
||||
|
@ -50,11 +50,6 @@ bool FileDescriptor::should_append()
|
||||
return flags & O_APPEND;
|
||||
}
|
||||
|
||||
bool FileDescriptor::should_block()
|
||||
{
|
||||
return flags & O_NONBLOCK;
|
||||
}
|
||||
|
||||
bool FileDescriptor::is_readable()
|
||||
{
|
||||
return flags & O_RDONLY;
|
||||
|
@ -29,7 +29,6 @@ struct FileDescriptor
|
||||
int flags { 0 };
|
||||
|
||||
bool should_append();
|
||||
bool should_block();
|
||||
bool is_writable();
|
||||
bool is_readable();
|
||||
};
|
||||
|
@ -10,6 +10,5 @@
|
||||
#define O_CREAT 8
|
||||
#define O_EXCL 16
|
||||
#define O_TRUNC 32
|
||||
#define O_NONBLOCK 64
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user