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:
parent
21796ee568
commit
3489b30126
@ -386,7 +386,8 @@ BPlusTree::FindFreeDuplicateFragment(bplustree_node *node, CachedNode *cached, o
|
|||||||
if (bplustree_node::LinkType(values[i]) != BPLUSTREE_DUPLICATE_FRAGMENT)
|
if (bplustree_node::LinkType(values[i]) != BPLUSTREE_DUPLICATE_FRAGMENT)
|
||||||
continue;
|
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) {
|
if (fragment == NULL) {
|
||||||
FATAL(("Could not get duplicate fragment at %Ld\n",values[i]));
|
FATAL(("Could not get duplicate fragment at %Ld\n",values[i]));
|
||||||
continue;
|
continue;
|
||||||
@ -398,7 +399,8 @@ BPlusTree::FindFreeDuplicateFragment(bplustree_node *node, CachedNode *cached, o
|
|||||||
duplicate_array *array = fragment->FragmentAt(j);
|
duplicate_array *array = fragment->FragmentAt(j);
|
||||||
|
|
||||||
if (array->count == 0) {
|
if (array->count == 0) {
|
||||||
*_offset = bplustree_node::FragmentOffset(values[i]);
|
*_offset = bplustree_node::FragmentOffset(
|
||||||
|
BFS_ENDIAN_TO_HOST_INT64(values[i]));
|
||||||
*_fragment = fragment;
|
*_fragment = fragment;
|
||||||
*_index = j;
|
*_index = j;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@ -444,7 +446,7 @@ BPlusTree::Find(const uint8 *key, uint16 keyLength, off_t *_value)
|
|||||||
|
|
||||||
if (node->OverflowLink() == BPLUSTREE_NULL) {
|
if (node->OverflowLink() == BPLUSTREE_NULL) {
|
||||||
if (status == B_OK && _value != NULL)
|
if (status == B_OK && _value != NULL)
|
||||||
*_value = node->Values()[keyIndex];
|
*_value = BFS_ENDIAN_TO_HOST_INT64(node->Values()[keyIndex]);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
} else if (nextOffset == nodeOffset)
|
} else if (nextOffset == nodeOffset)
|
||||||
@ -503,7 +505,7 @@ TreeIterator::Goto(int8 to)
|
|||||||
|| (uint32)node->Values() > (uint32)node + fTree->fNodeSize - 8 * node->NumKeys())
|
|| (uint32)node->Values() > (uint32)node + fTree->fNodeSize - 8 * node->NumKeys())
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
nextOffset = node->Values()[0];
|
nextOffset = BFS_ENDIAN_TO_HOST_INT64(node->Values()[0]);
|
||||||
}
|
}
|
||||||
if (nextOffset == nodeOffset)
|
if (nextOffset == nodeOffset)
|
||||||
break;
|
break;
|
||||||
@ -639,7 +641,7 @@ TreeIterator::Traverse(int8 direction, void *key, uint16 *keyLength, uint16 maxL
|
|||||||
}
|
}
|
||||||
*keyLength = length;
|
*keyLength = length;
|
||||||
|
|
||||||
off_t offset = node->Values()[fCurrentKey];
|
off_t offset = BFS_ENDIAN_TO_HOST_INT64(node->Values()[fCurrentKey]);
|
||||||
|
|
||||||
#ifdef BPLUSTREE_SUPPORTS_DUPLICATES
|
#ifdef BPLUSTREE_SUPPORTS_DUPLICATES
|
||||||
// duplicate fragments?
|
// duplicate fragments?
|
||||||
|
@ -96,7 +96,7 @@ struct bplustree_node {
|
|||||||
static inline off_t FragmentOffset(off_t link);
|
static inline off_t FragmentOffset(off_t link);
|
||||||
static inline uint32 FragmentIndex(off_t link);
|
static inline uint32 FragmentIndex(off_t link);
|
||||||
#endif
|
#endif
|
||||||
};
|
} __attribute__ ((__packed__));
|
||||||
|
|
||||||
//#define BPLUSTREE_NODE 0
|
//#define BPLUSTREE_NODE 0
|
||||||
#define BPLUSTREE_DUPLICATE_NODE 2
|
#define BPLUSTREE_DUPLICATE_NODE 2
|
||||||
|
@ -89,6 +89,8 @@ Directory::Lookup(const char *name, bool traverseLinks)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
Node *node = Stream::NodeFactory(fStream.GetVolume(), id);
|
Node *node = Stream::NodeFactory(fStream.GetVolume(), id);
|
||||||
|
if (!node)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (S_ISLNK(node->Type())) {
|
if (S_ISLNK(node->Type())) {
|
||||||
// the node is a symbolic link, so we have to resolve the path
|
// the node is a symbolic link, so we have to resolve the path
|
||||||
|
Loading…
Reference in New Issue
Block a user