Espresso 0.0.2c

This commit is contained in:
2026-03-20 16:57:08 -05:00
parent 021fdbbcef
commit 5971218b56
77 changed files with 4538 additions and 518 deletions

View File

@ -1,24 +1,76 @@
#include <stdlib.h>
#include <string.h>
#include <tty.h>
#include <fs/vfs.h>
/* we use something similar to the Linux kernel in terms of a VFS system */
typedef struct vfs_file_header {
char* filename; /* The filename, not the path. */
int32_t fd;
uint8_t type_info; /* Bits 0 - 3 -> File type, Bits 4 - 7 FS type */
uint16_t* fs_header;
struct vfs_file_header* next; /* Linked list */
} vfs_file_header_t;
#define MAX_FDS 64
struct inode {
size_t size;
int permissions;
void *fs_data; /* FS-specific */
};
struct file_ops {
int (*read)(struct file*, char*, size_t);
int (*write)(struct file*, const char*, size_t);
};
struct file {
struct inode* f_inode;
size_t f_offset;
size_t f_refcount;
const struct file_ops f_ops;
};
vfs_file_header_t* root;
struct fdtable {
struct file* fds[MAX_FDS];
};
int vfs_handle_stdout(struct file* __f, const char* __s, size_t __l)
{
(void) __f;
terminal_write(__s, __l);
return 0;
}
struct fdtable* vfs_init_kernel_fdtable(void)
{
#if 0
struct fdtable* ft = malloc(sizeof(struct fdtable));
struct file* _stdout = malloc(sizeof(struct file));
struct file* _stdin = malloc(sizeof(struct file));
if (!ft || !_stdin || !_stdout)
{
return NULL;
}
_stdout->f_inode = NULL;
_stdout->f_offset = 0;
_stdout->f_refcount = 1;
_stdout->f_ops = { .read = NULL, .write = vfs_handle_stdout };
#endif
return NULL;
}
int init_vfs(int argc, char** argv)
{
(void) argc;
(void) argv;
return 0;
}
/*
@ -28,5 +80,7 @@ vfs_file_header_t* root;
wow.
and now my CPU fan is going nuts.
--update: now it works. I had to go back to nouveau instead of the proprietary nVidia drivers..
--update: now it works. I had to go back to nouveau instead of the proprietary nVidia®©™ drivers..
--update: I wrote what months ago. now is 3/12/2026, I don't even remember what was going on well. wow.
*/