Commit a0f603df authored by Kamil Iskra's avatar Kamil Iskra

Constify

parent c03d3270
...@@ -105,8 +105,8 @@ struct aml_area_ops { ...@@ -105,8 +105,8 @@ struct aml_area_ops {
void *(*acquire)(struct aml_area_data *area, size_t size); void *(*acquire)(struct aml_area_data *area, size_t size);
void (*release)(struct aml_area_data *area, void *ptr); void (*release)(struct aml_area_data *area, void *ptr);
void *(*mmap)(struct aml_area_data *area, void *ptr, size_t size); void *(*mmap)(struct aml_area_data *area, void *ptr, size_t size);
int (*available)(struct aml_area_data *area); int (*available)(const struct aml_area_data *area);
int (*binding)(struct aml_area_data *area, int (*binding)(const struct aml_area_data *area,
struct aml_binding **binding); struct aml_binding **binding);
}; };
...@@ -152,7 +152,7 @@ struct aml_area_linux_manager_data { ...@@ -152,7 +152,7 @@ struct aml_area_linux_manager_data {
}; };
struct aml_area_linux_manager_ops { struct aml_area_linux_manager_ops {
struct aml_arena *(*get_arena)(struct aml_area_linux_manager_data *data); struct aml_arena *(*get_arena)(const struct aml_area_linux_manager_data *data);
}; };
extern struct aml_area_linux_manager_ops aml_area_linux_manager_single_ops; extern struct aml_area_linux_manager_ops aml_area_linux_manager_single_ops;
...@@ -187,13 +187,13 @@ struct aml_area_linux_mbind_ops { ...@@ -187,13 +187,13 @@ struct aml_area_linux_mbind_ops {
int (*pre_bind)(struct aml_area_linux_mbind_data *data); int (*pre_bind)(struct aml_area_linux_mbind_data *data);
int (*post_bind)(struct aml_area_linux_mbind_data *data, void *ptr, int (*post_bind)(struct aml_area_linux_mbind_data *data, void *ptr,
size_t size); size_t size);
int (*binding)(struct aml_area_linux_mbind_data *data, int (*binding)(const struct aml_area_linux_mbind_data *data,
struct aml_binding **binding); struct aml_binding **binding);
}; };
int aml_area_linux_mbind_setdata(struct aml_area_linux_mbind_data *data, int aml_area_linux_mbind_setdata(struct aml_area_linux_mbind_data *data,
int policy, unsigned long *nodemask); int policy, const unsigned long *nodemask);
int aml_area_linux_mbind_generic_binding(struct aml_area_linux_mbind_data *data, int aml_area_linux_mbind_generic_binding(const struct aml_area_linux_mbind_data *data,
struct aml_binding **binding); struct aml_binding **binding);
int aml_area_linux_mbind_regular_pre_bind(struct aml_area_linux_mbind_data *data); int aml_area_linux_mbind_regular_pre_bind(struct aml_area_linux_mbind_data *data);
int aml_area_linux_mbind_regular_post_bind(struct aml_area_linux_mbind_data *data, int aml_area_linux_mbind_regular_post_bind(struct aml_area_linux_mbind_data *data,
...@@ -202,7 +202,7 @@ int aml_area_linux_mbind_mempolicy_pre_bind(struct aml_area_linux_mbind_data *da ...@@ -202,7 +202,7 @@ int aml_area_linux_mbind_mempolicy_pre_bind(struct aml_area_linux_mbind_data *da
int aml_area_linux_mbind_mempolicy_post_bind(struct aml_area_linux_mbind_data *data, int aml_area_linux_mbind_mempolicy_post_bind(struct aml_area_linux_mbind_data *data,
void *ptr, size_t size); void *ptr, size_t size);
int aml_area_linux_mbind_init(struct aml_area_linux_mbind_data *data, int aml_area_linux_mbind_init(struct aml_area_linux_mbind_data *data,
int policy, unsigned long *nodemask); int policy, const unsigned long *nodemask);
int aml_area_linux_mbind_destroy(struct aml_area_linux_mbind_data *data); int aml_area_linux_mbind_destroy(struct aml_area_linux_mbind_data *data);
extern struct aml_area_linux_mbind_ops aml_area_linux_mbind_regular_ops; extern struct aml_area_linux_mbind_ops aml_area_linux_mbind_regular_ops;
...@@ -291,8 +291,8 @@ void *aml_area_realloc(struct aml_area *area, void *ptr, size_t size); ...@@ -291,8 +291,8 @@ void *aml_area_realloc(struct aml_area *area, void *ptr, size_t size);
void *aml_area_acquire(struct aml_area *area, size_t size); void *aml_area_acquire(struct aml_area *area, size_t size);
void aml_area_release(struct aml_area *area, void *ptr); void aml_area_release(struct aml_area *area, void *ptr);
void *aml_area_mmap(struct aml_area *area, void *ptr, size_t size); void *aml_area_mmap(struct aml_area *area, void *ptr, size_t size);
int aml_area_available(struct aml_area *area); int aml_area_available(const struct aml_area *area);
int aml_area_binding(struct aml_area *area, struct aml_binding **binding); int aml_area_binding(const struct aml_area *area, struct aml_binding **binding);
/******************************************************************************* /*******************************************************************************
* Tiling: * Tiling:
...@@ -316,9 +316,9 @@ struct aml_tiling_ops { ...@@ -316,9 +316,9 @@ struct aml_tiling_ops {
struct aml_tiling_iterator *iterator, int flags); struct aml_tiling_iterator *iterator, int flags);
int (*destroy_iterator)(struct aml_tiling_data *tiling, int (*destroy_iterator)(struct aml_tiling_data *tiling,
struct aml_tiling_iterator *iterator); struct aml_tiling_iterator *iterator);
size_t (*tilesize)(struct aml_tiling_data *tiling, int tileid); size_t (*tilesize)(const struct aml_tiling_data *tiling, int tileid);
void* (*tilestart)(struct aml_tiling_data *tiling, void *ptr, void* (*tilestart)(const struct aml_tiling_data *tiling,
int tileid); const void *ptr, int tileid);
}; };
struct aml_tiling { struct aml_tiling {
...@@ -326,8 +326,9 @@ struct aml_tiling { ...@@ -326,8 +326,9 @@ struct aml_tiling {
struct aml_tiling_data *data; struct aml_tiling_data *data;
}; };
size_t aml_tiling_tilesize(struct aml_tiling *tiling, int tileid); size_t aml_tiling_tilesize(const struct aml_tiling *tiling, int tileid);
void* aml_tiling_tilestart(struct aml_tiling *tiling, void *ptr, int tileid); void* aml_tiling_tilestart(const struct aml_tiling *tiling, const void *ptr,
int tileid);
int aml_tiling_create_iterator(struct aml_tiling *tiling, int aml_tiling_create_iterator(struct aml_tiling *tiling,
...@@ -341,8 +342,9 @@ int aml_tiling_destroy_iterator(struct aml_tiling *tiling, ...@@ -341,8 +342,9 @@ int aml_tiling_destroy_iterator(struct aml_tiling *tiling,
struct aml_tiling_iterator_ops { struct aml_tiling_iterator_ops {
int (*reset)(struct aml_tiling_iterator_data *iterator); int (*reset)(struct aml_tiling_iterator_data *iterator);
int (*next)(struct aml_tiling_iterator_data *iterator); int (*next)(struct aml_tiling_iterator_data *iterator);
int (*end)(struct aml_tiling_iterator_data *iterator); int (*end)(const struct aml_tiling_iterator_data *iterator);
int (*get)(struct aml_tiling_iterator_data *iterator, va_list args); int (*get)(const struct aml_tiling_iterator_data *iterator,
va_list args);
}; };
struct aml_tiling_iterator { struct aml_tiling_iterator {
...@@ -352,8 +354,8 @@ struct aml_tiling_iterator { ...@@ -352,8 +354,8 @@ struct aml_tiling_iterator {
int aml_tiling_iterator_reset(struct aml_tiling_iterator *iterator); int aml_tiling_iterator_reset(struct aml_tiling_iterator *iterator);
int aml_tiling_iterator_next(struct aml_tiling_iterator *iterator); int aml_tiling_iterator_next(struct aml_tiling_iterator *iterator);
int aml_tiling_iterator_end(struct aml_tiling_iterator *iterator); int aml_tiling_iterator_end(const struct aml_tiling_iterator *iterator);
int aml_tiling_iterator_get(struct aml_tiling_iterator *iterator, ...); int aml_tiling_iterator_get(const struct aml_tiling_iterator *iterator, ...);
#define AML_TILING_TYPE_1D 0 #define AML_TILING_TYPE_1D 0
...@@ -409,12 +411,15 @@ struct aml_tiling_iterator_1d_data { ...@@ -409,12 +411,15 @@ struct aml_tiling_iterator_1d_data {
struct aml_binding_data; struct aml_binding_data;
struct aml_binding_ops { struct aml_binding_ops {
int (*nbpages)(struct aml_binding_data *binding, int (*nbpages)(const struct aml_binding_data *binding,
struct aml_tiling *tiling, void *ptr, int tileid); const struct aml_tiling *tiling, const void *ptr,
int (*pages)(struct aml_binding_data *binding, void **pages, int tileid);
struct aml_tiling *tiling, void *ptr, int tileid); int (*pages)(const struct aml_binding_data *binding, void **pages,
int (*nodes)(struct aml_binding_data *binding, int *nodes, const struct aml_tiling *tiling, const void *ptr,
struct aml_tiling *tiling, void *ptr, int tileid); int tileid);
int (*nodes)(const struct aml_binding_data *binding, int *nodes,
const struct aml_tiling *tiling, const void *ptr,
int tileid);
}; };
struct aml_binding { struct aml_binding {
...@@ -422,12 +427,15 @@ struct aml_binding { ...@@ -422,12 +427,15 @@ struct aml_binding {
struct aml_binding_data *data; struct aml_binding_data *data;
}; };
int aml_binding_nbpages(struct aml_binding *binding, struct aml_tiling *tiling, int aml_binding_nbpages(const struct aml_binding *binding,
void *ptr, int tileid); const struct aml_tiling *tiling,
int aml_binding_pages(struct aml_binding *binding, void **pages, const void *ptr, int tileid);
struct aml_tiling *tiling, void *ptr, int tileid); int aml_binding_pages(const struct aml_binding *binding, void **pages,
int aml_binding_nodes(struct aml_binding *binding, int *nodes, const struct aml_tiling *tiling, const void *ptr,
struct aml_tiling *tiling, void *ptr, int tileid); int tileid);
int aml_binding_nodes(const struct aml_binding *binding, int *nodes,
const struct aml_tiling *tiling, const void *ptr,
int tileid);
#define AML_BINDING_TYPE_SINGLE 0 #define AML_BINDING_TYPE_SINGLE 0
#define AML_BINDING_TYPE_INTERLEAVE 1 #define AML_BINDING_TYPE_INTERLEAVE 1
......
...@@ -49,13 +49,13 @@ void *aml_area_mmap(struct aml_area *area, void *ptr, size_t size) ...@@ -49,13 +49,13 @@ void *aml_area_mmap(struct aml_area *area, void *ptr, size_t size)
return area->ops->mmap(area->data, ptr, size); return area->ops->mmap(area->data, ptr, size);
} }
int aml_area_available(struct aml_area *area) int aml_area_available(const struct aml_area *area)
{ {
assert(area != NULL); assert(area != NULL);
return area->ops->available(area->data); return area->ops->available(area->data);
} }
int aml_area_binding(struct aml_area *area, struct aml_binding **binding) int aml_area_binding(const struct aml_area *area, struct aml_binding **binding)
{ {
assert(area != NULL); assert(area != NULL);
return area->ops->binding(area->data, binding); return area->ops->binding(area->data, binding);
......
...@@ -23,15 +23,15 @@ void *aml_area_linux_mmap(struct aml_area_data *a, void *ptr, size_t sz) ...@@ -23,15 +23,15 @@ void *aml_area_linux_mmap(struct aml_area_data *a, void *ptr, size_t sz)
return ret; return ret;
} }
int aml_area_linux_available(struct aml_area_data *a) int aml_area_linux_available(const struct aml_area_data *a)
{ {
return 1; return 1;
} }
int aml_area_linux_binding(struct aml_area_data *a, struct aml_binding **b) int aml_area_linux_binding(const struct aml_area_data *a, struct aml_binding **b)
{ {
assert(a != NULL); assert(a != NULL);
struct aml_area_linux *area = (struct aml_area_linux *)a; const struct aml_area_linux *area = (const struct aml_area_linux *)a;
return area->ops.mbind.binding(&area->data.mbind, b); return area->ops.mbind.binding(&area->data.mbind, b);
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
******************************************************************************/ ******************************************************************************/
struct aml_arena * aml_area_linux_manager_single_get_arena( struct aml_arena * aml_area_linux_manager_single_get_arena(
struct aml_area_linux_manager_data *data) const struct aml_area_linux_manager_data *data)
{ {
return data->pool; return data->pool;
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
******************************************************************************/ ******************************************************************************/
/* common to both methods */ /* common to both methods */
int aml_area_linux_mbind_generic_binding(struct aml_area_linux_mbind_data *data, int aml_area_linux_mbind_generic_binding(const struct aml_area_linux_mbind_data *data,
struct aml_binding **b) struct aml_binding **b)
{ {
assert(data != NULL); assert(data != NULL);
...@@ -51,7 +51,7 @@ struct aml_area_linux_mbind_ops aml_area_linux_mbind_regular_ops = { ...@@ -51,7 +51,7 @@ struct aml_area_linux_mbind_ops aml_area_linux_mbind_regular_ops = {
}; };
int aml_area_linux_mbind_setdata(struct aml_area_linux_mbind_data *data, int aml_area_linux_mbind_setdata(struct aml_area_linux_mbind_data *data,
int policy, unsigned long *nodemask) int policy, const unsigned long *nodemask)
{ {
assert(data != NULL); assert(data != NULL);
data->policy = policy; data->policy = policy;
...@@ -97,7 +97,7 @@ struct aml_area_linux_mbind_ops aml_area_linux_mbind_mempolicy_ops = { ...@@ -97,7 +97,7 @@ struct aml_area_linux_mbind_ops aml_area_linux_mbind_mempolicy_ops = {
}; };
int aml_area_linux_mbind_init(struct aml_area_linux_mbind_data *data, int aml_area_linux_mbind_init(struct aml_area_linux_mbind_data *data,
int policy, unsigned long *nodemask) int policy, const unsigned long *nodemask)
{ {
assert(data != NULL); assert(data != NULL);
aml_area_linux_mbind_setdata(data, policy, nodemask); aml_area_linux_mbind_setdata(data, policy, nodemask);
......
...@@ -62,7 +62,7 @@ int aml_area_linux_mmap_tmpfile_init(struct aml_area_linux_mmap_data *data, ...@@ -62,7 +62,7 @@ int aml_area_linux_mmap_tmpfile_init(struct aml_area_linux_mmap_data *data,
data->flags = MAP_PRIVATE; data->flags = MAP_PRIVATE;
data->fildes = mkstemp(template); data->fildes = mkstemp(template);
data->off = 0; data->off = 0;
ftruncate(data->fildes, max); int n = ftruncate(data->fildes, max);
/* TODO: check & return errno */ /* TODO: check & return errno */
return 0; return 0;
} }
......
...@@ -17,7 +17,7 @@ void *aml_area_posix_mmap(struct aml_area_data *data, void *ptr, size_t sz) ...@@ -17,7 +17,7 @@ void *aml_area_posix_mmap(struct aml_area_data *data, void *ptr, size_t sz)
-1, 0); -1, 0);
} }
int aml_area_posix_available(struct aml_area_data *data) int aml_area_posix_available(const struct aml_area_data *data)
{ {
assert(data != NULL); assert(data != NULL);
return 1; return 1;
...@@ -26,7 +26,7 @@ int aml_area_posix_available(struct aml_area_data *data) ...@@ -26,7 +26,7 @@ int aml_area_posix_available(struct aml_area_data *data)
/* same thing here, it makes no sense to ask for this area to provide its /* same thing here, it makes no sense to ask for this area to provide its
* binding scheme, as no-one should migrate to this area. * binding scheme, as no-one should migrate to this area.
*/ */
int aml_area_posix_binding(struct aml_area_data *data, struct aml_binding **b) int aml_area_posix_binding(const struct aml_area_data *data, struct aml_binding **b)
{ {
assert(data != NULL); assert(data != NULL);
/* numa node 0 should always be available */ /* numa node 0 should always be available */
......
...@@ -25,7 +25,7 @@ static struct aml_arena_jemalloc_global_data aml_arena_jemalloc_global = { ...@@ -25,7 +25,7 @@ static struct aml_arena_jemalloc_global_data aml_arena_jemalloc_global = {
}; };
static struct aml_area *aml_arena_registry_get( static struct aml_area *aml_arena_registry_get(
struct aml_arena_jemalloc_global_data *g, const struct aml_arena_jemalloc_global_data *g,
unsigned int arenaid) unsigned int arenaid)
{ {
assert(g != NULL); assert(g != NULL);
...@@ -234,7 +234,7 @@ int aml_arena_jemalloc_deregister_arena(struct aml_arena_data *a) ...@@ -234,7 +234,7 @@ int aml_arena_jemalloc_deregister_arena(struct aml_arena_data *a)
} }
void *aml_arena_jemalloc_mallocx(struct aml_arena_data *a, size_t sz, void *aml_arena_jemalloc_mallocx(struct aml_arena_data *a, size_t sz,
int extraflags) int extraflags)
{ {
struct aml_arena_jemalloc_data *arena = struct aml_arena_jemalloc_data *arena =
(struct aml_arena_jemalloc_data*) a; (struct aml_arena_jemalloc_data*) a;
......
...@@ -7,16 +7,16 @@ ...@@ -7,16 +7,16 @@
* functions. * functions.
******************************************************************************/ ******************************************************************************/
int aml_binding_nbpages(struct aml_binding *binding, int aml_binding_nbpages(const struct aml_binding *binding,
struct aml_tiling *tiling, void *ptr, int tileid) const struct aml_tiling *tiling, const void *ptr, int tileid)
{ {
assert(binding != NULL); assert(binding != NULL);
assert(tiling != NULL); assert(tiling != NULL);
return binding->ops->nbpages(binding->data, tiling, ptr, tileid); return binding->ops->nbpages(binding->data, tiling, ptr, tileid);
} }
int aml_binding_pages(struct aml_binding *binding, void **pages, int aml_binding_pages(const struct aml_binding *binding, void **pages,
struct aml_tiling *tiling, void *ptr, int tileid) const struct aml_tiling *tiling, const void *ptr, int tileid)
{ {
assert(binding != NULL); assert(binding != NULL);
assert(pages != NULL); assert(pages != NULL);
...@@ -24,8 +24,8 @@ int aml_binding_pages(struct aml_binding *binding, void **pages, ...@@ -24,8 +24,8 @@ int aml_binding_pages(struct aml_binding *binding, void **pages,
return binding->ops->pages(binding->data, pages, tiling, ptr, tileid); return binding->ops->pages(binding->data, pages, tiling, ptr, tileid);
} }
int aml_binding_nodes(struct aml_binding *binding, int *nodes, int aml_binding_nodes(const struct aml_binding *binding, int *nodes,
struct aml_tiling *tiling, void *ptr, int tileid) const struct aml_tiling *tiling, const void *ptr, int tileid)
{ {
assert(binding != NULL); assert(binding != NULL);
assert(nodes != NULL); assert(nodes != NULL);
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
* Pages interleaved across all nodes * Pages interleaved across all nodes
******************************************************************************/ ******************************************************************************/
int aml_binding_interleave_getinfo(struct aml_binding_data *data, int aml_binding_interleave_getinfo(const struct aml_binding_data *data,
intptr_t *start, intptr_t *end, intptr_t *start, intptr_t *end,
struct aml_tiling *tiling, void *ptr, const struct aml_tiling *tiling, const void *ptr,
int tileid) int tileid)
{ {
assert(data != NULL); assert(data != NULL);
...@@ -25,8 +25,8 @@ int aml_binding_interleave_getinfo(struct aml_binding_data *data, ...@@ -25,8 +25,8 @@ int aml_binding_interleave_getinfo(struct aml_binding_data *data,
} }
int aml_binding_interleave_nbpages(struct aml_binding_data *data, int aml_binding_interleave_nbpages(const struct aml_binding_data *data,
struct aml_tiling *tiling, void *ptr, const struct aml_tiling *tiling, const void *ptr,
int tileid) int tileid)
{ {
assert(data != NULL); assert(data != NULL);
...@@ -35,8 +35,8 @@ int aml_binding_interleave_nbpages(struct aml_binding_data *data, ...@@ -35,8 +35,8 @@ int aml_binding_interleave_nbpages(struct aml_binding_data *data,
return aml_binding_interleave_getinfo(data, &start, &end, tiling, ptr, tileid); return aml_binding_interleave_getinfo(data, &start, &end, tiling, ptr, tileid);
} }
int aml_binding_interleave_pages(struct aml_binding_data *data, void **pages, int aml_binding_interleave_pages(const struct aml_binding_data *data, void **pages,
struct aml_tiling *tiling, void *ptr, const struct aml_tiling *tiling, const void *ptr,
int tileid) int tileid)
{ {
assert(data != NULL); assert(data != NULL);
...@@ -50,8 +50,8 @@ int aml_binding_interleave_pages(struct aml_binding_data *data, void **pages, ...@@ -50,8 +50,8 @@ int aml_binding_interleave_pages(struct aml_binding_data *data, void **pages,
return 0; return 0;
} }
int aml_binding_interleave_nodes(struct aml_binding_data *data, int *nodes, int aml_binding_interleave_nodes(const struct aml_binding_data *data, int *nodes,
struct aml_tiling *tiling, void *ptr, const struct aml_tiling *tiling, const void *ptr,
int tileid) int tileid)
{ {
assert(data != NULL); assert(data != NULL);
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
* All pages on the same node * All pages on the same node
******************************************************************************/ ******************************************************************************/
int aml_binding_single_getinfo(struct aml_binding_data *data, int aml_binding_single_getinfo(const struct aml_binding_data *data,
intptr_t *start, intptr_t *end, intptr_t *start, intptr_t *end,
struct aml_tiling *tiling, void *ptr, const struct aml_tiling *tiling, const void *ptr,
int tileid) int tileid)
{ {
assert(data != NULL); assert(data != NULL);
...@@ -25,8 +25,8 @@ int aml_binding_single_getinfo(struct aml_binding_data *data, ...@@ -25,8 +25,8 @@ int aml_binding_single_getinfo(struct aml_binding_data *data,
} }
int aml_binding_single_nbpages(struct aml_binding_data *data, int aml_binding_single_nbpages(const struct aml_binding_data *data,
struct aml_tiling *tiling, void *ptr, const struct aml_tiling *tiling, const void *ptr,
int tileid) int tileid)
{ {
assert(data != NULL); assert(data != NULL);
...@@ -35,8 +35,8 @@ int aml_binding_single_nbpages(struct aml_binding_data *data, ...@@ -35,8 +35,8 @@ int aml_binding_single_nbpages(struct aml_binding_data *data,
return aml_binding_single_getinfo(data, &start, &end, tiling, ptr, tileid); return aml_binding_single_getinfo(data, &start, &end, tiling, ptr, tileid);
} }
int aml_binding_single_pages(struct aml_binding_data *data, void **pages, int aml_binding_single_pages(const struct aml_binding_data *data, void **pages,
struct aml_tiling *tiling, void *ptr, const struct aml_tiling *tiling, const void *ptr,
int tileid) int tileid)
{ {
assert(data != NULL); assert(data != NULL);
...@@ -50,8 +50,8 @@ int aml_binding_single_pages(struct aml_binding_data *data, void **pages, ...@@ -50,8 +50,8 @@ int aml_binding_single_pages(struct aml_binding_data *data, void **pages,
return 0; return 0;
} }
int aml_binding_single_nodes(struct aml_binding_data *data, int *nodes, int aml_binding_single_nodes(const struct aml_binding_data *data, int *nodes,
struct aml_tiling *tiling, void *ptr, const struct aml_tiling *tiling, const void *ptr,
int tileid) int tileid)
{ {
assert(data != NULL); assert(data != NULL);
......
...@@ -52,10 +52,10 @@ struct aml_dma_request_ops aml_dma_request_linux_seq_ops = { ...@@ -52,10 +52,10 @@ struct aml_dma_request_ops aml_dma_request_linux_seq_ops = {
}; };
int aml_dma_request_linux_seq_copy_init(struct aml_dma_request *r, int aml_dma_request_linux_seq_copy_init(struct aml_dma_request *r,
struct aml_tiling *dt, const struct aml_tiling *dt,
void *dptr, int dtid, void *dptr, int dtid,
struct aml_tiling *st, const struct aml_tiling *st,
void *sptr, int stid) const void *sptr, int stid)
{ {
assert(r != NULL); assert(r != NULL);
struct aml_dma_request_linux_seq_data *data = struct aml_dma_request_linux_seq_data *data =
...@@ -78,7 +78,7 @@ int aml_dma_request_linux_seq_copy_destroy(struct aml_dma_request *r) ...@@ -78,7 +78,7 @@ int aml_dma_request_linux_seq_copy_destroy(struct aml_dma_request *r)
int aml_dma_request_linux_seq_move_init(struct aml_dma_request *r, int aml_dma_request_linux_seq_move_init(struct aml_dma_request *r,
struct aml_area *darea, struct aml_area *darea,
struct aml_tiling *tiling, const struct aml_tiling *tiling,
void *startptr, int tileid) void *startptr, int tileid)
{ {
assert(r != NULL); assert(r != NULL);
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
/******************************************************************************* /*******************************************************************************
* Tiling functions * Tiling functions
******************************************************************************/ ******************************************************************************/
size_t aml_tiling_tilesize(struct aml_tiling *t, int tileid) size_t aml_tiling_tilesize(const struct aml_tiling *t, int tileid)
{ {
assert(t != NULL); assert(t != NULL);
return t->ops->tilesize(t->data, tileid); return t->ops->tilesize(t->data, tileid);
} }
void* aml_tiling_tilestart(struct aml_tiling *t, void *ptr, int tileid) void* aml_tiling_tilestart(const struct aml_tiling *t, const void *ptr, int tileid)
{ {
assert(t != NULL); assert(t != NULL);
return t->ops->tilestart(t->data, ptr, tileid); return t->ops->tilestart(t->data, ptr, tileid);
...@@ -32,13 +32,13 @@ int aml_tiling_iterator_next(struct aml_tiling_iterator *it) ...@@ -32,13 +32,13 @@ int aml_tiling_iterator_next(struct aml_tiling_iterator *it)
return it->ops->next(it->data); return it->ops->next(it->data);
} }
int aml_tiling_iterator_end(struct aml_tiling_iterator *it) int aml_tiling_iterator_end(const struct aml_tiling_iterator *it)
{ {
assert(it != NULL); assert(it != NULL);
return it->ops->end(it->data); return it->ops->end(it->data);
} }
int aml_tiling_iterator_get(struct aml_tiling_iterator *it, ...) int aml_tiling_iterator_get(const struct aml_tiling_iterator *it, ...)
{ {
assert(it != NULL); assert(it != NULL);
va_list ap; va_list ap;
......
...@@ -13,10 +13,10 @@ int aml_tiling_iterator_1d_reset(struct aml_tiling_iterator_data *data) ...@@ -13,10 +13,10 @@ int aml_tiling_iterator_1d_reset(struct aml_tiling_iterator_data *data)
return 0; return 0;
} }
int aml_tiling_iterator_1d_end(struct aml_tiling_iterator_data *data) int aml_tiling_iterator_1d_end(const struct aml_tiling_iterator_data *data)
{ {
struct aml_tiling_iterator_1d_data *it = const struct aml_tiling_iterator_1d_data *it =
(struct aml_tiling_iterator_1d_data *)data; (const struct aml_tiling_iterator_1d_data *)data;
return it->i * it->tiling->blocksize >= it->tiling->totalsize; return it->i * it->tiling->blocksize >= it->tiling->totalsize;
} }
...@@ -28,11 +28,11 @@ int aml_tiling_iterator_1d_next(struct aml_tiling_iterator_data *data) ...@@ -28,11 +28,11 @@ int aml_tiling_iterator_1d_next(struct aml_tiling_iterator_data *data)
return 0; return 0;
} }
int aml_tiling_iterator_1d_get(struct aml_tiling_iterator_data *data, int aml_tiling_iterator_1d_get(const struct aml_tiling_iterator_data *data,
va_list args) va_list args)
{ {
struct aml_tiling_iterator_1d_data *it = const struct aml_tiling_iterator_1d_data *it =
(struct aml_tiling_iterator_1d_data *)data; (const struct aml_tiling_iterator_1d_data *)data;
unsigned long *x = va_arg(args, unsigned long *); unsigned long *x = va_arg(args, unsigned long *);
*x = it->i; *x = it->i;
return 0; return 0;
...@@ -49,17 +49,17 @@ struct aml_tiling_iterator_ops aml_tiling_iterator_1d_ops = { ...@@ -49,17 +49,17 @@ struct aml_tiling_iterator_ops aml_tiling_iterator_1d_ops = {
* 1D ops * 1D ops
******************************************************************************/ ******************************************************************************/
size_t aml_tiling_1d_tilesize(struct aml_tiling_data *t, int tileid) size_t aml_tiling_1d_tilesize(const struct aml_tiling_data *t, int tileid)
{ {
struct aml_tiling_1d_data *data = const struct aml_tiling_1d_data *data =
(struct aml_tiling_1d_data *)t; (const struct aml_tiling_1d_data *)t;
return data->blocksize; return data->blocksize;
} }
void* aml_tiling_1d_tilestart(struct aml_tiling_data *t, void *ptr, int tileid) void* aml_tiling_1d_tilestart(const struct aml_tiling_data *t, const void *ptr, int tileid)
{ {
struct aml_tiling_1d_data *data = const struct aml_tiling_1d_data *data =
(struct aml_tiling_1d_data *)t; (const struct aml_tiling_1d_data *)t;
intptr_t p = (intptr_t)ptr; intptr_t p = (intptr_t)ptr;
return (void *)(p + tileid*data->blocksize); return (void *)(p + tileid*data->blocksize);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment