From 7ab3153f92f38223157c4c1f4af1c30e33c94a76 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Fri, 26 Apr 2024 19:06:46 +0200 Subject: Kernel/VFS: Change polling from variables to functions Instead of having to store state in variables functions are called to check the object directly. --- kernel/poll.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'kernel/poll.c') diff --git a/kernel/poll.c b/kernel/poll.c index 7107646..4c6e411 100644 --- a/kernel/poll.c +++ b/kernel/poll.c @@ -57,11 +57,15 @@ int poll(struct pollfd *fds, size_t nfds, int timeout) { fds[i].revents |= POLLHUP; } } else { - if (f->inode->has_data && fds[i].events & POLLIN) { - fds[i].revents |= POLLIN; + if (f->inode->_has_data) { + if (f->inode->_has_data(f->inode) && fds[i].events & POLLIN) { + fds[i].revents |= POLLIN; + } } - if (f->inode->can_write && fds[i].events & POLLOUT) { - fds[i].revents |= POLLOUT; + if (f->inode->_can_write) { + if (f->inode->_can_write(f->inode) && fds[i].events & POLLOUT) { + fds[i].revents |= POLLOUT; + } } if (!(f->inode->is_open) && fds[i].events & POLLHUP) { fds[i].revents |= POLLHUP; -- cgit v1.2.3