[dpdk-dev] [PATCH 1/5] cfgfile: configurable comment character

Legacy, Allain Allain.Legacy at windriver.com
Fri Mar 3 12:31:11 CET 2017

> -----Original Message-----
> From: Dumitrescu, Cristian [mailto:cristian.dumitrescu at intel.com]
> 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;

	params |= flags;
	return _rte_cfgfile_load(filename, &params);

struct rte_cfgfile *rte_cfgfile_load_with_params(const char *filename, 
						    const struct rte_cfgfile_params *params)
	return _rte_cfgfile_load(filename, params);

More information about the dev mailing list