Changeset bb7e6fc5 in mainline
- Timestamp:
- 2011-12-09T21:41:35Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c24b272f
- Parents:
- 3342f33
- Location:
- kernel/generic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/lib/ra.h
r3342f33 rbb7e6fc5 77 77 } ra_segment_t; 78 78 79 extern ra_arena_t *ra_arena_create( uintptr_t, size_t);79 extern ra_arena_t *ra_arena_create(void); 80 80 extern bool ra_span_add(ra_arena_t *, uintptr_t, size_t); 81 81 extern uintptr_t ra_alloc(ra_arena_t *, size_t, size_t); -
kernel/generic/src/lib/ra.c
r3342f33 rbb7e6fc5 174 174 } 175 175 176 /** Create a rena with initial span. */177 ra_arena_t *ra_arena_create( uintptr_t base, size_t size)176 /** Create an empty arena. */ 177 ra_arena_t *ra_arena_create(void) 178 178 { 179 179 ra_arena_t *arena; 180 181 arena = (ra_arena_t *) malloc(sizeof(ra_arena_t), FRAME_ATOMIC); 182 if (!arena) 183 return NULL; 184 185 spinlock_initialize(&arena->lock, "arena_lock"); 186 list_initialize(&arena->spans); 187 188 return arena; 189 } 190 191 /** Add a span to arena. */ 192 bool ra_span_add(ra_arena_t *arena, uintptr_t base, size_t size) 193 { 180 194 ra_span_t *span; 181 195 … … 185 199 * slightly change the API of the resource allocator. 186 200 */ 187 if (base == 0)188 return NULL;189 190 arena = (ra_arena_t *) malloc(sizeof(ra_arena_t), FRAME_ATOMIC);191 if (!arena)192 return NULL;193 194 span = ra_span_create(base, size);195 if (!span) {196 free(arena);197 return NULL;198 }199 200 spinlock_initialize(&arena->lock, "arena_lock");201 list_initialize(&arena->spans);202 list_append(&span->span_link, &arena->spans);203 204 return arena;205 }206 207 /** Add additional span to arena. */208 bool ra_span_add(ra_arena_t *arena, uintptr_t base, size_t size)209 {210 ra_span_t *span;211 212 201 if (base == 0) 213 202 return false;
Note:
See TracChangeset
for help on using the changeset viewer.