diff options
author | Alexis211 <alexis211@gmail.com> | 2009-10-20 19:21:34 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-10-20 19:21:34 +0200 |
commit | 9836acd720988af30250c2c1ec18d618664dea4e (patch) | |
tree | 9e26d7d65e1693d1a7f9fd93c9fd33b41d175464 /Source/Kernel/VFS | |
parent | 90b49b6f171108f272ff529f7546bd9625ca7d17 (diff) | |
download | Melon-9836acd720988af30250c2c1ec18d618664dea4e.tar.gz Melon-9836acd720988af30250c2c1ec18d618664dea4e.zip |
Started working on a userland shell
This means I'll have to do syscalls for everything I need.
Diffstat (limited to 'Source/Kernel/VFS')
-rw-r--r-- | Source/Kernel/VFS/FSNode-sc.proto.cpp | 34 | ||||
-rw-r--r-- | Source/Kernel/VFS/FSNode.proto.h | 16 |
2 files changed, 48 insertions, 2 deletions
diff --git a/Source/Kernel/VFS/FSNode-sc.proto.cpp b/Source/Kernel/VFS/FSNode-sc.proto.cpp new file mode 100644 index 0000000..9e485e1 --- /dev/null +++ b/Source/Kernel/VFS/FSNode-sc.proto.cpp @@ -0,0 +1,34 @@ +#include "FSNode.proto.h" +#include <VFS/VFS.ns.h> + +call_t FSNode::m_callTable[] = { + CALL0(FNIF_GETNAME, &FSNode::getNameSC), + CALL0(FNIF_TYPE, &FSNode::typeSC), + CALL0(FNIF_GETPARENT, &FSNode::getParentSC), + CALL0(FNIF_GETLENGTH, &FSNode::getLengthSC), + CALL0(0, 0) +}; + +u32int FSNode::scall(u8int wat, u32int a, u32int b, u32int c, u32int d) { + if (wat == FNIF_SGETRFN) return VFS::getRootNode()->resId(); + return (u32int) - 1; +} + +u32int FSNode::getNameSC() { + return getName().serialize(); +} + +u32int FSNode::typeSC() { + return type(); +} + +u32int FSNode::getLengthSC() { + u64int* a = (u64int*)Mem::mkXchgSpace(sizeof(u64int)); + *a = getLength(); + return (u32int)a; +} + +u32int FSNode::getParentSC() { + if (m_parent != 0) return m_parent->resId(); + return (u32int) - 1; +} diff --git a/Source/Kernel/VFS/FSNode.proto.h b/Source/Kernel/VFS/FSNode.proto.h index c3cd1c1..b648141 100644 --- a/Source/Kernel/VFS/FSNode.proto.h +++ b/Source/Kernel/VFS/FSNode.proto.h @@ -5,6 +5,9 @@ #include <String.class.h> class FSNode; #include <VFS/FileSystem.proto.h> +#include <SyscallManager/Ressource.class.h> + +#include <FSNode.iface.h> enum { NT_FILE = 1, @@ -13,18 +16,27 @@ enum { NT_MOUNTPOINT = 4 }; -class FSNode { +class FSNode : public Ressource { protected: String m_name; u64int m_length; u32int m_permissions, m_uid, m_gid; FileSystem *m_fs; FSNode *m_parent; + + //Syscall related + static call_t m_callTable[]; + u32int getNameSC(); + u32int getLengthSC(); + u32int typeSC(); + u32int getParentSC(); public: + static u32int scall(u8int, u32int, u32int, u32int, u32int); + FSNode(String name, FileSystem* fs, FSNode* parent, u64int length = 0, u32int permissions = 0777, u32int uid = 0, u32int gid = 0) : - m_name(name), m_length(length), m_permissions(permissions), + Ressource(FNIF_OBJTYPE, m_callTable), m_name(name), m_length(length), m_permissions(permissions), m_uid(uid), m_gid(gid), m_fs(fs), m_parent(parent) {} virtual ~FSNode() {} |