rewrite the device subsystem interfaces (#48)
[lunaix-os.git] / lunaix-os / hal / char / devnull.c
index 410f3ba2cdf932276778011be925a00f91ef3c4c..3991548addec6dee0731677d412c00ca55f3fe19 100644 (file)
@@ -1,11 +1,11 @@
 #include <lunaix/device.h>
-#include <lunaix/mm/page.h>
+#include <lunaix/mm/pagetable.h>
 
 static int
 __null_wr_pg(struct device* dev, void* buf, size_t offset)
 {
     // do nothing
-    return PG_SIZE;
+    return PAGE_SIZE;
 }
 
 static int
@@ -30,7 +30,7 @@ __null_rd(struct device* dev, void* buf, size_t offset, size_t len)
 }
 
 static int
-pdev_nulldev_init(struct device_def* def)
+pdev_nulldev_create(struct device_def* def, morph_t* obj)
 {
     struct device* devnull = device_allocseq(NULL, NULL);
     devnull->ops.write_page = __null_wr_pg;
@@ -44,7 +44,8 @@ pdev_nulldev_init(struct device_def* def)
 }
 
 static struct device_def devnull_def = {
-    .name = "null",
-    .class = DEVCLASSV(DEVIF_NON, DEVFN_PSEUDO, DEV_NULL, DEV_BUILTIN_NULL),
-    .init = pdev_nulldev_init};
+    def_device_name("edendi"),
+    def_device_class(LUNAIX, PSEUDO, NIHIL),
+    def_on_create(pdev_nulldev_create)
+};
 EXPORT_DEVICE(nulldev, &devnull_def, load_onboot);