Renamed all thread symbols in l4lib with l4lib_ prefix. They were clasing with mm0

The threading work will be revised and prefixes changed to a more meaningful name
later on.
This commit is contained in:
Bahadir Balban
2009-11-23 13:18:58 +02:00
parent e690949b3b
commit 328040e98a
7 changed files with 47 additions and 47 deletions

View File

@@ -9,12 +9,12 @@
#include <l4/lib/list.h> #include <l4/lib/list.h>
/* Keeps all the struct utcb_descs belonging to a thread group together. */ /* Keeps all the struct utcb_descs belonging to a thread group together. */
struct utcb_head { struct l4lib_utcb_head {
struct link list; struct link list;
}; };
/* A simple thread control block for the thread library. */ /* A simple thread control block for the thread library. */
struct tcb { struct l4lib_tcb {
/* Task list */ /* Task list */
struct link list; struct link list;
@@ -22,7 +22,7 @@ struct tcb {
int tid; int tid;
/* Chain of utcb descriptors */ /* Chain of utcb descriptors */
struct utcb_head *utcb_head; struct l4lib_utcb_head *utcb_head;
/* Stack and utcb address */ /* Stack and utcb address */
unsigned long utcb_addr; unsigned long utcb_addr;
@@ -30,14 +30,14 @@ struct tcb {
}; };
/* All the threads handled by the thread lib are kept in this list. */ /* All the threads handled by the thread lib are kept in this list. */
struct global_list { struct l4lib_global_list {
int total; int total;
struct link list; struct link list;
}; };
struct tcb *find_task(int tid); struct l4lib_tcb *l4lib_find_task(int tid);
struct tcb *l4_tcb_alloc_init(struct tcb *parent, unsigned int flags); struct l4lib_tcb *l4_tcb_alloc_init(struct l4lib_tcb *parent, unsigned int flags);
void global_add_task(struct tcb *task); void l4lib_l4lib_global_add_task(struct l4lib_tcb *task);
void global_remove_task(struct tcb *task); void l4lib_global_remove_task(struct l4lib_tcb *task);
#endif /* __LIB_TCB_H__ */ #endif /* __LIB_TCB_H__ */

View File

@@ -8,7 +8,7 @@
#include <l4/lib/list.h> #include <l4/lib/list.h>
struct utcb_desc { struct l4lib_utcb_desc {
struct link list; struct link list;
unsigned long utcb_base; unsigned long utcb_base;
struct id_pool *slots; struct id_pool *slots;
@@ -16,10 +16,10 @@ struct utcb_desc {
int utcb_pool_init(unsigned long utcb_start, unsigned long utcb_end); int utcb_pool_init(unsigned long utcb_start, unsigned long utcb_end);
unsigned long utcb_new_slot(struct utcb_desc *desc); unsigned long utcb_new_slot(struct l4lib_utcb_desc *desc);
int utcb_delete_slot(struct utcb_desc *desc, unsigned long address); int utcb_delete_slot(struct l4lib_utcb_desc *desc, unsigned long address);
struct utcb_desc *utcb_new_desc(void); struct l4lib_utcb_desc *utcb_new_desc(void);
int utcb_delete_desc(struct utcb_desc *desc); int utcb_delete_desc(struct l4lib_utcb_desc *desc);
#endif /* __UTCB_COMMON_H__ */ #endif /* __UTCB_COMMON_H__ */

View File

@@ -15,8 +15,8 @@ int utcb_init(void);
/* Checks if l4_set_stack_params is called. */ /* Checks if l4_set_stack_params is called. */
#define IS_UTCB_SETUP() (lib_utcb_range_size) #define IS_UTCB_SETUP() (lib_utcb_range_size)
unsigned long get_utcb_addr(struct tcb *task); unsigned long get_utcb_addr(struct l4lib_tcb *task);
int delete_utcb_addr(struct tcb *task); int delete_utcb_addr(struct l4lib_tcb *task);
/* Bora end */ /* Bora end */
#endif /* __UTCB_H__ */ #endif /* __UTCB_H__ */

View File

@@ -11,29 +11,29 @@
#include <l4/macros.h> #include <l4/macros.h>
/* Global task list. */ /* Global task list. */
struct global_list global_tasks = { struct l4lib_global_list global_tasks = {
.list = { &global_tasks.list, &global_tasks.list }, .list = { &global_tasks.list, &global_tasks.list },
.total = 0, .total = 0,
}; };
/* Function definitions */ /* Function definitions */
void global_add_task(struct tcb *task) void global_add_task(struct l4lib_tcb *task)
{ {
BUG_ON(!list_empty(&task->list)); BUG_ON(!list_empty(&task->list));
list_insert_tail(&task->list, &global_tasks.list); list_insert_tail(&task->list, &global_tasks.list);
global_tasks.total++; global_tasks.total++;
} }
void global_remove_task(struct tcb *task) void l4lib_global_remove_task(struct l4lib_tcb *task)
{ {
BUG_ON(list_empty(&task->list)); BUG_ON(list_empty(&task->list));
list_remove_init(&task->list); list_remove_init(&task->list);
BUG_ON(--global_tasks.total < 0); BUG_ON(--global_tasks.total < 0);
} }
struct tcb *find_task(int tid) struct l4lib_tcb * l4lib_find_task(int tid)
{ {
struct tcb *t; struct l4lib_tcb *t;
list_foreach_struct(t, &global_tasks.list, list) list_foreach_struct(t, &global_tasks.list, list)
if (t->tid == tid) if (t->tid == tid)
@@ -41,11 +41,11 @@ struct tcb *find_task(int tid)
return 0; return 0;
} }
struct tcb *l4_tcb_alloc_init(struct tcb *parent, unsigned int flags) struct l4lib_tcb *l4_tcb_alloc_init(struct l4lib_tcb *parent, unsigned int flags)
{ {
struct tcb *task; struct l4lib_tcb *task;
if (!(task = kzalloc(sizeof(struct tcb)))) if (!(task = kzalloc(sizeof(struct l4lib_tcb))))
return PTR_ERR(-ENOMEM); return PTR_ERR(-ENOMEM);
link_init(&task->list); link_init(&task->list);
@@ -54,7 +54,7 @@ struct tcb *l4_tcb_alloc_init(struct tcb *parent, unsigned int flags)
task->utcb_head = parent->utcb_head; task->utcb_head = parent->utcb_head;
else { else {
/* COPY or NEW space */ /* COPY or NEW space */
if (!(task->utcb_head = kzalloc(sizeof(struct utcb_head)))) { if (!(task->utcb_head = kzalloc(sizeof(struct l4lib_utcb_head)))) {
kfree(task); kfree(task);
return PTR_ERR(-ENOMEM); return PTR_ERR(-ENOMEM);
} }

View File

@@ -28,7 +28,7 @@ int l4_thread_create(struct task_ids *ids, unsigned int flags,
{ {
struct exregs_data exregs; struct exregs_data exregs;
unsigned long utcb_addr; unsigned long utcb_addr;
struct tcb *parent, *child; struct l4lib_tcb *parent, *child;
unsigned long stack_top_addr, stack_bot_addr; unsigned long stack_top_addr, stack_bot_addr;
int err = 0; int err = 0;
@@ -42,14 +42,14 @@ int l4_thread_create(struct task_ids *ids, unsigned int flags,
/* Before doing any operation get the global mutex. */ /* Before doing any operation get the global mutex. */
l4_mutex_lock(&lib_mutex); l4_mutex_lock(&lib_mutex);
/* Get parent's ids and find the tcb belonging to it. */ /* Get parent's ids and find the l4lib_tcb belonging to it. */
l4_getid(ids); l4_getid(ids);
if (!(parent = find_task(ids->tid))) { if (!(parent = l4lib_find_task(ids->tid))) {
err = -ESRCH; err = -ESRCH;
goto out_err1; goto out_err1;
} }
/* Allocate tcb for the child. */ /* Allocate l4lib_tcb for the child. */
if (!(child = l4_tcb_alloc_init(parent, flags))) { if (!(child = l4_tcb_alloc_init(parent, flags))) {
// FIXME: What happens to utcb_head // FIXME: What happens to utcb_head
printf("libl4thread: No heap space left.\n"); printf("libl4thread: No heap space left.\n");
@@ -118,7 +118,7 @@ int l4_thread_create(struct task_ids *ids, unsigned int flags,
/* Error handling. */ /* Error handling. */
out_err6: out_err6:
global_remove_task(child); l4lib_global_remove_task(child);
out_err5: out_err5:
l4_thread_control(THREAD_DESTROY, ids); l4_thread_control(THREAD_DESTROY, ids);
out_err4: out_err4:
@@ -137,7 +137,7 @@ out_err1:
void l4_thread_exit(int retval) void l4_thread_exit(int retval)
{ {
struct tcb *task; struct l4lib_tcb *task;
struct task_ids ids; struct task_ids ids;
/* Before doing any operation get the global mutex. */ /* Before doing any operation get the global mutex. */
@@ -146,11 +146,11 @@ void l4_thread_exit(int retval)
/* Find the task. */ /* Find the task. */
l4_getid(&ids); l4_getid(&ids);
/* Cant find the thread means it wasnt added to the list. */ /* Cant find the thread means it wasnt added to the list. */
if (!(task = find_task(ids.tid))) if (!(task = l4lib_find_task(ids.tid)))
BUG(); BUG();
/* Remove child from the global task list. */ /* Remove child from the global task list. */
global_remove_task(task); l4lib_global_remove_task(task);
/* Delete the stack space. */ /* Delete the stack space. */
if (delete_stack_space((void *)task->stack_addr) < 0) if (delete_stack_space((void *)task->stack_addr) < 0)
@@ -175,19 +175,19 @@ void l4_thread_exit(int retval)
int l4_thread_kill(struct task_ids *ids) int l4_thread_kill(struct task_ids *ids)
{ {
struct tcb *task; struct l4lib_tcb *task;
/* Before doing any operation get the global mutex. */ /* Before doing any operation get the global mutex. */
l4_mutex_lock(&lib_mutex); l4_mutex_lock(&lib_mutex);
/* Find the task to be killed. */ /* Find the task to be killed. */
if (!(task = find_task(ids->tid))) { if (!(task = l4lib_find_task(ids->tid))) {
l4_mutex_unlock(&lib_mutex); l4_mutex_unlock(&lib_mutex);
return -ESRCH; return -ESRCH;
} }
/* Remove child from the global task list. */ /* Remove child from the global task list. */
global_remove_task(task); l4lib_global_remove_task(task);
/* Delete the stack space. */ /* Delete the stack space. */
if (delete_stack_space((void *)task->stack_addr) < 0) if (delete_stack_space((void *)task->stack_addr) < 0)

View File

@@ -37,7 +37,7 @@ static inline int utcb_delete_address(void *utcb_address, int nitems)
} }
/* Return an empty utcb slot in this descriptor */ /* Return an empty utcb slot in this descriptor */
unsigned long utcb_new_slot(struct utcb_desc *desc) unsigned long utcb_new_slot(struct l4lib_utcb_desc *desc)
{ {
int slot; int slot;
@@ -47,16 +47,16 @@ unsigned long utcb_new_slot(struct utcb_desc *desc)
return desc->utcb_base + (unsigned long)slot * UTCB_SIZE; return desc->utcb_base + (unsigned long)slot * UTCB_SIZE;
} }
int utcb_delete_slot(struct utcb_desc *desc, unsigned long address) int utcb_delete_slot(struct l4lib_utcb_desc *desc, unsigned long address)
{ {
BUG_ON(id_del(desc->slots, (address - desc->utcb_base) BUG_ON(id_del(desc->slots, (address - desc->utcb_base)
/ UTCB_SIZE) < 0); / UTCB_SIZE) < 0);
return 0; return 0;
} }
struct utcb_desc *utcb_new_desc(void) struct l4lib_utcb_desc *utcb_new_desc(void)
{ {
struct utcb_desc *d; struct l4lib_utcb_desc *d;
/* Allocate a new descriptor */ /* Allocate a new descriptor */
if (!(d = kzalloc(sizeof(*d)))) if (!(d = kzalloc(sizeof(*d))))
@@ -81,7 +81,7 @@ struct utcb_desc *utcb_new_desc(void)
return d; return d;
} }
int utcb_delete_desc(struct utcb_desc *desc) int utcb_delete_desc(struct l4lib_utcb_desc *desc)
{ {
/* Return descriptor address */ /* Return descriptor address */
utcb_delete_address((void *)desc->utcb_base, 1); utcb_delete_address((void *)desc->utcb_base, 1);

View File

@@ -13,15 +13,15 @@
#include <l4lib/utcb.h> #include <l4lib/utcb.h>
/* Extern declarations */ /* Extern declarations */
extern struct global_list global_tasks; extern struct l4lib_global_list global_tasks;
/* Global variables */ /* Global variables */
unsigned long lib_utcb_range_size; unsigned long lib_utcb_range_size;
/* Function definitions */ /* Function definitions */
unsigned long get_utcb_addr(struct tcb *task) unsigned long get_utcb_addr(struct l4lib_tcb *task)
{ {
struct utcb_desc *udesc; struct l4lib_utcb_desc *udesc;
unsigned long slot; unsigned long slot;
/* Setting this up twice is a bug. */ /* Setting this up twice is a bug. */
@@ -43,9 +43,9 @@ found:
return slot; return slot;
} }
int delete_utcb_addr(struct tcb *task) int delete_utcb_addr(struct l4lib_tcb *task)
{ {
struct utcb_desc *udesc; struct l4lib_utcb_desc *udesc;
list_foreach_struct(udesc, &task->utcb_head->list, list) { list_foreach_struct(udesc, &task->utcb_head->list, list) {
/* FIXME: Use variable alignment than a page */ /* FIXME: Use variable alignment than a page */
@@ -72,8 +72,8 @@ static int set_utcb_addr(void)
{ {
struct exregs_data exregs; struct exregs_data exregs;
struct task_ids ids; struct task_ids ids;
struct tcb *task; struct l4lib_tcb *task;
struct utcb_desc *udesc; struct l4lib_utcb_desc *udesc;
int err; int err;
/* Create a task. */ /* Create a task. */