summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2021-01-10 15:17:54 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-11 11:55:47 +0100
commitdca6f1f49b30b462d37440092e50a1a381b7cd2a (patch)
tree0822c3c3edaaf626a3f6a7e6e16c81df1a06aaa0
parent872f2a3b90852c5211e68e7c73f871585576a3f8 (diff)
downloadserenity-dca6f1f49b30b462d37440092e50a1a381b7cd2a.zip
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:
-rw-r--r--Kernel/FileSystem/Inode.cpp2
-rw-r--r--Kernel/FileSystem/InodeIdentifier.h8
-rw-r--r--Kernel/FileSystem/Plan9FileSystem.cpp11
-rw-r--r--Kernel/FileSystem/ProcFS.cpp2
-rw-r--r--Kernel/FileSystem/VirtualFileSystem.cpp36
-rw-r--r--Kernel/Heap/kmalloc.cpp2
-rw-r--r--Kernel/Interrupts/InterruptManagement.cpp18
-rw-r--r--Kernel/Interrupts/UnhandledInterruptHandler.cpp4
-rw-r--r--Kernel/Net/IPv4Socket.cpp8
9 files changed, 53 insertions, 38 deletions
diff --git a/Kernel/FileSystem/Inode.cpp b/Kernel/FileSystem/Inode.cpp
index ada6a7ae86..f74598ea41 100644
--- a/Kernel/FileSystem/Inode.cpp
+++ b/Kernel/FileSystem/Inode.cpp
@@ -268,7 +268,7 @@ KResult Inode::prepare_to_write_data()
return KResult(-EROFS);
auto metadata = this->metadata();
if (metadata.is_setuid() || metadata.is_setgid()) {
- dbg() << "Inode::prepare_to_write_data(): Stripping SUID/SGID bits from " << identifier();
+ dbgln("Inode::prepare_to_write_data(): Stripping SUID/SGID bits from {}", identifier());
return chmod(metadata.mode & ~(04000 | 02000));
}
return KSuccess;
diff --git a/Kernel/FileSystem/InodeIdentifier.h b/Kernel/FileSystem/InodeIdentifier.h
index 4c6dba79e5..0522e70bc1 100644
--- a/Kernel/FileSystem/InodeIdentifier.h
+++ b/Kernel/FileSystem/InodeIdentifier.h
@@ -76,3 +76,11 @@ inline const LogStream& operator<<(const LogStream& stream, const InodeIdentifie
}
}
+
+template<>
+struct AK::Formatter<Kernel::InodeIdentifier> : AK::Formatter<FormatString> {
+ void format(FormatBuilder& builder, Kernel::InodeIdentifier value)
+ {
+ return AK::Formatter<FormatString>::format(builder, "{}:{}", value.fsid(), value.index());
+ }
+};
diff --git a/Kernel/FileSystem/Plan9FileSystem.cpp b/Kernel/FileSystem/Plan9FileSystem.cpp
index 2bbc2256a5..e466847524 100644
--- a/Kernel/FileSystem/Plan9FileSystem.cpp
+++ b/Kernel/FileSystem/Plan9FileSystem.cpp
@@ -229,7 +229,7 @@ bool Plan9FS::initialize()
u32 msize;
StringView remote_protocol_version;
version_message >> msize >> remote_protocol_version;
- dbg() << "Remote supports msize=" << msize << " and protocol version " << remote_protocol_version;
+ dbgln("Remote supports msize={} and protocol version {}", msize, remote_protocol_version);
m_remote_protocol_version = parse_protocol_version(remote_protocol_version);
m_max_message_size = min(m_max_message_size, (size_t)msize);
@@ -602,7 +602,7 @@ KResult Plan9FS::read_and_dispatch_one_message()
m_completions.remove(header.tag);
m_completion_blocker.unblock_completed(header.tag);
} else {
- dbg() << "Received a 9p message of type " << header.type << " with an unexpected tag " << header.tag << ", dropping";
+ dbgln("Received a 9p message of type {} with an unexpected tag {}, dropping", header.type, header.tag);
}
return KSuccess;
@@ -625,7 +625,7 @@ KResult Plan9FS::post_message_and_wait_for_a_reply(Message& message)
return KResult(-EINTR);
if (completion->result.is_error()) {
- dbg() << "Plan9FS: Message was aborted with error " << completion->result;
+ dbgln("Plan9FS: Message was aborted with error {}", completion->result.error());
return KResult(-EIO);
}
@@ -642,13 +642,12 @@ KResult Plan9FS::post_message_and_wait_for_a_reply(Message& message)
// numerical errno in an unspecified encoding; we ignore those too.
StringView error_name;
message >> error_name;
- dbg() << "Plan9FS: Received error name " << error_name;
+ dbgln("Plan9FS: Received error name {}", error_name);
return KResult(-EIO);
} else if ((u8)reply_type != (u8)request_type + 1) {
// Other than those error messages. we only expect the matching reply
// message type.
- dbg() << "Plan9FS: Received unexpected message type " << (u8)reply_type
- << " in response to " << (u8)request_type;
+ dbgln("Plan9FS: Received unexpected message type {} in response to {}", (u8)reply_type, (u8)request_type);
return KResult(-EIO);
} else {
return KSuccess;
diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp
index 87ec817a34..ed085ed0ef 100644
--- a/Kernel/FileSystem/ProcFS.cpp
+++ b/Kernel/FileSystem/ProcFS.cpp
@@ -1185,7 +1185,7 @@ void ProcFSInode::did_seek(FileDescription& description, off_t new_offset)
auto result = refresh_data(description);
if (result.is_error()) {
// Subsequent calls to read will return EIO!
- dbg() << "ProcFS: Could not refresh contents: " << result.error();
+ dbgln("ProcFS: Could not refresh contents: {}", result.error());
}
}
diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp
index 05910e0110..12020f291a 100644
--- a/Kernel/FileSystem/VirtualFileSystem.cpp
+++ b/Kernel/FileSystem/VirtualFileSystem.cpp
@@ -77,7 +77,11 @@ KResult VFS::mount(FS& file_system, Custody& mount_point, int flags)
LOCKER(m_lock);
auto& inode = mount_point.inode();
- dbg() << "VFS: Mounting " << file_system.class_name() << " at " << mount_point.absolute_path() << " (inode: " << inode.identifier() << ") with flags " << flags;
+ dbgln("VFS: Mounting {} at {} (inode: {}) with flags {}",
+ file_system.class_name(),
+ mount_point.absolute_path(),
+ inode.identifier(),
+ flags);
// FIXME: check that this is not already a mount point
Mount mount { file_system, &mount_point, flags };
m_mounts.append(move(mount));
@@ -88,7 +92,7 @@ KResult VFS::bind_mount(Custody& source, Custody& mount_point, int flags)
{
LOCKER(m_lock);
- dbg() << "VFS: Bind-mounting " << source.absolute_path() << " at " << mount_point.absolute_path();
+ dbgln("VFS: Bind-mounting {} at {}", source.absolute_path(), mount_point.absolute_path());
// FIXME: check that this is not already a mount point
Mount mount { source.inode(), mount_point, flags };
m_mounts.append(move(mount));
@@ -99,7 +103,7 @@ KResult VFS::remount(Custody& mount_point, int new_flags)
{
LOCKER(m_lock);
- dbg() << "VFS: Remounting " << mount_point.absolute_path();
+ dbgln("VFS: Remounting {}", mount_point.absolute_path());
Mount* mount = find_mount_for_guest(mount_point.inode());
if (!mount)
@@ -112,7 +116,7 @@ KResult VFS::remount(Custody& mount_point, int new_flags)
KResult VFS::unmount(Inode& guest_inode)
{
LOCKER(m_lock);
- dbg() << "VFS: unmount called with inode " << guest_inode.identifier();
+ dbgln("VFS: unmount called with inode {}", guest_inode.identifier());
for (size_t i = 0; i < m_mounts.size(); ++i) {
auto& mount = m_mounts.at(i);
@@ -122,7 +126,7 @@ KResult VFS::unmount(Inode& guest_inode)
dbgln("VFS: Failed to unmount!");
return result;
}
- dbg() << "VFS: found fs " << mount.guest_fs().fsid() << " at mount index " << i << "! Unmounting...";
+ dbgln("VFS: found fs {} at mount index {}! Unmounting...", mount.guest_fs().fsid(), i);
m_mounts.unstable_take(i);
return KSuccess;
}
@@ -374,7 +378,7 @@ KResult VFS::mknod(StringView path, mode_t mode, dev_t dev, Custody& base)
return KResult(-EROFS);
LexicalPath p(path);
- dbg() << "VFS::mknod: '" << p.basename() << "' mode=" << mode << " dev=" << dev << " in " << parent_inode.identifier();
+ dbgln("VFS::mknod: '{}' mode={} dev={} in {}", p.basename(), mode, dev, parent_inode.identifier());
return parent_inode.create_child(p.basename(), mode, dev, current_process->uid(), current_process->gid()).result();
}
@@ -609,10 +613,10 @@ KResult VFS::chown(Custody& custody, uid_t a_uid, gid_t a_gid)
if (custody.is_readonly())
return KResult(-EROFS);
- dbg() << "VFS::chown(): inode " << inode.identifier() << " <- uid:" << new_uid << " gid:" << new_gid;
+ dbgln("VFS::chown(): inode {} <- uid={} gid={}", inode.identifier(), new_uid, new_gid);
if (metadata.is_setuid() || metadata.is_setgid()) {
- dbg() << "VFS::chown(): Stripping SUID/SGID bits from " << inode.identifier();
+ dbgln("VFS::chown(): Stripping SUID/SGID bits from {}", inode.identifier());
auto result = inode.chmod(metadata.mode & ~(04000 | 02000));
if (result.is_error())
return result;
@@ -718,7 +722,7 @@ KResult VFS::symlink(StringView target, StringView linkpath, Custody& base)
return KResult(-EROFS);
LexicalPath p(linkpath);
- dbg() << "VFS::symlink: '" << p.basename() << "' (-> '" << target << "') in " << parent_inode.identifier();
+ dbgln("VFS::symlink: '{}' (-> '{}') in {}", p.basename(), target, parent_inode.identifier());
auto inode_or_error = parent_inode.create_child(p.basename(), S_IFLNK | 0644, 0, current_process->uid(), current_process->gid());
if (inode_or_error.is_error())
return inode_or_error.error();
@@ -862,21 +866,21 @@ KResult VFS::validate_path_against_process_veil(StringView path, int options)
auto* unveiled_path = find_matching_unveiled_path(path);
if (!unveiled_path) {
- dbg() << "Rejecting path '" << path << "' since it hasn't been unveiled.";
+ dbgln("Rejecting path '{}' since it hasn't been unveiled.", path);
dump_backtrace();
return KResult(-ENOENT);
}
if (options & O_CREAT) {
if (!(unveiled_path->permissions() & UnveilAccess::CreateOrRemove)) {
- dbg() << "Rejecting path '" << path << "' since it hasn't been unveiled with 'c' permission.";
+ dbgln("Rejecting path '{}' since it hasn't been unveiled with 'c' permission.", path);
dump_backtrace();
return KResult(-EACCES);
}
}
if (options & O_UNLINK_INTERNAL) {
if (!(unveiled_path->permissions() & UnveilAccess::CreateOrRemove)) {
- dbg() << "Rejecting path '" << path << "' for unlink since it hasn't been unveiled with 'c' permission.";
+ dbgln("Rejecting path '{}' for unlink since it hasn't been unveiled with 'c' permission.", path);
dump_backtrace();
return KResult(-EACCES);
}
@@ -885,13 +889,13 @@ KResult VFS::validate_path_against_process_veil(StringView path, int options)
if (options & O_RDONLY) {
if (options & O_DIRECTORY) {
if (!(unveiled_path->permissions() & (UnveilAccess::Read | UnveilAccess::Browse))) {
- dbg() << "Rejecting path '" << path << "' since it hasn't been unveiled with 'r' or 'b' permissions.";
+ dbgln("Rejecting path '{}' since it hasn't been unveiled with 'r' or 'b' permissions.", path);
dump_backtrace();
return KResult(-EACCES);
}
} else {
if (!(unveiled_path->permissions() & UnveilAccess::Read)) {
- dbg() << "Rejecting path '" << path << "' since it hasn't been unveiled with 'r' permission.";
+ dbgln("Rejecting path '{}' since it hasn't been unveiled with 'r' permission.", path);
dump_backtrace();
return KResult(-EACCES);
}
@@ -899,14 +903,14 @@ KResult VFS::validate_path_against_process_veil(StringView path, int options)
}
if (options & O_WRONLY) {
if (!(unveiled_path->permissions() & UnveilAccess::Write)) {
- dbg() << "Rejecting path '" << path << "' since it hasn't been unveiled with 'w' permission.";
+ dbgln("Rejecting path '{}' since it hasn't been unveiled with 'w' permission.", path);
dump_backtrace();
return KResult(-EACCES);
}
}
if (options & O_EXEC) {
if (!(unveiled_path->permissions() & UnveilAccess::Execute)) {
- dbg() << "Rejecting path '" << path << "' since it hasn't been unveiled with 'x' permission.";
+ dbgln("Rejecting path '{}' since it hasn't been unveiled with 'x' permission.", path);
dump_backtrace();
return KResult(-EACCES);
}
diff --git a/Kernel/Heap/kmalloc.cpp b/Kernel/Heap/kmalloc.cpp
index 4c121ce164..934fac1a64 100644
--- a/Kernel/Heap/kmalloc.cpp
+++ b/Kernel/Heap/kmalloc.cpp
@@ -242,7 +242,7 @@ void* kmalloc_impl(size_t size)
++g_kmalloc_call_count;
if (g_dump_kmalloc_stacks && Kernel::g_kernel_symbols_available) {
- dbg() << "kmalloc(" << size << ")";
+ dbgln("kmalloc({})", size);
Kernel::dump_backtrace();
}
diff --git a/Kernel/Interrupts/InterruptManagement.cpp b/Kernel/Interrupts/InterruptManagement.cpp
index 75fbef16d3..858e89d8e1 100644
--- a/Kernel/Interrupts/InterruptManagement.cpp
+++ b/Kernel/Interrupts/InterruptManagement.cpp
@@ -152,9 +152,9 @@ void InterruptManagement::switch_to_pic_mode()
ASSERT(irq_controller);
if (irq_controller->type() == IRQControllerType::i82093AA) {
irq_controller->hard_disable();
- dbg() << "Interrupts: Detected " << irq_controller->model() << " - Disabled";
+ dbgln("Interrupts: Detected {} - Disabled", irq_controller->model());
} else {
- dbg() << "Interrupts: Detected " << irq_controller->model();
+ dbgln("Interrupts: Detected {}", irq_controller->model());
}
}
}
@@ -170,7 +170,7 @@ void InterruptManagement::switch_to_ioapic_mode()
return;
}
- dbg() << "Interrupts: MADT @ P " << m_madt.as_ptr();
+ dbgln("Interrupts: MADT @ P {}", m_madt.as_ptr());
locate_apic_data();
m_smp_enabled = true;
if (m_interrupt_controllers.size() == 1) {
@@ -183,9 +183,9 @@ void InterruptManagement::switch_to_ioapic_mode()
ASSERT(irq_controller);
if (irq_controller->type() == IRQControllerType::i8259) {
irq_controller->hard_disable();
- dbg() << "Interrupts: Detected " << irq_controller->model() << " Disabled";
+ dbgln("Interrupts: Detected {} - Disabled", irq_controller->model());
} else {
- dbg() << "Interrupts: Detected " << irq_controller->model();
+ dbgln("Interrupts: Detected {}", irq_controller->model());
}
}
@@ -213,7 +213,7 @@ void InterruptManagement::locate_apic_data()
size_t entry_length = madt_entry->length;
if (madt_entry->type == (u8)ACPI::Structures::MADTEntryType::IOAPIC) {
auto* ioapic_entry = (const ACPI::Structures::MADTEntries::IOAPIC*)madt_entry;
- dbg() << "IOAPIC found @ MADT entry " << entry_index << ", MMIO Registers @ " << PhysicalAddress(ioapic_entry->ioapic_address);
+ dbgln("IOAPIC found @ MADT entry {}, MMIO Registers @ {}", entry_index, PhysicalAddress(ioapic_entry->ioapic_address));
m_interrupt_controllers.resize(1 + irq_controller_count);
m_interrupt_controllers[irq_controller_count] = adopt(*new IOAPIC(PhysicalAddress(ioapic_entry->ioapic_address), ioapic_entry->gsi_base));
irq_controller_count++;
@@ -225,7 +225,11 @@ void InterruptManagement::locate_apic_data()
interrupt_override_entry->source,
interrupt_override_entry->global_system_interrupt,
interrupt_override_entry->flags);
- dbg() << "Interrupts: Overriding INT 0x" << String::format("%x", interrupt_override_entry->source) << " with GSI " << interrupt_override_entry->global_system_interrupt << ", for bus 0x" << String::format("%x", interrupt_override_entry->bus);
+
+ dbgln("Interrupts: Overriding INT {:#x} with GSI {}, for bus {:#x}",
+ interrupt_override_entry->source,
+ interrupt_override_entry->global_system_interrupt,
+ interrupt_override_entry->bus);
}
madt_entry = (ACPI::Structures::MADTEntryHeader*)(VirtualAddress(madt_entry).offset(entry_length).get());
entries_length -= entry_length;
diff --git a/Kernel/Interrupts/UnhandledInterruptHandler.cpp b/Kernel/Interrupts/UnhandledInterruptHandler.cpp
index a9a6b63cb0..827747cdaa 100644
--- a/Kernel/Interrupts/UnhandledInterruptHandler.cpp
+++ b/Kernel/Interrupts/UnhandledInterruptHandler.cpp
@@ -34,13 +34,13 @@ UnhandledInterruptHandler::UnhandledInterruptHandler(u8 interrupt_vector)
void UnhandledInterruptHandler::handle_interrupt(const RegisterState&)
{
- dbg() << "Interrupt: Unhandled vector " << interrupt_number() << " was invoked for handle_interrupt(RegisterState&).";
+ dbgln("Interrupt: Unhandled vector {} was invoked for handle_interrupt(RegisterState&).", interrupt_number());
Processor::halt();
}
[[noreturn]] bool UnhandledInterruptHandler::eoi()
{
- dbg() << "Interrupt: Unhandled vector " << interrupt_number() << " was invoked for eoi().";
+ dbgln("Interrupt: Unhandled vector {} was invoked for eoi().", interrupt_number());
Processor::halt();
}
diff --git a/Kernel/Net/IPv4Socket.cpp b/Kernel/Net/IPv4Socket.cpp
index 5c9ba42b68..f8c6a3ac2b 100644
--- a/Kernel/Net/IPv4Socket.cpp
+++ b/Kernel/Net/IPv4Socket.cpp
@@ -114,7 +114,7 @@ KResult IPv4Socket::bind(Userspace<const sockaddr*> user_address, socklen_t addr
auto requested_local_port = ntohs(address.sin_port);
if (!Process::current()->is_superuser()) {
if (requested_local_port < 1024) {
- dbg() << "UID " << Process::current()->uid() << " attempted to bind " << class_name() << " to port " << requested_local_port;
+ dbgln("UID {} attempted to bind {} to port {}", Process::current()->uid(), class_name(), requested_local_port);
return KResult(-EACCES);
}
}
@@ -300,7 +300,7 @@ KResultOr<size_t> IPv4Socket::receive_packet_buffered(FileDescription& descripti
}
if (!packet.data.has_value()) {
if (protocol_is_disconnected()) {
- dbg() << "IPv4Socket{" << this << "} is protocol-disconnected, returning 0 in recvfrom!";
+ dbgln("IPv4Socket({}) is protocol-disconnected, returning 0 in recvfrom!", this);
return 0;
}
@@ -394,7 +394,7 @@ bool IPv4Socket::did_receive(const IPv4Address& source_address, u16 source_port,
if (buffer_mode() == BufferMode::Bytes) {
size_t space_in_receive_buffer = m_receive_buffer.space_for_writing();
if (packet_size > space_in_receive_buffer) {
- dbg() << "IPv4Socket(" << this << "): did_receive refusing packet since buffer is full.";
+ dbgln("IPv4Socket({}): did_receive refusing packet since buffer is full.", this);
ASSERT(m_can_read);
return false;
}
@@ -408,7 +408,7 @@ bool IPv4Socket::did_receive(const IPv4Address& source_address, u16 source_port,
set_can_read(!m_receive_buffer.is_empty());
} else {
if (m_receive_queue.size() > 2000) {
- dbg() << "IPv4Socket(" << this << "): did_receive refusing packet since queue is full.";
+ dbgln("IPv4Socket({}): did_receive refusing packet since queue is full.", this);
return false;
}
m_receive_queue.append({ source_address, source_port, packet_timestamp, move(packet) });