summaryrefslogtreecommitdiff
path: root/kernel/drivers/ahci.c
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-04-26 19:06:46 +0200
committerAnton Kling <anton@kling.gg>2024-04-26 19:06:46 +0200
commit7ab3153f92f38223157c4c1f4af1c30e33c94a76 (patch)
tree301f950cd6dc8fde244e9b5c1201ec01d964347b /kernel/drivers/ahci.c
parent2e2805c88789c148cce0118d3a4ff0212458bb86 (diff)
Kernel/VFS: Change polling from variables to functions
Instead of having to store state in variables functions are called to check the object directly.
Diffstat (limited to 'kernel/drivers/ahci.c')
-rw-r--r--kernel/drivers/ahci.c7
1 files changed, 6 insertions, 1 deletions
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;
}