From 0236bd7cec6b4bb677b17ca7719ae9703b4d63e4 Mon Sep 17 00:00:00 2001 From: marcus Date: Mon, 1 Nov 2004 20:54:00 +0000 Subject: libhurd-cap-server/ 2004-11-01 Marcus Brinkmann * 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 * 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 * 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 * 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. --- task/task-class.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'task/task-class.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; } -- cgit v1.2.3