Volume-centric VFS implementation
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m41s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m41s
This commit is contained in:
@@ -7,64 +7,56 @@
|
||||
#include <libk/list.h>
|
||||
#include <libk/rbtree.h>
|
||||
#include <libk/std.h>
|
||||
#include <path.h>
|
||||
#include <path_defs.h>
|
||||
#include <proc/proc.h>
|
||||
#include <proc/procgroup.h>
|
||||
#include <proc/reschedule.h>
|
||||
#include <proc/suspension_q.h>
|
||||
#include <sync/spin_lock.h>
|
||||
|
||||
#define VFS_KERNEL ((struct proc*)0x123)
|
||||
|
||||
#define VFS_TARFS 0
|
||||
|
||||
struct vfs_mountpoint;
|
||||
struct vfs_volume;
|
||||
|
||||
struct vfs_handle {
|
||||
int id;
|
||||
struct vfs_mountpoint* mountpoint;
|
||||
char path[MAX_PATH];
|
||||
struct procgroup* ownerpg;
|
||||
struct rb_node_link handle_tree_link;
|
||||
spin_lock_t lock;
|
||||
};
|
||||
|
||||
struct vfs_mountpoint {
|
||||
char key[0x100];
|
||||
struct hash_node_link mount_table_link;
|
||||
struct vfs_volume {
|
||||
char key[VOLUME_MAX];
|
||||
struct hash_node_link volume_table_link;
|
||||
int fs_type;
|
||||
spin_lock_t lock;
|
||||
struct proc* owner;
|
||||
bool locked;
|
||||
struct proc_suspension_q sq;
|
||||
struct {
|
||||
int (*mount) (struct vfs_mountpoint* mountpoint, struct proc* proc,
|
||||
struct reschedule_ctx* rctx);
|
||||
int (*mount) (struct vfs_volume* volume, struct proc* proc, struct reschedule_ctx* rctx);
|
||||
|
||||
int (*describe) (struct vfs_mountpoint* mountpoint, const char* path, struct desc* desc);
|
||||
int (*describe) (struct vfs_volume* volume, const char* path, struct desc* desc);
|
||||
|
||||
int (*read) (struct vfs_mountpoint* mountpoint, const char* path, uint8_t* buffer, size_t off,
|
||||
int (*read) (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
|
||||
size_t size);
|
||||
} driver_ops;
|
||||
struct device* back_device;
|
||||
void* udata
|
||||
};
|
||||
|
||||
struct vfs_mount_table {
|
||||
struct hash_node_link* mountpoint_buckets[1024];
|
||||
struct vfs_volume_table {
|
||||
struct hash_node_link* volume_buckets[1024];
|
||||
spin_lock_t lock;
|
||||
};
|
||||
|
||||
int vfs_create_mountpoint (const char* key, int fs_type, struct device* back_device,
|
||||
struct proc* proc, struct reschedule_ctx* rctx);
|
||||
int vfs_create_volume (const char* key, int fs_type, struct device* back_device, struct proc* proc,
|
||||
struct reschedule_ctx* rctx);
|
||||
|
||||
int vfs_describe (struct procgroup* procgroup, int id, struct desc* desc);
|
||||
int vfs_volume_open (struct proc* proc, const char* volume, struct reschedule_ctx* rctx);
|
||||
|
||||
int vfs_read (struct procgroup* procgroup, int id, uint8_t* buffer, size_t off, size_t size);
|
||||
int vfs_volume_close (struct proc* proc, const char* volume, struct reschedule_ctx* rctx);
|
||||
|
||||
int vfs_close (struct procgroup* procgroup, int id);
|
||||
int vfs_read (struct proc* proc, const char* volume, const char* path, uint8_t* buffer, size_t off,
|
||||
size_t size, struct reschedule_ctx* rctx);
|
||||
|
||||
int vfs_open (struct procgroup* procgroup, const char* mountpoint, const char* path);
|
||||
|
||||
int vfs_kernel_read (const char* mountpoint, const char* path, uint8_t* buffer, size_t off,
|
||||
size_t size);
|
||||
|
||||
int vfs_kernel_describe (const char* mountpoint, const char* path, struct desc* desc);
|
||||
|
||||
void vfs_procgroup_cleanup (struct procgroup* procgroup);
|
||||
int vfs_describe (struct proc* proc, const char* volume, const char* path, struct desc* desc,
|
||||
struct reschedule_ctx* rctx);
|
||||
|
||||
void vfs_init (void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user