From 7cdb9677301ab01f5117528daf2ee58e6c1efc5c Mon Sep 17 00:00:00 2001 From: apio Date: Fri, 26 May 2023 20:30:39 +0200 Subject: [PATCH] kernel: compilation fix --- kernel/src/fs/VFS.h | 2 +- kernel/src/sys/file.cpp | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/kernel/src/fs/VFS.h b/kernel/src/fs/VFS.h index 6ab313cb..e5de6afa 100644 --- a/kernel/src/fs/VFS.h +++ b/kernel/src/fs/VFS.h @@ -286,7 +286,7 @@ namespace VFS bool is_setuid(SharedPtr inode); bool is_setgid(SharedPtr inode); - bool is_seekable(VFS::InodeType type); + bool is_seekable(SharedPtr inode); Inode& root_inode(); diff --git a/kernel/src/sys/file.cpp b/kernel/src/sys/file.cpp index aa36a940..735d224a 100644 --- a/kernel/src/sys/file.cpp +++ b/kernel/src/sys/file.cpp @@ -33,7 +33,7 @@ Result sys_read(Registers*, SyscallArgs args) 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; } @@ -52,12 +52,11 @@ Result sys_write(Registers*, SyscallArgs args) if (!descriptor.is_writable()) return err(EBADF); - if (descriptor.should_append() && VFS::is_seekable(descriptor.inode->type())) - descriptor.offset = descriptor.inode->size(); + if (descriptor.should_append() && VFS::is_seekable(descriptor.inode)) descriptor.offset = descriptor.inode->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; } @@ -74,7 +73,7 @@ Result sys_lseek(Registers*, SyscallArgs args) 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;