Files
ladybird/Kernel/FileSystem/Custody.h
Andreas Kling 393851418b FileSystem: Port most of the code over to using custodies.
The current working directory is now stored as a custody. Likewise for a
process executable file. This unbreaks /proc/PID/fd which has not been
working since we made the filesystem bigger.

This still needs a bunch of work, for instance when renaming or removing
a file somewhere, we have to update the relevant custody links.
2019-05-30 18:58:59 +02:00

35 lines
776 B
C++

#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; }
String absolute_path() const;
private:
Custody(Custody* parent, const String& name, Inode&);
RetainPtr<Custody> m_parent;
String m_name;
Retained<Inode> m_inode;
};