/trunk/kernel/generic/include/adt/hash_table.h |
---|
37,18 → 37,9 |
#include <adt/list.h> |
#include <arch/types.h> |
#include <typedefs.h> |
/** Hash table structure. */ |
struct hash_table { |
link_t *entry; |
count_t entries; |
count_t max_keys; |
hash_table_operations_t *op; |
}; |
/** Set of operations for hash table. */ |
struct hash_table_operations { |
typedef struct { |
/** Hash function. |
* |
* @param key Array of keys needed to compute hash index. All keys must be passed. |
70,8 → 61,16 |
* @param item Item that was removed from the hash table. |
*/ |
void (*remove_callback)(link_t *item); |
}; |
} hash_table_operations_t; |
/** Hash table structure. */ |
typedef struct { |
link_t *entry; |
count_t entries; |
count_t max_keys; |
hash_table_operations_t *op; |
} hash_table_t; |
#define hash_table_get_instance(item, type, member) list_get_instance((item), type, member) |
extern void hash_table_create(hash_table_t *h, count_t m, count_t max_keys, hash_table_operations_t *op); |
/trunk/kernel/generic/include/adt/list.h |
---|
36,13 → 36,12 |
#define KERN_LIST_H_ |
#include <arch/types.h> |
#include <typedefs.h> |
/** Doubly linked list head and link type. */ |
struct link { |
link_t *prev; /**< Pointer to the previous item in the list. */ |
link_t *next; /**< Pointer to the next item in the list. */ |
}; |
typedef struct link { |
struct link *prev; /**< Pointer to the previous item in the list. */ |
struct link *next; /**< Pointer to the next item in the list. */ |
} link_t; |
/** Declare and initialize statically allocated list. |
* |
/trunk/kernel/generic/include/adt/bitmap.h |
---|
36,7 → 36,6 |
#define KERN_BITMAP_H_ |
#include <arch/types.h> |
#include <typedefs.h> |
#define BITS2BYTES(bits) (bits ? ((((bits)-1)>>3)+1) : 0) |
/trunk/kernel/generic/include/adt/btree.h |
---|
36,7 → 36,6 |
#define KERN_BTREE_H_ |
#include <arch/types.h> |
#include <typedefs.h> |
#include <adt/list.h> |
#define BTREE_M 5 |
45,7 → 44,7 |
typedef uint64_t btree_key_t; |
/** B-tree node structure. */ |
struct btree_node { |
typedef struct btree_node { |
/** Number of keys. */ |
count_t keys; |
65,10 → 64,10 |
* ... |
* There is room for storing a subtree pointer for the extra key. |
*/ |
btree_node_t *subtree[BTREE_M + 1]; |
struct btree_node *subtree[BTREE_M + 1]; |
/** Pointer to parent node. Root node has NULL parent. */ |
btree_node_t *parent; |
struct btree_node *parent; |
/** Link connecting leaf-level nodes. Defined only when this node is a leaf. */ |
link_t leaf_link; |
76,13 → 75,13 |
/** Variables needed by btree_print(). */ |
link_t bfs_link; |
int depth; |
}; |
} btree_node_t; |
/** B-tree structure. */ |
struct btree { |
typedef struct { |
btree_node_t *root; /**< B-tree root node pointer. */ |
link_t leaf_head; /**< Leaf-level list head. */ |
}; |
} btree_t; |
extern void btree_init(void); |
/trunk/kernel/generic/include/adt/fifo.h |
---|
45,7 → 45,6 |
#ifndef KERN_FIFO_H_ |
#define KERN_FIFO_H_ |
#include <typedefs.h> |
#include <mm/slab.h> |
/** Create and initialize static FIFO. |