mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 20:45:14 +00:00
Kernel: Expose info about source devices of mounts in /proc/df
This commit is contained in:
parent
425c356288
commit
fde8f7f538
Notes:
sideshowbarker
2024-07-19 12:39:19 +09:00
Author: https://github.com/bugaevc Commit: https://github.com/SerenityOS/serenity/commit/fde8f7f538b Pull-request: https://github.com/SerenityOS/serenity/pull/456 Reviewed-by: https://github.com/awesomekling ✅
5 changed files with 19 additions and 2 deletions
|
@ -14,7 +14,12 @@ Device::~Device()
|
|||
VFS::the().unregister_device({}, *this);
|
||||
}
|
||||
|
||||
String Device::absolute_path(const FileDescription&) const
|
||||
String Device::absolute_path() const
|
||||
{
|
||||
return String::format("device:%u,%u (%s)", m_major, m_minor, class_name());
|
||||
}
|
||||
|
||||
String Device::absolute_path(const FileDescription&) const
|
||||
{
|
||||
return absolute_path();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ public:
|
|||
unsigned minor() const { return m_minor; }
|
||||
|
||||
virtual String absolute_path(const FileDescription&) const override;
|
||||
virtual String absolute_path() const;
|
||||
|
||||
uid_t uid() const { return m_uid; }
|
||||
uid_t gid() const { return m_gid; }
|
||||
|
|
|
@ -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
Reference in a new issue