| 1379 | } |
| 1380 | |
| 1381 | int |
| 1382 | malloc_heap_destroy(struct malloc_heap *heap) |
| 1383 | { |
| 1384 | if (heap->alloc_count != 0) { |
| 1385 | RTE_LOG(ERR, EAL, "Heap is still in use\n"); |
| 1386 | rte_errno = EBUSY; |
| 1387 | return -1; |
| 1388 | } |
| 1389 | if (heap->first != NULL || heap->last != NULL) { |
| 1390 | RTE_LOG(ERR, EAL, "Heap still contains memory segments\n"); |
| 1391 | rte_errno = EBUSY; |
| 1392 | return -1; |
| 1393 | } |
| 1394 | if (heap->total_size != 0) |
| 1395 | RTE_LOG(ERR, EAL, "Total size not zero, heap is likely corrupt\n"); |
| 1396 | |
| 1397 | /* Reset all of the heap but the (hold) lock so caller can release it. */ |
| 1398 | RTE_BUILD_BUG_ON(offsetof(struct malloc_heap, lock) != 0); |
| 1399 | memset(RTE_PTR_ADD(heap, sizeof(heap->lock)), 0, |
| 1400 | sizeof(*heap) - sizeof(heap->lock)); |
| 1401 | |
| 1402 | return 0; |
| 1403 | } |
| 1404 | |
| 1405 | int |
| 1406 | rte_eal_malloc_heap_init(void) |
no test coverage detected