From 7ab3153f92f38223157c4c1f4af1c30e33c94a76 Mon Sep 17 00:00:00 2001
From: Anton Kling <anton@kling.gg>
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/queue.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'kernel/queue.c')

diff --git a/kernel/queue.c b/kernel/queue.c
index b1cf698..0bef21b 100644
--- a/kernel/queue.c
+++ b/kernel/queue.c
@@ -57,8 +57,10 @@ int queue_should_block(struct event_queue *q, int *is_empty) {
         kprintf("queue: Invalid fd given\n");
         continue;
       }
-      if (fd->inode->has_data) {
-        return 0;
+      if (fd->inode->_has_data) {
+        if (fd->inode->_has_data(fd->inode)) {
+          return 0;
+        }
       }
     } else if (EVENT_TYPE_TCP_SOCKET == ev->type) {
       struct TcpConnection *con = tcp_get_connection(ev->internal_id, q->p);
-- 
cgit v1.2.3