From bb9c705fc2a40f4443b75f4eabb2c54b5ec00af4 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 23 Nov 2020 14:09:48 +0100 Subject: [PATCH] Ext2FS: Move some EXT2_DEBUG logging behind EXT2_VERY_DEBUG This makes the build actually somewhat usable with EXT2_DEBUG. :^) --- CMakeLists.txt | 2 +- Kernel/FileSystem/Ext2FileSystem.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6aab69fbb31..7ee9852f8da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,7 +55,7 @@ if (ALL_THE_DEBUG_MACROS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBBFS_DEBUG -DBXVGA_DEBUG") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCACHE_DEBUG -DCHTTPJOB_DEBUG -DCNETWORKJOB_DEBUG -DCOMPOSE_DEBUG -DCONTEXT_SWITCH_DEBUG -DCONTIGUOUS_VMOBJECT_DEBUG -DCRYPTO_DEBUG -DCSOCKET_DEBUG") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG_CURSOR_TOOL -DDEBUG_GZIP -DDEBUG_HIGHLIGHT_FOCUSED_FRAME -DDEBUG_IO -DDEBUG_ITEM_RECTS -DDEBUG_LOCAL_SOCKET -DDEBUG_MAPPED_FILE -DDEBUG_MARKDOWN -DDEBUG_MENUS -DDEBUG_POLL_SELECT -DDEBUG_SPAM -DDEBUG_STRINGIMPL -DDEBUG_SYNTAX_HIGHLIGHTING -DDEBUG_TEXTEDITOR -DDEFERRED_INVOKE_DEBUG -DDHCPV4CLIENT_DEBUG -DDHCPV4_DEBUG -DDOUBLECLICK_DEBUG -DDRAGDROP_DEBUG -DDWARF_DEBUG -DDYNAMIC_LOAD_DEBUG") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DE1000_DEBUG -DEBR_DEBUG -DEDITOR_DEBUG -DEMOJI_DEBUG -DETHERNET_DEBUG -DETHERNET_VERY_DEBUG -DEVENT_DEBUG -DEVENTLOOP_DEBUG -DEXEC_DEBUG -DEXT2_DEBUG") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DE1000_DEBUG -DEBR_DEBUG -DEDITOR_DEBUG -DEMOJI_DEBUG -DETHERNET_DEBUG -DETHERNET_VERY_DEBUG -DEVENT_DEBUG -DEVENTLOOP_DEBUG -DEXEC_DEBUG -DEXT2_DEBUG -DEXT2_VERY_DEBUG") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DFIFO_DEBUG -DFILL_PATH_DEBUG -DFORK_DEBUG") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGBOXLAYOUT_DEBUG -DGEMINIJOB_DEBUG -DGENERATE_DEBUG_CODE -DGLOBAL_DTORS_DEBUG -DGMENU_DEBUG -DGPT_DEBUG") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHEAP_DEBUG -DHEX_DEBUG -DHPET_COMPARATOR_DEBUG -DHPET_DEBUG -DHTML_DEBUG -DHTTPSJOB_DEBUG") diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp index 5f6ec4d3134..00e2a82b22d 100644 --- a/Kernel/FileSystem/Ext2FileSystem.cpp +++ b/Kernel/FileSystem/Ext2FileSystem.cpp @@ -38,6 +38,7 @@ #include //#define EXT2_DEBUG +//#define EXT2_VERY_DEBUG namespace Kernel { @@ -728,7 +729,7 @@ ssize_t Ext2FSInode::read_bytes(off_t offset, ssize_t count, UserOrKernelBuffer& ssize_t nread = 0; size_t remaining_count = min((off_t)count, (off_t)size() - offset); -#ifdef EXT2_DEBUG +#ifdef EXT2_VERY_DEBUG dbg() << "Ext2FS: Reading up to " << count << " bytes " << offset << " bytes into inode " << identifier() << " to " << buffer.user_or_kernel_ptr(); #endif @@ -855,14 +856,14 @@ ssize_t Ext2FSInode::write_bytes(off_t offset, ssize_t count, const UserOrKernel ssize_t nwritten = 0; size_t remaining_count = min((off_t)count, (off_t)new_size - offset); -#ifdef EXT2_DEBUG +#ifdef EXT2_VERY_DEBUG dbg() << "Ext2FS: Writing " << count << " bytes " << offset << " bytes into inode " << identifier() << " from " << data.user_or_kernel_ptr(); #endif for (size_t bi = first_block_logical_index; remaining_count && bi <= last_block_logical_index; ++bi) { size_t offset_into_block = (bi == first_block_logical_index) ? offset_into_first_block : 0; size_t num_bytes_to_copy = min(block_size - offset_into_block, remaining_count); -#ifdef EXT2_DEBUG +#ifdef EXT2_VERY_DEBUG dbg() << "Ext2FS: Writing block " << m_block_list[bi] << " (offset_into_block: " << offset_into_block << ")"; #endif int err = fs().write_block(m_block_list[bi], data.offset(nwritten), num_bytes_to_copy, offset_into_block, allow_cache); @@ -875,7 +876,7 @@ ssize_t Ext2FSInode::write_bytes(off_t offset, ssize_t count, const UserOrKernel nwritten += num_bytes_to_copy; } -#ifdef EXT2_DEBUG +#ifdef EXT2_VERY_DEBUG dbg() << "Ext2FS: After write, i_size=" << m_raw_inode.i_size << ", i_blocks=" << m_raw_inode.i_blocks << " (" << m_block_list.size() << " blocks in list)"; #endif @@ -912,7 +913,7 @@ KResult Ext2FSInode::traverse_as_directory(Functioninode != 0) { -#ifdef EXT2_DEBUG +#ifdef EXT2_VERY_DEBUG dbg() << "Ext2Inode::traverse_as_directory: " << entry->inode << ", name_len: " << entry->name_len << ", rec_len: " << entry->rec_len << ", file_type: " << entry->file_type << ", name: " << String(entry->name, entry->name_len); #endif if (!callback({ { entry->name, entry->name_len }, { fsid(), entry->inode }, entry->file_type }))