]> git.tue.mpg.de Git - paraslash.git/commitdiff
task_register() conversion: write task
authorAndre Noll <maan@systemlinux.org>
Mon, 30 Dec 2013 22:42:27 +0000 (22:42 +0000)
committerAndre Noll <maan@systemlinux.org>
Sun, 25 May 2014 13:36:37 +0000 (15:36 +0200)
write.c

diff --git a/write.c b/write.c
index aa230f59f9e17a0c4c09a672cbf830e73fd7c3ea..0dc233fca0a1b77859462959edfbb33c7d826902 100644 (file)
--- 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);