summaryrefslogtreecommitdiff
path: root/src/kernel/vfs/node.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/vfs/node.h')
-rw-r--r--src/kernel/vfs/node.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/kernel/vfs/node.h b/src/kernel/vfs/node.h
new file mode 100644
index 0000000..2d16dab
--- /dev/null
+++ b/src/kernel/vfs/node.h
@@ -0,0 +1,41 @@
+#ifndef DEF_VFS_NODE_H
+#define DEF_VFS_NODE_H
+
+#include <tce/vfs.h>
+#include <tce/syscalls.h>
+
+#include <task/task.h>
+
+class node {
+ public:
+ node* parent;
+ int type, dev_type;
+ int mode, uid, gid;
+
+ node(node* p, int t) : parent(p), type(t) {}
+
+ virtual int open(process *proc, int mode);
+ virtual void close(process *proc) {}
+ virtual int read(size_t offset, size_t len, char *buffer) { return E_NOT_IMPLEMENTED; }
+ virtual int write(size_t offset, size_t len, char* buffer) { return E_NOT_IMPLEMENTED; }
+ int stat(file_info *info);
+ 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; }
+};
+
+void vfs_setup();
+node* vfs_find(node* root, char* filename);
+
+// syscall interface
+FILE open(char* filename, int mode);
+FILE open_relative(FILE root, char* filename, int mode);
+int stat(char* filename, file_info *info);
+int stat_relative(FILE root, char* filename, file_info *info);
+int statf(FILE file, file_info *info);
+void close(FILE file);
+int read(FILE file, size_t offset, size_t len, char *buffer);
+int write(FILE file, size_t offset, size_t len, char *buffer);
+int link(char* from, char* to, int mode);
+
+#endif