Remove bootp
[akaros.git] / kern / src / blockdev.c
index 8e4f3b5..94f2fac 100644 (file)
@@ -38,8 +38,7 @@ void block_init(void)
        kref_init(&ram_bd->b_kref, fake_release, 1);
        pm_init(&ram_bd->b_pm, &block_pm_op, ram_bd);
        ram_bd->b_data = _binary_mnt_ext2fs_img_start;
-       strncpy(ram_bd->b_name, "RAMDISK", BDEV_INLINE_NAME);
-       ram_bd->b_name[BDEV_INLINE_NAME - 1] = '\0';
+       strlcpy(ram_bd->b_name, "RAMDISK", BDEV_INLINE_NAME);
        /* Connect it to the file system */
        struct file *ram_bf = make_device("/dev/ramdisk", S_IRUSR | S_IWUSR,
                                          __S_IFBLK, &block_f_op);
@@ -191,7 +190,7 @@ struct buffer_head *bdev_get_buffer(struct block_device *bdev,
        if (error)
                panic("Failed to load page! (%d)", error);
        my_buf = page2kva(page) + blk_offset;
-       assert(atomic_read(&page->pg_flags) & PG_BUFFER);
+       atomic_or(&page->pg_flags, PG_BUFFER);
 retry:
        bh = (struct buffer_head*)page->pg_private;
        prev = 0;
@@ -276,7 +275,7 @@ void bdev_dirty_buffer(struct buffer_head *bh)
  * reclaiming will be in page sized chunks from the page cache. */
 void bdev_put_buffer(struct buffer_head *bh)
 {
-       page_decref(bh->bh_page);
+       pm_put_page(bh->bh_page);
 }
 
 /* Block device page map ops: */