aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxlu_internal.h
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-03-03 17:39:22 +0000
committerKeir Fraser <keir.fraser@citrix.com>2010-03-03 17:39:22 +0000
commitb104c3762dcbe310318a14bed35f0813db48a26d (patch)
tree6ec4448b8b7c28e306348ebad1b41a4555ff83f7 /tools/libxl/libxlu_internal.h
parent24c2f2ccee02f7bf83bf8a9ffdb204cf8d40c653 (diff)
downloadxen-b104c3762dcbe310318a14bed35f0813db48a26d.tar.gz
xen-b104c3762dcbe310318a14bed35f0813db48a26d.tar.bz2
xen-b104c3762dcbe310318a14bed35f0813db48a26d.zip
Replace config file parser for "xl"
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>
Diffstat (limited to 'tools/libxl/libxlu_internal.h')
-rw-r--r--tools/libxl/libxlu_internal.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/tools/libxl/libxlu_internal.h b/tools/libxl/libxlu_internal.h
new file mode 100644
index 0000000000..fd7addcfd6
--- /dev/null
+++ b/tools/libxl/libxlu_internal.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2010 Citrix Ltd.
+ * Author Ian Jackson <ian.jackson@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#ifndef LIBXLU_INTERNAL_H
+#define LIBXLU_INTERNAL_H
+
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <assert.h>
+
+#define XLU_ConfigList XLU_ConfigSetting
+
+#include "libxlutil.h"
+
+struct XLU_ConfigSetting { /* transparent */
+ struct XLU_ConfigSetting *next;
+ char *name;
+ int nvalues, avalues; /* lists have avalues>1 */
+ char **values;
+ int lineno;
+};
+
+struct XLU_Config {
+ XLU_ConfigSetting *settings;
+ FILE *report;
+ char *filename;
+};
+
+typedef struct {
+ XLU_Config *cfg;
+ int err, lexerrlineno;
+ void *scanner;
+} CfgParseContext;
+
+#endif /*LIBXLU_INTERNAL_H*/