vfs: add mount support
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
9bbe42b95a
commit
7c8b46eeda
3 changed files with 318 additions and 20 deletions
|
|
@ -3,6 +3,7 @@
|
|||
#define _VFS_H_
|
||||
|
||||
#include <kernel/spinlock.h>
|
||||
#include <kernel/slab.h>
|
||||
#include <fs/inode.h>
|
||||
|
||||
#include <lib/rwlock.h>
|
||||
|
|
@ -81,19 +82,32 @@ struct _fs {
|
|||
|
||||
struct dir_context {
|
||||
void *cookie;
|
||||
bool init;
|
||||
bool init;
|
||||
};
|
||||
|
||||
struct mount {
|
||||
struct mount *parent;
|
||||
list_t children;
|
||||
list_item_t *child_link;
|
||||
fs_t *fs;
|
||||
dirent_t *mountpoint;
|
||||
u64 flags;
|
||||
};
|
||||
|
||||
void vfs_init(void);
|
||||
void vfs_register(struct fs_driver *fs);
|
||||
|
||||
int vfs_open(const char *abs_path, dirent_t **out);
|
||||
int vfs_openat(dirent_t *in, const char *name, dirent_t **out);
|
||||
int vfs_openat(struct mount *mnt, dirent_t *in, const char *name, dirent_t **out);
|
||||
void vfs_close(dirent_t *dent);
|
||||
int vfs_readdir(dirent_t *dir, struct dir_context *ctx, dirent_t **out);
|
||||
int vfs_creat(dirent_t *parent, const char *name, u64 mode, int flags, dirent_t **out);
|
||||
int vfs_unlink(dirent_t *parent, const char *name);
|
||||
int vfs_mount(const char *mount_point, fs_t *fs_to_mount);
|
||||
int vfs_mount(const char *path, fs_t *fs, u64 flags);
|
||||
int vfs_umount(const char *path);
|
||||
fs_t *vfs_get_root(void);
|
||||
struct mount *vfs_get_root_mount(void);
|
||||
struct mount *mount_find_child(struct mount *parent, dirent_t *dent);
|
||||
|
||||
ssize_t vfs_write(inode_t *ino, char *buf, size_t size, size_t offset);
|
||||
ssize_t vfs_read(inode_t *ino, char *buf, size_t size, size_t offset);
|
||||
|
|
|
|||
Loading…
Reference in a new issue