mirror of
https://github.com/drasko/codezero.git
synced 2026-04-17 17:29:04 +02:00
sys_readdir and root vnode fixes.
Changes towards successfully filling dirent structures for sys_readdir and creating a root vnode for the filesystem.
This commit is contained in:
@@ -1,18 +1,6 @@
|
||||
#ifndef __FS0_MM_H__
|
||||
#define __FS0_MM_H__
|
||||
|
||||
/*
|
||||
* Describes the in-memory representation of a file. This is used to track
|
||||
* file content, i.e. file pages by mm0, this is a temporary mock up until
|
||||
* fs0 and mm0 are wired together.
|
||||
*/
|
||||
struct vm_file {
|
||||
unsigned long vnum;
|
||||
unsigned long length;
|
||||
|
||||
/* This is the cache of physical pages that this file has in memory. */
|
||||
struct list_head page_cache_list;
|
||||
struct vm_pager *pager;
|
||||
};
|
||||
|
||||
#endif /* __FS0_MM_H__ */
|
||||
|
||||
@@ -48,6 +48,7 @@ struct vnode_ops {
|
||||
vnode_op_t create;
|
||||
struct vnode *(*lookup)(struct vnode *root, char *path);
|
||||
int (*readdir)(struct vnode *v);
|
||||
int (*filldir)(struct vnode *v);
|
||||
vnode_op_t link;
|
||||
vnode_op_t unlink;
|
||||
int (*mkdir)(struct vnode *parent, char *name);
|
||||
@@ -91,8 +92,9 @@ struct dentry {
|
||||
};
|
||||
|
||||
/*
|
||||
* Buffer to keep directory content. This is the only vnode content
|
||||
* that fs0 maintains. All other file data is in mm0 page cache.
|
||||
* Buffer that maintains directory content for a directory vnode. This is the
|
||||
* only vnode content that fs0 maintains. All other file data is in mm0 page
|
||||
* cache.
|
||||
*/
|
||||
struct dirbuf {
|
||||
unsigned long npages;
|
||||
@@ -100,6 +102,15 @@ struct dirbuf {
|
||||
u8 *buffer;
|
||||
};
|
||||
|
||||
/* Posix-style dirent format used by userspace. Returned by sys_readdir() */
|
||||
#define DIRENT_NAME_MAX 32
|
||||
struct dirent {
|
||||
u32 inum; /* Inode number */
|
||||
u32 offset; /* Dentry offset in its buffer */
|
||||
u32 rlength; /* Record length */
|
||||
u8 name[DIRENT_NAME_MAX]; /* Name string */
|
||||
};
|
||||
|
||||
struct vnode {
|
||||
unsigned long vnum; /* Filesystem-wide unique vnode id */
|
||||
int refcnt; /* Reference counter */
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#define MEMFS_MAGIC 0xB
|
||||
#define MEMFS_NAME "memfs"
|
||||
#define MEMFS_NAME_SIZE 8
|
||||
|
||||
struct memfs_inode {
|
||||
u32 inum; /* Inode number */
|
||||
u32 mode; /* File permissions */
|
||||
@@ -64,7 +65,7 @@ struct memfs_superblock {
|
||||
u32 blocksize; /* Filesystem block size */
|
||||
u64 fmaxblocks; /* Maximum number of blocks per file */
|
||||
u64 fssize; /* Total size of filesystem */
|
||||
struct memfs_inode *root; /* The root of this superblock */
|
||||
unsigned long root_vnum; /* The root vnum of this superblock */
|
||||
struct list_head inode_cache_list; /* Chain of alloc caches */
|
||||
struct list_head block_cache_list; /* Chain of alloc caches */
|
||||
struct id_pool *ipool; /* Index pool for inodes */
|
||||
|
||||
Reference in New Issue
Block a user