#include <lunaix/block.h>
#include <lunaix/fs/twifs.h>
#include <lunaix/mm/cake.h>
-#include <lunaix/mm/page.h>
+#include <lunaix/mm/pagetable.h>
#include <lunaix/mm/valloc.h>
#include <lunaix/spike.h>
#include <lunaix/syslog.h>
static struct cake_pile* lbd_pile;
static struct block_dev** dev_registry;
static struct twifs_node* blk_sysroot;
-static struct device* blk_parent_dev;
+static struct device_cat* blk_parent_dev;
int free_slot = 0;
struct block_dev* bdev = (struct block_dev*)dev->underlay;
u32_t lba = offset / bdev->blk_size + bdev->start_lba;
- u32_t rd_lba = MIN(lba + PG_SIZE / bdev->blk_size, bdev->end_lba);
+ u32_t rd_lba = MIN(lba + PAGE_SIZE / bdev->blk_size, bdev->end_lba);
if (rd_lba <= lba) {
return 0;
struct block_dev* bdev = (struct block_dev*)dev->underlay;
u32_t lba = offset / bdev->blk_size + bdev->start_lba;
- u32_t wr_lba = MIN(lba + PG_SIZE / bdev->blk_size, bdev->end_lba);
+ u32_t wr_lba = MIN(lba + PAGE_SIZE / bdev->blk_size, bdev->end_lba);
if (wr_lba <= lba) {
return 0;
return 0;
}
- struct device* dev = device_allocvol(blk_parent_dev, bdev);
+ struct device* dev = device_allocvol(dev_meta(blk_parent_dev), bdev);
dev->ops.write = __block_write;
dev->ops.write_page = __block_write_page;
dev->ops.read = __block_read;
bdev->dev = dev;
- device_register(dev, bdev->class, "sd%c", 'a' + free_slot);
+ register_device(dev, bdev->class, "sd%c", 'a' + free_slot);
dev_registry[free_slot++] = bdev;
strcpy(bdev->bdev_id, dev->name_val);
llist_append(&bdev->parts, &pbdev->parts);
- device_register(dev, pbdev->class, "%sp%d", bdev->bdev_id, index + 1);
+ register_device(dev, pbdev->class, "%sp%d", bdev->bdev_id, index + 1);
return pbdev;
}
\ No newline at end of file