Hello user process

This commit is contained in:
2025-09-01 23:22:47 +02:00
parent 13ab117b1b
commit 2015e0e0aa
28 changed files with 744 additions and 65 deletions

View File

@ -27,6 +27,22 @@ int32_t kvfs_read(struct VfsMountPoint *vmp, const char *key, uint8_t *const buf
return E_OK;
}
int32_t kvfs_stat(struct VfsMountPoint *vmp, const char *key, struct VfsStat *stat) {
KvfsNode *node = NULL;
spinlock_acquire(&vmp->spinlock);
HSHTB_GET(&vmp->fs.kvfs, nodes, (char *)key, key_, node);
spinlock_release(&vmp->spinlock);
if (node == NULL) {
return E_NOENTRY;
}
stat->type = VFS_TYPE_FILE;
stat->size = KVFS_BUFFER_SIZE;
return E_OK;
}
int32_t kvfs_write(struct VfsMountPoint *vmp, const char *key, const uint8_t *const buffer, size_t n, size_t off) {
KvfsNode *node = NULL;
@ -85,7 +101,7 @@ int32_t kvfs_create(struct VfsMountPoint *vmp, const char *path, int32_t type) {
bool kvfs_check(void) {
int32_t ret;
ret = vfs_create("tmpvars", "hello", VFS_CREATE_FILE);
ret = vfs_create("tmpvars", "hello", VFS_TYPE_FILE);
if (ret != E_OK) return false;
char *hello = "WAWAWAWA!!!";

View File

@ -5,6 +5,7 @@
#include <stdbool.h>
struct VfsMountPoint;
struct VfsStat;
#define KVFS_NODE_KEY_MAX 128
#define KVFS_NODES_MAX 256
@ -21,6 +22,7 @@ typedef struct {
} Kvfs;
int32_t kvfs_read(struct VfsMountPoint *vmp, const char *key, uint8_t *const buffer, size_t n, size_t off);
int32_t kvfs_stat(struct VfsMountPoint *vmp, const char *key, struct VfsStat *stat);
int32_t kvfs_write(struct VfsMountPoint *vmp, const char *key, const uint8_t *const buffer, size_t n, size_t off);
int32_t kvfs_remove(struct VfsMountPoint *vmp, const char *key);
int32_t kvfs_create(struct VfsMountPoint *vmp, const char *path, int32_t type);