aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxlu_cfg.c
Commit message (Collapse)AuthorAgeFilesLines
* libxlu: Rename filename to config_sourceGeorge Dunlap2012-05-151-11/+11
| | | | | | | | | | | | | | The "filename" is a bit of a misnomer, as it's only used during error messages, and in most instances cases is actually set to "command line". Rename it to "config_source" to make it clear that it's not used to actually open any files. No functional changes. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: add new "defbool" built in type.Ian Campbell2012-03-011-0/+11
| | | | | | | | This type is a but like a "boolean" but with a third state "default" (so really I suppose it's a tristate). Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: move a lot more includes into libxl_internal.hIan Jackson2012-01-131-0/+2
| | | | | | | | | | | | | | | | | Move a lot of #include <stdfoo.h> from individual files into libxl_internal.h. This helps avoid portability mistakes where necessary system headers are omitted from individual files, and is also of course a convenience when developing. Also add #include "libxl_osdeps.h" /* must come before any other headers */ to the top of most libxl*.c files, so that anyone who adds any headers before libxl_internal.h will put the in the right place. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxlu: add xlu_cfg_get_list_as_string_listIan Campbell2011-11-291-0/+23
| | | | | | | | | | Returns a cfg list as a libxl_string_list. Use this to simplify the parsing of device model extra args. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com> Acked-by: Ian Jackson <ian.jackson.citrix.com>
* xlu: add "dont_warn" to xlu_cfg_*Ian Campbell2011-11-291-18/+21
| | | | | | | | I want it for get_long but we might as well have it everywhere. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com> Acked-by: Ian Jackson <ian.jackson.citrix.com>
* Replace references to old wiki with ones to new.Ian Campbell2011-11-291-1/+1
| | | | | | | | | | | | | | | | | | | | I have confirmed that the relevant pages have been transitioned. What remains is pages which have not yet been moved over: $ rgrep xenwiki * tools/libxen/README:http://wiki.xensource.com/xenwiki/XenApi tools/xenballoon/xenballoond.README:http://wiki.xensource.com/xenwiki/Open_Topics_For_Discussion?action=AttachFile&do=get&target=Memory+Overcommit.pdf Note that "PythonInXlConfig" never existed in the old wiki and does not exist in the new. This reference was introduced by 22735:cb94dbe20f97 and was supposed to have been written prior to the 4.1 release. I have transitioned it anyway but it's not clear how valuable the message actually is. Perhaps we should just remove that aspect of it? Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com> Acked-by: Ian Jackson <ian.jackson.citrix.com>
* libxl: fixup incorrect indentationIan Campbell2011-10-121-0/+8
| | | | | | | | | Several places which were previsously indented using hard tabs are now incorrectly indented. Fix them up. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: clean up trailing whitespaces in code.Wei Liu2011-07-191-8/+8
| | | | | | | | | Commit exactly the results of running find \! -iname '*.txt' -type f -print0 | xargs -0 perl -p -i.bak -E 's/\s+\n/\n/' Signed-off-by: Wei Liu <liuw@liuw.name> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: add missing copyright notices to some filesIan Jackson2011-06-021-0/+18
| | | | | Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxl: do not expose libxenctrl/libxenstore headers via libxl.hIan Campbell2011-04-061-0/+1
| | | | | | | | | | | | This completely removes libxenstore from libxl users' view. xl still needs libxenctrl directly due to the direct use of the xentoollog functionality but it is not exposed to the indirect linkage anymore. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: correctly initialise yylinenoIan Jackson2011-03-031-0/+3
| | | | | | | | | | | | | | | | | | | | | Sometimes xl would read an uninitialised variable when printing error messages, resulting in things like this: /etc/xen/thing.cfg:1030057088: config parsing error near `"ws08r2-x64-2': lexical error This is because yylineno is a variable inside the scanner created by yylex_init, but it is not initialised by yylex_init. (Debian bug #616099.) On the way I discovered a lot of complication to do with the calling convention between bison and flex in reentrant parsers/scanners which use locations (Debian bug #616100) but as the above change makes the current code in xen-unstable work I don't propose to do anything else about that now in our tree. Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Tested-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: config parser: print warning for apparent arbitrary pythonIan Jackson2011-01-111-0/+9
| | | | | | | | | | | | | | | | The characters - + . ( ) : are not legal in xl config files but are valid Python and use of at least one of them is almost essential for writing arbitrary Python in the config file. So if we see one of these during lexing, note it, and then after the parse is complete if it failed we print a special extra warning. Currently this warning refers to the nonexistent wiki page http://wiki.xen.org/xenwiki/PythonInXlConfig which will have to be written (and/or given a better name) before the actual 4.1 release. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: config parser: make CfgParseContext initialisation commonIan Jackson2011-01-111-37/+45
| | | | | | | | | xlu_cfg_readfile and xlu_cfg_readdata had some somewhat-boilerplate code for initialisation, parsing, and cleanup. Make that common. No functional change. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: config parser: do not segfault in some error pathsIan Jackson2011-01-111-0/+1
| | | | | | | In error paths, xlu__cfg_set_free can be called on NULL. So check for that rather than segfaulting. Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxl: change xl_cfg_get_list to take a dont_warn parameterAndre Przywara2010-09-211-5/+7
| | | | | | | | | | | xl_cfg_get_list can cope with the option not being a list, but it always reports a warning in this case. Introduce a parameter to omit this warning if needed. Future code can then decide what to do with this information. Signed-off-by: Andre Przywara <andre.przywara@amd.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl, xl: don't free string literals in config structureGianni Tedesco2010-09-091-1/+12
| | | | | | | | | | | | | | | | The function init_dm_info() is initialising some strings from literals. This is bad juju because when the destructor is called we cannot know if the string literal was overridden with a strdup()'d value. Therefore strdup values in the initialiser then introduce and use the function libxlu_cfg_replace_string() which free's whatever is set before strdupping the new value on top of it. The rule for the new call should be clear due to const vs. non-const arguments - changing the behaviour of libxlu_cfg_get_string() would cause more complexity than it saves. [ fixed up for stray ! sign -iwj ] Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: free values in XLU_ConfigSetting.Ian Campbell2010-08-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes these valgrind reported leaks, found with "valgrind xl create -n ..." ==21170== 8 bytes in 3 blocks are definitely lost in loss record 1 of 3 ==21170== at 0x4022F0A: malloc (vg_replace_malloc.c:236) ==21170== by 0x411B22F: strdup (in /lib/i686/cmov/libc-2.7.so) ==21170== by 0x4030085: xlu__cfgl_strdup (libxlu_cfg.c:290) ==21170== by 0x402F3C4: xlu__cfg_yylex (libxlu_cfg_l.l:37) ==21170== by 0x402DD86: xlu__cfg_yyparse (libxlu_cfg_y.c:1338) ==21170== by 0x40308AE: xlu_cfg_readdata (libxlu_cfg.c:85) ==21170== by 0x804DBE4: parse_config_data (xl_cmdimpl.c:591) ==21170== by 0x8056EE4: create_domain (xl_cmdimpl.c:1381) ==21170== by 0x80582AE: main_create (xl_cmdimpl.c:3178) ==21170== by 0x804B54B: main (xl.c:76) ==21170== ==21170== 57 bytes in 2 blocks are definitely lost in loss record 2 of 3 ==21170== at 0x4022F0A: malloc (vg_replace_malloc.c:236) ==21170== by 0x402FE22: xlu__cfgl_dequote (libxlu_cfg.c:307) ==21170== by 0x402F4B4: xlu__cfg_yylex (libxlu_cfg_l.l:52) ==21170== by 0x402DD86: xlu__cfg_yyparse (libxlu_cfg_y.c:1338) ==21170== by 0x40308AE: xlu_cfg_readdata (libxlu_cfg.c:85) ==21170== by 0x804DBE4: parse_config_data (xl_cmdimpl.c:591) ==21170== by 0x8056EE4: create_domain (xl_cmdimpl.c:1381) ==21170== by 0x80582AE: main_create (xl_cmdimpl.c:3178) ==21170== by 0x804B54B: main (xl.c:76) ==21170== ==21170== 111 bytes in 6 blocks are definitely lost in loss record 3 of 3 ==21170== at 0x4022F0A: malloc (vg_replace_malloc.c:236) ==21170== by 0x402FE22: xlu__cfgl_dequote (libxlu_cfg.c:307) ==21170== by 0x402F4ED: xlu__cfg_yylex (libxlu_cfg_l.l:56) ==21170== by 0x402DD86: xlu__cfg_yyparse (libxlu_cfg_y.c:1338) ==21170== by 0x40308AE: xlu_cfg_readdata (libxlu_cfg.c:85) ==21170== by 0x804DBE4: parse_config_data (xl_cmdimpl.c:591) ==21170== by 0x8056EE4: create_domain (xl_cmdimpl.c:1381) ==21170== by 0x80582AE: main_create (xl_cmdimpl.c:3178) ==21170== by 0x804B54B: main (xl.c:76) Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* xl: New savefile format. Save domain config when saving a domain.Keir Fraser2010-04-121-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We introduce a new format for saved domains. The new format, in contrast to the old: * Has a magic number which can distinguish it from other kinds of file * Is extensible * Can contains the domain configuration file On domain creation we remember the actual config file used (using the toolstack data feature of libxl, just introduced), and by default save it to the save file. However, options are provided for the following: * When saving a domain, supplying an alternative config file to store in the savefile. * When restoring a domain, supplying an alternative config file. If a domain is restored with a different config file, it is the responsibility of the xl user to ensure that the two configs are "compatible". Changing the targets of virtual devices is supported; changing other features of the domain is not recommended. Bad changes may lead to undefined behaviour in the domain, and are in practice likely to cause resume failures or crashes. Old format save files generated by old versions of xl are not supported. Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* Replace config file parser for "xl"Keir Fraser2010-03-031-0/+341
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". Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>