diff options
author | marcus <marcus> | 2004-11-01 20:54:00 +0000 |
---|---|---|
committer | marcus <marcus> | 2004-11-01 20:54:00 +0000 |
commit | 0236bd7cec6b4bb677b17ca7719ae9703b4d63e4 (patch) | |
tree | 309ad09e8c6753fd6994008625ae1bc688e6abc4 /task | |
parent | 63c60b12a8ac44e279f7223844909d22db9f88e1 (diff) |
libhurd-cap-server/
2004-11-01 Marcus Brinkmann <marcus@gnu.org>
* cap-server.h (hurd_cap_class_create): Rename to ...
(hurd_cap_class_create_untyped): ... this.
(hurd_cap_class_create): New macro.
(hurd_cap_class_init): Rename to ...
(hurd_cap_class_init_untyped): ... this.
(hurd_cap_class_init): New macro.
(hurd_cap_get_obj_size): New inline function.
(hurd_cap_obj_to_user_untyped, hurd_cap_obj_from_user_untyped):
New inline function.
(hurd_cap_obj_to_user, hurd_cap_obj_from_user): New macro.
* class-alloc.c (hurd_cap_class_alloc): New variable NEW_OBJ, use
it as a temporary placeholder.
* class-create.c (hurd_cap_class_create): Rename to ...
(hurd_cap_class_create_untyped): ... this.
Use hurd_cap_class_init_untyped.
* class-init.c (hurd_cap_class_init): Rename to ...
(hurd_cap_class_init_untyped): ... this.
Add the size of struct hurd_cap_obj to SIZE.
* client-create.c (_hurd_cap_client_alloc): New variable
NEW_CLIENT, use it as a temporary placeholder.
* obj-copy-out.c (_hurd_cap_obj_copy_out): New variable NEW_ENTRY,
use it as a temporary placeholder.
physmem/
2004-11-01 Marcus Brinkmann <marcus@gnu.org>
* container.c (struct container, container_t): Remove member OBJ.
Move struct and typedef to ...
* physmem.h (struct container, container_t): ... here.
(container_alloc): Change type of last argument in prototype to a
pointer to a container_t.
* container.c (container_reinit, container_map): Use
hurd_cap_obj_to_user instead cast.
(container_class_init): Provide type instead size and alignment.
(container_alloc): Add new variable OBJ and use hurd_cap_obj_to_user.
Change type of last argument to a pointer to container_t.
* physmem.c (create_bootstrap_caps): New variable CONTAINER.
Use hurd_cap_obj_from_user to get at the object.
task/
2004-11-01 Marcus Brinkmann <marcus@gnu.org>
* task.h (struct task): Remove member OBJ.
(task_alloc): Change type of last argument to pointer to task_t.
(task_id_get_task): Use hurd_cap_obj_from_user.
* task.c (create_bootstrap_caps): Remove variable STARTUP_CAP.
Add variable TASK. Use hurd_cap_obj_to_user.
* task-class.c (task_reinit): Use hurd_cap_obj_to_user instead of
cast.
(task_class_init): Use type instead size and alignment.
(task_alloc): Change type of last argument to pointer to task_t.
Add new variable OBJ and use it as a temporary placeholder.
deva/
2004-11-01 Marcus Brinkmann <marcus@gnu.org>
* deva-class.c (struct deva): Remove member obj (and add dummy
member foo).
(deva_reinit): Use hurd_cap_obj_to_user instead of cast.
(deva_class_init): Replace size and alignment with type.
(deva_alloc): New variable OBJ. Use it with hurd_cap_class_alloc.
Use hurd_cap_obj_to_user to get at the deva object.
Diffstat (limited to 'task')
-rw-r--r-- | task/ChangeLog | 13 | ||||
-rw-r--r-- | task/task-class.c | 13 | ||||
-rw-r--r-- | task/task.c | 7 | ||||
-rw-r--r-- | task/task.h | 11 |
4 files changed, 29 insertions, 15 deletions
diff --git a/task/ChangeLog b/task/ChangeLog index 2d2919f..2e00bb6 100644 --- a/task/ChangeLog +++ b/task/ChangeLog @@ -1,3 +1,16 @@ +2004-11-01 Marcus Brinkmann <marcus@gnu.org> + + * task.h (struct task): Remove member OBJ. + (task_alloc): Change type of last argument to pointer to task_t. + (task_id_get_task): Use hurd_cap_obj_from_user. + * task.c (create_bootstrap_caps): Remove variable STARTUP_CAP. + Add variable TASK. Use hurd_cap_obj_to_user. + * task-class.c (task_reinit): Use hurd_cap_obj_to_user instead of + cast. + (task_class_init): Use type instead size and alignment. + (task_alloc): Change type of last argument to pointer to task_t. + Add new variable OBJ and use it as a temporary placeholder. + 2004-10-29 Marcus Brinkmann <marcus@gnu.org> * Makefile.am (task_SOURCES): Add task-id.c. diff --git a/task/task-class.c b/task/task-class.c index 4fa4420..20a3f2d 100644 --- a/task/task-class.c +++ b/task/task-class.c @@ -35,7 +35,7 @@ static void task_reinit (hurd_cap_class_t cap_class, hurd_cap_obj_t obj) { - task_t task = (task_t) obj; + task_t task = hurd_cap_obj_to_user (task_t, obj); unsigned int i; /* Destroy all threads. */ @@ -87,8 +87,7 @@ static struct hurd_cap_class task_class; error_t task_class_init () { - return hurd_cap_class_init (&task_class, sizeof (struct task), - __alignof__ (struct task), + return hurd_cap_class_init (&task_class, task_t, NULL, NULL, task_reinit, NULL, task_demuxer); } @@ -100,20 +99,22 @@ task_class_init () reference. */ error_t task_alloc (l4_word_t task_id, unsigned int nr_threads, - l4_thread_id_t *threads, hurd_cap_obj_t *r_obj) + l4_thread_id_t *threads, task_t *r_task) { error_t err; + hurd_cap_obj_t obj; task_t task; - err = hurd_cap_class_alloc (&task_class, (hurd_cap_obj_t *) &task); + err = hurd_cap_class_alloc (&task_class, &obj); if (err) return err; + task = hurd_cap_obj_to_user (task_t, obj); task->task_id = task_id; assert (nr_threads <= MAX_THREADS); task->nr_threads = nr_threads; memcpy (task->threads, threads, sizeof (l4_thread_id_t) * nr_threads); - *r_obj = &task->obj; + *r_task = task; return 0; } diff --git a/task/task.c b/task/task.c index ef1a23a..04681b2 100644 --- a/task/task.c +++ b/task/task.c @@ -70,8 +70,8 @@ create_bootstrap_caps (hurd_cap_bucket_t bucket) { error_t err; hurd_cap_handle_t cap; - hurd_cap_handle_t startup_cap; hurd_cap_obj_t obj; + task_t task; l4_accept (L4_UNTYPED_WORDS_ACCEPTOR); @@ -98,13 +98,14 @@ create_bootstrap_caps (hurd_cap_bucket_t bucket) { debug ("Creating task cap for 0x%x:", task_id); - err = task_alloc (task_id, nr_threads, threads, &obj); + err = task_alloc (task_id, nr_threads, threads, &task); if (err) panic ("task_alloc: %i\n", err); + obj = hurd_cap_obj_from_user (task_t, task); hurd_cap_obj_unlock (obj); - err = task_id_enter ((task_t) obj); + err = task_id_enter (task); if (err) panic ("task_id_enter: %i\n", err); diff --git a/task/task.h b/task/task.h index be3e30a..9b4630d 100644 --- a/task/task.h +++ b/task/task.h @@ -50,10 +50,6 @@ void switch_thread (l4_thread_id_t from, l4_thread_id_t to); struct task { - /* The capability object must be the first member of this - struct. */ - struct hurd_cap_obj obj; - /* This is for fast removal from the task_id_to_task hash table. */ hurd_ihash_locp_t locp; @@ -80,7 +76,7 @@ error_t task_class_init (); for that task. The object returned is locked and has one reference. */ error_t task_alloc (l4_word_t task_id, unsigned int nr_threads, - l4_thread_id_t *threads, hurd_cap_obj_t *r_obj); + l4_thread_id_t *threads, task_t *r_task); extern pthread_mutex_t task_id_to_task_lock; @@ -99,7 +95,10 @@ task_id_get_task (hurd_task_id_t task_id) pthread_mutex_lock (&task_id_to_task_lock); task = hurd_ihash_find (&task_id_to_task, task_id); if (task) - hurd_cap_obj_ref (&task->obj); + { + hurd_cap_obj_t obj = hurd_cap_obj_from_user (task_t, task); + hurd_cap_obj_ref (obj); + } pthread_mutex_unlock (&task_id_to_task_lock); return task; |