Changeset 635 for trunk/kernel/libk/grdxt.h
- Timestamp:
- Jun 26, 2019, 11:42:37 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/libk/grdxt.h
r626 r635 36 36 * Memory for the second and third levels arrays is dynamically allocated by the 37 37 * grdxt_insert() function and is only released by grdxt_destroy(). 38 * - This structure is entirely contained in one single cluster. 39 * - All modifications (insert / remove) must be done by a thread running in local cluster. 40 * - Lookup can be done by a thread running in any cluster (local or remote). 38 * This structure is entirely contained in one single cluster, but to allow any thread 39 * to access it, two sets of access functions are defined: 40 * - local threads can use access function using local pointers. 41 * - remote threads must use the access functions using extended pointers. 41 42 ****************************************************************************************** 42 43 * When it is used by the mapper implementing the file cache: … … 54 55 grdxt_t; 55 56 57 //////////////////////////////////////////////////////////////////////////////////////////// 58 // Local access functions 59 //////////////////////////////////////////////////////////////////////////////////////////// 60 56 61 /******************************************************************************************* 57 62 * This function initialises the radix-tree descriptor, 63 * It must be called by a local thread. 58 64 * and allocates memory for the first level array of pointers. 59 65 ******************************************************************************************* … … 71 77 /******************************************************************************************* 72 78 * This function releases all memory allocated to the radix-tree infrastructure. 73 * The radix-tree is supposed to be empty, but this is NOT checked by this function. 79 * It must be called by a local thread. 80 * A warning message is printed on the kernel TXT0 if the radix tree is not empty. 74 81 ******************************************************************************************* 75 82 * @ rt : pointer on the radix-tree descriptor. … … 79 86 /******************************************************************************************* 80 87 * This function insert a new item in the radix-tree. 88 * It must be called by a local thread. 81 89 * It dynamically allocates memory for new second and third level arrays if required. 82 90 ******************************************************************************************* … … 84 92 * @ key : key value. 85 93 * @ value : pointer on item to be registered in radix-tree. 86 * @ returns 0 if success / returns ENOMEM if no memory, or EINVAL ifillegal key.94 * @ returns 0 if success / returns -1 if no memory, or illegal key. 87 95 ******************************************************************************************/ 88 96 error_t grdxt_insert( grdxt_t * rt, … … 91 99 92 100 /******************************************************************************************* 93 * This function removes an item identified by its key, and returns a pointer 94 * on the removed item. No memory is released. 101 * This function removes an item identified by its key from the radix tree, 102 * It must be called by a local thread. 103 * and returns a pointer on the removed item. No memory is released. 95 104 ******************************************************************************************* 96 105 * @ rt : pointer on the radix-tree descriptor. … … 103 112 /******************************************************************************************* 104 113 * This function returns to a local client, a local pointer on the item identified 114 * It must be called by a local thread. 105 115 * by the <key> argument, from the radix tree identified by the <rt> local pointer. 106 116 ******************************************************************************************* … … 113 123 114 124 /******************************************************************************************* 115 * This function returns to a - possibly remote - remote client, an extended pointer116 * on the item identified by the <key> argument, from the radix tree identified by117 * the <rt_xp> remote pointer.118 *******************************************************************************************119 * @ rt_xp : extended pointer on the radix-tree descriptor.120 * @ key : key value.121 * @ returns an extended pointer on found item if success / returns XPTR_NULL if failure.122 ******************************************************************************************/123 xptr_t grdxt_remote_lookup( xptr_t rt_xp,124 uint32_t key );125 126 /*******************************************************************************************127 125 * This function scan all radix-tree entries in increasing key order, starting from 126 * It must be called by a local thread. 128 127 * the value defined by the <key> argument, and return a pointer on the first valid 129 128 * registered item, and the found item key value. … … 138 137 uint32_t * found_key ); 139 138 139 //////////////////////////////////////////////////////////////////////////////////////////// 140 // Remote access functions 141 //////////////////////////////////////////////////////////////////////////////////////////// 142 143 /******************************************************************************************* 144 * This function insert a new item in a - possibly remote - radix tree. 145 * It dynamically allocates memory for new second and third level arrays if required. 146 ******************************************************************************************* 147 * @ rt_xp : extended pointer on the radix-tree descriptor. 148 * @ key : key value. 149 * @ value : pointer on item to be registered in radix-tree. 150 * @ returns 0 if success / returns -1 if no memory, or illegal key. 151 ******************************************************************************************/ 152 error_t grdxt_remote_insert( xptr_t rt_xp, 153 uint32_t key, 154 void * value ); 155 156 /******************************************************************************************* 157 * This function removes an item identified by its key from a - possibly remote - radix 158 * tree, and returns a local pointer on the removed item. No memory is released. 159 ******************************************************************************************* 160 * @ rt_xp : pointer on the radix-tree descriptor. 161 * @ key : key value. 162 * @ returns local pointer on removed item if success / returns NULL if failure. 163 ******************************************************************************************/ 164 void * grdxt_remote_remove( xptr_t rt_xp, 165 uint32_t key ); 166 167 /******************************************************************************************* 168 * This function returns to a - possibly remote - client, an extended pointer 169 * on the item identified by the <key> argument, from the radix tree identified by 170 * the <rt_xp> remote pointer. 171 ******************************************************************************************* 172 * @ rt_xp : extended pointer on the radix-tree descriptor. 173 * @ key : key value. 174 * @ returns an extended pointer on found item if success / returns XPTR_NULL if failure. 175 ******************************************************************************************/ 176 xptr_t grdxt_remote_lookup( xptr_t rt_xp, 177 uint32_t key ); 178 140 179 /******************************************************************************************* 141 180 * This function displays the current content of a possibly remote radix_tree. … … 144 183 * @ string : radix tree identifier. 145 184 ******************************************************************************************/ 146 void grdxt_display( xptr_t rt_xp, 147 char * string ); 148 185 void grdxt_remote_display( xptr_t rt_xp, 186 char * string ); 149 187 150 188 #endif /* _GRDXT_H_ */
Note: See TracChangeset
for help on using the changeset viewer.