kernel: compilation fix
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
62e14e7580
commit
7cdb967730
@ -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(VFS::InodeType type);
|
bool is_seekable(SharedPtr<Inode> inode);
|
||||||
|
|
||||||
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->type())) descriptor.offset += nread;
|
if (VFS::is_seekable(descriptor.inode)) descriptor.offset += nread;
|
||||||
|
|
||||||
return nread;
|
return nread;
|
||||||
}
|
}
|
||||||
@ -52,12 +52,11 @@ 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->type()))
|
if (descriptor.should_append() && VFS::is_seekable(descriptor.inode)) descriptor.offset = descriptor.inode->size();
|
||||||
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->type())) descriptor.offset += nwritten;
|
if (VFS::is_seekable(descriptor.inode)) descriptor.offset += nwritten;
|
||||||
|
|
||||||
return nwritten;
|
return nwritten;
|
||||||
}
|
}
|
||||||
@ -74,7 +73,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->type())) return descriptor.offset;
|
if (!VFS::is_seekable(descriptor.inode)) return descriptor.offset;
|
||||||
|
|
||||||
off_t new_offset;
|
off_t new_offset;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user