mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:07:43 +00:00
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.
This commit is contained in:
parent
4cb87b1753
commit
393851418b
11 changed files with 280 additions and 220 deletions
|
@ -21,7 +21,7 @@ class SharedMemory;
|
|||
|
||||
class FileDescriptor : public Retainable<FileDescriptor> {
|
||||
public:
|
||||
static Retained<FileDescriptor> create(RetainPtr<Inode>&&);
|
||||
static Retained<FileDescriptor> create(RetainPtr<Custody>&&);
|
||||
static Retained<FileDescriptor> create(RetainPtr<File>&&, SocketRole = SocketRole::None);
|
||||
~FileDescriptor();
|
||||
|
||||
|
@ -64,6 +64,9 @@ public:
|
|||
Inode* inode() { return m_inode.ptr(); }
|
||||
const Inode* inode() const { return m_inode.ptr(); }
|
||||
|
||||
Custody* custody() { return m_custody.ptr(); }
|
||||
const Custody* custody() const { return m_custody.ptr(); }
|
||||
|
||||
KResultOr<Region*> mmap(Process&, LinearAddress, size_t offset, size_t, int prot);
|
||||
|
||||
bool is_blocking() const { return m_is_blocking; }
|
||||
|
@ -103,6 +106,7 @@ private:
|
|||
FileDescriptor(RetainPtr<File>&&, SocketRole = SocketRole::None);
|
||||
FileDescriptor(FIFO&, FIFO::Direction);
|
||||
|
||||
RetainPtr<Custody> m_custody;
|
||||
RetainPtr<Inode> m_inode;
|
||||
RetainPtr<File> m_file;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue