From: Andre Noll Date: Mon, 30 Dec 2013 22:42:27 +0000 (+0000) Subject: task_register() conversion: write task X-Git-Tag: v0.5.3~8^2~24 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=9e1f7d426afe9cc1c3556ff167733b64a46b4090;p=paraslash.git task_register() conversion: write task --- diff --git a/write.c b/write.c index aa230f59..0dc233fc 100644 --- a/write.c +++ b/write.c @@ -71,19 +71,19 @@ static void setup_writer_node(const char *arg, struct btr_node *parent, } struct write_task { - struct task task; + struct task *task; struct check_wav_context *cwc; }; static void write_pre_select(struct sched *s, struct task *t) { - struct write_task *wt = container_of(t, struct write_task, task); + struct write_task *wt = task_context(t); check_wav_pre_select(s, wt->cwc); } static int write_post_select(__a_unused struct sched *s, struct task *t) { - struct write_task *wt = container_of(t, struct write_task, task); + struct write_task *wt = task_context(t); return check_wav_post_select(wt->cwc); } @@ -94,13 +94,7 @@ static int setup_and_schedule(void) struct writer_node *wns; static struct sched s; struct wav_params wp; - struct write_task wt = { - .task = { - .pre_select = write_pre_select, - .post_select = write_post_select, - .status = "write task", - }, - }; + struct write_task wt; sit.btrn = btr_new_node(&(struct btr_node_description) EMBRACE(.name = "stdin")); @@ -108,7 +102,12 @@ static int setup_and_schedule(void) COPY_WAV_PARMS(&wp, &conf); wt.cwc = check_wav_init(sit.btrn, NULL, &wp, &cw_btrn); - register_task(&s, &wt.task); + wt.task = task_register(&(struct task_info) { + .name = "write", + .pre_select = write_pre_select, + .post_select = write_post_select, + .context = &wt, + }, &s); if (!conf.writer_given) { wns = para_calloc(sizeof(*wns)); setup_writer_node(NULL, cw_btrn, wns, &s);