1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 01:37:34 +00:00

Kernel/ProcFS: Remove all unnecessary components

Now that all global nodes are located in the /sys/kernel directory, we
can safely drop the global nodes in /proc, which includes both /proc/net
and /proc/sys directories as well.
This in fact leaves the ProcFS to only have subdirectories for processes
and the "self" symbolic link to reflect the current process being run.
This commit is contained in:
Liav A 2022-10-14 14:52:01 +03:00 committed by Andrew Kaster
parent 1c5e09f789
commit dc5b28e26c
4 changed files with 80 additions and 1153 deletions

View file

@ -86,7 +86,7 @@ public:
return {};
}
virtual ErrorOr<NonnullLockRefPtr<Inode>> to_inode(ProcFS const& procfs_instance) const;
virtual ErrorOr<NonnullLockRefPtr<Inode>> to_inode(ProcFS const& procfs_instance) const = 0;
virtual InodeIndex component_index() const { return m_component_index; }
@ -162,44 +162,4 @@ struct ProcFSInodeData : public OpenFileDescriptionData {
OwnPtr<KBuffer> buffer;
};
class ProcFSGlobalInformation : public ProcFSExposedComponent {
public:
virtual ~ProcFSGlobalInformation() override {};
virtual ErrorOr<size_t> read_bytes(off_t offset, size_t count, UserOrKernelBuffer& buffer, OpenFileDescription* description) const override;
virtual mode_t required_mode() const override { return 0444; }
protected:
explicit ProcFSGlobalInformation(StringView name)
: ProcFSExposedComponent(name)
{
}
virtual ErrorOr<void> refresh_data(OpenFileDescription&) const override;
virtual ErrorOr<void> try_generate(KBufferBuilder&) = 0;
mutable Mutex m_refresh_lock;
};
class ProcFSSystemBoolean : public ProcFSGlobalInformation {
public:
virtual bool value() const = 0;
virtual void set_value(bool new_value) = 0;
protected:
explicit ProcFSSystemBoolean(StringView name)
: ProcFSGlobalInformation(name)
{
}
private:
// ^ProcFSGlobalInformation
virtual ErrorOr<void> try_generate(KBufferBuilder&) override final;
// ^ProcFSExposedComponent
virtual ErrorOr<size_t> write_bytes(off_t, size_t, UserOrKernelBuffer const&, OpenFileDescription*) override final;
virtual mode_t required_mode() const override final { return 0644; }
virtual ErrorOr<void> truncate(u64) override final;
};
}