}
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);
}
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"));
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);