This provides a replacement config file parser for "xl" based on bison and flex. Benefits: * proper error reporting with line numbers * parser can understand nearly all "xm" configuration files directly (doesn''t understand Python code but should do everything else) * parser also understands the ;-infested "xl" style files * removes the dependency on libconfig * better checking for certain kinds of mistakes * eliminates the strange "massage file and try again" code This is intended to support all config files currently supported by "xl" and almost all files supported by "xm". (NB that whether a feature works depends on the implementation of that feature in xl/libxl of course.) This patch also introduces a new library "libxlutil" which is mainly for the benefit of "xl". Users of libxl do not need to use libxlutil, but they can do so if they want to parse "xl" files without being "xl". Ian. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Vincent Hanquez
2010-Mar-02 21:29 UTC
Re: [Xen-devel] [PATCH] Replace config file parser for "xl"
On 02/03/10 19:24, Ian Jackson wrote:> This provides a replacement config file parser for "xl" based on bison > and flex. > > Benefits: > * proper error reporting with line numbers > * parser can understand nearly all "xm" configuration files directly > (doesn''t understand Python code but should do everything else) > * parser also understands the ;-infested "xl" style files > * removes the dependency on libconfig > * better checking for certain kinds of mistakes > * eliminates the strange "massage file and try again" code > > This is intended to support all config files currently supported by > "xl" and almost all files supported by "xm". (NB that whether a > feature works depends on the implementation of that feature in > xl/libxl of course.) > > This patch also introduces a new library "libxlutil" which is mainly > for the benefit of "xl". Users of libxl do not need to use libxlutil, > but they can do so if they want to parse "xl" files without being > "xl".this is merely replacing a library dependency by a compilation dependency, plus the burden on maintaining a ad-hoc grammar. At least it would probably be useful to take the same approch as the linux kernel, i.e. checking bison/flex output in the repository to account for bison annoying volatility. however since it''s well separated from libxl, Acked-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com> -- Vincent _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2010-Mar-04 18:47 UTC
[Xen-devel] [PATCH] Fix config file interpretation when pci= not specified
My code for interpreting the results of the new config parser has undefined behaviour in the case when pci=... is not specified. Bad luck meant it worked for me in my tests. This patch fixes it. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> # HG changeset patch # User Ian Jackson <Ian.Jackson@eu.citrix.com> # Date 1267728147 0 # Node ID 2c7d21b063a59bfcc5c327820ffe1b15cf6915ac # Parent 32c721712bcef07b8e24834abbf1f23ef49640ed xl: Fix undefined behaviour when pci not specified in input file diff -r 32c721712bce -r 2c7d21b063a5 tools/libxl/xl.c --- a/tools/libxl/xl.c Thu Mar 04 11:23:57 2010 +0000 +++ b/tools/libxl/xl.c Thu Mar 04 18:42:27 2010 +0000 @@ -590,7 +590,7 @@ if (!xlu_cfg_get_long (config, "pci_power_mgmt", &l)) pci_power_mgmt = l; - if (xlu_cfg_get_list (config, "pci", &pcis, 0)) { + if (!xlu_cfg_get_list (config, "pci", &pcis, 0)) { *num_pcidevs = 0; *pcidevs = NULL; while ((buf = xlu_cfg_get_listitem (pcis, *num_pcidevs)) != NULL) { _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel