VFS mountpoint backing device system
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m24s

This commit is contained in:
2026-02-16 23:48:45 +01:00
parent 7726fd2f00
commit 9aea870159
22 changed files with 528 additions and 241 deletions

View File

@@ -1,6 +1,7 @@
#ifndef _KERNEL_FS_VFS_H
#define _KERNEL_FS_VFS_H
#include <device/device.h>
#include <libk/hash.h>
#include <libk/list.h>
#include <libk/std.h>
@@ -8,7 +9,7 @@
#include <proc/procgroup.h>
#include <sync/spin_lock.h>
#define VFS_RAMDISKFS 0
#define VFS_TARFS 0
struct vfs_mountpoint {
char key[0x100];
@@ -18,12 +19,14 @@ struct vfs_mountpoint {
bool locked;
struct procgroup* ownerpg;
struct {
bool (*mount) (struct vfs_mountpoint* mountpoint);
int (*mount) (struct vfs_mountpoint* mountpoint, struct device_op_ctx* op_ctx);
int (*describe) (struct vfs_mountpoint* mountpoint, const char* path,
struct fs_desc_buffer* desc);
int (*read) (struct vfs_mountpoint* mountpoint, const char* path, uint8_t* buffer, size_t off,
size_t size);
} driver_ops;
struct device* back_device;
void* udata
};
struct vfs_mount_table {
@@ -31,14 +34,21 @@ struct vfs_mount_table {
spin_lock_t lock;
};
struct vfs_mountpoint* vfs_create_mountpoint (const char* key, int fs_type);
int vfs_create_mountpoint (const char* key, int fs_type, struct device* back_device,
struct device_op_ctx* op_ctx);
int vfs_describe (struct procgroup* procgroup, const char* mountpoint, const char* path,
struct fs_desc_buffer* desc);
int vfs_read (struct procgroup* procgroup, const char* mountpoint, const char* path,
uint8_t* buffer, size_t off, size_t size);
int vfs_close (struct procgroup* procgroup, const char* mountpoint, const char* path);
int vfs_open (struct procgroup* procgroup, const char* mountpoint, const char* path);
void vfs_procgroup_cleanup (struct procgroup* procgroup);
void vfs_init (void);
#endif // _KERNEL_FS_VFS_H