summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/Custody.h
AgeCommit message (Collapse)Author
2021-09-06Kernel: Improvements to Custody absolute path serializationAndreas Kling
- Renamed try_create_absolute_path() => try_serialize_absolute_path() - Use KResultOr and TRY() to propagate errors - Don't call this when it's only for debug logging
2021-09-05AK+Kernel: Move KResult.h to Kernel/API for userspace accesssin-ack
This commit moves the KResult and KResultOr objects to Kernel/API to signify that they may now be freely used by userspace code at points where a syscall-related error result is to be expected. It also exposes KResult and KResultOr to the global namespace to make it nicer to use for userspace code.
2021-08-15Kernel: Cache Custody objects (weakly) to avoid expensive reconstructionAndreas Kling
This patch adds a (spinlock-protected) custody cache. It's a simple intrusive list containing all currently live custody objects. This allows us to re-use existing custodies instead of creating them again and again. This gives a pretty decent performance improvement on "find /" :^)
2021-07-11Kernel: Switch Custody to east-const styleAndreas Kling
2021-07-07Kernel: Add Custody::try_create_absolute_path()Max Wipfli
This adds a way to get a Custody's absolute path as KString, which enables it to fail gracefully on OOM.
2021-05-28Kernel: Rename Custody::create() => try_create()Andreas Kling
The try_ prefix indicates that this may fail. :^)
2021-05-28Kernel: Use a KString for Custody::m_nameAndreas Kling
2021-05-13Kernel: Replace bare new in Custody::create() with adopt_ref_if_nonnullBrian Gianforcaro
2021-05-10Kernel: Plumb OOM propagation through Custody factoryBrian Gianforcaro
Modify the Custody::create(..) API so it has the ability to propagate OOM back to the caller.
2021-04-23AK: Rename adopt() to adopt_ref()Andreas Kling
This makes it more symmetrical with adopt_own() (which is used to create a NonnullOwnPtr from the result of a naked new.)
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2020-05-29Kernel: Support read-only filesystem mountsSergey Bugaev
This adds support for MS_RDONLY, a mount flag that tells the kernel to disallow any attempts to write to the newly mounted filesystem. As this flag is per-mount, and different mounts of the same filesystems (such as in case of bind mounts) can have different mutability settings, you have to go though a custody to find out if the filesystem is mounted read-only, instead of just asking the filesystem itself whether it's inherently read-only. This also adds a lot of checks we were previously missing; and moves some of them to happen after more specific checks (such as regular permission checks). One outstanding hole in this system is sys$mprotect(PROT_WRITE), as there's no way we can know if the original file description this region has been mounted from had been opened through a readonly mount point. Currently, we always allow such sys$mprotect() calls to succeed, which effectively allows anyone to circumvent the effect of MS_RDONLY. We should solve this one way or another.
2020-02-26Kernel: Remove unused artifacts of the Custody cacheAndreas Kling
We'll probably want some kind of Custody caching in the future, but as it's not used at the moment, let's simplify things a bit.
2020-02-22Kernel: Make Custody slab-allocatedAndreas Kling
2020-02-16Kernel: More header dependency reduction workAndreas Kling
2020-02-16Kernel: Move all code into the Kernel namespaceAndreas Kling
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2020-01-11Kernel+LibC: Add support for mount flagsSergey Bugaev
At the moment, the actual flags are ignored, but we correctly propagate them all the way from the original mount() syscall to each custody that resides on the mounted FS.
2019-09-06AK: Rename <AK/AKString.h> to <AK/String.h>Andreas Kling
This was a workaround to be able to build on case-insensitive file systems where it might get confused about <string.h> vs <String.h>. Let's just not support building that way, so String.h can have an objectively nicer name. :^)
2019-08-25Kernel: Don't create a String every time we look up a Custody by nameAndreas Kling
2019-08-08Kernel: Turns global Custody and Inode tables into InlineLinkedListsAndreas Kling
Yet more of this same thing. Each one of these patches has a small but noticeable impact on the steady-state kmalloc numbers. :^)
2019-06-21AK: Rename Retainable.h => RefCounted.h.Andreas Kling
2019-06-21AK: Rename RetainPtr.h => RefPtr.h, Retained.h => NonnullRefPtr.h.Andreas Kling
2019-06-21AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr.Andreas Kling
2019-06-21AK: Rename Retainable => RefCounted.Andreas Kling
(And various related renames that go along with it.)
2019-05-31FileSystem: Reuse existing custodies when possible, and keep them updated.Andreas Kling
Walk the custody cache and try to reuse an existing one when possible. The VFS is responsible for updating them when something happens that would cause the described relationship to change. This is definitely not perfect but it does work for the basic scenarios like renaming and removing directory entries.
2019-05-30FileSystem: Port most of the code over to using custodies.Andreas Kling
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-30FileSystem: Add a Custody class that represents a parent/child guardianship.Andreas Kling
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.