mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:48:11 +00:00
Add a simple /proc/mounts that enumerates the current VFS mounts.
This commit is contained in:
parent
a447359916
commit
81627cf7d5
6 changed files with 46 additions and 17 deletions
|
@ -1,5 +1,6 @@
|
|||
#include "ProcFileSystem.h"
|
||||
#include "Task.h"
|
||||
#include <VirtualFileSystem/VirtualFileSystem.h>
|
||||
|
||||
static ProcFileSystem* s_the;
|
||||
|
||||
|
@ -64,6 +65,22 @@ bool ProcFileSystem::initialize()
|
|||
{
|
||||
SyntheticFileSystem::initialize();
|
||||
|
||||
addFile(createGeneratedFile("mounts", [] {
|
||||
InterruptDisabler disabler;
|
||||
auto buffer = ByteBuffer::createUninitialized(VirtualFileSystem::the().mountCount() * 80);
|
||||
char* ptr = (char*)buffer.pointer();
|
||||
VirtualFileSystem::the().forEachMount([&ptr] (auto& mount) {
|
||||
auto& fs = mount.fileSystem();
|
||||
ptr += ksprintf(ptr, "%s @ ", fs.className());
|
||||
if (!mount.host().isValid())
|
||||
ptr += ksprintf(ptr, "/\n", fs.className());
|
||||
else
|
||||
ptr += ksprintf(ptr, "%u:%u\n", mount.host().fileSystemID(), mount.host().index());
|
||||
});
|
||||
buffer.trim(ptr - (char*)buffer.pointer());
|
||||
return buffer;
|
||||
}));
|
||||
|
||||
addFile(createGeneratedFile("kmalloc", [] {
|
||||
InterruptDisabler disabler;
|
||||
auto buffer = ByteBuffer::createUninitialized(128);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue