summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/DevPtsFS.h
AgeCommit message (Collapse)Author
2021-08-17Kernel: Convert SlavePTY all-instances HashTable to an IntrusiveListAndreas Kling
This simplifies the DevPtsFS implementation somewhat, as it no longer requires SlavePTY to register itself with it, since it can now simply use the list of SlavePTY instances.
2021-08-17Kernel/DevPtsFS: Add tightly typed DevPtsFSInode::fs()Andreas Kling
2021-08-14Kernel: Make FileSystem::initialize() return KResultAndreas Kling
This forced me to also come up with error codes for a bunch of situations where we'd previously just panic the kernel.
2021-08-14Kernel: Make Inode::lookup() return a KResultOr<NonnullRefPtr<Inode>>Andreas Kling
This allows file systems to return arbitrary error codes instead of just an Inode or not an Inode.
2021-07-18Kernel: Make FileSystem::root_inode() return a plain Inode&Andreas Kling
All file system classes are expected to keep their root Inode object in memory, so this function can safely return an Inode&.
2021-07-17Kernel: Remove Inode::directory_entry_count()Andreas Kling
This was only used in one place: VirtualFileSystem::rmdir(), and that has now been converted to a simple directory traversal.
2021-07-17Kernel: Make Inode::create_child() take the name as a StringViewAndreas Kling
No sense in forcing callers to construct a String. One more small step towards not using String in the kernel.
2021-07-17Kernel: Make FileSystem::class_name() return a StringViewAndreas Kling
2021-07-11Kernel: Rename FS => FileSystemAndreas Kling
This matches our common naming style better.
2021-06-16Kernel: Remove various other uses of ssize_tGunnar Beutner
2021-05-02Kernel: Change Inode::{read/write}_bytes interface to KResultOr<ssize_t>Brian Gianforcaro
The error handling in all these cases was still using the old style negative values to indicate errors. We have a nicer solution for this now with KResultOr<T>. This change switches the interface and then all implementers to use the new style.
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 *
2021-02-12Kernel: Add distinct InodeIndex typeAndreas Kling
Use the DistinctNumeric mechanism to make InodeIndex a strongly typed integer type.
2020-09-13Kernel: Make copy_to/from_user safe and remove unnecessary checksTom
Since the CPU already does almost all necessary validation steps for us, we don't really need to attempt to do this. Doing it ourselves doesn't really work very reliably, because we'd have to account for other processors modifying virtual memory, and we'd have to account for e.g. pages not being able to be allocated due to insufficient resources. So change the copy_to/from_user (and associated helper functions) to use the new safe_memcpy, which will return whether it succeeded or not. The only manual validation step needed (which the CPU can't perform for us) is making sure the pointers provided by user mode aren't pointing to kernel mappings. To make it easier to read/write from/to either kernel or user mode data add the UserOrKernelBuffer helper class, which will internally either use copy_from/to_user or directly memcpy, or pass the data through directly using a temporary buffer on the stack. Last but not least we need to keep syscall params trivial as we need to copy them from/to user mode using copy_from/to_user.
2020-09-06Kernel: Track time-of-last-write in SlavePTY and report it as mtimeAndreas Kling
2020-08-18Kernel: Add DirectoryEntryView for VFS directory traversalAndreas Kling
Unlike DirectoryEntry (which is used when constructing directories), DirectoryEntryView does not manage storage for file names. Names are just StringViews. This is much more suited to the directory traversal API and makes it easier to implement this in file system classes since they no longer need to create temporary name copies while traversing.
2020-08-05Kernel: Make Inode::directory_entry_count errors observable.Brian Gianforcaro
Certain implementations of Inode::directory_entry_count were calling functions which returned errors, but had no way of surfacing them. Switch the return type to KResultOr<size_t> and start observing these error paths.
2020-06-25Kernel: Port mounts to reference inodes directlySergey Bugaev
...instead of going through their identifiers. See the previous commit for reasoning.
2020-06-25Kernel: Deemphasize inode identifiersSergey Bugaev
These APIs were clearly modeled after Ext2FS internals, and make perfect sense in Ext2FS context. The new APIs are more generic, and map better to the semantics exported to the userspace, where inode identifiers only appear in stat() and readdir() output, but never in any input. This will also hopefully reduce the potential for races (see commit https://github.com/SerenityOS/serenity/commit/c44b4d61f350703fcf1bbd8f6e353b9c6c4210c2). Lastly, this makes it way more viable to implement a filesystem that only synthesizes its inodes lazily when queried, and destroys them when they are no longer in use. With inode identifiers being used to reference inodes, the only choice for such a filesystem is to persist any inode it has given out the identifier for, because it might be queried at any later time. With direct references to inodes, the filesystem will know when the last reference is dropped and the inode can be safely destroyed.
2020-05-26Kernel: Plumb KResult through FileDescription::read_entire_file() ↵Brian Gianforcaro
implementation. Allow file system implementation to return meaningful error codes to callers of the FileDescription::read_entire_file(). This allows both Process::sys$readlink() and Process::sys$module_load() to return more detailed errors to the user.
2020-02-16Kernel: Move all code into the Kernel namespaceAndreas Kling
2020-02-08Kernel: Simplify FS::create_inode() a little bitAndreas Kling
Return a KResultOr<NonnullRefPtr<Inode>> instead of returning errors in an out-parameter.
2020-02-08Kernel: Simplify FS::create_directory() a little bitAndreas Kling
None of the clients of this function actually used the returned Inode, so it can simply return a KResult instead.
2020-02-01Kernel: Make Inode::lookup() return a RefPtr<Inode>Andreas Kling
Previously this API would return an InodeIdentifier, which meant that there was a race in path resolution where an inode could be unlinked in between finding the InodeIdentifier for a path component, and actually resolving that to an Inode object. Attaching a test that would quickly trip an assertion before. Test: Kernel/path-resolution-race.cpp
2020-01-24Meta: Claim copyright for files created by meSergey Bugaev
This changes copyright holder to myself for the source code files that I've created or have (almost) completely rewritten. Not included are the files that were significantly changed by others even though it was me who originally created them (think HtmlView), or the many other files I've contributed code to.
2020-01-18Kernel: Fix identifier casingSergey Bugaev
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-03Kernel: Allow passing initial UID and GID when creating new inodesAndreas Kling
If we're creating something that should have a different owner than the current process's UID/GID, we need to plumb that all the way through VFS down to the FS functions.
2019-08-17DevPtsFS: Do not assume there is one of itSergey Bugaev
Unfortunately, that also means it can no longer inherit from SynthFS.
2019-07-16Kernel: Remove use of [[gnu::pure]].Andreas Kling
I was messing around with this to tell the compiler that these functions always return the same value no matter how many times you call them. It doesn't really seem to improve code generation and it looks weird so let's just get rid of it.
2019-06-21AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr.Andreas Kling
2019-05-28Add clang-format fileRobin Burchell
Also run it across the whole tree to get everything using the One True Style. We don't yet run this in an automated fashion as it's a little slow, but there is a snippet to do so in makeall.sh.
2019-04-03Kernel: Move FS-related files into Kernel/FileSystem/Andreas Kling