1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:48:11 +00:00

Kernel: Convert klog() => dmesgln() in filesystem code

This commit is contained in:
Andreas Kling 2021-03-09 20:17:57 +01:00
parent 2fc684f6bc
commit 10f10abaa3
3 changed files with 15 additions and 18 deletions

View file

@ -115,20 +115,20 @@ bool Ext2FS::initialize()
auto& super_block = this->super_block(); auto& super_block = this->super_block();
if constexpr (EXT2_DEBUG) { if constexpr (EXT2_DEBUG) {
klog() << "ext2fs: super block magic: " << String::format("%x", super_block.s_magic) << " (super block size: " << sizeof(ext2_super_block) << ")"; dmesgln("Ext2FS: super block magic: {:04x} (super block size: {})", super_block.s_magic, sizeof(ext2_super_block));
} }
if (super_block.s_magic != EXT2_SUPER_MAGIC) if (super_block.s_magic != EXT2_SUPER_MAGIC)
return false; return false;
if constexpr (EXT2_DEBUG) { if constexpr (EXT2_DEBUG) {
klog() << "ext2fs: " << super_block.s_inodes_count << " inodes, " << super_block.s_blocks_count << " blocks"; dmesgln("Ext2FS: {} inodes, {} blocks", super_block.s_inodes_count, super_block.s_blocks_count);
klog() << "ext2fs: block size = " << EXT2_BLOCK_SIZE(&super_block); dmesgln("Ext2FS: Block size: {}", EXT2_BLOCK_SIZE(&super_block));
klog() << "ext2fs: first data block = " << super_block.s_first_data_block; dmesgln("Ext2FS: First data block: {}", super_block.s_first_data_block);
klog() << "ext2fs: inodes per block = " << inodes_per_block(); dmesgln("Ext2FS: Inodes per block: {}", inodes_per_block());
klog() << "ext2fs: inodes per group = " << inodes_per_group(); dmesgln("Ext2FS: Inodes per group: {}", inodes_per_group());
klog() << "ext2fs: free inodes = " << super_block.s_free_inodes_count; dmesgln("Ext2FS: Free inodes: {}", super_block.s_free_inodes_count);
klog() << "ext2fs: desc per block = " << EXT2_DESC_PER_BLOCK(&super_block); dmesgln("Ext2FS: Descriptors per block: {}", EXT2_DESC_PER_BLOCK(&super_block));
klog() << "ext2fs: desc size = " << EXT2_DESC_SIZE(&super_block); dmesgln("Ext2FS: Descriptor size: {}", EXT2_DESC_SIZE(&super_block));
} }
set_block_size(EXT2_BLOCK_SIZE(&super_block)); set_block_size(EXT2_BLOCK_SIZE(&super_block));
@ -138,7 +138,7 @@ bool Ext2FS::initialize()
m_block_group_count = ceil_div(super_block.s_blocks_count, super_block.s_blocks_per_group); m_block_group_count = ceil_div(super_block.s_blocks_count, super_block.s_blocks_per_group);
if (m_block_group_count == 0) { if (m_block_group_count == 0) {
klog() << "ext2fs: no block groups :("; dmesgln("Ext2FS: no block groups :(");
return false; return false;
} }
@ -160,7 +160,7 @@ bool Ext2FS::initialize()
if constexpr (EXT2_DEBUG) { if constexpr (EXT2_DEBUG) {
for (unsigned i = 1; i <= m_block_group_count; ++i) { for (unsigned i = 1; i <= m_block_group_count; ++i) {
auto& group = group_descriptor(i); auto& group = group_descriptor(i);
klog() << "ext2fs: group[" << i << "] { block_bitmap: " << group.bg_block_bitmap << ", inode_bitmap: " << group.bg_inode_bitmap << ", inode_table: " << group.bg_inode_table << " }"; dbgln("Ext2FS: group[{}] ( block_bitmap: {}, inode_bitmap: {}, inode_table: {} )", i, group.bg_block_bitmap, group.bg_inode_bitmap, group.bg_inode_table);
} }
} }

View file

@ -92,7 +92,7 @@ KResultOr<NonnullOwnPtr<KBuffer>> Inode::read_entire(FileDescription* descriptio
break; break;
} }
if (nread < 0) { if (nread < 0) {
klog() << "Inode::read_entire: ERROR: " << nread; dmesgln("Inode::read_entire: Error: {}", nread);
return KResult((ErrnoCode)-nread); return KResult((ErrnoCode)-nread);
} }

View file

@ -56,9 +56,6 @@ VFS& VFS::the()
UNMAP_AFTER_INIT VFS::VFS() UNMAP_AFTER_INIT VFS::VFS()
{ {
#if VFS_DEBUG
klog() << "VFS: Constructing VFS";
#endif
} }
UNMAP_AFTER_INIT VFS::~VFS() UNMAP_AFTER_INIT VFS::~VFS()
@ -138,7 +135,7 @@ KResult VFS::unmount(Inode& guest_inode)
bool VFS::mount_root(FS& file_system) bool VFS::mount_root(FS& file_system)
{ {
if (m_root_inode) { if (m_root_inode) {
klog() << "VFS: mount_root can't mount another root"; dmesgln("VFS: mount_root can't mount another root");
return false; return false;
} }
@ -146,12 +143,12 @@ bool VFS::mount_root(FS& file_system)
auto root_inode = file_system.root_inode(); auto root_inode = file_system.root_inode();
if (!root_inode->is_directory()) { if (!root_inode->is_directory()) {
klog() << "VFS: root inode (" << String::format("%02u", file_system.fsid()) << ":" << String::format("%08u", root_inode->index().value()) << ") for / is not a directory :("; dmesgln("VFS: root inode ({}) for / is not a directory :(", root_inode->identifier());
return false; return false;
} }
m_root_inode = move(root_inode); m_root_inode = move(root_inode);
klog() << "VFS: mounted root from " << file_system.class_name() << " (" << static_cast<FileBackedFS&>(file_system).file_description().absolute_path() << ")"; dmesgln("VFS: mounted root from {} ({})", file_system.class_name(), static_cast<FileBackedFS&>(file_system).file_description().absolute_path());
m_mounts.append(move(mount)); m_mounts.append(move(mount));
return true; return true;