From eb4074bb9dd9c38d6bc7f67f382bac288c630686 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 24 Oct 2018 13:38:53 +0200 Subject: [PATCH] Put more logspam behind EXT2_DEBUG. --- VirtualFileSystem/Ext2FileSystem.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/VirtualFileSystem/Ext2FileSystem.cpp b/VirtualFileSystem/Ext2FileSystem.cpp index 53fa6a3b66..1b79224488 100644 --- a/VirtualFileSystem/Ext2FileSystem.cpp +++ b/VirtualFileSystem/Ext2FileSystem.cpp @@ -65,9 +65,11 @@ const ext2_group_desc& Ext2FileSystem::blockGroupDescriptor(unsigned groupIndex) if (!m_cachedBlockGroupDescriptorTable) { unsigned blocksToRead = ceilDiv(m_blockGroupCount * (unsigned)sizeof(ext2_group_desc), blockSize()); - kprintf("[ext2fs] block group count: %u, blocks-to-read: %u\n", m_blockGroupCount, blocksToRead); unsigned firstBlockOfBGDT = blockSize() == 1024 ? 2 : 1; +#ifdef EXT2_DEBUG + kprintf("[ext2fs] block group count: %u, blocks-to-read: %u\n", m_blockGroupCount, blocksToRead); kprintf("[ext2fs] first block of BGDT: %u\n", firstBlockOfBGDT); +#endif m_cachedBlockGroupDescriptorTable = readBlocks(firstBlockOfBGDT, blocksToRead); } return reinterpret_cast(m_cachedBlockGroupDescriptorTable.pointer())[groupIndex - 1]; @@ -76,19 +78,22 @@ const ext2_group_desc& Ext2FileSystem::blockGroupDescriptor(unsigned groupIndex) bool Ext2FileSystem::initialize() { auto& superBlock = this->superBlock(); +#ifdef EXT2_DEBUG kprintf("[ext2fs] super block magic: %x (super block size: %u)\n", superBlock.s_magic, sizeof(ext2_super_block)); +#endif if (superBlock.s_magic != EXT2_SUPER_MAGIC) return false; +#ifdef EXT2_DEBUG kprintf("[ext2fs] %u inodes, %u blocks\n", superBlock.s_inodes_count, superBlock.s_blocks_count); kprintf("[ext2fs] block size = %u\n", EXT2_BLOCK_SIZE(&superBlock)); kprintf("[ext2fs] first data block = %u\n", superBlock.s_first_data_block); kprintf("[ext2fs] inodes per block = %u\n", inodesPerBlock()); kprintf("[ext2fs] inodes per group = %u\n", inodesPerGroup()); kprintf("[ext2fs] free inodes = %u\n", superBlock.s_free_inodes_count); - kprintf("[ext2fs] desc per block = %u\n", EXT2_DESC_PER_BLOCK(&superBlock)); kprintf("[ext2fs] desc size = %u\n", EXT2_DESC_SIZE(&superBlock)); +#endif setBlockSize(EXT2_BLOCK_SIZE(&superBlock)); @@ -99,6 +104,7 @@ bool Ext2FileSystem::initialize() return false; } +#ifdef EXT2_DEBUG for (unsigned i = 1; i <= m_blockGroupCount; ++i) { auto& group = blockGroupDescriptor(i); kprintf("[ext2fs] group[%u] { block_bitmap: %u, inode_bitmap: %u, inode_table: %u }\n", @@ -107,6 +113,7 @@ bool Ext2FileSystem::initialize() group.bg_inode_bitmap, group.bg_inode_table); } +#endif return true; }