]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - prebuffer_filter.c
string: Introduce arr_alloc().
[paraslash.git] / prebuffer_filter.c
index ad2373767a8b8df5793472b795ac3d5b85327b55..ef66ffa13f2308eb4ac1571d9314ba4aee17e8b2 100644 (file)
@@ -57,7 +57,14 @@ static int prebuffer_post_select(__a_unused struct sched *s, void *context)
        size_t iqs = btr_get_input_queue_size(btrn);
        struct private_prebuffer_data *ppd = fn->private_data;
        uint32_t size = FILTER_CMD_OPT_UINT32_VAL(PREBUFFER, SIZE, fn->lpr);
+       int ret;
 
+       ret = task_get_notification(fn->task);
+       if (ret < 0)
+               goto fail;
+       ret = btr_node_status(btrn, size, BTR_NT_INTERNAL);
+       if (ret < 0)
+               goto fail;
        if (ppd->barrier.tv_sec == 0)
                return 0;
        if (tv_diff(now, &ppd->barrier, NULL) < 0)
@@ -66,11 +73,14 @@ static int prebuffer_post_select(__a_unused struct sched *s, void *context)
                return 0;
        btr_splice_out_node(&fn->btrn);
        return -E_PREBUFFER_SUCCESS;
+fail:
+       btr_remove_node(&fn->btrn);
+       return ret;
 }
 
 static void prebuffer_open(struct filter_node *fn)
 {
-       struct private_prebuffer_data *ppd = para_calloc(sizeof(*ppd));
+       struct private_prebuffer_data *ppd = zalloc(sizeof(*ppd));
        fn->private_data = ppd;
 }