From: Andre Noll Date: Tue, 31 Dec 2013 00:13:29 +0000 (+0000) Subject: task_register() conversion: grab client task X-Git-Tag: v0.5.3~8^2~12 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=e03f07ca9d8c69b22b52dbb0aa035d43134ce95c task_register() conversion: grab client task --- diff --git a/grab_client.c b/grab_client.c index 672c96f1..4f9b4041 100644 --- a/grab_client.c +++ b/grab_client.c @@ -54,7 +54,7 @@ struct grab_client { /** The point of the grab client's node in the buffer tree. */ struct btr_node *btrn; /* The task of this grab client. */ - struct task task; + struct task *task; /** Belongs to either the active or the inactive list. */ struct list_head node; }; @@ -94,7 +94,7 @@ err: static void gc_pre_select(struct sched *s, struct task *t) { - struct grab_client *gc = container_of(t, struct grab_client, task); + struct grab_client *gc = task_context(t); int ret = btr_node_status(gc->btrn, 0, BTR_NT_LEAF); if (ret == 0) @@ -129,12 +129,13 @@ static void gc_activate(struct grab_client *gc, struct sched *s) list_move(&gc->node, &active_grab_client_list); gc->btrn = btr_new_node(&(struct btr_node_description) EMBRACE(.name = name, .parent = parent)); - gc->task.pre_select = gc_pre_select; - gc->task.post_select = gc_post_select; - snprintf(gc->task.status, sizeof(gc->task.status) - 1, "%s", name); - gc->task.status[sizeof(gc->task.status) - 1] = '\0'; - gc->task.error = 0; - register_task(s, &gc->task); + + gc->task = task_register(&(struct task_info) { + .name = name, + .pre_select = gc_pre_select, + .post_select = gc_post_select, + .context = gc, + }, s); } /** @@ -186,7 +187,7 @@ static int gc_close(struct grab_client *gc, int err) static int gc_post_select(__a_unused struct sched *s, struct task *t) { - struct grab_client *gc = container_of(t, struct grab_client, task); + struct grab_client *gc = task_context(t); struct btr_node *btrn = gc->btrn; int ret; size_t sz;