diff options
Diffstat (limited to 'Kernel')
96 files changed, 505 insertions, 505 deletions
diff --git a/Kernel/Arch/x86/IO.h b/Kernel/Arch/x86/IO.h index f38dfc89bd..79a7b92a4c 100644 --- a/Kernel/Arch/x86/IO.h +++ b/Kernel/Arch/x86/IO.h @@ -148,6 +148,6 @@ template<> struct AK::Formatter<IOAddress> : AK::Formatter<FormatString> { ErrorOr<void> format(FormatBuilder& builder, IOAddress value) { - return Formatter<FormatString>::format(builder, "IO {:x}", value.get()); + return Formatter<FormatString>::format(builder, "IO {:x}"sv, value.get()); } }; diff --git a/Kernel/Arch/x86/ProcessorInfo.h b/Kernel/Arch/x86/ProcessorInfo.h index c417fd6ac4..6bb90b0ea7 100644 --- a/Kernel/Arch/x86/ProcessorInfo.h +++ b/Kernel/Arch/x86/ProcessorInfo.h @@ -42,8 +42,8 @@ public: void set_apic_id(u32 apic_id) { m_apic_id = apic_id; } - static constexpr StringView s_amd_vendor_id = "AuthenticAMD"; - static constexpr StringView s_intel_vendor_id = "GenuineIntel"; + static constexpr StringView s_amd_vendor_id = "AuthenticAMD"sv; + static constexpr StringView s_intel_vendor_id = "GenuineIntel"sv; private: static NonnullOwnPtr<KString> build_vendor_id_string(); diff --git a/Kernel/Arch/x86/common/InterruptManagement.cpp b/Kernel/Arch/x86/common/InterruptManagement.cpp index 08174be0ec..5a137c38e1 100644 --- a/Kernel/Arch/x86/common/InterruptManagement.cpp +++ b/Kernel/Arch/x86/common/InterruptManagement.cpp @@ -126,7 +126,7 @@ UNMAP_AFTER_INIT PhysicalAddress InterruptManagement::search_for_madt() auto rsdp = ACPI::StaticParsing::find_rsdp(); if (!rsdp.has_value()) return {}; - auto apic = ACPI::StaticParsing::find_table(rsdp.value(), "APIC"); + auto apic = ACPI::StaticParsing::find_table(rsdp.value(), "APIC"sv); if (!apic.has_value()) return {}; return apic.value(); diff --git a/Kernel/Bus/PCI/Access.cpp b/Kernel/Bus/PCI/Access.cpp index cc0886aa18..c8c7af840d 100644 --- a/Kernel/Bus/PCI/Access.cpp +++ b/Kernel/Bus/PCI/Access.cpp @@ -74,7 +74,7 @@ UNMAP_AFTER_INIT bool Access::find_and_register_pci_host_bridges_from_acpi_mcfg_ dbgln("Failed to round up length of {} to pages", length); return false; } - auto mcfg_region_or_error = MM.allocate_kernel_region(mcfg_table.page_base(), region_size_or_error.value(), "PCI Parsing MCFG", Memory::Region::Access::ReadWrite); + auto mcfg_region_or_error = MM.allocate_kernel_region(mcfg_table.page_base(), region_size_or_error.value(), "PCI Parsing MCFG"sv, Memory::Region::Access::ReadWrite); if (mcfg_region_or_error.is_error()) return false; auto& mcfg = *(ACPI::Structures::MCFG*)mcfg_region_or_error.value()->vaddr().offset(mcfg_table.offset_in_page()).as_ptr(); diff --git a/Kernel/Bus/PCI/Controller/MemoryBackedHostBridge.cpp b/Kernel/Bus/PCI/Controller/MemoryBackedHostBridge.cpp index 4cfb166381..41bb7991df 100644 --- a/Kernel/Bus/PCI/Controller/MemoryBackedHostBridge.cpp +++ b/Kernel/Bus/PCI/Controller/MemoryBackedHostBridge.cpp @@ -69,7 +69,7 @@ void MemoryBackedHostBridge::map_bus_region(BusNumber bus) if (m_mapped_bus == bus && m_mapped_bus_region) return; auto bus_base_address = determine_memory_mapped_bus_base_address(bus); - auto region_or_error = MM.allocate_kernel_region(bus_base_address, memory_range_per_bus, "PCI ECAM", Memory::Region::Access::ReadWrite); + auto region_or_error = MM.allocate_kernel_region(bus_base_address, memory_range_per_bus, "PCI ECAM"sv, Memory::Region::Access::ReadWrite); // FIXME: Find a way to propagate error from here. if (region_or_error.is_error()) VERIFY_NOT_REACHED(); diff --git a/Kernel/Bus/PCI/Definitions.h b/Kernel/Bus/PCI/Definitions.h index e2b4c3a3ca..96b72b6de8 100644 --- a/Kernel/Bus/PCI/Definitions.h +++ b/Kernel/Bus/PCI/Definitions.h @@ -300,7 +300,7 @@ struct AK::Formatter<Kernel::PCI::Address> : Formatter<FormatString> { { return Formatter<FormatString>::format( builder, - "PCI [{:04x}:{:02x}:{:02x}:{:02x}]", value.domain(), value.bus(), value.device(), value.function()); + "PCI [{:04x}:{:02x}:{:02x}:{:02x}]"sv, value.domain(), value.bus(), value.device(), value.function()); } }; @@ -310,6 +310,6 @@ struct AK::Formatter<Kernel::PCI::HardwareID> : Formatter<FormatString> { { return Formatter<FormatString>::format( builder, - "PCI::HardwareID [{:04x}:{:04x}]", value.vendor_id, value.device_id); + "PCI::HardwareID [{:04x}:{:04x}]"sv, value.vendor_id, value.device_id); } }; diff --git a/Kernel/Bus/PCI/Initializer.cpp b/Kernel/Bus/PCI/Initializer.cpp index 2d3de9deac..a6a9162368 100644 --- a/Kernel/Bus/PCI/Initializer.cpp +++ b/Kernel/Bus/PCI/Initializer.cpp @@ -24,7 +24,7 @@ static bool test_pci_io(); UNMAP_AFTER_INIT static PCIAccessLevel detect_optimal_access_type() { auto boot_determined = kernel_command_line().pci_access_level(); - if (!ACPI::is_enabled() || !ACPI::Parser::the()->find_table("MCFG").has_value()) + if (!ACPI::is_enabled() || !ACPI::Parser::the()->find_table("MCFG"sv).has_value()) return PCIAccessLevel::IOAddressing; if (boot_determined != PCIAccessLevel::IOAddressing) @@ -44,7 +44,7 @@ UNMAP_AFTER_INIT void initialize() return; switch (detect_optimal_access_type()) { case PCIAccessLevel::MemoryAddressing: { - auto mcfg = ACPI::Parser::the()->find_table("MCFG"); + auto mcfg = ACPI::Parser::the()->find_table("MCFG"sv); VERIFY(mcfg.has_value()); auto success = Access::initialize_for_multiple_pci_domains(mcfg.value()); VERIFY(success); diff --git a/Kernel/Bus/USB/UHCI/UHCIController.cpp b/Kernel/Bus/USB/UHCI/UHCIController.cpp index 9f3db0a28a..75ec88c7d2 100644 --- a/Kernel/Bus/USB/UHCI/UHCIController.cpp +++ b/Kernel/Bus/USB/UHCI/UHCIController.cpp @@ -105,7 +105,7 @@ ErrorOr<void> UHCIController::reset() } // Let's allocate the physical page for the Frame List (which is 4KiB aligned) - m_framelist = TRY(MM.allocate_dma_buffer_page("UHCI Framelist", Memory::Region::Access::Write)); + m_framelist = TRY(MM.allocate_dma_buffer_page("UHCI Framelist"sv, Memory::Region::Access::Write)); dbgln("UHCI: Allocated framelist at physical address {}", m_framelist->physical_page(0)->paddr()); dbgln("UHCI: Framelist is at virtual address {}", m_framelist->vaddr()); write_sofmod(64); // 1mS frame time @@ -139,7 +139,7 @@ UNMAP_AFTER_INIT ErrorOr<void> UHCIController::create_structures() // Now the Transfer Descriptor pool m_transfer_descriptor_pool = TRY(UHCIDescriptorPool<TransferDescriptor>::try_create("Transfer Descriptor Pool"sv)); - m_isochronous_transfer_pool = TRY(MM.allocate_dma_buffer_page("UHCI Isochronous Descriptor Pool", Memory::Region::Access::ReadWrite)); + m_isochronous_transfer_pool = TRY(MM.allocate_dma_buffer_page("UHCI Isochronous Descriptor Pool"sv, Memory::Region::Access::ReadWrite)); // Set up the Isochronous Transfer Descriptor list m_iso_td_list.resize(UHCI_NUMBER_OF_ISOCHRONOUS_TDS); @@ -509,7 +509,7 @@ size_t UHCIController::poll_transfer_queue(QueueHead& transfer_queue) ErrorOr<void> UHCIController::spawn_port_process() { RefPtr<Thread> usb_hotplug_thread; - (void)Process::create_kernel_process(usb_hotplug_thread, TRY(KString::try_create("UHCI Hot Plug Task")), [&] { + (void)Process::create_kernel_process(usb_hotplug_thread, TRY(KString::try_create("UHCI Hot Plug Task"sv)), [&] { for (;;) { if (m_root_hub) m_root_hub->check_for_port_updates(); diff --git a/Kernel/Bus/USB/UHCI/UHCIDescriptorPool.h b/Kernel/Bus/USB/UHCI/UHCIDescriptorPool.h index eceb249a39..007fffc4da 100644 --- a/Kernel/Bus/USB/UHCI/UHCIDescriptorPool.h +++ b/Kernel/Bus/USB/UHCI/UHCIDescriptorPool.h @@ -30,7 +30,7 @@ class UHCIDescriptorPool { public: static ErrorOr<NonnullOwnPtr<UHCIDescriptorPool<T>>> try_create(StringView name) { - auto pool_memory_block = TRY(MM.allocate_kernel_region(PAGE_SIZE, "UHCI Descriptor Pool", Memory::Region::Access::ReadWrite)); + auto pool_memory_block = TRY(MM.allocate_kernel_region(PAGE_SIZE, "UHCI Descriptor Pool"sv, Memory::Region::Access::ReadWrite)); return adopt_nonnull_own_or_enomem(new (nothrow) UHCIDescriptorPool(move(pool_memory_block), name)); } diff --git a/Kernel/Bus/USB/USBPipe.cpp b/Kernel/Bus/USB/USBPipe.cpp index 6b0ff1f3cd..b8153cfe2a 100644 --- a/Kernel/Bus/USB/USBPipe.cpp +++ b/Kernel/Bus/USB/USBPipe.cpp @@ -14,7 +14,7 @@ namespace Kernel::USB { ErrorOr<NonnullOwnPtr<Pipe>> Pipe::try_create_pipe(USBController const& controller, Type type, Direction direction, u8 endpoint_address, u16 max_packet_size, i8 device_address, u8 poll_interval) { - auto dma_region = TRY(MM.allocate_kernel_region(PAGE_SIZE, "USB device DMA buffer", Memory::Region::Access::ReadWrite)); + auto dma_region = TRY(MM.allocate_kernel_region(PAGE_SIZE, "USB device DMA buffer"sv, Memory::Region::Access::ReadWrite)); return adopt_nonnull_own_or_enomem(new (nothrow) Pipe(controller, type, direction, endpoint_address, max_packet_size, poll_interval, device_address, move(dma_region))); } diff --git a/Kernel/Bus/USB/USBPipe.h b/Kernel/Bus/USB/USBPipe.h index 2d43203984..eb01d34177 100644 --- a/Kernel/Bus/USB/USBPipe.h +++ b/Kernel/Bus/USB/USBPipe.h @@ -79,7 +79,7 @@ private: u8 m_poll_interval { 0 }; // Polling interval (in frames) bool m_data_toggle { false }; // Data toggle for stuffing bit - Mutex m_dma_buffer_lock { "USB pipe mutex" }; + Mutex m_dma_buffer_lock { "USB pipe mutex"sv }; NonnullOwnPtr<Memory::Region> m_dma_buffer; }; diff --git a/Kernel/Bus/VirtIO/Device.cpp b/Kernel/Bus/VirtIO/Device.cpp index 9296dc4213..abe960aa59 100644 --- a/Kernel/Bus/VirtIO/Device.cpp +++ b/Kernel/Bus/VirtIO/Device.cpp @@ -136,7 +136,7 @@ UNMAP_AFTER_INIT void Device::initialize() dbgln_if(VIRTIO_DEBUG, "{}: Failed to round up size={} to pages", m_class_name, mapping.size); continue; } - auto region_or_error = MM.allocate_kernel_region(PhysicalAddress(page_base_of(PCI::get_BAR(pci_address(), cfg.bar))), region_size_or_error.value(), "VirtIO MMIO", Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No); + auto region_or_error = MM.allocate_kernel_region(PhysicalAddress(page_base_of(PCI::get_BAR(pci_address(), cfg.bar))), region_size_or_error.value(), "VirtIO MMIO"sv, Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No); if (region_or_error.is_error()) { dbgln_if(VIRTIO_DEBUG, "{}: Failed to map bar {} - (size={}) {}", m_class_name, cfg.bar, mapping.size, region_or_error.error()); } else { diff --git a/Kernel/Bus/VirtIO/RNG.cpp b/Kernel/Bus/VirtIO/RNG.cpp index 9c482bfc10..8bcae54b25 100644 --- a/Kernel/Bus/VirtIO/RNG.cpp +++ b/Kernel/Bus/VirtIO/RNG.cpp @@ -25,7 +25,7 @@ UNMAP_AFTER_INIT void RNG::initialize() } if (success) { finish_init(); - m_entropy_buffer = MM.allocate_contiguous_kernel_region(PAGE_SIZE, "VirtIO::RNG", Memory::Region::Access::ReadWrite).release_value(); + m_entropy_buffer = MM.allocate_contiguous_kernel_region(PAGE_SIZE, "VirtIO::RNG"sv, Memory::Region::Access::ReadWrite).release_value(); if (m_entropy_buffer) { memset(m_entropy_buffer->vaddr().as_ptr(), 0, m_entropy_buffer->size()); request_entropy_from_host(); diff --git a/Kernel/CommandLine.cpp b/Kernel/CommandLine.cpp index 1a20968c44..3ea48cbd5c 100644 --- a/Kernel/CommandLine.cpp +++ b/Kernel/CommandLine.cpp @@ -13,7 +13,7 @@ namespace Kernel { static char s_cmd_line[1024]; -static constexpr StringView s_embedded_cmd_line = ""; +static constexpr StringView s_embedded_cmd_line = ""sv; static CommandLine* s_the; UNMAP_AFTER_INIT void CommandLine::early_initialize(char const* cmd_line) diff --git a/Kernel/Devices/MemoryDevice.cpp b/Kernel/Devices/MemoryDevice.cpp index 732d4ca5d3..02e879dc87 100644 --- a/Kernel/Devices/MemoryDevice.cpp +++ b/Kernel/Devices/MemoryDevice.cpp @@ -67,7 +67,7 @@ ErrorOr<Memory::Region*> MemoryDevice::mmap(Process& process, OpenFileDescriptio range, move(vmobject), 0, - "Mapped Physical Memory", + "Mapped Physical Memory"sv, prot, shared); } diff --git a/Kernel/Devices/PCISerialDevice.h b/Kernel/Devices/PCISerialDevice.h index f92ef97ab8..c53901648f 100644 --- a/Kernel/Devices/PCISerialDevice.h +++ b/Kernel/Devices/PCISerialDevice.h @@ -31,10 +31,10 @@ private: }; static constexpr BoardDefinition board_definitions[4] = { - { { PCI::VendorID::WCH, 0x3253 }, "WCH CH382 2S", 2, 0, 0xC0, 8, SerialDevice::Baud::Baud115200 }, - { { PCI::VendorID::RedHat, 0x0002 }, "QEMU PCI 16550A", 1, 0, 0, 8, SerialDevice::Baud::Baud115200 }, - { { PCI::VendorID::RedHat, 0x0003 }, "QEMU PCI Dual-port 16550A", 2, 0, 0, 8, SerialDevice::Baud::Baud115200 }, - { { PCI::VendorID::RedHat, 0x0004 }, "QEMU PCI Quad-port 16550A", 4, 0, 0, 8, SerialDevice::Baud::Baud115200 } + { { PCI::VendorID::WCH, 0x3253 }, "WCH CH382 2S"sv, 2, 0, 0xC0, 8, SerialDevice::Baud::Baud115200 }, + { { PCI::VendorID::RedHat, 0x0002 }, "QEMU PCI 16550A"sv, 1, 0, 0, 8, SerialDevice::Baud::Baud115200 }, + { { PCI::VendorID::RedHat, 0x0003 }, "QEMU PCI Dual-port 16550A"sv, 2, 0, 0, 8, SerialDevice::Baud::Baud115200 }, + { { PCI::VendorID::RedHat, 0x0004 }, "QEMU PCI Quad-port 16550A"sv, 4, 0, 0, 8, SerialDevice::Baud::Baud115200 } }; }; diff --git a/Kernel/DoubleBuffer.h b/Kernel/DoubleBuffer.h index b9a86830b5..54bb39bd8c 100644 --- a/Kernel/DoubleBuffer.h +++ b/Kernel/DoubleBuffer.h @@ -72,7 +72,7 @@ private: size_t m_read_buffer_index { 0 }; size_t m_space_for_writing { 0 }; bool m_empty { true }; - mutable Mutex m_lock { "DoubleBuffer" }; + mutable Mutex m_lock { "DoubleBuffer"sv }; }; } diff --git a/Kernel/FileSystem/DevPtsFS.cpp b/Kernel/FileSystem/DevPtsFS.cpp index ffb1d21013..06d187e284 100644 --- a/Kernel/FileSystem/DevPtsFS.cpp +++ b/Kernel/FileSystem/DevPtsFS.cpp @@ -103,8 +103,8 @@ ErrorOr<void> DevPtsFSInode::traverse_as_directory(Function<ErrorOr<void>(FileSy if (identifier().index() > 1) return ENOTDIR; - TRY(callback({ ".", identifier(), 0 })); - TRY(callback({ "..", identifier(), 0 })); + TRY(callback({ "."sv, identifier(), 0 })); + TRY(callback({ ".."sv, identifier(), 0 })); return SlavePTY::all_instances().with([&](auto& list) -> ErrorOr<void> { StringBuilder builder; diff --git a/Kernel/FileSystem/DevTmpFS.cpp b/Kernel/FileSystem/DevTmpFS.cpp index e6fff851aa..6c78255a4f 100644 --- a/Kernel/FileSystem/DevTmpFS.cpp +++ b/Kernel/FileSystem/DevTmpFS.cpp @@ -205,8 +205,8 @@ DevTmpFSDirectoryInode::~DevTmpFSDirectoryInode() = default; ErrorOr<void> DevTmpFSDirectoryInode::traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const { MutexLocker locker(m_inode_lock); - TRY(callback({ ".", identifier(), 0 })); - TRY(callback({ "..", identifier(), 0 })); + TRY(callback({ "."sv, identifier(), 0 })); + TRY(callback({ ".."sv, identifier(), 0 })); for (auto& node : m_nodes) { InodeIdentifier identifier = { fsid(), node.index() }; TRY(callback({ node.name(), identifier, 0 })); diff --git a/Kernel/FileSystem/DevTmpFS.h b/Kernel/FileSystem/DevTmpFS.h index e94da24a6a..4326e04ec5 100644 --- a/Kernel/FileSystem/DevTmpFS.h +++ b/Kernel/FileSystem/DevTmpFS.h @@ -153,7 +153,7 @@ class DevTmpFSRootDirectoryInode final : public DevTmpFSDirectoryInode { public: virtual ~DevTmpFSRootDirectoryInode() override; - virtual StringView name() const override { return "."; } + virtual StringView name() const override { return "."sv; } private: // ^DevTmpFSInode diff --git a/Kernel/FileSystem/FIFO.cpp b/Kernel/FileSystem/FIFO.cpp index 571e70d3df..259f061d8c 100644 --- a/Kernel/FileSystem/FIFO.cpp +++ b/Kernel/FileSystem/FIFO.cpp @@ -41,7 +41,7 @@ ErrorOr<NonnullRefPtr<OpenFileDescription>> FIFO::open_direction_blocking(FIFO:: if (m_writers == 0) { locker.unlock(); - m_write_open_queue.wait_forever("FIFO"); + m_write_open_queue.wait_forever("FIFO"sv); locker.lock(); } } @@ -51,7 +51,7 @@ ErrorOr<NonnullRefPtr<OpenFileDescription>> FIFO::open_direction_blocking(FIFO:: if (m_readers == 0) { locker.unlock(); - m_read_open_queue.wait_forever("FIFO"); + m_read_open_queue.wait_forever("FIFO"sv); locker.lock(); } } diff --git a/Kernel/FileSystem/FileSystem.h b/Kernel/FileSystem/FileSystem.h index ef50f87c05..e504244874 100644 --- a/Kernel/FileSystem/FileSystem.h +++ b/Kernel/FileSystem/FileSystem.h @@ -67,7 +67,7 @@ protected: void set_block_size(u64 size) { m_block_size = size; } void set_fragment_size(size_t size) { m_fragment_size = size; } - mutable Mutex m_lock { "FS" }; + mutable Mutex m_lock { "FS"sv }; private: FileSystemID m_fsid; diff --git a/Kernel/FileSystem/ISO9660FileSystem.cpp b/Kernel/FileSystem/ISO9660FileSystem.cpp index 81843c4372..532302a5b3 100644 --- a/Kernel/FileSystem/ISO9660FileSystem.cpp +++ b/Kernel/FileSystem/ISO9660FileSystem.cpp @@ -239,7 +239,7 @@ ErrorOr<void> ISO9660FS::parse_volume_set() } auto const* header = reinterpret_cast<ISO::VolumeDescriptorHeader const*>(block->data()); - if (StringView { header->identifier, 5 } != "CD001") { + if (StringView { header->identifier, 5 } != "CD001"sv) { dbgln_if(ISO9660_DEBUG, "Header magic at volume descriptor {} is not valid", current_block_index - first_data_area_block); return EIO; } diff --git a/Kernel/FileSystem/Inode.h b/Kernel/FileSystem/Inode.h index 84c8eca1b7..befb3a42f2 100644 --- a/Kernel/FileSystem/Inode.h +++ b/Kernel/FileSystem/Inode.h @@ -109,7 +109,7 @@ protected: void did_modify_contents(); void did_delete_self(); - mutable Mutex m_inode_lock { "Inode" }; + mutable Mutex m_inode_lock { "Inode"sv }; private: FileSystem& m_file_system; diff --git a/Kernel/FileSystem/InodeIdentifier.h b/Kernel/FileSystem/InodeIdentifier.h index 585bbe6905..2e00f1c8cc 100644 --- a/Kernel/FileSystem/InodeIdentifier.h +++ b/Kernel/FileSystem/InodeIdentifier.h @@ -56,6 +56,6 @@ template<> struct AK::Formatter<Kernel::InodeIdentifier> : AK::Formatter<FormatString> { ErrorOr<void> format(FormatBuilder& builder, Kernel::InodeIdentifier value) { - return AK::Formatter<FormatString>::format(builder, "{}:{}", value.fsid(), value.index()); + return AK::Formatter<FormatString>::format(builder, "{}:{}"sv, value.fsid(), value.index()); } }; diff --git a/Kernel/FileSystem/Plan9FileSystem.cpp b/Kernel/FileSystem/Plan9FileSystem.cpp index 17336b7b24..43822bfb2d 100644 --- a/Kernel/FileSystem/Plan9FileSystem.cpp +++ b/Kernel/FileSystem/Plan9FileSystem.cpp @@ -201,7 +201,7 @@ ErrorOr<void> Plan9FS::initialize() ensure_thread(); Message version_message { *this, Message::Type::Tversion }; - version_message << (u32)m_max_message_size << "9P2000.L"; + version_message << (u32)m_max_message_size << "9P2000.L"sv; TRY(post_message_and_wait_for_a_reply(version_message)); @@ -218,8 +218,8 @@ ErrorOr<void> Plan9FS::initialize() Message attach_message { *this, Message::Type::Tattach }; // FIXME: This needs a user name and an "export" name; but how do we get them? // Perhaps initialize() should accept a string of FS-specific options... - attach_message << root_fid << (u32)-1 << "sergey" - << "/"; + attach_message << root_fid << (u32)-1 << "sergey"sv + << "/"sv; if (m_remote_protocol_version >= ProtocolVersion::v9P2000u) attach_message << (u32)-1; @@ -653,7 +653,7 @@ void Plan9FS::ensure_thread() { SpinlockLocker lock(m_thread_lock); if (!m_thread_running.exchange(true, AK::MemoryOrder::memory_order_acq_rel)) { - auto process_name = KString::try_create("Plan9FS"); + auto process_name = KString::try_create("Plan9FS"sv); if (process_name.is_error()) TODO(); (void)Process::create_kernel_process(m_thread, process_name.release_value(), [&]() { diff --git a/Kernel/FileSystem/Plan9FileSystem.h b/Kernel/FileSystem/Plan9FileSystem.h index 590d317124..cae3edb872 100644 --- a/Kernel/FileSystem/Plan9FileSystem.h +++ b/Kernel/FileSystem/Plan9FileSystem.h @@ -135,7 +135,7 @@ private: ProtocolVersion m_remote_protocol_version { ProtocolVersion::v9P2000 }; size_t m_max_message_size { 4 * KiB }; - Mutex m_send_lock { "Plan9FS send" }; + Mutex m_send_lock { "Plan9FS send"sv }; Plan9FSBlockerSet m_completion_blocker; HashMap<u16, NonnullRefPtr<ReceiveCompletion>> m_completions; diff --git a/Kernel/FileSystem/SysFS/Component.cpp b/Kernel/FileSystem/SysFS/Component.cpp index e5c28bd21c..af366a5880 100644 --- a/Kernel/FileSystem/SysFS/Component.cpp +++ b/Kernel/FileSystem/SysFS/Component.cpp @@ -35,8 +35,8 @@ ErrorOr<void> SysFSDirectory::traverse_as_directory(FileSystemID fsid, Function< { MutexLocker locker(SysFSComponentRegistry::the().get_lock()); VERIFY(m_parent_directory); - TRY(callback({ ".", { fsid, component_index() }, 0 })); - TRY(callback({ "..", { fsid, m_parent_directory->component_index() }, 0 })); + TRY(callback({ "."sv, { fsid, component_index() }, 0 })); + TRY(callback({ ".."sv, { fsid, m_parent_directory->component_index() }, 0 })); for (auto& component : m_components) { InodeIdentifier identifier = { fsid, component.component_index() }; diff --git a/Kernel/FileSystem/SysFS/RootDirectory.cpp b/Kernel/FileSystem/SysFS/RootDirectory.cpp index 5eb21c5e57..8a5951ebf6 100644 --- a/Kernel/FileSystem/SysFS/RootDirectory.cpp +++ b/Kernel/FileSystem/SysFS/RootDirectory.cpp @@ -20,8 +20,8 @@ NonnullRefPtr<SysFSRootDirectory> SysFSRootDirectory::create() ErrorOr<void> SysFSRootDirectory::traverse_as_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const { MutexLocker locker(SysFSComponentRegistry::the().get_lock()); - TRY(callback({ ".", { fsid, component_index() }, 0 })); - TRY(callback({ "..", { fsid, 0 }, 0 })); + TRY(callback({ "."sv, { fsid, component_index() }, 0 })); + TRY(callback({ ".."sv, { fsid, 0 }, 0 })); for (auto const& component : m_components) { InodeIdentifier identifier = { fsid, component.component_index() }; diff --git a/Kernel/FileSystem/SysFS/Subsystems/Bus/USB/BusDirectory.cpp b/Kernel/FileSystem/SysFS/Subsystems/Bus/USB/BusDirectory.cpp index 5ff793575d..bcd77960dd 100644 --- a/Kernel/FileSystem/SysFS/Subsystems/Bus/USB/BusDirectory.cpp +++ b/Kernel/FileSystem/SysFS/Subsystems/Bus/USB/BusDirectory.cpp @@ -17,8 +17,8 @@ ErrorOr<void> SysFSUSBBusDirectory::traverse_as_directory(FileSystemID fsid, Fun SpinlockLocker lock(m_lock); // Note: if the parent directory is null, it means something bad happened as this should not happen for the USB directory. VERIFY(m_parent_directory); - TRY(callback({ ".", { fsid, component_index() }, 0 })); - TRY(callback({ "..", { fsid, m_parent_directory->component_index() }, 0 })); + TRY(callback({ "."sv, { fsid, component_index() }, 0 })); + TRY(callback({ ".."sv, { fsid, m_parent_directory->component_index() }, 0 })); for (auto const& device_node : m_device_nodes) { InodeIdentifier identifier = { fsid, device_node.component_index() }; diff --git a/Kernel/FileSystem/SysFS/Subsystems/Bus/USB/DeviceInformation.cpp b/Kernel/FileSystem/SysFS/Subsystems/Bus/USB/DeviceInformation.cpp index e411fba780..b18dfc469b 100644 --- a/Kernel/FileSystem/SysFS/Subsystems/Bus/USB/DeviceInformation.cpp +++ b/Kernel/FileSystem/SysFS/Subsystems/Bus/USB/DeviceInformation.cpp @@ -26,56 +26,56 @@ ErrorOr<void> SysFSUSBDeviceInformation::try_generate(KBufferBuilder& builder) auto array = TRY(JsonArraySerializer<>::try_create(builder)); auto obj = TRY(array.add_object()); - TRY(obj.add("device_address", m_device->address())); - TRY(obj.add("usb_spec_compliance_bcd", m_device->device_descriptor().usb_spec_compliance_bcd)); - TRY(obj.add("device_class", m_device->device_descriptor().device_class)); - TRY(obj.add("device_sub_class", m_device->device_descriptor().device_sub_class)); - TRY(obj.add("device_protocol", m_device->device_descriptor().device_protocol)); - TRY(obj.add("max_packet_size", m_device->device_descriptor().max_packet_size)); - TRY(obj.add("vendor_id", m_device->device_descriptor().vendor_id)); - TRY(obj.add("product_id", m_device->device_descriptor().product_id)); - TRY(obj.add("device_release_bcd", m_device->device_descriptor().device_release_bcd)); - TRY(obj.add("manufacturer_id_descriptor_index", m_device->device_descriptor().manufacturer_id_descriptor_index)); - TRY(obj.add("product_string_descriptor_index", m_device->device_descriptor().product_string_descriptor_index)); - TRY(obj.add("serial_number_descriptor_index", m_device->device_descriptor().serial_number_descriptor_index)); - TRY(obj.add("num_configurations", m_device->device_descriptor().num_configurations)); - TRY(obj.add("length", m_device->device_descriptor().descriptor_header.length)); - TRY(obj.add("descriptor_type", m_device->device_descriptor().descriptor_header.descriptor_type)); - - auto configuration_array = TRY(obj.add_array("configurations")); + TRY(obj.add("device_address"sv, m_device->address())); + TRY(obj.add("usb_spec_compliance_bcd"sv, m_device->device_descriptor().usb_spec_compliance_bcd)); + TRY(obj.add("device_class"sv, m_device->device_descriptor().device_class)); + TRY(obj.add("device_sub_class"sv, m_device->device_descriptor().device_sub_class)); + TRY(obj.add("device_protocol"sv, m_device->device_descriptor().device_protocol)); + TRY(obj.add("max_packet_size"sv, m_device->device_descriptor().max_packet_size)); + TRY(obj.add("vendor_id"sv, m_device->device_descriptor().vendor_id)); + TRY(obj.add("product_id"sv, m_device->device_descriptor().product_id)); + TRY(obj.add("device_release_bcd"sv, m_device->device_descriptor().device_release_bcd)); + TRY(obj.add("manufacturer_id_descriptor_index"sv, m_device->device_descriptor().manufacturer_id_descriptor_index)); + TRY(obj.add("product_string_descriptor_index"sv, m_device->device_descriptor().product_string_descriptor_index)); + TRY(obj.add("serial_number_descriptor_index"sv, m_device->device_descriptor().serial_number_descriptor_index)); + TRY(obj.add("num_configurations"sv, m_device->device_descriptor().num_configurations)); + TRY(obj.add("length"sv, m_device->device_descriptor().descriptor_header.length)); + TRY(obj.add("descriptor_type"sv, m_device->device_descriptor().descriptor_header.descriptor_type)); + + auto configuration_array = TRY(obj.add_array("configurations"sv)); for (auto const& configuration : m_device->configurations()) { auto configuration_object = TRY(configuration_array.add_object()); auto const& configuration_descriptor = configuration.descriptor(); - TRY(configuration_object.add("length", configuration_descriptor.descriptor_header.length)); - TRY(configuration_object.add("descriptor_type", configuration_descriptor.descriptor_header.descriptor_type)); - TRY(configuration_object.add("total_length", configuration_descriptor.total_length)); - TRY(configuration_object.add("number_of_interfaces", configuration_descriptor.number_of_interfaces)); - TRY(configuration_object.add("attributes_bitmap", configuration_descriptor.attributes_bitmap)); - TRY(configuration_object.add("max_power", configuration_descriptor.max_power_in_ma)); - - auto interface_array = TRY(configuration_object.add_array("interfaces")); + TRY(configuration_object.add("length"sv, configuration_descriptor.descriptor_header.length)); + TRY(configuration_object.add("descriptor_type"sv, configuration_descriptor.descriptor_header.descriptor_type)); + TRY(configuration_object.add("total_length"sv, configuration_descriptor.total_length)); + TRY(configuration_object.add("number_of_interfaces"sv, configuration_descriptor.number_of_interfaces)); + TRY(configuration_object.add("attributes_bitmap"sv, configuration_descriptor.attributes_bitmap)); + TRY(configuration_object.add("max_power"sv, configuration_descriptor.max_power_in_ma)); + + auto interface_array = TRY(configuration_object.add_array("interfaces"sv)); for (auto const& interface : configuration.interfaces()) { auto interface_object = TRY(interface_array.add_object()); auto const& interface_descriptor = interface.descriptor(); - TRY(interface_object.add("length", interface_descriptor.descriptor_header.length)); - TRY(interface_object.add("descriptor_type", interface_descriptor.descriptor_header.descriptor_type)); - TRY(interface_object.add("interface_number", interface_descriptor.interface_id)); - TRY(interface_object.add("alternate_setting", interface_descriptor.alternate_setting)); - TRY(interface_object.add("num_endpoints", interface_descriptor.number_of_endpoints)); - TRY(interface_object.add("interface_class_code", interface_descriptor.interface_class_code)); - TRY(interface_object.add("interface_sub_class_code", interface_descriptor.interface_sub_class_code)); - TRY(interface_object.add("interface_protocol", interface_descriptor.interface_protocol)); - TRY(interface_object.add("interface_string_desc_index", interface_descriptor.interface_string_descriptor_index)); - - auto endpoint_array = TRY(interface_object.add_array("endpoints")); + TRY(interface_object.add("length"sv, interface_descriptor.descriptor_header.length)); + TRY(interface_object.add("descriptor_type"sv, interface_descriptor.descriptor_header.descriptor_type)); + TRY(interface_object.add("interface_number"sv, interface_descriptor.interface_id)); + TRY(interface_object.add("alternate_setting"sv, interface_descriptor.alternate_setting)); + TRY(interface_object.add("num_endpoints"sv, interface_descriptor.number_of_endpoints)); + TRY(interface_object.add("interface_class_code"sv, interface_descriptor.interface_class_code)); + TRY(interface_object.add("interface_sub_class_code"sv, interface_descriptor.interface_sub_class_code)); + TRY(interface_object.add("interface_protocol"sv, interface_descriptor.interface_protocol)); + TRY(interface_object.add("interface_string_desc_index"sv, interface_descriptor.interface_string_descriptor_index)); + + auto endpoint_array = TRY(interface_object.add_array("endpoints"sv)); for (auto const& endpoint : interface.endpoints()) { auto endpoint_object = TRY(endpoint_array.add_object()); - TRY(endpoint_object.add("length", endpoint.descriptor_header.length)); - TRY(endpoint_object.add("descriptor_length", endpoint.descriptor_header.descriptor_type)); - TRY(endpoint_object.add("endpoint_address", endpoint.endpoint_address)); - TRY(endpoint_object.add("attribute_bitmap", endpoint.endpoint_attributes_bitmap)); - TRY(endpoint_object.add("max_packet_size", endpoint.max_packet_size)); - TRY(endpoint_object.add("polling_interval", endpoint.poll_interval_in_frames)); + TRY(endpoint_object.add("length"sv, endpoint.descriptor_header.length)); + TRY(endpoint_object.add("descriptor_length"sv, endpoint.descriptor_header.descriptor_type)); + TRY(endpoint_object.add("endpoint_address"sv, endpoint.endpoint_address)); + TRY(endpoint_object.add("attribute_bitmap"sv, endpoint.endpoint_attributes_bitmap)); + TRY(endpoint_object.add("max_packet_size"sv, endpoint.max_packet_size)); + TRY(endpoint_object.add("polling_interval"sv, endpoint.poll_interval_in_frames)); TRY(endpoint_object.finish()); } TRY(endpoint_array.finish()); diff --git a/Kernel/FileSystem/SysFS/Subsystems/Bus/USB/DeviceInformation.h b/Kernel/FileSystem/SysFS/Subsystems/Bus/USB/DeviceInformation.h index 9ccae41742..07f074a45d 100644 --- a/Kernel/FileSystem/SysFS/Subsystems/Bus/USB/DeviceInformation.h +++ b/Kernel/FileSystem/SysFS/Subsystems/Bus/USB/DeviceInformation.h @@ -37,7 +37,7 @@ protected: private: ErrorOr<void> try_generate(KBufferBuilder&); virtual ErrorOr<void> refresh_data(OpenFileDescription& description) const override; - mutable Mutex m_lock { "SysFSUSBDeviceInformation" }; + mutable Mutex m_lock { "SysFSUSBDeviceInformation"sv }; NonnullOwnPtr<KString> m_device_name; }; diff --git a/Kernel/FileSystem/SysFS/Subsystems/Devices/BlockDevicesDirectory.cpp b/Kernel/FileSystem/SysFS/Subsystems/Devices/BlockDevicesDirectory.cpp index 3dcefd70bc..21a95c3ef5 100644 --- a/Kernel/FileSystem/SysFS/Subsystems/Devices/BlockDevicesDirectory.cpp +++ b/Kernel/FileSystem/SysFS/Subsystems/Devices/BlockDevicesDirectory.cpp @@ -22,8 +22,8 @@ SysFSBlockDevicesDirectory::SysFSBlockDevicesDirectory(SysFSDevicesDirectory con ErrorOr<void> SysFSBlockDevicesDirectory::traverse_as_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const { VERIFY(m_parent_directory); - TRY(callback({ ".", { fsid, component_index() }, 0 })); - TRY(callback({ "..", { fsid, m_parent_directory->component_index() }, 0 })); + TRY(callback({ "."sv, { fsid, component_index() }, 0 })); + TRY(callback({ ".."sv, { fsid, m_parent_directory->component_index() }, 0 })); return SysFSComponentRegistry::the().devices_list().with_exclusive([&](auto& list) -> ErrorOr<void> { for (auto& exposed_device : list) { diff --git a/Kernel/FileSystem/SysFS/Subsystems/Devices/CharacterDevicesDirectory.cpp b/Kernel/FileSystem/SysFS/Subsystems/Devices/CharacterDevicesDirectory.cpp index 0d09be1b68..3c3f65ba34 100644 --- a/Kernel/FileSystem/SysFS/Subsystems/Devices/CharacterDevicesDirectory.cpp +++ b/Kernel/FileSystem/SysFS/Subsystems/Devices/CharacterDevicesDirectory.cpp @@ -21,8 +21,8 @@ SysFSCharacterDevicesDirectory::SysFSCharacterDevicesDirectory(SysFSDevicesDirec ErrorOr<void> SysFSCharacterDevicesDirectory::traverse_as_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const { VERIFY(m_parent_directory); - TRY(callback({ ".", { fsid, component_index() }, 0 })); - TRY(callback({ "..", { fsid, m_parent_directory->component_index() }, 0 })); + TRY(callback({ "."sv, { fsid, component_index() }, 0 })); + TRY(callback({ ".."sv, { fsid, m_parent_directory->component_index() }, 0 })); return SysFSComponentRegistry::the().devices_list().with_exclusive([&](auto& list) -> ErrorOr<void> { for (auto& exposed_device : list) { diff --git a/Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS/Directory.cpp b/Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS/Directory.cpp index 665fe1e635..5fa0c6def0 100644 --- a/Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS/Directory.cpp +++ b/Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS/Directory.cpp @@ -96,7 +96,7 @@ UNMAP_AFTER_INIT Optional<PhysicalAddress> BIOSSysFSDirectory::find_dmi_entry64b auto bios_or_error = map_bios(); if (bios_or_error.is_error()) return {}; - return bios_or_error.value().find_chunk_starting_with("_SM3_", 16); + return bios_or_error.value().find_chunk_starting_with("_SM3_"sv, 16); } UNMAP_AFTER_INIT Optional<PhysicalAddress> BIOSSysFSDirectory::find_dmi_entry32bit_point() @@ -104,7 +104,7 @@ UNMAP_AFTER_INIT Optional<PhysicalAddress> BIOSSysFSDirectory::find_dmi_entry32b auto bios_or_error = map_bios(); if (bios_or_error.is_error()) return {}; - return bios_or_error.value().find_chunk_starting_with("_SM_", 16); + return bios_or_error.value().find_chunk_starting_with("_SM_"sv, 16); } } diff --git a/Kernel/FileSystem/TmpFS.cpp b/Kernel/FileSystem/TmpFS.cpp index b8e58f094c..2c4ba99891 100644 --- a/Kernel/FileSystem/TmpFS.cpp +++ b/Kernel/FileSystem/TmpFS.cpp @@ -77,9 +77,9 @@ ErrorOr<void> TmpFSInode::traverse_as_directory(Function<ErrorOr<void>(FileSyste if (!is_directory()) return ENOTDIR; - TRY(callback({ ".", identifier(), 0 })); + TRY(callback({ "."sv, identifier(), 0 })); if (auto parent = m_parent.strong_ref()) - TRY(callback({ "..", parent->identifier(), 0 })); + TRY(callback({ ".."sv, parent->identifier(), 0 })); for (auto& child : m_children) { TRY(callback({ child.name->view(), child.inode->identifier(), 0 })); diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp index 1c29b4f4bd..d17530e344 100644 --- a/Kernel/FileSystem/VirtualFileSystem.cpp +++ b/Kernel/FileSystem/VirtualFileSystem.cpp @@ -128,7 +128,7 @@ ErrorOr<void> VirtualFileSystem::mount_root(FileSystem& fs) mounts.append(move(mount)); }); - m_root_custody = TRY(Custody::try_create(nullptr, "", *m_root_inode, root_mount_flags)); + m_root_custody = TRY(Custody::try_create(nullptr, ""sv, *m_root_inode, root_mount_flags)); return {}; } @@ -376,7 +376,7 @@ ErrorOr<void> VirtualFileSystem::mkdir(StringView path, mode_t mode, Custody& ba path = path.trim("/"sv, TrimMode::Right); if (path.is_empty()) { // NOTE: This means the path was a series of slashes, which resolves to "/". - path = "/"; + path = "/"sv; } RefPtr<Custody> parent_custody; @@ -736,8 +736,8 @@ ErrorOr<void> VirtualFileSystem::rmdir(StringView path, Custody& base) if (custody->is_readonly()) return EROFS; - TRY(inode.remove_child(".")); - TRY(inode.remove_child("..")); + TRY(inode.remove_child("."sv)); + TRY(inode.remove_child(".."sv)); return parent_inode.remove_child(KLexicalPath::basename(path)); } diff --git a/Kernel/Firmware/ACPI/Initialize.cpp b/Kernel/Firmware/ACPI/Initialize.cpp index 890bed30f6..5588080a6f 100644 --- a/Kernel/Firmware/ACPI/Initialize.cpp +++ b/Kernel/Firmware/ACPI/Initialize.cpp @@ -22,7 +22,7 @@ UNMAP_AFTER_INIT void initialize() if (!rsdp.has_value()) return; - auto facp = StaticParsing::find_table(rsdp.value(), "FACP"); + auto facp = StaticParsing::find_table(rsdp.value(), "FACP"sv); if (!facp.has_value()) return; auto facp_table_or_error = Memory::map_typed<Structures::FADT>(facp.value()); diff --git a/Kernel/Firmware/ACPI/Parser.cpp b/Kernel/Firmware/ACPI/Parser.cpp index fa3439432f..5be352e4f2 100644 --- a/Kernel/Firmware/ACPI/Parser.cpp +++ b/Kernel/Firmware/ACPI/Parser.cpp @@ -84,13 +84,13 @@ UNMAP_AFTER_INIT void ACPISysFSDirectory::find_tables_and_register_them_as_compo m_components = components; auto rsdp = Memory::map_typed<Structures::RSDPDescriptor20>(ACPI::Parser::the()->rsdp()).release_value_but_fixme_should_propagate_errors(); - m_components.append(ACPISysFSComponent::create("RSDP", ACPI::Parser::the()->rsdp(), rsdp->base.revision == 0 ? sizeof(Structures::RSDPDescriptor) : rsdp->length)); + m_components.append(ACPISysFSComponent::create("RSDP"sv, ACPI::Parser::the()->rsdp(), rsdp->base.revision == 0 ? sizeof(Structures::RSDPDescriptor) : rsdp->length)); auto main_system_description_table = Memory::map_typed<Structures::SDTHeader>(ACPI::Parser::the()->main_system_description_table()).release_value_but_fixme_should_propagate_errors(); if (ACPI::Parser::the()->is_xsdt_supported()) { - m_components.append(ACPISysFSComponent::create("XSDT", ACPI::Parser::the()->main_system_description_table(), main_system_description_table->length)); + m_components.append(ACPISysFSComponent::create("XSDT"sv, ACPI::Parser::the()->main_system_description_table(), main_system_description_table->length)); } else { - m_components.append(ACPISysFSComponent::create("RSDT", ACPI::Parser::the()->main_system_description_table(), main_system_description_table->length)); + m_components.append(ACPISysFSComponent::create("RSDT"sv, ACPI::Parser::the()->main_system_description_table(), main_system_description_table->length)); } } diff --git a/Kernel/GlobalProcessExposed.cpp b/Kernel/GlobalProcessExposed.cpp index 8df53cbf6e..a0acdb0778 100644 --- a/Kernel/GlobalProcessExposed.cpp +++ b/Kernel/GlobalProcessExposed.cpp @@ -46,24 +46,24 @@ private: auto array = TRY(JsonArraySerializer<>::try_create(builder)); TRY(NetworkingManagement::the().try_for_each([&array](auto& adapter) -> ErrorOr<void> { auto obj = TRY(array.add_object()); - TRY(obj.add("name", adapter.name())); - TRY(obj.add("class_name", adapter.class_name())); + TRY(obj.add("name"sv, adapter.name())); + TRY(obj.add("class_name"sv, adapter.class_name())); auto mac_address = TRY(adapter.mac_address().to_string()); - TRY(obj.add("mac_address", mac_address->view())); + TRY(obj.add("mac_address"sv, mac_address->view())); if (!adapter.ipv4_address().is_zero()) { auto ipv4_address = TRY(adapter.ipv4_address().to_string()); - TRY(obj.add("ipv4_address", ipv4_address->view())); + TRY(obj.add("ipv4_address"sv, ipv4_address->view())); auto ipv4_netmask = TRY(adapter.ipv4_netmask().to_string()); - TRY(obj.add("ipv4_netmask", ipv4_netmask->view())); + TRY(obj.add("ipv4_netmask"sv, ipv4_netmask->view())); } - TRY(obj.add("packets_in", adapter.packets_in())); - TRY(obj.add("bytes_in", adapter.bytes_in())); - TRY(obj.add("packets_out", adapter.packets_out())); - TRY(obj.add("bytes_out", adapter.bytes_out())); - TRY(obj.add("link_up", adapter.link_up())); - TRY(obj.add("link_speed", adapter.link_speed())); - TRY(obj.add("link_full_duplex", adapter.link_full_duplex())); - TRY(obj.add("mtu", adapter.mtu())); + TRY(obj.add("packets_in"sv, adapter.packets_in())); + TRY(obj.add("bytes_in"sv, adapter.bytes_in())); + TRY(obj.add("packets_out"sv, adapter.packets_out())); + TRY(obj.add("bytes_out"sv, adapter.bytes_out())); + TRY(obj.add("link_up"sv, adapter.link_up())); + TRY(obj.add("link_speed"sv, adapter.link_speed())); + TRY(obj.add("link_full_duplex"sv, adapter.link_full_duplex())); + TRY(obj.add("mtu"sv, adapter.mtu())); TRY(obj.finish()); return {}; })); @@ -85,9 +85,9 @@ private: for (auto& it : table) { auto obj = TRY(array.add_object()); auto mac_address = TRY(it.value.to_string()); - TRY(obj.add("mac_address", mac_address->view())); + TRY(obj.add("mac_address"sv, mac_address->view())); auto ip_address = TRY(it.key.to_string()); - TRY(obj.add("ip_address", ip_address->view())); + TRY(obj.add("ip_address"sv, ip_address->view())); TRY(obj.finish()); } return {}; @@ -110,13 +110,13 @@ private: for (auto& it : table) { auto obj = TRY(array.add_object()); auto destination = TRY(it.destination.to_string()); - TRY(obj.add("destination", destination->view())); + TRY(obj.add("destination"sv, destination->view())); auto gateway = TRY(it.gateway.to_string()); - TRY(obj.add("gateway", gateway->view())); + TRY(obj.add("gateway"sv, gateway->view())); auto netmask = TRY(it.netmask.to_string()); - TRY(obj.add("genmask", netmask->view())); - TRY(obj.add("flags", it.flags)); - TRY(obj.add("interface", it.adapter->name())); + TRY(obj.add("genmask"sv, netmask->view())); + TRY(obj.add("flags"sv, it.flags)); + TRY(obj.add("interface"sv, it.adapter->name())); TRY(obj.finish()); } return {}; @@ -138,22 +138,22 @@ private: TRY(TCPSocket::try_for_each([&array](auto& socket) -> ErrorOr<void> { auto obj = TRY(array.add_object()); auto local_address = TRY(socket.local_address().to_string()); - TRY(obj.add("local_address", local_address->view())); - TRY(obj.add("local_port", socket.local_port())); + TRY(obj.add("local_address"sv, local_address->view())); + TRY(obj.add("local_port"sv, socket.local_port())); auto peer_address = TRY(socket.peer_address().to_string()); - TRY(obj.add("peer_address", peer_address->view())); - TRY(obj.add("peer_port", socket.peer_port())); - TRY(obj.add("state", TCPSocket::to_string(socket.state()))); - TRY(obj.add("ack_number", socket.ack_number())); - TRY(obj.add("sequence_number", socket.sequence_number())); - TRY(obj.add("packets_in", socket.packets_in())); - TRY(obj.add("bytes_in", socket.bytes_in())); - TRY(obj.add("packets_out", socket.packets_out())); - TRY(obj.add("bytes_out", socket.bytes_out())); + TRY(obj.add("peer_address"sv, peer_address->view())); + TRY(obj.add("peer_port"sv, socket.peer_port())); + TRY(obj.add("state"sv, TCPSocket::to_string(socket.state()))); + TRY(obj.add("ack_number"sv, socket.ack_number())); + TRY(obj.add("sequence_number"sv, socket.sequence_number())); + TRY(obj.add("packets_in"sv, socket.packets_in())); + TRY(obj.add("bytes_in"sv, socket.bytes_in())); + TRY(obj.add("packets_out"sv, socket.packets_out())); + TRY(obj.add("bytes_out"sv, socket.bytes_out())); if (Process::current().is_superuser() || Process::current().uid() == socket.origin_uid()) { - TRY(obj.add("origin_pid", socket.origin_pid().value())); - TRY(obj.add("origin_uid", socket.origin_uid().value())); - TRY(obj.add("origin_gid", socket.origin_gid().value())); + TRY(obj.add("origin_pid"sv, socket.origin_pid().value())); + TRY(obj.add("origin_uid"sv, socket.origin_uid().value())); + TRY(obj.add("origin_gid"sv, socket.origin_gid().value())); } TRY(obj.finish()); return {}; @@ -174,13 +174,13 @@ private: auto array = TRY(JsonArraySerializer<>::try_create(builder)); TRY(LocalSocket::try_for_each([&array](auto& socket) -> ErrorOr<void> { auto obj = TRY(array.add_object()); - TRY(obj.add("path", socket.socket_path())); - TRY(obj.add("origin_pid", socket.origin_pid().value())); - TRY(obj.add("origin_uid", socket.origin_uid().value())); - TRY(obj.add("origin_gid", socket.origin_gid().value())); - TRY(obj.add("acceptor_pid", socket.acceptor_pid().value())); - TRY(obj.add("acceptor_uid", socket.acceptor_uid().value())); - TRY(obj.add("acceptor_gid", socket.acceptor_gid().value())); + TRY(obj.add("path"sv, socket.socket_path())); + TRY(obj.add("origin_pid"sv, socket.origin_pid().value())); + TRY(obj.add("origin_uid"sv, socket.origin_uid().value())); + TRY(obj.add("origin_gid"sv, socket.origin_gid().value())); + TRY(obj.add("acceptor_pid"sv, socket.acceptor_pid().value())); + TRY(obj.add("acceptor_uid"sv, socket.acceptor_uid().value())); + TRY(obj.add("acceptor_gid"sv, socket.acceptor_gid().value())); TRY(obj.finish()); return {}; })); @@ -201,15 +201,15 @@ private: TRY(UDPSocket::try_for_each([&array](auto& socket) -> ErrorOr<void> { auto obj = TRY(array.add_object()); auto local_address = TRY(socket.local_address().to_string()); - TRY(obj.add("local_address", local_address->view())); - TRY(obj.add("local_port", socket.local_port())); + TRY(obj.add("local_address"sv, local_address->view())); + TRY(obj.add("local_port"sv, socket.local_port())); auto peer_address = TRY(socket.peer_address().to_string()); - TRY(obj.add("peer_address", peer_address->view())); - TRY(obj.add("peer_port", socket.peer_port())); + TRY(obj.add("peer_address"sv, peer_address->view())); + TRY(obj.add("peer_port"sv, socket.peer_port())); if (Process::current().is_superuser() || Process::current().uid() == socket.origin_uid()) { - TRY(obj.add("origin_pid", socket.origin_pid().value())); - TRY(obj.add("origin_uid", socket.origin_uid().value())); - TRY(obj.add("origin_gid", socket.origin_gid().value())); + TRY(obj.add("origin_pid"sv, socket.origin_pid().value())); + TRY(obj.add("origin_uid"sv, socket.origin_uid().value())); + TRY(obj.add("origin_gid"sv, socket.origin_gid().value())); } TRY(obj.finish()); return {}; @@ -402,22 +402,22 @@ private: TRY(VirtualFileSystem::the().for_each_mount([&array](auto& mount) -> ErrorOr<void> { auto& fs = mount.guest_fs(); auto fs_object = TRY(array.add_object()); - TRY(fs_object.add("class_name", fs.class_name())); - TRY(fs_object.add("total_block_count", fs.total_block_count())); - TRY(fs_object.add("free_block_count", fs.free_block_count())); - TRY(fs_object.add("total_inode_count", fs.total_inode_count())); - TRY(fs_object.add("free_inode_count", fs.free_inode_count())); + TRY(fs_object.add("class_name"sv, fs.class_name())); + TRY(fs_object.add("total_block_count"sv, fs.total_block_count())); + TRY(fs_object.add("free_block_count"sv, fs.free_block_count())); + TRY(fs_object.add("total_inode_count"sv, fs.total_inode_count())); + TRY(fs_object.add("free_inode_count"sv, fs.free_inode_count())); auto mount_point = TRY(mount.absolute_path()); - TRY(fs_object.add("mount_point", mount_point->view())); - TRY(fs_object.add("block_size", static_cast<u64>(fs.block_size()))); - TRY(fs_object.add("readonly", fs.is_readonly())); - TRY(fs_object.add("mount_flags", mount.flags())); + TRY(fs_object.add("mount_point"sv, mount_point->view())); + TRY(fs_object.add("block_size"sv, static_cast<u64>(fs.block_size()))); + TRY(fs_object.add("readonly"sv, fs.is_readonly())); + TRY(fs_object.add("mount_flags"sv, mount.flags())); if (fs.is_file_backed()) { auto pseudo_path = TRY(static_cast<const FileBackedFileSystem&>(fs).file_description().pseudo_path()); - TRY(fs_object.add("source", pseudo_path->view())); + TRY(fs_object.add("source"sv, pseudo_path->view())); } else { - TRY(fs_object.add("source", "none")); + TRY(fs_object.add("source"sv, "none")); } TRY(fs_object.finish()); @@ -444,16 +444,16 @@ private: auto system_memory = MM.get_system_memory_info(); auto json = TRY(JsonObjectSerializer<>::try_create(builder)); - TRY(json.add("kmalloc_allocated", stats.bytes_allocated)); - TRY(json.add("kmalloc_available", stats.bytes_free)); - TRY(json.add("user_physical_allocated", system_memory.user_physical_pages_used)); - TRY(json.add("user_physical_available", system_memory.user_physical_pages - system_memory.user_physical_pages_used)); - TRY(json.add("user_physical_committed", system_memory.user_physical_pages_committed)); - TRY(json.add("user_physical_uncommitted", system_memory.user_physical_pages_uncommitted)); - TRY(json.add("super_physical_allocated", system_memory.super_physical_pages_used)); - TRY(json.add("super_physical_available", system_memory.super_physical_pages - system_memory.super_physical_pages_used)); - TRY(json.add("kmalloc_call_count", stats.kmalloc_call_count)); - TRY(json.add("kfree_call_count", stats.kfree_call_count)); + TRY(json.add("kmalloc_allocated"sv, stats.bytes_allocated)); + TRY(json.add("kmalloc_available"sv, stats.bytes_free)); + TRY(json.add("user_physical_allocated"sv, system_memory.user_physical_pages_used)); + TRY(json.add("user_physical_available"sv, system_memory.user_physical_pages - system_memory.user_physical_pages_used)); + TRY(json.add("user_physical_committed"sv, system_memory.user_physical_pages_committed)); + TRY(json.add("user_physical_uncommitted"sv, system_memory.user_physical_pages_uncommitted)); + TRY(json.add("super_physical_allocated"sv, system_memory.super_physical_pages_used)); + TRY(json.add("super_physical_available"sv, system_memory.super_physical_pages - system_memory.super_physical_pages_used)); + TRY(json.add("kmalloc_call_count"sv, stats.kmalloc_call_count)); + TRY(json.add("kfree_call_count"sv, stats.kfree_call_count)); TRY(json.finish()); return {}; } @@ -469,14 +469,14 @@ private: { auto json = TRY(JsonObjectSerializer<>::try_create(builder)); auto total_time_scheduled = Scheduler::get_total_time_scheduled(); - TRY(json.add("total_time", total_time_scheduled.total)); - TRY(json.add("kernel_time", total_time_scheduled.total_kernel)); - TRY(json.add("user_time", total_time_scheduled.total - total_time_scheduled.total_kernel)); + TRY(json.add("total_time"sv, total_time_scheduled.total)); + TRY(json.add("kernel_time"sv, total_time_scheduled.total_kernel)); + TRY(json.add("user_time"sv, total_time_scheduled.total - total_time_scheduled.total_kernel)); u64 idle_time = 0; Processor::for_each([&](Processor& processor) { idle_time += processor.time_spent_idle(); }); - TRY(json.add("idle_time", idle_time)); + TRY(json.add("idle_time"sv, idle_time)); TRY(json.finish()); return {}; } @@ -501,78 +501,78 @@ private: #define __ENUMERATE_PLEDGE_PROMISE(promise) \ if (process.has_promised(Pledge::promise)) \ - TRY(pledge_builder.try_append(#promise " ")); + TRY(pledge_builder.try_append(#promise " "sv)); ENUMERATE_PLEDGE_PROMISES #undef __ENUMERATE_PLEDGE_PROMISE - TRY(process_object.add("pledge", pledge_builder.string_view())); + TRY(process_object.add("pledge"sv, pledge_builder.string_view())); switch (process.veil_state()) { case VeilState::None: - TRY(process_object.add("veil", "None")); + TRY(process_object.add("veil"sv, "None")); break; case VeilState::Dropped: - TRY(process_object.add("veil", "Dropped")); + TRY(process_object.add("veil"sv, "Dropped")); break; case VeilState::Locked: - TRY(process_object.add("veil", "Locked")); + TRY(process_object.add("veil"sv, "Locked")); break; } } else { - TRY(process_object.add("pledge", ""sv)); - TRY(process_object.add("veil", ""sv)); + TRY(process_object.add("pledge"sv, ""sv)); + TRY(process_object.add("veil"sv, ""sv)); } - TRY(process_object.add("pid", process.pid().value())); - TRY(process_object.add("pgid", process.tty() ? process.tty()->pgid().value() : 0)); - TRY(process_object.add("pgp", process.pgid().value())); - TRY(process_object.add("sid", process.sid().value())); - TRY(process_object.add("uid", process.uid().value())); - TRY(process_object.add("gid", process.gid().value())); - TRY(process_object.add("ppid", process.ppid().value())); + TRY(process_object.add("pid"sv, process.pid().value())); + TRY(process_object.add("pgid"sv, process.tty() ? process.tty()->pgid().value() : 0)); + TRY(process_object.add("pgp"sv, process.pgid().value())); + TRY(process_object.add("sid"sv, process.sid().value())); + TRY(process_object.add("uid"sv, process.uid().value())); + TRY(process_object.add("gid"sv, process.gid().value())); + TRY(process_object.add("ppid"sv, process.ppid().value())); if (process.tty()) { auto tty_pseudo_name = TRY(process.tty()->pseudo_name()); - TRY(process_object.add("tty", tty_pseudo_name->view())); + TRY(process_object.add("tty"sv, tty_pseudo_name->view())); } else { - TRY(process_object.add("tty", "")); + TRY(process_object.add("tty"sv, "")); } - TRY(process_object.add("nfds", process.fds().with_shared([](auto& fds) { return fds.open_count(); }))); - TRY(process_object.add("name", process.name())); - TRY(process_object.add("executable", process.executable() ? TRY(process.executable()->try_serialize_absolute_path())->view() : ""sv)); - TRY(process_object.add("amount_virtual", process.address_space().amount_virtual())); - TRY(process_object.add("amount_resident", process.address_space().amount_resident())); - TRY(process_object.add("amount_dirty_private", process.address_space().amount_dirty_private())); - TRY(process_object.add("amount_clean_inode", TRY(process.address_space().amount_clean_inode()))); - TRY(process_object.add("amount_shared", process.address_space().amount_shared())); - TRY(process_object.add("amount_purgeable_volatile", process.address_space().amount_purgeable_volatile())); - TRY(process_object.add("amount_purgeable_nonvolatile", process.address_space().amount_purgeable_nonvolatile())); - TRY(process_object.add("dumpable", process.is_dumpable())); - TRY(process_object.add("kernel", process.is_kernel_process())); - auto thread_array = TRY(process_object.add_array("threads")); + TRY(process_object.add("nfds"sv, process.fds().with_shared([](auto& fds) { return fds.open_count(); }))); + TRY(process_object.add("name"sv, process.name())); + TRY(process_object.add("executable"sv, process.executable() ? TRY(process.executable()->try_serialize_absolute_path())->view() : ""sv)); + TRY(process_object.add("amount_virtual"sv, process.address_space().amount_virtual())); + TRY(process_object.add("amount_resident"sv, process.address_space().amount_resident())); + TRY(process_object.add("amount_dirty_private"sv, process.address_space().amount_dirty_private())); + TRY(process_object.add("amount_clean_inode"sv, TRY(process.address_space().amount_clean_inode()))); + TRY(process_object.add("amount_shared"sv, process.address_space().amount_shared())); + TRY(process_object.add("amount_purgeable_volatile"sv, process.address_space().amount_purgeable_volatile())); + TRY(process_object.add("amount_purgeable_nonvolatile"sv, process.address_space().amount_purgeable_nonvolatile())); + TRY(process_object.add("dumpable"sv, process.is_dumpable())); + TRY(process_object.add("kernel"sv, process.is_kernel_process())); + auto thread_array = TRY(process_object.add_array("threads"sv)); TRY(process.try_for_each_thread([&](const Thread& thread) -> ErrorOr<void> { SpinlockLocker locker(thread.get_lock()); auto thread_object = TRY(thread_array.add_object()); #if LOCK_DEBUG - TRY(thread_object.add("lock_count", thread.lock_count())); + TRY(thread_object.add("lock_count"sv, thread.lock_count())); #endif - TRY(thread_object.add("tid", thread.tid().value())); - TRY(thread_object.add("name", thread.name())); - TRY(thread_object.add("times_scheduled", thread.times_scheduled())); - TRY(thread_object.add("time_user", thread.time_in_user())); - TRY(thread_object.add("time_kernel", thread.time_in_kernel())); - TRY(thread_object.add("state", thread.state_string())); - TRY(thread_object.add("cpu", thread.cpu())); - TRY(thread_object.add("priority", thread.priority())); - TRY(thread_object.add("syscall_count", thread.syscall_count())); - TRY(thread_object.add("inode_faults", thread.inode_faults())); - TRY(thread_object.add("zero_faults", thread.zero_faults())); - TRY(thread_object.add("cow_faults", thread.cow_faults())); - TRY(thread_object.add("file_read_bytes", thread.file_read_bytes())); - TRY(thread_object.add("file_write_bytes", thread.file_write_bytes())); - TRY(thread_object.add("unix_socket_read_bytes", thread.unix_socket_read_bytes())); - TRY(thread_object.add("unix_socket_write_bytes", thread.unix_socket_write_bytes())); - TRY(thread_object.add("ipv4_socket_read_bytes", thread.ipv4_socket_read_bytes())); - TRY(thread_object.add("ipv4_socket_write_bytes", thread.ipv4_socket_write_bytes())); + TRY(thread_object.add("tid"sv, thread.tid().value())); + TRY(thread_object.add("name"sv, thread.name())); + TRY(thread_object.add("times_scheduled"sv, thread.times_scheduled())); + TRY(thread_object.add("time_user"sv, thread.time_in_user())); + TRY(thread_object.add("time_kernel"sv, thread.time_in_kernel())); + TRY(thread_object.add("state"sv, thread.state_string())); + TRY(thread_object.add("cpu"sv, thread.cpu())); + TRY(thread_object.add("priority"sv, thread.priority())); + TRY(thread_object.add("syscall_count"sv, thread.syscall_count())); + TRY(thread_object.add("inode_faults"sv, thread.inode_faults())); + TRY(thread_object.add("zero_faults"sv, thread.zero_faults())); + TRY(thread_object.add("cow_faults"sv, thread.cow_faults())); + TRY(thread_object.add("file_read_bytes"sv, thread.file_read_bytes())); + TRY(thread_object.add("file_write_bytes"sv, thread.file_write_bytes())); + TRY(thread_object.add("unix_socket_read_bytes"sv, thread.unix_socket_read_bytes())); + TRY(thread_object.add("unix_socket_write_bytes"sv, thread.unix_socket_write_bytes())); + TRY(thread_object.add("ipv4_socket_read_bytes"sv, thread.ipv4_socket_read_bytes())); + TRY(thread_object.add("ipv4_socket_write_bytes"sv, thread.ipv4_socket_write_bytes())); TRY(thread_object.finish()); return {}; @@ -585,7 +585,7 @@ private: SpinlockLocker lock(g_scheduler_lock); { { - auto array = TRY(json.add_array("processes")); + auto array = TRY(json.add_array("processes"sv)); TRY(build_process(array, *Scheduler::colonel())); TRY(Process::all_instances().with([&](auto& processes) -> ErrorOr<void> { for (auto& process : processes) @@ -596,8 +596,8 @@ private: } auto total_time_scheduled = Scheduler::get_total_time_scheduled(); - TRY(json.add("total_time", total_time_scheduled.total)); - TRY(json.add("total_time_kernel", total_time_scheduled.total_kernel)); + TRY(json.add("total_time"sv, total_time_scheduled.total)); + TRY(json.add("total_time_kernel"sv, total_time_scheduled.total_kernel)); } TRY(json.finish()); return {}; @@ -616,13 +616,13 @@ private: [&](Processor& proc) -> ErrorOr<void> { auto& info = proc.info(); auto obj = TRY(array.add_object()); - TRY(obj.add("processor", proc.id())); - TRY(obj.add("vendor_id", info.vendor_id_string())); - TRY(obj.add("family", info.display_family())); + TRY(obj.add("processor"sv, proc.id())); + TRY(obj.add("vendor_id"sv, info.vendor_id_string())); + TRY(obj.add("family"sv, info.display_family())); if (!info.hypervisor_vendor_id_string().is_null()) - TRY(obj.add("hypervisor_vendor_id", info.hypervisor_vendor_id_string())); + TRY(obj.add("hypervisor_vendor_id"sv, info.hypervisor_vendor_id_string())); - auto features_array = TRY(obj.add_array("features")); + auto features_array = TRY(obj.add_array("features"sv)); auto keep_empty = false; ErrorOr<void> result; // FIXME: Make this nicer @@ -635,29 +635,29 @@ private: TRY(features_array.finish()); - TRY(obj.add("model", info.display_model())); - TRY(obj.add("stepping", info.stepping())); - TRY(obj.add("type", info.type())); - TRY(obj.add("brand", info.brand_string())); + TRY(obj.add("model"sv, info.display_model())); + TRY(obj.add("stepping"sv, info.stepping())); + TRY(obj.add("type"sv, info.type())); + TRY(obj.add("brand"sv, info.brand_string())); - auto caches = TRY(obj.add_object("caches")); + auto caches = TRY(obj.add_object("caches"sv)); auto add_cache_info = [&](StringView name, ProcessorInfo::Cache const& cache) -> ErrorOr<void> { auto cache_object = TRY(caches.add_object(name)); - TRY(cache_object.add("size", cache.size)); - TRY(cache_object.add("line_size", cache.line_size)); + TRY(cache_object.add("size"sv, cache.size)); + TRY(cache_object.add("line_size"sv, cache.line_size)); TRY(cache_object.finish()); return {}; }; if (info.l1_data_cache().has_value()) - TRY(add_cache_info("l1_data", *info.l1_data_cache())); + TRY(add_cache_info("l1_data"sv, *info.l1_data_cache())); if (info.l1_data_cache().has_value()) - TRY(add_cache_info("l1_instruction", *info.l1_instruction_cache())); + TRY(add_cache_info("l1_instruction"sv, *info.l1_instruction_cache())); if (info.l1_data_cache().has_value()) - TRY(add_cache_info("l2", *info.l2_cache())); + TRY(add_cache_info("l2"sv, *info.l2_cache())); if (info.l1_data_cache().has_value()) - TRY(add_cache_info("l3", *info.l3_cache())); + TRY(add_cache_info("l3"sv, *info.l3_cache())); TRY(caches.finish()); @@ -701,12 +701,12 @@ private: return; result = ([&]() -> ErrorOr<void> { auto obj = TRY(array.add_object()); - TRY(obj.add("purpose", handler.purpose())); - TRY(obj.add("interrupt_line", handler.interrupt_number())); - TRY(obj.add("controller", handler.controller())); - TRY(obj.add("cpu_handler", 0)); // FIXME: Determine the responsible CPU for each interrupt handler. - TRY(obj.add("device_sharing", (unsigned)handler.sharing_devices_count())); - TRY(obj.add("call_count", (unsigned)handler.get_invoking_count())); + TRY(obj.add("purpose"sv, handler.purpose())); + TRY(obj.add("interrupt_line"sv, handler.interrupt_number())); + TRY(obj.add("controller"sv, handler.controller())); + TRY(obj.add("cpu_handler"sv, 0)); // FIXME: Determine the responsible CPU for each interrupt handler. + TRY(obj.add("device_sharing"sv, (unsigned)handler.sharing_devices_count())); + TRY(obj.add("call_count"sv, (unsigned)handler.get_invoking_count())); TRY(obj.finish()); return {}; })(); @@ -726,7 +726,7 @@ private: { auto json = TRY(JsonObjectSerializer<>::try_create(builder)); TRY(HIDManagement::the().keymap_data().with([&](auto const& keymap_data) { - return json.add("keymap", keymap_data.character_map_name->view()); + return json.add("keymap"sv, keymap_data.character_map_name->view()); })); TRY(json.finish()); return {}; @@ -749,17 +749,17 @@ private: return; result = ([&]() -> ErrorOr<void> { auto obj = TRY(array.add_object()); - TRY(obj.add("domain", device_identifier.address().domain())); - TRY(obj.add("bus", device_identifier.address().bus())); - TRY(obj.add("device", device_identifier.address().device())); - TRY(obj.add("function", device_identifier.address().function())); - TRY(obj.add("vendor_id", device_identifier.hardware_id().vendor_id)); - TRY(obj.add("device_id", device_identifier.hardware_id().device_id)); - TRY(obj.add("revision_id", device_identifier.revision_id().value())); - TRY(obj.add("subclass", device_identifier.subclass_code().value())); - TRY(obj.add("class", device_identifier.class_code().value())); - TRY(obj.add("subsystem_id", device_identifier.subsystem_id().value())); - TRY(obj.add("subsystem_vendor_id", device_identifier.subsystem_vendor_id().value())); + TRY(obj.add("domain"sv, device_identifier.address().domain())); + TRY(obj.add("bus"sv, device_identifier.address().bus())); + TRY(obj.add("device"sv, device_identifier.address().device())); + TRY(obj.add("function"sv, device_identifier.address().function())); + TRY(obj.add("vendor_id"sv, device_identifier.hardware_id().vendor_id)); + TRY(obj.add("device_id"sv, device_identifier.hardware_id().device_id)); + TRY(obj.add("revision_id"sv, device_identifier.revision_id().value())); + TRY(obj.add("subclass"sv, device_identifier.subclass_code().value())); + TRY(obj.add("class"sv, device_identifier.class_code().value())); + TRY(obj.add("subsystem_id"sv, device_identifier.subsystem_id().value())); + TRY(obj.add("subsystem_vendor_id"sv, device_identifier.subsystem_vendor_id().value())); TRY(obj.finish()); return {}; })(); @@ -781,14 +781,14 @@ private: auto array = TRY(JsonArraySerializer<>::try_create(builder)); TRY(DeviceManagement::the().try_for_each([&array](auto& device) -> ErrorOr<void> { auto obj = TRY(array.add_object()); - TRY(obj.add("major", device.major().value())); - TRY(obj.add("minor", device.minor().value())); - TRY(obj.add("class_name", device.class_name())); + TRY(obj.add("major"sv, device.major().value())); + TRY(obj.add("minor"sv, device.minor().value())); + TRY(obj.add("class_name"sv, device.class_name())); if (device.is_block_device()) - TRY(obj.add("type", "block")); + TRY(obj.add("type"sv, "block")); else if (device.is_character_device()) - TRY(obj.add("type", "character")); + TRY(obj.add("type"sv, "character")); else VERIFY_NOT_REACHED(); TRY(obj.finish()); @@ -1048,8 +1048,8 @@ UNMAP_AFTER_INIT NonnullRefPtr<ProcFSRootDirectory> ProcFSRootDirectory::must_cr ErrorOr<void> ProcFSRootDirectory::traverse_as_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const { MutexLocker locker(ProcFSComponentRegistry::the().get_lock()); - TRY(callback({ ".", { fsid, component_index() }, 0 })); - TRY(callback({ "..", { fsid, 0 }, 0 })); + TRY(callback({ "."sv, { fsid, component_index() }, 0 })); + TRY(callback({ ".."sv, { fsid, 0 }, 0 })); for (auto const& component : m_components) { InodeIdentifier identifier = { fsid, component.component_index() }; diff --git a/Kernel/Graphics/Console/ContiguousFramebufferConsole.cpp b/Kernel/Graphics/Console/ContiguousFramebufferConsole.cpp index 0b9cc6730f..ab252d39ef 100644 --- a/Kernel/Graphics/Console/ContiguousFramebufferConsole.cpp +++ b/Kernel/Graphics/Console/ContiguousFramebufferConsole.cpp @@ -29,7 +29,7 @@ void ContiguousFramebufferConsole::set_resolution(size_t width, size_t height, s size_t size = Memory::page_round_up(pitch * height).release_value_but_fixme_should_propagate_errors(); dbgln("Framebuffer Console: taking {} bytes", size); - auto region_or_error = MM.allocate_kernel_region(m_framebuffer_address, size, "Framebuffer Console", Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::Yes); + auto region_or_error = MM.allocate_kernel_region(m_framebuffer_address, size, "Framebuffer Console"sv, Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::Yes); VERIFY(!region_or_error.is_error()); m_framebuffer_region = region_or_error.release_value(); diff --git a/Kernel/Graphics/Console/VGAConsole.cpp b/Kernel/Graphics/Console/VGAConsole.cpp index 01741ef608..c60a1be493 100644 --- a/Kernel/Graphics/Console/VGAConsole.cpp +++ b/Kernel/Graphics/Console/VGAConsole.cpp @@ -11,7 +11,7 @@ namespace Kernel::Graphics { UNMAP_AFTER_INIT VGAConsole::VGAConsole(Mode mode, size_t width, size_t height) : Console(width, height) - , m_vga_region(MM.allocate_kernel_region(PhysicalAddress(0xa0000), Memory::page_round_up(0xc0000 - 0xa0000).release_value_but_fixme_should_propagate_errors(), "VGA Display", Memory::Region::Access::ReadWrite).release_value()) + , m_vga_region(MM.allocate_kernel_region(PhysicalAddress(0xa0000), Memory::page_round_up(0xc0000 - 0xa0000).release_value_but_fixme_should_propagate_errors(), "VGA Display"sv, Memory::Region::Access::ReadWrite).release_value()) , m_mode(mode) { } diff --git a/Kernel/Graphics/DisplayConnector.cpp b/Kernel/Graphics/DisplayConnector.cpp index 88ccc14d7c..e6462e33d1 100644 --- a/Kernel/Graphics/DisplayConnector.cpp +++ b/Kernel/Graphics/DisplayConnector.cpp @@ -39,7 +39,7 @@ ErrorOr<Memory::Region*> DisplayConnector::mmap(Process& process, OpenFileDescri range, *m_shared_framebuffer_vmobject, 0, - "Mapped Framebuffer", + "Mapped Framebuffer"sv, prot, shared); } diff --git a/Kernel/Graphics/Intel/NativeDisplayConnector.cpp b/Kernel/Graphics/Intel/NativeDisplayConnector.cpp index 4f4470e116..c0b1e85c05 100644 --- a/Kernel/Graphics/Intel/NativeDisplayConnector.cpp +++ b/Kernel/Graphics/Intel/NativeDisplayConnector.cpp @@ -177,7 +177,7 @@ Optional<IntelGraphics::PLLSettings> IntelNativeDisplayConnector::create_pll_set NonnullRefPtr<IntelNativeDisplayConnector> IntelNativeDisplayConnector::must_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, PhysicalAddress registers_region_address, size_t registers_region_length) { - auto registers_region = MUST(MM.allocate_kernel_region(PhysicalAddress(registers_region_address), registers_region_length, "Intel Native Graphics Registers", Memory::Region::Access::ReadWrite)); + auto registers_region = MUST(MM.allocate_kernel_region(PhysicalAddress(registers_region_address), registers_region_length, "Intel Native Graphics Registers"sv, Memory::Region::Access::ReadWrite)); auto device_or_error = DeviceManagement::try_create_device<IntelNativeDisplayConnector>(framebuffer_address, framebuffer_resource_size, move(registers_region)); VERIFY(!device_or_error.is_error()); auto connector = device_or_error.release_value(); diff --git a/Kernel/Graphics/VirtIOGPU/GPU3DDevice.cpp b/Kernel/Graphics/VirtIOGPU/GPU3DDevice.cpp index 7405c3ecd7..acc93f5e5a 100644 --- a/Kernel/Graphics/VirtIOGPU/GPU3DDevice.cpp +++ b/Kernel/Graphics/VirtIOGPU/GPU3DDevice.cpp @@ -26,7 +26,7 @@ NonnullRefPtr<VirtIOGPU3DDevice> VirtIOGPU3DDevice::must_create(VirtIOGraphicsAd // Setup memory transfer region auto region_result = MM.allocate_kernel_region( NUM_TRANSFER_REGION_PAGES * PAGE_SIZE, - "VIRGL3D kernel upload buffer", + "VIRGL3D kernel upload buffer"sv, Memory::Region::Access::ReadWrite, AllocationStrategy::AllocateNow); VERIFY(!region_result.is_error()); diff --git a/Kernel/Graphics/VirtIOGPU/GPU3DDevice.h b/Kernel/Graphics/VirtIOGPU/GPU3DDevice.h index 45f6cf8411..a59641a79e 100644 --- a/Kernel/Graphics/VirtIOGPU/GPU3DDevice.h +++ b/Kernel/Graphics/VirtIOGPU/GPU3DDevice.h @@ -106,7 +106,7 @@ private: { auto region_result = TRY(MM.allocate_kernel_region( NUM_TRANSFER_REGION_PAGES * PAGE_SIZE, - "VIRGL3D userspace upload buffer", + "VIRGL3D userspace upload buffer"sv, Memory::Region::Access::ReadWrite, AllocationStrategy::AllocateNow)); return TRY(adopt_nonnull_ref_or_enomem(new (nothrow) PerContextState(context_id, move(region_result)))); @@ -125,7 +125,7 @@ private: virtual bool can_write(OpenFileDescription const&, u64) const override { return true; } virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return ENOTSUP; } virtual ErrorOr<size_t> write(OpenFileDescription&, u64, UserOrKernelBuffer const&, size_t) override { return ENOTSUP; } - virtual StringView class_name() const override { return "virgl3d"; } + virtual StringView class_name() const override { return "virgl3d"sv; } virtual ErrorOr<void> ioctl(OpenFileDescription&, unsigned request, Userspace<void*> arg) override; virtual void detach(OpenFileDescription&) override; diff --git a/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp b/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp index 9fb1083164..c69b6fed3a 100644 --- a/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp +++ b/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp @@ -27,7 +27,7 @@ NonnullRefPtr<VirtIOGraphicsAdapter> VirtIOGraphicsAdapter::initialize(PCI::Devi // Setup memory transfer region auto scratch_space_region = MUST(MM.allocate_contiguous_kernel_region( 32 * PAGE_SIZE, - "VirtGPU Scratch Space", + "VirtGPU Scratch Space"sv, Memory::Region::Access::ReadWrite)); auto adapter = adopt_ref(*new (nothrow) VirtIOGraphicsAdapter(device_identifier, move(scratch_space_region))); diff --git a/Kernel/Interrupts/APIC.cpp b/Kernel/Interrupts/APIC.cpp index f66e9bf811..758ba5cd37 100644 --- a/Kernel/Interrupts/APIC.cpp +++ b/Kernel/Interrupts/APIC.cpp @@ -271,7 +271,7 @@ UNMAP_AFTER_INIT bool APIC::init_bsp() dbgln("APIC: RSDP not found"); return false; } - auto madt_address = ACPI::StaticParsing::find_table(rsdp.value(), "APIC"); + auto madt_address = ACPI::StaticParsing::find_table(rsdp.value(), "APIC"sv); if (!madt_address.has_value()) { dbgln("APIC: MADT table not found"); return false; diff --git a/Kernel/Interrupts/SpuriousInterruptHandler.cpp b/Kernel/Interrupts/SpuriousInterruptHandler.cpp index f67790fbfd..51fd499c75 100644 --- a/Kernel/Interrupts/SpuriousInterruptHandler.cpp +++ b/Kernel/Interrupts/SpuriousInterruptHandler.cpp @@ -110,7 +110,7 @@ void SpuriousInterruptHandler::disable_interrupt_vector() StringView SpuriousInterruptHandler::controller() const { if (m_responsible_irq_controller->type() == IRQControllerType::i82093AA) - return ""; + return ""sv; return m_responsible_irq_controller->model(); } } diff --git a/Kernel/KBufferBuilder.cpp b/Kernel/KBufferBuilder.cpp index 50bf6640d6..0f1912bad3 100644 --- a/Kernel/KBufferBuilder.cpp +++ b/Kernel/KBufferBuilder.cpp @@ -105,19 +105,19 @@ ErrorOr<void> KBufferBuilder::append_escaped_for_json(StringView string) for (auto ch : string) { switch (ch) { case '\b': - TRY(append("\\b")); + TRY(append("\\b"sv)); break; case '\n': - TRY(append("\\n")); + TRY(append("\\n"sv)); break; case '\t': - TRY(append("\\t")); + TRY(append("\\t"sv)); break; case '\"': - TRY(append("\\\"")); + TRY(append("\\\""sv)); break; case '\\': - TRY(append("\\\\")); + TRY(append("\\\\"sv)); break; default: if (ch >= 0 && ch <= 0x1f) diff --git a/Kernel/KLexicalPath.cpp b/Kernel/KLexicalPath.cpp index ee5cd22771..085cfbe771 100644 --- a/Kernel/KLexicalPath.cpp +++ b/Kernel/KLexicalPath.cpp @@ -25,7 +25,7 @@ bool is_canonical(StringView path) return false; if (path.starts_with("./"sv) || path.contains("/./"sv) || path.ends_with("/."sv)) return false; - if (path.starts_with("../"sv) || path.contains("/../"sv) || path.ends_with("/..")) + if (path.starts_with("../"sv) || path.contains("/../"sv) || path.ends_with("/.."sv)) return false; if (path.contains("//"sv)) return false; diff --git a/Kernel/Memory/MemoryManager.cpp b/Kernel/Memory/MemoryManager.cpp index a1dc009e24..31de498efe 100644 --- a/Kernel/Memory/MemoryManager.cpp +++ b/Kernel/Memory/MemoryManager.cpp @@ -986,7 +986,7 @@ ErrorOr<NonnullRefPtrVector<PhysicalPage>> MemoryManager::allocate_contiguous_us auto physical_pages = physical_region.take_contiguous_free_pages(page_count); if (!physical_pages.is_empty()) { { - auto cleanup_region = TRY(MM.allocate_kernel_region(physical_pages[0].paddr(), PAGE_SIZE * page_count, "MemoryManager Allocation Sanitization", Region::Access::Read | Region::Access::Write)); + auto cleanup_region = TRY(MM.allocate_kernel_region(physical_pages[0].paddr(), PAGE_SIZE * page_count, "MemoryManager Allocation Sanitization"sv, Region::Access::Read | Region::Access::Write)); memset(cleanup_region->vaddr().as_ptr(), 0, PAGE_SIZE * page_count); } m_system_memory_info.user_physical_pages_uncommitted -= page_count; @@ -1012,7 +1012,7 @@ ErrorOr<NonnullRefPtrVector<PhysicalPage>> MemoryManager::allocate_contiguous_su } { - auto cleanup_region = TRY(MM.allocate_kernel_region(physical_pages[0].paddr(), PAGE_SIZE * count, "MemoryManager Allocation Sanitization", Region::Access::Read | Region::Access::Write)); + auto cleanup_region = TRY(MM.allocate_kernel_region(physical_pages[0].paddr(), PAGE_SIZE * count, "MemoryManager Allocation Sanitization"sv, Region::Access::Read | Region::Access::Write)); memset(cleanup_region->vaddr().as_ptr(), 0, PAGE_SIZE * count); } m_system_memory_info.super_physical_pages_used += count; diff --git a/Kernel/Memory/MemoryManager.h b/Kernel/Memory/MemoryManager.h index a7eebf530f..3072fc0c3c 100644 --- a/Kernel/Memory/MemoryManager.h +++ b/Kernel/Memory/MemoryManager.h @@ -51,10 +51,10 @@ enum class UsedMemoryRangeType { }; static constexpr StringView UserMemoryRangeTypeNames[] { - "Low memory", - "Kernel", - "Boot module", - "Physical Pages" + "Low memory"sv, + "Kernel"sv, + "Boot module"sv, + "Physical Pages"sv }; static_assert(array_size(UserMemoryRangeTypeNames) == to_underlying(UsedMemoryRangeType::__Count)); diff --git a/Kernel/Memory/ScatterGatherList.cpp b/Kernel/Memory/ScatterGatherList.cpp index b55672d6fc..0b22f12f6f 100644 --- a/Kernel/Memory/ScatterGatherList.cpp +++ b/Kernel/Memory/ScatterGatherList.cpp @@ -21,7 +21,7 @@ RefPtr<ScatterGatherList> ScatterGatherList::try_create(AsyncBlockDeviceRequest& ScatterGatherList::ScatterGatherList(NonnullRefPtr<AnonymousVMObject> vm_object, AsyncBlockDeviceRequest& request, size_t device_block_size) : m_vm_object(move(vm_object)) { - auto region_or_error = MM.allocate_kernel_region_with_vmobject(m_vm_object, page_round_up((request.block_count() * device_block_size)).release_value_but_fixme_should_propagate_errors(), "AHCI Scattered DMA", Region::Access::Read | Region::Access::Write, Region::Cacheable::Yes); + auto region_or_error = MM.allocate_kernel_region_with_vmobject(m_vm_object, page_round_up((request.block_count() * device_block_size)).release_value_but_fixme_should_propagate_errors(), "AHCI Scattered DMA"sv, Region::Access::Read | Region::Access::Write, Region::Cacheable::Yes); if (region_or_error.is_error()) TODO(); m_dma_region = region_or_error.release_value(); diff --git a/Kernel/Memory/VirtualRange.h b/Kernel/Memory/VirtualRange.h index 071f78bb37..bf3d537201 100644 --- a/Kernel/Memory/VirtualRange.h +++ b/Kernel/Memory/VirtualRange.h @@ -64,6 +64,6 @@ template<> struct AK::Formatter<Kernel::Memory::VirtualRange> : Formatter<FormatString> { ErrorOr<void> format(FormatBuilder& builder, Kernel::Memory::VirtualRange value) { - return Formatter<FormatString>::format(builder, "{} - {} (size {:p})", value.base().as_ptr(), value.base().offset(value.size() - 1).as_ptr(), value.size()); + return Formatter<FormatString>::format(builder, "{} - {} (size {:p})"sv, value.base().as_ptr(), value.base().offset(value.size() - 1).as_ptr(), value.size()); } }; diff --git a/Kernel/Net/IPv4Socket.cpp b/Kernel/Net/IPv4Socket.cpp index 67dd1ea1fe..497fdc49d1 100644 --- a/Kernel/Net/IPv4Socket.cpp +++ b/Kernel/Net/IPv4Socket.cpp @@ -474,7 +474,7 @@ ErrorOr<NonnullOwnPtr<KString>> IPv4Socket::pseudo_path(OpenFileDescription cons return KString::try_create("socket"sv); StringBuilder builder; - TRY(builder.try_append("socket:")); + TRY(builder.try_append("socket:"sv)); TRY(builder.try_appendff("{}:{}", m_local_address.to_string(), m_local_port)); if (m_role == Role::Accepted || m_role == Role::Connected) @@ -482,16 +482,16 @@ ErrorOr<NonnullOwnPtr<KString>> IPv4Socket::pseudo_path(OpenFileDescription cons switch (m_role) { case Role::Listener: - TRY(builder.try_append(" (listening)")); + TRY(builder.try_append(" (listening)"sv)); break; case Role::Accepted: - TRY(builder.try_append(" (accepted)")); + TRY(builder.try_append(" (accepted)"sv)); break; case Role::Connected: - TRY(builder.try_append(" (connected)")); + TRY(builder.try_append(" (connected)"sv)); break; case Role::Connecting: - TRY(builder.try_append(" (connecting)")); + TRY(builder.try_append(" (connecting)"sv)); break; default: VERIFY_NOT_REACHED(); diff --git a/Kernel/Net/Intel/E1000ENetworkAdapter.cpp b/Kernel/Net/Intel/E1000ENetworkAdapter.cpp index 7d0f2cfb70..7b9ee770be 100644 --- a/Kernel/Net/Intel/E1000ENetworkAdapter.cpp +++ b/Kernel/Net/Intel/E1000ENetworkAdapter.cpp @@ -209,7 +209,7 @@ UNMAP_AFTER_INIT bool E1000ENetworkAdapter::initialize() enable_bus_mastering(pci_address()); size_t mmio_base_size = PCI::get_BAR_space_size(pci_address(), 0); - auto region_or_error = MM.allocate_kernel_region(PhysicalAddress(page_base_of(PCI::get_BAR0(pci_address()))), Memory::page_round_up(mmio_base_size).release_value_but_fixme_should_propagate_errors(), "E1000e MMIO", Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No); + auto region_or_error = MM.allocate_kernel_region(PhysicalAddress(page_base_of(PCI::get_BAR0(pci_address()))), Memory::page_round_up(mmio_base_size).release_value_but_fixme_should_propagate_errors(), "E1000e MMIO"sv, Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No); if (region_or_error.is_error()) return false; m_mmio_region = region_or_error.release_value(); diff --git a/Kernel/Net/Intel/E1000NetworkAdapter.cpp b/Kernel/Net/Intel/E1000NetworkAdapter.cpp index e0ca57a69d..08bbbcf584 100644 --- a/Kernel/Net/Intel/E1000NetworkAdapter.cpp +++ b/Kernel/Net/Intel/E1000NetworkAdapter.cpp @@ -200,7 +200,7 @@ UNMAP_AFTER_INIT bool E1000NetworkAdapter::initialize() m_io_base = IOAddress(PCI::get_BAR1(pci_address()) & ~1); size_t mmio_base_size = PCI::get_BAR_space_size(pci_address(), 0); - auto region_or_error = MM.allocate_kernel_region(PhysicalAddress(page_base_of(PCI::get_BAR0(pci_address()))), Memory::page_round_up(mmio_base_size).release_value_but_fixme_should_propagate_errors(), "E1000 MMIO", Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No); + auto region_or_error = MM.allocate_kernel_region(PhysicalAddress(page_base_of(PCI::get_BAR0(pci_address()))), Memory::page_round_up(mmio_base_size).release_value_but_fixme_should_propagate_errors(), "E1000 MMIO"sv, Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No); if (region_or_error.is_error()) return false; m_mmio_region = region_or_error.release_value(); @@ -231,8 +231,8 @@ UNMAP_AFTER_INIT E1000NetworkAdapter::E1000NetworkAdapter(PCI::Address address, : NetworkAdapter(move(interface_name)) , PCI::Device(address) , IRQHandler(irq) - , m_rx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(e1000_rx_desc) * number_of_rx_descriptors).release_value_but_fixme_should_propagate_errors(), "E1000 RX Descriptors", Memory::Region::Access::ReadWrite).release_value()) - , m_tx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(e1000_tx_desc) * number_of_tx_descriptors).release_value_but_fixme_should_propagate_errors(), "E1000 TX Descriptors", Memory::Region::Access::ReadWrite).release_value()) + , m_rx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(e1000_rx_desc) * number_of_rx_descriptors).release_value_but_fixme_should_propagate_errors(), "E1000 RX Descriptors"sv, Memory::Region::Access::ReadWrite).release_value()) + , m_tx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(e1000_tx_desc) * number_of_tx_descriptors).release_value_but_fixme_should_propagate_errors(), "E1000 TX Descriptors"sv, Memory::Region::Access::ReadWrite).release_value()) { } @@ -324,7 +324,7 @@ UNMAP_AFTER_INIT void E1000NetworkAdapter::initialize_rx_descriptors() constexpr auto rx_buffer_size = 8192; constexpr auto rx_buffer_page_count = rx_buffer_size / PAGE_SIZE; - m_rx_buffer_region = MM.allocate_contiguous_kernel_region(rx_buffer_size * number_of_rx_descriptors, "E1000 RX buffers", Memory::Region::Access::ReadWrite).release_value(); + m_rx_buffer_region = MM.allocate_contiguous_kernel_region(rx_buffer_size * number_of_rx_descriptors, "E1000 RX buffers"sv, Memory::Region::Access::ReadWrite).release_value(); for (size_t i = 0; i < number_of_rx_descriptors; ++i) { auto& descriptor = rx_descriptors[i]; m_rx_buffers[i] = m_rx_buffer_region->vaddr().as_ptr() + rx_buffer_size * i; @@ -347,7 +347,7 @@ UNMAP_AFTER_INIT void E1000NetworkAdapter::initialize_tx_descriptors() constexpr auto tx_buffer_size = 8192; constexpr auto tx_buffer_page_count = tx_buffer_size / PAGE_SIZE; - m_tx_buffer_region = MM.allocate_contiguous_kernel_region(tx_buffer_size * number_of_tx_descriptors, "E1000 TX buffers", Memory::Region::Access::ReadWrite).release_value(); + m_tx_buffer_region = MM.allocate_contiguous_kernel_region(tx_buffer_size * number_of_tx_descriptors, "E1000 TX buffers"sv, Memory::Region::Access::ReadWrite).release_value(); for (size_t i = 0; i < number_of_tx_descriptors; ++i) { auto& descriptor = tx_descriptors[i]; @@ -446,7 +446,7 @@ void E1000NetworkAdapter::send_raw(ReadonlyBytes payload) sti(); break; } - m_wait_queue.wait_forever("E1000NetworkAdapter"); + m_wait_queue.wait_forever("E1000NetworkAdapter"sv); } dbgln_if(E1000_DEBUG, "E1000: Sent packet, status is now {:#02x}!", (u8)descriptor.status); } diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp index 04fbca624c..71c1a1b7f8 100644 --- a/Kernel/Net/LocalSocket.cpp +++ b/Kernel/Net/LocalSocket.cpp @@ -368,12 +368,12 @@ StringView LocalSocket::socket_path() const ErrorOr<NonnullOwnPtr<KString>> LocalSocket::pseudo_path(OpenFileDescription const& description) const { StringBuilder builder; - TRY(builder.try_append("socket:")); + TRY(builder.try_append("socket:"sv)); TRY(builder.try_append(socket_path())); switch (role(description)) { case Role::Listener: - TRY(builder.try_append(" (listening)")); + TRY(builder.try_append(" (listening)"sv)); break; case Role::Accepted: TRY(builder.try_appendff(" (accepted from pid {})", origin_pid())); @@ -382,7 +382,7 @@ ErrorOr<NonnullOwnPtr<KString>> LocalSocket::pseudo_path(OpenFileDescription con TRY(builder.try_appendff(" (connected to pid {})", acceptor_pid())); break; case Role::Connecting: - TRY(builder.try_append(" (connecting)")); + TRY(builder.try_append(" (connecting)"sv)); break; default: break; diff --git a/Kernel/Net/NE2000/NetworkAdapter.cpp b/Kernel/Net/NE2000/NetworkAdapter.cpp index 1cc1ef25e9..a3cf68d1be 100644 --- a/Kernel/Net/NE2000/NetworkAdapter.cpp +++ b/Kernel/Net/NE2000/NetworkAdapter.cpp @@ -379,7 +379,7 @@ void NE2000NetworkAdapter::send_raw(ReadonlyBytes payload) } while (in8(REG_RW_COMMAND) & BIT_COMMAND_TXP) - m_wait_queue.wait_forever("NE2000NetworkAdapter"); + m_wait_queue.wait_forever("NE2000NetworkAdapter"sv); disable_irq(); size_t packet_size = payload.size(); diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp index 632ca05beb..722241b9b3 100644 --- a/Kernel/Net/NetworkTask.cpp +++ b/Kernel/Net/NetworkTask.cpp @@ -43,7 +43,7 @@ static HashTable<RefPtr<TCPSocket>>* delayed_ack_sockets; void NetworkTask::spawn() { RefPtr<Thread> thread; - auto name = KString::try_create("Network Task"); + auto name = KString::try_create("Network Task"sv); if (name.is_error()) TODO(); (void)Process::create_kernel_process(thread, name.release_value(), NetworkTask_main, nullptr); @@ -90,7 +90,7 @@ void NetworkTask_main(void*) }; size_t buffer_size = 64 * KiB; - auto region_or_error = MM.allocate_kernel_region(buffer_size, "Kernel Packet Buffer", Memory::Region::Access::ReadWrite); + auto region_or_error = MM.allocate_kernel_region(buffer_size, "Kernel Packet Buffer"sv, Memory::Region::Access::ReadWrite); if (region_or_error.is_error()) TODO(); auto buffer_region = region_or_error.release_value(); @@ -104,7 +104,7 @@ void NetworkTask_main(void*) if (!packet_size) { auto timeout_time = Time::from_milliseconds(500); auto timeout = Thread::BlockTimeout { false, &timeout_time }; - [[maybe_unused]] auto result = packet_wait_queue.wait_on(timeout, "NetworkTask"); + [[maybe_unused]] auto result = packet_wait_queue.wait_on(timeout, "NetworkTask"sv); continue; } if (packet_size < sizeof(EthernetFrameHeader)) { diff --git a/Kernel/Net/Realtek/RTL8139NetworkAdapter.cpp b/Kernel/Net/Realtek/RTL8139NetworkAdapter.cpp index 6481280a75..038464fd83 100644 --- a/Kernel/Net/Realtek/RTL8139NetworkAdapter.cpp +++ b/Kernel/Net/Realtek/RTL8139NetworkAdapter.cpp @@ -131,8 +131,8 @@ UNMAP_AFTER_INIT RTL8139NetworkAdapter::RTL8139NetworkAdapter(PCI::Address addre , PCI::Device(address) , IRQHandler(irq) , m_io_base(PCI::get_BAR0(pci_address()) & ~1) - , m_rx_buffer(MM.allocate_contiguous_kernel_region(Memory::page_round_up(RX_BUFFER_SIZE + PACKET_SIZE_MAX).release_value_but_fixme_should_propagate_errors(), "RTL8139 RX", Memory::Region::Access::ReadWrite).release_value()) - , m_packet_buffer(MM.allocate_contiguous_kernel_region(Memory::page_round_up(PACKET_SIZE_MAX).release_value_but_fixme_should_propagate_errors(), "RTL8139 Packet buffer", Memory::Region::Access::ReadWrite).release_value()) + , m_rx_buffer(MM.allocate_contiguous_kernel_region(Memory::page_round_up(RX_BUFFER_SIZE + PACKET_SIZE_MAX).release_value_but_fixme_should_propagate_errors(), "RTL8139 RX"sv, Memory::Region::Access::ReadWrite).release_value()) + , m_packet_buffer(MM.allocate_contiguous_kernel_region(Memory::page_round_up(PACKET_SIZE_MAX).release_value_but_fixme_should_propagate_errors(), "RTL8139 Packet buffer"sv, Memory::Region::Access::ReadWrite).release_value()) { m_tx_buffers.ensure_capacity(RTL8139_TX_BUFFER_COUNT); @@ -149,7 +149,7 @@ UNMAP_AFTER_INIT RTL8139NetworkAdapter::RTL8139NetworkAdapter(PCI::Address addre dbgln("RTL8139: RX buffer: {}", m_rx_buffer->physical_page(0)->paddr()); for (int i = 0; i < RTL8139_TX_BUFFER_COUNT; i++) { - m_tx_buffers.append(MM.allocate_contiguous_kernel_region(Memory::page_round_up(TX_BUFFER_SIZE).release_value_but_fixme_should_propagate_errors(), "RTL8139 TX", Memory::Region::Access::Write | Memory::Region::Access::Read).release_value()); + m_tx_buffers.append(MM.allocate_contiguous_kernel_region(Memory::page_round_up(TX_BUFFER_SIZE).release_value_but_fixme_should_propagate_errors(), "RTL8139 TX"sv, Memory::Region::Access::Write | Memory::Region::Access::Read).release_value()); dbgln("RTL8139: TX buffer {}: {}", i, m_tx_buffers[i]->physical_page(0)->paddr()); } diff --git a/Kernel/Net/Realtek/RTL8168NetworkAdapter.cpp b/Kernel/Net/Realtek/RTL8168NetworkAdapter.cpp index 0d1fcc3945..4d3f52511d 100644 --- a/Kernel/Net/Realtek/RTL8168NetworkAdapter.cpp +++ b/Kernel/Net/Realtek/RTL8168NetworkAdapter.cpp @@ -246,8 +246,8 @@ UNMAP_AFTER_INIT RTL8168NetworkAdapter::RTL8168NetworkAdapter(PCI::Address addre , PCI::Device(address) , IRQHandler(irq) , m_io_base(PCI::get_BAR0(pci_address()) & ~1) - , m_rx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(TXDescriptor) * (number_of_rx_descriptors + 1)).release_value_but_fixme_should_propagate_errors(), "RTL8168 RX", Memory::Region::Access::ReadWrite).release_value()) - , m_tx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(RXDescriptor) * (number_of_tx_descriptors + 1)).release_value_but_fixme_should_propagate_errors(), "RTL8168 TX", Memory::Region::Access::ReadWrite).release_value()) + , m_rx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(TXDescriptor) * (number_of_rx_descriptors + 1)).release_value_but_fixme_should_propagate_errors(), "RTL8168 RX"sv, Memory::Region::Access::ReadWrite).release_value()) + , m_tx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(RXDescriptor) * (number_of_tx_descriptors + 1)).release_value_but_fixme_should_propagate_errors(), "RTL8168 TX"sv, Memory::Region::Access::ReadWrite).release_value()) { dmesgln("RTL8168: Found @ {}", pci_address()); dmesgln("RTL8168: I/O port base: {}", m_io_base); @@ -1095,7 +1095,7 @@ UNMAP_AFTER_INIT void RTL8168NetworkAdapter::initialize_rx_descriptors() auto* rx_descriptors = (RXDescriptor*)m_rx_descriptors_region->vaddr().as_ptr(); for (size_t i = 0; i < number_of_rx_descriptors; ++i) { auto& descriptor = rx_descriptors[i]; - auto region = MM.allocate_contiguous_kernel_region(Memory::page_round_up(RX_BUFFER_SIZE).release_value_but_fixme_should_propagate_errors(), "RTL8168 RX buffer", Memory::Region::Access::ReadWrite).release_value(); + auto region = MM.allocate_contiguous_kernel_region(Memory::page_round_up(RX_BUFFER_SIZE).release_value_but_fixme_should_propagate_errors(), "RTL8168 RX buffer"sv, Memory::Region::Access::ReadWrite).release_value(); memset(region->vaddr().as_ptr(), 0, region->size()); // MM already zeros out newly allocated pages, but we do it again in case that ever changes m_rx_buffers_regions.append(move(region)); @@ -1113,7 +1113,7 @@ UNMAP_AFTER_INIT void RTL8168NetworkAdapter::initialize_tx_descriptors() auto* tx_descriptors = (TXDescriptor*)m_tx_descriptors_region->vaddr().as_ptr(); for (size_t i = 0; i < number_of_tx_descriptors; ++i) { auto& descriptor = tx_descriptors[i]; - auto region = MM.allocate_contiguous_kernel_region(Memory::page_round_up(TX_BUFFER_SIZE).release_value_but_fixme_should_propagate_errors(), "RTL8168 TX buffer", Memory::Region::Access::ReadWrite).release_value(); + auto region = MM.allocate_contiguous_kernel_region(Memory::page_round_up(TX_BUFFER_SIZE).release_value_but_fixme_should_propagate_errors(), "RTL8168 TX buffer"sv, Memory::Region::Access::ReadWrite).release_value(); memset(region->vaddr().as_ptr(), 0, region->size()); // MM already zeros out newly allocated pages, but we do it again in case that ever changes m_tx_buffers_regions.append(move(region)); @@ -1204,7 +1204,7 @@ void RTL8168NetworkAdapter::send_raw(ReadonlyBytes payload) if ((free_descriptor.flags & TXDescriptor::Ownership) != 0) { dbgln_if(RTL8168_DEBUG, "RTL8168: No free TX buffers, sleeping until one is available"); - m_wait_queue.wait_forever("RTL8168NetworkAdapter"); + m_wait_queue.wait_forever("RTL8168NetworkAdapter"sv); return send_raw(payload); // if we woke up a TX descriptor is guaranteed to be available, so this should never recurse more than once // but this can probably be done more cleanly @@ -1664,7 +1664,7 @@ StringView RTL8168NetworkAdapter::possible_device_name() case ChipVersion::Version19: return "RTL8168F/8111F"sv; // 35, 36 case ChipVersion::Version20: - return "RTL8411"; // 38 + return "RTL8411"sv; // 38 case ChipVersion::Version21: case ChipVersion::Version22: return "RTL8168G/8111G"sv; // 40, 41, 42 @@ -1676,7 +1676,7 @@ StringView RTL8168NetworkAdapter::possible_device_name() case ChipVersion::Version25: return "RTL8168GU/8111GU"sv; // ??? case ChipVersion::Version26: - return "RTL8411B"; // 44 + return "RTL8411B"sv; // 44 case ChipVersion::Version29: case ChipVersion::Version30: return "RTL8168H/8111H"sv; // 45, 46 diff --git a/Kernel/Net/TCPSocket.h b/Kernel/Net/TCPSocket.h index e9d588b790..8f7530214e 100644 --- a/Kernel/Net/TCPSocket.h +++ b/Kernel/Net/TCPSocket.h @@ -88,7 +88,7 @@ public: case State::TimeWait: return "TimeWait"sv; default: - return "None"; + return "None"sv; } } diff --git a/Kernel/PerformanceEventBuffer.cpp b/Kernel/PerformanceEventBuffer.cpp index 1920a48fac..50ee253202 100644 --- a/Kernel/PerformanceEventBuffer.cpp +++ b/Kernel/PerformanceEventBuffer.cpp @@ -191,7 +191,7 @@ template<typename Serializer> ErrorOr<void> PerformanceEventBuffer::to_json_impl(Serializer& object) const { { - auto strings = TRY(object.add_array("strings")); + auto strings = TRY(object.add_array("strings"sv)); Vector<KString*> strings_sorted_by_index; TRY(strings_sorted_by_index.try_resize(m_strings.size())); @@ -207,7 +207,7 @@ ErrorOr<void> PerformanceEventBuffer::to_json_impl(Serializer& object) const } bool show_kernel_addresses = Process::current().is_superuser(); - auto array = TRY(object.add_array("events")); + auto array = TRY(object.add_array("events"sv)); bool seen_first_sample = false; for (size_t i = 0; i < m_count; ++i) { auto const& event = at(i); @@ -220,67 +220,67 @@ ErrorOr<void> PerformanceEventBuffer::to_json_impl(Serializer& object) const auto event_object = TRY(array.add_object()); switch (event.type) { case PERF_EVENT_SAMPLE: - TRY(event_object.add("type", "sample")); + TRY(event_object.add("type"sv, "sample")); break; case PERF_EVENT_MALLOC: - TRY(event_object.add("type", "malloc")); - TRY(event_object.add("ptr", static_cast<u64>(event.data.malloc.ptr))); - TRY(event_object.add("size", static_cast<u64>(event.data.malloc.size))); + TRY(event_object.add("type"sv, "malloc")); + TRY(event_object.add("ptr"sv, static_cast<u64>(event.data.malloc.ptr))); + TRY(event_object.add("size"sv, static_cast<u64>(event.data.malloc.size))); break; case PERF_EVENT_FREE: - TRY(event_object.add("type", "free")); - TRY(event_object.add("ptr", static_cast<u64>(event.data.free.ptr))); + TRY(event_object.add("type"sv, "free")); + TRY(event_object.add("ptr"sv, static_cast<u64>(event.data.free.ptr))); break; case PERF_EVENT_MMAP: - TRY(event_object.add("type", "mmap")); - TRY(event_object.add("ptr", static_cast<u64>(event.data.mmap.ptr))); - TRY(event_object.add("size", static_cast<u64>(event.data.mmap.size))); - TRY(event_object.add("name", event.data.mmap.name)); + TRY(event_object.add("type"sv, "mmap")); + TRY(event_object.add("ptr"sv, static_cast<u64>(event.data.mmap.ptr))); + TRY(event_object.add("size"sv, static_cast<u64>(event.data.mmap.size))); + TRY(event_object.add("name"sv, event.data.mmap.name)); break; case PERF_EVENT_MUNMAP: - TRY(event_object.add("type", "munmap")); - TRY(event_object.add("ptr", static_cast<u64>(event.data.munmap.ptr))); - TRY(event_object.add("size", static_cast<u64>(event.data.munmap.size))); + TRY(event_object.add("type"sv, "munmap")); + TRY(event_object.add("ptr"sv, static_cast<u64>(event.data.munmap.ptr))); + TRY(event_object.add("size"sv, static_cast<u64>(event.data.munmap.size))); break; case PERF_EVENT_PROCESS_CREATE: - TRY(event_object.add("type", "process_create")); - TRY(event_object.add("parent_pid", static_cast<u64>(event.data.process_create.parent_pid))); - TRY(event_object.add("executable", event.data.process_create.executable)); + TRY(event_object.add("type"sv, "process_create")); + TRY(event_object.add("parent_pid"sv, static_cast<u64>(event.data.process_create.parent_pid))); + TRY(event_object.add("executable"sv, event.data.process_create.executable)); break; case PERF_EVENT_PROCESS_EXEC: - TRY(event_object.add("type", "process_exec")); - TRY(event_object.add("executable", event.data.process_exec.executable)); + TRY(event_object.add("type"sv, "process_exec")); + TRY(event_object.add("executable"sv, event.data.process_exec.executable)); break; case PERF_EVENT_PROCESS_EXIT: - TRY(event_object.add("type", "process_exit")); + TRY(event_object.add("type"sv, "process_exit")); break; case PERF_EVENT_THREAD_CREATE: - TRY(event_object.add("type", "thread_create")); - TRY(event_object.add("parent_tid", static_cast<u64>(event.data.thread_create.parent_tid))); + TRY(event_object.add("type"sv, "thread_create")); + TRY(event_object.add("parent_tid"sv, static_cast<u64>(event.data.thread_create.parent_tid))); break; case PERF_EVENT_THREAD_EXIT: - TRY(event_object.add("type", "thread_exit")); + TRY(event_object.add("type"sv, "thread_exit")); break; case PERF_EVENT_CONTEXT_SWITCH: - TRY(event_object.add("type", "context_switch")); - TRY(event_object.add("next_pid", static_cast<u64>(event.data.context_switch.next_pid))); - TRY(event_object.add("next_tid", static_cast<u64>(event.data.context_switch.next_tid))); + TRY(event_object.add("type"sv, "context_switch")); + TRY(event_object.add("next_pid"sv, static_cast<u64>(event.data.context_switch.next_pid))); + TRY(event_object.add("next_tid"sv, static_cast<u64>(event.data.context_switch.next_tid))); break; case PERF_EVENT_KMALLOC: - TRY(event_object.add("type", "kmalloc")); - TRY(event_object.add("ptr", static_cast<u64>(event.data.kmalloc.ptr))); - TRY(event_object.add("size", static_cast<u64>(event.data.kmalloc.size))); + TRY(event_object.add("type"sv, "kmalloc")); + TRY(event_object.add("ptr"sv, static_cast<u64>(event.data.kmalloc.ptr))); + TRY(event_object.add("size"sv, static_cast<u64>(event.data.kmalloc.size))); break; case PERF_EVENT_KFREE: - TRY(event_object.add("type", "kfree")); - TRY(event_object.add("ptr", static_cast<u64>(event.data.kfree.ptr))); - TRY(event_object.add("size", static_cast<u64>(event.data.kfree.size))); + TRY(event_object.add("type"sv, "kfree")); + TRY(event_object.add("ptr"sv, static_cast<u64>(event.data.kfree.ptr))); + TRY(event_object.add("size"sv, static_cast<u64>(event.data.kfree.size))); break; case PERF_EVENT_PAGE_FAULT: - TRY(event_object.add("type", "page_fault")); + TRY(event_object.add("type"sv, "page_fault")); break; case PERF_EVENT_SYSCALL: - TRY(event_object.add("type", "syscall")); + TRY(event_object.add("type"sv, "syscall")); break; case PERF_EVENT_SIGNPOST: TRY(event_object.add("type"sv, "signpost"sv)); @@ -288,21 +288,21 @@ ErrorOr<void> PerformanceEventBuffer::to_json_impl(Serializer& object) const TRY(event_object.add("arg2"sv, event.data.signpost.arg2)); break; case PERF_EVENT_READ: - TRY(event_object.add("type", "read")); - TRY(event_object.add("fd", event.data.read.fd)); + TRY(event_object.add("type"sv, "read")); + TRY(event_object.add("fd"sv, event.data.read.fd)); TRY(event_object.add("size"sv, event.data.read.size)); TRY(event_object.add("filename_index"sv, event.data.read.filename_index)); TRY(event_object.add("start_timestamp"sv, event.data.read.start_timestamp)); TRY(event_object.add("success"sv, event.data.read.success)); break; } - TRY(event_object.add("pid", event.pid)); - TRY(event_object.add("tid", event.tid)); - TRY(event_object.add("timestamp", event.timestamp)); - TRY(event_object.add("lost_samples", seen_first_sample ? event.lost_samples : 0)); + TRY(event_object.add("pid"sv, event.pid)); + TRY(event_object.add("tid"sv, event.tid)); + TRY(event_object.add("timestamp"sv, event.timestamp)); + TRY(event_object.add("lost_samples"sv, seen_first_sample ? event.lost_samples : 0)); if (event.type == PERF_EVENT_SAMPLE) seen_first_sample = true; - auto stack_array = TRY(event_object.add_array("stack")); + auto stack_array = TRY(event_object.add_array("stack"sv)); for (size_t j = 0; j < event.stack_size; ++j) { auto address = event.stack[j]; if (!show_kernel_addresses && !Memory::is_user_address(VirtualAddress { address })) diff --git a/Kernel/PerformanceManager.h b/Kernel/PerformanceManager.h index a2f5d77786..fb909c8522 100644 --- a/Kernel/PerformanceManager.h +++ b/Kernel/PerformanceManager.h @@ -149,7 +149,7 @@ public: return; filepath_string_index = registered_result.value(); } else { - auto invalid_path_string = KString::try_create("<INVALID_FILE_PATH>"); // TODO: Performance, unecessary allocations. + auto invalid_path_string = KString::try_create("<INVALID_FILE_PATH>"sv); // TODO: Performance, unecessary allocations. if (invalid_path_string.is_error()) return; auto registered_result = event_buffer->register_string(move(invalid_path_string.value())); diff --git a/Kernel/PhysicalAddress.h b/Kernel/PhysicalAddress.h index 8a4fbaef25..8610992ab5 100644 --- a/Kernel/PhysicalAddress.h +++ b/Kernel/PhysicalAddress.h @@ -61,8 +61,8 @@ struct AK::Formatter<PhysicalAddress> : AK::Formatter<FormatString> { ErrorOr<void> format(FormatBuilder& builder, PhysicalAddress value) { if constexpr (sizeof(PhysicalPtr) == sizeof(u64)) - return AK::Formatter<FormatString>::format(builder, "P{:016x}", value.get()); + return AK::Formatter<FormatString>::format(builder, "P{:016x}"sv, value.get()); else - return AK::Formatter<FormatString>::format(builder, "P{}", value.as_ptr()); + return AK::Formatter<FormatString>::format(builder, "P{}"sv, value.as_ptr()); } }; diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 1e911cf3b3..4c50479e70 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -374,7 +374,7 @@ extern "C" char const asm_signal_trampoline_end[]; void create_signal_trampoline() { // NOTE: We leak this region. - g_signal_trampoline_region = MM.allocate_kernel_region(PAGE_SIZE, "Signal trampolines", Memory::Region::Access::ReadWrite).release_value().leak_ptr(); + g_signal_trampoline_region = MM.allocate_kernel_region(PAGE_SIZE, "Signal trampolines"sv, Memory::Region::Access::ReadWrite).release_value().leak_ptr(); g_signal_trampoline_region->set_syscall_region(true); size_t trampoline_size = asm_signal_trampoline_end - asm_signal_trampoline; @@ -905,7 +905,7 @@ static constexpr StringView to_string(Pledge promise) { #define __ENUMERATE_PLEDGE_PROMISE(x) \ case Pledge::x: \ - return #x; + return #x##sv; switch (promise) { ENUMERATE_PLEDGE_PROMISES } diff --git a/Kernel/Process.h b/Kernel/Process.h index 2bfa038b96..aae7df23e5 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -819,8 +819,8 @@ private: size_t m_master_tls_size { 0 }; size_t m_master_tls_alignment { 0 }; - Mutex m_big_lock { "Process", Mutex::MutexBehavior::BigLock }; - Mutex m_ptrace_lock { "ptrace" }; + Mutex m_big_lock { "Process"sv, Mutex::MutexBehavior::BigLock }; + Mutex m_ptrace_lock { "ptrace"sv }; RefPtr<Timer> m_alarm_timer; @@ -1036,6 +1036,6 @@ template<> struct AK::Formatter<Kernel::Process> : AK::Formatter<FormatString> { ErrorOr<void> format(FormatBuilder& builder, Kernel::Process const& value) { - return AK::Formatter<FormatString>::format(builder, "{}({})", value.name(), value.pid().value()); + return AK::Formatter<FormatString>::format(builder, "{}({})"sv, value.name(), value.pid().value()); } }; diff --git a/Kernel/ProcessExposed.cpp b/Kernel/ProcessExposed.cpp index 2a37d06269..e553103b37 100644 --- a/Kernel/ProcessExposed.cpp +++ b/Kernel/ProcessExposed.cpp @@ -241,8 +241,8 @@ ErrorOr<void> ProcFSExposedDirectory::traverse_as_directory(FileSystemID fsid, F auto parent_directory = m_parent_directory.strong_ref(); if (parent_directory.is_null()) return Error::from_errno(EINVAL); - TRY(callback({ ".", { fsid, component_index() }, DT_DIR })); - TRY(callback({ "..", { fsid, parent_directory->component_index() }, DT_DIR })); + TRY(callback({ "."sv, { fsid, component_index() }, DT_DIR })); + TRY(callback({ ".."sv, { fsid, parent_directory->component_index() }, DT_DIR })); for (auto const& component : m_components) { InodeIdentifier identifier = { fsid, component.component_index() }; diff --git a/Kernel/ProcessExposed.h b/Kernel/ProcessExposed.h index 5a15725c56..cd2edf5321 100644 --- a/Kernel/ProcessExposed.h +++ b/Kernel/ProcessExposed.h @@ -138,7 +138,7 @@ public: protected: virtual bool acquire_link(KBufferBuilder& builder) = 0; explicit ProcFSExposedLink(StringView name); - mutable Mutex m_lock { "ProcFSLink" }; + mutable Mutex m_lock { "ProcFSLink"sv }; }; namespace PCI { diff --git a/Kernel/ProcessProcFSTraits.cpp b/Kernel/ProcessProcFSTraits.cpp index 8776a444f9..78a04f5469 100644 --- a/Kernel/ProcessProcFSTraits.cpp +++ b/Kernel/ProcessProcFSTraits.cpp @@ -51,19 +51,19 @@ ErrorOr<void> Process::ProcessProcFSTraits::traverse_as_directory(FileSystemID f if (!process) return ESRCH; - TRY(callback({ ".", { fsid, SegmentedProcFSIndex::build_segmented_index_for_pid_directory(process->pid()) }, DT_DIR })); - TRY(callback({ "..", { fsid, ProcFSComponentRegistry::the().root_directory().component_index() }, DT_DIR })); - TRY(callback({ "fd", { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(process->pid(), SegmentedProcFSIndex::ProcessSubDirectory::OpenFileDescriptions) }, DT_DIR })); - TRY(callback({ "stacks", { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(process->pid(), SegmentedProcFSIndex::ProcessSubDirectory::Stacks) }, DT_DIR })); - TRY(callback({ "children", { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(process->pid(), SegmentedProcFSIndex::ProcessSubDirectory::Children) }, DT_DIR })); - TRY(callback({ "unveil", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::Unveil) }, DT_REG })); - TRY(callback({ "pledge", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::Pledge) }, DT_REG })); - TRY(callback({ "fds", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::OpenFileDescriptions) }, DT_DIR })); - TRY(callback({ "exe", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::BinaryLink) }, DT_LNK })); - TRY(callback({ "cwd", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::CurrentWorkDirectoryLink) }, DT_LNK })); - TRY(callback({ "perf_events", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::PerformanceEvents) }, DT_REG })); - TRY(callback({ "vm", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::VirtualMemoryStats) }, DT_REG })); - TRY(callback({ "cmdline", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::CommandLine) }, DT_REG })); + TRY(callback({ "."sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_pid_directory(process->pid()) }, DT_DIR })); + TRY(callback({ ".."sv, { fsid, ProcFSComponentRegistry::the().root_directory().component_index() }, DT_DIR })); + TRY(callback({ "fd"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(process->pid(), SegmentedProcFSIndex::ProcessSubDirectory::OpenFileDescriptions) }, DT_DIR })); + TRY(callback({ "stacks"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(process->pid(), SegmentedProcFSIndex::ProcessSubDirectory::Stacks) }, DT_DIR })); + TRY(callback({ "children"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(process->pid(), SegmentedProcFSIndex::ProcessSubDirectory::Children) }, DT_DIR })); + TRY(callback({ "unveil"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::Unveil) }, DT_REG })); + TRY(callback({ "pledge"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::Pledge) }, DT_REG })); + TRY(callback({ "fds"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::OpenFileDescriptions) }, DT_DIR })); + TRY(callback({ "exe"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::BinaryLink) }, DT_LNK })); + TRY(callback({ "cwd"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::CurrentWorkDirectoryLink) }, DT_LNK })); + TRY(callback({ "perf_events"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::PerformanceEvents) }, DT_REG })); + TRY(callback({ "vm"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::VirtualMemoryStats) }, DT_REG })); + TRY(callback({ "cmdline"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::CommandLine) }, DT_REG })); return {}; } diff --git a/Kernel/ProcessSpecificExposed.cpp b/Kernel/ProcessSpecificExposed.cpp index d4fd0eff8c..14eb1db680 100644 --- a/Kernel/ProcessSpecificExposed.cpp +++ b/Kernel/ProcessSpecificExposed.cpp @@ -43,8 +43,8 @@ ErrorOr<void> Process::procfs_get_thread_stack(ThreadID thread_id, KBufferBuilde ErrorOr<void> Process::traverse_stacks_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const { - TRY(callback({ ".", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property(pid(), SegmentedProcFSIndex::ProcessSubDirectory::Stacks, SegmentedProcFSIndex::MainProcessProperty::Reserved) }, 0 })); - TRY(callback({ "..", { fsid, m_procfs_traits->component_index() }, 0 })); + TRY(callback({ "."sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property(pid(), SegmentedProcFSIndex::ProcessSubDirectory::Stacks, SegmentedProcFSIndex::MainProcessProperty::Reserved) }, 0 })); + TRY(callback({ ".."sv, { fsid, m_procfs_traits->component_index() }, 0 })); return thread_list().with([&](auto& list) -> ErrorOr<void> { for (auto const& thread : list) { @@ -82,8 +82,8 @@ ErrorOr<NonnullRefPtr<Inode>> Process::lookup_stacks_directory(ProcFS const& pro ErrorOr<void> Process::traverse_children_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const { - TRY(callback({ ".", { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(pid(), SegmentedProcFSIndex::ProcessSubDirectory::Children) }, 0 })); - TRY(callback({ "..", { fsid, m_procfs_traits->component_index() }, 0 })); + TRY(callback({ "."sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(pid(), SegmentedProcFSIndex::ProcessSubDirectory::Children) }, 0 })); + TRY(callback({ ".."sv, { fsid, m_procfs_traits->component_index() }, 0 })); return Process::all_instances().with([&](auto& processes) -> ErrorOr<void> { for (auto& process : processes) { if (process.ppid() == pid()) { @@ -126,8 +126,8 @@ ErrorOr<size_t> Process::procfs_get_file_description_link(unsigned fd, KBufferBu ErrorOr<void> Process::traverse_file_descriptions_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const { - TRY(callback({ ".", { fsid, m_procfs_traits->component_index() }, 0 })); - TRY(callback({ "..", { fsid, m_procfs_traits->component_index() }, 0 })); + TRY(callback({ "."sv, { fsid, m_procfs_traits->component_index() }, 0 })); + TRY(callback({ ".."sv, { fsid, m_procfs_traits->component_index() }, 0 })); size_t count = 0; fds().with_shared([&](auto& fds) { fds.enumerate([&](auto& file_description_metadata) { @@ -164,12 +164,12 @@ ErrorOr<void> Process::procfs_get_pledge_stats(KBufferBuilder& builder) const if (has_promised(Pledge::x)) { \ if (!promises_builder.is_empty()) \ TRY(promises_builder.try_append(' ')); \ - TRY(promises_builder.try_append(#x)); \ + TRY(promises_builder.try_append(#x##sv)); \ } if (has_promises()) { StringBuilder promises_builder; ENUMERATE_PLEDGE_PROMISES - TRY(obj.add("promises", promises_builder.string_view())); + TRY(obj.add("promises"sv, promises_builder.string_view())); } #undef __ENUMERATE_PLEDGE_PROMISE TRY(obj.finish()); @@ -184,7 +184,7 @@ ErrorOr<void> Process::procfs_get_unveil_stats(KBufferBuilder& builder) const if (!unveiled_path.was_explicitly_unveiled()) return IterationDecision::Continue; auto obj = TRY(array.add_object()); - TRY(obj.add("path", unveiled_path.path())); + TRY(obj.add("path"sv, unveiled_path.path())); StringBuilder permissions_builder; if (unveiled_path.permissions() & UnveilAccess::Read) permissions_builder.append('r'); @@ -196,7 +196,7 @@ ErrorOr<void> Process::procfs_get_unveil_stats(KBufferBuilder& builder) const permissions_builder.append('c'); if (unveiled_path.permissions() & UnveilAccess::Browse) permissions_builder.append('b'); - TRY(obj.add("permissions", permissions_builder.string_view())); + TRY(obj.add("permissions"sv, permissions_builder.string_view())); TRY(obj.finish()); return IterationDecision::Continue; })); @@ -235,22 +235,22 @@ ErrorOr<void> Process::procfs_get_fds_stats(KBufferBuilder& builder) const bool cloexec = file_description_metadata.flags() & FD_CLOEXEC; RefPtr<OpenFileDescription> description = file_description_metadata.description(); auto description_object = TRY(array.add_object()); - TRY(description_object.add("fd", count)); + TRY(description_object.add("fd"sv, count)); // TODO: Better OOM handling. auto pseudo_path_or_error = description->pseudo_path(); - TRY(description_object.add("absolute_path", pseudo_path_or_error.is_error() ? "???"sv : pseudo_path_or_error.value()->view())); - TRY(description_object.add("seekable", description->file().is_seekable())); - TRY(description_object.add("class", description->file().class_name())); - TRY(description_object.add("offset", description->offset())); - TRY(description_object.add("cloexec", cloexec)); - TRY(description_object.add("blocking", description->is_blocking())); - TRY(description_object.add("can_read", description->can_read())); - TRY(description_object.add("can_write", description->can_write())); + TRY(description_object.add("absolute_path"sv, pseudo_path_or_error.is_error() ? "???"sv : pseudo_path_or_error.value()->view())); + TRY(description_object.add("seekable"sv, description->file().is_seekable())); + TRY(description_object.add("class"sv, description->file().class_name())); + TRY(description_object.add("offset"sv, description->offset())); + TRY(description_object.add("cloexec"sv, cloexec)); + TRY(description_object.add("blocking"sv, description->is_blocking())); + TRY(description_object.add("can_read"sv, description->can_read())); + TRY(description_object.add("can_write"sv, description->can_write())); Inode* inode = description->inode(); if (inode != nullptr) { - auto inode_object = TRY(description_object.add_object("inode")); - TRY(inode_object.add("fsid", inode->fsid().value())); - TRY(inode_object.add("index", inode->index().value())); + auto inode_object = TRY(description_object.add_object("inode"sv)); + TRY(inode_object.add("fsid"sv, inode->fsid().value())); + TRY(inode_object.add("index"sv, inode->index().value())); TRY(inode_object.finish()); } TRY(description_object.finish()); @@ -272,24 +272,24 @@ ErrorOr<void> Process::procfs_get_virtual_memory_stats(KBufferBuilder& builder) if (!region.is_user() && !Process::current().is_superuser()) continue; auto region_object = TRY(array.add_object()); - TRY(region_object.add("readable", region.is_readable())); - TRY(region_object.add("writable", region.is_writable())); - TRY(region_object.add("executable", region.is_executable())); - TRY(region_object.add("stack", region.is_stack())); - TRY(region_object.add("shared", region.is_shared())); - TRY(region_object.add("syscall", region.is_syscall_region())); - TRY(region_object.add("purgeable", region.vmobject().is_anonymous())); + TRY(region_object.add("readable"sv, region.is_readable())); + TRY(region_object.add("writable"sv, region.is_writable())); + TRY(region_object.add("executable"sv, region.is_executable())); + TRY(region_object.add("stack"sv, region.is_stack())); + TRY(region_object.add("shared"sv, region.is_shared())); + TRY(region_object.add("syscall"sv, region.is_syscall_region())); + TRY(region_object.add("purgeable"sv, region.vmobject().is_anonymous())); if (region.vmobject().is_anonymous()) { - TRY(region_object.add("volatile", static_cast<Memory::AnonymousVMObject const&>(region.vmobject()).is_volatile())); + TRY(region_object.add("volatile"sv, static_cast<Memory::AnonymousVMObject const&>(region.vmobject()).is_volatile())); } - TRY(region_object.add("cacheable", region.is_cacheable())); - TRY(region_object.add("address", region.vaddr().get())); - TRY(region_object.add("size", region.size())); - TRY(region_object.add("amount_resident", region.amount_resident())); - TRY(region_object.add("amount_dirty", region.amount_dirty())); - TRY(region_object.add("cow_pages", region.cow_pages())); - TRY(region_object.add("name", region.name())); - TRY(region_object.add("vmobject", region.vmobject().class_name())); + TRY(region_object.add("cacheable"sv, region.is_cacheable())); + TRY(region_object.add("address"sv, region.vaddr().get())); + TRY(region_object.add("size"sv, region.size())); + TRY(region_object.add("amount_resident"sv, region.amount_resident())); + TRY(region_object.add("amount_dirty"sv, region.amount_dirty())); + TRY(region_object.add("cow_pages"sv, region.cow_pages())); + TRY(region_object.add("name"sv, region.name())); + TRY(region_object.add("vmobject"sv, region.vmobject().class_name())); StringBuilder pagemap_builder; for (size_t i = 0; i < region.page_count(); ++i) { @@ -301,7 +301,7 @@ ErrorOr<void> Process::procfs_get_virtual_memory_stats(KBufferBuilder& builder) else pagemap_builder.append('P'); } - TRY(region_object.add("pagemap", pagemap_builder.string_view())); + TRY(region_object.add("pagemap"sv, pagemap_builder.string_view())); TRY(region_object.finish()); } } diff --git a/Kernel/Random.cpp b/Kernel/Random.cpp index fedb562c19..6d87ddfa8f 100644 --- a/Kernel/Random.cpp +++ b/Kernel/Random.cpp @@ -73,7 +73,7 @@ void KernelRng::wait_for_entropy() SpinlockLocker lock(get_lock()); if (!is_ready()) { dbgln("Entropy starvation..."); - m_seed_queue.wait_forever("KernelRng"); + m_seed_queue.wait_forever("KernelRng"sv); } } diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index 8056c5a106..d674b5829c 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -401,11 +401,11 @@ UNMAP_AFTER_INIT void Scheduler::initialize() g_finalizer_wait_queue = new WaitQueue; g_finalizer_has_work.store(false, AK::MemoryOrder::memory_order_release); - s_colonel_process = Process::create_kernel_process(idle_thread, KString::must_create("colonel"), idle_loop, nullptr, 1, Process::RegisterProcess::No).leak_ref(); + s_colonel_process = Process::create_kernel_process(idle_thread, KString::must_create("colonel"sv), idle_loop, nullptr, 1, Process::RegisterProcess::No).leak_ref(); VERIFY(s_colonel_process); VERIFY(idle_thread); idle_thread->set_priority(THREAD_PRIORITY_MIN); - idle_thread->set_name(KString::must_create("Idle Task #0")); + idle_thread->set_name(KString::must_create("Idle Task #0"sv)); set_idle_thread(idle_thread); } diff --git a/Kernel/Storage/ATA/AHCIController.cpp b/Kernel/Storage/ATA/AHCIController.cpp index 7e353bcb9e..f66ec99ed8 100644 --- a/Kernel/Storage/ATA/AHCIController.cpp +++ b/Kernel/Storage/ATA/AHCIController.cpp @@ -155,7 +155,7 @@ AHCI::HBADefinedCapabilities AHCIController::capabilities() const UNMAP_AFTER_INIT NonnullOwnPtr<Memory::Region> AHCIController::default_hba_region() const { - return MM.allocate_kernel_region(PhysicalAddress(PCI::get_BAR5(pci_address())).page_base(), Memory::page_round_up(sizeof(AHCI::HBA)).release_value_but_fixme_should_propagate_errors(), "AHCI HBA", Memory::Region::Access::ReadWrite).release_value(); + return MM.allocate_kernel_region(PhysicalAddress(PCI::get_BAR5(pci_address())).page_base(), Memory::page_round_up(sizeof(AHCI::HBA)).release_value_but_fixme_should_propagate_errors(), "AHCI HBA"sv, Memory::Region::Access::ReadWrite).release_value(); } AHCIController::~AHCIController() = default; diff --git a/Kernel/Storage/ATA/AHCIPort.cpp b/Kernel/Storage/ATA/AHCIPort.cpp index cb688fc973..f303cd6e7f 100644 --- a/Kernel/Storage/ATA/AHCIPort.cpp +++ b/Kernel/Storage/ATA/AHCIPort.cpp @@ -46,7 +46,7 @@ ErrorOr<void> AHCIPort::allocate_resources_and_initialize_ports() m_command_table_pages.append(move(command_table_page)); } - m_command_list_region = TRY(MM.allocate_dma_buffer_page("AHCI Port Command List", Memory::Region::Access::ReadWrite, m_command_list_page)); + m_command_list_region = TRY(MM.allocate_dma_buffer_page("AHCI Port Command List"sv, Memory::Region::Access::ReadWrite, m_command_list_page)); dbgln_if(AHCI_DEBUG, "AHCI Port {}: Command list page at {}", representative_port_index(), m_command_list_page->paddr()); dbgln_if(AHCI_DEBUG, "AHCI Port {}: FIS receive page at {}", representative_port_index(), m_fis_receive_page->paddr()); @@ -220,7 +220,7 @@ void AHCIPort::eject() // handshake error bit in PxSERR register if CFL is incorrect. command_list_entries[unused_command_header.value()].attributes = (size_t)FIS::DwordCount::RegisterHostToDevice | AHCI::CommandHeaderAttributes::P | AHCI::CommandHeaderAttributes::C | AHCI::CommandHeaderAttributes::A; - auto command_table_region = MM.allocate_kernel_region(m_command_table_pages[unused_command_header.value()].paddr().page_base(), Memory::page_round_up(sizeof(AHCI::CommandTable)).value(), "AHCI Command Table", Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No).release_value(); + auto command_table_region = MM.allocate_kernel_region(m_command_table_pages[unused_command_header.value()].paddr().page_base(), Memory::page_round_up(sizeof(AHCI::CommandTable)).value(), "AHCI Command Table"sv, Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No).release_value(); auto& command_table = *(volatile AHCI::CommandTable*)command_table_region->vaddr().as_ptr(); memset(const_cast<u8*>(command_table.command_fis), 0, 64); auto& fis = *(volatile FIS::HostToDevice::Register*)command_table.command_fis; @@ -590,7 +590,7 @@ bool AHCIPort::access_device(AsyncBlockDeviceRequest::RequestType direction, u64 dbgln_if(AHCI_DEBUG, "AHCI Port {}: CLE: ctba={:#08x}, ctbau={:#08x}, prdbc={:#08x}, prdtl={:#04x}, attributes={:#04x}", representative_port_index(), (u32)command_list_entries[unused_command_header.value()].ctba, (u32)command_list_entries[unused_command_header.value()].ctbau, (u32)command_list_entries[unused_command_header.value()].prdbc, (u16)command_list_entries[unused_command_header.value()].prdtl, (u16)command_list_entries[unused_command_header.value()].attributes); - auto command_table_region = MM.allocate_kernel_region(m_command_table_pages[unused_command_header.value()].paddr().page_base(), Memory::page_round_up(sizeof(AHCI::CommandTable)).value(), "AHCI Command Table", Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No).release_value(); + auto command_table_region = MM.allocate_kernel_region(m_command_table_pages[unused_command_header.value()].paddr().page_base(), Memory::page_round_up(sizeof(AHCI::CommandTable)).value(), "AHCI Command Table"sv, Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No).release_value(); auto& command_table = *(volatile AHCI::CommandTable*)command_table_region->vaddr().as_ptr(); dbgln_if(AHCI_DEBUG, "AHCI Port {}: Allocated command table at {}", representative_port_index(), command_table_region->vaddr()); @@ -678,7 +678,7 @@ bool AHCIPort::identify_device() // QEMU doesn't care if we don't set the correct CFL field in this register, real hardware will set an handshake error bit in PxSERR register. command_list_entries[unused_command_header.value()].attributes = (size_t)FIS::DwordCount::RegisterHostToDevice | AHCI::CommandHeaderAttributes::P; - auto command_table_region = MM.allocate_kernel_region(m_command_table_pages[unused_command_header.value()].paddr().page_base(), Memory::page_round_up(sizeof(AHCI::CommandTable)).value(), "AHCI Command Table", Memory::Region::Access::ReadWrite).release_value(); + auto command_table_region = MM.allocate_kernel_region(m_command_table_pages[unused_command_header.value()].paddr().page_base(), Memory::page_round_up(sizeof(AHCI::CommandTable)).value(), "AHCI Command Table"sv, Memory::Region::Access::ReadWrite).release_value(); auto& command_table = *(volatile AHCI::CommandTable*)command_table_region->vaddr().as_ptr(); memset(const_cast<u8*>(command_table.command_fis), 0, 64); command_table.descriptors[0].base_high = 0; diff --git a/Kernel/Storage/ATA/AHCIPort.h b/Kernel/Storage/ATA/AHCIPort.h index 0bc5467a95..8f24ae734d 100644 --- a/Kernel/Storage/ATA/AHCIPort.h +++ b/Kernel/Storage/ATA/AHCIPort.h @@ -106,7 +106,7 @@ private: EntropySource m_entropy_source; RefPtr<AsyncBlockDeviceRequest> m_current_request; Spinlock m_hard_lock; - Mutex m_lock { "AHCIPort" }; + Mutex m_lock { "AHCIPort"sv }; mutable bool m_wait_for_completion { false }; diff --git a/Kernel/Storage/ATA/ATADiskDevice.cpp b/Kernel/Storage/ATA/ATADiskDevice.cpp index d0229b7c6c..321719beb9 100644 --- a/Kernel/Storage/ATA/ATADiskDevice.cpp +++ b/Kernel/Storage/ATA/ATADiskDevice.cpp @@ -35,7 +35,7 @@ ATADiskDevice::~ATADiskDevice() = default; StringView ATADiskDevice::class_name() const { - return "ATADiskDevice"; + return "ATADiskDevice"sv; } } diff --git a/Kernel/Storage/ATA/ATAPIDiscDevice.cpp b/Kernel/Storage/ATA/ATAPIDiscDevice.cpp index ac8ee20f94..f696043ecd 100644 --- a/Kernel/Storage/ATA/ATAPIDiscDevice.cpp +++ b/Kernel/Storage/ATA/ATAPIDiscDevice.cpp @@ -35,7 +35,7 @@ ATAPIDiscDevice::~ATAPIDiscDevice() = default; StringView ATAPIDiscDevice::class_name() const { - return "ATAPIDiscDevice"; + return "ATAPIDiscDevice"sv; } } diff --git a/Kernel/Storage/ATA/BMIDEChannel.cpp b/Kernel/Storage/ATA/BMIDEChannel.cpp index e938669a1a..cc29eaaf9f 100644 --- a/Kernel/Storage/ATA/BMIDEChannel.cpp +++ b/Kernel/Storage/ATA/BMIDEChannel.cpp @@ -40,13 +40,13 @@ UNMAP_AFTER_INIT void BMIDEChannel::initialize() VERIFY(m_io_group.bus_master_base().has_value()); // Let's try to set up DMA transfers. { - auto region_or_error = MM.allocate_dma_buffer_page("IDE PRDT", Memory::Region::Access::ReadWrite, m_prdt_page); + auto region_or_error = MM.allocate_dma_buffer_page("IDE PRDT"sv, Memory::Region::Access::ReadWrite, m_prdt_page); if (region_or_error.is_error()) TODO(); m_prdt_region = region_or_error.release_value(); } { - auto region_or_error = MM.allocate_dma_buffer_page("IDE DMA region", Memory::Region::Access::ReadWrite, m_dma_buffer_page); + auto region_or_error = MM.allocate_dma_buffer_page("IDE DMA region"sv, Memory::Region::Access::ReadWrite, m_dma_buffer_page); if (region_or_error.is_error()) TODO(); m_dma_buffer_region = region_or_error.release_value(); diff --git a/Kernel/Storage/ATA/IDEChannel.h b/Kernel/Storage/ATA/IDEChannel.h index 4c9aa03d3e..6d1bf1303a 100644 --- a/Kernel/Storage/ATA/IDEChannel.h +++ b/Kernel/Storage/ATA/IDEChannel.h @@ -158,7 +158,7 @@ protected: u64 m_current_request_block_index { 0 }; bool m_current_request_flushing_cache { false }; Spinlock m_request_lock; - Mutex m_lock { "IDEChannel" }; + Mutex m_lock { "IDEChannel"sv }; IOAddressGroup m_io_group; NonnullRefPtr<IDEController> m_parent_controller; diff --git a/Kernel/Storage/NVMe/NVMeController.cpp b/Kernel/Storage/NVMe/NVMeController.cpp index d1c0fcf2d5..5744dee0f1 100644 --- a/Kernel/Storage/NVMe/NVMeController.cpp +++ b/Kernel/Storage/NVMe/NVMeController.cpp @@ -158,7 +158,7 @@ UNMAP_AFTER_INIT ErrorOr<void> NVMeController::identify_and_init_namespaces() u32 active_namespace_list[NVMe_IDENTIFY_SIZE / sizeof(u32)]; { - auto buffer = TRY(MM.allocate_dma_buffer_page("Identify PRP", Memory::Region::Access::ReadWrite, prp_dma_buffer)); + auto buffer = TRY(MM.allocate_dma_buffer_page("Identify PRP"sv, Memory::Region::Access::ReadWrite, prp_dma_buffer)); prp_dma_region = move(buffer); } @@ -269,7 +269,7 @@ UNMAP_AFTER_INIT ErrorOr<void> NVMeController::create_admin_queue(Optional<u8> i return EFAULT; } { - auto buffer = TRY(MM.allocate_dma_buffer_pages(cq_size, "Admin CQ queue", Memory::Region::Access::ReadWrite, cq_dma_pages)); + auto buffer = TRY(MM.allocate_dma_buffer_pages(cq_size, "Admin CQ queue"sv, Memory::Region::Access::ReadWrite, cq_dma_pages)); cq_dma_region = move(buffer); } @@ -278,7 +278,7 @@ UNMAP_AFTER_INIT ErrorOr<void> NVMeController::create_admin_queue(Optional<u8> i memset(cq_dma_region->vaddr().as_ptr(), 0, cq_size); { - auto buffer = TRY(MM.allocate_dma_buffer_pages(sq_size, "Admin SQ queue", Memory::Region::Access::ReadWrite, sq_dma_pages)); + auto buffer = TRY(MM.allocate_dma_buffer_pages(sq_size, "Admin SQ queue"sv, Memory::Region::Access::ReadWrite, sq_dma_pages)); sq_dma_region = move(buffer); } auto doorbell_regs = TRY(Memory::map_typed_writable<volatile DoorbellRegister>(PhysicalAddress(m_bar + REG_SQ0TDBL_START))); @@ -307,7 +307,7 @@ UNMAP_AFTER_INIT ErrorOr<void> NVMeController::create_io_queue(u8 qid, Optional< auto sq_size = round_up_to_power_of_two(SQ_SIZE(IO_QUEUE_SIZE), 4096); { - auto buffer = TRY(MM.allocate_dma_buffer_pages(cq_size, "IO CQ queue", Memory::Region::Access::ReadWrite, cq_dma_pages)); + auto buffer = TRY(MM.allocate_dma_buffer_pages(cq_size, "IO CQ queue"sv, Memory::Region::Access::ReadWrite, cq_dma_pages)); cq_dma_region = move(buffer); } @@ -316,7 +316,7 @@ UNMAP_AFTER_INIT ErrorOr<void> NVMeController::create_io_queue(u8 qid, Optional< memset(cq_dma_region->vaddr().as_ptr(), 0, cq_size); { - auto buffer = TRY(MM.allocate_dma_buffer_pages(sq_size, "IO SQ queue", Memory::Region::Access::ReadWrite, sq_dma_pages)); + auto buffer = TRY(MM.allocate_dma_buffer_pages(sq_size, "IO SQ queue"sv, Memory::Region::Access::ReadWrite, sq_dma_pages)); sq_dma_region = move(buffer); } diff --git a/Kernel/Storage/Ramdisk/Controller.cpp b/Kernel/Storage/Ramdisk/Controller.cpp index 81f5a079b9..45de8cde44 100644 --- a/Kernel/Storage/Ramdisk/Controller.cpp +++ b/Kernel/Storage/Ramdisk/Controller.cpp @@ -44,7 +44,7 @@ RamdiskController::RamdiskController() for (auto& used_memory_range : MM.used_memory_ranges()) { if (used_memory_range.type == Memory::UsedMemoryRangeType::BootModule) { size_t length = Memory::page_round_up(used_memory_range.end.get()).release_value_but_fixme_should_propagate_errors() - used_memory_range.start.get(); - auto region_or_error = MM.allocate_kernel_region(used_memory_range.start, length, "Ramdisk", Memory::Region::Access::ReadWrite); + auto region_or_error = MM.allocate_kernel_region(used_memory_range.start, length, "Ramdisk"sv, Memory::Region::Access::ReadWrite); if (region_or_error.is_error()) { dmesgln("RamdiskController: Failed to allocate kernel region of size {}", length); } else { diff --git a/Kernel/Storage/Ramdisk/Device.h b/Kernel/Storage/Ramdisk/Device.h index 1747bd4eae..0e4ef6cca9 100644 --- a/Kernel/Storage/Ramdisk/Device.h +++ b/Kernel/Storage/Ramdisk/Device.h @@ -33,7 +33,7 @@ private: // ^StorageDevice virtual CommandSet command_set() const override { return CommandSet::PlainMemory; } - Mutex m_lock { "RamdiskDevice" }; + Mutex m_lock { "RamdiskDevice"sv }; NonnullOwnPtr<Memory::Region> m_region; }; diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp index 0ec380a6ee..428ba887a8 100644 --- a/Kernel/Syscalls/execve.cpp +++ b/Kernel/Syscalls/execve.cpp @@ -173,7 +173,7 @@ static ErrorOr<RequiredLoadRange> get_required_load_range(OpenFileDescription& p size_t executable_size = inode.size(); size_t rounded_executable_size = TRY(Memory::page_round_up(executable_size)); - auto region = TRY(MM.allocate_kernel_region_with_vmobject(*vmobject, rounded_executable_size, "ELF memory range calculation", Memory::Region::Access::Read)); + auto region = TRY(MM.allocate_kernel_region_with_vmobject(*vmobject, rounded_executable_size, "ELF memory range calculation"sv, Memory::Region::Access::Read)); auto elf_image = ELF::Image(region->vaddr().as_ptr(), executable_size); if (!elf_image.is_valid()) { return EINVAL; @@ -269,7 +269,7 @@ static ErrorOr<LoadResult> load_elf_object(NonnullOwnPtr<Memory::AddressSpace> n size_t executable_size = inode.size(); size_t rounded_executable_size = TRY(Memory::page_round_up(executable_size)); - auto executable_region = TRY(MM.allocate_kernel_region_with_vmobject(*vmobject, rounded_executable_size, "ELF loading", Memory::Region::Access::Read)); + auto executable_region = TRY(MM.allocate_kernel_region_with_vmobject(*vmobject, rounded_executable_size, "ELF loading"sv, Memory::Region::Access::Read)); auto elf_image = ELF::Image(executable_region->vaddr().as_ptr(), executable_size); if (!elf_image.is_valid()) @@ -392,7 +392,7 @@ static ErrorOr<LoadResult> load_elf_object(NonnullOwnPtr<Memory::AddressSpace> n return ENOEXEC; } - auto* stack_region = TRY(new_space->allocate_region(Memory::RandomizeVirtualAddress::Yes, {}, Thread::default_userspace_stack_size, PAGE_SIZE, "Stack (Main thread)", PROT_READ | PROT_WRITE, AllocationStrategy::Reserve)); + auto* stack_region = TRY(new_space->allocate_region(Memory::RandomizeVirtualAddress::Yes, {}, Thread::default_userspace_stack_size, PAGE_SIZE, "Stack (Main thread)"sv, PROT_READ | PROT_WRITE, AllocationStrategy::Reserve)); stack_region->set_stack(true); return LoadResult { @@ -488,7 +488,7 @@ ErrorOr<void> Process::do_exec(NonnullRefPtr<OpenFileDescription> main_program_d bool has_interpreter = interpreter_description; interpreter_description = nullptr; - auto* signal_trampoline_region = TRY(load_result.space->allocate_region_with_vmobject(Memory::RandomizeVirtualAddress::Yes, {}, PAGE_SIZE, PAGE_SIZE, g_signal_trampoline_region->vmobject(), 0, "Signal trampoline", PROT_READ | PROT_EXEC, true)); + auto* signal_trampoline_region = TRY(load_result.space->allocate_region_with_vmobject(Memory::RandomizeVirtualAddress::Yes, {}, PAGE_SIZE, PAGE_SIZE, g_signal_trampoline_region->vmobject(), 0, "Signal trampoline"sv, PROT_READ | PROT_EXEC, true)); signal_trampoline_region->set_syscall_region(true); // (For dynamically linked executable) Allocate an FD for passing the main executable to the dynamic loader. diff --git a/Kernel/Syscalls/pledge.cpp b/Kernel/Syscalls/pledge.cpp index 6759801c16..c6b7fc5ec0 100644 --- a/Kernel/Syscalls/pledge.cpp +++ b/Kernel/Syscalls/pledge.cpp @@ -31,7 +31,7 @@ ErrorOr<FlatPtr> Process::sys$pledge(Userspace<Syscall::SC_pledge_params const*> auto found_invalid_pledge = true; pledge_spec.for_each_split_view(' ', false, [&mask, &found_invalid_pledge](auto const& part) { #define __ENUMERATE_PLEDGE_PROMISE(x) \ - if (part == StringView { #x }) { \ + if (part == #x##sv) { \ mask |= (1u << (u32)Pledge::x); \ return; \ } diff --git a/Kernel/TTY/TTY.cpp b/Kernel/TTY/TTY.cpp index c8f0b68999..5f4ea788a7 100644 --- a/Kernel/TTY/TTY.cpp +++ b/Kernel/TTY/TTY.cpp @@ -398,18 +398,18 @@ ErrorOr<void> TTY::set_termios(termios const& t) }; constexpr FlagDescription unimplemented_iflags[] = { - { IGNBRK, "IGNBRK" }, - { BRKINT, "BRKINT" }, - { IGNPAR, "IGNPAR" }, - { PARMRK, "PARMRK" }, - { INPCK, "INPCK" }, - { IGNCR, "IGNCR" }, - { IUCLC, "IUCLC" }, - { IXON, "IXON" }, - { IXANY, "IXANY" }, - { IXOFF, "IXOFF" }, - { IMAXBEL, "IMAXBEL" }, - { IUTF8, "IUTF8" } + { IGNBRK, "IGNBRK"sv }, + { BRKINT, "BRKINT"sv }, + { IGNPAR, "IGNPAR"sv }, + { PARMRK, "PARMRK"sv }, + { INPCK, "INPCK"sv }, + { IGNCR, "IGNCR"sv }, + { IUCLC, "IUCLC"sv }, + { IXON, "IXON"sv }, + { IXANY, "IXANY"sv }, + { IXOFF, "IXOFF"sv }, + { IMAXBEL, "IMAXBEL"sv }, + { IUTF8, "IUTF8"sv } }; for (auto flag : unimplemented_iflags) { if (m_termios.c_iflag & flag.value) { @@ -419,11 +419,11 @@ ErrorOr<void> TTY::set_termios(termios const& t) } constexpr FlagDescription unimplemented_oflags[] = { - { OLCUC, "OLCUC" }, - { ONOCR, "ONOCR" }, - { ONLRET, "ONLRET" }, - { OFILL, "OFILL" }, - { OFDEL, "OFDEL" } + { OLCUC, "OLCUC"sv }, + { ONOCR, "ONOCR"sv }, + { ONLRET, "ONLRET"sv }, + { OFILL, "OFILL"sv }, + { OFDEL, "OFDEL"sv } }; for (auto flag : unimplemented_oflags) { if (m_termios.c_oflag & flag.value) { @@ -438,12 +438,12 @@ ErrorOr<void> TTY::set_termios(termios const& t) } constexpr FlagDescription unimplemented_cflags[] = { - { CSTOPB, "CSTOPB" }, - { CREAD, "CREAD" }, - { PARENB, "PARENB" }, - { PARODD, "PARODD" }, - { HUPCL, "HUPCL" }, - { CLOCAL, "CLOCAL" } + { CSTOPB, "CSTOPB"sv }, + { CREAD, "CREAD"sv }, + { PARENB, "PARENB"sv }, + { PARODD, "PARODD"sv }, + { HUPCL, "HUPCL"sv }, + { CLOCAL, "CLOCAL"sv } }; for (auto flag : unimplemented_cflags) { if (m_termios.c_cflag & flag.value) { @@ -453,8 +453,8 @@ ErrorOr<void> TTY::set_termios(termios const& t) } constexpr FlagDescription unimplemented_lflags[] = { - { TOSTOP, "TOSTOP" }, - { IEXTEN, "IEXTEN" } + { TOSTOP, "TOSTOP"sv }, + { IEXTEN, "IEXTEN"sv } }; for (auto flag : unimplemented_lflags) { if (m_termios.c_lflag & flag.value) { diff --git a/Kernel/TTY/VirtualConsole.cpp b/Kernel/TTY/VirtualConsole.cpp index fb39f196fd..16986626fd 100644 --- a/Kernel/TTY/VirtualConsole.cpp +++ b/Kernel/TTY/VirtualConsole.cpp @@ -135,7 +135,7 @@ UNMAP_AFTER_INIT void VirtualConsole::initialize() // Allocate twice of the max row * max column * sizeof(Cell) to ensure we can have some sort of history mechanism... auto size = GraphicsManagement::the().console()->max_column() * GraphicsManagement::the().console()->max_row() * sizeof(Cell) * 2; - m_cells = MM.allocate_kernel_region(Memory::page_round_up(size).release_value_but_fixme_should_propagate_errors(), "Virtual Console Cells", Memory::Region::Access::ReadWrite, AllocationStrategy::AllocateNow).release_value(); + m_cells = MM.allocate_kernel_region(Memory::page_round_up(size).release_value_but_fixme_should_propagate_errors(), "Virtual Console Cells"sv, Memory::Region::Access::ReadWrite, AllocationStrategy::AllocateNow).release_value(); // Add the lines, so we also ensure they will be flushed now for (size_t row = 0; row < rows(); row++) { @@ -154,7 +154,7 @@ void VirtualConsole::refresh_after_resolution_change() // Note: From now on, columns() and rows() are updated with the new settings. auto size = GraphicsManagement::the().console()->max_column() * GraphicsManagement::the().console()->max_row() * sizeof(Cell) * 2; - auto new_cells = MM.allocate_kernel_region(Memory::page_round_up(size).release_value_but_fixme_should_propagate_errors(), "Virtual Console Cells", Memory::Region::Access::ReadWrite, AllocationStrategy::AllocateNow).release_value(); + auto new_cells = MM.allocate_kernel_region(Memory::page_round_up(size).release_value_but_fixme_should_propagate_errors(), "Virtual Console Cells"sv, Memory::Region::Access::ReadWrite, AllocationStrategy::AllocateNow).release_value(); if (rows() < old_rows_count) { m_lines.shrink(rows()); diff --git a/Kernel/Tasks/SyncTask.cpp b/Kernel/Tasks/SyncTask.cpp index 19fa77c4a9..d895df2c0b 100644 --- a/Kernel/Tasks/SyncTask.cpp +++ b/Kernel/Tasks/SyncTask.cpp @@ -15,7 +15,7 @@ namespace Kernel { UNMAP_AFTER_INIT void SyncTask::spawn() { RefPtr<Thread> syncd_thread; - (void)Process::create_kernel_process(syncd_thread, KString::must_create("VFS Sync Task"), [] { + (void)Process::create_kernel_process(syncd_thread, KString::must_create("VFS Sync Task"sv), [] { dbgln("VFS SyncTask is running"); for (;;) { VirtualFileSystem::sync(); diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index 2d84d761af..1ab509f01d 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -1359,7 +1359,7 @@ static ErrorOr<bool> symbolicate(RecognizedSymbol const& symbol, Process& proces bool mask_kernel_addresses = !process.is_superuser(); if (!symbol.symbol) { if (!Memory::is_user_address(VirtualAddress(symbol.address))) { - TRY(builder.try_append("0xdeadc0de\n")); + TRY(builder.try_append("0xdeadc0de\n"sv)); } else { if (auto* region = process.address_space().find_region_containing({ VirtualAddress(symbol.address), sizeof(FlatPtr) })) { size_t offset = symbol.address - region->vaddr().get(); @@ -1421,7 +1421,7 @@ ErrorOr<void> Thread::make_thread_specific_region(Badge<Process>) if (!process().m_master_tls_region) return {}; - auto* region = TRY(process().address_space().allocate_region(Memory::RandomizeVirtualAddress::Yes, {}, thread_specific_region_size(), PAGE_SIZE, "Thread-specific", PROT_READ | PROT_WRITE)); + auto* region = TRY(process().address_space().allocate_region(Memory::RandomizeVirtualAddress::Yes, {}, thread_specific_region_size(), PAGE_SIZE, "Thread-specific"sv, PROT_READ | PROT_WRITE)); m_thread_specific_range = region->range(); @@ -1511,5 +1511,5 @@ ErrorOr<void> AK::Formatter<Kernel::Thread>::format(FormatBuilder& builder, Kern { return AK::Formatter<FormatString>::format( builder, - "{}({}:{})", value.process().name(), value.pid().value(), value.tid().value()); + "{}({}:{})"sv, value.process().name(), value.pid().value(), value.tid().value()); } diff --git a/Kernel/Time/HPET.cpp b/Kernel/Time/HPET.cpp index 8493e40bb1..18c33811fa 100644 --- a/Kernel/Time/HPET.cpp +++ b/Kernel/Time/HPET.cpp @@ -127,7 +127,7 @@ UNMAP_AFTER_INIT bool HPET::test_and_initialize() { VERIFY(!HPET::initialized()); hpet_initialized = true; - auto hpet_table = ACPI::Parser::the()->find_table("HPET"); + auto hpet_table = ACPI::Parser::the()->find_table("HPET"sv); if (!hpet_table.has_value()) return false; dmesgln("HPET @ {}", hpet_table.value()); @@ -153,7 +153,7 @@ UNMAP_AFTER_INIT bool HPET::test_and_initialize() UNMAP_AFTER_INIT bool HPET::check_for_exisiting_periodic_timers() { - auto hpet_table = ACPI::Parser::the()->find_table("HPET"); + auto hpet_table = ACPI::Parser::the()->find_table("HPET"sv); if (!hpet_table.has_value()) return false; @@ -431,7 +431,7 @@ u64 HPET::ns_to_raw_counter_ticks(u64 ns) const UNMAP_AFTER_INIT HPET::HPET(PhysicalAddress acpi_hpet) : m_physical_acpi_hpet_table(acpi_hpet) , m_physical_acpi_hpet_registers(find_acpi_hpet_registers_block()) - , m_hpet_mmio_region(MM.allocate_kernel_region(m_physical_acpi_hpet_registers.page_base(), PAGE_SIZE, "HPET MMIO", Memory::Region::Access::ReadWrite).release_value()) + , m_hpet_mmio_region(MM.allocate_kernel_region(m_physical_acpi_hpet_registers.page_base(), PAGE_SIZE, "HPET MMIO"sv, Memory::Region::Access::ReadWrite).release_value()) { s_hpet = this; // Make available as soon as possible so that IRQs can use it diff --git a/Kernel/UBSanitizer.cpp b/Kernel/UBSanitizer.cpp index 3cc6292723..5d714bcaea 100644 --- a/Kernel/UBSanitizer.cpp +++ b/Kernel/UBSanitizer.cpp @@ -127,18 +127,18 @@ void __ubsan_handle_type_mismatch_v1(TypeMismatchData const&, ValueHandle) __att void __ubsan_handle_type_mismatch_v1(TypeMismatchData const& data, ValueHandle ptr) { constexpr StringView kinds[] = { - "load of", - "store to", - "reference binding to", - "member access within", - "member call on", - "constructor call on", - "downcast of", - "downcast of", - "upcast of", - "cast to virtual base of", - "_Nonnull binding to", - "dynamic operation on" + "load of"sv, + "store to"sv, + "reference binding to"sv, + "member access within"sv, + "member call on"sv, + "constructor call on"sv, + "downcast of"sv, + "downcast of"sv, + "upcast of"sv, + "cast to virtual base of"sv, + "_Nonnull binding to"sv, + "dynamic operation on"sv }; FlatPtr alignment = (FlatPtr)1 << data.log_alignment; diff --git a/Kernel/VirtualAddress.h b/Kernel/VirtualAddress.h index 82ba5a88ef..52817266cd 100644 --- a/Kernel/VirtualAddress.h +++ b/Kernel/VirtualAddress.h @@ -56,6 +56,6 @@ template<> struct AK::Formatter<VirtualAddress> : AK::Formatter<FormatString> { ErrorOr<void> format(FormatBuilder& builder, VirtualAddress const& value) { - return AK::Formatter<FormatString>::format(builder, "V{}", value.as_ptr()); + return AK::Formatter<FormatString>::format(builder, "V{}"sv, value.as_ptr()); } }; diff --git a/Kernel/WorkQueue.cpp b/Kernel/WorkQueue.cpp index 77978ff5ba..a96882e631 100644 --- a/Kernel/WorkQueue.cpp +++ b/Kernel/WorkQueue.cpp @@ -16,7 +16,7 @@ WorkQueue* g_io_work; UNMAP_AFTER_INIT void WorkQueue::initialize() { - g_io_work = new WorkQueue("IO WorkQueue Task"); + g_io_work = new WorkQueue("IO WorkQueue Task"sv); } UNMAP_AFTER_INIT WorkQueue::WorkQueue(StringView name) diff --git a/Kernel/init.cpp b/Kernel/init.cpp index bad8511cf0..e47255e837 100644 --- a/Kernel/init.cpp +++ b/Kernel/init.cpp @@ -252,7 +252,7 @@ extern "C" [[noreturn]] UNMAP_AFTER_INIT void init(BootInfo const& boot_info) { RefPtr<Thread> init_stage2_thread; - (void)Process::create_kernel_process(init_stage2_thread, KString::must_create("init_stage2"), init_stage2, nullptr, THREAD_AFFINITY_DEFAULT, Process::RegisterProcess::No); + (void)Process::create_kernel_process(init_stage2_thread, KString::must_create("init_stage2"sv), init_stage2, nullptr, THREAD_AFFINITY_DEFAULT, Process::RegisterProcess::No); // We need to make sure we drop the reference for init_stage2_thread // before calling into Scheduler::start, otherwise we will have a // dangling Thread that never gets cleaned up |