diff --git a/Kernel/Devices/Device.cpp b/Kernel/Devices/Device.cpp index c768eb7308..77b951e89c 100644 --- a/Kernel/Devices/Device.cpp +++ b/Kernel/Devices/Device.cpp @@ -72,7 +72,7 @@ Device::~Device() String Device::absolute_path() const { - return String::format("device:%u,%u (%s)", m_major, m_minor, class_name()); + return String::formatted("device:{},{} ({})", m_major, m_minor, class_name()); } String Device::absolute_path(const FileDescription&) const diff --git a/Kernel/Devices/PS2MouseDevice.cpp b/Kernel/Devices/PS2MouseDevice.cpp index 159cb9b35b..ee53c540a6 100644 --- a/Kernel/Devices/PS2MouseDevice.cpp +++ b/Kernel/Devices/PS2MouseDevice.cpp @@ -181,8 +181,8 @@ MousePacket PS2MouseDevice::parse_data_packet(const RawPacket& raw_packet) packet.is_relative = true; #ifdef PS2MOUSE_DEBUG - dbg() << "PS2 Relative Mouse: Buttons " << String::format("%x", packet.buttons); - dbg() << "Mouse: X " << packet.x << ", Y " << packet.y << ", Z " << packet.z; + dbgln("PS2 Relative Mouse: Buttons {:x}", packet.buttons); + dbgln("Mouse: X {}, Y {}, Z {}", packet.x, packet.y, packet.z); #endif return packet; } @@ -282,8 +282,8 @@ KResultOr PS2MouseDevice::read(FileDescription&, size_t, UserOrKernelBuf lock.unlock(); #ifdef PS2MOUSE_DEBUG - dbg() << "PS2 Mouse Read: Buttons " << String::format("%x", packet.buttons); - dbg() << "PS2 Mouse: X " << packet.x << ", Y " << packet.y << ", Z " << packet.z << " Relative " << packet.buttons; + dbgln("PS2 Mouse Read: Buttons {:x}", packet.buttons); + dbgln("PS2 Mouse: X {}, Y {}, Z {}, Relative {}", packet.x, packet.y, packet.z, packet.buttons); dbgln("PS2 Mouse Read: Filter packets"); #endif size_t bytes_read_from_packet = min(remaining_space_in_buffer, sizeof(MousePacket)); diff --git a/Kernel/FileSystem/DevFS.cpp b/Kernel/FileSystem/DevFS.cpp index 84e7176b4b..123f5e45c8 100644 --- a/Kernel/FileSystem/DevFS.cpp +++ b/Kernel/FileSystem/DevFS.cpp @@ -394,8 +394,8 @@ String DevFSDeviceInode::determine_name() const case 4: if (m_attached_device->minor() >= 64) - return String::format("ttyS%d", m_attached_device->minor() - 64); - return String::format("tty%d", m_attached_device->minor()); + return String::formatted("ttyS{}", m_attached_device->minor() - 64); + return String::formatted("tty{}", m_attached_device->minor()); default: ASSERT_NOT_REACHED(); @@ -403,7 +403,7 @@ String DevFSDeviceInode::determine_name() const } else { switch (m_attached_device->major()) { case 29: - return String::format("fb%d", m_attached_device->minor()); + return String::formatted("fb{}", m_attached_device->minor()); case 3: { size_t drive_index = (u8)'a' + m_attached_device->minor(); char drive_letter = (u8)drive_index; @@ -414,7 +414,7 @@ String DevFSDeviceInode::determine_name() const // FIXME: Try to not hardcode a maximum of 16 partitions per drive! size_t drive_index = (u8)'a' + (m_attached_device->minor() / 16); char drive_letter = (u8)drive_index; - return String::format("hd%c%d", drive_letter, m_attached_device->minor() + 1); + return String::formatted("hd{:c}{}", drive_letter, m_attached_device->minor() + 1); } } diff --git a/Kernel/FileSystem/InodeIdentifier.h b/Kernel/FileSystem/InodeIdentifier.h index 0522e70bc1..d7a44316a1 100644 --- a/Kernel/FileSystem/InodeIdentifier.h +++ b/Kernel/FileSystem/InodeIdentifier.h @@ -62,7 +62,7 @@ public: return m_fsid != other.m_fsid || m_index != other.m_index; } - String to_string() const { return String::format("%u:%u", m_fsid, m_index); } + String to_string() const { return String::formatted("{}:{}", m_fsid, m_index); } private: u32 m_fsid { 0 }; diff --git a/Kernel/FileSystem/InodeWatcher.cpp b/Kernel/FileSystem/InodeWatcher.cpp index df03df8845..09580bbaff 100644 --- a/Kernel/FileSystem/InodeWatcher.cpp +++ b/Kernel/FileSystem/InodeWatcher.cpp @@ -90,7 +90,7 @@ KResultOr InodeWatcher::write(FileDescription&, size_t, const UserOrKern String InodeWatcher::absolute_path(const FileDescription&) const { if (auto inode = m_inode.strong_ref()) - return String::format("InodeWatcher:%s", inode->identifier().to_string().characters()); + return String::formatted("InodeWatcher:{}", inode->identifier().to_string()); return "InodeWatcher:(gone)"; } diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index ed085ed0ef..c5aa834fb8 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -130,9 +130,6 @@ enum ProcFileType { static inline ProcessID to_pid(const InodeIdentifier& identifier) { -#ifdef PROCFS_DEBUG - dbg() << "to_pid, index=" << String::format("%08x", identifier.index()) << " -> " << (identifier.index() >> 16); -#endif return identifier.index() >> 16u; } @@ -800,9 +797,9 @@ static bool procfs$memstat(InodeIdentifier, KBufferBuilder& builder) json.add("kmalloc_call_count", stats.kmalloc_call_count); json.add("kfree_call_count", stats.kfree_call_count); slab_alloc_stats([&json](size_t slab_size, size_t num_allocated, size_t num_free) { - auto prefix = String::format("slab_%zu", slab_size); - json.add(String::format("%s_num_allocated", prefix.characters()), num_allocated); - json.add(String::format("%s_num_free", prefix.characters()), num_free); + auto prefix = String::formatted("slab_{}", slab_size); + json.add(String::formatted("{}_num_allocated", prefix), num_allocated); + json.add(String::formatted("{}_num_free", prefix), num_free); }); json.finish(); return true; @@ -1264,10 +1261,6 @@ InodeMetadata ProcFSInode::metadata() const metadata.mode &= ~077; } } - -#ifdef PROCFS_DEBUG - dbg() << "Returning mode " << String::format("%o", metadata.mode); -#endif return metadata; } diff --git a/Kernel/IO.h b/Kernel/IO.h index f6d971371b..41a8df2f33 100644 --- a/Kernel/IO.h +++ b/Kernel/IO.h @@ -174,7 +174,7 @@ private: inline const LogStream& operator<<(const LogStream& stream, IOAddress value) { - return stream << "IO " << String::format("%x", value.get()); + return stream << "IO " << String::formatted("{:x}", value.get()); } template<> diff --git a/Kernel/TTY/MasterPTY.cpp b/Kernel/TTY/MasterPTY.cpp index 9ac4ba2290..eca9f4c2fa 100644 --- a/Kernel/TTY/MasterPTY.cpp +++ b/Kernel/TTY/MasterPTY.cpp @@ -41,7 +41,7 @@ MasterPTY::MasterPTY(unsigned index) , m_slave(adopt(*new SlavePTY(*this, index))) , m_index(index) { - m_pts_name = String::format("/dev/pts/%u", m_index); + m_pts_name = String::formatted("/dev/pts/{}", m_index); auto process = Process::current(); set_uid(process->uid()); set_gid(process->gid()); @@ -143,7 +143,7 @@ int MasterPTY::ioctl(FileDescription& description, unsigned request, FlatPtr arg String MasterPTY::absolute_path(const FileDescription&) const { - return String::format("ptm:%s", m_pts_name.characters()); + return String::formatted("ptm:{}", m_pts_name); } } diff --git a/Kernel/TTY/VirtualConsole.cpp b/Kernel/TTY/VirtualConsole.cpp index 961ee9f8c2..4f87c49fd5 100644 --- a/Kernel/TTY/VirtualConsole.cpp +++ b/Kernel/TTY/VirtualConsole.cpp @@ -70,7 +70,7 @@ VirtualConsole::VirtualConsole(const unsigned index) { ASSERT(index < s_max_virtual_consoles); - m_tty_name = String::format("/dev/tty%u", m_index); + m_tty_name = String::formatted("/dev/tty{}", m_index); m_terminal.set_size(80, 25); s_consoles[index] = this; diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index bf5922db44..17849bd191 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -91,7 +91,7 @@ Thread::Thread(NonnullRefPtr process) m_tss.cr3 = m_process->page_directory().cr3(); - m_kernel_stack_region = MM.allocate_kernel_region(default_kernel_stack_size, String::format("Kernel Stack (Thread %d)", m_tid.value()), Region::Access::Read | Region::Access::Write, false, AllocationStrategy::AllocateNow); + m_kernel_stack_region = MM.allocate_kernel_region(default_kernel_stack_size, String::formatted("Kernel Stack (Thread {})", m_tid.value()), Region::Access::Read | Region::Access::Write, false, AllocationStrategy::AllocateNow); if (!m_kernel_stack_region) { // Abort creating this thread, was_created() will return false return; diff --git a/Kernel/Time/PIT.cpp b/Kernel/Time/PIT.cpp index 3234a5cf53..df3af8167b 100644 --- a/Kernel/Time/PIT.cpp +++ b/Kernel/Time/PIT.cpp @@ -53,7 +53,7 @@ PIT::PIT(Function callback) { IO::out8(PIT_CTL, TIMER0_SELECT | WRITE_WORD | MODE_SQUARE_WAVE); - klog() << "PIT: " << OPTIMAL_TICKS_PER_SECOND_RATE << " Hz, square wave (" << String::format("%x", BASE_FREQUENCY / OPTIMAL_TICKS_PER_SECOND_RATE) << ")"; + klog() << "PIT: " << OPTIMAL_TICKS_PER_SECOND_RATE << " Hz, square wave (" << String::formatted("{:x}", BASE_FREQUENCY / OPTIMAL_TICKS_PER_SECOND_RATE) << ")"; reset_to_default_ticks_per_second(); enable_irq(); } diff --git a/Kernel/VM/PhysicalPage.cpp b/Kernel/VM/PhysicalPage.cpp index 0a7818c7b5..50cbda1669 100644 --- a/Kernel/VM/PhysicalPage.cpp +++ b/Kernel/VM/PhysicalPage.cpp @@ -52,7 +52,7 @@ void PhysicalPage::return_to_freelist() const MM.deallocate_user_physical_page(*this); #ifdef MM_DEBUG - dbg() << "MM: P" << String::format("%x", m_paddr.get()) << " released to freelist"; + dbgln("MM: {} released to freelist", m_paddr); #endif } diff --git a/Kernel/VM/RangeAllocator.h b/Kernel/VM/RangeAllocator.h index 964139c475..89292ef3e6 100644 --- a/Kernel/VM/RangeAllocator.h +++ b/Kernel/VM/RangeAllocator.h @@ -107,7 +107,7 @@ private: inline const LogStream& operator<<(const LogStream& stream, const Range& value) { - return stream << String::format("Range(%x-%x)", value.base().get(), value.end().get() - 1); + return stream << String::formatted("Range({:08x}-{:08x})", value.base().get(), value.end().get() - 1); } } diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp index 119e02c8f4..215b3c05d4 100644 --- a/Kernel/VM/Region.cpp +++ b/Kernel/VM/Region.cpp @@ -382,10 +382,6 @@ void Region::unmap(ShouldDeallocateVirtualMemoryRange deallocate_range) for (size_t i = 0; i < count; ++i) { auto vaddr = vaddr_from_page_index(i); MM.release_pte(*m_page_directory, vaddr, i == count - 1); -#ifdef MM_DEBUG - auto* page = physical_page(i); - dbg() << "MM: >> Unmapped " << vaddr << " => P" << String::format("%p", (void*)(page ? page->paddr().get() : 0)) << " <<"; -#endif } MM.flush_tlb(m_page_directory, vaddr(), page_count()); if (deallocate_range == ShouldDeallocateVirtualMemoryRange::Yes) {