From 48de0cd029b52f64f76345b6e1fdf3cde5c58de3 Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Fri, 23 Oct 2009 19:40:08 +0200 Subject: More work on syscalls and shell --- Source/Library/Interface/FSNode.iface.h | 6 ++++++ Source/Library/Userland/Binding/FSNode.class.h | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'Source/Library') diff --git a/Source/Library/Interface/FSNode.iface.h b/Source/Library/Interface/FSNode.iface.h index fd99bab..cba4621 100644 --- a/Source/Library/Interface/FSNode.iface.h +++ b/Source/Library/Interface/FSNode.iface.h @@ -12,6 +12,8 @@ enum { //S : static, GET : get, R : root, FN : fsnode #define FNIF_SGETRFN 0 +#define FNIF_SGETCWD 1 //Get current working directory +#define FNIF_SFIND 2 //Find a node following a path from a node #define FNIF_GETNAME 0x10 #define FNIF_TYPE 0x11 @@ -21,5 +23,9 @@ enum { #define FNIF_GETGID 0x15 #define FNIF_GETPERM 0x16 #define FNIF_GETPATH 0x17 +#define FNIF_SETCWD 0x18 //Sets node as current working directory + +#define FNIF_GETIDXCHILD 0x20 //Get child node from index +#define FNIF_GETNAMECHILD 0x21 //Get child node from name #endif diff --git a/Source/Library/Userland/Binding/FSNode.class.h b/Source/Library/Userland/Binding/FSNode.class.h index 95802a4..61ac991 100644 --- a/Source/Library/Userland/Binding/FSNode.class.h +++ b/Source/Library/Userland/Binding/FSNode.class.h @@ -4,7 +4,13 @@ class FSNode : public RessourceCaller { public: static FSNode getRoot() { - return FSNode(RessourceCaller::sCall(FNIF_OBJTYPE, FNIF_SGETRFN)); + return FSNode(sCall(FNIF_OBJTYPE, FNIF_SGETRFN)); + } + static FSNode getCwd() { + return FSNode(sCall(FNIF_OBJTYPE, FNIF_SGETCWD)); + } + static FSNode find(String path) { //Finds a node starting from root node + return FSNode(sCall(FNIF_OBJTYPE, FNIF_SFIND, (u32int)&path, 0)); } FSNode(u32int id) : RessourceCaller(id, FNIF_OBJTYPE) {} @@ -32,4 +38,16 @@ class FSNode : public RessourceCaller { String path() { return String::unserialize(doCall(FNIF_GETPATH)); } + void setCwd() { + doCall(FNIF_SETCWD); + } + FSNode getChild(u32int idx) { + return FSNode(doCall(FNIF_GETIDXCHILD, idx)); + } + FSNode getChild(String name) { + return FSNode(doCall(FNIF_GETNAMECHILD, (u32int)&name)); + } + FSNode findFrom(String path) { //Search a filesystem node starting from here + return FSNode(sCall(FNIF_OBJTYPE, FNIF_SFIND, (u32int)&path, resId())); + } }; -- cgit v1.2.3