mirror of
https://github.com/drasko/codezero.git
synced 2026-03-29 08:19:03 +02:00
sys_readdir and memfs_readdir closer to targeted look and feel.
We now have a single dirbuf of size PAGE_SIZE kept on the vnode. This is to be used for directory contents only. The reason it's kept on FS0 is because the contents are modified by calls such as mkdir or create, and otherwise these would have been handled by mm0 on the page cache buffers, which wouldn't work.
This commit is contained in:
@@ -10,10 +10,11 @@
|
||||
* that fs0 maintains. All other file data is in mm0 page cache.
|
||||
*/
|
||||
struct dirbuf {
|
||||
struct list_head list;
|
||||
unsigned long bufsize;
|
||||
u8 *buffer;
|
||||
unsigned long npages;
|
||||
int dirty;
|
||||
u8 *buf;
|
||||
};
|
||||
|
||||
extern struct list_head vnode_cache;
|
||||
extern struct list_head dentry_cache;
|
||||
|
||||
@@ -54,6 +55,7 @@ static inline struct dentry *vfs_alloc_dentry(void)
|
||||
INIT_LIST_HEAD(&d->child);
|
||||
INIT_LIST_HEAD(&d->children);
|
||||
INIT_LIST_HEAD(&d->vref);
|
||||
INIT_LIST_HEAD(&d->cache_list);
|
||||
|
||||
return d;
|
||||
}
|
||||
@@ -68,9 +70,7 @@ static inline struct vnode *vfs_alloc_vnode(void)
|
||||
struct vnode *v = kzalloc(sizeof(struct vnode));
|
||||
|
||||
INIT_LIST_HEAD(&v->dentries);
|
||||
INIT_LIST_HEAD(&v->state_list);
|
||||
INIT_LIST_HEAD(&v->cache_list);
|
||||
list_add(&v->cache_list, &vnode_cache);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user