VFS can now reschedule the calling process
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m48s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m48s
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
#include <limine/requests.h>
|
||||
#include <mm/liballoc.h>
|
||||
#include <path_defs.h>
|
||||
#include <proc/proc.h>
|
||||
#include <proc/reschedule.h>
|
||||
#include <status.h>
|
||||
#include <sys/debug.h>
|
||||
|
||||
@@ -63,7 +65,8 @@ static size_t tar_parse (struct tarfs* tarfs, uint8_t* addr, size_t max_size) {
|
||||
return i;
|
||||
}
|
||||
|
||||
int tarfs_mount (struct vfs_volume* volume, bool format) {
|
||||
int tarfs_mount (struct vfs_volume* volume, struct proc* proc, struct reschedule_ctx* rctx,
|
||||
bool format) {
|
||||
(void)format;
|
||||
|
||||
struct tarfs* tarfs = malloc (sizeof (*tarfs));
|
||||
@@ -107,7 +110,7 @@ int tarfs_mount (struct vfs_volume* volume, bool format) {
|
||||
size_t sector_count = 1;
|
||||
for (size_t sector = 0; sector < total_size / sector_size; sector++) {
|
||||
uint8_t* dest = (uint8_t*)((uintptr_t)buffer + (sector * sector_size));
|
||||
ret = device_op (back_device, XDRV_READ, NULL, NULL, §or, §or_count, dest);
|
||||
ret = device_op (back_device, XDRV_READ, proc, rctx, §or, §or_count, dest);
|
||||
}
|
||||
|
||||
spin_unlock (&back_device->lock);
|
||||
@@ -126,12 +129,15 @@ int tarfs_mount (struct vfs_volume* volume, bool format) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int tarfs_format (struct vfs_volume* volume) {
|
||||
(void)volume;
|
||||
int tarfs_format (struct vfs_volume* volume, struct proc* proc, struct reschedule_ctx* rctx) {
|
||||
(void)volume, (void)proc, (void)rctx;
|
||||
return ST_OK;
|
||||
}
|
||||
|
||||
int tarfs_describe (struct vfs_volume* volume, const char* path, struct desc* desc) {
|
||||
int tarfs_describe (struct vfs_volume* volume, struct proc* proc, struct reschedule_ctx* rctx,
|
||||
const char* path, struct desc* desc) {
|
||||
(void)proc, (void)rctx;
|
||||
|
||||
struct tarfs* tarfs = volume->udata;
|
||||
|
||||
if ((path[0] == '/') && (path[1] == '\0')) {
|
||||
@@ -163,9 +169,9 @@ int tarfs_describe (struct vfs_volume* volume, const char* path, struct desc* de
|
||||
}
|
||||
}
|
||||
|
||||
int tarfs_read_file (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
|
||||
size_t size) {
|
||||
(void)volume;
|
||||
int tarfs_read_file (struct vfs_volume* volume, struct proc* proc, struct reschedule_ctx* rctx,
|
||||
const char* path, uint8_t* buffer, size_t off, size_t size) {
|
||||
(void)volume, (void)proc, (void)rctx;
|
||||
|
||||
const char* filename = path_basename (path);
|
||||
|
||||
@@ -185,8 +191,10 @@ int tarfs_read_file (struct vfs_volume* volume, const char* path, uint8_t* buffe
|
||||
return ST_OK;
|
||||
}
|
||||
|
||||
int tarfs_read_dir_entry (struct vfs_volume* volume, const char* path, struct dir_entry* entry,
|
||||
size_t entry_num) {
|
||||
int tarfs_read_dir_entry (struct vfs_volume* volume, struct proc* proc, struct reschedule_ctx* rctx,
|
||||
const char* path, struct dir_entry* entry, size_t entry_num) {
|
||||
(void)proc, (void)rctx;
|
||||
|
||||
struct tarfs* tarfs = volume->udata;
|
||||
|
||||
if (strncmp (path, "/", PATH_MAX) != 0) {
|
||||
@@ -214,23 +222,27 @@ int tarfs_read_dir_entry (struct vfs_volume* volume, const char* path, struct di
|
||||
return -ST_DIR_NO_ENTRIES;
|
||||
}
|
||||
|
||||
int tarfs_write_file (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
|
||||
size_t size, uint32_t flags) {
|
||||
(void)volume, (void)path, (void)buffer, (void)off, (void)size, (void)flags;
|
||||
int tarfs_write_file (struct vfs_volume* volume, struct proc* proc, struct reschedule_ctx* rctx,
|
||||
const char* path, uint8_t* buffer, size_t off, size_t size, uint32_t flags) {
|
||||
(void)volume, (void)path, (void)buffer, (void)off;
|
||||
(void)size, (void)flags, (void)proc, (void)rctx;
|
||||
return ST_OK;
|
||||
}
|
||||
|
||||
int tarfs_create_file (struct vfs_volume* volume, const char* path) {
|
||||
(void)volume, (void)path;
|
||||
int tarfs_create_file (struct vfs_volume* volume, struct proc* proc, struct reschedule_ctx* rctx,
|
||||
const char* path) {
|
||||
(void)volume, (void)path, (void)proc, (void)rctx;
|
||||
return ST_OK;
|
||||
}
|
||||
|
||||
int tarfs_create_dir (struct vfs_volume* volume, const char* path) {
|
||||
(void)volume, (void)path;
|
||||
int tarfs_create_dir (struct vfs_volume* volume, struct proc* proc, struct reschedule_ctx* rctx,
|
||||
const char* path) {
|
||||
(void)volume, (void)path, (void)proc, (void)rctx;
|
||||
return ST_OK;
|
||||
}
|
||||
|
||||
int tarfs_remove (struct vfs_volume* volume, const char* path) {
|
||||
(void)volume, (void)path;
|
||||
int tarfs_remove (struct vfs_volume* volume, struct proc* proc, struct reschedule_ctx* rctx,
|
||||
const char* path) {
|
||||
(void)volume, (void)path, (void)proc, (void)rctx;
|
||||
return ST_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user