aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/libxl/libxl_utils.c')
-rw-r--r--tools/libxl/libxl_utils.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
index b23cf2550b..889d02cb7a 100644
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -639,3 +639,17 @@ int libxl_get_max_cpus(libxl_ctx *ctx)
{
return xc_get_max_cpus(ctx->xch);
}
+
+int libxl__enum_from_string(const libxl_enum_string_table *t,
+ const char *s, int *e)
+{
+ if (!t) return ERROR_INVAL;
+
+ for( ; t->s; t++) {
+ if (!strcasecmp(t->s, s)) {
+ *e = t->v;
+ return 0;
+ }
+ }
+ return ERROR_FAIL;
+}