diff options
Diffstat (limited to 'Source/Kernel/Shell')
-rw-r--r-- | Source/Kernel/Shell/KernelShell-sys.class.cpp | 22 | ||||
-rw-r--r-- | Source/Kernel/Shell/KernelShell.class.cpp | 32 | ||||
-rw-r--r-- | Source/Kernel/Shell/KernelShell.class.h | 1 |
3 files changed, 28 insertions, 27 deletions
diff --git a/Source/Kernel/Shell/KernelShell-sys.class.cpp b/Source/Kernel/Shell/KernelShell-sys.class.cpp index b039c4d..06af11d 100644 --- a/Source/Kernel/Shell/KernelShell-sys.class.cpp +++ b/Source/Kernel/Shell/KernelShell-sys.class.cpp @@ -4,6 +4,8 @@ #include <MemoryManager/Mem.ns.h> #include <MemoryManager/PhysMem.ns.h> #include <VFS/Part.ns.h> +#include <VFS/VFS.ns.h> +#include <FileSystems/RamFS/RamFS.class.h> void KernelShell::devices(Vector<String>& args) { Vector<Device*> dev = Dev::findDevices(); @@ -59,6 +61,26 @@ void KernelShell::part(Vector<String>& args) { } } +void KernelShell::mount(Vector<String>& args) { + if (args.size() == 1) { + for (u32int i = 0; i < VFS::filesystems.size(); i++) { + *m_vt << VFS::filesystems[i]->getDevDescription() << " on " << VFS::path(VFS::filesystems[i]->getRootNode()) << "\n"; + } + } else if (args.size() == 2) { + if (args[1] == "help") { + *m_vt << "Usage: mount [help|<options>]\n" << + "Options formats :\n" << + " - <mountpoint>:ramfs\n" << + " - <mountpoint>:[<dev_class>]:<dev_number>:<part_number>[:<type>[:[ro|rw]]]\n" << + "You can have a list of available block devices and partitions by typing 'part'.\n"; + } else { + if (VFS::mount(args[1], m_vt)) *m_vt << "Ok, filesystem mounted.\n"; + } + } else { + *m_vt << "Usage: mount [<device> <mountpoint>\n"; + } +} + void KernelShell::readblock(Vector<String>& args) { if (args.size() == 3) { Vector<Device*> devcs = Dev::findDevices("block"); diff --git a/Source/Kernel/Shell/KernelShell.class.cpp b/Source/Kernel/Shell/KernelShell.class.cpp index f35b4dc..71a717a 100644 --- a/Source/Kernel/Shell/KernelShell.class.cpp +++ b/Source/Kernel/Shell/KernelShell.class.cpp @@ -3,9 +3,8 @@ #include <DeviceManager/Kbd.ns.h> #include <SimpleList.class.h> #include <MemoryManager/PhysMem.ns.h> -#include <VFS/VFS.ns.h> -#include <FileSystems/RamFS/RamFS.class.h> #include <TaskManager/Task.ns.h> +#include <VFS/VFS.ns.h> u32int KernelShell::m_instances = 0; @@ -62,6 +61,7 @@ u32int KernelShell::run() { {"uptime", &KernelShell::uptime}, {"part", &KernelShell::part}, {"readblock", &KernelShell::readblock}, + {"mount", &KernelShell::mount}, {"hexdump", &KernelShell::hexdump}, {0, 0} @@ -84,6 +84,9 @@ u32int KernelShell::run() { *m_vt << " - free shows memory usage (frames and kheap)\n"; *m_vt << " - uptime shows seconds since boot\n"; *m_vt << " - part shows all detected block devs and partitions\n"; + *m_vt << " - mount shows mounted devices or mounts a ramfs\n"; + *m_vt << " - readblock reads a block from a block device and dumps it\n"; + *m_vt << " - hexdump shows a hexadecimal dump of a file\n"; *m_vt << " - Standard UNIX commands : ls cd cat pwd rm mkdir wf\n"; *m_vt << " - Scroll up with shift+pgup !\n"; } else if (tokens[0] == "reboot") { @@ -95,31 +98,6 @@ u32int KernelShell::run() { } else if (tokens[0] == "exit") { if (tokens.size() == 1) return 0; return tokens[1].toInt(); - } else if (tokens[0] == "mount") { - if (tokens.size() == 1) { - for (u32int i = 0; i < VFS::filesystems.size(); i++) { - *m_vt << VFS::path(VFS::filesystems[i]->getRootNode()) << "\n"; - } - } else if (tokens.size() == 3) { - if (tokens[1] == "ramfs") { - FSNode* n = VFS::find(tokens[2], m_cwd); - if (n == 0) { - *m_vt << "No such directory.\n"; - } else if (n->type() != NT_DIRECTORY) { - *m_vt << "Not a directory.\n"; - } else { - if (RamFS::mount(100000, (DirectoryNode*)n) != 0) { - *m_vt << "Ok...\n"; - } else { - *m_vt << "Error !\n"; - } - } - } else { - *m_vt << "Not supported yet.\n"; - } - } else { - *m_vt << "Usage: mount [<device> <mountpoint>\n"; - } } else if (tokens[0] == "unmount") { if (tokens.size() == 2) { FSNode* n = VFS::find(tokens[1], m_cwd); diff --git a/Source/Kernel/Shell/KernelShell.class.h b/Source/Kernel/Shell/KernelShell.class.h index d3fd5e1..9655def 100644 --- a/Source/Kernel/Shell/KernelShell.class.h +++ b/Source/Kernel/Shell/KernelShell.class.h @@ -36,6 +36,7 @@ class KernelShell { void uptime(Vector<String>& args); void part(Vector<String>& args); void readblock(Vector<String>& args); + void mount(Vector<String>& args); void setup(DirectoryNode* cwd, VirtualTerminal *vt); |