mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-04 02:08:53 +00:00
Kernel: Get rid of *LockRefPtr in the SysFS filesystem code
To do this we also need to get rid of LockRefPtrs in the USB code as well. Most of the SysFS nodes are statically generated during boot and are not mutated afterwards. The same goes for general device code - once we generate the appropriate SysFS nodes, we almost never mutate the node pointers afterwards, making locking unnecessary.
This commit is contained in:
parent
dd7633c5f4
commit
b02ee664e7
Notes:
sideshowbarker
2024-07-17 06:45:52 +09:00
Author: https://github.com/supercomputer7
Commit: b02ee664e7
Pull-request: https://github.com/SerenityOS/serenity/pull/18190
Reviewed-by: https://github.com/awesomekling
114 changed files with 230 additions and 218 deletions
|
@ -74,8 +74,6 @@ ErrorOr<size_t> SysFSSymbolicLink::read_bytes(off_t offset, size_t count, UserOr
|
|||
ErrorOr<NonnullOwnPtr<KBuffer>> SysFSSymbolicLink::try_to_generate_buffer() const
|
||||
{
|
||||
auto return_path_to_mount_point = TRY(try_generate_return_path_to_mount_point());
|
||||
if (!m_pointed_component)
|
||||
return Error::from_errno(EIO);
|
||||
auto pointed_component_base_name = MUST(KString::try_create(m_pointed_component->name()));
|
||||
auto pointed_component_relative_path = MUST(m_pointed_component->relative_path(move(pointed_component_base_name), 0));
|
||||
auto full_return_and_target_path = TRY(KString::formatted("{}{}", return_path_to_mount_point->view(), pointed_component_relative_path->view()));
|
||||
|
@ -126,9 +124,9 @@ ErrorOr<void> SysFSDirectory::traverse_as_directory(FileSystemID fsid, Function<
|
|||
});
|
||||
}
|
||||
|
||||
LockRefPtr<SysFSComponent> SysFSDirectory::lookup(StringView name)
|
||||
RefPtr<SysFSComponent> SysFSDirectory::lookup(StringView name)
|
||||
{
|
||||
return m_child_components.with([&](auto& list) -> LockRefPtr<SysFSComponent> {
|
||||
return m_child_components.with([&](auto& list) -> RefPtr<SysFSComponent> {
|
||||
for (auto& child_component : list) {
|
||||
if (child_component.name() == name) {
|
||||
return child_component;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue