Kernel: Make Inodes use the new lock

Also remove old lock from TTY since it can just use the one Inode
already has.
This commit is contained in:
Bananymous 2023-12-07 13:19:12 +02:00
parent 7c25e4ce5a
commit 12474addda
3 changed files with 9 additions and 6 deletions

View File

@ -121,9 +121,10 @@ namespace Kernel
virtual BAN::ErrorOr<void> chmod_impl(mode_t) { return BAN::Error::from_errno(ENOTSUP); }
virtual bool has_data_impl() const { dwarnln("nonblock not supported"); return true; }
private:
mutable RecursiveSpinLock m_lock;
protected:
mutable RecursivePrioritySpinLock m_lock;
private:
BAN::WeakPtr<SharedFileData> m_shared_region;
friend class FileBackedRegion;
};

View File

@ -56,8 +56,6 @@ namespace Kernel
void do_backspace();
protected:
mutable Kernel::RecursiveSpinLock m_lock;
TerminalDriver::Color m_foreground { TerminalColor::BRIGHT_WHITE };
TerminalDriver::Color m_background { TerminalColor::BLACK };
termios m_termios;

View File

@ -303,9 +303,13 @@ namespace Kernel
LockGuard _(m_lock);
while (!m_output.flush)
{
m_lock.unlock();
// FIXME: this is very hacky way to unlock lock temporarily
uint32_t depth = m_lock.lock_depth();
for (uint32_t i = 0; i < depth; i++)
m_lock.unlock();
bool eintr = Thread::current().block_or_eintr(m_output.semaphore);
m_lock.lock();
for (uint32_t i = 0; i < depth; i++)
m_lock.lock();
if (eintr)
return BAN::Error::from_errno(EINTR);
}