Fixed some warnings (due to -Wall).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2840 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
adf71bf608
commit
cdeaad9578
@ -65,7 +65,7 @@ BufferPool::RequestBuffers(uint32 blockSize)
|
|||||||
|
|
||||||
// allocate and connect buffers
|
// allocate and connect buffers
|
||||||
|
|
||||||
for (int32 i = 0; i < kNumBuffers; i++) {
|
for (uint32 i = 0; i < kNumBuffers; i++) {
|
||||||
buffers[i] = (void **)malloc(blockSize);
|
buffers[i] = (void **)malloc(blockSize);
|
||||||
if (buffers[i] == NULL) {
|
if (buffers[i] == NULL) {
|
||||||
// free already allocated buffers
|
// free already allocated buffers
|
||||||
@ -86,7 +86,7 @@ BufferPool::RequestBuffers(uint32 blockSize)
|
|||||||
release_sem(fLock);
|
release_sem(fLock);
|
||||||
release_sem_etc(fFreeBuffers, kNumBuffers, B_DO_NOT_RESCHEDULE);
|
release_sem_etc(fFreeBuffers, kNumBuffers, B_DO_NOT_RESCHEDULE);
|
||||||
} else {
|
} else {
|
||||||
for (int32 i = 0; i < kNumBuffers; i++)
|
for (uint32 i = 0; i < kNumBuffers; i++)
|
||||||
free(buffers[i]);
|
free(buffers[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ BufferPool::ReleaseBuffers()
|
|||||||
return status;
|
return status;
|
||||||
|
|
||||||
void **buffer = fFirstFree;
|
void **buffer = fFirstFree;
|
||||||
for (int32 i = 0; i < kNumBuffers && buffer; i++) {
|
for (uint32 i = 0; i < kNumBuffers && buffer; i++) {
|
||||||
void **nextBuffer = (void **)*buffer;
|
void **nextBuffer = (void **)*buffer;
|
||||||
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
@ -27,18 +27,19 @@ get_tupel(uint32 id)
|
|||||||
tupel[2] = 0xff & (id >> 8);
|
tupel[2] = 0xff & (id >> 8);
|
||||||
tupel[3] = 0xff & (id);
|
tupel[3] = 0xff & (id);
|
||||||
tupel[4] = 0;
|
tupel[4] = 0;
|
||||||
for (int16 i = 0;i < 4;i++)
|
for (int16 i = 0;i < 4;i++) {
|
||||||
if (tupel[i] < ' ' || tupel[i] > 128)
|
if (tupel[i] < ' ' || tupel[i] > 128)
|
||||||
tupel[i] = '.';
|
tupel[i] = '.';
|
||||||
|
}
|
||||||
|
|
||||||
return (char *)tupel;
|
return (char *)tupel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
dump_block_run(const char *prefix,block_run &run)
|
dump_block_run(const char *prefix, block_run &run)
|
||||||
{
|
{
|
||||||
Print("%s(%ld, %d, %d)\n",prefix,run.allocation_group,run.start,run.length);
|
Print("%s(%ld, %d, %d)\n", prefix, run.allocation_group, run.start, run.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -46,25 +47,25 @@ void
|
|||||||
dump_super_block(disk_super_block *superBlock)
|
dump_super_block(disk_super_block *superBlock)
|
||||||
{
|
{
|
||||||
Print("disk_super_block:\n");
|
Print("disk_super_block:\n");
|
||||||
Print(" name = %s\n",superBlock->name);
|
Print(" name = %s\n", superBlock->name);
|
||||||
Print(" magic1 = %#08lx (%s) %s\n",superBlock->magic1, get_tupel(superBlock->magic1), (superBlock->magic1 == SUPER_BLOCK_MAGIC1 ? "valid" : "INVALID"));
|
Print(" magic1 = %#08lx (%s) %s\n", superBlock->magic1, get_tupel(superBlock->magic1), (superBlock->magic1 == SUPER_BLOCK_MAGIC1 ? "valid" : "INVALID"));
|
||||||
Print(" fs_byte_order = %#08lx (%s)\n",superBlock->fs_byte_order, get_tupel(superBlock->fs_byte_order));
|
Print(" fs_byte_order = %#08lx (%s)\n", superBlock->fs_byte_order, get_tupel(superBlock->fs_byte_order));
|
||||||
Print(" block_size = %lu\n",superBlock->block_size);
|
Print(" block_size = %lu\n", superBlock->block_size);
|
||||||
Print(" block_shift = %lu\n",superBlock->block_shift);
|
Print(" block_shift = %lu\n", superBlock->block_shift);
|
||||||
Print(" num_blocks = %Lu\n",superBlock->num_blocks);
|
Print(" num_blocks = %Lu\n", superBlock->num_blocks);
|
||||||
Print(" used_blocks = %Lu\n",superBlock->used_blocks);
|
Print(" used_blocks = %Lu\n", superBlock->used_blocks);
|
||||||
Print(" inode_size = %lu\n",superBlock->inode_size);
|
Print(" inode_size = %lu\n", superBlock->inode_size);
|
||||||
Print(" magic2 = %#08lx (%s) %s\n",superBlock->magic2, get_tupel(superBlock->magic2), (superBlock->magic2 == (int)SUPER_BLOCK_MAGIC2 ? "valid" : "INVALID"));
|
Print(" magic2 = %#08lx (%s) %s\n", superBlock->magic2, get_tupel(superBlock->magic2), (superBlock->magic2 == (int)SUPER_BLOCK_MAGIC2 ? "valid" : "INVALID"));
|
||||||
Print(" blocks_per_ag = %lu\n",superBlock->blocks_per_ag);
|
Print(" blocks_per_ag = %lu\n", superBlock->blocks_per_ag);
|
||||||
Print(" ag_shift = %lu (%ld bytes)\n",superBlock->ag_shift, 1LL << superBlock->ag_shift);
|
Print(" ag_shift = %lu (%ld bytes)\n", superBlock->ag_shift, 1L << superBlock->ag_shift);
|
||||||
Print(" num_ags = %lu\n",superBlock->num_ags);
|
Print(" num_ags = %lu\n", superBlock->num_ags);
|
||||||
Print(" flags = %#08lx (%s)\n",superBlock->flags, get_tupel(superBlock->flags));
|
Print(" flags = %#08lx (%s)\n", superBlock->flags, get_tupel(superBlock->flags));
|
||||||
dump_block_run(" log_blocks = ",superBlock->log_blocks);
|
dump_block_run(" log_blocks = ", superBlock->log_blocks);
|
||||||
Print(" log_start = %Lu\n",superBlock->log_start);
|
Print(" log_start = %Lu\n", superBlock->log_start);
|
||||||
Print(" log_end = %Lu\n",superBlock->log_end);
|
Print(" log_end = %Lu\n", superBlock->log_end);
|
||||||
Print(" magic3 = %#08lx (%s) %s\n",superBlock->magic3, get_tupel(superBlock->magic3), (superBlock->magic3 == SUPER_BLOCK_MAGIC3 ? "valid" : "INVALID"));
|
Print(" magic3 = %#08lx (%s) %s\n", superBlock->magic3, get_tupel(superBlock->magic3), (superBlock->magic3 == SUPER_BLOCK_MAGIC3 ? "valid" : "INVALID"));
|
||||||
dump_block_run(" root_dir = ",superBlock->root_dir);
|
dump_block_run(" root_dir = ", superBlock->root_dir);
|
||||||
dump_block_run(" indices = ",superBlock->indices);
|
dump_block_run(" indices = ", superBlock->indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -78,46 +79,49 @@ dump_data_stream(data_stream *stream)
|
|||||||
dump_block_run("",stream->direct[i]);
|
dump_block_run("",stream->direct[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Print(" max_direct_range = %Lu\n",stream->max_direct_range);
|
Print(" max_direct_range = %Lu\n", stream->max_direct_range);
|
||||||
|
|
||||||
if (!stream->indirect.IsZero())
|
if (!stream->indirect.IsZero())
|
||||||
dump_block_run(" indirect = ",stream->indirect);
|
dump_block_run(" indirect = ", stream->indirect);
|
||||||
|
|
||||||
Print(" max_indirect_range = %Lu\n",stream->max_indirect_range);
|
Print(" max_indirect_range = %Lu\n", stream->max_indirect_range);
|
||||||
|
|
||||||
if (!stream->double_indirect.IsZero())
|
if (!stream->double_indirect.IsZero())
|
||||||
dump_block_run(" double_indirect = ",stream->double_indirect);
|
dump_block_run(" double_indirect = ", stream->double_indirect);
|
||||||
|
|
||||||
Print(" max_double_indirect_range = %Lu\n",stream->max_double_indirect_range);
|
Print(" max_double_indirect_range = %Lu\n", stream->max_double_indirect_range);
|
||||||
Print(" size = %Lu\n",stream->size);
|
Print(" size = %Lu\n", stream->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
dump_inode(bfs_inode *inode)
|
dump_inode(bfs_inode *inode)
|
||||||
{
|
{
|
||||||
Print("inode:\n");
|
Print("inode:\n");
|
||||||
Print(" magic1 = %08lx (%s) %s\n",inode->magic1,
|
Print(" magic1 = %08lx (%s) %s\n", inode->magic1,
|
||||||
get_tupel(inode->magic1), (inode->magic1 == INODE_MAGIC1 ? "valid" : "INVALID"));
|
get_tupel(inode->magic1), (inode->magic1 == INODE_MAGIC1 ? "valid" : "INVALID"));
|
||||||
dump_block_run( " inode_num = ",inode->inode_num);
|
dump_block_run( " inode_num = ", inode->inode_num);
|
||||||
Print(" uid = %lu\n",inode->uid);
|
Print(" uid = %lu\n", inode->uid);
|
||||||
Print(" gid = %lu\n",inode->gid);
|
Print(" gid = %lu\n", inode->gid);
|
||||||
Print(" mode = %08lx\n",inode->mode);
|
Print(" mode = %08lx\n", inode->mode);
|
||||||
Print(" flags = %08lx\n",inode->flags);
|
Print(" flags = %08lx\n", inode->flags);
|
||||||
Print(" create_time = %Ld (%Ld)\n",inode->create_time,inode->create_time >> INODE_TIME_SHIFT);
|
Print(" create_time = %Ld (%Ld)\n", inode->create_time,
|
||||||
Print(" last_modified_time = %Ld (%Ld)\n",inode->last_modified_time,inode->last_modified_time >> INODE_TIME_SHIFT);
|
inode->create_time >> INODE_TIME_SHIFT);
|
||||||
dump_block_run( " parent = ",inode->parent);
|
Print(" last_modified_time = %Ld (%Ld)\n", inode->last_modified_time,
|
||||||
dump_block_run( " attributes = ",inode->attributes);
|
inode->last_modified_time >> INODE_TIME_SHIFT);
|
||||||
Print(" type = %lu\n",inode->type);
|
dump_block_run( " parent = ", inode->parent);
|
||||||
Print(" inode_size = %lu\n",inode->inode_size);
|
dump_block_run( " attributes = ", inode->attributes);
|
||||||
Print(" etc = %#08lx\n",inode->etc);
|
Print(" type = %lu\n", inode->type);
|
||||||
|
Print(" inode_size = %lu\n", inode->inode_size);
|
||||||
|
Print(" etc = %#08lx\n", inode->etc);
|
||||||
Print(" short_symlink = %s\n",
|
Print(" short_symlink = %s\n",
|
||||||
S_ISLNK(inode->mode) && (inode->flags & INODE_LONG_SYMLINK) == 0? inode->short_symlink : "-");
|
S_ISLNK(inode->mode) && (inode->flags & INODE_LONG_SYMLINK) == 0 ?
|
||||||
|
inode->short_symlink : "-");
|
||||||
dump_data_stream(&(inode->data));
|
dump_data_stream(&(inode->data));
|
||||||
Print(" --\n pad[0] = %08lx\n",inode->pad[0]);
|
Print(" --\n pad[0] = %08lx\n", inode->pad[0]);
|
||||||
Print(" pad[1] = %08lx\n",inode->pad[1]);
|
Print(" pad[1] = %08lx\n", inode->pad[1]);
|
||||||
Print(" pad[2] = %08lx\n",inode->pad[2]);
|
Print(" pad[2] = %08lx\n", inode->pad[2]);
|
||||||
Print(" pad[3] = %08lx\n",inode->pad[3]);
|
Print(" pad[3] = %08lx\n", inode->pad[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -125,14 +129,14 @@ void
|
|||||||
dump_bplustree_header(bplustree_header *header)
|
dump_bplustree_header(bplustree_header *header)
|
||||||
{
|
{
|
||||||
Print("bplustree_header:\n");
|
Print("bplustree_header:\n");
|
||||||
Print(" magic = %#08lx (%s) %s\n",header->magic,
|
Print(" magic = %#08lx (%s) %s\n", header->magic,
|
||||||
get_tupel(header->magic), (header->magic == BPLUSTREE_MAGIC ? "valid" : "INVALID"));
|
get_tupel(header->magic), (header->magic == BPLUSTREE_MAGIC ? "valid" : "INVALID"));
|
||||||
Print(" node_size = %lu\n",header->node_size);
|
Print(" node_size = %lu\n", header->node_size);
|
||||||
Print(" max_number_of_levels = %lu\n",header->max_number_of_levels);
|
Print(" max_number_of_levels = %lu\n", header->max_number_of_levels);
|
||||||
Print(" data_type = %lu\n",header->data_type);
|
Print(" data_type = %lu\n", header->data_type);
|
||||||
Print(" root_node_pointer = %Ld\n",header->root_node_pointer);
|
Print(" root_node_pointer = %Ld\n", header->root_node_pointer);
|
||||||
Print(" free_node_pointer = %Ld\n",header->free_node_pointer);
|
Print(" free_node_pointer = %Ld\n", header->free_node_pointer);
|
||||||
Print(" maximum_size = %Lu\n",header->maximum_size);
|
Print(" maximum_size = %Lu\n", header->maximum_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -163,8 +167,7 @@ dump_block(const char *buffer,int size)
|
|||||||
Print(".");
|
Print(".");
|
||||||
else
|
else
|
||||||
Print("%c",c);
|
Print("%c",c);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Print("\n");
|
Print("\n");
|
||||||
@ -176,12 +179,12 @@ void
|
|||||||
dump_bplustree_node(bplustree_node *node,bplustree_header *header,Volume *volume)
|
dump_bplustree_node(bplustree_node *node,bplustree_header *header,Volume *volume)
|
||||||
{
|
{
|
||||||
Print("bplustree_node:\n");
|
Print("bplustree_node:\n");
|
||||||
Print(" left_link = %Ld\n",node->left_link);
|
Print(" left_link = %Ld\n", node->left_link);
|
||||||
Print(" right_link = %Ld\n",node->right_link);
|
Print(" right_link = %Ld\n", node->right_link);
|
||||||
Print(" overflow_link = %Ld\n",node->overflow_link);
|
Print(" overflow_link = %Ld\n", node->overflow_link);
|
||||||
Print(" all_key_count = %u\n",node->all_key_count);
|
Print(" all_key_count = %u\n", node->all_key_count);
|
||||||
Print(" all_key_length = %u\n",node->all_key_length);
|
Print(" all_key_length = %u\n", node->all_key_length);
|
||||||
|
|
||||||
if (header == NULL)
|
if (header == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -189,47 +192,46 @@ dump_bplustree_node(bplustree_node *node,bplustree_header *header,Volume *volume
|
|||||||
|| uint32(node->all_key_count * 10) > (uint32)header->node_size
|
|| uint32(node->all_key_count * 10) > (uint32)header->node_size
|
||||||
|| node->all_key_count == 0) {
|
|| node->all_key_count == 0) {
|
||||||
Print("\n");
|
Print("\n");
|
||||||
dump_block((char *)node,header->node_size/*,sizeof(off_t)*/);
|
dump_block((char *)node, header->node_size/*, sizeof(off_t)*/);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Print("\n");
|
Print("\n");
|
||||||
for (int32 i = 0;i < node->all_key_count;i++) {
|
for (int32 i = 0;i < node->all_key_count;i++) {
|
||||||
uint16 length;
|
uint16 length;
|
||||||
char buffer[256],*key = (char *)node->KeyAt(i,&length);
|
char buffer[256], *key = (char *)node->KeyAt(i, &length);
|
||||||
if (length > 255 || length == 0) {
|
if (length > 255 || length == 0) {
|
||||||
Print(" %2ld. Invalid length (%u)!!\n",i,length);
|
Print(" %2ld. Invalid length (%u)!!\n", i, length);
|
||||||
dump_block((char *)node,header->node_size/*,sizeof(off_t)*/);
|
dump_block((char *)node, header->node_size/*, sizeof(off_t)*/);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
memcpy(buffer,key,length);
|
memcpy(buffer, key, length);
|
||||||
buffer[length] = '\0';
|
buffer[length] = '\0';
|
||||||
|
|
||||||
off_t *value = node->Values() + i;
|
off_t *value = node->Values() + i;
|
||||||
if ((uint32)value < (uint32)node || (uint32)value > (uint32)node + header->node_size)
|
if ((uint32)value < (uint32)node || (uint32)value > (uint32)node + header->node_size)
|
||||||
Print(" %2ld. Invalid Offset!!\n",i);
|
Print(" %2ld. Invalid Offset!!\n", i);
|
||||||
else {
|
else {
|
||||||
Print(" %2ld. ",i);
|
Print(" %2ld. ", i);
|
||||||
if (header->data_type == BPLUSTREE_STRING_TYPE)
|
if (header->data_type == BPLUSTREE_STRING_TYPE)
|
||||||
Print("\"%s\"",buffer);
|
Print("\"%s\"", buffer);
|
||||||
else if (header->data_type == BPLUSTREE_INT32_TYPE)
|
else if (header->data_type == BPLUSTREE_INT32_TYPE)
|
||||||
Print("int32 = %ld (0x%lx)",*(int32 *)&buffer,*(int32 *)&buffer);
|
Print("int32 = %ld (0x%lx)", *(int32 *)&buffer, *(int32 *)&buffer);
|
||||||
else if (header->data_type == BPLUSTREE_UINT32_TYPE)
|
else if (header->data_type == BPLUSTREE_UINT32_TYPE)
|
||||||
Print("uint32 = %lu (0x%lx)",*(uint32 *)&buffer,*(uint32 *)&buffer);
|
Print("uint32 = %lu (0x%lx)", *(uint32 *)&buffer, *(uint32 *)&buffer);
|
||||||
else if (header->data_type == BPLUSTREE_INT64_TYPE)
|
else if (header->data_type == BPLUSTREE_INT64_TYPE)
|
||||||
Print("int64 = %Ld (0x%Lx)",*(int64 *)&buffer,*(int64 *)&buffer);
|
Print("int64 = %Ld (0x%Lx)", *(int64 *)&buffer, *(int64 *)&buffer);
|
||||||
else
|
else
|
||||||
Print("???");
|
Print("???");
|
||||||
|
|
||||||
off_t offset = *value & 0x3fffffffffffffffLL;
|
off_t offset = *value & 0x3fffffffffffffffLL;
|
||||||
Print(" (%d bytes) -> %Ld",length,offset);
|
Print(" (%d bytes) -> %Ld", length, offset);
|
||||||
if (volume != NULL)
|
if (volume != NULL) {
|
||||||
{
|
|
||||||
block_run run = volume->ToBlockRun(offset);
|
block_run run = volume->ToBlockRun(offset);
|
||||||
Print(" (%ld, %d)",run.allocation_group,run.start);
|
Print(" (%ld, %d)", run.allocation_group, run.start);
|
||||||
}
|
}
|
||||||
if (bplustree_node::LinkType(*value) == BPLUSTREE_DUPLICATE_FRAGMENT)
|
if (bplustree_node::LinkType(*value) == BPLUSTREE_DUPLICATE_FRAGMENT)
|
||||||
Print(" (duplicate fragment %Ld)\n",*value & 0x3ff);
|
Print(" (duplicate fragment %Ld)\n", *value & 0x3ff);
|
||||||
else if (bplustree_node::LinkType(*value) == BPLUSTREE_DUPLICATE_NODE)
|
else if (bplustree_node::LinkType(*value) == BPLUSTREE_DUPLICATE_NODE)
|
||||||
Print(" (duplicate node)\n");
|
Print(" (duplicate node)\n");
|
||||||
else
|
else
|
||||||
@ -238,4 +240,3 @@ dump_bplustree_node(bplustree_node *node,bplustree_header *header,Volume *volume
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,8 +76,8 @@ sorted_array::Remove(off_t value)
|
|||||||
BlockArray::BlockArray(int32 blockSize)
|
BlockArray::BlockArray(int32 blockSize)
|
||||||
:
|
:
|
||||||
fArray(NULL),
|
fArray(NULL),
|
||||||
fSize(0),
|
fBlockSize(blockSize),
|
||||||
fBlockSize(blockSize)
|
fSize(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user