[Cbe-oss-dev] [PATCH 10/10]MARS: Remove generic symbols from global space

Yuji Mano yuji.mano at am.sony.com
Fri Oct 3 04:31:49 EST 2008


This adds a mars_ prefix to all workload_queue_* API to avoid generic symbol
clashes when linking the host library.

Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>

---
 include/host/mars/mars_workload_queue.h |   44 ++++++++++++++++++-------------
 src/host/lib/mars_context.c             |    8 ++---
 src/host/lib/mars_task.c                |   24 +++++++++--------
 src/host/lib/mars_task_event_flag.c     |    2 -
 src/host/lib/mars_task_queue.c          |    8 ++---
 src/host/lib/mars_task_signal.c         |    3 +-
 src/host/lib/mars_workload_queue.c      |   45 +++++++++++++++++++-------------
 7 files changed, 77 insertions(+), 57 deletions(-)

--- a/include/host/mars/mars_workload_queue.h
+++ b/include/host/mars/mars_workload_queue.h
@@ -44,34 +44,42 @@
 extern "C" {
 #endif
 
-int workload_queue_create(struct mars_workload_queue **queue);
-int workload_queue_destroy(struct mars_workload_queue *queue);
-int workload_queue_exit(struct mars_workload_queue *queue);
+int mars_workload_queue_create(struct mars_workload_queue **queue);
+int mars_workload_queue_destroy(struct mars_workload_queue *queue);
+int mars_workload_queue_exit(struct mars_workload_queue *queue);
 
-int workload_queue_add_begin(struct mars_workload_queue *queue, uint16_t *id,
-				uint8_t type,
+int mars_workload_queue_add_begin(struct mars_workload_queue *queue,
+				uint16_t *id, uint8_t type,
 				struct mars_workload_context **workload);
-int workload_queue_add_end(struct mars_workload_queue *queue, uint16_t id);
-int workload_queue_add_cancel(struct mars_workload_queue *queue, uint16_t id);
+int mars_workload_queue_add_end(struct mars_workload_queue *queue,
+				uint16_t id);
+int mars_workload_queue_add_cancel(struct mars_workload_queue *queue,
+				uint16_t id);
 
-int workload_queue_remove_begin(struct mars_workload_queue *queue, uint16_t id,
+int mars_workload_queue_remove_begin(struct mars_workload_queue *queue,
+				uint16_t id,
 				struct mars_workload_context **workload);
-int workload_queue_remove_end(struct mars_workload_queue *queue, uint16_t id);
-int workload_queue_remove_cancel(struct mars_workload_queue *queue,
+int mars_workload_queue_remove_end(struct mars_workload_queue *queue,
+				uint16_t id);
+int mars_workload_queue_remove_cancel(struct mars_workload_queue *queue,
 				uint16_t id);
 
-int workload_queue_schedule_begin(struct mars_workload_queue *queue,
+int mars_workload_queue_schedule_begin(struct mars_workload_queue *queue,
 				uint16_t id, uint8_t priority,
 				struct mars_workload_context **workload);
-int workload_queue_schedule_end(struct mars_workload_queue *queue, uint16_t id);
-int workload_queue_schedule_cancel(struct mars_workload_queue *queue,
+int mars_workload_queue_schedule_end(struct mars_workload_queue *queue,
+				uint16_t id);
+int mars_workload_queue_schedule_cancel(struct mars_workload_queue *queue,
 				uint16_t id);
 
-int workload_queue_wait(struct mars_workload_queue *queue, uint16_t id,
-			struct mars_workload_context **workload);
-int workload_queue_try_wait(struct mars_workload_queue *queue, uint16_t id,
-			struct mars_workload_context **workload);
-int workload_queue_signal_send(struct mars_workload_queue *queue, uint16_t id);
+int mars_workload_queue_wait(struct mars_workload_queue *queue,
+				uint16_t id,
+				struct mars_workload_context **workload);
+int mars_workload_queue_try_wait(struct mars_workload_queue *queue,
+				uint16_t id,
+				struct mars_workload_context **workload);
+int mars_workload_queue_signal_send(struct mars_workload_queue *queue,
+				uint16_t id);
 
 #if defined(__cplusplus)
 }
--- a/src/host/lib/mars_context.c
+++ b/src/host/lib/mars_context.c
@@ -112,7 +112,7 @@ static int mpu_contexts_destroy(struct m
 	unsigned int i;
 
 	/* shutdown the workload queue so mpu context threads exit */
-	ret = workload_queue_exit(mars->workload_queue);
+	ret = mars_workload_queue_exit(mars->workload_queue);
 	if (ret != MARS_SUCCESS)
 		return ret;
 
@@ -203,7 +203,7 @@ int mars_context_create(struct mars_cont
 	}
 
 	/* create workload queue */
-	ret = workload_queue_create(&mars->workload_queue);
+	ret = mars_workload_queue_create(&mars->workload_queue);
 	if (ret != MARS_SUCCESS)
 		goto ERROR_workload_queue_create;
 
@@ -231,7 +231,7 @@ int mars_context_create(struct mars_cont
 ERROR_pthread_mutex_unlock:
 	mpu_contexts_destroy(mars);
 ERROR_mpu_contexts_create:
-	workload_queue_destroy(mars->workload_queue);
+	mars_workload_queue_destroy(mars->workload_queue);
 ERROR_workload_queue_create:
 	free(mars->mpu_context_threads);
 ERROR_malloc_mpu_context_threads:
@@ -273,7 +273,7 @@ int mars_context_destroy(struct mars_con
 
 	/* destroy workload queue */
 	if (mars->workload_queue) {
-		ret = workload_queue_destroy(mars->workload_queue);
+		ret = mars_workload_queue_destroy(mars->workload_queue);
 		if (ret != MARS_SUCCESS)
 			return ret;
 	}
--- a/src/host/lib/mars_task.c
+++ b/src/host/lib/mars_task.c
@@ -78,7 +78,7 @@ int mars_task_create(struct mars_context
 		return MARS_ERROR_FORMAT;
 
 	/* begin process to add the task to the workload queue */
-	ret = workload_queue_add_begin(mars->workload_queue, &workload_id,
+	ret = mars_workload_queue_add_begin(mars->workload_queue, &workload_id,
 		MARS_WORKLOAD_TYPE_TASK, &workload);
 	if (ret != MARS_SUCCESS)
 		return ret;
@@ -105,7 +105,7 @@ int mars_task_create(struct mars_context
 		task->context_save_ea = mars_ptr_to_ea(memalign(
 			MARS_TASK_CONTEXT_SAVE_ALIGN, task->context_save_size));
 		if (!task->context_save_ea) {
-			workload_queue_add_cancel(mars->workload_queue,
+			mars_workload_queue_add_cancel(mars->workload_queue,
 				workload_id);
 			return MARS_ERROR_MEMORY;
 		}
@@ -115,9 +115,10 @@ int mars_task_create(struct mars_context
 	}
 
 	/* end process to add the task to the workload queue */
-	ret = workload_queue_add_end(mars->workload_queue, workload_id);
+	ret = mars_workload_queue_add_end(mars->workload_queue, workload_id);
 	if (ret != MARS_SUCCESS) {
-		workload_queue_add_cancel(mars->workload_queue, workload_id);
+		mars_workload_queue_add_cancel(mars->workload_queue,
+			workload_id);
 		if (context_save_size)
 			free(mars_ea_to_ptr(task->context_save_ea));
 		return ret;
@@ -148,7 +149,7 @@ int mars_task_destroy(struct mars_task_i
 	mars = mars_ea_to_ptr(id->mars_context_ea);
 
 	/* begin process to remove the task from the workload queue */
-	ret = workload_queue_remove_begin(mars->workload_queue,
+	ret = mars_workload_queue_remove_begin(mars->workload_queue,
 		id->workload_id, &workload);
 	if (ret != MARS_SUCCESS)
 		return ret;
@@ -161,7 +162,8 @@ int mars_task_destroy(struct mars_task_i
 		free(mars_ea_to_ptr(task->context_save_ea));
 
 	/* end process to remove the task from the workload queue */
-	ret = workload_queue_remove_end(mars->workload_queue, id->workload_id);
+	ret = mars_workload_queue_remove_end(mars->workload_queue,
+		id->workload_id);
 	if (ret != MARS_SUCCESS)
 		return ret;
 
@@ -188,7 +190,7 @@ int mars_task_schedule(struct mars_task_
 	mars = mars_ea_to_ptr(id->mars_context_ea);
 
 	/* begin process to schedule the workload in the workload queue */
-	ret = workload_queue_schedule_begin(mars->workload_queue,
+	ret = mars_workload_queue_schedule_begin(mars->workload_queue,
 		id->workload_id, priority, &workload);
 	if (ret != MARS_SUCCESS)
 		return ret;
@@ -202,7 +204,7 @@ int mars_task_schedule(struct mars_task_
 		memcpy(&task->args, args, sizeof(struct mars_task_args));
 
 	/* end process to schedule the workload in the workload queue */
-	ret = workload_queue_schedule_end(mars->workload_queue,
+	ret = mars_workload_queue_schedule_end(mars->workload_queue,
 		id->workload_id);
 	if (ret != MARS_SUCCESS)
 		return ret;
@@ -229,7 +231,7 @@ int mars_task_wait(struct mars_task_id *
 	mars = mars_ea_to_ptr(id->mars_context_ea);
 
 	/* blocking wait for workload completion */
-	ret = workload_queue_wait(mars->workload_queue, id->workload_id,
+	ret = mars_workload_queue_wait(mars->workload_queue, id->workload_id,
 		&workload);
 	if (ret != MARS_SUCCESS)
 		return ret;
@@ -263,8 +265,8 @@ int mars_task_try_wait(struct mars_task_
 	mars = mars_ea_to_ptr(id->mars_context_ea);
 
 	/* non-blocking wait for workload completion */
-	ret = workload_queue_try_wait(mars->workload_queue, id->workload_id,
-		&workload);
+	ret = mars_workload_queue_try_wait(mars->workload_queue,
+		id->workload_id, &workload);
 	if (ret != MARS_SUCCESS)
 		return ret;
 
--- a/src/host/lib/mars_task_event_flag.c
+++ b/src/host/lib/mars_task_event_flag.c
@@ -155,7 +155,7 @@ int mars_task_event_flag_set(struct mars
 		}
 
 		/* signal the task to go to ready state */
-		ret = workload_queue_signal_send(mars->workload_queue,
+		ret = mars_workload_queue_signal_send(mars->workload_queue,
 			event_flag->wait_id[i]);
 		if (ret != MARS_SUCCESS)
 			return ret;
--- a/src/host/lib/mars_task_queue.c
+++ b/src/host/lib/mars_task_queue.c
@@ -148,8 +148,8 @@ int mars_task_queue_clear(struct mars_ta
 
 	/* signal all waiting tasks that queue is ready for push */
 	for (i = 0; i < queue->push_wait_count; i++)
-		workload_queue_signal_send(
-			mars->workload_queue, queue->push_wait_id[0]);
+		mars_workload_queue_signal_send(mars->workload_queue,
+			queue->push_wait_id[0]);
 
 	/* flush all ids from push wait list */
 	queue->push_wait_count = 0;
@@ -171,7 +171,7 @@ static void push_update(struct mars_task
 	/* signal waiting task that queue is ready for pop */
 	if (queue->pop_wait_count) {
 		/* signal waiting task */
-		workload_queue_signal_send(mars->workload_queue,
+		mars_workload_queue_signal_send(mars->workload_queue,
 			queue->pop_wait_id[0]);
 
 		/* flush id from pop wait list */
@@ -245,7 +245,7 @@ static void pop_update(struct mars_task_
 	/* signal waiting task that queue is ready for push */
 	if (queue->push_wait_count) {
 		/* signal waiting task */
-		workload_queue_signal_send(mars->workload_queue,
+		mars_workload_queue_signal_send(mars->workload_queue,
 			queue->push_wait_id[0]);
 
 		/* flush id from push wait list */
--- a/src/host/lib/mars_task_signal.c
+++ b/src/host/lib/mars_task_signal.c
@@ -55,7 +55,8 @@ int mars_task_signal_send(struct mars_ta
 		return MARS_ERROR_PARAMS;
 
 	/* send signal to workload */
-	ret = workload_queue_signal_send(mars->workload_queue, id->workload_id);
+	ret = mars_workload_queue_signal_send(mars->workload_queue,
+		id->workload_id);
 	if (ret != MARS_SUCCESS)
 		return ret;
 
--- a/src/host/lib/mars_workload_queue.c
+++ b/src/host/lib/mars_workload_queue.c
@@ -46,7 +46,7 @@
 #include "mars/mars_mutex.h"
 #include "mars/mars_error.h"
 
-int workload_queue_create(struct mars_workload_queue **queue_ret)
+int mars_workload_queue_create(struct mars_workload_queue **queue_ret)
 {
 	int block;
 	int index;
@@ -95,7 +95,7 @@ int workload_queue_create(struct mars_wo
 	return MARS_SUCCESS;
 }
 
-int workload_queue_destroy(struct mars_workload_queue *queue)
+int mars_workload_queue_destroy(struct mars_workload_queue *queue)
 {
 	int block;
 	int index;
@@ -127,7 +127,7 @@ int workload_queue_destroy(struct mars_w
 	return MARS_SUCCESS;
 }
 
-int workload_queue_exit(struct mars_workload_queue *queue)
+int mars_workload_queue_exit(struct mars_workload_queue *queue)
 {
 	/* check function params */
 	if (!queue)
@@ -138,8 +138,8 @@ int workload_queue_exit(struct mars_work
 	return MARS_SUCCESS;
 }
 
-int workload_queue_add_begin(struct mars_workload_queue *queue, uint16_t *id,
-				uint8_t type,
+int mars_workload_queue_add_begin(struct mars_workload_queue *queue,
+				uint16_t *id, uint8_t type,
 				struct mars_workload_context **workload)
 {
 	int block = 0;
@@ -199,7 +199,8 @@ int workload_queue_add_begin(struct mars
 	return MARS_SUCCESS;
 }
 
-int workload_queue_add_end(struct mars_workload_queue *queue, uint16_t id)
+int mars_workload_queue_add_end(struct mars_workload_queue *queue,
+				uint16_t id)
 {
 	int block;
 	int index;
@@ -234,7 +235,8 @@ int workload_queue_add_end(struct mars_w
 	return MARS_SUCCESS;
 }
 
-int workload_queue_add_cancel(struct mars_workload_queue *queue, uint16_t id)
+int mars_workload_queue_add_cancel(struct mars_workload_queue *queue,
+				uint16_t id)
 {
 	int block;
 	int index;
@@ -267,7 +269,8 @@ int workload_queue_add_cancel(struct mar
 	return MARS_SUCCESS;
 }
 
-int workload_queue_remove_begin(struct mars_workload_queue *queue, uint16_t id,
+int mars_workload_queue_remove_begin(struct mars_workload_queue *queue,
+				uint16_t id,
 				struct mars_workload_context **workload)
 {
 	int block;
@@ -305,7 +308,8 @@ int workload_queue_remove_begin(struct m
 	return MARS_SUCCESS;
 }
 
-int workload_queue_remove_end(struct mars_workload_queue *queue, uint16_t id)
+int mars_workload_queue_remove_end(struct mars_workload_queue *queue,
+				uint16_t id)
 {
 	int block;
 	int index;
@@ -338,7 +342,8 @@ int workload_queue_remove_end(struct mar
 	return MARS_SUCCESS;
 }
 
-int workload_queue_remove_cancel(struct mars_workload_queue *queue, uint16_t id)
+int mars_workload_queue_remove_cancel(struct mars_workload_queue *queue,
+				uint16_t id)
 {
 	int block;
 	int index;
@@ -371,7 +376,7 @@ int workload_queue_remove_cancel(struct 
 	return MARS_SUCCESS;
 }
 
-int workload_queue_schedule_begin(struct mars_workload_queue *queue,
+int mars_workload_queue_schedule_begin(struct mars_workload_queue *queue,
 				uint16_t id, uint8_t priority,
 				struct mars_workload_context **workload)
 {
@@ -418,7 +423,8 @@ int workload_queue_schedule_begin(struct
 	return MARS_SUCCESS;
 }
 
-int workload_queue_schedule_end(struct mars_workload_queue *queue, uint16_t id)
+int mars_workload_queue_schedule_end(struct mars_workload_queue *queue,
+				uint16_t id)
 {
 	int block;
 	int index;
@@ -451,7 +457,7 @@ int workload_queue_schedule_end(struct m
 	return MARS_SUCCESS;
 }
 
-int workload_queue_schedule_cancel(struct mars_workload_queue *queue,
+int mars_workload_queue_schedule_cancel(struct mars_workload_queue *queue,
 				uint16_t id)
 {
 	int block;
@@ -485,8 +491,9 @@ int workload_queue_schedule_cancel(struc
 	return MARS_SUCCESS;
 }
 
-int workload_queue_wait(struct mars_workload_queue *queue, uint16_t id,
-			struct mars_workload_context **workload)
+int mars_workload_queue_wait(struct mars_workload_queue *queue,
+				uint16_t id,
+				struct mars_workload_context **workload)
 {
 	int block;
 	int index;
@@ -517,8 +524,9 @@ int workload_queue_wait(struct mars_work
 	return MARS_SUCCESS;
 }
 
-int workload_queue_try_wait(struct mars_workload_queue *queue, uint16_t id,
-			struct mars_workload_context **workload)
+int mars_workload_queue_try_wait(struct mars_workload_queue *queue,
+				uint16_t id,
+				struct mars_workload_context **workload)
 {
 	int block;
 	int index;
@@ -550,7 +558,8 @@ int workload_queue_try_wait(struct mars_
 	return MARS_SUCCESS;
 }
 
-int workload_queue_signal_send(struct mars_workload_queue *queue, uint16_t id)
+int mars_workload_queue_signal_send(struct mars_workload_queue *queue,
+				uint16_t id)
 {
 	int block;
 	int index;






More information about the cbe-oss-dev mailing list