mirror of
https://github.com/drasko/codezero.git
synced 2026-02-27 01:03:14 +01:00
Some efforts to adding better support for readdir
This commit is contained in:
@@ -47,7 +47,7 @@ struct file_ops {
|
||||
struct vnode_ops {
|
||||
vnode_op_t create;
|
||||
struct vnode *(*lookup)(struct vnode *root, char *path);
|
||||
void * (*readdir)(struct vnode *v, void *dirbuf);
|
||||
void *(*readdir)(struct vnode *v, void *dirbuf);
|
||||
vnode_op_t link;
|
||||
vnode_op_t unlink;
|
||||
vnode_op_t mkdir;
|
||||
@@ -97,6 +97,7 @@ struct vnode {
|
||||
struct file_ops fops; /* File-related operations on this vnode */
|
||||
struct list_head dentries; /* Dirents that refer to this vnode */
|
||||
struct list_head state_list; /* List for vnode's dirty/clean state */
|
||||
struct list_head cache_list; /* For adding the vnode to vnode cache */
|
||||
u32 type; /* Vnode type, dev? socket? dir? ... */
|
||||
u32 mode; /* Permissions */
|
||||
u32 owner; /* Owner */
|
||||
|
||||
@@ -75,8 +75,9 @@ struct memfs_superblock {
|
||||
|
||||
#define MEMFS_DNAME_MAX 32
|
||||
struct memfs_dentry {
|
||||
u32 inum; /* Inode number */
|
||||
u32 nlength; /* Name length */
|
||||
u32 inum; /* Inode number */
|
||||
u32 offset; /* Dentry offset in its buffer */
|
||||
u32 rlength; /* Record length */
|
||||
u8 name[MEMFS_DNAME_MAX]; /* Name string */
|
||||
};
|
||||
|
||||
|
||||
@@ -6,6 +6,17 @@
|
||||
#include <l4/lib/list.h>
|
||||
#include <memfs/memfs.h>
|
||||
|
||||
/* Buffer to keep directory content. This is the only vnode content
|
||||
* that fs0 maintains. All other file data is in mm0 page cache.
|
||||
*/
|
||||
struct dirbuf {
|
||||
struct list_head list;
|
||||
unsigned long bufsize;
|
||||
u8 *buffer;
|
||||
};
|
||||
extern struct list_head vnode_cache;
|
||||
extern struct list_head dentry_cache;
|
||||
|
||||
/*
|
||||
* FIXME:
|
||||
* These ought to be strings and split/comparison functions should
|
||||
@@ -58,12 +69,16 @@ static inline struct vnode *vfs_alloc_vnode(void)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
static inline void vfs_free_vnode(struct vnode *v)
|
||||
{
|
||||
BUG(); /* Are the dentries freed ??? */
|
||||
list_del(&v->cache_list);
|
||||
kfree(v);
|
||||
}
|
||||
|
||||
@@ -84,6 +99,7 @@ extern struct vfs_mountpoint vfs_root;
|
||||
|
||||
int vfs_mount_root(struct superblock *sb);
|
||||
struct vnode *generic_vnode_lookup(struct vnode *thisnode, char *path);
|
||||
struct vnode *vfs_lookup(struct superblock *sb, char *path);
|
||||
struct vnode *vfs_lookup_bypath(struct superblock *sb, char *path);
|
||||
struct vnode *vfs_lookup_byvnum(struct superblock *sb, unsigned long vnum);
|
||||
|
||||
#endif /* __VFS_H__ */
|
||||
|
||||
Reference in New Issue
Block a user