Seem to have fixed dirbuf allocation.

Dirbuf allocation was broken, fixed it.
Added more comments on reading directories.

Issues: fs0 ought to check buf address for sys_readdir(). Currently
test0 is passing an area on its stack and fs0 is writing the data to its own
address space (i.e. an area on its own stack.)
This commit is contained in:
Bahadir Balban
2008-04-13 00:23:21 +01:00
parent 367e455506
commit 2efffdfa88
5 changed files with 22 additions and 19 deletions

View File

@@ -127,6 +127,7 @@ struct vnode *memfs_alloc_vnode(struct superblock *sb)
/* Associate memfs-specific fields with vnode */
v->ops = memfs_vnode_operations;
v->fops = memfs_file_operations;
v->sb = sb;
/* Return the vnode */
return v;
@@ -315,7 +316,10 @@ int memfs_vnode_readdir(struct vnode *v)
return 0;
/* This is as big as a page */
v->dirbuf.buffer = vfs_alloc_dirpage();
if (IS_ERR(v->dirbuf.buffer = vfs_alloc_dirpage(v))) {
printf("%s: Could not allocate dirbuf.\n", __FUNCTION__);
return (int)v->dirbuf.buffer;
}
v->dirbuf.npages = 1;
/*