Wrap filesystem op in macros
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m32s

This commit is contained in:
2026-03-15 14:50:13 +01:00
parent cd5604da43
commit d7bfc5c8fd
5 changed files with 85 additions and 93 deletions

View File

@@ -65,9 +65,7 @@ static size_t tar_parse (struct tarfs* tarfs, uint8_t* addr, size_t max_size) {
return i;
}
int tarfs_mount (struct vfs_volume* volume, struct proc* proc, struct reschedule_ctx* rctx,
bool format) {
(void)format;
DEFINE_VFS_MOUNT (tarfs_mount) {
uint64_t fd;
struct tarfs* tarfs = malloc (sizeof (*tarfs));
@@ -130,15 +128,9 @@ int tarfs_mount (struct vfs_volume* volume, struct proc* proc, struct reschedule
return ret;
}
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, struct proc* proc, struct reschedule_ctx* rctx,
const char* path, struct desc* desc) {
(void)proc, (void)rctx;
DEFINE_VFS_FORMAT (tarfs_format) { return ST_OK; }
DEFINE_VFS_DESCRIBE (tarfs_describe) {
struct tarfs* tarfs = volume->udata;
if ((path[0] == '/') && (path[1] == '\0')) {
@@ -170,10 +162,7 @@ int tarfs_describe (struct vfs_volume* volume, struct proc* proc, struct resched
}
}
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;
DEFINE_VFS_READ_FILE (tarfs_read_file) {
const char* filename = path_basename (path);
if (filename == NULL)
@@ -192,10 +181,7 @@ int tarfs_read_file (struct vfs_volume* volume, struct proc* proc, struct resche
return ST_OK;
}
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;
DEFINE_VFS_READ_DIR_ENTRY (tarfs_read_dir_entry) {
struct tarfs* tarfs = volume->udata;
if (strncmp (path, "/", PATH_MAX) != 0) {
@@ -223,27 +209,10 @@ int tarfs_read_dir_entry (struct vfs_volume* volume, struct proc* proc, struct r
return -ST_DIR_NO_ENTRIES;
}
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;
}
DEFINE_VFS_WRITE_FILE (tarfs_write_file) { return ST_OK; }
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;
}
DEFINE_VFS_CREATE_FILE (tarfs_create_file) { return ST_OK; }
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;
}
DEFINE_VFS_CREATE_DIR (tarfs_create_dir) { return ST_OK; }
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;
}
DEFINE_VFS_REMOVE (tarfs_remove) { return ST_OK; }