[Cbe-oss-dev] [PATCH 17/22]MARS/task: add const qualifier

Yuji Mano yuji.mano at am.sony.com
Fri Mar 20 07:54:41 EST 2009


This patch adds const qualifiers to task API function parameters where there
should be one.

Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>
---
 task/include/host/mars/task.h     |    9 +++++----
 task/include/mpu/mars/task.h      |   10 ++++++----
 task/src/host/lib/task.c          |    9 +++++----
 task/src/mpu/lib/task.c           |   10 ++++++----
 task/src/mpu/module/task_module.c |    9 ++++++---
 task/src/mpu/module/task_module.h |   21 +++++++++++----------
 6 files changed, 39 insertions(+), 29 deletions(-)

--- a/task/include/host/mars/task.h
+++ b/task/include/host/mars/task.h
@@ -140,23 +140,24 @@ int mars_task_create(struct mars_context
  * \n	MARS_ERROR_PARAMS	- bad task id specified
  * \n	MARS_ERROR_STATE	- task is in an invalid state
  */
-int mars_task_destroy(struct mars_task_id *id);
+int mars_task_destroy(const struct mars_task_id *id);
 
 /**
  * \ingroup group_mars_task
  */
-int mars_task_schedule(struct mars_task_id *id, struct mars_task_args *args,
+int mars_task_schedule(const struct mars_task_id *id,
+		       const struct mars_task_args *args,
 		       uint8_t priority);
 
 /**
  * \ingroup group_mars_task
  */
-int mars_task_wait(struct mars_task_id *id, int32_t *exit_code);
+int mars_task_wait(const struct mars_task_id *id, int32_t *exit_code);
 
 /**
  * \ingroup group_mars_task
  */
-int mars_task_try_wait(struct mars_task_id *id, int32_t *exit_code);
+int mars_task_try_wait(const struct mars_task_id *id, int32_t *exit_code);
 
 /**
  * \ingroup group_mars_task
--- a/task/include/mpu/mars/task.h
+++ b/task/include/mpu/mars/task.h
@@ -164,7 +164,8 @@ int mars_task_yield(void);
  * \n	MARS_ERROR_PARAMS	- bad task id specified
  * \n	MARS_ERROR_STATE	- task is in an invalid state
  */
-int mars_task_schedule(struct mars_task_id *id, struct mars_task_args *args,
+int mars_task_schedule(const struct mars_task_id *id,
+		       const struct mars_task_args *args,
 		       uint8_t priority);
 
 /**
@@ -203,7 +204,7 @@ int mars_task_schedule(struct mars_task_
  * \n	MARS_ERROR_STATE	- task is in an invalid state
  * \n	MARS_ERROR_FORMAT	- no context save area specified
  */
-int mars_task_wait(struct mars_task_id *id, int32_t *exit_code);
+int mars_task_wait(const struct mars_task_id *id, int32_t *exit_code);
 
 /**
  * \ingroup group_mars_task
@@ -228,7 +229,7 @@ int mars_task_wait(struct mars_task_id *
  * \n	MARS_ERROR_STATE	- task is in an invalid state
  * \n	MARS_ERROR_BUSY		- task has not yet finished execution
  */
-int mars_task_try_wait(struct mars_task_id *id, int32_t *exit_code);
+int mars_task_try_wait(const struct mars_task_id *id, int32_t *exit_code);
 
 /**
  * \ingroup group_mars_task
@@ -241,7 +242,8 @@ int mars_task_try_wait(struct mars_task_
  *	MARS_SUCCESS		- host callback successful
  * \n	MARS_ERROR_FORMAT	- no context save area specified
  */
-int mars_task_call_host(uint64_t callback_ea, struct mars_callback_args *in,
+int mars_task_call_host(uint64_t callback_ea,
+			const struct mars_callback_args *in,
 			struct mars_callback_args *out);
 
 /**
--- a/task/src/host/lib/task.c
+++ b/task/src/host/lib/task.c
@@ -233,7 +233,7 @@ int mars_task_create(struct mars_context
 	return MARS_SUCCESS;
 }
 
-int mars_task_destroy(struct mars_task_id *id)
+int mars_task_destroy(const struct mars_task_id *id)
 {
 	int ret;
 	struct mars_context *mars;
@@ -279,7 +279,8 @@ int mars_task_destroy(struct mars_task_i
 	return MARS_SUCCESS;
 }
 
-int mars_task_schedule(struct mars_task_id *id, struct mars_task_args *args,
+int mars_task_schedule(const struct mars_task_id *id,
+		       const struct mars_task_args *args,
 		       uint8_t priority)
 {
 	int ret;
@@ -328,7 +329,7 @@ int mars_task_schedule(struct mars_task_
 	return MARS_SUCCESS;
 }
 
-int mars_task_wait(struct mars_task_id *id, int32_t *exit_code)
+int mars_task_wait(const struct mars_task_id *id, int32_t *exit_code)
 {
 	int ret;
 	struct mars_context *mars;
@@ -355,7 +356,7 @@ int mars_task_wait(struct mars_task_id *
 	return MARS_SUCCESS;
 }
 
-int mars_task_try_wait(struct mars_task_id *id, int32_t *exit_code)
+int mars_task_try_wait(const struct mars_task_id *id, int32_t *exit_code)
 {
 	int ret;
 	struct mars_context *mars;
--- a/task/src/mpu/lib/task.c
+++ b/task/src/mpu/lib/task.c
@@ -97,7 +97,8 @@ int mars_task_yield(void)
 	return MARS_SUCCESS;
 }
 
-int mars_task_schedule(struct mars_task_id *id, struct mars_task_args *args,
+int mars_task_schedule(const struct mars_task_id *id,
+		       const struct mars_task_args *args,
 		       uint8_t priority)
 {
 	/* check function params */
@@ -107,7 +108,7 @@ int mars_task_schedule(struct mars_task_
 	return mars_task_module_schedule(id->workload_id, args, priority);
 }
 
-int mars_task_wait(struct mars_task_id *id, int32_t *exit_code)
+int mars_task_wait(const struct mars_task_id *id, int32_t *exit_code)
 {
 	struct mars_task_context *task;
 
@@ -137,7 +138,7 @@ int mars_task_wait(struct mars_task_id *
 	return MARS_SUCCESS;
 }
 
-int mars_task_try_wait(struct mars_task_id *id, int32_t *exit_code)
+int mars_task_try_wait(const struct mars_task_id *id, int32_t *exit_code)
 {
 	struct mars_task_context *task;
 
@@ -160,7 +161,8 @@ int mars_task_try_wait(struct mars_task_
 	return MARS_SUCCESS;
 }
 
-int mars_task_call_host(uint64_t callback_ea, struct mars_callback_args *in,
+int mars_task_call_host(uint64_t callback_ea,
+			const struct mars_callback_args *in,
 			struct mars_callback_args *out)
 {
 	struct mars_task_context *task;
--- a/task/src/mpu/module/task_module.c
+++ b/task/src/mpu/module/task_module.c
@@ -82,7 +82,8 @@ static struct mars_task_context *get_tas
 	return (struct mars_task_context *)mars_module_get_workload();
 }
 
-static struct mars_task_context *get_task_by_id(struct mars_task_id *task_id)
+static struct mars_task_context *
+	get_task_by_id(const struct mars_task_id *task_id)
 {
 	return (struct mars_task_context *)
 		mars_module_get_workload_by_id(task_id->workload_id);
@@ -152,7 +153,8 @@ static void task_yield(void *task_heap)
 	task_save(task_heap, 0);
 }
 
-static int task_schedule(uint16_t workload_id, struct mars_task_args *args,
+static int task_schedule(uint16_t workload_id,
+			 const struct mars_task_args *args,
 			 uint8_t priority)
 {
 	int ret;
@@ -232,7 +234,8 @@ static int task_signal_try_wait(void)
 	return mars_module_workload_signal_reset();
 }
 
-static int task_call_host(uint64_t callback_ea, struct mars_callback_args *in,
+static int task_call_host(uint64_t callback_ea,
+			  const struct mars_callback_args *in,
 			  struct mars_callback_args *out, void *task_heap)
 {
 	int ret;
--- a/task/src/mpu/module/task_module.h
+++ b/task/src/mpu/module/task_module.h
@@ -56,11 +56,12 @@ struct mars_task_module_syscalls {
 	uint16_t			(*get_kernel_id)(void);
 	struct mars_task_context *	(*get_task)(void);
 	struct mars_task_context *	(*get_task_by_id)
-						(struct mars_task_id *task_id);
+					   (const struct mars_task_id *task_id);
 
 	void	(*exit)(void);
 	void	(*yield)(void *heap);
-	int	(*schedule)(uint16_t workload_id, struct mars_task_args *args,
+	int	(*schedule)(uint16_t workload_id,
+			    const struct mars_task_args *args,
 			    uint8_t priority);
 	int	(*wait)(uint16_t workload_id, void *heap);
 	int	(*try_wait)(uint16_t workload_id);
@@ -69,7 +70,7 @@ struct mars_task_module_syscalls {
 	int	(*signal_wait)(void *heap);
 	int	(*signal_try_wait)(void);
 	int	(*call_host)(uint64_t callback_ea,
-			     struct mars_callback_args *in,
+			     const struct mars_callback_args *in,
 			     struct mars_callback_args *out, void *heap);
 
 	int	(*mutex_lock_get)(uint64_t mutex_ea,
@@ -110,7 +111,7 @@ static inline struct mars_task_context *
 }
 
 static inline struct mars_task_context *mars_task_module_get_task_by_id
-						(struct mars_task_id *task_id)
+					(const struct mars_task_id *task_id)
 {
 	return (*mars_task_module_syscalls->get_task_by_id)(task_id);
 }
@@ -126,7 +127,7 @@ static inline void mars_task_module_yiel
 }
 
 static inline int mars_task_module_schedule(uint16_t workload_id,
-					    struct mars_task_args *args,
+					    const struct mars_task_args *args,
 					    uint8_t priority)
 {
 	return (*mars_task_module_syscalls->schedule)(workload_id, args,
@@ -164,9 +165,9 @@ static inline int mars_task_module_signa
 }
 
 static inline int mars_task_module_call_host(uint64_t callback_ea,
-					     struct mars_callback_args *in,
-					     struct mars_callback_args *out,
-					     void *task_heap)
+					const struct mars_callback_args *in,
+					struct mars_callback_args *out,
+					void *task_heap)
 {
 	return (*mars_task_module_syscalls->call_host)(callback_ea, in, out,
 						       task_heap);
@@ -185,13 +186,13 @@ static inline int mars_mutex_unlock_put(
 }
 
 static inline int mars_dma_get(void *ls, uint64_t ea, uint32_t size,
-				uint32_t tag)
+			       uint32_t tag)
 {
 	return (*mars_task_module_syscalls->dma_get)(ls, ea, size, tag);
 }
 
 static inline int mars_dma_put(const void *ls, uint64_t ea, uint32_t size,
-				uint32_t tag)
+			       uint32_t tag)
 {
 	return (*mars_task_module_syscalls->dma_put)(ls, ea, size, tag);
 }






More information about the cbe-oss-dev mailing list