mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:47:34 +00:00
Everywhere: Turn #if *_DEBUG into dbgln_if/if constexpr
This commit is contained in:
parent
4e6f03a860
commit
6cf59b6ae9
58 changed files with 315 additions and 469 deletions
|
@ -215,26 +215,20 @@ void Parser::try_acpi_shutdown()
|
|||
size_t Parser::get_table_size(PhysicalAddress table_header)
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
#if ACPI_DEBUG
|
||||
dbgln("ACPI: Checking SDT Length");
|
||||
#endif
|
||||
dbgln_if(ACPI_DEBUG, "ACPI: Checking SDT Length");
|
||||
return map_typed<Structures::SDTHeader>(table_header)->length;
|
||||
}
|
||||
|
||||
u8 Parser::get_table_revision(PhysicalAddress table_header)
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
#if ACPI_DEBUG
|
||||
dbgln("ACPI: Checking SDT Revision");
|
||||
#endif
|
||||
dbgln_if(ACPI_DEBUG, "ACPI: Checking SDT Revision");
|
||||
return map_typed<Structures::SDTHeader>(table_header)->revision;
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT void Parser::initialize_main_system_description_table()
|
||||
{
|
||||
#if ACPI_DEBUG
|
||||
dbgln("ACPI: Checking Main SDT Length to choose the correct mapping size");
|
||||
#endif
|
||||
dbgln_if(ACPI_DEBUG, "ACPI: Checking Main SDT Length to choose the correct mapping size");
|
||||
VERIFY(!m_main_system_description_table.is_null());
|
||||
auto length = get_table_size(m_main_system_description_table);
|
||||
auto revision = get_table_revision(m_main_system_description_table);
|
||||
|
|
|
@ -324,9 +324,7 @@ void page_fault_handler(TrapFrame* trap)
|
|||
|
||||
handle_crash(regs, "Page Fault", SIGSEGV, response == PageFaultResponse::OutOfMemory);
|
||||
} else if (response == PageFaultResponse::Continue) {
|
||||
#if PAGE_FAULT_DEBUG
|
||||
dbgln("Continuing after resolved page fault");
|
||||
#endif
|
||||
dbgln_if(PAGE_FAULT_DEBUG, "Continuing after resolved page fault");
|
||||
} else {
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
|
|
@ -134,10 +134,8 @@ MousePacket PS2MouseDevice::parse_data_packet(const RawPacket& raw_packet)
|
|||
}
|
||||
|
||||
packet.is_relative = true;
|
||||
#if PS2MOUSE_DEBUG
|
||||
dbgln("PS2 Relative Mouse: Buttons {:x}", packet.buttons);
|
||||
dbgln("Mouse: X {}, Y {}, Z {}", packet.x, packet.y, packet.z);
|
||||
#endif
|
||||
dbgln_if(PS2MOUSE_DEBUG, "PS2 Relative Mouse: Buttons {:x}", packet.buttons);
|
||||
dbgln_if(PS2MOUSE_DEBUG, "Mouse: X {}, Y {}, Z {}", packet.x, packet.y, packet.z);
|
||||
return packet;
|
||||
}
|
||||
|
||||
|
|
|
@ -176,9 +176,8 @@ UNMAP_AFTER_INIT void UHCIController::create_structures()
|
|||
transfer_descriptor->set_isochronous();
|
||||
transfer_descriptor->link_queue_head(m_interrupt_transfer_queue->paddr());
|
||||
|
||||
#if UHCI_VERBOSE_DEBUG
|
||||
transfer_descriptor->print();
|
||||
#endif
|
||||
if constexpr (UHCI_VERBOSE_DEBUG)
|
||||
transfer_descriptor->print();
|
||||
}
|
||||
|
||||
m_free_td_pool.resize(MAXIMUM_NUMBER_OF_TDS);
|
||||
|
@ -192,10 +191,10 @@ UNMAP_AFTER_INIT void UHCIController::create_structures()
|
|||
// access the raw descriptor (that we later send to the controller)
|
||||
m_free_td_pool.at(i) = new (placement_addr) Kernel::USB::TransferDescriptor(paddr);
|
||||
|
||||
#if UHCI_VERBOSE_DEBUG
|
||||
auto transfer_descriptor = m_free_td_pool.at(i);
|
||||
transfer_descriptor->print();
|
||||
#endif
|
||||
if constexpr (UHCI_VERBOSE_DEBUG) {
|
||||
auto transfer_descriptor = m_free_td_pool.at(i);
|
||||
transfer_descriptor->print();
|
||||
}
|
||||
}
|
||||
|
||||
if constexpr (UHCI_DEBUG) {
|
||||
|
|
|
@ -453,9 +453,7 @@ bool TCPSocket::protocol_is_disconnected() const
|
|||
void TCPSocket::shut_down_for_writing()
|
||||
{
|
||||
if (state() == State::Established) {
|
||||
#if TCP_SOCKET_DEBUG
|
||||
dbgln(" Sending FIN/ACK from Established and moving into FinWait1");
|
||||
#endif
|
||||
dbgln_if(TCP_SOCKET_DEBUG, " Sending FIN/ACK from Established and moving into FinWait1");
|
||||
[[maybe_unused]] auto rc = send_tcp_packet(TCPFlags::FIN | TCPFlags::ACK);
|
||||
set_state(State::FinWait1);
|
||||
} else {
|
||||
|
@ -468,9 +466,7 @@ KResult TCPSocket::close()
|
|||
Locker socket_locker(lock());
|
||||
auto result = IPv4Socket::close();
|
||||
if (state() == State::CloseWait) {
|
||||
#if TCP_SOCKET_DEBUG
|
||||
dbgln(" Sending FIN from CloseWait and moving into LastAck");
|
||||
#endif
|
||||
dbgln_if(TCP_SOCKET_DEBUG, " Sending FIN from CloseWait and moving into LastAck");
|
||||
[[maybe_unused]] auto rc = send_tcp_packet(TCPFlags::FIN | TCPFlags::ACK);
|
||||
set_state(State::LastAck);
|
||||
}
|
||||
|
|
|
@ -66,9 +66,7 @@ void IOAccess::write32_field(Address address, u32 field, u32 value)
|
|||
|
||||
void IOAccess::enumerate_hardware(Function<void(Address, ID)> callback)
|
||||
{
|
||||
#if PCI_DEBUG
|
||||
dbgln("PCI: IO enumerating hardware");
|
||||
#endif
|
||||
dbgln_if(PCI_DEBUG, "PCI: IO enumerating hardware");
|
||||
// Single PCI host controller.
|
||||
if ((read8_field(Address(), PCI_HEADER_TYPE) & 0x80) == 0) {
|
||||
enumerate_bus(-1, 0, callback, true);
|
||||
|
|
|
@ -443,9 +443,7 @@ PageFaultResponse AnonymousVMObject::handle_cow_fault(size_t page_index, Virtual
|
|||
auto& page_slot = physical_pages()[page_index];
|
||||
bool have_committed = m_shared_committed_cow_pages && is_nonvolatile(page_index);
|
||||
if (page_slot->ref_count() == 1) {
|
||||
#if PAGE_FAULT_DEBUG
|
||||
dbgln(" >> It's a COW page but nobody is sharing it anymore. Remap r/w");
|
||||
#endif
|
||||
dbgln_if(PAGE_FAULT_DEBUG, " >> It's a COW page but nobody is sharing it anymore. Remap r/w");
|
||||
set_should_cow(page_index, false);
|
||||
if (have_committed) {
|
||||
if (m_shared_committed_cow_pages->return_one())
|
||||
|
@ -456,14 +454,10 @@ PageFaultResponse AnonymousVMObject::handle_cow_fault(size_t page_index, Virtual
|
|||
|
||||
RefPtr<PhysicalPage> page;
|
||||
if (have_committed) {
|
||||
#if PAGE_FAULT_DEBUG
|
||||
dbgln(" >> It's a committed COW page and it's time to COW!");
|
||||
#endif
|
||||
dbgln_if(PAGE_FAULT_DEBUG, " >> It's a committed COW page and it's time to COW!");
|
||||
page = m_shared_committed_cow_pages->allocate_one();
|
||||
} else {
|
||||
#if PAGE_FAULT_DEBUG
|
||||
dbgln(" >> It's a COW page and it's time to COW!");
|
||||
#endif
|
||||
dbgln_if(PAGE_FAULT_DEBUG, " >> It's a COW page and it's time to COW!");
|
||||
page = MM.allocate_user_physical_page(MemoryManager::ShouldZeroFill::No);
|
||||
if (page.is_null()) {
|
||||
dmesgln("MM: handle_cow_fault was unable to allocate a physical page");
|
||||
|
|
|
@ -457,9 +457,7 @@ PageFaultResponse Region::handle_zero_fault(size_t page_index_in_region)
|
|||
auto page_index_in_vmobject = translate_to_vmobject_page(page_index_in_region);
|
||||
|
||||
if (!page_slot.is_null() && !page_slot->is_shared_zero_page() && !page_slot->is_lazy_committed_page()) {
|
||||
#if PAGE_FAULT_DEBUG
|
||||
dbgln("MM: zero_page() but page already present. Fine with me!");
|
||||
#endif
|
||||
dbgln_if(PAGE_FAULT_DEBUG, "MM: zero_page() but page already present. Fine with me!");
|
||||
if (!remap_vmobject_page(page_index_in_vmobject))
|
||||
return PageFaultResponse::OutOfMemory;
|
||||
return PageFaultResponse::Continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue