summaryrefslogtreecommitdiff
path: root/Source/Library/Userland
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-10-23 20:43:48 +0200
committerAlexis211 <alexis211@gmail.com>2009-10-23 20:43:48 +0200
commit66630e4154b7c1c47d6223fe5a8607cd269446a0 (patch)
tree21995ed408e9ecbaba48f29ed67c91c4b0dad950 /Source/Library/Userland
parent48de0cd029b52f64f76345b6e1fdf3cde5c58de3 (diff)
downloadMelon-66630e4154b7c1c47d6223fe5a8607cd269446a0.tar.gz
Melon-66630e4154b7c1c47d6223fe5a8607cd269446a0.zip
Some changes, and implemented rm in userland shell.
Diffstat (limited to 'Source/Library/Userland')
-rw-r--r--Source/Library/Userland/Binding/FSNode.class.h37
-rw-r--r--Source/Library/Userland/Binding/Process.class.h5
-rw-r--r--Source/Library/Userland/Binding/Thread.class.h5
-rw-r--r--Source/Library/Userland/Binding/VirtualTerminal.class.h5
4 files changed, 40 insertions, 12 deletions
diff --git a/Source/Library/Userland/Binding/FSNode.class.h b/Source/Library/Userland/Binding/FSNode.class.h
index 61ac991..1fdc7ef 100644
--- a/Source/Library/Userland/Binding/FSNode.class.h
+++ b/Source/Library/Userland/Binding/FSNode.class.h
@@ -1,17 +1,11 @@
+#ifndef DEF_FSNODE_CLASS_H
+#define DEF_FSNODE_CLASS_H
+
#include <Syscall/RessourceCaller.class.h>
#include <FSNode.iface.h>
class FSNode : public RessourceCaller {
public:
- static FSNode getRoot() {
- 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) {}
String getName() {
@@ -41,13 +35,32 @@ class FSNode : public RessourceCaller {
void setCwd() {
doCall(FNIF_SETCWD);
}
+ bool remove() {
+ return doCall(FNIF_REMOVE) != 0;
+ }
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()));
- }
};
+
+namespace FS {
+
+inline FSNode rootNode() {
+ return FSNode(RessourceCaller::sCall(FNIF_OBJTYPE, FNIF_SGETRFN));
+}
+
+inline FSNode cwdNode() {
+ return FSNode(RessourceCaller::sCall(FNIF_OBJTYPE, FNIF_SGETCWD));
+}
+
+inline FSNode find(String name, FSNode cwd = FSNode(0)) {
+ if (!cwd.valid()) cwd = rootNode();
+ return FSNode(RessourceCaller::sCall(FNIF_OBJTYPE, FNIF_SFIND, (u32int)&name, cwd.resId()));
+}
+
+}
+
+#endif
diff --git a/Source/Library/Userland/Binding/Process.class.h b/Source/Library/Userland/Binding/Process.class.h
index 935bb39..ddca6be 100644
--- a/Source/Library/Userland/Binding/Process.class.h
+++ b/Source/Library/Userland/Binding/Process.class.h
@@ -1,3 +1,6 @@
+#ifndef DEF_PROCESS_CLASS_H
+#define DEF_PROCESS_CLASS_H
+
#include <Syscall/RessourceCaller.class.h>
#include <Process.iface.h>
@@ -30,3 +33,5 @@ class Process : public RessourceCaller {
return String::unserialize(doCall(PRIF_GETCMDLINE));
}
};
+
+#endif
diff --git a/Source/Library/Userland/Binding/Thread.class.h b/Source/Library/Userland/Binding/Thread.class.h
index a19c256..1588d8c 100644
--- a/Source/Library/Userland/Binding/Thread.class.h
+++ b/Source/Library/Userland/Binding/Thread.class.h
@@ -1,3 +1,6 @@
+#ifndef DEF_THREAD_CLASS_H
+#define DEF_THREAD_CLASS_H
+
#include <Syscall/RessourceCaller.class.h>
#include <Thread.iface.h>
@@ -17,3 +20,5 @@ class Thread : public RessourceCaller {
doCall(THIF_FINISH, errcode);
}
};
+
+#endif
diff --git a/Source/Library/Userland/Binding/VirtualTerminal.class.h b/Source/Library/Userland/Binding/VirtualTerminal.class.h
index 06a8dd7..1bfce85 100644
--- a/Source/Library/Userland/Binding/VirtualTerminal.class.h
+++ b/Source/Library/Userland/Binding/VirtualTerminal.class.h
@@ -1,3 +1,6 @@
+#ifndef DEF_VIRTUALTERMINAL_CLASS_H
+#define DEF_VIRTUALTERMINAL_CLASS_H
+
#include <Syscall/RessourceCaller.class.h>
#include <VirtualTerminal.iface.h>
@@ -52,3 +55,5 @@ class VirtualTerminal : public RessourceCaller {
};
extern VirtualTerminal invt, outvt;
+
+#endif