1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +00:00

Kernel: Expose info about source devices of mounts in /proc/df

This commit is contained in:
Sergey Bugaev 2019-08-17 12:17:36 +03:00 committed by Andreas Kling
parent 425c356288
commit fde8f7f538
5 changed files with 19 additions and 2 deletions

View file

@ -9,6 +9,7 @@
#include <AK/JsonValue.h>
#include <Kernel/Arch/i386/CPU.h>
#include <Kernel/FileSystem/Custody.h>
#include <Kernel/FileSystem/DiskBackedFileSystem.h>
#include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/FileSystem/VirtualFileSystem.h>
#include <Kernel/KBufferBuilder.h>
@ -502,7 +503,13 @@ Optional<KBuffer> procfs$df(InodeIdentifier)
fs_object.set("mount_point", mount.absolute_path());
fs_object.set("block_size", fs.block_size());
fs_object.set("readonly", fs.is_readonly());
json.append(fs_object);
if (fs.is_disk_backed())
fs_object.set("device", static_cast<const DiskBackedFS&>(fs).device().absolute_path());
else
fs_object.set("device", nullptr);
json.append(move(fs_object));
});
return json.serialized<KBufferBuilder>();
}