diff --git a/Kernel/Arch/x86_64/ISABus/IDEController.cpp b/Kernel/Arch/x86_64/ISABus/IDEController.cpp index fc701d4a8e..870564725d 100644 --- a/Kernel/Arch/x86_64/ISABus/IDEController.cpp +++ b/Kernel/Arch/x86_64/ISABus/IDEController.cpp @@ -44,11 +44,11 @@ UNMAP_AFTER_INIT ErrorOr ISAIDEController::initialize_channels() TRY(m_channels.try_append(IDEChannel::create(*this, move(primary_channel_io_window_group), IDEChannel::ChannelType::Primary))); TRY(initialize_and_enumerate(m_channels[0])); - m_channels[0].enable_irq(); + m_channels[0]->enable_irq(); TRY(m_channels.try_append(IDEChannel::create(*this, move(secondary_channel_io_window_group), IDEChannel::ChannelType::Secondary))); TRY(initialize_and_enumerate(m_channels[1])); - m_channels[1].enable_irq(); + m_channels[1]->enable_irq(); dbgln("ISA IDE controller detected and initialized"); return {}; } diff --git a/Kernel/Arch/x86_64/PCI/IDELegacyModeController.cpp b/Kernel/Arch/x86_64/PCI/IDELegacyModeController.cpp index 080ac29518..219137d91d 100644 --- a/Kernel/Arch/x86_64/PCI/IDELegacyModeController.cpp +++ b/Kernel/Arch/x86_64/PCI/IDELegacyModeController.cpp @@ -152,7 +152,7 @@ UNMAP_AFTER_INIT ErrorOr PCIIDELegacyModeController::initialize_and_enumer TRY(m_channels.try_append(IDEChannel::create(*this, move(primary_channel_io_window_group), IDEChannel::ChannelType::Primary))); } TRY(initialize_and_enumerate(m_channels[0])); - m_channels[0].enable_irq(); + m_channels[0]->enable_irq(); if (is_pci_native_mode_enabled_on_secondary_channel()) { TRY(m_channels.try_append(IDEChannel::create(*this, irq_line, move(secondary_channel_io_window_group), IDEChannel::ChannelType::Secondary))); @@ -160,7 +160,7 @@ UNMAP_AFTER_INIT ErrorOr PCIIDELegacyModeController::initialize_and_enumer TRY(m_channels.try_append(IDEChannel::create(*this, move(secondary_channel_io_window_group), IDEChannel::ChannelType::Secondary))); } TRY(initialize_and_enumerate(m_channels[1])); - m_channels[1].enable_irq(); + m_channels[1]->enable_irq(); return {}; } diff --git a/Kernel/Arch/x86_64/Time/HPET.cpp b/Kernel/Arch/x86_64/Time/HPET.cpp index 88d99d5ca7..13aaa37d62 100644 --- a/Kernel/Arch/x86_64/Time/HPET.cpp +++ b/Kernel/Arch/x86_64/Time/HPET.cpp @@ -187,21 +187,21 @@ void HPET::update_periodic_comparator_value() if (m_main_counter_64bits) regs.main_counter_value.high = 0; for (auto& comparator : m_comparators) { - auto& timer = regs.timers[comparator.comparator_number()]; - if (!comparator.is_enabled()) + auto& timer = regs.timers[comparator->comparator_number()]; + if (!comparator->is_enabled()) continue; - if (comparator.is_periodic()) { + if (comparator->is_periodic()) { // Note that this means we're restarting all periodic timers. There is no // way to resume periodic timers properly because we reset the main counter // and we can only write the period into the comparator value... timer.capabilities = timer.capabilities | (u32)HPETFlags::TimerConfiguration::ValueSet; - u64 value = ns_to_raw_counter_ticks(1000000000ull / comparator.ticks_per_second()); + u64 value = ns_to_raw_counter_ticks(1000000000ull / comparator->ticks_per_second()); dbgln_if(HPET_DEBUG, "HPET: Update periodic comparator {} comparator value to {} main value was: {}", - comparator.comparator_number(), + comparator->comparator_number(), value, previous_main_value); timer.comparator_value.low = (u32)value; - if (comparator.is_64bit_capable()) { + if (comparator->is_64bit_capable()) { timer.capabilities = timer.capabilities | (u32)HPETFlags::TimerConfiguration::ValueSet; timer.comparator_value.high = (u32)(value >> 32); } @@ -210,12 +210,12 @@ void HPET::update_periodic_comparator_value() u64 current_value = (u64)timer.comparator_value.low | ((u64)timer.comparator_value.high << 32); u64 value = current_value - previous_main_value; dbgln_if(HPET_DEBUG, "HPET: Update non-periodic comparator {} comparator value from {} to {} main value was: {}", - comparator.comparator_number(), + comparator->comparator_number(), current_value, value, previous_main_value); timer.comparator_value.low = (u32)value; - if (comparator.is_64bit_capable()) + if (comparator->is_64bit_capable()) timer.comparator_value.high = (u32)(value >> 32); } } diff --git a/Kernel/Arch/x86_64/Time/HPET.h b/Kernel/Arch/x86_64/Time/HPET.h index cfc31426a3..708a991288 100644 --- a/Kernel/Arch/x86_64/Time/HPET.h +++ b/Kernel/Arch/x86_64/Time/HPET.h @@ -9,7 +9,6 @@ #include #include #include -#include #include #include @@ -29,7 +28,7 @@ public: u64 raw_counter_ticks_to_ns(u64) const; u64 ns_to_raw_counter_ticks(u64) const; - NonnullLockRefPtrVector const& comparators() const { return m_comparators; } + Vector> const& comparators() const { return m_comparators; } void disable(HPETComparator const&); void enable(HPETComparator const&); @@ -76,6 +75,6 @@ private: bool m_main_counter_64bits : 1; bool legacy_replacement_route_capable : 1; - NonnullLockRefPtrVector m_comparators; + Vector> m_comparators; }; } diff --git a/Kernel/Bus/USB/USBManagement.h b/Kernel/Bus/USB/USBManagement.h index 9d8da80afe..0abcd42632 100644 --- a/Kernel/Bus/USB/USBManagement.h +++ b/Kernel/Bus/USB/USBManagement.h @@ -8,7 +8,6 @@ #include #include -#include namespace Kernel::USB { diff --git a/Kernel/Coredump.cpp b/Kernel/Coredump.cpp index be9d2811ac..15e444763e 100644 --- a/Kernel/Coredump.cpp +++ b/Kernel/Coredump.cpp @@ -310,10 +310,10 @@ ErrorOr Coredump::create_notes_threads_data(auto& builder) const for (auto const& thread : m_process->threads_for_coredump({})) { ELF::Core::ThreadInfo info {}; info.header.type = ELF::Core::NotesEntryHeader::Type::ThreadInfo; - info.tid = thread.tid().value(); + info.tid = thread->tid().value(); - if (thread.current_trap()) - copy_kernel_registers_into_ptrace_registers(info.regs, thread.get_register_dump_from_stack()); + if (thread->current_trap()) + copy_kernel_registers_into_ptrace_registers(info.regs, thread->get_register_dump_from_stack()); TRY(builder.append_bytes(ReadonlyBytes { &info, sizeof(info) })); } diff --git a/Kernel/Devices/DeviceManagement.h b/Kernel/Devices/DeviceManagement.h index e4347f0381..805639d949 100644 --- a/Kernel/Devices/DeviceManagement.h +++ b/Kernel/Devices/DeviceManagement.h @@ -19,7 +19,6 @@ #include #include #include -#include #include namespace Kernel { diff --git a/Kernel/Devices/HID/HIDManagement.h b/Kernel/Devices/HID/HIDManagement.h index bf1d17f5b1..157ef94afd 100644 --- a/Kernel/Devices/HID/HIDManagement.h +++ b/Kernel/Devices/HID/HIDManagement.h @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -65,7 +64,7 @@ private: #if ARCH(X86_64) LockRefPtr m_i8042_controller; #endif - NonnullLockRefPtrVector m_hid_devices; + Vector> m_hid_devices; Spinlock m_client_lock {}; }; diff --git a/Kernel/FileSystem/Inode.cpp b/Kernel/FileSystem/Inode.cpp index 1eea0c0b82..ae838f2468 100644 --- a/Kernel/FileSystem/Inode.cpp +++ b/Kernel/FileSystem/Inode.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -31,7 +30,7 @@ SpinlockProtected& Inode::all_instances void Inode::sync_all() { - NonnullLockRefPtrVector inodes; + Vector, 32> inodes; Inode::all_instances().with([&](auto& all_inodes) { for (auto& inode : all_inodes) { if (inode.is_metadata_dirty()) @@ -40,8 +39,8 @@ void Inode::sync_all() }); for (auto& inode : inodes) { - VERIFY(inode.is_metadata_dirty()); - (void)inode.flush_metadata(); + VERIFY(inode->is_metadata_dirty()); + (void)inode->flush_metadata(); } } diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp index f7f70ca46c..4ad76550d8 100644 --- a/Kernel/FileSystem/VirtualFileSystem.cpp +++ b/Kernel/FileSystem/VirtualFileSystem.cpp @@ -135,26 +135,26 @@ ErrorOr VirtualFileSystem::remount(Custody& mount_point, int new_flags) void VirtualFileSystem::sync_filesystems() { - NonnullLockRefPtrVector file_systems; + Vector, 32> file_systems; m_file_systems_list.with([&](auto const& list) { for (auto& fs : list) file_systems.append(fs); }); for (auto& fs : file_systems) - fs.flush_writes(); + fs->flush_writes(); } void VirtualFileSystem::lock_all_filesystems() { - NonnullLockRefPtrVector file_systems; + Vector, 32> file_systems; m_file_systems_list.with([&](auto const& list) { for (auto& fs : list) file_systems.append(fs); }); for (auto& fs : file_systems) - fs.m_lock.lock(); + fs->m_lock.lock(); } ErrorOr VirtualFileSystem::unmount(Custody& mountpoint_custody) diff --git a/Kernel/Graphics/GraphicsManagement.h b/Kernel/Graphics/GraphicsManagement.h index ee30adf3ce..c7432f639d 100644 --- a/Kernel/Graphics/GraphicsManagement.h +++ b/Kernel/Graphics/GraphicsManagement.h @@ -19,7 +19,6 @@ #include #include #include -#include #include namespace Kernel { @@ -54,7 +53,7 @@ private: void initialize_preset_resolution_generic_display_connector(); - NonnullLockRefPtrVector m_graphics_devices; + Vector> m_graphics_devices; LockRefPtr m_console; // Note: This is only used when booting with kernel commandline that includes "graphics_subsystem_mode=limited" diff --git a/Kernel/Memory/MemoryManager.h b/Kernel/Memory/MemoryManager.h index 1e727368f9..1c023001da 100644 --- a/Kernel/Memory/MemoryManager.h +++ b/Kernel/Memory/MemoryManager.h @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include diff --git a/Kernel/Memory/PhysicalRegion.h b/Kernel/Memory/PhysicalRegion.h index 9843a96265..72b5e2d87d 100644 --- a/Kernel/Memory/PhysicalRegion.h +++ b/Kernel/Memory/PhysicalRegion.h @@ -7,6 +7,7 @@ #pragma once #include +#include #include #include diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp index 33db0b60b0..f1cbc13d57 100644 --- a/Kernel/Net/LocalSocket.cpp +++ b/Kernel/Net/LocalSocket.cpp @@ -472,7 +472,7 @@ ErrorOr LocalSocket::chown(Credentials const& credentials, OpenFileDescrip return {}; } -NonnullLockRefPtrVector& LocalSocket::recvfd_queue_for(OpenFileDescription const& description) +Vector>& LocalSocket::recvfd_queue_for(OpenFileDescription const& description) { auto role = this->role(description); if (role == Role::Connected) @@ -482,7 +482,7 @@ NonnullLockRefPtrVector& LocalSocket::recvfd_queue_for(Open VERIFY_NOT_REACHED(); } -NonnullLockRefPtrVector& LocalSocket::sendfd_queue_for(OpenFileDescription const& description) +Vector>& LocalSocket::sendfd_queue_for(OpenFileDescription const& description) { auto role = this->role(description); if (role == Role::Connected) @@ -520,10 +520,10 @@ ErrorOr> LocalSocket::recvfd(OpenFileDesc return queue.take_first(); } -ErrorOr> LocalSocket::recvfds(OpenFileDescription const& socket_description, int n) +ErrorOr>> LocalSocket::recvfds(OpenFileDescription const& socket_description, int n) { MutexLocker locker(mutex()); - NonnullLockRefPtrVector fds; + Vector> fds; auto role = this->role(socket_description); if (role != Role::Connected && role != Role::Accepted) diff --git a/Kernel/Net/LocalSocket.h b/Kernel/Net/LocalSocket.h index 9698a49384..5bdfa512e9 100644 --- a/Kernel/Net/LocalSocket.h +++ b/Kernel/Net/LocalSocket.h @@ -28,7 +28,7 @@ public: ErrorOr sendfd(OpenFileDescription const& socket_description, NonnullLockRefPtr passing_description); ErrorOr> recvfd(OpenFileDescription const& socket_description); - ErrorOr> recvfds(OpenFileDescription const& socket_description, int n); + ErrorOr>> recvfds(OpenFileDescription const& socket_description, int n); static void for_each(Function); static ErrorOr try_for_each(Function(LocalSocket const&)>); @@ -60,8 +60,8 @@ private: bool has_attached_peer(OpenFileDescription const&) const; DoubleBuffer* receive_buffer_for(OpenFileDescription&); DoubleBuffer* send_buffer_for(OpenFileDescription&); - NonnullLockRefPtrVector& sendfd_queue_for(OpenFileDescription const&); - NonnullLockRefPtrVector& recvfd_queue_for(OpenFileDescription const&); + Vector>& sendfd_queue_for(OpenFileDescription const&); + Vector>& recvfd_queue_for(OpenFileDescription const&); void set_connect_side_role(Role connect_side_role, bool force_evaluate_block_conditions = false) { @@ -101,8 +101,8 @@ private: NonnullOwnPtr m_for_client; NonnullOwnPtr m_for_server; - NonnullLockRefPtrVector m_fds_for_client; - NonnullLockRefPtrVector m_fds_for_server; + Vector> m_fds_for_client; + Vector> m_fds_for_server; IntrusiveListNode m_list_node; diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp index 2bb134e632..5b90d4ad33 100644 --- a/Kernel/Net/NetworkTask.cpp +++ b/Kernel/Net/NetworkTask.cpp @@ -229,7 +229,7 @@ void handle_icmp(EthernetFrameHeader const& eth, IPv4Packet const& ipv4_packet, dbgln_if(ICMP_DEBUG, "handle_icmp: source={}, destination={}, type={:#02x}, code={:#02x}", ipv4_packet.source().to_string(), ipv4_packet.destination().to_string(), icmp_header.type(), icmp_header.code()); { - NonnullLockRefPtrVector icmp_sockets; + Vector> icmp_sockets; IPv4Socket::all_sockets().with_exclusive([&](auto& sockets) { for (auto& socket : sockets) { if (socket.protocol() == (unsigned)IPv4Protocol::ICMP) @@ -237,7 +237,7 @@ void handle_icmp(EthernetFrameHeader const& eth, IPv4Packet const& ipv4_packet, } }); for (auto& socket : icmp_sockets) - socket.did_receive(ipv4_packet.source(), 0, { &ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size() }, packet_timestamp); + socket->did_receive(ipv4_packet.source(), 0, { &ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size() }, packet_timestamp); } auto adapter = NetworkingManagement::the().from_ipv4_address(ipv4_packet.destination()); @@ -657,7 +657,7 @@ void retransmit_tcp_packets() { // We must keep the sockets alive until after we've unlocked the hash table // in case retransmit_packets() realizes that it wants to close the socket. - NonnullLockRefPtrVector sockets; + Vector, 16> sockets; TCPSocket::sockets_for_retransmit().for_each_shared([&](auto const& socket) { // We ignore allocation failures above the first 16 guaranteed socket slots, as // we will just retransmit their packets the next time around @@ -665,8 +665,8 @@ void retransmit_tcp_packets() }); for (auto& socket : sockets) { - MutexLocker socket_locker(socket.mutex()); - socket.retransmit_packets(); + MutexLocker socket_locker(socket->mutex()); + socket->retransmit_packets(); } } diff --git a/Kernel/Net/NetworkingManagement.cpp b/Kernel/Net/NetworkingManagement.cpp index d0d95a123e..0a80587ecf 100644 --- a/Kernel/Net/NetworkingManagement.cpp +++ b/Kernel/Net/NetworkingManagement.cpp @@ -64,7 +64,7 @@ LockRefPtr NetworkingManagement::from_ipv4_address(IPv4Address c return m_loopback_adapter; return m_adapters.with([&](auto& adapters) -> LockRefPtr { for (auto& adapter : adapters) { - if (adapter.ipv4_address() == address || adapter.ipv4_broadcast() == address) + if (adapter->ipv4_address() == address || adapter->ipv4_broadcast() == address) return adapter; } return nullptr; @@ -75,7 +75,7 @@ LockRefPtr NetworkingManagement::lookup_by_name(StringView name) { return m_adapters.with([&](auto& adapters) -> LockRefPtr { for (auto& adapter : adapters) { - if (adapter.name() == name) + if (adapter->name() == name) return adapter; } return nullptr; diff --git a/Kernel/Net/NetworkingManagement.h b/Kernel/Net/NetworkingManagement.h index ab4f3bc25f..60ecc2c926 100644 --- a/Kernel/Net/NetworkingManagement.h +++ b/Kernel/Net/NetworkingManagement.h @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -42,7 +41,7 @@ public: private: ErrorOr> determine_network_device(PCI::DeviceIdentifier const&) const; - SpinlockProtected, LockRank::None> m_adapters {}; + SpinlockProtected>, LockRank::None> m_adapters {}; LockRefPtr m_loopback_adapter; }; diff --git a/Kernel/Net/Socket.h b/Kernel/Net/Socket.h index 182a06bc5b..04fe6efd86 100644 --- a/Kernel/Net/Socket.h +++ b/Kernel/Net/Socket.h @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -182,7 +181,7 @@ private: Optional m_so_error; - NonnullLockRefPtrVector m_pending; + Vector> m_pending; }; // This is a special variant of TRY() that also updates the socket's SO_ERROR field on error. diff --git a/Kernel/Process.h b/Kernel/Process.h index 77cb2b0f31..1588940a36 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -566,7 +565,7 @@ public: ErrorOr set_coredump_property(NonnullOwnPtr key, NonnullOwnPtr value); ErrorOr try_set_coredump_property(StringView key, StringView value); - NonnullLockRefPtrVector const& threads_for_coredump(Badge) const { return m_threads_for_coredump; } + Vector> const& threads_for_coredump(Badge) const { return m_threads_for_coredump; } PerformanceEventBuffer* perf_events() { return m_perf_event_buffer; } PerformanceEventBuffer const* perf_events() const { return m_perf_event_buffer; } @@ -882,7 +881,7 @@ private: }; SpinlockProtected, LockRank::None> m_coredump_properties {}; - NonnullLockRefPtrVector m_threads_for_coredump; + Vector> m_threads_for_coredump; struct SignalActionData { VirtualAddress handler_or_sigaction; diff --git a/Kernel/Storage/ATA/AHCI/Controller.cpp b/Kernel/Storage/ATA/AHCI/Controller.cpp index 13f8ef066c..23105ba65d 100644 --- a/Kernel/Storage/ATA/AHCI/Controller.cpp +++ b/Kernel/Storage/ATA/AHCI/Controller.cpp @@ -205,7 +205,7 @@ LockRefPtr AHCIController::device_by_port(u32 port_index) const LockRefPtr AHCIController::device(u32 index) const { - NonnullLockRefPtrVector connected_devices; + Vector> connected_devices; u32 pi = hba().control_regs.pi; u32 bit = bit_scan_forward(pi); while (bit) { diff --git a/Kernel/Storage/ATA/ATAPort.h b/Kernel/Storage/ATA/ATAPort.h index bb876cad7f..ef6942d1af 100644 --- a/Kernel/Storage/ATA/ATAPort.h +++ b/Kernel/Storage/ATA/ATAPort.h @@ -149,7 +149,7 @@ protected: RefPtr m_dma_buffer_page; const u8 m_port_index; - NonnullLockRefPtrVector m_ata_devices; + Vector> m_ata_devices; NonnullOwnPtr m_ata_identify_data_buffer; NonnullLockRefPtr m_parent_ata_controller; }; diff --git a/Kernel/Storage/ATA/GenericIDE/Controller.cpp b/Kernel/Storage/ATA/GenericIDE/Controller.cpp index 1f1aea0e8e..b4458d8bb6 100644 --- a/Kernel/Storage/ATA/GenericIDE/Controller.cpp +++ b/Kernel/Storage/ATA/GenericIDE/Controller.cpp @@ -46,13 +46,13 @@ void IDEController::start_request(ATADevice const& device, AsyncBlockDeviceReque VERIFY(address.subport < 2); switch (address.port) { case 0: { - auto result = m_channels[0].start_request(device, request); + auto result = m_channels[0]->start_request(device, request); // FIXME: Propagate errors properly VERIFY(!result.is_error()); return; } case 1: { - auto result = m_channels[1].start_request(device, request); + auto result = m_channels[1]->start_request(device, request); // FIXME: Propagate errors properly VERIFY(!result.is_error()); return; @@ -73,20 +73,20 @@ LockRefPtr IDEController::device_by_channel_and_position(u32 inde { switch (index) { case 0: - return m_channels[0].connected_device(0); + return m_channels[0]->connected_device(0); case 1: - return m_channels[0].connected_device(1); + return m_channels[0]->connected_device(1); case 2: - return m_channels[1].connected_device(0); + return m_channels[1]->connected_device(0); case 3: - return m_channels[1].connected_device(1); + return m_channels[1]->connected_device(1); } VERIFY_NOT_REACHED(); } LockRefPtr IDEController::device(u32 index) const { - NonnullLockRefPtrVector connected_devices; + Vector> connected_devices; for (size_t index = 0; index < 4; index++) { auto checked_device = device_by_channel_and_position(index); if (checked_device.is_null()) diff --git a/Kernel/Storage/ATA/GenericIDE/Controller.h b/Kernel/Storage/ATA/GenericIDE/Controller.h index 406bcad5d4..75f8907018 100644 --- a/Kernel/Storage/ATA/GenericIDE/Controller.h +++ b/Kernel/Storage/ATA/GenericIDE/Controller.h @@ -32,6 +32,6 @@ protected: IDEController(); LockRefPtr device_by_channel_and_position(u32 index) const; - NonnullLockRefPtrVector m_channels; + Vector> m_channels; }; } diff --git a/Kernel/Storage/NVMe/NVMeController.h b/Kernel/Storage/NVMe/NVMeController.h index 8c51bf438d..e07d447acf 100644 --- a/Kernel/Storage/NVMe/NVMeController.h +++ b/Kernel/Storage/NVMe/NVMeController.h @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -70,8 +69,8 @@ private: private: LockRefPtr m_admin_queue; - NonnullLockRefPtrVector m_queues; - NonnullLockRefPtrVector m_namespaces; + Vector> m_queues; + Vector> m_namespaces; Memory::TypedMapping m_controller_regs; bool m_admin_queue_ready { false }; size_t m_device_count { 0 }; diff --git a/Kernel/Storage/NVMe/NVMeNameSpace.cpp b/Kernel/Storage/NVMe/NVMeNameSpace.cpp index f126f8c10f..48e5d2551a 100644 --- a/Kernel/Storage/NVMe/NVMeNameSpace.cpp +++ b/Kernel/Storage/NVMe/NVMeNameSpace.cpp @@ -12,13 +12,13 @@ namespace Kernel { -UNMAP_AFTER_INIT ErrorOr> NVMeNameSpace::try_create(NVMeController const& controller, NonnullLockRefPtrVector queues, u16 nsid, size_t storage_size, size_t lba_size) +UNMAP_AFTER_INIT ErrorOr> NVMeNameSpace::try_create(NVMeController const& controller, Vector> queues, u16 nsid, size_t storage_size, size_t lba_size) { auto device = TRY(DeviceManagement::try_create_device(StorageDevice::LUNAddress { controller.controller_id(), nsid, 0 }, controller.hardware_relative_controller_id(), move(queues), storage_size, lba_size, nsid)); return device; } -UNMAP_AFTER_INIT NVMeNameSpace::NVMeNameSpace(LUNAddress logical_unit_number_address, u32 hardware_relative_controller_id, NonnullLockRefPtrVector queues, size_t max_addresable_block, size_t lba_size, u16 nsid) +UNMAP_AFTER_INIT NVMeNameSpace::NVMeNameSpace(LUNAddress logical_unit_number_address, u32 hardware_relative_controller_id, Vector> queues, size_t max_addresable_block, size_t lba_size, u16 nsid) : StorageDevice(logical_unit_number_address, hardware_relative_controller_id, lba_size, max_addresable_block) , m_nsid(nsid) , m_queues(move(queues)) @@ -34,9 +34,9 @@ void NVMeNameSpace::start_request(AsyncBlockDeviceRequest& request) VERIFY(request.block_count() <= (PAGE_SIZE / block_size())); if (request.request_type() == AsyncBlockDeviceRequest::Read) { - queue.read(request, m_nsid, request.block_index(), request.block_count()); + queue->read(request, m_nsid, request.block_index(), request.block_count()); } else { - queue.write(request, m_nsid, request.block_index(), request.block_count()); + queue->write(request, m_nsid, request.block_index(), request.block_count()); } } } diff --git a/Kernel/Storage/NVMe/NVMeNameSpace.h b/Kernel/Storage/NVMe/NVMeNameSpace.h index f7c5a1225f..92081b7338 100644 --- a/Kernel/Storage/NVMe/NVMeNameSpace.h +++ b/Kernel/Storage/NVMe/NVMeNameSpace.h @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -24,16 +23,16 @@ class NVMeNameSpace : public StorageDevice { friend class DeviceManagement; public: - static ErrorOr> try_create(NVMeController const&, NonnullLockRefPtrVector queues, u16 nsid, size_t storage_size, size_t lba_size); + static ErrorOr> try_create(NVMeController const&, Vector> queues, u16 nsid, size_t storage_size, size_t lba_size); CommandSet command_set() const override { return CommandSet::NVMe; }; void start_request(AsyncBlockDeviceRequest& request) override; private: - NVMeNameSpace(LUNAddress, u32 hardware_relative_controller_id, NonnullLockRefPtrVector queues, size_t storage_size, size_t lba_size, u16 nsid); + NVMeNameSpace(LUNAddress, u32 hardware_relative_controller_id, Vector> queues, size_t storage_size, size_t lba_size, u16 nsid); u16 m_nsid; - NonnullLockRefPtrVector m_queues; + Vector> m_queues; }; } diff --git a/Kernel/Storage/NVMe/NVMeQueue.h b/Kernel/Storage/NVMe/NVMeQueue.h index be0b864f4e..46f386c726 100644 --- a/Kernel/Storage/NVMe/NVMeQueue.h +++ b/Kernel/Storage/NVMe/NVMeQueue.h @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include diff --git a/Kernel/Storage/Ramdisk/Controller.h b/Kernel/Storage/Ramdisk/Controller.h index 56c31a0c03..64661663b2 100644 --- a/Kernel/Storage/Ramdisk/Controller.h +++ b/Kernel/Storage/Ramdisk/Controller.h @@ -31,6 +31,6 @@ public: private: RamdiskController(); - NonnullLockRefPtrVector m_devices; + Vector> m_devices; }; } diff --git a/Kernel/Storage/StorageDevice.h b/Kernel/Storage/StorageDevice.h index 7497e9637f..b66a94f062 100644 --- a/Kernel/Storage/StorageDevice.h +++ b/Kernel/Storage/StorageDevice.h @@ -63,7 +63,7 @@ public: virtual bool can_write(OpenFileDescription const&, u64) const override; virtual void prepare_for_unplug() { m_partitions.clear(); } - NonnullLockRefPtrVector const& partitions() const { return m_partitions; } + Vector> const& partitions() const { return m_partitions; } void add_partition(NonnullLockRefPtr disk_partition) { MUST(m_partitions.try_append(disk_partition)); } @@ -93,7 +93,7 @@ private: virtual void will_be_destroyed() override; mutable IntrusiveListNode> m_list_node; - NonnullLockRefPtrVector m_partitions; + Vector> m_partitions; LUNAddress const m_logical_unit_number_address; diff --git a/Kernel/Storage/StorageManagement.cpp b/Kernel/Storage/StorageManagement.cpp index 62ec69ed62..7fa774d8d2 100644 --- a/Kernel/Storage/StorageManagement.cpp +++ b/Kernel/Storage/StorageManagement.cpp @@ -129,8 +129,8 @@ UNMAP_AFTER_INIT void StorageManagement::enumerate_storage_devices() { VERIFY(!m_controllers.is_empty()); for (auto& controller : m_controllers) { - for (size_t device_index = 0; device_index < controller.devices_count(); device_index++) { - auto device = controller.device(device_index); + for (size_t device_index = 0; device_index < controller->devices_count(); device_index++) { + auto device = controller->device(device_index); if (device.is_null()) continue; m_storage_devices.append(device.release_nonnull()); @@ -149,7 +149,7 @@ UNMAP_AFTER_INIT void StorageManagement::dump_storage_devices_and_partitions() c dbgln(" Device: block{}:{} ({} partitions)", storage_device.major(), storage_device.minor(), partitions.size()); unsigned partition_number = 1; for (auto const& partition : partitions) { - dbgln(" Partition: {}, block{}:{} (UUID {})", partition_number, partition.major(), partition.minor(), partition.metadata().unique_guid().to_string()); + dbgln(" Partition: {}, block{}:{} (UUID {})", partition_number, partition->major(), partition->minor(), partition->metadata().unique_guid().to_string()); partition_number++; } } @@ -375,9 +375,9 @@ UNMAP_AFTER_INIT void StorageManagement::determine_boot_device_with_partition_uu for (auto& storage_device : m_storage_devices) { for (auto& partition : storage_device.partitions()) { - if (partition.metadata().unique_guid().is_zero()) + if (partition->metadata().unique_guid().is_zero()) continue; - if (partition.metadata().unique_guid() == partition_uuid) { + if (partition->metadata().unique_guid() == partition_uuid) { m_boot_block_device = partition; break; } diff --git a/Kernel/Storage/StorageManagement.h b/Kernel/Storage/StorageManagement.h index f8512ba13f..bdc30935ed 100644 --- a/Kernel/Storage/StorageManagement.h +++ b/Kernel/Storage/StorageManagement.h @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -67,7 +66,7 @@ private: StringView m_boot_argument; LockWeakPtr m_boot_block_device; - NonnullLockRefPtrVector m_controllers; + Vector> m_controllers; IntrusiveList<&StorageDevice::m_list_node> m_storage_devices; }; diff --git a/Kernel/Syscalls/chown.cpp b/Kernel/Syscalls/chown.cpp index 1075f1bba9..69d2934a35 100644 --- a/Kernel/Syscalls/chown.cpp +++ b/Kernel/Syscalls/chown.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include namespace Kernel { diff --git a/Kernel/Syscalls/purge.cpp b/Kernel/Syscalls/purge.cpp index 0512c52f03..50af18da03 100644 --- a/Kernel/Syscalls/purge.cpp +++ b/Kernel/Syscalls/purge.cpp @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include #include #include #include @@ -21,7 +20,7 @@ ErrorOr Process::sys$purge(int mode) return EPERM; size_t purged_page_count = 0; if (mode & PURGE_ALL_VOLATILE) { - NonnullLockRefPtrVector vmobjects; + Vector> vmobjects; { ErrorOr result; Memory::MemoryManager::for_each_vmobject([&](auto& vmobject) { @@ -40,11 +39,11 @@ ErrorOr Process::sys$purge(int mode) return result.release_error(); } for (auto& vmobject : vmobjects) { - purged_page_count += vmobject.purge(); + purged_page_count += vmobject->purge(); } } if (mode & PURGE_ALL_CLEAN_INODE) { - NonnullLockRefPtrVector vmobjects; + Vector> vmobjects; { ErrorOr result; Memory::MemoryManager::for_each_vmobject([&](auto& vmobject) { @@ -63,7 +62,7 @@ ErrorOr Process::sys$purge(int mode) return result.release_error(); } for (auto& vmobject : vmobjects) { - purged_page_count += vmobject.release_all_clean_pages(); + purged_page_count += vmobject->release_all_clean_pages(); } } return purged_page_count; diff --git a/Kernel/Syscalls/socket.cpp b/Kernel/Syscalls/socket.cpp index f29598a35d..59d8885d27 100644 --- a/Kernel/Syscalls/socket.cpp +++ b/Kernel/Syscalls/socket.cpp @@ -313,7 +313,7 @@ ErrorOr Process::sys$recvmsg(int sockfd, Userspace user Vector fdnums; for (auto& description : descriptions) { auto fd_allocation = TRY(m_fds.with_exclusive([](auto& fds) { return fds.allocate(); })); - m_fds.with_exclusive([&](auto& fds) { fds[fd_allocation.fd].set(description, 0); }); + m_fds.with_exclusive([&](auto& fds) { fds[fd_allocation.fd].set(*description, 0); }); fdnums.append(fd_allocation.fd); } TRY(try_add_cmsg(SOL_SOCKET, SCM_RIGHTS, fdnums.data(), fdnums.size() * sizeof(int))); diff --git a/Kernel/Syscalls/stat.cpp b/Kernel/Syscalls/stat.cpp index 650c88eb83..f2ceeb215b 100644 --- a/Kernel/Syscalls/stat.cpp +++ b/Kernel/Syscalls/stat.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include namespace Kernel { diff --git a/Kernel/TTY/ConsoleManagement.cpp b/Kernel/TTY/ConsoleManagement.cpp index 752d471986..87cd8c431a 100644 --- a/Kernel/TTY/ConsoleManagement.cpp +++ b/Kernel/TTY/ConsoleManagement.cpp @@ -20,7 +20,7 @@ static Singleton s_the; void ConsoleManagement::resolution_was_changed() { for (auto& console : m_consoles) { - console.refresh_after_resolution_change(); + console->refresh_after_resolution_change(); } } @@ -60,7 +60,7 @@ UNMAP_AFTER_INIT void ConsoleManagement::initialize() if (tty_number > m_consoles.size()) { PANIC("Switch to tty value is invalid: {} ", tty_number); } - m_active_console = &m_consoles[tty_number]; + m_active_console = m_consoles[tty_number]; SpinlockLocker lock(m_lock); m_active_console->set_active(true); if (!m_active_console->is_graphical()) @@ -77,7 +77,7 @@ void ConsoleManagement::switch_to(unsigned index) bool was_graphical = m_active_console->is_graphical(); m_active_console->set_active(false); - m_active_console = &m_consoles[index]; + m_active_console = m_consoles[index]; dbgln_if(VIRTUAL_CONSOLE_DEBUG, "Console: Switch to {}", index); // Before setting current console to be "active", switch between graphical mode to "textual" mode diff --git a/Kernel/TTY/ConsoleManagement.h b/Kernel/TTY/ConsoleManagement.h index 675c931228..ff8122f777 100644 --- a/Kernel/TTY/ConsoleManagement.h +++ b/Kernel/TTY/ConsoleManagement.h @@ -8,7 +8,6 @@ #include #include -#include #include namespace Kernel { @@ -37,7 +36,7 @@ public: RecursiveSpinlock& tty_write_lock() { return m_tty_write_lock; } private: - NonnullLockRefPtrVector m_consoles; + Vector, s_max_virtual_consoles> m_consoles; VirtualConsole* m_active_console { nullptr }; Spinlock m_lock {}; RecursiveSpinlock m_tty_write_lock {}; diff --git a/Kernel/Time/TimeManagement.cpp b/Kernel/Time/TimeManagement.cpp index e11eb47226..49e257c660 100644 --- a/Kernel/Time/TimeManagement.cpp +++ b/Kernel/Time/TimeManagement.cpp @@ -285,10 +285,10 @@ UNMAP_AFTER_INIT Vector TimeManagement::scan_and_initialize_ dbgln("Time: Scanning for periodic timers"); Vector timers; for (auto& hardware_timer : m_hardware_timers) { - if (hardware_timer.is_periodic_capable()) { - timers.append(&hardware_timer); + if (hardware_timer->is_periodic_capable()) { + timers.append(hardware_timer); if (should_enable) - hardware_timer.set_periodic(); + hardware_timer->set_periodic(); } } return timers; @@ -299,8 +299,8 @@ UNMAP_AFTER_INIT Vector TimeManagement::scan_for_non_periodi dbgln("Time: Scanning for non-periodic timers"); Vector timers; for (auto& hardware_timer : m_hardware_timers) { - if (!hardware_timer.is_periodic_capable()) - timers.append(&hardware_timer); + if (!hardware_timer->is_periodic_capable()) + timers.append(hardware_timer); } return timers; } diff --git a/Kernel/Time/TimeManagement.h b/Kernel/Time/TimeManagement.h index 4346f16925..01547c3901 100644 --- a/Kernel/Time/TimeManagement.h +++ b/Kernel/Time/TimeManagement.h @@ -15,7 +15,6 @@ #include #include #include -#include #include namespace Kernel { @@ -93,7 +92,7 @@ private: #endif Vector scan_and_initialize_periodic_timers(); Vector scan_for_non_periodic_timers(); - NonnullLockRefPtrVector m_hardware_timers; + Vector> m_hardware_timers; void set_system_timer(HardwareTimerBase&); static void system_timer_tick(RegisterState const&); diff --git a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h index a7509c4c7e..34eb0cf8af 100644 --- a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h +++ b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h @@ -7,7 +7,6 @@ #pragma once -#include #include #include #include