Hendiadyoin1
c3e57bfccb
Kernel: Try to set [cm]time in Inode::did_modify_contents
...
This indirectly resolves a fixme in sys$msync
2022-07-15 12:42:43 +02:00
Tim Schumacher
cd189999d1
Kernel: Don't let locks of the same owner conflict with each other
...
Documentation on POSIX locks seems sparse, but this is how the Linux
kernel implementation handles it.
2022-07-08 22:27:38 +00:00
Tim Schumacher
dc6016cd18
Kernel: Don't fail on unlocking nonexistent file locks
...
I haven't found any POSIX specification on this, but the Linux kernel
appears to handle it like that.
This is required by QEMU, as it just bulk-unlocks all its file locking
bytes without checking first if they are held.
2022-07-08 22:27:38 +00:00
Idan Horowitz
086969277e
Everywhere: Run clang-format
2022-04-01 21:24:45 +01:00
Idan Horowitz
e37e4a7980
Kernel: Make Inode::set_shared_vmobject() OOM-fallible
...
Allocating a WeakPtr can fail, so this let's us properly propagate said
failure.
2022-02-14 11:35:20 +01:00
Andreas Kling
cda56f8049
Kernel: Robustify and rename Inode bound socket API
...
Rename the bound socket accessor from socket() to bound_socket().
Also return RefPtr<LocalSocket> instead of a raw pointer, to make it
harder for callers to mess up.
2022-02-07 13:02:34 +01:00
Andreas Kling
e7dc9f71b8
Kernel: Protect Inode flock list with spinlock instead of mutex
2022-02-03 17:28:45 +01:00
Andreas Kling
e0d9472ced
Kernel: Protect Inode's list of watchers with spinlock instead of mutex
2022-02-03 16:11:26 +01:00
Idan Horowitz
a9cd8ca841
Kernel: Make Inode::register_watcher() OOM-fallible
2022-01-26 02:37:03 +02:00
Idan Horowitz
e236f9d85a
Kernel: Convert Inode event APIs to use StringViews instead of Strings
...
These APIs allocate a copy internally anyways, so there's no point to
making another one for them.
2022-01-12 16:09:09 +02:00
Andreas Kling
c427f8bbeb
Kernel: Always pass InodeIdentifier by value
...
These objects are small, there are no benefits to passing by reference.
2022-01-02 18:08:02 +01:00
Daniel Bertalan
8e2efe78f7
Kernel: Tighten String-related includes
2021-12-30 14:16:03 +01:00
Andreas Kling
abf2204402
Kernel: Use copy_typed_from_user() in more places :^)
2021-12-18 11:30:10 +01:00
Hendiadyoin1
4cec16a713
Kernel: Add implied auto-specifiers in FileSystem
...
As per clang-tidy.
2021-12-15 23:34:11 -08:00
Andreas Kling
b285323d91
Kernel: Propagate Vector append failures from Inode::apply_flock()
2021-11-18 21:11:30 +01:00
Andreas Kling
79fa9765ca
Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T>
...
We now use AK::Error and AK::ErrorOr<T> in both kernel and userspace!
This was a slightly tedious refactoring that took a long time, so it's
not unlikely that some bugs crept in.
Nevertheless, it does pass basic functionality testing, and it's just
real nice to finally see the same pattern in all contexts. :^)
2021-11-08 01:10:53 +01:00
Andreas Kling
6f69d5204f
Kernel: Make Inode::flush_metadata() return a KResult
...
Even if this goes nowhere yet, we have to start building an error
propagation path somewhere.
2021-10-21 23:23:23 +02:00
Brian Gianforcaro
85d36e56d2
Kernel: Pack Flock struct tighter
...
Flagged by pvs-studio, ordering the members from largest to smallest
allows us to save a few bytes in the size of the struct.
2021-09-16 17:17:13 +02:00
TheFightingCatfish
a81b21c1a7
Kernel+LibC: Implement fsync
2021-09-12 11:24:02 +02:00
Andreas Kling
524ef5e475
Kernel: Add KBuffer::bytes() and use it
...
(Instead of hand-wrapping { data(), size() } in a bunch of places.)
2021-09-08 20:16:00 +02:00
Andreas Kling
300402cc14
Kernel: Make it possible for KBufferBuilder creation to fail
...
This patch adds KBufferBuilder::try_create() and treats it like anything
else that can fail. And so, failure to allocate the initial internal
buffer of the builder will now propagate an ENOMEM to the caller. :^)
2021-09-07 15:54:23 +02:00
Andreas Kling
ed5d04b0ea
Kernel: Use KResultOr and TRY() for FIFO
2021-09-07 13:58:16 +02:00
Andreas Kling
4a9c18afb9
Kernel: Rename FileDescription => OpenFileDescription
...
Dr. POSIX really calls these "open file description", not just
"file description", so let's call them exactly that. :^)
2021-09-07 13:53:14 +02:00
Andreas Kling
2065ced8f6
Kernel: Make KBufferBuilder::append() & friends return KResult
...
This allows callers to react to a failed append (due to OOM.)
2021-09-06 18:56:51 +02:00
Andreas Kling
48a0b31c47
Kernel: Make copy_{from,to}_user() return KResult and use TRY()
...
This makes EFAULT propagation flow much more naturally. :^)
2021-09-05 17:38:37 +02:00
Andreas Kling
b2950c67ea
Kernel: Use TRY() in Inode
2021-09-05 16:25:40 +02:00
Andreas Kling
55adace359
Kernel: Rename SpinLock => Spinlock
2021-08-22 03:34:10 +02:00
Andreas Kling
ed6f84c2c9
Kernel: Rename SpinLockProtectedValue<T> => SpinLockProtected<T>
2021-08-22 03:34:09 +02:00
Andreas Kling
ea09294351
Kernel: Port Inode to ListedRefCounted
...
This consolidates the lock+list combo into a SpinLockProtectedValue
and closes yet another unref() race. :^)
2021-08-17 01:21:47 +02:00
Andreas Kling
c94c15d45c
Everywhere: Replace AK::Singleton => Singleton
2021-08-08 00:03:45 +02:00
Andreas Kling
93d98d4976
Kernel: Move Kernel/Memory/ code into Kernel::Memory namespace
2021-08-06 14:05:58 +02:00
Andreas Kling
a1d7ebf85a
Kernel: Rename Kernel/VM/ to Kernel/Memory/
...
This directory isn't just about virtual memory, it's about all kinds
of memory management.
2021-08-06 14:05:58 +02:00
Brian Gianforcaro
8d3b819daf
Kernel: Handle OOM from DoubleBuffer creation in FIFO creation
2021-08-03 18:54:23 +02:00
Andreas Kling
f9b7ea6de9
Revert "Kernel: Use IntrusiveList for keeping track of InodeWatchers"
...
This reverts commit 43d6a7e74e
.
This breaks multi-inode watchers.
2021-07-21 21:24:26 +02:00
Andreas Kling
43d6a7e74e
Kernel: Use IntrusiveList for keeping track of InodeWatchers
2021-07-21 20:17:55 +02:00
Peter Elliott
3fa2816642
Kernel+LibC: Implement fcntl(2) advisory locks
...
Advisory locks don't actually prevent other processes from writing to
the file, but they do prevent other processes looking to acquire and
advisory lock on the file.
This implementation currently only adds non-blocking locks, which are
all I need for now.
2021-07-20 17:44:30 +04:30
Andreas Kling
9457d83986
Kernel: Rename Locker => MutexLocker
2021-07-18 01:53:04 +02:00
Andreas Kling
3b805a57e6
Kernel: Rename Inode::m_lock => m_inode_lock
...
This makes file system code much easier to read since it was hard when
both the file system and inode locks were called "m_lock".
2021-07-17 21:17:39 +02:00
Andreas Kling
63e1423830
Kernel: Remove unused Inode::is_shared_vmobject()
2021-07-17 21:11:12 +02:00
Andreas Kling
0d39bd04d3
Kernel: Rename VFS => VirtualFileSystem
2021-07-11 00:25:24 +02:00
Andreas Kling
d53d9d3677
Kernel: Rename FS => FileSystem
...
This matches our common naming style better.
2021-07-11 00:20:38 +02:00
Gunnar Beutner
58c182b19e
Kernel: Update check in Inode::read_entire
...
The nread variable can't be less than zero anymore.
2021-06-17 19:52:54 +02:00
Gunnar Beutner
bc3076f894
Kernel: Remove various other uses of ssize_t
2021-06-16 21:29:36 +02:00
Brian Gianforcaro
493d4d1cd7
Kernel: Switch Inode to IntrusiveList from InlineLinkedList
2021-05-26 20:24:32 +02:00
sin-ack
fe5ca6ca27
Kernel: Implement multi-watch InodeWatcher :^)
...
This patch modifies InodeWatcher to switch to a one watcher, multiple
watches architecture. The following changes have been made:
- The watch_file syscall is removed, and in its place the
create_iwatcher, iwatcher_add_watch and iwatcher_remove_watch calls
have been added.
- InodeWatcher now holds multiple WatchDescriptions for each file that
is being watched.
- The InodeWatcher file descriptor can be read from to receive events on
all watched files.
Co-authored-by: Gunnar Beutner <gunnar@beutner.name>
2021-05-12 22:38:20 +02:00
Brian Gianforcaro
234c6ae32d
Kernel: Change Inode::{read/write}_bytes interface to KResultOr<ssize_t>
...
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-05-02 13:27:37 +02:00
Andreas Kling
cd9be1733c
Kernel: Make Inode::set_{a,c,m}time return KResult
...
This exposed some missing error propagation, which this patch also
takes care of.
2021-04-30 15:51:06 +02:00
Brian Gianforcaro
8d6e9fad40
Kernel: Remove the now defunct LOCKER(..)
macro.
2021-04-25 09:38:27 +02:00
Brian Gianforcaro
1682f0b760
Everything: Move to SPDX license identifiers in all files.
...
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-04-22 11:22:27 +02:00
Andreas Kling
10f10abaa3
Kernel: Convert klog() => dmesgln() in filesystem code
2021-03-09 22:10:41 +01:00