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:
parent
159cefb14d
commit
a1fc8fe017
2 changed files with 12 additions and 0 deletions
|
@ -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
|
||||
|
|
10
lib/memory.c
10
lib/memory.c
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue