Fixed some boot loader PPC BFS issues:

* bfs_inode must be packed, otherwise the structure is larger due to
  different alignment requirements.
* The off_t array returned by bfs_inode::Values() is in on-disk
  endianess. This was ignored in some places. Hope I squashed all
  occurences.
Those fixes should probably be back-ported to the kernel add-on, too.
Will do that when I get to that point in the kernel, unless someone
beats me to it.

The PPC boot loader does at least find the kernel on a BFS volume now.
Haven't dared to let it be loaded yet.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15686 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2005-12-27 21:33:11 +00:00
parent 21796ee568
commit 3489b30126
3 changed files with 10 additions and 6 deletions

View File

@ -386,7 +386,8 @@ BPlusTree::FindFreeDuplicateFragment(bplustree_node *node, CachedNode *cached, o
if (bplustree_node::LinkType(values[i]) != BPLUSTREE_DUPLICATE_FRAGMENT)
continue;
bplustree_node *fragment = cached->SetTo(bplustree_node::FragmentOffset(values[i]), false);
bplustree_node *fragment = cached->SetTo(bplustree_node::FragmentOffset(
BFS_ENDIAN_TO_HOST_INT64(values[i])), false);
if (fragment == NULL) {
FATAL(("Could not get duplicate fragment at %Ld\n",values[i]));
continue;
@ -398,7 +399,8 @@ BPlusTree::FindFreeDuplicateFragment(bplustree_node *node, CachedNode *cached, o
duplicate_array *array = fragment->FragmentAt(j);
if (array->count == 0) {
*_offset = bplustree_node::FragmentOffset(values[i]);
*_offset = bplustree_node::FragmentOffset(
BFS_ENDIAN_TO_HOST_INT64(values[i]));
*_fragment = fragment;
*_index = j;
return B_OK;
@ -444,7 +446,7 @@ BPlusTree::Find(const uint8 *key, uint16 keyLength, off_t *_value)
if (node->OverflowLink() == BPLUSTREE_NULL) {
if (status == B_OK && _value != NULL)
*_value = node->Values()[keyIndex];
*_value = BFS_ENDIAN_TO_HOST_INT64(node->Values()[keyIndex]);
return status;
} else if (nextOffset == nodeOffset)
@ -503,7 +505,7 @@ TreeIterator::Goto(int8 to)
|| (uint32)node->Values() > (uint32)node + fTree->fNodeSize - 8 * node->NumKeys())
return B_ERROR;
nextOffset = node->Values()[0];
nextOffset = BFS_ENDIAN_TO_HOST_INT64(node->Values()[0]);
}
if (nextOffset == nodeOffset)
break;
@ -639,7 +641,7 @@ TreeIterator::Traverse(int8 direction, void *key, uint16 *keyLength, uint16 maxL
}
*keyLength = length;
off_t offset = node->Values()[fCurrentKey];
off_t offset = BFS_ENDIAN_TO_HOST_INT64(node->Values()[fCurrentKey]);
#ifdef BPLUSTREE_SUPPORTS_DUPLICATES
// duplicate fragments?

View File

@ -96,7 +96,7 @@ struct bplustree_node {
static inline off_t FragmentOffset(off_t link);
static inline uint32 FragmentIndex(off_t link);
#endif
};
} __attribute__ ((__packed__));
//#define BPLUSTREE_NODE 0
#define BPLUSTREE_DUPLICATE_NODE 2

View File

@ -89,6 +89,8 @@ Directory::Lookup(const char *name, bool traverseLinks)
return NULL;
Node *node = Stream::NodeFactory(fStream.GetVolume(), id);
if (!node)
return NULL;
if (S_ISLNK(node->Type())) {
// the node is a symbolic link, so we have to resolve the path