Removed linux linked list dependency.

This commit is contained in:
Bahadir Balban
2009-06-02 13:19:17 +03:00
parent 4757f46f71
commit 276b4643c6
69 changed files with 455 additions and 885 deletions

View File

@@ -232,7 +232,7 @@ int ipc_send(l4id_t recv_tid, unsigned int flags)
struct waitqueue *wq = receiver->wq;
/* Remove from waitqueue */
list_del_init(&wq->task_list);
list_remove_init(&wq->task_list);
wqhr->sleepers--;
task_unset_wqh(receiver);
@@ -255,7 +255,7 @@ int ipc_send(l4id_t recv_tid, unsigned int flags)
/* The receiver is not ready and/or not expecting us */
CREATE_WAITQUEUE_ON_STACK(wq, current);
wqhs->sleepers++;
list_add_tail(&wq.task_list, &wqhs->task_list);
list_insert_tail(&wq.task_list, &wqhs->task_list);
task_set_wqh(current, wqhs, &wq);
sched_prepare_sleep();
spin_unlock(&wqhr->slock);
@@ -292,13 +292,13 @@ int ipc_recv(l4id_t senderid, unsigned int flags)
BUG_ON(list_empty(&wqhs->task_list));
/* Look for a sender we want to receive from */
list_for_each_entry_safe(wq, n, &wqhs->task_list, task_list) {
list_foreach_removable_struct(wq, n, &wqhs->task_list, task_list) {
sleeper = wq->task;
/* Found a sender that we wanted to receive from */
if ((sleeper->tid == current->expected_sender) ||
(current->expected_sender == L4_ANYTHREAD)) {
list_del_init(&wq->task_list);
list_remove_init(&wq->task_list);
wqhs->sleepers--;
task_unset_wqh(sleeper);
spin_unlock(&wqhr->slock);
@@ -320,7 +320,7 @@ int ipc_recv(l4id_t senderid, unsigned int flags)
/* The sender is not ready */
CREATE_WAITQUEUE_ON_STACK(wq, current);
wqhr->sleepers++;
list_add_tail(&wq.task_list, &wqhr->task_list);
list_insert_tail(&wq.task_list, &wqhr->task_list);
task_set_wqh(current, wqhr, &wq);
sched_prepare_sleep();
// printk("%s: (%d) waiting for (%d)\n", __FUNCTION__,
@@ -341,7 +341,7 @@ int ipc_recv(l4id_t senderid, unsigned int flags)
* (1) User task (client) calls ipc_sendrecv();
* (2) System task (server) calls ipc_recv() with from == ANYTHREAD.
* (3) Rendezvous occurs. Both tasks exchange mrs and leave rendezvous.
* (4,5) User task, immediately calls ipc_recv(), expecting a reply from server.
* (4,5) User task, immediately calls ipc_recv(), expecting a origy from server.
* (4,5) System task handles the request in userspace.
* (6) System task calls ipc_send() sending the return result.
* (7) Rendezvous occurs. Both tasks exchange mrs and leave rendezvous.
@@ -355,7 +355,7 @@ int ipc_sendrecv(l4id_t to, l4id_t from, unsigned int flags)
if ((ret = ipc_send(to, flags)) < 0)
return ret;
/*
* Get reply. A client would block its server
* Get origy. A client would block its server
* only very briefly between these calls.
*/
if ((ret = ipc_recv(from, flags)) < 0)

View File

@@ -18,13 +18,13 @@
struct mutex_queue {
unsigned long physical;
struct list_head list;
struct link list;
struct waitqueue_head wqh_waiters;
struct waitqueue_head wqh_wakers;
};
struct mutex_queue_head {
struct list_head list;
struct link list;
/*
* Single lock for:
@@ -42,7 +42,7 @@ struct mutex_queue_head {
void init_mutex_queue_head(void)
{
memset(&mutex_queue_head, 0, sizeof (mutex_queue_head));
INIT_LIST_HEAD(&mutex_queue_head.list);
link_init(&mutex_queue_head.list);
mutex_init(&mutex_queue_head.mutex_control_mutex);
}
void mutex_queue_head_lock()
@@ -61,7 +61,7 @@ void mutex_queue_init(struct mutex_queue *mq, unsigned long physical)
/* This is the unique key that describes this mutex */
mq->physical = physical;
INIT_LIST_HEAD(&mq->list);
link_init(&mq->list);
waitqueue_head_init(&mq->wqh_wakers);
waitqueue_head_init(&mq->wqh_waiters);
}
@@ -70,13 +70,13 @@ void mutex_control_add(struct mutex_queue *mq)
{
BUG_ON(!list_empty(&mq->list));
list_add(&mq->list, &mutex_queue_head.list);
list_insert(&mq->list, &mutex_queue_head.list);
mutex_queue_head.count++;
}
void mutex_control_remove(struct mutex_queue *mq)
{
list_del_init(&mq->list);
list_remove_init(&mq->list);
mutex_queue_head.count--;
}
@@ -86,7 +86,7 @@ struct mutex_queue *mutex_control_find(unsigned long mutex_physical)
struct mutex_queue *mutex_queue;
/* Find the mutex queue with this key */
list_for_each_entry(mutex_queue, &mutex_queue_head.list, list)
list_foreach_struct(mutex_queue, &mutex_queue_head.list, list)
if (mutex_queue->physical == mutex_physical)
return mutex_queue;

View File

@@ -13,7 +13,7 @@
* For lazy mm switching, a list of newly created mappings that are common to
* all tasks (e.g. any mapping done in the kernel) can be kept here so that when
* a new task is scheduled, the same mappings are copied to its page tables as
* well. struct list_head new_mappings;
* well. struct link new_mappings;
*/
int sys_map(syscall_context_t *regs)