![]() It does not really "store" the entire user defined struct, it merely holds a pointer to the struct hlist_node field of each element. The hashtable only contains a bunch of linked lists of struct hlist_node, nothing else. ![]() Each of those represents a bucket, and is the head of a linked list. An hashtable is just an array of fixed size of struct hlist_head. That's because of how hash tables are implemented in the Linux kernel. Why our struct has to have the struct h_list inside it? If we're gonna access our struct through the struct h_list our struct shouldn't be within struct h_list and not the opposite? PS: In my hash table it will never occur a collision (I'll handle it to never occur) so the key can be the name in the struct h_node So I would like that my hash table be like this: What I'm doing wrong? I need that the key be the same name present in the struct h_node. My first question is: Why our struct has to have the struct h_list inside it? If we're gonna access our struct through the struct h_list our struct shouldn't be within struct h_list and not the opposite? After reading the tutorial I've tried to write the following code: DECLARE_HASHTABLE(nodes_hash, 3)Ĭhar name /*The key is the name of lua state*/īut this does not even compile. The root of an rbtree is represented by the rb_root struct.I'm trying to understand and use the kernel hash tables and I've already read this and this link, but I didn't understand none of them. The Linux implementation of red-black trees is rbtree, defined in. ![]() Maintaining the properties during insertion and deletion will keep the tree semi-balanced. These properties ensure that the deepest leaf has a depth no more than double the depth of the shallowest leaf.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |