Explorar el Código

Everywhere: Replace a bundle of dbg with dbgln.

These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.Everything:
asynts hace 4 años
padre
commit
5931758dbc

+ 1 - 1
Kernel/Net/LoopbackAdapter.cpp

@@ -49,7 +49,7 @@ LoopbackAdapter::~LoopbackAdapter()
 
 void LoopbackAdapter::send_raw(ReadonlyBytes payload)
 {
-    dbg() << "LoopbackAdapter: Sending " << payload.size() << " byte(s) to myself.";
+    dbgln("LoopbackAdapter: Sending {} byte(s) to myself.", payload.size());
     did_receive(payload);
 }
 

+ 2 - 2
Kernel/Net/Socket.cpp

@@ -149,7 +149,7 @@ KResult Socket::setsockopt(int level, int option, Userspace<const void*> user_va
         }
         return KSuccess;
     default:
-        dbg() << "setsockopt(" << option << ") at SOL_SOCKET not implemented.";
+        dbgln("setsockopt({}) at SOL_SOCKET not implemented.", option);
         return KResult(-ENOPROTOOPT);
     }
 }
@@ -226,7 +226,7 @@ KResult Socket::getsockopt(FileDescription&, int level, int option, Userspace<vo
             return KResult(-EFAULT);
         return KSuccess;
     default:
-        dbg() << "getsockopt(" << option << ") at SOL_SOCKET not implemented.";
+        dbgln("setsockopt({}) at SOL_SOCKET not implemented.", option);
         return KResult(-ENOPROTOOPT);
     }
 }

+ 1 - 1
Kernel/Net/TCPSocket.cpp

@@ -465,7 +465,7 @@ void TCPSocket::shut_down_for_writing()
         [[maybe_unused]] auto rc = send_tcp_packet(TCPFlags::FIN | TCPFlags::ACK);
         set_state(State::FinWait1);
     } else {
-        dbg() << " Shutting down TCPSocket for writing but not moving to FinWait1 since state is " << to_string(state());
+        dbgln(" Shutting down TCPSocket for writing but not moving to FinWait1 since state is {}", to_string(state()));
     }
 }
 

+ 2 - 2
Kernel/Storage/IDEChannel.cpp

@@ -272,7 +272,7 @@ void IDEChannel::handle_irq(const RegisterState&)
         // trigger page faults
         Processor::deferred_call_queue([this]() {
             if (m_current_request->request_type() == AsyncBlockDeviceRequest::Read) {
-                dbg() << "IDEChannel: Read block " << m_current_request_block_index << "/" << m_current_request->block_count();
+                dbgln("IDEChannel: Read block {}/{}", m_current_request_block_index, m_current_request->block_count());
                 if (ata_do_read_sector()) {
                     if (++m_current_request_block_index >= m_current_request->block_count()) {
                         complete_current_request(AsyncDeviceRequest::Success);
@@ -283,7 +283,7 @@ void IDEChannel::handle_irq(const RegisterState&)
                 }
             } else {
                 if (!m_current_request_flushing_cache) {
-                    dbg() << "IDEChannel: Wrote block " << m_current_request_block_index << "/" << m_current_request->block_count();
+                    dbgln("IDEChannel: Wrote block {}/{}", m_current_request_block_index, m_current_request->block_count());
                     if (++m_current_request_block_index >= m_current_request->block_count()) {
                         // We read the last block, flush cache
                         ASSERT(!m_current_request_flushing_cache);

+ 1 - 1
Kernel/Storage/Partition/GUIDPartitionTable.cpp

@@ -133,7 +133,7 @@ bool GUIDPartitionTable::initialize()
         Array<u8, 16> unique_guid {};
         unique_guid.span().overwrite(0, entry.unique_guid, unique_guid.size());
         String name = entry.partition_name;
-        dbg() << "Detected GPT partition (entry " << entry_index << ") , offset " << entry.first_lba << " , limit " << entry.last_lba;
+        dbgln("Detected GPT partition (entry={}), offset={}, limit={}", entry_index, entry.first_lba, entry.last_lba);
         m_partitions.append({ entry.first_lba, entry.last_lba, partition_type, unique_guid, entry.attributes, "" });
         raw_byte_index += header().partition_entry_size;
     }

+ 7 - 7
Kernel/Syscalls/module.cpp

@@ -86,17 +86,17 @@ int Process::sys$module_load(Userspace<const char*> user_path, size_t path_lengt
             switch (relocation.type()) {
             case R_386_PC32: {
                 // PC-relative relocation
-                dbg() << "PC-relative relocation: " << relocation.symbol().name();
+                dbgln("PC-relative relocation: {}", relocation.symbol().name());
                 u32 symbol_address = address_for_kernel_symbol(relocation.symbol().name());
                 if (symbol_address == 0)
                     missing_symbols = true;
-                dbg() << "   Symbol address: " << (void*)symbol_address;
+                dbgln("   Symbol address: {:p}", symbol_address);
                 ptrdiff_t relative_offset = (char*)symbol_address - ((char*)&patch_ptr + 4);
                 patch_ptr = relative_offset;
                 break;
             }
             case R_386_32: // Absolute relocation
-                dbg() << "Absolute relocation: '" << relocation.symbol().name() << "' value:" << relocation.symbol().value() << ", index:" << relocation.symbol_index();
+                dbgln("Absolute relocation: '{}' value={}, index={}", relocation.symbol().name(), relocation.symbol().value(), relocation.symbol_index());
 
                 if (relocation.symbol().bind() == STB_LOCAL) {
                     auto* section_storage_containing_symbol = section_storage_by_name.get(relocation.symbol().section().name()).value_or(nullptr);
@@ -104,13 +104,13 @@ int Process::sys$module_load(Userspace<const char*> user_path, size_t path_lengt
                     u32 symbol_address = (ptrdiff_t)(section_storage_containing_symbol + relocation.symbol().value());
                     if (symbol_address == 0)
                         missing_symbols = true;
-                    dbg() << "   Symbol address: " << (void*)symbol_address;
+                    dbgln("   Symbol address: {:p}", symbol_address);
                     patch_ptr += symbol_address;
                 } else if (relocation.symbol().bind() == STB_GLOBAL) {
                     u32 symbol_address = address_for_kernel_symbol(relocation.symbol().name());
                     if (symbol_address == 0)
                         missing_symbols = true;
-                    dbg() << "   Symbol address: " << (void*)symbol_address;
+                    dbgln("   Symbol address: {:p}", symbol_address);
                     patch_ptr += symbol_address;
                 } else {
                     ASSERT_NOT_REACHED();
@@ -133,7 +133,7 @@ int Process::sys$module_load(Userspace<const char*> user_path, size_t path_lengt
     }
 
     elf_image->for_each_symbol([&](const ELF::Image::Symbol& symbol) {
-        dbg() << " - " << symbol.type() << " '" << symbol.name() << "' @ " << (void*)symbol.value() << ", size=" << symbol.size();
+        dbgln(" - {} '{}' @ {:p}, size={}", symbol.type(), symbol.name(), symbol.value(), symbol.size());
         if (symbol.name() == "module_init") {
             module->module_init = (ModuleInitPtr)(text_base + symbol.value());
         } else if (symbol.name() == "module_fini") {
@@ -150,7 +150,7 @@ int Process::sys$module_load(Userspace<const char*> user_path, size_t path_lengt
         return -EINVAL;
 
     if (g_modules->contains(module->name)) {
-        dbg() << "a module with the name " << module->name << " is already loaded; please unload it first";
+        dbgln("a module with the name {} is already loaded; please unload it first", module->name);
         return -EEXIST;
     }
 

+ 6 - 6
Kernel/Syscalls/mount.cpp

@@ -57,9 +57,9 @@ int Process::sys$mount(Userspace<const Syscall::SC_mount_params*> user_params)
 
     auto description = file_description(source_fd);
     if (!description.is_null())
-        dbg() << "mount " << fs_type << ": source fd " << source_fd << " @ " << target;
+        dbgln("mount {}: source fd {} @ {}", fs_type, source_fd, target);
     else
-        dbg() << "mount " << fs_type << " @ " << target;
+        dbgln("mount {} @ {}", fs_type, target);
 
     auto custody_or_error = VFS::the().resolve_path(target, current_directory());
     if (custody_or_error.is_error())
@@ -93,7 +93,7 @@ int Process::sys$mount(Userspace<const Syscall::SC_mount_params*> user_params)
             return -ENODEV;
         }
 
-        dbg() << "mount: attempting to mount " << description->absolute_path() << " on " << target;
+        dbgln("mount: attempting to mount {} on {}", description->absolute_path(), target);
 
         fs = Ext2FS::create(*description);
     } else if (fs_type == "9p" || fs_type == "Plan9FS") {
@@ -114,15 +114,15 @@ int Process::sys$mount(Userspace<const Syscall::SC_mount_params*> user_params)
     }
 
     if (!fs->initialize()) {
-        dbg() << "mount: failed to initialize " << fs_type << " filesystem, fd - " << source_fd;
+        dbgln("mount: failed to initialize {} filesystem, fd={}", fs_type, source_fd);
         return -ENODEV;
     }
 
     auto result = VFS::the().mount(fs.release_nonnull(), target_custody, params.flags);
     if (!description.is_null())
-        dbg() << "mount: successfully mounted " << description->absolute_path() << " on " << target;
+        dbgln("mount: successfully mounted {} on {}", description->absolute_path(), target);
     else
-        dbg() << "mount: successfully mounted " << target;
+        dbgln("mount: successfully mounted {}", target);
     return result;
 }