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/drivers/ahci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'kernel/drivers/ahci.c') diff --git a/kernel/drivers/ahci.c b/kernel/drivers/ahci.c index 1fad0a3..34de443 100644 --- a/kernel/drivers/ahci.c +++ b/kernel/drivers/ahci.c @@ -485,6 +485,11 @@ int ahci_read(u8 *buffer, u64 offset, u64 len, vfs_fd_t *fd) { return rc; } +int ahci_has_data(vfs_inode_t *inode) { + (void)inode; + return 1; +} + void add_devfs_drive_file(u8 port) { static u8 num_drives_added = 0; char *path = "/sda"; @@ -492,7 +497,7 @@ void add_devfs_drive_file(u8 port) { num_drives_added++; vfs_inode_t *inode = devfs_add_file(path, ahci_read, ahci_write, NULL /*get_vm_object*/, - 1 /*has_data*/, 0 /*can_write*/, FS_TYPE_BLOCK_DEVICE); + ahci_has_data, NULL /*can_write*/, FS_TYPE_BLOCK_DEVICE); inode->inode_num = port; } -- cgit v1.2.3