VFS can now reschedule the calling process
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m48s

This commit is contained in:
2026-03-11 19:07:22 +01:00
parent e765855309
commit 04b7355a3d
10 changed files with 196 additions and 120 deletions

View File

@@ -37,7 +37,8 @@ static struct vfs_volume* vfs_find_volume (const char* volume) {
return hash_entry (found_link, struct vfs_volume, volume_table_link);
}
int vfs_create_volume (const char* key, int fs_type, struct device* back_device, bool format) {
int vfs_create_volume (struct proc* proc, struct reschedule_ctx* rctx, const char* key, int fs_type,
struct device* back_device, bool format) {
if (strlen_null (key) > VOLUME_MAX)
return -ST_OOB_ERROR;
@@ -92,7 +93,7 @@ int vfs_create_volume (const char* key, int fs_type, struct device* back_device,
return -ST_MOUNT_ERROR;
}
int ret = volume->driver_ops.mount (volume, format);
int ret = volume->driver_ops.mount (volume, proc, rctx, format);
if (ret < 0) {
free (volume);
@@ -170,7 +171,7 @@ int vfs_volume_close (struct proc* proc, const char* volume_name, struct resched
return ST_OK;
}
int vfs_format (struct proc* proc, const char* volume_name) {
int vfs_format (struct proc* proc, struct reschedule_ctx* rctx, const char* volume_name) {
struct vfs_volume* volume = vfs_find_volume (volume_name);
if (volume == NULL)
@@ -185,11 +186,11 @@ int vfs_format (struct proc* proc, const char* volume_name) {
spin_unlock (&volume->lock);
return volume->driver_ops.format (volume);
return volume->driver_ops.format (volume, proc, rctx);
}
int vfs_read_file (struct proc* proc, const char* volume_name, const char* path, uint8_t* buffer,
size_t off, size_t size) {
int vfs_read_file (struct proc* proc, struct reschedule_ctx* rctx, const char* volume_name,
const char* path, uint8_t* buffer, size_t off, size_t size) {
struct vfs_volume* volume = vfs_find_volume (volume_name);
if (volume == NULL)
@@ -204,11 +205,11 @@ int vfs_read_file (struct proc* proc, const char* volume_name, const char* path,
spin_unlock (&volume->lock);
return volume->driver_ops.read_file (volume, path, buffer, off, size);
return volume->driver_ops.read_file (volume, proc, rctx, path, buffer, off, size);
}
int vfs_write_file (struct proc* proc, const char* volume_name, const char* path, uint8_t* buffer,
size_t off, size_t size, uint32_t flags) {
int vfs_write_file (struct proc* proc, struct reschedule_ctx* rctx, const char* volume_name,
const char* path, uint8_t* buffer, size_t off, size_t size, uint32_t flags) {
struct vfs_volume* volume = vfs_find_volume (volume_name);
if (volume == NULL)
@@ -223,10 +224,11 @@ int vfs_write_file (struct proc* proc, const char* volume_name, const char* path
spin_unlock (&volume->lock);
return volume->driver_ops.write_file (volume, path, buffer, off, size, flags);
return volume->driver_ops.write_file (volume, proc, rctx, path, buffer, off, size, flags);
}
int vfs_create_file (struct proc* proc, const char* volume_name, const char* path) {
int vfs_create_file (struct proc* proc, struct reschedule_ctx* rctx, const char* volume_name,
const char* path) {
struct vfs_volume* volume = vfs_find_volume (volume_name);
if (volume == NULL)
@@ -241,10 +243,11 @@ int vfs_create_file (struct proc* proc, const char* volume_name, const char* pat
spin_unlock (&volume->lock);
return volume->driver_ops.create_file (volume, path);
return volume->driver_ops.create_file (volume, proc, rctx, path);
}
int vfs_describe (struct proc* proc, const char* volume_name, const char* path, struct desc* desc) {
int vfs_describe (struct proc* proc, struct reschedule_ctx* rctx, const char* volume_name,
const char* path, struct desc* desc) {
struct vfs_volume* volume = vfs_find_volume (volume_name);
if (volume == NULL)
@@ -259,11 +262,11 @@ int vfs_describe (struct proc* proc, const char* volume_name, const char* path,
spin_unlock (&volume->lock);
return volume->driver_ops.describe (volume, path, desc);
return volume->driver_ops.describe (volume, proc, rctx, path, desc);
}
int vfs_read_dir_entry (struct proc* proc, const char* volume_name, const char* path,
struct dir_entry* entry, size_t entry_num) {
int vfs_read_dir_entry (struct proc* proc, struct reschedule_ctx* rctx, const char* volume_name,
const char* path, struct dir_entry* entry, size_t entry_num) {
struct vfs_volume* volume = vfs_find_volume (volume_name);
if (volume == NULL)
@@ -278,10 +281,11 @@ int vfs_read_dir_entry (struct proc* proc, const char* volume_name, const char*
spin_unlock (&volume->lock);
return volume->driver_ops.read_dir_entry (volume, path, entry, entry_num);
return volume->driver_ops.read_dir_entry (volume, proc, rctx, path, entry, entry_num);
}
int vfs_create_dir (struct proc* proc, const char* volume_name, const char* path) {
int vfs_create_dir (struct proc* proc, struct reschedule_ctx* rctx, const char* volume_name,
const char* path) {
struct vfs_volume* volume = vfs_find_volume (volume_name);
if (volume == NULL)
@@ -296,10 +300,11 @@ int vfs_create_dir (struct proc* proc, const char* volume_name, const char* path
spin_unlock (&volume->lock);
return volume->driver_ops.create_dir (volume, path);
return volume->driver_ops.create_dir (volume, proc, rctx, path);
}
int vfs_remove (struct proc* proc, const char* volume_name, const char* path) {
int vfs_remove (struct proc* proc, struct reschedule_ctx* rctx, const char* volume_name,
const char* path) {
struct vfs_volume* volume = vfs_find_volume (volume_name);
if (volume == NULL)
@@ -314,7 +319,7 @@ int vfs_remove (struct proc* proc, const char* volume_name, const char* path) {
spin_unlock (&volume->lock);
return volume->driver_ops.remove (volume, path);
return volume->driver_ops.remove (volume, proc, rctx, path);
}
void vfs_init (void) {