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

Kernel/ProcFS: Provide a way to write to ProcFS inodes

ProcFSGlobalInode now calls `write_bytes()`, `truncate()` and
`set_mtime()` on its associated component. This allows us to write 0 or
1 to a ProcFSSystemBoolean component to toggle a boolean value.
This commit is contained in:
SeekingBlues 2021-10-16 17:35:59 -04:00 committed by Andreas Kling
parent f8e89306e0
commit 3d174e3ad2
4 changed files with 58 additions and 11 deletions

View file

@ -99,11 +99,6 @@ KResult ProcFSInode::chown(UserID, GroupID)
return EPERM;
}
KResult ProcFSInode::truncate(u64)
{
return EPERM;
}
KResultOr<NonnullRefPtr<ProcFSGlobalInode>> ProcFSGlobalInode::try_create(const ProcFS& fs, const ProcFSExposedComponent& component)
{
return adopt_nonnull_ref_or_enomem(new (nothrow) ProcFSGlobalInode(fs, component));
@ -151,6 +146,16 @@ KResultOr<NonnullRefPtr<Inode>> ProcFSGlobalInode::lookup(StringView)
VERIFY_NOT_REACHED();
}
KResult ProcFSGlobalInode::truncate(u64 size)
{
return m_associated_component->truncate(size);
}
KResult ProcFSGlobalInode::set_mtime(time_t time)
{
return m_associated_component->set_mtime(time);
}
InodeMetadata ProcFSGlobalInode::metadata() const
{
MutexLocker locker(m_inode_lock);