Andreas Kling
f173f73f10
Kernel/USB: Use TRY() and adopt_nonnull_own_or_enomem() some more
2021-09-06 13:06:05 +02:00
Andreas Kling
e3b063581e
Kernel: Use TRY() in sys$alarm()
2021-09-06 13:06:05 +02:00
Andreas Kling
b083b165a7
Kernel/Ext2FS: Wrap calls to traverse_as_directory() in TRY()
...
Nothing says we can't TRY() a multi-line function call. :^)
2021-09-06 13:06:05 +02:00
Andreas Kling
18dbafec85
Kernel: Use TRY() more in Plan9FS
2021-09-06 13:06:05 +02:00
Andreas Kling
d34f2b643e
Kernel: Tidy up Plan9FS construction a bit
2021-09-06 13:06:05 +02:00
Andreas Kling
36725228fa
Kernel: Tidy up Ext2FS construction a bit
2021-09-06 13:06:05 +02:00
Andreas Kling
47bfbe343b
Kernel: Tidy up SysFS construction
...
- Use KResultOr and TRY() to propagate errors
- Check for OOM errors
- Move allocation out of constructors
There's still a lot more to do here, as SysFS is still quite brittle
in the face of memory pressure.
2021-09-06 13:06:05 +02:00
Andreas Kling
788b91a65c
Kernel: Tidy up DevFS construction and handle OOM errorso
...
- Use KResultOr and TRY() to propagate errors
- Check for OOM
- Move allocations out of the DevFS constructor
2021-09-06 13:06:05 +02:00
Andreas Kling
efe4e230ee
Kernel: Tidy up DevPtsFS construction and handle OOM errors
...
- Use KResultOr and TRY() to propagate errors
- Check for OOM when creating new inodes
2021-09-06 13:06:05 +02:00
Andreas Kling
f2512071f2
Kernel: Use TRY() in sys$getrandom()
2021-09-06 02:36:21 +02:00
Andreas Kling
a8516681b7
Kernel: Tidy up TmpFS and TmpFSInode construction
...
- Use KResultOr<NonnullRefPtr<T>>
- Propagate errors
- Use TRY() at call sites
2021-09-06 02:36:21 +02:00
Andreas Kling
398f8e7c96
Kernel: Use TRY() more in process-specific ProcFS code
2021-09-06 02:14:22 +02:00
Andreas Kling
f4a6b60570
Kernel: Use TRY() in Graphics::VirtIOGPU::FrameBufferDevice
2021-09-06 02:11:46 +02:00
Andreas Kling
17a12c8a30
Kernel: Use TRY() in FramebufferDevice
2021-09-06 02:10:01 +02:00
Andreas Kling
7a8061ba0c
Kernel: Use TRY() in ISO9660FileSystem
2021-09-06 02:06:49 +02:00
Andreas Kling
a994f11f10
Kernel: Make AddressSpace::add_region() return KResultOr<Region*>
...
This allows us to use TRY() in a few places.
2021-09-06 02:02:06 +02:00
Andreas Kling
062cc804e7
Kernel: Use TRY() some more in Memory::AddressSpace
2021-09-06 01:59:30 +02:00
Andreas Kling
75564b4a5f
Kernel: Make kernel region allocators return KResultOr<NOP<Region>>
...
This expands the reach of error propagation greatly throughout the
kernel. Sadly, it also exposes the fact that we're allocating (and
doing other fallible things) in constructors all over the place.
This patch doesn't attempt to address that of course. That's work for
our future selves.
2021-09-06 01:55:27 +02:00
Andreas Kling
cb71a73708
Kernel/USB: Tidy up UHCIDescriptorPool construction
...
- Use KResultOr<NonnullRefPtr<UHCIDescriptorPool<T>>
- Make the constructor private
- Use TRY() at call sites
2021-09-06 01:55:27 +02:00
Andreas Kling
91fe6b6552
Kernel/KCOV: Bring closer to typical SerenityOS coding style
...
- Remove a bunch of redundant `this->`
- Make class data members private and provide accessors instead
2021-09-06 01:55:27 +02:00
Andreas Kling
79fbad6df9
Kernel/USB: Tidy up USB::Transfer construction
2021-09-06 01:55:27 +02:00
Andreas Kling
f4a9a0d561
Kernel: Make VirtualRangeAllocator return KResultOr<VirtualRange>
...
This achieves two things:
- The allocator can report more specific errors
- Callers can (and now do) use TRY() :^)
2021-09-06 01:55:27 +02:00
Andreas Kling
21f7932ae2
Kernel: Use TRY() and adopt_nonnull_ref_or_enomem() in AnonymousVMObject
2021-09-06 01:55:27 +02:00
Andreas Kling
52cbbe1dc5
Kernel: Actually share committed CoW pages
...
Due to a double-move mistake, we were always clearing the shared
committed CoW pages in the parent when forking.
2021-09-06 01:55:27 +02:00
Andreas Kling
2f790cf78f
Kernel: Make MM.commit_user_physical_pages() return KResultOr
...
..and use TRY() at call sites. :^)
2021-09-06 01:55:27 +02:00
Andreas Kling
98dc08fe56
Kernel: Use KResultOr better in ProcessGroup construction
...
This allows us to use TRY() more.
2021-09-06 01:55:27 +02:00
Andreas Kling
540d62d3b2
Kernel: Simplify WatchDescription::create()
2021-09-06 01:55:27 +02:00
Andreas Kling
5e2bae700d
Kernel: Use TRY() in PTYMultiplexer::open()
2021-09-06 01:55:27 +02:00
Andreas Kling
4d961387c1
Kernel: Use TRY() some more in USB::Hub
2021-09-06 01:55:27 +02:00
Andreas Kling
8ceff65161
Kernel: Use TRY() some more in FileDescription
2021-09-06 01:55:27 +02:00
Andreas Kling
5516592748
Kernel: Use TRY() in BlockBasedFileSystem
2021-09-06 01:55:27 +02:00
Ali Mohammad Pur
97e97bccab
Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe
2021-09-06 01:53:26 +02:00
Ali Mohammad Pur
3a9f00c59b
Everywhere: Use OOM-safe ByteBuffer APIs where possible
...
If we can easily communicate failure, let's avoid asserting and report
failure instead.
2021-09-06 01:53:26 +02:00
Brian Gianforcaro
bb58a4d943
Kernel: Make all Spinlocks use u8 for storage, remove template
...
The default template argument is only used in one place, and it
looks like it was probably just an oversight. The rest of the Kernel
code all uses u8 as the type. So lets make that the default and remove
the unused template argument, as there doesn't seem to be a reason to
allow the size to be customizable.
2021-09-05 20:46:02 +02:00
Brian Gianforcaro
472454cded
Kernel: Switch static_asserts of a type size to AK::AssertSize
...
This will provide better debug ability when the size comparison fails.
2021-09-05 20:08:57 +02:00
Andreas Kling
100b3835f0
Kernel: Use TRY() in DevFSLinkInode::write_bytes()
2021-09-05 19:02:57 +02:00
Andreas Kling
667a39df6b
Kernel: Use TRY() in ProcFS
2021-09-05 19:01:38 +02:00
Andreas Kling
caaeae9607
Kernel: Make FileSystem::get_inode() return KResultOr<NRP<Inode>>
...
This allows for natural error propagation in a bunch of new places.
2021-09-05 18:55:55 +02:00
Andreas Kling
12d9a6c1fa
Kernel: Use TRY() in sys$waitid()
2021-09-05 18:42:32 +02:00
Andreas Kling
c076d765c4
Kernel: Simplify sys$inode_watcher_remove_watch() a little bit
2021-09-05 18:41:28 +02:00
Andreas Kling
d912bfdf38
Kernel: Use TRY() in sys$create_inode_watcher() and friends
2021-09-05 18:41:01 +02:00
Andreas Kling
a9204510a4
Kernel: Make file description lookup return KResultOr
...
Instead of checking it at every call site (to generate EBADF), we make
file_description(fd) return a KResultOr<NonnullRefPtr<FileDescription>>.
This allows us to wrap all the calls in TRY(). :^)
The only place that got a little bit messier from this is sys$mount(),
and there's a whole bunch of things there in need of cleanup.
2021-09-05 18:36:13 +02:00
Andreas Kling
2d2ea05c97
Kernel: Use TRY() in sys$sethostname()
2021-09-05 18:22:18 +02:00
Andreas Kling
963f847579
Kernel: Use TRY() in sys$mount()
2021-09-05 18:20:57 +02:00
Andreas Kling
3580c5a72e
Kernel: Use TRY() in sys$umount()
2021-09-05 18:18:23 +02:00
Andreas Kling
76f2596ce8
Kernel: Use TRY() in sys$set_process_name()
2021-09-05 18:17:06 +02:00
Andreas Kling
53aa01384d
Kernel: Use TRY() in sys$set_coredump_metadata()
2021-09-05 18:15:42 +02:00
Andreas Kling
bfe4c84541
Kernel: Use TRY() in sys$create_thread()
2021-09-05 18:15:05 +02:00
Andreas Kling
257fa80312
Kernel: Use TRY() in sys$set_thread_name()
2021-09-05 18:15:05 +02:00
Andreas Kling
afc5bbd56b
Kernel: Use TRY() in sys$write()
2021-09-05 18:15:05 +02:00