#define INBUF_SIZE 32 * 1024
-static struct filter_chain_info filter_chain_info_struct;
-static struct filter_chain_info *fci = &filter_chain_info_struct;
+static struct filter_chain filter_chain_struct;
+static struct filter_chain *fc = &filter_chain_struct;
struct gengetopt_args_info conf;
-__printf_2_3 void para_log(int ll, char* fmt,...)
+__printf_2_3 void para_log(int ll, const char* fmt,...)
{
va_list argp;
int i, filter_num;
struct filter_node *fn;
- INIT_LIST_HEAD(&fci->filters);
+ INIT_LIST_HEAD(&fc->filters);
- fci->inbuf = inbuf;
- fci->in_loaded = &loaded;
- fci->eof = &eof;
+ fc->inbuf = inbuf;
+ fc->in_loaded = &loaded;
+ fc->eof = &eof;
for (i = 0; i < conf.filter_given; i++) {
char *fa = para_strdup(conf.filter_arg[i]);
free(fn);
return filter_num;
}
- fn->fci = fci;
+ fn->fc = fc;
INIT_LIST_HEAD(&fn->callbacks);
fn->filter = &filters[filter_num];
PARA_DEBUG_LOG("adding %s to filter chain\n", fn->filter->name);
- list_add_tail(&fn->node, &fci->filters);
+ list_add_tail(&fn->node, &fc->filters);
}
- if (list_empty(&fci->filters))
+ if (list_empty(&fc->filters))
return -E_NO_FILTERS;
return 1;
}
{
struct filter_node *fn;
- list_for_each_entry(fn, &fci->filters, node) {
+ list_for_each_entry(fn, &fc->filters, node) {
fn->filter->open(fn);
PARA_INFO_LOG("opened %s filter\n", fn->filter->name);
- fci->outbuf = fn->buf;
- fci->out_loaded = &fn->loaded;
+ fc->outbuf = fn->buf;
+ fc->out_loaded = &fn->loaded;
}
}
if (ret < 0)
goto out;
open_filters();
- ib = fci->inbuf;
- ob = fci->outbuf;
- il = fci->in_loaded;
- ol = fci->out_loaded;
+ ib = fc->inbuf;
+ ob = fc->outbuf;
+ il = fc->in_loaded;
+ ol = fc->out_loaded;
PARA_DEBUG_LOG("ib %p in, ob: %p\n", ib, ob);
again:
if (*il < INBUF_SIZE && !eof) {
eof = 1;
*il += ret;
}
- ret = filter_io(fci);
+ ret = filter_io(fc);
if (ret < 0)
goto out;
converted = ret;
out:
if (ret < 0)
PARA_EMERG_LOG("%s\n", PARA_STRERROR(-ret));
- close_filters(fci);
+ close_filters(fc);
return ret;
}