diff options
author | Alexis211 <alexis211@gmail.com> | 2009-11-29 12:30:07 +0100 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-11-29 12:30:07 +0100 |
commit | 74dea7d492d6d352bfacb147b1c08ad0cf0a8b29 (patch) | |
tree | f613c8395b75a68e51d69c24eb3acdb0816ad509 /Source/Kernel/Shell/KernelShell.class.cpp | |
parent | d3e4ef59cbb45f02e07fe17fb7c58cba3c737900 (diff) | |
parent | a913d4c2cb4daf10c0eac4d548fccb26b2a9f099 (diff) | |
download | Melon-74dea7d492d6d352bfacb147b1c08ad0cf0a8b29.tar.gz Melon-74dea7d492d6d352bfacb147b1c08ad0cf0a8b29.zip |
Merge branch 'mountpoints' of github.com:Alexis211/Melon into mountpoints
Diffstat (limited to 'Source/Kernel/Shell/KernelShell.class.cpp')
-rw-r--r-- | Source/Kernel/Shell/KernelShell.class.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/Source/Kernel/Shell/KernelShell.class.cpp b/Source/Kernel/Shell/KernelShell.class.cpp index d62d822..71a717a 100644 --- a/Source/Kernel/Shell/KernelShell.class.cpp +++ b/Source/Kernel/Shell/KernelShell.class.cpp @@ -3,8 +3,8 @@ #include <DeviceManager/Kbd.ns.h> #include <SimpleList.class.h> #include <MemoryManager/PhysMem.ns.h> -#include <VFS/VFS.ns.h> #include <TaskManager/Task.ns.h> +#include <VFS/VFS.ns.h> u32int KernelShell::m_instances = 0; @@ -60,6 +60,9 @@ u32int KernelShell::run() { {"free", &KernelShell::free}, {"uptime", &KernelShell::uptime}, {"part", &KernelShell::part}, + {"readblock", &KernelShell::readblock}, + {"mount", &KernelShell::mount}, + {"hexdump", &KernelShell::hexdump}, {0, 0} }; @@ -81,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") { @@ -92,6 +98,26 @@ u32int KernelShell::run() { } else if (tokens[0] == "exit") { if (tokens.size() == 1) return 0; return tokens[1].toInt(); + } else if (tokens[0] == "unmount") { + if (tokens.size() == 2) { + FSNode* n = VFS::find(tokens[1], m_cwd); + bool ok = false; + if (n == 0) { + ok = false; + } else { + String p = VFS::path(n); + for (u32int i = 0; i < VFS::filesystems.size(); i++) { + if (VFS::path(VFS::filesystems[i]->getRootNode()) == p) { + ok = VFS::unmount(VFS::filesystems[i]); + break; + } + } + } + if (ok) *m_vt << "Ok, filesystem unmounted.\n"; + else *m_vt << "Error.\n"; + } else { + *m_vt << "Usage: unmount <mountpoint>\n"; + } } else if (tokens[0] != "" or tokens.size() != 1) { u32int i = 0; bool found = false; |