bfs_tools: some more structs needed packing.
This commit is contained in:
parent
e5e3ac7f70
commit
10e6523159
@ -16,12 +16,12 @@
|
||||
class BPositionIO;
|
||||
|
||||
|
||||
//****************** on-disk structures ********************
|
||||
// ****************** on-disk structures ********************
|
||||
|
||||
#define BPLUSTREE_NULL -1LL
|
||||
#define BPLUSTREE_FREE -2LL
|
||||
|
||||
struct bplustree_header
|
||||
struct __attribute__((packed)) bplustree_header
|
||||
{
|
||||
uint32 magic;
|
||||
uint32 node_size;
|
||||
@ -30,7 +30,7 @@ struct bplustree_header
|
||||
off_t root_node_pointer;
|
||||
off_t free_node_pointer;
|
||||
off_t maximum_size;
|
||||
|
||||
|
||||
inline bool IsValidLink(off_t link);
|
||||
};
|
||||
|
||||
@ -49,21 +49,21 @@ enum bplustree_types {
|
||||
BPLUSTREE_DOUBLE_TYPE = 6
|
||||
};
|
||||
|
||||
struct bplustree_node {
|
||||
struct __attribute((packed)) bplustree_node {
|
||||
off_t left_link;
|
||||
off_t right_link;
|
||||
off_t overflow_link;
|
||||
uint16 all_key_count;
|
||||
uint16 all_key_length;
|
||||
|
||||
|
||||
inline uint16 *KeyLengths() const;
|
||||
inline off_t *Values() const;
|
||||
inline uint8 *Keys() const;
|
||||
inline int32 Used() const;
|
||||
uint8 *KeyAt(int32 index,uint16 *keyLength) const;
|
||||
|
||||
uint8 CountDuplicates(off_t offset,bool isFragment) const;
|
||||
off_t DuplicateAt(off_t offset,bool isFragment,int8 index) const;
|
||||
uint8 *KeyAt(int32 index, uint16 *keyLength) const;
|
||||
|
||||
uint8 CountDuplicates(off_t offset, bool isFragment) const;
|
||||
off_t DuplicateAt(off_t offset, bool isFragment, int8 index) const;
|
||||
|
||||
static inline uint8 LinkType(off_t link);
|
||||
static inline off_t FragmentOffset(off_t link);
|
||||
@ -73,12 +73,12 @@ struct bplustree_node {
|
||||
#define BPLUSTREE_DUPLICATE_NODE 2
|
||||
#define BPLUSTREE_DUPLICATE_FRAGMENT 3
|
||||
|
||||
//**************************************
|
||||
// **************************************
|
||||
|
||||
enum bplustree_traversing {
|
||||
BPLUSTREE_FORWARD = 1,
|
||||
BPLUSTREE_BACKWARD = -1,
|
||||
|
||||
|
||||
BPLUSTREE_BEGIN = 0,
|
||||
BPLUSTREE_END = 1
|
||||
};
|
||||
@ -89,10 +89,10 @@ class BPlusTree;
|
||||
class NodeCache : public Cache<off_t> {
|
||||
public:
|
||||
NodeCache(BPlusTree *);
|
||||
|
||||
|
||||
virtual Cacheable *NewCacheable(off_t offset);
|
||||
bplustree_node *Get(off_t offset);
|
||||
// void SetOffset(bplustree_node *,off_t offset);
|
||||
// void SetOffset(bplustree_node *, off_t offset);
|
||||
|
||||
protected:
|
||||
BPlusTree *fTree;
|
||||
|
@ -85,7 +85,7 @@ struct __attribute__((packed)) data_stream
|
||||
int64 size;
|
||||
};
|
||||
|
||||
//**************************************
|
||||
// **************************************
|
||||
|
||||
struct bfs_inode;
|
||||
|
||||
@ -95,7 +95,7 @@ struct __attribute__((packed)) small_data
|
||||
uint16 name_size;
|
||||
uint16 data_size;
|
||||
char name[0]; // name_size long, followed by data
|
||||
|
||||
|
||||
inline char *Name();
|
||||
inline uint8 *Data();
|
||||
inline small_data *Next();
|
||||
@ -104,10 +104,10 @@ struct __attribute__((packed)) small_data
|
||||
|
||||
// the file name is part of the small_data structure
|
||||
#define FILE_NAME_TYPE 'CSTR'
|
||||
#define FILE_NAME_NAME 0x13
|
||||
#define FILE_NAME_NAME_LENGTH 1
|
||||
#define FILE_NAME_NAME 0x13
|
||||
#define FILE_NAME_NAME_LENGTH 1
|
||||
|
||||
//**************************************
|
||||
// **************************************
|
||||
|
||||
#define SHORT_SYMLINK_NAME_LENGTH 144 // length incl. terminating '\0'
|
||||
|
||||
@ -124,17 +124,17 @@ struct __attribute__((packed)) bfs_inode
|
||||
inode_addr parent;
|
||||
inode_addr attributes;
|
||||
uint32 type; // attribute type
|
||||
|
||||
|
||||
int32 inode_size;
|
||||
uint32 etc; // for in-memory structures (unused in OpenBeOS' fs)
|
||||
|
||||
union {
|
||||
union __attribute__((packed)) {
|
||||
data_stream data;
|
||||
char short_symlink[SHORT_SYMLINK_NAME_LENGTH];
|
||||
};
|
||||
int32 pad[4];
|
||||
small_data small_data_start[0];
|
||||
};
|
||||
};
|
||||
|
||||
#define INODE_MAGIC1 0x3bbe0ad9
|
||||
#define INODE_TIME_SHIFT 16
|
||||
|
Loading…
Reference in New Issue
Block a user