All checks were successful
Build documentation / build-and-deploy (push) Successful in 27s
43 lines
1.2 KiB
C
43 lines
1.2 KiB
C
#ifndef _KERNEL_FS_VFS_H
|
|
#define _KERNEL_FS_VFS_H
|
|
|
|
#include <libk/hash.h>
|
|
#include <libk/list.h>
|
|
#include <libk/std.h>
|
|
#include <m/fs_desc_buffer.h>
|
|
#include <sync/spin_lock.h>
|
|
|
|
#define VFS_OK 0
|
|
#define VFS_EXISTS 1
|
|
#define VFS_NOT_FOUND 2
|
|
#define VFS_BAD_PATH 3
|
|
#define VFS_OOB_ERROR 4
|
|
|
|
#define VFS_RAMDISKFS 0
|
|
|
|
struct vfs_mountpoint {
|
|
char key[0x100];
|
|
struct hash_node_link mount_table_link;
|
|
int fs_type;
|
|
spin_lock_t lock;
|
|
struct {
|
|
bool (*mount) (struct vfs_mountpoint* mountpoint);
|
|
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 vfs_mount_table {
|
|
struct hash_node_link* mountpoint_buckets[1024];
|
|
spin_lock_t lock;
|
|
};
|
|
|
|
struct vfs_mountpoint* vfs_create_mountpoint (const char* key, int fs_type);
|
|
int vfs_describe (const char* mountpoint, const char* path, struct fs_desc_buffer* desc);
|
|
int vfs_read (const char* mountpoint, const char* path, uint8_t* buffer, size_t off, size_t size);
|
|
void vfs_init (void);
|
|
|
|
#endif // _KERNEL_FS_VFS_H
|