| 1321 | } |
| 1322 | |
| 1323 | int |
| 1324 | malloc_heap_remove_external_memory(struct malloc_heap *heap, void *va_addr, |
| 1325 | size_t len) |
| 1326 | { |
| 1327 | struct malloc_elem *elem = heap->first; |
| 1328 | |
| 1329 | /* find element with specified va address */ |
| 1330 | while (elem != NULL && elem != va_addr) { |
| 1331 | elem = elem->next; |
| 1332 | /* stop if we've blown past our VA */ |
| 1333 | if (elem > (struct malloc_elem *)va_addr) { |
| 1334 | rte_errno = ENOENT; |
| 1335 | return -1; |
| 1336 | } |
| 1337 | } |
| 1338 | /* check if element was found */ |
| 1339 | if (elem == NULL || elem->msl->len != len) { |
| 1340 | rte_errno = ENOENT; |
| 1341 | return -1; |
| 1342 | } |
| 1343 | /* if element's size is not equal to segment len, segment is busy */ |
| 1344 | if (elem->state == ELEM_BUSY || elem->size != len) { |
| 1345 | rte_errno = EBUSY; |
| 1346 | return -1; |
| 1347 | } |
| 1348 | return destroy_elem(elem, len); |
| 1349 | } |
| 1350 | |
| 1351 | int |
| 1352 | malloc_heap_create(struct malloc_heap *heap, const char *heap_name) |
no test coverage detected