MCPcopy Create free account
hub / github.com/F-Stack/f-stack / malloc_heap_remove_external_memory

Function malloc_heap_remove_external_memory

dpdk/lib/eal/common/malloc_heap.c:1323–1349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1321}
1322
1323int
1324malloc_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
1351int
1352malloc_heap_create(struct malloc_heap *heap, const char *heap_name)

Callers 1

Calls 1

destroy_elemFunction · 0.85

Tested by

no test coverage detected