area.c 1.49 KB
Newer Older
1 2
#include <aml.h>
#include <assert.h>
3 4 5

/*******************************************************************************
 * Area Generic functions
6
 * Most of the stuff is dispatched to a different layer, using type-specific
7 8 9
 * functions.
 ******************************************************************************/

10
void *aml_area_malloc(struct aml_area *area, size_t size)
11 12
{
	assert(area != NULL);
13
	return area->ops->malloc(area->data, size);
14 15
}

16
void aml_area_free(struct aml_area *area, void *ptr)
17
{
18
	assert(area != NULL);
19
	area->ops->free(area->data, ptr);
20 21
}

22
void *aml_area_calloc(struct aml_area *area, size_t num, size_t size)
23
{
24
	assert(area != NULL);
25
	return area->ops->calloc(area->data, num, size);
26 27
}

28
void *aml_area_realloc(struct aml_area *area, void *ptr, size_t size)
29
{
30
	assert(area != NULL);
31
	return area->ops->realloc(area->data, ptr, size);
32 33
}

34
void *aml_area_acquire(struct aml_area *area, size_t size)
35
{
36
	assert(area != NULL);
37
	return area->ops->acquire(area->data, size);
38 39
}

40
void aml_area_release(struct aml_area *area, void *ptr)
41
{
42
	assert(area != NULL);
43
	area->ops->release(area->data, ptr);
44 45
}

46
void *aml_area_mmap(struct aml_area *area, void *ptr, size_t size)
47
{
48
	assert(area != NULL);
49
	return area->ops->mmap(area->data, ptr, size);
50 51
}

52
int aml_area_available(struct aml_area *area)
53
{
54
	assert(area != NULL);
55
	return area->ops->available(area->data);
56
}
57

58
int aml_area_binding(struct aml_area *area, struct aml_binding **binding)
59 60 61 62
{
	assert(area != NULL);
	return area->ops->binding(area->data, binding);
}