allow specifiying access mode when creating twifs file node
[lunaix-os.git] / lunaix-os / hal / ahci / hbadev_export.c
index d193937c8376ff1ae68deb899ae490c697f11fb7..f6c52bf19d965b566bbdcea7e6310be5e958cf1d 100644 (file)
@@ -3,14 +3,14 @@
 #include <lunaix/fs/twifs.h>
 
 void
-__blk_rd_serial(struct twimap* map)
+__twimap_read_serial(struct twimap* map)
 {
     struct hba_device* hbadev = twimap_data(map, struct hba_device*);
     twimap_printf(map, "%s", hbadev->serial_num);
 }
 
 void
-__blk_rd_last_status(struct twimap* map)
+__twimap_read_last_status(struct twimap* map)
 {
     struct hba_device* hbadev = twimap_data(map, struct hba_device*);
     twimap_printf(map,
@@ -21,25 +21,25 @@ __blk_rd_last_status(struct twimap* map)
 }
 
 void
-__blk_rd_capabilities(struct twimap* map)
+__twimap_read_capabilities(struct twimap* map)
 {
     struct hba_device* hbadev = twimap_data(map, struct hba_device*);
     twimap_printf(map, "%p", hbadev->capabilities);
 }
 
 void
-__blk_rd_aoffset(struct twimap* map)
+__twimap_read_alignment(struct twimap* map)
 {
     struct hba_device* hbadev = twimap_data(map, struct hba_device*);
     twimap_printf(map, "%d", hbadev->alignment_offset);
 }
 
 void
-__blk_rd_wwid(struct twimap* map)
+__twimap_read_wwid(struct twimap* map)
 {
     struct hba_device* hbadev = twimap_data(map, struct hba_device*);
-    uint32_t h = hbadev->wwn >> 32;
-    uint32_t l = (uint32_t)hbadev->wwn;
+    u32_t h = hbadev->wwn >> 32;
+    u32_t l = (u32_t)hbadev->wwn;
     if ((h | l)) {
         twimap_printf(map, "wwn:%x%x", h, l);
     } else {
@@ -53,18 +53,9 @@ ahci_fsexport(struct block_dev* bdev, void* fs_node)
     struct twifs_node* dev_root = (struct twifs_node*)fs_node;
     struct twimap* map;
 
-    map = twifs_mapping(dev_root, bdev->driver, "serial");
-    map->read = __blk_rd_serial;
-
-    map = twifs_mapping(dev_root, bdev->driver, "last_status");
-    map->read = __blk_rd_last_status;
-
-    map = twifs_mapping(dev_root, bdev->driver, "wwid");
-    map->read = __blk_rd_wwid;
-
-    map = twifs_mapping(dev_root, bdev->driver, "capabilities");
-    map->read = __blk_rd_capabilities;
-
-    map = twifs_mapping(dev_root, bdev->driver, "alignment_offset");
-    map->read = __blk_rd_aoffset;
+    twimap_export_value(dev_root, serial,       FSACL_aR, bdev->driver);
+    twimap_export_value(dev_root, last_status,  FSACL_aR, bdev->driver);
+    twimap_export_value(dev_root, wwid,         FSACL_aR, bdev->driver);
+    twimap_export_value(dev_root, capabilities, FSACL_aR, bdev->driver);
+    twimap_export_value(dev_root, alignment,    FSACL_aR, bdev->driver);
 }
\ No newline at end of file