mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
FileSystem: Add a Custody class that represents a parent/child guardianship.
A custody is kind of a directory entry abstraction that represents a single entry in a parent directory that tells us the name of a child inode. The idea here is for path resolution to produce a chain of custody objects.
This commit is contained in:
parent
3a1d5fa112
commit
4cb87b1753
5 changed files with 141 additions and 0 deletions
32
Kernel/FileSystem/Custody.h
Normal file
32
Kernel/FileSystem/Custody.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/RetainPtr.h>
|
||||
#include <AK/Retainable.h>
|
||||
|
||||
class Inode;
|
||||
|
||||
class Custody : public Retainable<Custody> {
|
||||
public:
|
||||
static Retained<Custody> create(Custody* parent, const String& name, Inode& inode)
|
||||
{
|
||||
return adopt(*new Custody(parent, name, inode));
|
||||
}
|
||||
|
||||
~Custody();
|
||||
|
||||
Custody* parent() { return m_parent.ptr(); }
|
||||
const Custody* parent() const { return m_parent.ptr(); }
|
||||
|
||||
Inode& inode() { return *m_inode; }
|
||||
const Inode& inode() const { return *m_inode; }
|
||||
|
||||
const String& name() const { return m_name; }
|
||||
|
||||
private:
|
||||
Custody(Custody* parent, const String& name, Inode&);
|
||||
|
||||
RetainPtr<Custody> m_parent;
|
||||
String m_name;
|
||||
Retained<Inode> m_inode;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue