Compare commits
21 Commits
8939edf313
...
176864f623
Author | SHA1 | Date | |
---|---|---|---|
176864f623 | |||
1e586ee982 | |||
35c96024d4 | |||
9653497051 | |||
39a713333d | |||
52cbcb627f | |||
d55edf77cd | |||
e60b8cfdf0 | |||
0483f38038 | |||
1722b995c9 | |||
5afe1ec3a6 | |||
2c239f7d19 | |||
6fb25e2499 | |||
2ab3860d04 | |||
a35c8d74fb | |||
9422b8c878 | |||
1c4a26a381 | |||
01489a12d9 | |||
5eaacd7b29 | |||
249453ac3f | |||
260c86e22c |
@ -296,11 +296,6 @@ class ATADevice : public Device
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_block_device() const override
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
usize size() const override
|
usize size() const override
|
||||||
{
|
{
|
||||||
return m_drive->capacity();
|
return m_drive->capacity();
|
||||||
|
@ -286,7 +286,7 @@ namespace VFS
|
|||||||
bool is_setuid(SharedPtr<Inode> inode);
|
bool is_setuid(SharedPtr<Inode> inode);
|
||||||
bool is_setgid(SharedPtr<Inode> inode);
|
bool is_setgid(SharedPtr<Inode> inode);
|
||||||
|
|
||||||
bool is_seekable(SharedPtr<Inode> inode);
|
bool is_seekable(VFS::InodeType type);
|
||||||
|
|
||||||
Inode& root_inode();
|
Inode& root_inode();
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ Result<u64> sys_read(Registers*, SyscallArgs args)
|
|||||||
|
|
||||||
usize nread = TRY(descriptor.inode->read(buf, descriptor.offset, size));
|
usize nread = TRY(descriptor.inode->read(buf, descriptor.offset, size));
|
||||||
|
|
||||||
if (VFS::is_seekable(descriptor.inode)) descriptor.offset += nread;
|
if (VFS::is_seekable(descriptor.inode->type())) descriptor.offset += nread;
|
||||||
|
|
||||||
return nread;
|
return nread;
|
||||||
}
|
}
|
||||||
@ -52,11 +52,12 @@ Result<u64> sys_write(Registers*, SyscallArgs args)
|
|||||||
|
|
||||||
if (!descriptor.is_writable()) return err(EBADF);
|
if (!descriptor.is_writable()) return err(EBADF);
|
||||||
|
|
||||||
if (descriptor.should_append() && VFS::is_seekable(descriptor.inode)) descriptor.offset = descriptor.inode->size();
|
if (descriptor.should_append() && VFS::is_seekable(descriptor.inode->type()))
|
||||||
|
descriptor.offset = descriptor.inode->size();
|
||||||
|
|
||||||
usize nwritten = TRY(descriptor.inode->write(buf, descriptor.offset, size));
|
usize nwritten = TRY(descriptor.inode->write(buf, descriptor.offset, size));
|
||||||
|
|
||||||
if (VFS::is_seekable(descriptor.inode)) descriptor.offset += nwritten;
|
if (VFS::is_seekable(descriptor.inode->type())) descriptor.offset += nwritten;
|
||||||
|
|
||||||
return nwritten;
|
return nwritten;
|
||||||
}
|
}
|
||||||
@ -73,7 +74,7 @@ Result<u64> sys_lseek(Registers*, SyscallArgs args)
|
|||||||
|
|
||||||
if (descriptor.inode->type() == VFS::InodeType::FIFO) return err(ESPIPE);
|
if (descriptor.inode->type() == VFS::InodeType::FIFO) return err(ESPIPE);
|
||||||
|
|
||||||
if (!VFS::is_seekable(descriptor.inode)) return descriptor.offset;
|
if (!VFS::is_seekable(descriptor.inode->type())) return descriptor.offset;
|
||||||
|
|
||||||
off_t new_offset;
|
off_t new_offset;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user