summaryrefslogtreecommitdiff
path: root/src/kernel/vfs
diff options
context:
space:
mode:
authorAlex AUVOLAT <alexis211@gmail.com>2012-05-17 17:56:23 +0200
committerAlex AUVOLAT <alexis211@gmail.com>2012-05-17 17:56:23 +0200
commit593bf4df3d8db49286c1a7ae4ef75c887b629930 (patch)
tree988a104c9611d72e1252282789688586efd9a394 /src/kernel/vfs
parent7c9a48b4e6d66cf4f62e7bad9e22ab06923e47ef (diff)
downloadTCE-593bf4df3d8db49286c1a7ae4ef75c887b629930.tar.gz
TCE-593bf4df3d8db49286c1a7ae4ef75c887b629930.zip
Devices using the VFS structure. Basic keyboard handler.
Diffstat (limited to 'src/kernel/vfs')
-rw-r--r--src/kernel/vfs/node.cpp10
-rw-r--r--src/kernel/vfs/node.h8
-rw-r--r--src/kernel/vfs/vdir.h1
3 files changed, 14 insertions, 5 deletions
diff --git a/src/kernel/vfs/node.cpp b/src/kernel/vfs/node.cpp
index 9900a3c..e174bd6 100644
--- a/src/kernel/vfs/node.cpp
+++ b/src/kernel/vfs/node.cpp
@@ -1,6 +1,5 @@
#include "node.h"
#include "vdir.h"
-#include <core/monitor.h>
int node::open(process *proc, int mode) {
//TODO : permission checks
@@ -17,13 +16,14 @@ int node::stat(file_info *info) {
return 0;
}
-node *root = 0;
+node *root = 0, *dot_dev = 0, *dot_ui = 0;
void vfs_setup() {
root = new vdir(0);
- root->add_child(".dev", new vdir(root));
-
- monitor_write("[VFS] ");
+ dot_dev = new vdir(root);
+ root->add_child(".dev", dot_dev);
+ dot_ui = new vdir(root);
+ root->add_child(".ui", dot_ui);
}
node* vfs_find(node* root, char* path) {
diff --git a/src/kernel/vfs/node.h b/src/kernel/vfs/node.h
index 2d16dab..9005d55 100644
--- a/src/kernel/vfs/node.h
+++ b/src/kernel/vfs/node.h
@@ -6,6 +6,8 @@
#include <task/task.h>
+class display;
+
class node {
public:
node* parent;
@@ -13,6 +15,7 @@ class node {
int mode, uid, gid;
node(node* p, int t) : parent(p), type(t) {}
+ virtual ~node() {}
virtual int open(process *proc, int mode);
virtual void close(process *proc) {}
@@ -22,11 +25,16 @@ class node {
virtual node* get_child(char* name) { return 0; }
virtual int add_child(char* name, node *child) { return E_NOT_IMPLEMENTED; }
virtual size_t get_size() { return 0; }
+
+ // kind of like dynamic_cast'int these things
+ virtual display *as_display() { return 0; }
};
void vfs_setup();
node* vfs_find(node* root, char* filename);
+extern node *root, *dot_dev, *dot_ui;
+
// syscall interface
FILE open(char* filename, int mode);
FILE open_relative(FILE root, char* filename, int mode);
diff --git a/src/kernel/vfs/vdir.h b/src/kernel/vfs/vdir.h
index 9595409..609a504 100644
--- a/src/kernel/vfs/vdir.h
+++ b/src/kernel/vfs/vdir.h
@@ -20,6 +20,7 @@ class vdir : public node {
public:
vdir(node* parent);
+ virtual ~vdir() {}
virtual int read(size_t offset, size_t len, char* buffer);
virtual int write(size_t offset, size_t len, char* buffer); // rename file