got some of the pty actually working in userspace

This commit is contained in:
2026-07-12 03:56:25 -05:00
parent 992ffd1f6b
commit 3c6fd8cb65
16 changed files with 140 additions and 147 deletions

View File

@@ -0,0 +1,40 @@
#include "vfs.h"
#include <drivers/devfs/devfs.h>
#include <lib/memory.h>
#include <lib/string.h>
#include <lib/print.h>
static vfs_node_t* devfs_find(vfs_node_t* parent, const char* name) {
vfs_node_t* cur = parent->first_child;
if (!cur) return NULL;
while (cur) {
if (strcmp(cur->name, name) == 0) break;
cur = cur->next_sibling;
}
return cur;
}
static vfs_node_t* devfs_create(vfs_node_t* parent, const char* name) {
vfs_node_t* node = kalloc(sizeof(vfs_node_t*));
memset((void*)node, 0, sizeof(vfs_node_t));
strcpy(node->name, name);
node->flags = VFS_CHARDEVICE;
if (parent->first_child) {
node->next_sibling = parent->first_child;
}
parent->first_child = node;
return node;
}
vfs_node_t* create_devfs() {
vfs_node_t* root = kalloc(sizeof(vfs_node_t*));
memset((void*)root, 0, sizeof(vfs_node_t));
strcpy(root->name, "dev");
root->find = devfs_find;
root->flags = VFS_DIRECTORY;
root->create = devfs_create;
return root;
}