mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:57:43 +00:00
Kernel/SysFS: Add two methods related to relative paths for components
These methods will be used later on to introduce symbolic links support in the SysFS, so the kernel will be able to resolve relative paths of components in filesystem based on using the m_parent_directory pointer in each SysFSComponent object.
This commit is contained in:
parent
4744ccbff0
commit
7e88bbe550
2 changed files with 35 additions and 4 deletions
|
@ -23,6 +23,7 @@ struct SysFSInodeData : public OpenFileDescriptionData {
|
|||
OwnPtr<KBuffer> buffer;
|
||||
};
|
||||
|
||||
class SysFSDirectory;
|
||||
class SysFSComponent : public RefCounted<SysFSComponent> {
|
||||
public:
|
||||
virtual StringView name() const = 0;
|
||||
|
@ -42,9 +43,15 @@ public:
|
|||
|
||||
virtual ~SysFSComponent() = default;
|
||||
|
||||
ErrorOr<NonnullOwnPtr<KString>> relative_path(NonnullOwnPtr<KString>, size_t current_hop = 0) const;
|
||||
ErrorOr<size_t> relative_path_hops_count_from_mountpoint(size_t current_hop = 0) const;
|
||||
|
||||
protected:
|
||||
explicit SysFSComponent(SysFSDirectory const& parent_directory);
|
||||
SysFSComponent();
|
||||
|
||||
RefPtr<SysFSDirectory> m_parent_directory;
|
||||
|
||||
private:
|
||||
InodeIndex m_component_index {};
|
||||
};
|
||||
|
@ -57,10 +64,9 @@ public:
|
|||
virtual ErrorOr<NonnullRefPtr<SysFSInode>> to_inode(SysFS const& sysfs_instance) const override final;
|
||||
|
||||
protected:
|
||||
SysFSDirectory() = default;
|
||||
SysFSDirectory() {};
|
||||
explicit SysFSDirectory(SysFSDirectory const& parent_directory);
|
||||
NonnullRefPtrVector<SysFSComponent> m_components;
|
||||
RefPtr<SysFSDirectory> m_parent_directory;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue