Files
mop3/kernel/fs/vfs.h
kamkow1 389f250d0b
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m24s
Rename fs_desc_buffer to desc
2026-02-22 00:11:09 +01:00

59 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/std.h>
#include <proc/proc.h>
#include <proc/procgroup.h>
#include <proc/reschedule.h>
#include <sync/spin_lock.h>
#define VFS_TARFS 0
struct vfs_mountpoint {
char key[0x100];
struct hash_node_link mount_table_link;
int fs_type;
spin_lock_t lock;
bool locked;
struct procgroup* ownerpg;
struct {
int (*mount) (struct vfs_mountpoint* mountpoint, struct proc* proc,
struct reschedule_ctx* rctx);
int (*describe) (struct vfs_mountpoint* mountpoint, const char* path, struct desc* 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 {
struct hash_node_link* mountpoint_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_describe (struct procgroup* procgroup, const char* mountpoint, const char* path,
struct desc* 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