}
}
-struct pcache_pg*
+int
pcache_get_page(struct pcache* pcache,
uint32_t index,
uint32_t* offset,
}
// Filling up the page
- errno = inode->default_fops.read(inode, pg->pg, PG_SIZE, pg->fpos);
+ errno = inode->default_fops->read(inode, pg->pg, PG_SIZE, pg->fpos);
if (errno >= 0 && errno < PG_SIZE) {
// EOF
- len = buf_off + errno;
+ len = MIN(len, buf_off + errno);
} else if (errno < 0) {
break;
}
return;
}
- int errno = inode->default_fops.write(inode, page->pg, PG_SIZE, page->fpos);
+ int errno =
+ inode->default_fops->write(inode, page->pg, PG_SIZE, page->fpos);
if (!errno) {
page->flags &= ~PCACHE_DIRTY;