1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

memory: add new function to get memory type from flag

This commit is contained in:
Steffen Vogel 2018-10-21 12:57:02 +01:00
parent 159cefb14d
commit a1fc8fe017
2 changed files with 12 additions and 0 deletions

View file

@ -62,6 +62,8 @@ extern struct memory_type memory_hugepage;
struct memory_type * memory_ib(struct node *n, struct memory_type *parent);
struct memory_type * memory_managed(void *ptr, size_t len);
struct memory_type * memory_type_lookup(enum memory_type_flags flags);
#ifdef __cplusplus
}
#endif

View file

@ -163,3 +163,13 @@ struct memory_allocation * memory_get_allocation(void *ptr)
struct memory_allocation *ma = (struct memory_allocation *) hash_table_lookup(&allocations, ptr);
return ma;
}
struct memory_type * memory_type_lookup(enum memory_type_flags flags)
{
if (flags & MEMORY_HUGEPAGE)
return &memory_hugepage;
else if (flags & MEMORY_HEAP)
return &memory_heap;
else
return NULL;
}