From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH 0/4] xl: consolidate adhoc parsers Date: Mon, 25 Jan 2016 12:25:53 +0000 Message-ID: <1453724753.4320.143.camel@citrix.com> References: <1453463454-4114-1-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aNgDY-0001CJ-Be for xen-devel@lists.xenproject.org; Mon, 25 Jan 2016 12:26:00 +0000 In-Reply-To: <1453463454-4114-1-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu , Xen-devel List-Id: xen-devel@lists.xenproject.org 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). Ian.