mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-29 05:38:21 +00:00
vfs filesystem mounting
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
#ifndef _TMPFS_H_INCLUDE
|
||||
#define _TMPFS_H_INCLUDE
|
||||
|
||||
#include <kernel/vfs.h>
|
||||
|
||||
fscalls_t* tmpfs_getfuncs();
|
||||
|
||||
#endif
|
||||
+11
-10
@@ -18,6 +18,7 @@ typedef struct {
|
||||
|
||||
typedef struct _vnode_t {
|
||||
stat st;
|
||||
char* name;
|
||||
fs_t* fs;
|
||||
void* fsdata;
|
||||
size_t refcount;
|
||||
@@ -28,23 +29,23 @@ typedef struct _vnode_t {
|
||||
|
||||
typedef struct _dirnode_t{
|
||||
vnode_t vnode;
|
||||
struct _dirnode_t* mountednode;
|
||||
struct _dirnode_t* mount;
|
||||
hashtable children;
|
||||
} dirnode_t;
|
||||
|
||||
// fs specific calls called by the vfs on filesystems
|
||||
|
||||
typedef struct _fscalls_t {
|
||||
// prepares the filesystem using a filesystem data pointer and returns the root node
|
||||
dirnode_t* (*mount)(void*);
|
||||
// prepares the filesystem using a filesystem data pointer and device, returning the root node in rootptr
|
||||
int (*mount)(dirnode_t** rootptr, vnode_t* device, int mountflags, void* fsinfo);
|
||||
// cleanup of the filesystem
|
||||
int (*umount)();
|
||||
int (*umount)(fs_t* fs);
|
||||
// opens a file under a dirnode
|
||||
// args: parent, name
|
||||
int (*open)(dirnode_t*, char*);
|
||||
// cleans up a vfsnode
|
||||
int (*open)(dirnode_t* parent, char* name);
|
||||
// cleans up a node
|
||||
// args: the node to clean
|
||||
int (*close)(vnode_t*);
|
||||
int (*close)(vnode_t* node);
|
||||
// creates a new directory with the right mode
|
||||
// args: parent, name, mode
|
||||
int (*mkdir)(dirnode_t* parent, char* name, mode_t mode);
|
||||
@@ -54,7 +55,7 @@ typedef struct _fscalls_t {
|
||||
} fscalls_t;
|
||||
|
||||
|
||||
int vfs_mount(dirnode_t* ref, char* device, char* mountpoint, char* fs);
|
||||
int vfs_mount(dirnode_t* ref, char* device, char* mountpoint, char* fs, int mountflags, void* fsinfo);
|
||||
int vfs_umount(dirnode_t* ref, char* mountpoint);
|
||||
int vfs_open(vnode_t* buf, dirnode_t* ref, char* path, int flags, mode_t mode);
|
||||
int vfs_close(vnode_t* node);
|
||||
@@ -66,8 +67,8 @@ void vfs_init();
|
||||
dirnode_t* vfs_root();
|
||||
void vfs_acquirenode(vnode_t* node);
|
||||
void vfs_releasenode(vnode_t* node);
|
||||
vnode_t* vfs_newnode(fs_t* fs, void* fsdata);
|
||||
dirnode_t* vfs_newdirnode(fs_t* fs, void* fsdata);
|
||||
vnode_t* vfs_newnode(char* name, fs_t* fs, void* fsdata);
|
||||
dirnode_t* vfs_newdirnode(char* name, fs_t* fs, void* fsdata);
|
||||
void vfs_destroynode(vnode_t* node);
|
||||
int vfs_resolvepath(vnode_t** result, dirnode_t* ref, char* path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user