mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:47:35 +00:00
Kernel: Expose info about source devices of mounts in /proc/df
This commit is contained in:
parent
425c356288
commit
fde8f7f538
5 changed files with 19 additions and 2 deletions
|
@ -7,6 +7,8 @@ class DiskBackedFS : public FS {
|
|||
public:
|
||||
virtual ~DiskBackedFS() override;
|
||||
|
||||
virtual bool is_disk_backed() const override { return true; }
|
||||
|
||||
DiskDevice& device() { return *m_device; }
|
||||
const DiskDevice& device() const { return *m_device; }
|
||||
|
||||
|
|
|
@ -65,6 +65,8 @@ public:
|
|||
|
||||
int block_size() const { return m_block_size; }
|
||||
|
||||
virtual bool is_disk_backed() const { return false; }
|
||||
|
||||
protected:
|
||||
FS();
|
||||
|
||||
|
|
|
@ -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>();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue