All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m41s
64 lines
1.7 KiB
C
64 lines
1.7 KiB
C
#ifndef _KERNEL_FS_VFS_H
|
|
#define _KERNEL_FS_VFS_H
|
|
|
|
#include <desc.h>
|
|
#include <device/device.h>
|
|
#include <libk/hash.h>
|
|
#include <libk/list.h>
|
|
#include <libk/rbtree.h>
|
|
#include <libk/std.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_volume;
|
|
|
|
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_volume* volume, struct proc* proc, struct reschedule_ctx* rctx);
|
|
|
|
int (*describe) (struct vfs_volume* volume, const char* path, struct desc* desc);
|
|
|
|
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_volume_table {
|
|
struct hash_node_link* volume_buckets[1024];
|
|
spin_lock_t lock;
|
|
};
|
|
|
|
int vfs_create_volume (const char* key, int fs_type, struct device* back_device, struct proc* proc,
|
|
struct reschedule_ctx* rctx);
|
|
|
|
int vfs_volume_open (struct proc* proc, const char* volume, struct reschedule_ctx* rctx);
|
|
|
|
int vfs_volume_close (struct proc* proc, const char* volume, struct reschedule_ctx* rctx);
|
|
|
|
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_describe (struct proc* proc, const char* volume, const char* path, struct desc* desc,
|
|
struct reschedule_ctx* rctx);
|
|
|
|
void vfs_init (void);
|
|
|
|
#endif // _KERNEL_FS_VFS_H
|