mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:47:34 +00:00
Everywhere: Replace dbgln<flag>(...) with dbgln_if(flag, ...)
Replacement made by `find Kernel Userland -name '*.h' -o -name '*.cpp' | sed -i -Ee 's/dbgln\b<(\w+)>\(/dbgln_if(\1, /g'`
This commit is contained in:
parent
1f8a633cc7
commit
09a43969ba
95 changed files with 427 additions and 425 deletions
|
@ -362,7 +362,7 @@ void E1000NetworkAdapter::initialize_tx_descriptors()
|
|||
|
||||
void E1000NetworkAdapter::out8(u16 address, u8 data)
|
||||
{
|
||||
dbgln<E1000_DEBUG>("E1000: OUT8 {:#02x} @ {:#04x}", data, address);
|
||||
dbgln_if(E1000_DEBUG, "E1000: OUT8 {:#02x} @ {:#04x}", data, address);
|
||||
if (m_use_mmio) {
|
||||
auto* ptr = (volatile u8*)(m_mmio_base.get() + address);
|
||||
*ptr = data;
|
||||
|
@ -373,7 +373,7 @@ void E1000NetworkAdapter::out8(u16 address, u8 data)
|
|||
|
||||
void E1000NetworkAdapter::out16(u16 address, u16 data)
|
||||
{
|
||||
dbgln<E1000_DEBUG>("E1000: OUT16 {:#04x} @ {:#04x}", data, address);
|
||||
dbgln_if(E1000_DEBUG, "E1000: OUT16 {:#04x} @ {:#04x}", data, address);
|
||||
if (m_use_mmio) {
|
||||
auto* ptr = (volatile u16*)(m_mmio_base.get() + address);
|
||||
*ptr = data;
|
||||
|
@ -384,7 +384,7 @@ void E1000NetworkAdapter::out16(u16 address, u16 data)
|
|||
|
||||
void E1000NetworkAdapter::out32(u16 address, u32 data)
|
||||
{
|
||||
dbgln<E1000_DEBUG>("E1000: OUT32 {:#08x} @ {:#04x}", data, address);
|
||||
dbgln_if(E1000_DEBUG, "E1000: OUT32 {:#08x} @ {:#04x}", data, address);
|
||||
if (m_use_mmio) {
|
||||
auto* ptr = (volatile u32*)(m_mmio_base.get() + address);
|
||||
*ptr = data;
|
||||
|
@ -395,7 +395,7 @@ void E1000NetworkAdapter::out32(u16 address, u32 data)
|
|||
|
||||
u8 E1000NetworkAdapter::in8(u16 address)
|
||||
{
|
||||
dbgln<E1000_DEBUG>("E1000: IN8 @ {:#04x}", address);
|
||||
dbgln_if(E1000_DEBUG, "E1000: IN8 @ {:#04x}", address);
|
||||
if (m_use_mmio)
|
||||
return *(volatile u8*)(m_mmio_base.get() + address);
|
||||
return m_io_base.offset(address).in<u8>();
|
||||
|
@ -403,7 +403,7 @@ u8 E1000NetworkAdapter::in8(u16 address)
|
|||
|
||||
u16 E1000NetworkAdapter::in16(u16 address)
|
||||
{
|
||||
dbgln<E1000_DEBUG>("E1000: IN16 @ {:#04x}", address);
|
||||
dbgln_if(E1000_DEBUG, "E1000: IN16 @ {:#04x}", address);
|
||||
if (m_use_mmio)
|
||||
return *(volatile u16*)(m_mmio_base.get() + address);
|
||||
return m_io_base.offset(address).in<u16>();
|
||||
|
@ -411,7 +411,7 @@ u16 E1000NetworkAdapter::in16(u16 address)
|
|||
|
||||
u32 E1000NetworkAdapter::in32(u16 address)
|
||||
{
|
||||
dbgln<E1000_DEBUG>("E1000: IN32 @ {:#04x}", address);
|
||||
dbgln_if(E1000_DEBUG, "E1000: IN32 @ {:#04x}", address);
|
||||
if (m_use_mmio)
|
||||
return *(volatile u32*)(m_mmio_base.get() + address);
|
||||
return m_io_base.offset(address).in<u32>();
|
||||
|
|
|
@ -66,7 +66,7 @@ KResultOr<NonnullRefPtr<Socket>> IPv4Socket::create(int type, int protocol)
|
|||
IPv4Socket::IPv4Socket(int type, int protocol)
|
||||
: Socket(AF_INET, type, protocol)
|
||||
{
|
||||
dbgln<IPV4_SOCKET_DEBUG>("IPv4Socket({}) created with type={}, protocol={}", this, type, protocol);
|
||||
dbgln_if(IPV4_SOCKET_DEBUG, "IPv4Socket({}) created with type={}, protocol={}", this, type, protocol);
|
||||
m_buffer_mode = type == SOCK_STREAM ? BufferMode::Bytes : BufferMode::Packets;
|
||||
if (m_buffer_mode == BufferMode::Bytes) {
|
||||
m_scratch_buffer = KBuffer::create_with_size(65536);
|
||||
|
@ -119,7 +119,7 @@ KResult IPv4Socket::bind(Userspace<const sockaddr*> user_address, socklen_t addr
|
|||
m_local_address = IPv4Address((const u8*)&address.sin_addr.s_addr);
|
||||
m_local_port = requested_local_port;
|
||||
|
||||
dbgln<IPV4_SOCKET_DEBUG>("IPv4Socket::bind {}({}) to {}:{}", class_name(), this, m_local_address, m_local_port);
|
||||
dbgln_if(IPV4_SOCKET_DEBUG, "IPv4Socket::bind {}({}) to {}:{}", class_name(), this, m_local_address, m_local_port);
|
||||
|
||||
return protocol_bind();
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ KResult IPv4Socket::listen(size_t backlog)
|
|||
m_role = Role::Listener;
|
||||
evaluate_block_conditions();
|
||||
|
||||
dbgln<IPV4_SOCKET_DEBUG>("IPv4Socket({}) listening with backlog={}", this, backlog);
|
||||
dbgln_if(IPV4_SOCKET_DEBUG, "IPv4Socket({}) listening with backlog={}", this, backlog);
|
||||
|
||||
return protocol_listen();
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ KResultOr<size_t> IPv4Socket::receive_packet_buffered(FileDescription& descripti
|
|||
packet = m_receive_queue.take_first();
|
||||
set_can_read(!m_receive_queue.is_empty());
|
||||
|
||||
dbgln<IPV4_SOCKET_DEBUG>("IPv4Socket({}): recvfrom without blocking {} bytes, packets in queue: {}",
|
||||
dbgln_if(IPV4_SOCKET_DEBUG, "IPv4Socket({}): recvfrom without blocking {} bytes, packets in queue: {}",
|
||||
this,
|
||||
packet.data.value().size(),
|
||||
m_receive_queue.size());
|
||||
|
@ -316,7 +316,7 @@ KResultOr<size_t> IPv4Socket::receive_packet_buffered(FileDescription& descripti
|
|||
packet = m_receive_queue.take_first();
|
||||
set_can_read(!m_receive_queue.is_empty());
|
||||
|
||||
dbgln<IPV4_SOCKET_DEBUG>("IPv4Socket({}): recvfrom with blocking {} bytes, packets in queue: {}",
|
||||
dbgln_if(IPV4_SOCKET_DEBUG, "IPv4Socket({}): recvfrom with blocking {} bytes, packets in queue: {}",
|
||||
this,
|
||||
packet.data.value().size(),
|
||||
m_receive_queue.size());
|
||||
|
@ -326,7 +326,7 @@ KResultOr<size_t> IPv4Socket::receive_packet_buffered(FileDescription& descripti
|
|||
packet_timestamp = packet.timestamp;
|
||||
|
||||
if (addr) {
|
||||
dbgln<IPV4_SOCKET_DEBUG>("Incoming packet is from: {}:{}", packet.peer_address, packet.peer_port);
|
||||
dbgln_if(IPV4_SOCKET_DEBUG, "Incoming packet is from: {}:{}", packet.peer_address, packet.peer_port);
|
||||
|
||||
sockaddr_in out_addr {};
|
||||
memcpy(&out_addr.sin_addr, &packet.peer_address, sizeof(IPv4Address));
|
||||
|
|
|
@ -74,7 +74,7 @@ LocalSocket::LocalSocket(int type)
|
|||
evaluate_block_conditions();
|
||||
});
|
||||
|
||||
dbgln<LOCAL_SOCKET_DEBUG>("LocalSocket({}) created with type={}", this, type);
|
||||
dbgln_if(LOCAL_SOCKET_DEBUG, "LocalSocket({}) created with type={}", this, type);
|
||||
}
|
||||
|
||||
LocalSocket::~LocalSocket()
|
||||
|
@ -110,7 +110,7 @@ KResult LocalSocket::bind(Userspace<const sockaddr*> user_address, socklen_t add
|
|||
|
||||
auto path = String(address.sun_path, strnlen(address.sun_path, sizeof(address.sun_path)));
|
||||
|
||||
dbgln<LOCAL_SOCKET_DEBUG>("LocalSocket({}) bind({})", this, path);
|
||||
dbgln_if(LOCAL_SOCKET_DEBUG, "LocalSocket({}) bind({})", this, path);
|
||||
|
||||
mode_t mode = S_IFSOCK | (m_prebind_mode & 0777);
|
||||
UidAndGid owner { m_prebind_uid, m_prebind_gid };
|
||||
|
@ -154,7 +154,7 @@ KResult LocalSocket::connect(FileDescription& description, Userspace<const socka
|
|||
return EFAULT;
|
||||
safe_address[sizeof(safe_address) - 1] = '\0';
|
||||
|
||||
dbgln<LOCAL_SOCKET_DEBUG>("LocalSocket({}) connect({})", this, safe_address);
|
||||
dbgln_if(LOCAL_SOCKET_DEBUG, "LocalSocket({}) connect({})", this, safe_address);
|
||||
|
||||
auto description_or_error = VFS::the().open(safe_address, O_RDWR, 0, Process::current()->current_directory());
|
||||
if (description_or_error.is_error())
|
||||
|
@ -190,7 +190,7 @@ KResult LocalSocket::connect(FileDescription& description, Userspace<const socka
|
|||
return EINTR;
|
||||
}
|
||||
|
||||
dbgln<LOCAL_SOCKET_DEBUG>("LocalSocket({}) connect({}) status is {}", this, safe_address, to_string(setup_state()));
|
||||
dbgln_if(LOCAL_SOCKET_DEBUG, "LocalSocket({}) connect({}) status is {}", this, safe_address, to_string(setup_state()));
|
||||
|
||||
if (!((u32)unblock_flags & (u32)Thread::FileDescriptionBlocker::BlockFlags::Connect)) {
|
||||
set_connect_side_role(Role::None);
|
||||
|
@ -210,7 +210,7 @@ KResult LocalSocket::listen(size_t backlog)
|
|||
m_role = Role::Listener;
|
||||
set_connect_side_role(Role::Listener, previous_role != m_role);
|
||||
|
||||
dbgln<LOCAL_SOCKET_DEBUG>("LocalSocket({}) listening with backlog={}", this, backlog);
|
||||
dbgln_if(LOCAL_SOCKET_DEBUG, "LocalSocket({}) listening with backlog={}", this, backlog);
|
||||
|
||||
return KSuccess;
|
||||
}
|
||||
|
|
|
@ -210,13 +210,13 @@ NE2000NetworkAdapter::~NE2000NetworkAdapter()
|
|||
void NE2000NetworkAdapter::handle_irq(const RegisterState&)
|
||||
{
|
||||
u8 status = in8(REG_RW_INTERRUPTSTATUS);
|
||||
dbgln<NE2000_DEBUG>("NE2000NetworkAdapter: Got interrupt, status=0x{}", String::format("%02x", status));
|
||||
dbgln_if(NE2000_DEBUG, "NE2000NetworkAdapter: Got interrupt, status=0x{}", String::format("%02x", status));
|
||||
|
||||
if (status & BIT_INTERRUPTMASK_PRX) {
|
||||
dbgln<NE2000_DEBUG>("NE2000NetworkAdapter: Interrupt for packet received");
|
||||
dbgln_if(NE2000_DEBUG, "NE2000NetworkAdapter: Interrupt for packet received");
|
||||
}
|
||||
if (status & BIT_INTERRUPTMASK_PTX) {
|
||||
dbgln<NE2000_DEBUG>("NE2000NetworkAdapter: Interrupt for packet sent");
|
||||
dbgln_if(NE2000_DEBUG, "NE2000NetworkAdapter: Interrupt for packet sent");
|
||||
}
|
||||
if (status & BIT_INTERRUPTMASK_RXE) {
|
||||
u8 fae = in8(REG_RD_FAE_TALLY);
|
||||
|
@ -278,9 +278,9 @@ int NE2000NetworkAdapter::ram_test()
|
|||
for (size_t j = 0; j < buffer.size(); ++j) {
|
||||
if (buffer[j] != patterns[i]) {
|
||||
if (errors < 16)
|
||||
dbgln<NE2000_DEBUG>("NE2000NetworkAdapter: Bad adapter RAM @ {} expected={} got={}", PhysicalAddress(NE2K_RAM_BEGIN + j), patterns[i], buffer[j]);
|
||||
dbgln_if(NE2000_DEBUG, "NE2000NetworkAdapter: Bad adapter RAM @ {} expected={} got={}", PhysicalAddress(NE2K_RAM_BEGIN + j), patterns[i], buffer[j]);
|
||||
else if (errors == 16)
|
||||
dbgln<NE2000_DEBUG>("NE2000NetworkAdapter: Too many RAM errors, silencing further output");
|
||||
dbgln_if(NE2000_DEBUG, "NE2000NetworkAdapter: Too many RAM errors, silencing further output");
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ void NE2000NetworkAdapter::reset()
|
|||
|
||||
void NE2000NetworkAdapter::rdma_read(size_t address, Bytes payload)
|
||||
{
|
||||
dbgln<NE2000_DEBUG>("NE2000NetworkAdapter: DMA read @ {} length={}", PhysicalAddress(address), payload.size());
|
||||
dbgln_if(NE2000_DEBUG, "NE2000NetworkAdapter: DMA read @ {} length={}", PhysicalAddress(address), payload.size());
|
||||
|
||||
u8 command = in8(REG_RW_COMMAND) & ~(BIT_COMMAND_PAGE_FIELD | BIT_COMMAND_DMA_FIELD);
|
||||
out8(REG_RW_COMMAND, command | BIT_COMMAND_DMA_ABORT);
|
||||
|
@ -357,7 +357,7 @@ void NE2000NetworkAdapter::rdma_read(size_t address, Bytes payload)
|
|||
|
||||
void NE2000NetworkAdapter::rdma_write(size_t address, ReadonlyBytes payload)
|
||||
{
|
||||
dbgln<NE2000_DEBUG>("NE2000NetworkAdapter: DMA write @ {} length={}", PhysicalAddress(address), payload.size());
|
||||
dbgln_if(NE2000_DEBUG, "NE2000NetworkAdapter: DMA write @ {} length={}", PhysicalAddress(address), payload.size());
|
||||
|
||||
u8 command = in8(REG_RW_COMMAND) & ~(BIT_COMMAND_PAGE_FIELD | BIT_COMMAND_DMA_FIELD);
|
||||
out8(REG_RW_COMMAND, command | BIT_COMMAND_DMA_ABORT);
|
||||
|
@ -384,7 +384,7 @@ void NE2000NetworkAdapter::rdma_write(size_t address, ReadonlyBytes payload)
|
|||
|
||||
void NE2000NetworkAdapter::send_raw(ReadonlyBytes payload)
|
||||
{
|
||||
dbgln<NE2000_DEBUG>("NE2000NetworkAdapter: Sending packet length={}", payload.size());
|
||||
dbgln_if(NE2000_DEBUG, "NE2000NetworkAdapter: Sending packet length={}", payload.size());
|
||||
|
||||
if (payload.size() > NE2K_RAM_SEND_SIZE) {
|
||||
dmesgln("NE2000NetworkAdapter: Packet to send was too big; discarding");
|
||||
|
@ -404,7 +404,7 @@ void NE2000NetworkAdapter::send_raw(ReadonlyBytes payload)
|
|||
out8(REG_WR_TRANSMITBYTECOUNT1, packet_size >> 8);
|
||||
out8(REG_RW_COMMAND, BIT_COMMAND_DMA_ABORT | BIT_COMMAND_TXP | BIT_COMMAND_START);
|
||||
|
||||
dbgln<NE2000_DEBUG>("NE2000NetworkAdapter: Packet submitted for transmission");
|
||||
dbgln_if(NE2000_DEBUG, "NE2000NetworkAdapter: Packet submitted for transmission");
|
||||
|
||||
enable_irq();
|
||||
}
|
||||
|
@ -423,7 +423,7 @@ void NE2000NetworkAdapter::receive()
|
|||
rdma_read(header_address, Bytes(reinterpret_cast<u8*>(&header), sizeof(header)));
|
||||
|
||||
bool packet_ok = header.status & BIT_RECEIVESTATUS_PRX;
|
||||
dbgln<NE2000_DEBUG>("NE2000NetworkAdapter: Packet received {} length={}", (packet_ok ? "intact" : "damaged"), header.length);
|
||||
dbgln_if(NE2000_DEBUG, "NE2000NetworkAdapter: Packet received {} length={}", (packet_ok ? "intact" : "damaged"), header.length);
|
||||
|
||||
if (packet_ok) {
|
||||
auto packet = ByteBuffer::create_uninitialized(sizeof(received_packet_header) + header.length);
|
||||
|
|
|
@ -64,7 +64,7 @@ Socket::~Socket()
|
|||
|
||||
void Socket::set_setup_state(SetupState new_setup_state)
|
||||
{
|
||||
dbgln<SOCKET_DEBUG>("Socket({}) setup state moving from {} to {}", this, to_string(m_setup_state), to_string(new_setup_state));
|
||||
dbgln_if(SOCKET_DEBUG, "Socket({}) setup state moving from {} to {}", this, to_string(m_setup_state), to_string(new_setup_state));
|
||||
m_setup_state = new_setup_state;
|
||||
evaluate_block_conditions();
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ RefPtr<Socket> Socket::accept()
|
|||
LOCKER(m_lock);
|
||||
if (m_pending.is_empty())
|
||||
return nullptr;
|
||||
dbgln<SOCKET_DEBUG>("Socket({}) de-queueing connection", this);
|
||||
dbgln_if(SOCKET_DEBUG, "Socket({}) de-queueing connection", this);
|
||||
auto client = m_pending.take_first();
|
||||
ASSERT(!client->is_connected());
|
||||
auto& process = *Process::current();
|
||||
|
@ -88,7 +88,7 @@ RefPtr<Socket> Socket::accept()
|
|||
|
||||
KResult Socket::queue_connection_from(NonnullRefPtr<Socket> peer)
|
||||
{
|
||||
dbgln<SOCKET_DEBUG>("Socket({}) queueing connection", this);
|
||||
dbgln_if(SOCKET_DEBUG, "Socket({}) queueing connection", this);
|
||||
LOCKER(m_lock);
|
||||
if (m_pending.size() >= m_backlog)
|
||||
return ECONNREFUSED;
|
||||
|
|
|
@ -47,7 +47,7 @@ void TCPSocket::for_each(Function<void(const TCPSocket&)> callback)
|
|||
|
||||
void TCPSocket::set_state(State new_state)
|
||||
{
|
||||
dbgln<TCP_SOCKET_DEBUG>("TCPSocket({}) state moving from {} to {}", this, to_string(m_state), to_string(new_state));
|
||||
dbgln_if(TCP_SOCKET_DEBUG, "TCPSocket({}) state moving from {} to {}", this, to_string(m_state), to_string(new_state));
|
||||
|
||||
auto was_disconnected = protocol_is_disconnected();
|
||||
auto previous_role = m_role;
|
||||
|
@ -154,7 +154,7 @@ TCPSocket::~TCPSocket()
|
|||
LOCKER(sockets_by_tuple().lock());
|
||||
sockets_by_tuple().resource().remove(tuple());
|
||||
|
||||
dbgln<TCP_SOCKET_DEBUG>("~TCPSocket in state {}", to_string(state()));
|
||||
dbgln_if(TCP_SOCKET_DEBUG, "~TCPSocket in state {}", to_string(state()));
|
||||
}
|
||||
|
||||
NonnullRefPtr<TCPSocket> TCPSocket::create(int protocol)
|
||||
|
@ -273,14 +273,14 @@ void TCPSocket::receive_tcp_packet(const TCPPacket& packet, u16 size)
|
|||
if (packet.has_ack()) {
|
||||
u32 ack_number = packet.ack_number();
|
||||
|
||||
dbgln<TCP_SOCKET_DEBUG>("TCPSocket: receive_tcp_packet: {}", ack_number);
|
||||
dbgln_if(TCP_SOCKET_DEBUG, "TCPSocket: receive_tcp_packet: {}", ack_number);
|
||||
|
||||
int removed = 0;
|
||||
LOCKER(m_not_acked_lock);
|
||||
while (!m_not_acked.is_empty()) {
|
||||
auto& packet = m_not_acked.first();
|
||||
|
||||
dbgln<TCP_SOCKET_DEBUG>("TCPSocket: iterate: {}", packet.ack_number);
|
||||
dbgln_if(TCP_SOCKET_DEBUG, "TCPSocket: iterate: {}", packet.ack_number);
|
||||
|
||||
if (packet.ack_number <= ack_number) {
|
||||
m_not_acked.take_first();
|
||||
|
@ -290,7 +290,7 @@ void TCPSocket::receive_tcp_packet(const TCPPacket& packet, u16 size)
|
|||
}
|
||||
}
|
||||
|
||||
dbgln<TCP_SOCKET_DEBUG>("TCPSocket: receive_tcp_packet acknowledged {} packets", removed);
|
||||
dbgln_if(TCP_SOCKET_DEBUG, "TCPSocket: receive_tcp_packet acknowledged {} packets", removed);
|
||||
}
|
||||
|
||||
m_packets_in++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue