feat: better rtc framework which aims to remove single rtc restrictions.
[lunaix-os.git] / lunaix-os / kernel / block / block.c
index f699169b01423e1ce7ddbf0be5447d13cf87e57e..460e94bf3c4690394b4bf2240113ace6ae5a5397 100644 (file)
@@ -1,16 +1,18 @@
-#include <hal/ahci/hba.h>
 #include <klibc/stdio.h>
 #include <klibc/string.h>
+
+#include <hal/ahci/hba.h>
+
 #include <lib/crc.h>
+
+#include <lunaix/blkpart_gpt.h>
 #include <lunaix/block.h>
 #include <lunaix/fs/twifs.h>
 #include <lunaix/mm/cake.h>
+#include <lunaix/mm/page.h>
 #include <lunaix/mm/valloc.h>
-#include <lunaix/syslog.h>
-
-#include <lunaix/blkpart_gpt.h>
-
 #include <lunaix/spike.h>
+#include <lunaix/syslog.h>
 
 #define BLOCK_EREAD 1
 #define BLOCK_ESIG 2
@@ -318,10 +320,10 @@ __block_register(struct block_dev* bdev)
 
     struct device* dev =
       device_addvol(blk_parent_dev, bdev, "sd%c", 'a' + free_slot);
-    dev->write = __block_write;
-    dev->write_page = __block_write_page;
-    dev->read = __block_read;
-    dev->read_page = __block_read_page;
+    dev->ops.write = __block_write;
+    dev->ops.write_page = __block_write_page;
+    dev->ops.read = __block_read;
+    dev->ops.read_page = __block_read_page;
 
     bdev->dev = dev;
     strcpy(bdev->bdev_id, dev->name_val);
@@ -341,10 +343,10 @@ blk_mount_part(struct block_dev* bdev,
 
     struct device* dev =
       device_addvol(NULL, pbdev, "%sp%d", bdev->bdev_id, index + 1);
-    dev->write = __block_write;
-    dev->write_page = __block_write_page;
-    dev->read = __block_read;
-    dev->read_page = __block_read_page;
+    dev->ops.write = __block_write;
+    dev->ops.write_page = __block_write_page;
+    dev->ops.read = __block_read;
+    dev->ops.read_page = __block_read_page;
 
     pbdev->start_lba = start_lba;
     pbdev->end_lba = end_lba;