[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 0/4] xl: consolidate adhoc parsers

On Fri, 2016-01-22 at 11:50 +0000, Wei Liu wrote:
> This patch series consolidates adhoc parsers in xl.
> There are currently 4 types of devices:
> 1. block
> 2. netowrk
> 3. vtpm
> 4. pci
> that support hotplug as well as being specified in config file.
> Block and pci devices are fine because they use libxlu to parse
> configuration strings.
> Network and vtpms config parsers are not in a very good state, which
> need to be consolidated.
> Note that there is code repetition in the newly introduced parser
> code. We either need to have very long macro definition or code
> repetition. I chose the latter. Let me know your opinion.

You could make it take function pointers by using void * to point to the
objects. There's a (small) risk of mismatching the point and the callback,
but not significant enough to worry about IMHO.

That said, when I mentioned helpers originally I was imagining they would
parse their input into a data structure containing (in some form or other)
a list of key value pairs (taking into account the behaviour desired on
duplication of keys etc) which the callers would use opaquely up front and
then iterate over the results in some way (either a foreach helper macro,
or first() and next() type helpers etc).


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.