* Prepared the BFS sources to be used with the new FS shell:

- Moved all inclusions of system headers into a new
    system_dependencies.h header, which conditionally either includes
    these or the FS shell headers.
  - Fixed compiler warnings related to printf-like functions (int32 is
    int, not long on non-BeOS platforms).
* Build a new bfs_shell. Compiles and links, but does nothing ATM.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20860 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2007-04-27 12:25:49 +00:00
parent a38a92c955
commit c391f84b2c
28 changed files with 160 additions and 181 deletions
@@ -6,7 +6,6 @@
#include "Attribute.h" #include "Attribute.h"
#include <stdlib.h>
// ToDo: clean this up, find a better separation between Inode and this class // ToDo: clean this up, find a better separation between Inode and this class
@@ -13,14 +13,6 @@
#include "Inode.h" #include "Inode.h"
#include "Utility.h" #include "Utility.h"
#include <util/kernel_cpp.h>
#include <util/Stack.h>
#include <TypeConstants.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef DEBUG #ifdef DEBUG
class NodeChecker { class NodeChecker {
@@ -795,8 +787,8 @@ BPlusTree::InsertDuplicate(Transaction &transaction, CachedNode &cached,
duplicate_array *array = duplicate->FragmentAt(bplustree_node::FragmentIndex(oldValue)); duplicate_array *array = duplicate->FragmentAt(bplustree_node::FragmentIndex(oldValue));
if (array->count > NUM_FRAGMENT_VALUES if (array->count > NUM_FRAGMENT_VALUES
|| array->count < 1) { || array->count < 1) {
FATAL(("insertDuplicate: Invalid array[%ld] size in fragment %Ld == %Ld!\n", FATAL(("insertDuplicate: Invalid array[%d] size in fragment %Ld == %Ld!\n",
bplustree_node::FragmentIndex(oldValue), (int)bplustree_node::FragmentIndex(oldValue),
bplustree_node::FragmentOffset(oldValue), bplustree_node::FragmentOffset(oldValue),
array->count)); array->count));
return B_BAD_DATA; return B_BAD_DATA;
@@ -1365,8 +1357,8 @@ BPlusTree::RemoveDuplicate(Transaction &transaction, const bplustree_node *node,
if (array->count > NUM_FRAGMENT_VALUES if (array->count > NUM_FRAGMENT_VALUES
|| array->count < 1) { || array->count < 1) {
FATAL(("removeDuplicate: Invalid array[%ld] size in fragment %Ld == %Ld!\n", FATAL(("removeDuplicate: Invalid array[%d] size in fragment %Ld == %Ld!\n",
bplustree_node::FragmentIndex(oldValue), duplicateOffset, array->count)); (int)bplustree_node::FragmentIndex(oldValue), duplicateOffset, array->count));
return B_BAD_DATA; return B_BAD_DATA;
} }
if (!array->Remove(value)) { if (!array->Remove(value)) {
@@ -1549,8 +1541,8 @@ BPlusTree::RemoveKey(bplustree_node *node, uint16 index)
uint8 *key = node->KeyAt(index, &length); uint8 *key = node->KeyAt(index, &length);
if (key + length + sizeof(off_t) + sizeof(uint16) > (uint8 *)node + fNodeSize if (key + length + sizeof(off_t) + sizeof(uint16) > (uint8 *)node + fNodeSize
|| length > BPLUSTREE_MAX_KEY_LENGTH) { || length > BPLUSTREE_MAX_KEY_LENGTH) {
FATAL(("Key length to long: %s, %u (inode at %ld,%u)\n", key, length, FATAL(("Key length to long: %s, %u (inode at %d,%u)\n", key, length,
fStream->BlockRun().allocation_group, fStream->BlockRun().start)); (int)fStream->BlockRun().allocation_group, fStream->BlockRun().start));
fStream->GetVolume()->Panic(); fStream->GetVolume()->Panic();
return; return;
} }
@@ -14,8 +14,6 @@
#include "Journal.h" #include "Journal.h"
#include "Chain.h" #include "Chain.h"
#include <string.h>
//****************** on-disk structures ******************** //****************** on-disk structures ********************
@@ -12,9 +12,7 @@
#include "BPlusTree.h" #include "BPlusTree.h"
#include "bfs_control.h" #include "bfs_control.h"
#include <util/Stack.h> #include "system_dependencies.h"
#include <util/kernel_cpp.h>
#include <stdlib.h>
#ifdef USER #ifdef USER
# define spawn_kernel_thread spawn_thread # define spawn_kernel_thread spawn_thread
@@ -161,7 +159,7 @@ AllocationBlock::Allocate(uint16 start, uint16 numBlocks)
#endif #endif
if (uint32(start + numBlocks) > fNumBits) { if (uint32(start + numBlocks) > fNumBits) {
FATAL(("Allocation::Allocate(): tried to allocate too many blocks: %u (numBlocks = %lu)!\n", numBlocks, fNumBits)); FATAL(("Allocation::Allocate(): tried to allocate too many blocks: %u (numBlocks = %u)!\n", numBlocks, (unsigned)fNumBits));
DIE(("Allocation::Allocate(): tried to allocate too many blocks")); DIE(("Allocation::Allocate(): tried to allocate too many blocks"));
} }
@@ -195,7 +193,7 @@ AllocationBlock::Free(uint16 start, uint16 numBlocks)
#endif #endif
if (uint32(start + numBlocks) > fNumBits) { if (uint32(start + numBlocks) > fNumBits) {
FATAL(("Allocation::Free(): tried to free too many blocks: %u (numBlocks = %lu)!\n", numBlocks, fNumBits)); FATAL(("Allocation::Free(): tried to free too many blocks: %u (numBlocks = %u)!\n", numBlocks, (unsigned)fNumBits));
DIE(("Allocation::Free(): tried to free too many blocks")); DIE(("Allocation::Free(): tried to free too many blocks"));
} }
@@ -736,13 +734,13 @@ BlockAllocator::Free(Transaction &transaction, block_run run)
|| start > fGroups[group].NumBits() || start > fGroups[group].NumBits()
|| uint32(start + length) > fGroups[group].NumBits() || uint32(start + length) > fGroups[group].NumBits()
|| length == 0) { || length == 0) {
FATAL(("tried to free an invalid block_run (%ld, %u, %u)\n", group, start, length)); FATAL(("tried to free an invalid block_run (%d, %u, %u)\n", (int)group, start, length));
DEBUGGER(("tried to free invalid block_run")); DEBUGGER(("tried to free invalid block_run"));
return B_BAD_VALUE; return B_BAD_VALUE;
} }
// check if someone tries to free reserved areas at the beginning of the drive // check if someone tries to free reserved areas at the beginning of the drive
if (group == 0 && start < uint32(fVolume->Log().Start() + fVolume->Log().Length())) { if (group == 0 && start < uint32(fVolume->Log().Start() + fVolume->Log().Length())) {
FATAL(("tried to free a reserved block_run (%ld, %u, %u)\n", group, start, length)); FATAL(("tried to free a reserved block_run (%d, %u, %u)\n", (int)group, start, length));
DEBUGGER(("tried to free reserved block")); DEBUGGER(("tried to free reserved block"));
return B_BAD_VALUE; return B_BAD_VALUE;
} }
@@ -1161,8 +1159,8 @@ BlockAllocator::CheckBlockRun(block_run run, const char *type, check_control *co
control->stats.already_set++; control->stats.already_set++;
} else { } else {
if (firstSet != -1) { if (firstSet != -1) {
FATAL(("%s: block_run(%ld, %u, %u): blocks %Ld - %Ld are already set!\n", FATAL(("%s: block_run(%d, %u, %u): blocks %Ld - %Ld are already set!\n",
type, run.AllocationGroup(), run.Start(), run.Length(), firstSet, firstGroupBlock + offset - 1)); type, (int)run.AllocationGroup(), run.Start(), run.Length(), firstSet, firstGroupBlock + offset - 1));
firstSet = -1; firstSet = -1;
} }
_SetCheckBitmapAt(firstGroupBlock + offset); _SetCheckBitmapAt(firstGroupBlock + offset);
@@ -1176,7 +1174,7 @@ BlockAllocator::CheckBlockRun(block_run run, const char *type, check_control *co
if (firstMissing != -1) if (firstMissing != -1)
PRINT(("%s: block_run(%ld, %u, %u): blocks %Ld - %Ld are not allocated!\n", type, run.AllocationGroup(), run.Start(), run.Length(), firstMissing, firstGroupBlock + pos + block * bitsPerBlock - 1)); PRINT(("%s: block_run(%ld, %u, %u): blocks %Ld - %Ld are not allocated!\n", type, run.AllocationGroup(), run.Start(), run.Length(), firstMissing, firstGroupBlock + pos + block * bitsPerBlock - 1));
if (firstSet != -1) if (firstSet != -1)
FATAL(("%s: block_run(%ld, %u, %u): blocks %Ld - %Ld are already set!\n", type, run.AllocationGroup(), run.Start(), run.Length(), firstSet, firstGroupBlock + pos + block * bitsPerBlock - 1)); FATAL(("%s: block_run(%d, %u, %u): blocks %Ld - %Ld are already set!\n", type, (int)run.AllocationGroup(), run.Start(), run.Length(), firstSet, firstGroupBlock + pos + block * bitsPerBlock - 1));
} }
} }
@@ -7,14 +7,7 @@
#define CACHED_BLOCK_H #define CACHED_BLOCK_H
#include <KernelExport.h> #include "system_dependencies.h"
#ifdef USER
//# include "myfs.h"
# include <stdio.h>
#endif
#include <string.h>
#include <unistd.h>
#include "Volume.h" #include "Volume.h"
#include "Journal.h" #include "Journal.h"
+1 -1
View File
@@ -7,7 +7,7 @@
** This file may be used under the terms of the OpenBeOS License. ** This file may be used under the terms of the OpenBeOS License.
*/ */
#include <null.h> #include "system_dependencies.h"
/** The Link class you want to use with the Chain class needs to have /** The Link class you want to use with the Chain class needs to have
* a "fNext" member which is accessable from within the Chain class. * a "fNext" member which is accessable from within the Chain class.
+34 -38
View File
@@ -11,10 +11,6 @@
#include "BPlusTree.h" #include "BPlusTree.h"
#include "Inode.h" #include "Inode.h"
#include <KernelExport.h>
#include <time.h>
#define Print __out #define Print __out
@@ -40,7 +36,7 @@ get_tupel(uint32 id)
void void
dump_block_run(const char *prefix, const block_run &run) dump_block_run(const char *prefix, const block_run &run)
{ {
Print("%s(%ld, %d, %d)\n", prefix, run.allocation_group, run.start, run.length); Print("%s(%d, %d, %d)\n", prefix, (int)run.allocation_group, run.start, run.length);
} }
@@ -49,22 +45,22 @@ dump_super_block(const 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 = %#08x (%s) %s\n", (int)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 = %#08x (%s)\n", (int)superBlock->fs_byte_order, get_tupel(superBlock->fs_byte_order));
Print(" block_size = %lu\n", superBlock->block_size); Print(" block_size = %u\n", (unsigned)superBlock->block_size);
Print(" block_shift = %lu\n", superBlock->block_shift); Print(" block_shift = %u\n", (unsigned)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 = %u\n", (unsigned)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 = %#08x (%s) %s\n", (int)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 = %u\n", (unsigned)superBlock->blocks_per_ag);
Print(" ag_shift = %lu (%ld bytes)\n", superBlock->ag_shift, 1L << superBlock->ag_shift); Print(" ag_shift = %u (%ld bytes)\n", (unsigned)superBlock->ag_shift, 1L << superBlock->ag_shift);
Print(" num_ags = %lu\n", superBlock->num_ags); Print(" num_ags = %u\n", (unsigned)superBlock->num_ags);
Print(" flags = %#08lx (%s)\n", superBlock->flags, get_tupel(superBlock->flags)); Print(" flags = %#08x (%s)\n", (int)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 = %#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); dump_block_run(" root_dir = ", superBlock->root_dir);
dump_block_run(" indices = ", superBlock->indices); dump_block_run(" indices = ", superBlock->indices);
} }
@@ -99,30 +95,30 @@ void
dump_inode(const bfs_inode *inode) dump_inode(const bfs_inode *inode)
{ {
Print("inode:\n"); Print("inode:\n");
Print(" magic1 = %08lx (%s) %s\n", inode->magic1, Print(" magic1 = %08x (%s) %s\n", (int)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 = %u\n", (unsigned)inode->uid);
Print(" gid = %lu\n", inode->gid); Print(" gid = %u\n", (unsigned)inode->gid);
Print(" mode = %08lx\n", inode->mode); Print(" mode = %08x\n", (int)inode->mode);
Print(" flags = %08lx\n", inode->flags); Print(" flags = %08x\n", (int)inode->flags);
Print(" create_time = %Ld (%Ld)\n", inode->create_time, Print(" create_time = %Ld (%Ld)\n", inode->create_time,
inode->create_time >> INODE_TIME_SHIFT); inode->create_time >> INODE_TIME_SHIFT);
Print(" last_modified_time = %Ld (%Ld)\n", inode->last_modified_time, Print(" last_modified_time = %Ld (%Ld)\n", inode->last_modified_time,
inode->last_modified_time >> INODE_TIME_SHIFT); inode->last_modified_time >> INODE_TIME_SHIFT);
dump_block_run( " parent = ", inode->parent); dump_block_run( " parent = ", inode->parent);
dump_block_run( " attributes = ", inode->attributes); dump_block_run( " attributes = ", inode->attributes);
Print(" type = %lu\n", inode->type); Print(" type = %u\n", (unsigned)inode->type);
Print(" inode_size = %lu\n", inode->inode_size); Print(" inode_size = %u\n", (unsigned)inode->inode_size);
Print(" etc = %#08lx\n", inode->etc); Print(" etc = %#08x\n", (int)inode->etc);
Print(" short_symlink = %s\n", Print(" short_symlink = %s\n",
S_ISLNK(inode->mode) && (inode->flags & INODE_LONG_SYMLINK) == 0 ? S_ISLNK(inode->mode) && (inode->flags & INODE_LONG_SYMLINK) == 0 ?
inode->short_symlink : "-"); 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] = %08x\n", (int)inode->pad[0]);
Print(" pad[1] = %08lx\n", inode->pad[1]); Print(" pad[1] = %08x\n", (int)inode->pad[1]);
Print(" pad[2] = %08lx\n", inode->pad[2]); Print(" pad[2] = %08x\n", (int)inode->pad[2]);
Print(" pad[3] = %08lx\n", inode->pad[3]); Print(" pad[3] = %08x\n", (int)inode->pad[3]);
} }
@@ -130,11 +126,11 @@ void
dump_bplustree_header(const bplustree_header *header) dump_bplustree_header(const bplustree_header *header)
{ {
Print("bplustree_header:\n"); Print("bplustree_header:\n");
Print(" magic = %#08lx (%s) %s\n", header->magic, Print(" magic = %#08x (%s) %s\n", (int)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 = %u\n", (unsigned)header->node_size);
Print(" max_number_of_levels = %lu\n", header->max_number_of_levels); Print(" max_number_of_levels = %u\n", (unsigned)header->max_number_of_levels);
Print(" data_type = %lu\n", header->data_type); Print(" data_type = %u\n", (unsigned)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);
@@ -203,7 +199,7 @@ dump_bplustree_node(const bplustree_node *node, const bplustree_header *header,
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(" %2d. Invalid length (%u)!!\n", (int)i, length);
dump_block((char *)node, header->node_size/*, sizeof(off_t)*/); dump_block((char *)node, header->node_size/*, sizeof(off_t)*/);
break; break;
} }
@@ -212,15 +208,15 @@ dump_bplustree_node(const bplustree_node *node, const bplustree_header *header,
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(" %2d. Invalid Offset!!\n", (int)i);
else { else {
Print(" %2ld. ", i); Print(" %2d. ", (int)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 = %d (0x%x)", (int)*(int32 *)&buffer, (int)*(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 = %u (0x%x)", (unsigned)*(uint32 *)&buffer, (unsigned)*(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
@@ -230,7 +226,7 @@ dump_bplustree_node(const bplustree_node *node, const bplustree_header *header,
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(" (%d, %d)", (int)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);
+1 -7
View File
@@ -7,17 +7,11 @@
#define DEBUG_H #define DEBUG_H
#include <KernelExport.h> #include "system_dependencies.h"
#ifdef DEBUG
# include <string.h>
#endif
#ifdef USER #ifdef USER
# include <stdio.h>
# define __out printf # define __out printf
#else #else
# include <null.h>
# define __out dprintf # define __out dprintf
#endif #endif
@@ -12,8 +12,6 @@
#include "Inode.h" #include "Inode.h"
#include "BPlusTree.h" #include "BPlusTree.h"
#include <util/kernel_cpp.h>
#include <TypeConstants.h>
// B_MIME_STRING_TYPE is defined in storage/Mime.h, but we // B_MIME_STRING_TYPE is defined in storage/Mime.h, but we
// don't need the whole file here; the type can't change anyway // don't need the whole file here; the type can't change anyway
+1 -1
View File
@@ -7,7 +7,7 @@
#define INDEX_H #define INDEX_H
#include <KernelExport.h> #include "system_dependencies.h"
class Transaction; class Transaction;
class Volume; class Volume;
+4 -10
View File
@@ -11,12 +11,6 @@
#include "BPlusTree.h" #include "BPlusTree.h"
#include "Index.h" #include "Index.h"
#include <fs_cache.h>
#include <util/kernel_cpp.h>
#include <string.h>
#include <stdio.h>
class InodeAllocator { class InodeAllocator {
public: public:
@@ -183,8 +177,8 @@ Inode::Inode(Volume *volume, vnode_id id)
memcpy(&fNode, node.Node(), sizeof(bfs_inode)); memcpy(&fNode, node.Node(), sizeof(bfs_inode));
char lockName[B_OS_NAME_LENGTH]; char lockName[B_OS_NAME_LENGTH];
snprintf(lockName, sizeof(lockName), "bfs inode %ld.%d", snprintf(lockName, sizeof(lockName), "bfs inode %d.%d",
BlockRun().AllocationGroup(), BlockRun().Start()); (int)BlockRun().AllocationGroup(), BlockRun().Start());
fLock.Initialize(lockName); fLock.Initialize(lockName);
// these two will help to maintain the indices // these two will help to maintain the indices
@@ -210,8 +204,8 @@ Inode::Inode(Volume *volume, Transaction &transaction, vnode_id id, mode_t mode,
volume, &transaction, id, this)); volume, &transaction, id, this));
char lockName[B_OS_NAME_LENGTH]; char lockName[B_OS_NAME_LENGTH];
snprintf(lockName, sizeof(lockName), "bfs inode+%ld.%d", snprintf(lockName, sizeof(lockName), "bfs inode+%d.%d",
run.AllocationGroup(), run.Start()); (int)run.AllocationGroup(), run.Start());
fLock.Initialize(lockName); fLock.Initialize(lockName);
NodeGetter node(volume, transaction, this, true); NodeGetter node(volume, transaction, this, true);
+1 -8
View File
@@ -6,19 +6,12 @@
#define INODE_H #define INODE_H
#include <KernelExport.h> #include "system_dependencies.h"
#ifdef USER
//# include "myfs.h"
# include <stdio.h>
#endif
#ifndef _IMPEXP_KERNEL #ifndef _IMPEXP_KERNEL
# define _IMPEXP_KERNEL # define _IMPEXP_KERNEL
#endif #endif
#include <string.h>
#include <unistd.h>
#include "Volume.h" #include "Volume.h"
#include "Journal.h" #include "Journal.h"
#include "Lock.h" #include "Lock.h"
@@ -9,11 +9,6 @@
#include "Inode.h" #include "Inode.h"
#include "Debug.h" #include "Debug.h"
#include <Drivers.h>
#include <util/kernel_cpp.h>
#include <util/Stack.h>
#include <errno.h>
struct run_array { struct run_array {
int32 count; int32 count;
@@ -337,8 +332,8 @@ Journal::_CheckRunArray(const run_array *array)
if (array->MaxRuns() != maxRuns if (array->MaxRuns() != maxRuns
|| array->CountRuns() > maxRuns || array->CountRuns() > maxRuns
|| array->CountRuns() <= 0) { || array->CountRuns() <= 0) {
dprintf("run count: %ld, array max: %ld, max runs: %ld\n", dprintf("run count: %d, array max: %d, max runs: %d\n",
array->CountRuns(), array->MaxRuns(), maxRuns); (int)array->CountRuns(), (int)array->MaxRuns(), (int)maxRuns);
FATAL(("Log entry has broken header!\n")); FATAL(("Log entry has broken header!\n"));
return B_ERROR; return B_ERROR;
} }
@@ -433,7 +428,7 @@ Journal::ReplayLog()
status_t status = _ReplayRunArray(&start); status_t status = _ReplayRunArray(&start);
if (status < B_OK) { if (status < B_OK) {
FATAL(("replaying log entry from %ld failed: %s\n", start, strerror(status))); FATAL(("replaying log entry from %d failed: %s\n", (int)start, strerror(status)));
return B_ERROR; return B_ERROR;
} }
start = start % fLogSize; start = start % fLogSize;
@@ -7,13 +7,7 @@
#define JOURNAL_H #define JOURNAL_H
#include <KernelExport.h> #include "system_dependencies.h"
#include <util/DoublyLinkedList.h>
#ifdef USER
//# include "myfs.h"
# include <stdio.h>
#endif
#ifndef _IMPEXP_KERNEL #ifndef _IMPEXP_KERNEL
# define _IMPEXP_KERNEL # define _IMPEXP_KERNEL
+2 -3
View File
@@ -7,9 +7,8 @@
#ifndef LOCK_H #ifndef LOCK_H
#define LOCK_H #define LOCK_H
#include "system_dependencies.h"
#include <KernelExport.h>
#include <stdio.h>
#include "Utility.h" #include "Utility.h"
#include "Debug.h" #include "Debug.h"
@@ -165,7 +164,7 @@ class RecursiveLock {
{ {
thread_id thread = find_thread(NULL); thread_id thread = find_thread(NULL);
if (thread != fOwner) { if (thread != fOwner) {
panic("RecursiveLock unlocked by %ld, owned by %ld\n", thread, fOwner); panic("RecursiveLock unlocked by %d, owned by %d\n", (int)thread, (int)fOwner);
} }
if (--fOwnerCount == 0) { if (--fOwnerCount == 0) {
+1 -12
View File
@@ -17,17 +17,6 @@
#include "BPlusTree.h" #include "BPlusTree.h"
#include "Index.h" #include "Index.h"
#include <util/kernel_cpp.h>
#include <SupportDefs.h>
#include <NodeMonitor.h>
#include <TypeConstants.h>
#include <AppDefs.h>
#include <fs_query.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
// The parser has a very static design, but it will do what is required. // The parser has a very static design, but it will do what is required.
// //
@@ -698,7 +687,7 @@ Equation::ConvertValue(type_code type)
fSize = sizeof(double); fSize = sizeof(double);
break; break;
default: default:
FATAL(("query value conversion to 0x%lx requested!\n", type)); FATAL(("query value conversion to 0x%x requested!\n", (int)type));
// should we fail here or just do a safety int32 conversion? // should we fail here or just do a safety int32 conversion?
return B_ERROR; return B_ERROR;
} }
+1 -3
View File
@@ -6,13 +6,11 @@
#ifndef QUERY_H #ifndef QUERY_H
#define QUERY_H #define QUERY_H
#include "system_dependencies.h"
#include "Chain.h" #include "Chain.h"
#include "Index.h" #include "Index.h"
#include <util/Stack.h>
#include <SupportDefs.h>
class Volume; class Volume;
class Term; class Term;
class Equation; class Equation;
@@ -8,11 +8,6 @@
#include "Utility.h" #include "Utility.h"
#include "Debug.h" #include "Debug.h"
#include <util/kernel_cpp.h>
#include <stdlib.h>
#include <string.h>
bool bool
sorted_array::FindInternal(off_t value, int32 &index) const sorted_array::FindInternal(off_t value, int32 &index) const
@@ -7,7 +7,7 @@
#define UTILITY_H #define UTILITY_H
#include <SupportDefs.h> #include "system_dependencies.h"
// Simple array, used for the duplicate handling in the B+Tree, // Simple array, used for the duplicate handling in the B+Tree,
+1 -12
View File
@@ -11,17 +11,6 @@
#include "Inode.h" #include "Inode.h"
#include "Query.h" #include "Query.h"
#include <util/kernel_cpp.h>
#include <KernelExport.h>
#include <Drivers.h>
#include <fs_volume.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static const int32 kDesiredAllocationGroups = 56; static const int32 kDesiredAllocationGroups = 56;
// This is the number of allocation groups that will be tried // This is the number of allocation groups that will be tried
@@ -444,7 +433,7 @@ Volume::ValidateBlockRun(block_run run)
|| run.length == 0 || run.length == 0
|| uint32(run.Length() + run.Start()) > (1UL << AllocationGroupShift())) { || uint32(run.Length() + run.Start()) > (1UL << AllocationGroupShift())) {
Panic(); Panic();
FATAL(("*** invalid run(%ld,%d,%d)\n", run.AllocationGroup(), run.Start(), run.Length())); FATAL(("*** invalid run(%d,%d,%d)\n", (int)run.AllocationGroup(), run.Start(), run.Length()));
return B_BAD_DATA; return B_BAD_DATA;
} }
return B_OK; return B_OK;
+1 -3
View File
@@ -7,9 +7,7 @@
#define VOLUME_H #define VOLUME_H
#include <KernelExport.h> #include "system_dependencies.h"
#include <fs_interface.h>
#include <fs_cache.h>
#include "bfs.h" #include "bfs.h"
#include "BlockAllocator.h" #include "BlockAllocator.h"
+1 -6
View File
@@ -9,15 +9,10 @@
#define BFS_H #define BFS_H
#include <SupportDefs.h>
#include "bfs_endian.h" #include "bfs_endian.h"
#include "system_dependencies.h"
#ifndef B_BEOS_VERSION_DANO
# define B_BAD_DATA B_ERROR
#endif
// ToDo: temporary fix! (missing but public ioctls) // ToDo: temporary fix! (missing but public ioctls)
#define IOCTL_FILE_UNCACHED_IO 10000 #define IOCTL_FILE_UNCACHED_IO 10000
@@ -7,7 +7,7 @@
*/ */
#include <fs_interface.h> #include "system_dependencies.h"
/* ioctl to check the version of BFS used - parameter is a uint32 * /* ioctl to check the version of BFS used - parameter is a uint32 *
@@ -6,7 +6,7 @@
#define BFS_ENDIAN_H #define BFS_ENDIAN_H
#include <ByteOrder.h> #include "system_dependencies.h"
#if !defined(BFS_LITTLE_ENDIAN_ONLY) && !defined(BFS_BIG_ENDIAN_ONLY) #if !defined(BFS_LITTLE_ENDIAN_ONLY) && !defined(BFS_BIG_ENDIAN_ONLY)
@@ -14,21 +14,6 @@
#include "Attribute.h" #include "Attribute.h"
#include "bfs_control.h" #include "bfs_control.h"
#include <util/kernel_cpp.h>
#include <string.h>
#include <stdio.h>
#include <KernelExport.h>
#include <NodeMonitor.h>
#include <fs_interface.h>
#include <fs_cache.h>
#include <fs_attr.h>
#include <fs_info.h>
#include <fs_index.h>
#include <fs_query.h>
#include <fs_volume.h>
#define BFS_IO_SIZE 65536 #define BFS_IO_SIZE 65536
@@ -1265,8 +1250,8 @@ bfs_free_cookie(void *_ns, void *_node, void *_cookie)
if (needsTrimming) { if (needsTrimming) {
status = inode->TrimPreallocation(transaction); status = inode->TrimPreallocation(transaction);
if (status < B_OK) { if (status < B_OK) {
FATAL(("Could not trim preallocated blocks: inode %Ld, transaction %ld: %s!\n", FATAL(("Could not trim preallocated blocks: inode %Ld, transaction %d: %s!\n",
inode->ID(), transaction.ID(), strerror(status))); inode->ID(), (int)transaction.ID(), strerror(status)));
// we still want this transaction to succeed // we still want this transaction to succeed
status = B_OK; status = B_OK;
@@ -0,0 +1,46 @@
/*
* Copyright 2007, Ingo Weinhold, bonefish@cs.tu-berlin.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _SYSTEM_DEPENDENCIES_H
#define _SYSTEM_DEPENDENCIES_H
#ifdef BFS_SHELL
#include "fssh_api_wrapper.h"
#else // !BFS_SHELL
#include <ctype.h>
#include <errno.h>
#include <null.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <fs_attr.h>
#include <fs_cache.h>
#include <fs_index.h>
#include <fs_info.h>
#include <fs_interface.h>
#include <fs_query.h>
#include <fs_volume.h>
#include <ByteOrder.h>
#include <Drivers.h>
#include <KernelExport.h>
#include <NodeMonitor.h>
#include <SupportDefs.h>
#include <TypeConstants.h>
#include <util/DoublyLinkedList.h>
#include <util/kernel_cpp.h>
#include <util/Stack.h>
#endif // !BFS_SHELL
#endif // _SYSTEM_DEPENDENCIES_H
+1
View File
@@ -59,6 +59,7 @@ SEARCH on [ FGristFiles
UpdateMimeInfoThread.cpp MimeUpdateThread.cpp database_support.cpp UpdateMimeInfoThread.cpp MimeUpdateThread.cpp database_support.cpp
] = [ FDirName $(HAIKU_TOP) src build libbe storage mime ] ; ] = [ FDirName $(HAIKU_TOP) src build libbe storage mime ] ;
SubInclude HAIKU_TOP src tools bfs_shell ;
SubInclude HAIKU_TOP src tools copy_to_bfs_image ; SubInclude HAIKU_TOP src tools copy_to_bfs_image ;
SubInclude HAIKU_TOP src tools cppunit ; SubInclude HAIKU_TOP src tools cppunit ;
SubInclude HAIKU_TOP src tools docbook ; SubInclude HAIKU_TOP src tools docbook ;
+40
View File
@@ -0,0 +1,40 @@
SubDir HAIKU_TOP src tools bfs_shell ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems bfs ] ;
# set some additional defines
{
local defines =
#BFS_BIG_ENDIAN_ONLY
BFS_SHELL
;
if $(DEBUG) = 0 {
# the gcc on BeOS doesn't compile BFS correctly with -O2 or more
OPTIM = -O1 ;
}
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) -Wall -Wno-multichar ;
SubDirC++Flags $(defines) -Wall -Wno-multichar -fno-rtti ;
}
UsePrivateHeaders fs_shell ;
BuildPlatformMain <build2>bfs_shell
:
BlockAllocator.cpp
BPlusTree.cpp
Attribute.cpp
Debug.cpp
Index.cpp
Inode.cpp
Journal.cpp
Query.cpp
Utility.cpp
Volume.cpp
kernel_interface.cpp
: <build2>fs_shell.a $(HOST_LIBSUPC++) $(HOST_LIBROOT)
;