* Replaced the Print() macro with a direct call to kprintf().
* Before, it would incorrectly resolve to the __out() macro which was defined as dprintf() when compiled for the kernel -- this could deadlock KDL, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30614 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
8323a7cd49
commit
37e5be59a6
@ -12,8 +12,6 @@
|
||||
#include "Inode.h"
|
||||
#include "Journal.h"
|
||||
|
||||
#define Print __out
|
||||
|
||||
|
||||
char*
|
||||
get_tupel(uint32 id)
|
||||
@ -37,7 +35,7 @@ get_tupel(uint32 id)
|
||||
void
|
||||
dump_block_run(const char* prefix, const block_run& run)
|
||||
{
|
||||
Print("%s(%d, %d, %d)\n", prefix, (int)run.allocation_group, run.start,
|
||||
kprintf("%s(%d, %d, %d)\n", prefix, (int)run.allocation_group, run.start,
|
||||
run.length);
|
||||
}
|
||||
|
||||
@ -45,33 +43,33 @@ dump_block_run(const char* prefix, const block_run& run)
|
||||
void
|
||||
dump_super_block(const disk_super_block* superBlock)
|
||||
{
|
||||
Print("disk_super_block:\n");
|
||||
Print(" name = %s\n", superBlock->name);
|
||||
Print(" magic1 = %#08x (%s) %s\n", (int)superBlock->Magic1(),
|
||||
kprintf("disk_super_block:\n");
|
||||
kprintf(" name = %s\n", superBlock->name);
|
||||
kprintf(" magic1 = %#08x (%s) %s\n", (int)superBlock->Magic1(),
|
||||
get_tupel(superBlock->magic1),
|
||||
(superBlock->magic1 == SUPER_BLOCK_MAGIC1 ? "valid" : "INVALID"));
|
||||
Print(" fs_byte_order = %#08x (%s)\n", (int)superBlock->fs_byte_order,
|
||||
kprintf(" fs_byte_order = %#08x (%s)\n", (int)superBlock->fs_byte_order,
|
||||
get_tupel(superBlock->fs_byte_order));
|
||||
Print(" block_size = %u\n", (unsigned)superBlock->BlockSize());
|
||||
Print(" block_shift = %u\n", (unsigned)superBlock->BlockShift());
|
||||
Print(" num_blocks = %Lu\n", superBlock->NumBlocks());
|
||||
Print(" used_blocks = %Lu\n", superBlock->UsedBlocks());
|
||||
Print(" inode_size = %u\n", (unsigned)superBlock->InodeSize());
|
||||
Print(" magic2 = %#08x (%s) %s\n", (int)superBlock->Magic2(),
|
||||
kprintf(" block_size = %u\n", (unsigned)superBlock->BlockSize());
|
||||
kprintf(" block_shift = %u\n", (unsigned)superBlock->BlockShift());
|
||||
kprintf(" num_blocks = %Lu\n", superBlock->NumBlocks());
|
||||
kprintf(" used_blocks = %Lu\n", superBlock->UsedBlocks());
|
||||
kprintf(" inode_size = %u\n", (unsigned)superBlock->InodeSize());
|
||||
kprintf(" magic2 = %#08x (%s) %s\n", (int)superBlock->Magic2(),
|
||||
get_tupel(superBlock->magic2),
|
||||
(superBlock->magic2 == (int)SUPER_BLOCK_MAGIC2 ? "valid" : "INVALID"));
|
||||
Print(" blocks_per_ag = %u\n",
|
||||
kprintf(" blocks_per_ag = %u\n",
|
||||
(unsigned)superBlock->BlocksPerAllocationGroup());
|
||||
Print(" ag_shift = %u (%ld bytes)\n",
|
||||
kprintf(" ag_shift = %u (%ld bytes)\n",
|
||||
(unsigned)superBlock->AllocationGroupShift(),
|
||||
1L << superBlock->AllocationGroupShift());
|
||||
Print(" num_ags = %u\n", (unsigned)superBlock->AllocationGroups());
|
||||
Print(" flags = %#08x (%s)\n", (int)superBlock->Flags(),
|
||||
kprintf(" num_ags = %u\n", (unsigned)superBlock->AllocationGroups());
|
||||
kprintf(" flags = %#08x (%s)\n", (int)superBlock->Flags(),
|
||||
get_tupel(superBlock->Flags()));
|
||||
dump_block_run(" log_blocks = ", superBlock->log_blocks);
|
||||
Print(" log_start = %Lu\n", superBlock->LogStart());
|
||||
Print(" log_end = %Lu\n", superBlock->LogEnd());
|
||||
Print(" magic3 = %#08x (%s) %s\n", (int)superBlock->Magic3(),
|
||||
kprintf(" log_start = %Lu\n", superBlock->LogStart());
|
||||
kprintf(" log_end = %Lu\n", superBlock->LogEnd());
|
||||
kprintf(" magic3 = %#08x (%s) %s\n", (int)superBlock->Magic3(),
|
||||
get_tupel(superBlock->magic3),
|
||||
(superBlock->magic3 == SUPER_BLOCK_MAGIC3 ? "valid" : "INVALID"));
|
||||
dump_block_run(" root_dir = ", superBlock->root_dir);
|
||||
@ -82,76 +80,76 @@ dump_super_block(const disk_super_block* superBlock)
|
||||
void
|
||||
dump_data_stream(const data_stream* stream)
|
||||
{
|
||||
Print("data_stream:\n");
|
||||
kprintf("data_stream:\n");
|
||||
for (int i = 0; i < NUM_DIRECT_BLOCKS; i++) {
|
||||
if (!stream->direct[i].IsZero()) {
|
||||
Print(" direct[%02d] = ", i);
|
||||
kprintf(" direct[%02d] = ", i);
|
||||
dump_block_run("", stream->direct[i]);
|
||||
}
|
||||
}
|
||||
Print(" max_direct_range = %Lu\n", stream->MaxDirectRange());
|
||||
kprintf(" max_direct_range = %Lu\n", stream->MaxDirectRange());
|
||||
|
||||
if (!stream->indirect.IsZero())
|
||||
dump_block_run(" indirect = ", stream->indirect);
|
||||
|
||||
Print(" max_indirect_range = %Lu\n", stream->MaxIndirectRange());
|
||||
kprintf(" max_indirect_range = %Lu\n", stream->MaxIndirectRange());
|
||||
|
||||
if (!stream->double_indirect.IsZero()) {
|
||||
dump_block_run(" double_indirect = ",
|
||||
stream->double_indirect);
|
||||
}
|
||||
|
||||
Print(" max_double_indirect_range = %Lu\n",
|
||||
kprintf(" max_double_indirect_range = %Lu\n",
|
||||
stream->MaxDoubleIndirectRange());
|
||||
Print(" size = %Lu\n", stream->Size());
|
||||
kprintf(" size = %Lu\n", stream->Size());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dump_inode(const bfs_inode* inode)
|
||||
{
|
||||
Print("inode:\n");
|
||||
Print(" magic1 = %08x (%s) %s\n", (int)inode->Magic1(),
|
||||
kprintf("inode:\n");
|
||||
kprintf(" magic1 = %08x (%s) %s\n", (int)inode->Magic1(),
|
||||
get_tupel(inode->magic1),
|
||||
(inode->magic1 == INODE_MAGIC1 ? "valid" : "INVALID"));
|
||||
dump_block_run( " inode_num = ", inode->inode_num);
|
||||
Print(" uid = %u\n", (unsigned)inode->UserID());
|
||||
Print(" gid = %u\n", (unsigned)inode->GroupID());
|
||||
Print(" mode = %08x\n", (int)inode->Mode());
|
||||
Print(" flags = %08x\n", (int)inode->Flags());
|
||||
Print(" create_time = %Ld (%Ld)\n", inode->CreateTime(),
|
||||
kprintf(" uid = %u\n", (unsigned)inode->UserID());
|
||||
kprintf(" gid = %u\n", (unsigned)inode->GroupID());
|
||||
kprintf(" mode = %08x\n", (int)inode->Mode());
|
||||
kprintf(" flags = %08x\n", (int)inode->Flags());
|
||||
kprintf(" create_time = %Ld (%Ld)\n", inode->CreateTime(),
|
||||
inode->CreateTime() >> INODE_TIME_SHIFT);
|
||||
Print(" last_modified_time = %Ld (%Ld)\n", inode->LastModifiedTime(),
|
||||
kprintf(" last_modified_time = %Ld (%Ld)\n", inode->LastModifiedTime(),
|
||||
inode->LastModifiedTime() >> INODE_TIME_SHIFT);
|
||||
dump_block_run( " parent = ", inode->parent);
|
||||
dump_block_run( " attributes = ", inode->attributes);
|
||||
Print(" type = %u\n", (unsigned)inode->Type());
|
||||
Print(" inode_size = %u\n", (unsigned)inode->InodeSize());
|
||||
Print(" short_symlink = %s\n",
|
||||
kprintf(" type = %u\n", (unsigned)inode->Type());
|
||||
kprintf(" inode_size = %u\n", (unsigned)inode->InodeSize());
|
||||
kprintf(" short_symlink = %s\n",
|
||||
S_ISLNK(inode->Mode()) && (inode->Flags() & INODE_LONG_SYMLINK) == 0
|
||||
? inode->short_symlink : "-");
|
||||
dump_data_stream(&(inode->data));
|
||||
Print(" --\n pad[0] = %08x\n", (int)inode->pad[0]);
|
||||
Print(" pad[1] = %08x\n", (int)inode->pad[1]);
|
||||
Print(" pad[2] = %08x\n", (int)inode->pad[2]);
|
||||
Print(" pad[3] = %08x\n", (int)inode->pad[3]);
|
||||
kprintf(" --\n pad[0] = %08x\n", (int)inode->pad[0]);
|
||||
kprintf(" pad[1] = %08x\n", (int)inode->pad[1]);
|
||||
kprintf(" pad[2] = %08x\n", (int)inode->pad[2]);
|
||||
kprintf(" pad[3] = %08x\n", (int)inode->pad[3]);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dump_bplustree_header(const bplustree_header* header)
|
||||
{
|
||||
Print("bplustree_header:\n");
|
||||
Print(" magic = %#08x (%s) %s\n", (int)header->Magic(),
|
||||
kprintf("bplustree_header:\n");
|
||||
kprintf(" magic = %#08x (%s) %s\n", (int)header->Magic(),
|
||||
get_tupel(header->magic),
|
||||
(header->magic == BPLUSTREE_MAGIC ? "valid" : "INVALID"));
|
||||
Print(" node_size = %u\n", (unsigned)header->NodeSize());
|
||||
Print(" max_number_of_levels = %u\n",
|
||||
kprintf(" node_size = %u\n", (unsigned)header->NodeSize());
|
||||
kprintf(" max_number_of_levels = %u\n",
|
||||
(unsigned)header->MaxNumberOfLevels());
|
||||
Print(" data_type = %u\n", (unsigned)header->DataType());
|
||||
Print(" root_node_pointer = %Ld\n", header->RootNode());
|
||||
Print(" free_node_pointer = %Ld\n", header->FreeNode());
|
||||
Print(" maximum_size = %Lu\n", header->MaximumSize());
|
||||
kprintf(" data_type = %u\n", (unsigned)header->DataType());
|
||||
kprintf(" root_node_pointer = %Ld\n", header->RootNode());
|
||||
kprintf(" free_node_pointer = %Ld\n", header->FreeNode());
|
||||
kprintf(" maximum_size = %Lu\n", header->MaximumSize());
|
||||
}
|
||||
|
||||
|
||||
@ -165,27 +163,27 @@ dump_block(const char* buffer,int size)
|
||||
|
||||
for (; i < start + DUMPED_BLOCK_SIZE; i++) {
|
||||
if (!(i % 4))
|
||||
Print(" ");
|
||||
kprintf(" ");
|
||||
|
||||
if (i >= size)
|
||||
Print(" ");
|
||||
kprintf(" ");
|
||||
else
|
||||
Print("%02x", *(unsigned char *)(buffer + i));
|
||||
kprintf("%02x", *(unsigned char *)(buffer + i));
|
||||
}
|
||||
Print(" ");
|
||||
kprintf(" ");
|
||||
|
||||
for (i = start; i < start + DUMPED_BLOCK_SIZE; i++) {
|
||||
if (i < size) {
|
||||
char c = *(buffer + i);
|
||||
|
||||
if (c < 30)
|
||||
Print(".");
|
||||
kprintf(".");
|
||||
else
|
||||
Print("%c", c);
|
||||
kprintf("%c", c);
|
||||
} else
|
||||
break;
|
||||
}
|
||||
Print("\n");
|
||||
kprintf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,12 +192,12 @@ void
|
||||
dump_bplustree_node(const bplustree_node* node, const bplustree_header* header,
|
||||
Volume* volume)
|
||||
{
|
||||
Print("bplustree_node:\n");
|
||||
Print(" left_link = %Ld\n", node->left_link);
|
||||
Print(" right_link = %Ld\n", node->right_link);
|
||||
Print(" overflow_link = %Ld\n", node->overflow_link);
|
||||
Print(" all_key_count = %u\n", node->all_key_count);
|
||||
Print(" all_key_length = %u\n", node->all_key_length);
|
||||
kprintf("bplustree_node:\n");
|
||||
kprintf(" left_link = %Ld\n", node->left_link);
|
||||
kprintf(" right_link = %Ld\n", node->right_link);
|
||||
kprintf(" overflow_link = %Ld\n", node->overflow_link);
|
||||
kprintf(" all_key_count = %u\n", node->all_key_count);
|
||||
kprintf(" all_key_length = %u\n", node->all_key_length);
|
||||
|
||||
if (header == NULL)
|
||||
return;
|
||||
@ -207,17 +205,17 @@ dump_bplustree_node(const bplustree_node* node, const bplustree_header* header,
|
||||
if (node->all_key_count > node->all_key_length
|
||||
|| uint32(node->all_key_count * 10) > (uint32)header->node_size
|
||||
|| node->all_key_count == 0) {
|
||||
Print("\n");
|
||||
kprintf("\n");
|
||||
dump_block((char *)node, header->node_size/*, sizeof(off_t)*/);
|
||||
return;
|
||||
}
|
||||
|
||||
Print("\n");
|
||||
kprintf("\n");
|
||||
for (int32 i = 0;i < node->all_key_count;i++) {
|
||||
uint16 length;
|
||||
char buffer[256], *key = (char *)node->KeyAt(i, &length);
|
||||
if (length > 255 || length == 0) {
|
||||
Print(" %2d. Invalid length (%u)!!\n", (int)i, length);
|
||||
kprintf(" %2d. Invalid length (%u)!!\n", (int)i, length);
|
||||
dump_block((char *)node, header->node_size/*, sizeof(off_t)*/);
|
||||
break;
|
||||
}
|
||||
@ -227,37 +225,37 @@ dump_bplustree_node(const bplustree_node* node, const bplustree_header* header,
|
||||
off_t* value = node->Values() + i;
|
||||
if ((addr_t)value < (addr_t)node
|
||||
|| (addr_t)value > (addr_t)node + header->node_size)
|
||||
Print(" %2d. Invalid Offset!!\n", (int)i);
|
||||
kprintf(" %2d. Invalid Offset!!\n", (int)i);
|
||||
else {
|
||||
Print(" %2d. ", (int)i);
|
||||
kprintf(" %2d. ", (int)i);
|
||||
if (header->data_type == BPLUSTREE_STRING_TYPE)
|
||||
Print("\"%s\"", buffer);
|
||||
kprintf("\"%s\"", buffer);
|
||||
else if (header->data_type == BPLUSTREE_INT32_TYPE) {
|
||||
Print("int32 = %d (0x%x)", (int)*(int32 *)&buffer,
|
||||
kprintf("int32 = %d (0x%x)", (int)*(int32 *)&buffer,
|
||||
(int)*(int32 *)&buffer);
|
||||
} else if (header->data_type == BPLUSTREE_UINT32_TYPE) {
|
||||
Print("uint32 = %u (0x%x)", (unsigned)*(uint32 *)&buffer,
|
||||
kprintf("uint32 = %u (0x%x)", (unsigned)*(uint32 *)&buffer,
|
||||
(unsigned)*(uint32 *)&buffer);
|
||||
} else if (header->data_type == BPLUSTREE_INT64_TYPE) {
|
||||
Print("int64 = %Ld (0x%Lx)", *(int64 *)&buffer,
|
||||
kprintf("int64 = %Ld (0x%Lx)", *(int64 *)&buffer,
|
||||
*(int64 *)&buffer);
|
||||
} else
|
||||
Print("???");
|
||||
kprintf("???");
|
||||
|
||||
off_t offset = *value & 0x3fffffffffffffffLL;
|
||||
Print(" (%d bytes) -> %Ld", length, offset);
|
||||
kprintf(" (%d bytes) -> %Ld", length, offset);
|
||||
if (volume != NULL) {
|
||||
block_run run = volume->ToBlockRun(offset);
|
||||
Print(" (%d, %d)", (int)run.allocation_group, run.start);
|
||||
kprintf(" (%d, %d)", (int)run.allocation_group, run.start);
|
||||
}
|
||||
if (bplustree_node::LinkType(*value)
|
||||
== BPLUSTREE_DUPLICATE_FRAGMENT)
|
||||
Print(" (duplicate fragment %Ld)\n", *value & 0x3ff);
|
||||
kprintf(" (duplicate fragment %Ld)\n", *value & 0x3ff);
|
||||
else if (bplustree_node::LinkType(*value)
|
||||
== BPLUSTREE_DUPLICATE_NODE)
|
||||
Print(" (duplicate node)\n");
|
||||
kprintf(" (duplicate node)\n");
|
||||
else
|
||||
Print("\n");
|
||||
kprintf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user