area.c 1.65 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 29 30 31 32 33
void *aml_area_memalign(struct aml_area *area, size_t align, size_t size)
{
	assert(area != NULL);
	return area->ops->memalign(area->data, align, size);
}

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

40
void *aml_area_acquire(struct aml_area *area, size_t size)
41
{
42
	assert(area != NULL);
43
	return area->ops->acquire(area->data, size);
44 45
}

46
void aml_area_release(struct aml_area *area, void *ptr)
47
{
48
	assert(area != NULL);
49
	area->ops->release(area->data, ptr);
50 51
}

52
void *aml_area_mmap(struct aml_area *area, void *ptr, size_t size)
53
{
54
	assert(area != NULL);
55
	return area->ops->mmap(area->data, ptr, size);
56 57
}

Kamil Iskra's avatar
Kamil Iskra committed
58
int aml_area_available(const struct aml_area *area)
59
{
60
	assert(area != NULL);
61
	return area->ops->available(area->data);
62
}
63

Kamil Iskra's avatar
Kamil Iskra committed
64
int aml_area_binding(const struct aml_area *area, struct aml_binding **binding)
65 66 67 68
{
	assert(area != NULL);
	return area->ops->binding(area->data, binding);
}