1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:57:43 +00:00

Kernel/SysFS: Add Symbolic link functionality to the filesystem

This will be used later on to help connecting a node at /sys/dev/block/
that represents a Storage device to a directory in /sys/devices/storage/
with details on that device in that directory.
This commit is contained in:
Liav A 2022-04-22 20:35:15 +03:00 committed by Andreas Kling
parent 7e88bbe550
commit ecc29bb52e
4 changed files with 104 additions and 0 deletions

View file

@ -56,6 +56,20 @@ private:
InodeIndex m_component_index {};
};
class SysFSSymbolicLink : public SysFSComponent {
public:
virtual ErrorOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, OpenFileDescription*) const override final;
virtual ErrorOr<NonnullRefPtr<SysFSInode>> to_inode(SysFS const& sysfs_instance) const override final;
protected:
ErrorOr<NonnullOwnPtr<KString>> try_generate_return_path_to_mount_point() const;
ErrorOr<NonnullOwnPtr<KBuffer>> try_to_generate_buffer() const;
explicit SysFSSymbolicLink(SysFSDirectory const& parent_directory, SysFSComponent const& pointed_component);
RefPtr<SysFSComponent> m_pointed_component;
};
class SysFSDirectory : public SysFSComponent {
public:
virtual ErrorOr<void> traverse_as_directory(FileSystemID, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override;