mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:17:35 +00:00
Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
This commit is contained in:
parent
e5f09ea170
commit
3f3f45580a
762 changed files with 8315 additions and 8316 deletions
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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)));
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue