Changeset 1b20da0 in mainline for kernel/generic/include/adt
- Timestamp:
- 2018-02-28T17:52:03Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3061bc1
- Parents:
- df6ded8
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:26:03)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:52:03)
- Location:
- kernel/generic/include/adt
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/adt/avl.h
rdf6ded8 r1b20da0 62 62 struct avltree_node 63 63 { 64 /** 64 /** 65 65 * Pointer to the left descendant of this node. 66 66 * … … 70 70 struct avltree_node *lft; 71 71 72 /** 72 /** 73 73 * Pointer to the right descendant of this node. 74 74 * … … 82 82 83 83 /** Node's key. */ 84 avltree_key_t key; 84 avltree_key_t key; 85 85 86 86 /** … … 97 97 struct avltree_node *root; 98 98 99 /** 99 /** 100 100 * Base of the tree is a value that is smaller or equal than every value 101 101 * in the tree (valid for positive keys otherwise ignore this atribute). 102 * 102 * 103 103 * The base is added to the current key when a new node is inserted into 104 104 * the tree. The base is changed to the key of the node which is deleted 105 105 * with avltree_delete_min(). 106 106 */ 107 avltree_key_t base; 107 avltree_key_t base; 108 108 }; 109 109 -
kernel/generic/include/adt/btree.h
rdf6ded8 r1b20da0 55 55 btree_key_t key[BTREE_MAX_KEYS + 1]; 56 56 57 /** 57 /** 58 58 * Pointers to values. Sorted according to the key array. Defined only in 59 59 * leaf-level. There is room for storing value for the extra key. -
kernel/generic/include/adt/cht.h
rdf6ded8 r1b20da0 46 46 /** Concurrent hash table node link. */ 47 47 typedef struct cht_link { 48 /* Must be placed first. 49 * 50 * The function pointer (rcu_link.func) is used to store the item's 51 * mixed memoized hash. If in use by RCU (ie waiting for deferred 52 * destruction) the hash will contain the value of 48 /* Must be placed first. 49 * 50 * The function pointer (rcu_link.func) is used to store the item's 51 * mixed memoized hash. If in use by RCU (ie waiting for deferred 52 * destruction) the hash will contain the value of 53 53 * cht_t.op->remove_callback. 54 54 */ … … 64 64 typedef struct cht_ops { 65 65 /** Returns the hash of the item. 66 * 66 * 67 67 * Applicable also to items that were logically deleted from the table 68 68 * but have yet to be physically removed by means of remove_callback(). … … 80 80 81 81 /** Groups hash table buckets with their count. 82 * 82 * 83 83 * It allows both the number of buckets as well as the bucket array 84 84 * to be swapped atomically when resing the table. … … 100 100 /** Resized table buckets that will replace b once resize is complete. */ 101 101 cht_buckets_t *new_b; 102 /** Invalid memoized hash value. 103 * 102 /** Invalid memoized hash value. 103 * 104 104 * If cht_link.hash contains this value the item had been logically 105 105 * removed and is waiting to be freed. Such hashes (and the associated 106 * items) are disregarded and skipped or the actual hash must be 106 * items) are disregarded and skipped or the actual hash must be 107 107 * determined via op->hash(). 108 108 */ … … 116 116 work_t resize_work; 117 117 /** If positive the table should grow or shrink. 118 * 118 * 119 119 * If not 0 resize work had already been posted to the system work queue. 120 120 */ … … 133 133 134 134 extern bool cht_create_simple(cht_t *h, cht_ops_t *op); 135 extern bool cht_create(cht_t *h, size_t init_size, size_t min_size, 135 extern bool cht_create(cht_t *h, size_t init_size, size_t min_size, 136 136 size_t max_load, bool can_block, cht_ops_t *op); 137 137 extern void cht_destroy(cht_t *h); -
kernel/generic/include/adt/fifo.h
rdf6ded8 r1b20da0 72 72 * 73 73 * FIFO is allocated dynamically. 74 * This macro is suitable for creating larger FIFOs. 74 * This macro is suitable for creating larger FIFOs. 75 75 * 76 76 * @param name Name of FIFO. -
kernel/generic/include/adt/hash.h
rdf6ded8 r1b20da0 75 75 76 76 /** Produces a uniform hash affecting all output bits from the skewed input. */ 77 static inline size_t hash_mix(size_t hash) 77 static inline size_t hash_mix(size_t hash) 78 78 { 79 79 #ifdef __32_BITS__ … … 87 87 88 88 /** Use to create a hash from multiple values. 89 * 89 * 90 90 * Typical usage: 91 91 * @code … … 101 101 static inline size_t hash_combine(size_t seed, size_t hash) 102 102 { 103 /* 103 /* 104 104 * todo: use Bob Jenkin's proper mixing hash pass: 105 105 * http://burtleburtle.net/bob/c/lookup3.c -
kernel/generic/include/adt/hash_table.h
rdf6ded8 r1b20da0 2 2 * Copyright (c) 2006 Jakub Jermar 3 3 * Copyright (c) 2012 Adam Hraska 4 * 4 * 5 5 * All rights reserved. 6 6 * … … 62 62 63 63 /** Hash table item removal callback. 64 * 64 * 65 65 * Must not invoke any mutating functions of the hash table. 66 66 * -
kernel/generic/include/adt/list.h
rdf6ded8 r1b20da0 66 66 67 67 /** Initializer for statically allocated list. 68 * 68 * 69 69 * @code 70 70 * struct named_list { 71 71 * const char *name; 72 72 * list_t list; 73 * } var = { 74 * .name = "default name", 75 * .list = LIST_INITIALIZER(name_list.list) 73 * } var = { 74 * .name = "default name", 75 * .list = LIST_INITIALIZER(name_list.list) 76 76 * }; 77 77 * @endcode … … 111 111 * link_t item_link; 112 112 * } item_t; 113 * 113 * 114 114 * //.. 115 * 115 * 116 116 * // Print each list element's value and remove the element from the list. 117 117 * list_foreach_safe(mylist, cur_link, next_link) { … … 121 121 * } 122 122 * @endcode 123 * 123 * 124 124 * @param list List to traverse. 125 125 * @param iterator Iterator to the current element of the list.
Note:
See TracChangeset
for help on using the changeset viewer.
