/*
- * Copyright (C) 2005-2010 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2005-2013 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
*/
#include <regex.h>
-#include <stdbool.h>
#include "para.h"
#include "compress_filter.cmdline.h"
free(fn->private_data);
}
-static void compress_post_select(__a_unused struct sched *s, struct task *t)
+static int compress_post_select(__a_unused struct sched *s, struct task *t)
{
struct filter_node *fn = container_of(t, struct filter_node, task);
struct private_compress_data *pcd = fn->private_data;
//inplace = false;
next_buffer:
- t->error = 0;
ret = btr_node_status(btrn, fn->min_iqs, BTR_NT_INTERNAL);
if (ret < 0)
goto err;
if (ret == 0)
- return;
+ return 0;
btr_merge(btrn, fn->min_iqs);
length = btr_next_buffer(btrn, &inbuf) & ~(size_t)1;
if (length == 0) { /* eof and 1 byte available */
goto next_buffer;
err:
assert(ret < 0);
- t->error = ret;
- btr_remove_node(btrn);
+ btr_remove_node(&fn->btrn);
+ return ret;
}
/** TODO: Add sanity checks */
static int compress_parse_config(int argc, char **argv, void **config)
{
- int ret;
- struct compress_filter_args_info *compress_conf
- = para_calloc(sizeof(*compress_conf));
+ struct compress_filter_args_info *conf = para_calloc(sizeof(*conf));
- ret = -E_COMPRESS_SYNTAX;
- if (compress_cmdline_parser(argc, argv, compress_conf))
- goto err;
- *config = compress_conf;
+ compress_filter_cmdline_parser(argc, argv, conf);
+ *config = conf;
return 1;
-err:
- free(compress_conf);
- return ret;
}
static void compress_open(struct filter_node *fn)
static void compress_free_config(void *conf)
{
- compress_cmdline_parser_free(conf);
+ compress_filter_cmdline_parser_free(conf);
}
/**
{
struct compress_filter_args_info dummy;
- compress_cmdline_parser_init(&dummy);
+ compress_filter_cmdline_parser_init(&dummy);
f->open = compress_open;
f->close = compress_close;
f->pre_select = generic_filter_pre_select;