> -----Original Message-----
> From: Dumitrescu, Cristian [mailto:[email protected]]
> Possible options that I see:
> 1. Add a new parameters argument to the load functions (e.g. struct
> cfgfile_params *p), whit the comment char as one (and currently only) field
> of this struct. Drawbacks: API change that might have to be announced one
> release before the actual API change.
I would prefer this option as it provides more flexibility. We can leave the
existing API as is and a wrapper that accepts additional parameters.
Something like the following (with implementations in the .c obviously rather
than inline the header like I have it here). There are several examples of
this pattern already in the dpdk (i.e., ring APIs, mempool APIs, etc.) where we
use a common function invoked by higher level functions that pass in additional
parameters to customize behavior.
struct rte_cfgfile *_rte_cfgfile_load(const char *filename,
const struct rte_cfgfile_params
*params);
struct rte_cfgfile *rte_cfgfile_load(const char *filename, int flags)
{
struct rte_cfgfile_params params;
rte_cfgfile_set_default_params(¶ms);
params |= flags;
return _rte_cfgfile_load(filename, ¶ms);
}
struct rte_cfgfile *rte_cfgfile_load_with_params(const char *filename,
const struct
rte_cfgfile_params *params)
{
return _rte_cfgfile_load(filename, params);
}