aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFranklin Wei <frankhwei536@gmail.com>2015-03-02 21:37:44 -0500
committerFranklin Wei <frankhwei536@gmail.com>2015-03-02 21:37:44 -0500
commita0721b4caa79b81e021678089fde0b8467daa1cd (patch)
tree56af15c29704cc4c6738345ccd6c9db3782fd8d1 /include
parent46e94578765d3d2f03b83421d752e5dfc3e56d34 (diff)
downloadkappa-master.zip
kappa-master.tar.gz
kappa-master.tar.bz2
kappa-master.tar.xz
Virtual filesystem WIP!HEADmaster
Diffstat (limited to '')
-rw-r--r--include/arch/i686/drivers/ps2kbd.h2
-rw-r--r--include/kernel/heap.h2
-rw-r--r--include/kernel/multiboot.h12
-rw-r--r--include/kernel/vfs.h48
-rw-r--r--include/string.h3
5 files changed, 66 insertions, 1 deletions
diff --git a/include/arch/i686/drivers/ps2kbd.h b/include/arch/i686/drivers/ps2kbd.h
index 9e353ee..a9e2bf9 100644
--- a/include/arch/i686/drivers/ps2kbd.h
+++ b/include/arch/i686/drivers/ps2kbd.h
@@ -50,6 +50,8 @@ struct ps2_specialkeys_t {
struct ps2_keyevent {
const struct ps2_specialkeys_t *special_keys;
char ascii;
+ uint8_t scancode;
+ uint8_t ps2_scancode_set;
};
/* returns which arrow keys are down */
diff --git a/include/kernel/heap.h b/include/kernel/heap.h
index dfadf36..abb9bdf 100644
--- a/include/kernel/heap.h
+++ b/include/kernel/heap.h
@@ -1,5 +1,7 @@
#include <stddef.h>
+#include <stdint.h>
void *kmalloc(size_t);
void *kmalloc_a(size_t);
void *kmalloc_p(size_t, void**);
void *kmalloc_ap(size_t, void**);
+void kmalloc_set_addr(uint32_t);
diff --git a/include/kernel/multiboot.h b/include/kernel/multiboot.h
index e1f7cf0..2d415bf 100644
--- a/include/kernel/multiboot.h
+++ b/include/kernel/multiboot.h
@@ -1,3 +1,6 @@
+#ifndef _MULTIBOOT_H_
+#define _MULTIBOOT_H_
+
#include <stdint.h>
struct multiboot_aout_symbol_table_t
@@ -38,6 +41,13 @@ struct vbe_info_t {
uint16_t reserved2;
} __attribute__((packed));
+struct multiboot_mod_t {
+ uint32_t mod_start;
+ uint32_t mod_end;
+ uint32_t mod_str;
+ uint32_t reserved;
+} __attribute__((packed));
+
struct multiboot_info_t
{
/* Multiboot info version number */
@@ -88,3 +98,5 @@ struct multiboot_info_t
uint16_t vbe_interface_off;
uint16_t vbe_interface_len;
} __attribute__((packed));
+
+#endif
diff --git a/include/kernel/vfs.h b/include/kernel/vfs.h
new file mode 100644
index 0000000..4977665
--- /dev/null
+++ b/include/kernel/vfs.h
@@ -0,0 +1,48 @@
+#include <stdint.h>
+
+#define VFS_DIR 0
+#define VFS_REG 1
+#define VFS_SPEC 2
+
+#define VFS_TYPEMASK 0x3
+
+struct vfs_node {
+ unsigned int flags;
+ char *name;
+ uint64_t file_len;
+ unsigned char *contents;
+ struct vfs_node *parent;
+ struct vfs_node *next;
+ struct vfs_node *child;
+};
+
+#define DT_BLK (1<<0)
+#define DT_CHR (1<<1)
+#define DT_DIR (1<<2)
+#define DT_FIFO (1<<3)
+#define DT_LNK (1<<4)
+#define DT_REG (1<<5)
+#define DT_SOCK (1<<6)
+#define DT_UNKNOWN (1<<7)
+
+struct dirent {
+ unsigned char d_type;
+ char d_name[256];
+};
+
+/* initializes an empty filesystem on the heap */
+struct vfs_node *vfs_init(void);
+
+/* creates a new, empty directory UNDER a directory node */
+int vfs_mkdir(struct vfs_node*, const char *name);
+
+/* creates a new, empty, regular file under a directory node */
+int vfs_creat(struct vfs_node*, const char *name);
+
+typedef struct DIR {
+ struct vfs_node *node;
+} DIR;
+
+DIR *vfs_opendir(struct vfs_node*);
+
+struct dirent *vfs_readdir(DIR *dirp);
diff --git a/include/string.h b/include/string.h
index 05050a0..b829978 100644
--- a/include/string.h
+++ b/include/string.h
@@ -1,4 +1,5 @@
#include <stddef.h>
-int strlen(const char*);
+size_t strlen(const char*);
void* memset(void*, int, size_t);
void* memcpy(void*, void*, size_t);
+char* strdup(const char*);