Added _PACKED to the on-disk structures.
Switched to kernel_cpp.h/cpp. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6287 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3,18 +3,18 @@
|
|||||||
** Initial version by Axel Dörfler, [email protected]
|
** Initial version by Axel Dörfler, [email protected]
|
||||||
** Roughly based on 'btlib' written by Marcus J. Ranum
|
** Roughly based on 'btlib' written by Marcus J. Ranum
|
||||||
**
|
**
|
||||||
** Copyright (c) 2001-2002 pinc Software. All Rights Reserved.
|
** Copyright (c) 2001-2004 pinc Software. All Rights Reserved.
|
||||||
** 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 "Debug.h"
|
#include "Debug.h"
|
||||||
#include "cpp.h"
|
|
||||||
#include "BPlusTree.h"
|
#include "BPlusTree.h"
|
||||||
#include "Inode.h"
|
#include "Inode.h"
|
||||||
#include "Utility.h"
|
#include "Utility.h"
|
||||||
#include "Stack.h"
|
#include "Stack.h"
|
||||||
|
|
||||||
|
#include <kernel_cpp.h>
|
||||||
#include <TypeConstants.h>
|
#include <TypeConstants.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -2052,14 +2052,25 @@ bplustree_node::CheckIntegrity(uint32 nodeSize)
|
|||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
compareKeys(type_code type,const void *key1, int keyLength1, const void *key2, int keyLength2)
|
compareKeys(type_code type, const void *key1, int keyLength1, const void *key2, int keyLength2)
|
||||||
{
|
{
|
||||||
// if one of the keys is NULL, bail out gracefully
|
// if one of the keys is NULL, bail out gracefully
|
||||||
if (key1 == NULL || key2 == NULL)
|
if (key1 == NULL || key2 == NULL) {
|
||||||
return -1;
|
//#if USER
|
||||||
|
// // that's here to see if it's reasonable to handle this case nicely at all
|
||||||
|
// DEBUGGER(("compareKeys() got NULL key!"));
|
||||||
|
//#endif
|
||||||
|
// even if it's most probably a bug in the calling code, we try to
|
||||||
|
// give a meaningful result
|
||||||
|
if (key1 == NULL && key2 != NULL)
|
||||||
|
return 1;
|
||||||
|
else if (key2 == NULL && key1 != NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
switch (type)
|
return 0;
|
||||||
{
|
}
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
case B_STRING_TYPE:
|
case B_STRING_TYPE:
|
||||||
{
|
{
|
||||||
int len = min_c(keyLength1, keyLength2);
|
int len = min_c(keyLength1, keyLength2);
|
||||||
@@ -2125,4 +2136,3 @@ compareKeys(type_code type,const void *key1, int keyLength1, const void *key2, i
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
** Initial version by Axel Dörfler, [email protected]
|
** Initial version by Axel Dörfler, [email protected]
|
||||||
** Roughly based on 'btlib' written by Marcus J. Ranum
|
** Roughly based on 'btlib' written by Marcus J. Ranum
|
||||||
**
|
**
|
||||||
** Copyright (c) 2001-2002 pinc Software. All Rights Reserved.
|
** Copyright (c) 2001-2004 pinc Software. All Rights Reserved.
|
||||||
** This file may be used under the terms of the OpenBeOS License.
|
** This file may be used under the terms of the OpenBeOS License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ struct bplustree_header {
|
|||||||
uint32 MaxNumberOfLevels() const { return BFS_ENDIAN_TO_HOST_INT32(max_number_of_levels); }
|
uint32 MaxNumberOfLevels() const { return BFS_ENDIAN_TO_HOST_INT32(max_number_of_levels); }
|
||||||
|
|
||||||
inline bool IsValidLink(off_t link);
|
inline bool IsValidLink(off_t link);
|
||||||
};
|
} _PACKED;
|
||||||
|
|
||||||
#define BPLUSTREE_MAGIC 0x69f6c2e8
|
#define BPLUSTREE_MAGIC 0x69f6c2e8
|
||||||
#define BPLUSTREE_NODE_SIZE 1024
|
#define BPLUSTREE_NODE_SIZE 1024
|
||||||
@@ -97,7 +97,7 @@ struct bplustree_node {
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void CheckIntegrity(uint32 nodeSize);
|
void CheckIntegrity(uint32 nodeSize);
|
||||||
#endif
|
#endif
|
||||||
};
|
} _PACKED;
|
||||||
|
|
||||||
//#define BPLUSTREE_NODE 0
|
//#define BPLUSTREE_NODE 0
|
||||||
#define BPLUSTREE_DUPLICATE_NODE 2
|
#define BPLUSTREE_DUPLICATE_NODE 2
|
||||||
|
|||||||
Reference in New Issue
Block a user