Debug code to see remote kmsgs
[akaros.git] / kern / src / kfs.c
index 9c7e3e1..c5e876c 100644 (file)
@@ -119,11 +119,11 @@ struct fs_type kfs_fs_type = {"KFS", 0, kfs_get_sb, kfs_kill_sb, {0, 0},
 /* Fills page with its contents from its backing store file.  Note that we do
  * the zero padding here, instead of higher in the VFS.  Might change in the
  * future. */
-int kfs_readpage(struct file *file, struct page *page)
+int kfs_readpage(struct page_map *pm, struct page *page)
 {
        size_t pg_idx_byte = page->pg_index * PGSIZE;
        struct kfs_i_info *k_i_info = (struct kfs_i_info*)
-                                     file->f_dentry->d_inode->i_fs_info;
+                                     pm->pm_host->i_fs_info;
        uintptr_t begin = (size_t)k_i_info->filestart + pg_idx_byte;
        /* If we're beyond the initial start point, we just need a zero page.  This
         * is for a hole or for extending a file (even though it won't be saved).
@@ -137,24 +137,21 @@ int kfs_readpage(struct file *file, struct page *page)
                memset(page2kva(page) + copy_amt, 0, PGSIZE - copy_amt);
        }
        struct buffer_head *bh = kmem_cache_alloc(bh_kcache, 0);
-       if (!bh) {
-               unlock_page(page);
+       if (!bh)
                return -1;                      /* untested, un-thought-through */
-       }
        /* KFS does a 1:1 BH to page mapping */
        bh->bh_page = page;                                                             /* weak ref */
        bh->bh_buffer = page2kva(page);
        bh->bh_flags = 0;                                                               /* whatever... */
        bh->bh_next = 0;                                                                /* only one BH needed */
-       bh->bh_bdev = file->f_dentry->d_sb->s_bdev;             /* uncounted */
-       bh->bh_blocknum = page->pg_index;
-       bh->bh_numblock = 1;
+       bh->bh_bdev = pm->pm_host->i_sb->s_bdev;                /* uncounted */
+       bh->bh_sector = page->pg_index;
+       bh->bh_nr_sector = 1;                                                   /* sector size = PGSIZE */
        page->pg_private = bh;
        /* This is supposed to be done in the IO system when the operation is
         * complete.  Since we aren't doing a real IO request, and it is already
         * done, we can do it here. */
        page->pg_flags |= PG_UPTODATE;
-       unlock_page(page);
        return 0;
 }
 
@@ -916,7 +913,7 @@ void parse_cpio_entries(struct super_block *sb, void *cpio_b)
                }
                c_bhdr->c_filename = (char*)c_hdr + sizeof(*c_hdr);
                namesize = cpio_strntol(buf, c_hdr->c_namesize, 8);
-               printd("Namesize: %d\n", size);
+               printd("Namesize: %d\n", namesize);
                if (!strcmp(c_bhdr->c_filename, "TRAILER!!!"))
                        break;
                c_bhdr->c_ino = cpio_strntol(buf, c_hdr->c_ino, 8);