Compare commits

..

No commits in common. "51f0bdff0e8c4f74cd91c4c5fc4e14f9cd95fc73" and "cd00e41f5934d97f1f58b0aeb761394a7903a327" have entirely different histories.

11 changed files with 1 additions and 46 deletions

View File

@ -32,8 +32,6 @@ namespace VFS
virtual Result<void> truncate(usize size) = 0; virtual Result<void> truncate(usize size) = 0;
virtual bool blocking() const = 0;
// Metadata accessors // Metadata accessors
virtual usize size() = 0; virtual usize size() = 0;
@ -75,11 +73,6 @@ namespace VFS
return err(ENOTDIR); return err(ENOTDIR);
} }
bool blocking() const override
{
return false;
}
InodeType type() const override InodeType type() const override
{ {
return InodeType::RegularFile; return InodeType::RegularFile;

View File

@ -17,8 +17,3 @@ Result<usize> ConsoleDevice::write(const u8* buf, usize, usize length)
TextConsole::write((const char*)buf, length); TextConsole::write((const char*)buf, length);
return length; return length;
} }
bool ConsoleDevice::blocking() const
{
return false;
}

View File

@ -11,7 +11,5 @@ class ConsoleDevice : public Device
Result<usize> write(const u8*, usize, usize) override; Result<usize> write(const u8*, usize, usize) override;
bool blocking() const override;
virtual ~ConsoleDevice() = default; virtual ~ConsoleDevice() = default;
}; };

View File

@ -8,7 +8,5 @@ class Device
virtual Result<usize> write(const u8* buf, usize offset, usize length) = 0; virtual Result<usize> write(const u8* buf, usize offset, usize length) = 0;
virtual bool blocking() const = 0;
virtual ~Device() = default; virtual ~Device() = default;
}; };

View File

@ -17,10 +17,5 @@ class NullDevice : public Device
return 0; return 0;
} }
bool blocking() const override
{
return false;
}
virtual ~NullDevice() = default; virtual ~NullDevice() = default;
}; };

View File

@ -134,11 +134,6 @@ namespace TmpFS
return err(EINVAL); return err(EINVAL);
} }
bool blocking() const override
{
return m_device->blocking();
}
usize size() override usize size() override
{ {
return 0; return 0;
@ -201,11 +196,6 @@ namespace TmpFS
return err(EISDIR); return err(EISDIR);
} }
bool blocking() const override
{
return false;
}
usize size() override usize size() override
{ {
return 0; return 0;

View File

@ -21,13 +21,6 @@ Result<u64> sys_read(Registers*, SyscallArgs args)
if (!descriptor.is_readable()) return err(EBADF); 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)); usize nread = TRY(descriptor.inode->read(buf, descriptor.offset, size));
descriptor.offset += nread; descriptor.offset += nread;

View File

@ -7,7 +7,7 @@
#include <bits/open-flags.h> #include <bits/open-flags.h>
// These flags are needed after open(), the rest only affect open(). // 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) Result<u64> sys_open(Registers*, SyscallArgs args)
{ {

View File

@ -50,11 +50,6 @@ bool FileDescriptor::should_append()
return flags & O_APPEND; return flags & O_APPEND;
} }
bool FileDescriptor::should_block()
{
return flags & O_NONBLOCK;
}
bool FileDescriptor::is_readable() bool FileDescriptor::is_readable()
{ {
return flags & O_RDONLY; return flags & O_RDONLY;

View File

@ -29,7 +29,6 @@ struct FileDescriptor
int flags { 0 }; int flags { 0 };
bool should_append(); bool should_append();
bool should_block();
bool is_writable(); bool is_writable();
bool is_readable(); bool is_readable();
}; };

View File

@ -10,6 +10,5 @@
#define O_CREAT 8 #define O_CREAT 8
#define O_EXCL 16 #define O_EXCL 16
#define O_TRUNC 32 #define O_TRUNC 32
#define O_NONBLOCK 64
#endif #endif