mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-25 04:02:28 +03:00
Kernel: Stop using NonnullLockRefPtrVector
This commit is contained in:
parent
21db2b7b90
commit
7369d0ab5f
Notes:
sideshowbarker
2024-07-17 14:36:19 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/7369d0ab5f
@ -44,11 +44,11 @@ UNMAP_AFTER_INIT ErrorOr<void> 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 {};
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ UNMAP_AFTER_INIT ErrorOr<void> 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<void> 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 {};
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
#include <Kernel/Memory/Region.h>
|
||||
#include <Kernel/PhysicalAddress.h>
|
||||
|
||||
@ -29,7 +28,7 @@ public:
|
||||
u64 raw_counter_ticks_to_ns(u64) const;
|
||||
u64 ns_to_raw_counter_ticks(u64) const;
|
||||
|
||||
NonnullLockRefPtrVector<HPETComparator> const& comparators() const { return m_comparators; }
|
||||
Vector<NonnullLockRefPtr<HPETComparator>> 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<HPETComparator> m_comparators;
|
||||
Vector<NonnullLockRefPtr<HPETComparator>> m_comparators;
|
||||
};
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include <Kernel/Bus/USB/USBController.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtr.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
|
||||
namespace Kernel::USB {
|
||||
|
||||
|
@ -310,10 +310,10 @@ ErrorOr<void> 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) }));
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <Kernel/Devices/DeviceControlDevice.h>
|
||||
#include <Kernel/Devices/NullDevice.h>
|
||||
#include <Kernel/Library/LockRefPtr.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <Kernel/Devices/HID/HIDDevice.h>
|
||||
#include <Kernel/Forward.h>
|
||||
#include <Kernel/Library/LockRefPtr.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
#include <Kernel/Locking/Spinlock.h>
|
||||
#include <Kernel/Locking/SpinlockProtected.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
@ -65,7 +64,7 @@ private:
|
||||
#if ARCH(X86_64)
|
||||
LockRefPtr<I8042Controller> m_i8042_controller;
|
||||
#endif
|
||||
NonnullLockRefPtrVector<HIDDevice> m_hid_devices;
|
||||
Vector<NonnullLockRefPtr<HIDDevice>> m_hid_devices;
|
||||
Spinlock<LockRank::None> m_client_lock {};
|
||||
};
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <Kernel/FileSystem/OpenFileDescription.h>
|
||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||
#include <Kernel/KBufferBuilder.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
#include <Kernel/Memory/SharedInodeVMObject.h>
|
||||
#include <Kernel/Net/LocalSocket.h>
|
||||
#include <Kernel/Process.h>
|
||||
@ -31,7 +30,7 @@ SpinlockProtected<Inode::AllInstancesList, LockRank::None>& Inode::all_instances
|
||||
|
||||
void Inode::sync_all()
|
||||
{
|
||||
NonnullLockRefPtrVector<Inode, 32> inodes;
|
||||
Vector<NonnullLockRefPtr<Inode>, 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,26 +135,26 @@ ErrorOr<void> VirtualFileSystem::remount(Custody& mount_point, int new_flags)
|
||||
|
||||
void VirtualFileSystem::sync_filesystems()
|
||||
{
|
||||
NonnullLockRefPtrVector<FileSystem, 32> file_systems;
|
||||
Vector<NonnullLockRefPtr<FileSystem>, 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<FileSystem, 32> file_systems;
|
||||
Vector<NonnullLockRefPtr<FileSystem>, 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<void> VirtualFileSystem::unmount(Custody& mountpoint_custody)
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <Kernel/Graphics/GenericGraphicsAdapter.h>
|
||||
#include <Kernel/Graphics/VirtIOGPU/GraphicsAdapter.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtr.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
#include <Kernel/Memory/Region.h>
|
||||
|
||||
namespace Kernel {
|
||||
@ -54,7 +53,7 @@ private:
|
||||
|
||||
void initialize_preset_resolution_generic_display_connector();
|
||||
|
||||
NonnullLockRefPtrVector<GenericGraphicsAdapter> m_graphics_devices;
|
||||
Vector<NonnullLockRefPtr<GenericGraphicsAdapter>> m_graphics_devices;
|
||||
LockRefPtr<Graphics::Console> m_console;
|
||||
|
||||
// Note: This is only used when booting with kernel commandline that includes "graphics_subsystem_mode=limited"
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <AK/HashTable.h>
|
||||
#include <AK/IntrusiveRedBlackTree.h>
|
||||
#include <Kernel/Forward.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
#include <Kernel/Locking/Spinlock.h>
|
||||
#include <Kernel/Memory/AllocationStrategy.h>
|
||||
#include <Kernel/Memory/PhysicalPage.h>
|
||||
|
@ -7,6 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <Kernel/Memory/PhysicalPage.h>
|
||||
#include <Kernel/Memory/PhysicalZone.h>
|
||||
|
||||
|
@ -472,7 +472,7 @@ ErrorOr<void> LocalSocket::chown(Credentials const& credentials, OpenFileDescrip
|
||||
return {};
|
||||
}
|
||||
|
||||
NonnullLockRefPtrVector<OpenFileDescription>& LocalSocket::recvfd_queue_for(OpenFileDescription const& description)
|
||||
Vector<NonnullLockRefPtr<OpenFileDescription>>& LocalSocket::recvfd_queue_for(OpenFileDescription const& description)
|
||||
{
|
||||
auto role = this->role(description);
|
||||
if (role == Role::Connected)
|
||||
@ -482,7 +482,7 @@ NonnullLockRefPtrVector<OpenFileDescription>& LocalSocket::recvfd_queue_for(Open
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
NonnullLockRefPtrVector<OpenFileDescription>& LocalSocket::sendfd_queue_for(OpenFileDescription const& description)
|
||||
Vector<NonnullLockRefPtr<OpenFileDescription>>& LocalSocket::sendfd_queue_for(OpenFileDescription const& description)
|
||||
{
|
||||
auto role = this->role(description);
|
||||
if (role == Role::Connected)
|
||||
@ -520,10 +520,10 @@ ErrorOr<NonnullLockRefPtr<OpenFileDescription>> LocalSocket::recvfd(OpenFileDesc
|
||||
return queue.take_first();
|
||||
}
|
||||
|
||||
ErrorOr<NonnullLockRefPtrVector<OpenFileDescription>> LocalSocket::recvfds(OpenFileDescription const& socket_description, int n)
|
||||
ErrorOr<Vector<NonnullLockRefPtr<OpenFileDescription>>> LocalSocket::recvfds(OpenFileDescription const& socket_description, int n)
|
||||
{
|
||||
MutexLocker locker(mutex());
|
||||
NonnullLockRefPtrVector<OpenFileDescription> fds;
|
||||
Vector<NonnullLockRefPtr<OpenFileDescription>> fds;
|
||||
|
||||
auto role = this->role(socket_description);
|
||||
if (role != Role::Connected && role != Role::Accepted)
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
|
||||
ErrorOr<void> sendfd(OpenFileDescription const& socket_description, NonnullLockRefPtr<OpenFileDescription> passing_description);
|
||||
ErrorOr<NonnullLockRefPtr<OpenFileDescription>> recvfd(OpenFileDescription const& socket_description);
|
||||
ErrorOr<NonnullLockRefPtrVector<OpenFileDescription>> recvfds(OpenFileDescription const& socket_description, int n);
|
||||
ErrorOr<Vector<NonnullLockRefPtr<OpenFileDescription>>> recvfds(OpenFileDescription const& socket_description, int n);
|
||||
|
||||
static void for_each(Function<void(LocalSocket const&)>);
|
||||
static ErrorOr<void> try_for_each(Function<ErrorOr<void>(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<OpenFileDescription>& sendfd_queue_for(OpenFileDescription const&);
|
||||
NonnullLockRefPtrVector<OpenFileDescription>& recvfd_queue_for(OpenFileDescription const&);
|
||||
Vector<NonnullLockRefPtr<OpenFileDescription>>& sendfd_queue_for(OpenFileDescription const&);
|
||||
Vector<NonnullLockRefPtr<OpenFileDescription>>& 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<DoubleBuffer> m_for_client;
|
||||
NonnullOwnPtr<DoubleBuffer> m_for_server;
|
||||
|
||||
NonnullLockRefPtrVector<OpenFileDescription> m_fds_for_client;
|
||||
NonnullLockRefPtrVector<OpenFileDescription> m_fds_for_server;
|
||||
Vector<NonnullLockRefPtr<OpenFileDescription>> m_fds_for_client;
|
||||
Vector<NonnullLockRefPtr<OpenFileDescription>> m_fds_for_server;
|
||||
|
||||
IntrusiveListNode<LocalSocket> m_list_node;
|
||||
|
||||
|
@ -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<IPv4Socket> icmp_sockets;
|
||||
Vector<NonnullLockRefPtr<IPv4Socket>> 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<TCPSocket, 16> sockets;
|
||||
Vector<NonnullLockRefPtr<TCPSocket>, 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ LockRefPtr<NetworkAdapter> NetworkingManagement::from_ipv4_address(IPv4Address c
|
||||
return m_loopback_adapter;
|
||||
return m_adapters.with([&](auto& adapters) -> LockRefPtr<NetworkAdapter> {
|
||||
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<NetworkAdapter> NetworkingManagement::lookup_by_name(StringView name)
|
||||
{
|
||||
return m_adapters.with([&](auto& adapters) -> LockRefPtr<NetworkAdapter> {
|
||||
for (auto& adapter : adapters) {
|
||||
if (adapter.name() == name)
|
||||
if (adapter->name() == name)
|
||||
return adapter;
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/Bus/PCI/Definitions.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtr.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
#include <Kernel/Locking/SpinlockProtected.h>
|
||||
#include <Kernel/Memory/Region.h>
|
||||
#include <Kernel/Net/NetworkAdapter.h>
|
||||
@ -42,7 +41,7 @@ public:
|
||||
private:
|
||||
ErrorOr<NonnullLockRefPtr<NetworkAdapter>> determine_network_device(PCI::DeviceIdentifier const&) const;
|
||||
|
||||
SpinlockProtected<NonnullLockRefPtrVector<NetworkAdapter>, LockRank::None> m_adapters {};
|
||||
SpinlockProtected<Vector<NonnullLockRefPtr<NetworkAdapter>>, LockRank::None> m_adapters {};
|
||||
LockRefPtr<NetworkAdapter> m_loopback_adapter;
|
||||
};
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <AK/Time.h>
|
||||
#include <Kernel/FileSystem/File.h>
|
||||
#include <Kernel/Library/LockRefPtr.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
#include <Kernel/Locking/Mutex.h>
|
||||
#include <Kernel/Net/NetworkAdapter.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
@ -182,7 +181,7 @@ private:
|
||||
|
||||
Optional<ErrnoCode> m_so_error;
|
||||
|
||||
NonnullLockRefPtrVector<Socket> m_pending;
|
||||
Vector<NonnullLockRefPtr<Socket>> m_pending;
|
||||
};
|
||||
|
||||
// This is a special variant of TRY() that also updates the socket's SO_ERROR field on error.
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <Kernel/Jail.h>
|
||||
#include <Kernel/Library/LockWeakPtr.h>
|
||||
#include <Kernel/Library/LockWeakable.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
#include <Kernel/Locking/Mutex.h>
|
||||
#include <Kernel/Locking/MutexProtected.h>
|
||||
#include <Kernel/Memory/AddressSpace.h>
|
||||
@ -566,7 +565,7 @@ public:
|
||||
ErrorOr<void> set_coredump_property(NonnullOwnPtr<KString> key, NonnullOwnPtr<KString> value);
|
||||
ErrorOr<void> try_set_coredump_property(StringView key, StringView value);
|
||||
|
||||
NonnullLockRefPtrVector<Thread> const& threads_for_coredump(Badge<Coredump>) const { return m_threads_for_coredump; }
|
||||
Vector<NonnullLockRefPtr<Thread>> const& threads_for_coredump(Badge<Coredump>) 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<Array<CoredumpProperty, 4>, LockRank::None> m_coredump_properties {};
|
||||
NonnullLockRefPtrVector<Thread> m_threads_for_coredump;
|
||||
Vector<NonnullLockRefPtr<Thread>> m_threads_for_coredump;
|
||||
|
||||
struct SignalActionData {
|
||||
VirtualAddress handler_or_sigaction;
|
||||
|
@ -205,7 +205,7 @@ LockRefPtr<StorageDevice> AHCIController::device_by_port(u32 port_index) const
|
||||
|
||||
LockRefPtr<StorageDevice> AHCIController::device(u32 index) const
|
||||
{
|
||||
NonnullLockRefPtrVector<StorageDevice> connected_devices;
|
||||
Vector<NonnullLockRefPtr<StorageDevice>> connected_devices;
|
||||
u32 pi = hba().control_regs.pi;
|
||||
u32 bit = bit_scan_forward(pi);
|
||||
while (bit) {
|
||||
|
@ -149,7 +149,7 @@ protected:
|
||||
RefPtr<Memory::PhysicalPage> m_dma_buffer_page;
|
||||
|
||||
const u8 m_port_index;
|
||||
NonnullLockRefPtrVector<ATADevice> m_ata_devices;
|
||||
Vector<NonnullLockRefPtr<ATADevice>> m_ata_devices;
|
||||
NonnullOwnPtr<KBuffer> m_ata_identify_data_buffer;
|
||||
NonnullLockRefPtr<ATAController> m_parent_ata_controller;
|
||||
};
|
||||
|
@ -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<StorageDevice> 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<StorageDevice> IDEController::device(u32 index) const
|
||||
{
|
||||
NonnullLockRefPtrVector<StorageDevice> connected_devices;
|
||||
Vector<NonnullLockRefPtr<StorageDevice>> connected_devices;
|
||||
for (size_t index = 0; index < 4; index++) {
|
||||
auto checked_device = device_by_channel_and_position(index);
|
||||
if (checked_device.is_null())
|
||||
|
@ -32,6 +32,6 @@ protected:
|
||||
IDEController();
|
||||
|
||||
LockRefPtr<StorageDevice> device_by_channel_and_position(u32 index) const;
|
||||
NonnullLockRefPtrVector<IDEChannel> m_channels;
|
||||
Vector<NonnullLockRefPtr<IDEChannel>> m_channels;
|
||||
};
|
||||
}
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <Kernel/Bus/PCI/Device.h>
|
||||
#include <Kernel/Library/LockRefPtr.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtr.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
#include <Kernel/Locking/Spinlock.h>
|
||||
#include <Kernel/Memory/TypedMapping.h>
|
||||
#include <Kernel/Storage/NVMe/NVMeDefinitions.h>
|
||||
@ -70,8 +69,8 @@ private:
|
||||
|
||||
private:
|
||||
LockRefPtr<NVMeQueue> m_admin_queue;
|
||||
NonnullLockRefPtrVector<NVMeQueue> m_queues;
|
||||
NonnullLockRefPtrVector<NVMeNameSpace> m_namespaces;
|
||||
Vector<NonnullLockRefPtr<NVMeQueue>> m_queues;
|
||||
Vector<NonnullLockRefPtr<NVMeNameSpace>> m_namespaces;
|
||||
Memory::TypedMapping<ControllerRegister volatile> m_controller_regs;
|
||||
bool m_admin_queue_ready { false };
|
||||
size_t m_device_count { 0 };
|
||||
|
@ -12,13 +12,13 @@
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
UNMAP_AFTER_INIT ErrorOr<NonnullLockRefPtr<NVMeNameSpace>> NVMeNameSpace::try_create(NVMeController const& controller, NonnullLockRefPtrVector<NVMeQueue> queues, u16 nsid, size_t storage_size, size_t lba_size)
|
||||
UNMAP_AFTER_INIT ErrorOr<NonnullLockRefPtr<NVMeNameSpace>> NVMeNameSpace::try_create(NVMeController const& controller, Vector<NonnullLockRefPtr<NVMeQueue>> queues, u16 nsid, size_t storage_size, size_t lba_size)
|
||||
{
|
||||
auto device = TRY(DeviceManagement::try_create_device<NVMeNameSpace>(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<NVMeQueue> 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<NonnullLockRefPtr<NVMeQueue>> 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <AK/kmalloc.h>
|
||||
#include <Kernel/Library/LockRefPtr.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtr.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
#include <Kernel/Locking/Spinlock.h>
|
||||
#include <Kernel/Storage/NVMe/NVMeDefinitions.h>
|
||||
#include <Kernel/Storage/NVMe/NVMeQueue.h>
|
||||
@ -24,16 +23,16 @@ class NVMeNameSpace : public StorageDevice {
|
||||
friend class DeviceManagement;
|
||||
|
||||
public:
|
||||
static ErrorOr<NonnullLockRefPtr<NVMeNameSpace>> try_create(NVMeController const&, NonnullLockRefPtrVector<NVMeQueue> queues, u16 nsid, size_t storage_size, size_t lba_size);
|
||||
static ErrorOr<NonnullLockRefPtr<NVMeNameSpace>> try_create(NVMeController const&, Vector<NonnullLockRefPtr<NVMeQueue>> 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<NVMeQueue> queues, size_t storage_size, size_t lba_size, u16 nsid);
|
||||
NVMeNameSpace(LUNAddress, u32 hardware_relative_controller_id, Vector<NonnullLockRefPtr<NVMeQueue>> queues, size_t storage_size, size_t lba_size, u16 nsid);
|
||||
|
||||
u16 m_nsid;
|
||||
NonnullLockRefPtrVector<NVMeQueue> m_queues;
|
||||
Vector<NonnullLockRefPtr<NVMeQueue>> m_queues;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <Kernel/Interrupts/IRQHandler.h>
|
||||
#include <Kernel/Library/LockRefPtr.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtr.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
#include <Kernel/Locking/Spinlock.h>
|
||||
#include <Kernel/Memory/MemoryManager.h>
|
||||
#include <Kernel/Memory/TypedMapping.h>
|
||||
|
@ -31,6 +31,6 @@ public:
|
||||
private:
|
||||
RamdiskController();
|
||||
|
||||
NonnullLockRefPtrVector<RamdiskDevice> m_devices;
|
||||
Vector<NonnullLockRefPtr<RamdiskDevice>> m_devices;
|
||||
};
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
virtual bool can_write(OpenFileDescription const&, u64) const override;
|
||||
virtual void prepare_for_unplug() { m_partitions.clear(); }
|
||||
|
||||
NonnullLockRefPtrVector<DiskPartition> const& partitions() const { return m_partitions; }
|
||||
Vector<NonnullLockRefPtr<DiskPartition>> const& partitions() const { return m_partitions; }
|
||||
|
||||
void add_partition(NonnullLockRefPtr<DiskPartition> disk_partition) { MUST(m_partitions.try_append(disk_partition)); }
|
||||
|
||||
@ -93,7 +93,7 @@ private:
|
||||
virtual void will_be_destroyed() override;
|
||||
|
||||
mutable IntrusiveListNode<StorageDevice, LockRefPtr<StorageDevice>> m_list_node;
|
||||
NonnullLockRefPtrVector<DiskPartition> m_partitions;
|
||||
Vector<NonnullLockRefPtr<DiskPartition>> m_partitions;
|
||||
|
||||
LUNAddress const m_logical_unit_number_address;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/FileSystem/FileSystem.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtr.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
#include <Kernel/Storage/DiskPartition.h>
|
||||
#include <Kernel/Storage/StorageController.h>
|
||||
#include <Kernel/Storage/StorageDevice.h>
|
||||
@ -67,7 +66,7 @@ private:
|
||||
|
||||
StringView m_boot_argument;
|
||||
LockWeakPtr<BlockDevice> m_boot_block_device;
|
||||
NonnullLockRefPtrVector<StorageController> m_controllers;
|
||||
Vector<NonnullLockRefPtr<StorageController>> m_controllers;
|
||||
IntrusiveList<&StorageDevice::m_list_node> m_storage_devices;
|
||||
};
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <Kernel/FileSystem/Custody.h>
|
||||
#include <Kernel/FileSystem/OpenFileDescription.h>
|
||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
#include <Kernel/Process.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
@ -4,7 +4,6 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
#include <Kernel/Memory/AnonymousVMObject.h>
|
||||
#include <Kernel/Memory/InodeVMObject.h>
|
||||
#include <Kernel/Memory/MemoryManager.h>
|
||||
@ -21,7 +20,7 @@ ErrorOr<FlatPtr> Process::sys$purge(int mode)
|
||||
return EPERM;
|
||||
size_t purged_page_count = 0;
|
||||
if (mode & PURGE_ALL_VOLATILE) {
|
||||
NonnullLockRefPtrVector<Memory::AnonymousVMObject> vmobjects;
|
||||
Vector<NonnullLockRefPtr<Memory::AnonymousVMObject>> vmobjects;
|
||||
{
|
||||
ErrorOr<void> result;
|
||||
Memory::MemoryManager::for_each_vmobject([&](auto& vmobject) {
|
||||
@ -40,11 +39,11 @@ ErrorOr<FlatPtr> 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<Memory::InodeVMObject> vmobjects;
|
||||
Vector<NonnullLockRefPtr<Memory::InodeVMObject>> vmobjects;
|
||||
{
|
||||
ErrorOr<void> result;
|
||||
Memory::MemoryManager::for_each_vmobject([&](auto& vmobject) {
|
||||
@ -63,7 +62,7 @@ ErrorOr<FlatPtr> 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;
|
||||
|
@ -313,7 +313,7 @@ ErrorOr<FlatPtr> Process::sys$recvmsg(int sockfd, Userspace<struct msghdr*> user
|
||||
Vector<int> 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)));
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include <AK/RefPtr.h>
|
||||
#include <Kernel/FileSystem/Custody.h>
|
||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
#include <Kernel/Process.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
@ -20,7 +20,7 @@ static Singleton<ConsoleManagement> 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
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtr.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
#include <Kernel/TTY/VirtualConsole.h>
|
||||
|
||||
namespace Kernel {
|
||||
@ -37,7 +36,7 @@ public:
|
||||
RecursiveSpinlock<LockRank::None>& tty_write_lock() { return m_tty_write_lock; }
|
||||
|
||||
private:
|
||||
NonnullLockRefPtrVector<VirtualConsole, s_max_virtual_consoles> m_consoles;
|
||||
Vector<NonnullLockRefPtr<VirtualConsole>, s_max_virtual_consoles> m_consoles;
|
||||
VirtualConsole* m_active_console { nullptr };
|
||||
Spinlock<LockRank::None> m_lock {};
|
||||
RecursiveSpinlock<LockRank::None> m_tty_write_lock {};
|
||||
|
@ -285,10 +285,10 @@ UNMAP_AFTER_INIT Vector<HardwareTimerBase*> TimeManagement::scan_and_initialize_
|
||||
dbgln("Time: Scanning for periodic timers");
|
||||
Vector<HardwareTimerBase*> 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<HardwareTimerBase*> TimeManagement::scan_for_non_periodi
|
||||
dbgln("Time: Scanning for non-periodic timers");
|
||||
Vector<HardwareTimerBase*> 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;
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <Kernel/Arch/RegisterState.h>
|
||||
#include <Kernel/Forward.h>
|
||||
#include <Kernel/Library/LockRefPtr.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtrVector.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
|
||||
namespace Kernel {
|
||||
@ -93,7 +92,7 @@ private:
|
||||
#endif
|
||||
Vector<HardwareTimerBase*> scan_and_initialize_periodic_timers();
|
||||
Vector<HardwareTimerBase*> scan_for_non_periodic_timers();
|
||||
NonnullLockRefPtrVector<HardwareTimerBase> m_hardware_timers;
|
||||
Vector<NonnullLockRefPtr<HardwareTimerBase>> m_hardware_timers;
|
||||
void set_system_timer(HardwareTimerBase&);
|
||||
static void system_timer_tick(RegisterState const&);
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/NonnullPtrVector.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <DevTools/HackStudio/ProjectTemplate.h>
|
||||
|
Loading…
Reference in New Issue
Block a user