Changeset 02667d9 in mainline
- Timestamp:
- 2017-10-09T19:10:25Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bfdb7c63
- Parents:
- d75dc05
- Location:
- kernel/generic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/lib/ra.h
rd75dc05 r02667d9 87 87 extern void ra_init(void); 88 88 extern ra_arena_t *ra_arena_create(void); 89 extern void ra_arena_destroy(ra_arena_t *); 89 90 extern bool ra_span_add(ra_arena_t *, uintptr_t, size_t); 90 91 extern bool ra_alloc(ra_arena_t *, size_t, size_t, uintptr_t *); -
kernel/generic/src/lib/ra.c
rd75dc05 r02667d9 75 75 static bool used_key_equal(void *key, const ht_link_t *item) 76 76 { 77 uintptr_t *base = ( sysarg_t *) key;77 uintptr_t *base = (uintptr_t *) key; 78 78 ra_segment_t *seg = hash_table_get_inst(item, ra_segment_t, uh_link); 79 79 return seg->base == *base; … … 184 184 } 185 185 186 static void ra_span_destroy(ra_span_t *span) 187 { 188 hash_table_destroy(&span->used); 189 190 list_foreach_safe(span->segments, cur, next) { 191 ra_segment_t *seg = list_get_instance(cur, ra_segment_t, 192 segment_link); 193 list_remove(&seg->segment_link); 194 if (seg->flags & RA_SEGMENT_FREE) 195 list_remove(&seg->fl_link); 196 ra_segment_destroy(seg); 197 } 198 199 free(span); 200 } 201 186 202 /** Create an empty arena. */ 187 203 ra_arena_t *ra_arena_create(void) … … 197 213 198 214 return arena; 215 } 216 217 void ra_arena_destroy(ra_arena_t *arena) 218 { 219 /* 220 * No locking necessary as this is the cleanup and all users should have 221 * stopped using the arena already. 222 */ 223 list_foreach_safe(arena->spans, cur, next) { 224 ra_span_t *span = list_get_instance(cur, ra_span_t, span_link); 225 list_remove(&span->span_link); 226 ra_span_destroy(span); 227 } 228 229 free(arena); 199 230 } 200 231
Note:
See TracChangeset
for help on using the changeset viewer.