aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxen/src
diff options
context:
space:
mode:
authorEwan Mellor <ewan@xensource.com>2007-04-13 18:14:06 +0100
committerEwan Mellor <ewan@xensource.com>2007-04-13 18:14:06 +0100
commit7371dd7b91a403c45a4363c952697b0e71e1e434 (patch)
tree45f85fbb829cf859a4a635b15a4773f50e9ec14e /tools/libxen/src
parent3bd8ff8dd154311d78165d26e8970c10bc7bbcd7 (diff)
downloadxen-7371dd7b91a403c45a4363c952697b0e71e1e434.tar.gz
xen-7371dd7b91a403c45a4363c952697b0e71e1e434.tar.bz2
xen-7371dd7b91a403c45a4363c952697b0e71e1e434.zip
Added documentation, C bindings, and test for VM_metrics.VCPUs_flags.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
Diffstat (limited to 'tools/libxen/src')
-rw-r--r--tools/libxen/src/xen_common.c19
-rw-r--r--tools/libxen/src/xen_int_string_set_map.c52
-rw-r--r--tools/libxen/src/xen_vm_metrics.c22
3 files changed, 93 insertions, 0 deletions
diff --git a/tools/libxen/src/xen_common.c b/tools/libxen/src/xen_common.c
index 6b52723d9d..b22ab2fcee 100644
--- a/tools/libxen/src/xen_common.c
+++ b/tools/libxen/src/xen_common.c
@@ -36,6 +36,7 @@
#include "xen_internal.h"
#include "xen_int_float_map.h"
#include "xen_int_int_map.h"
+#include "xen_int_string_set_map.h"
#include "xen_string_string_map.h"
@@ -1716,3 +1717,21 @@ const abstract_type abstract_type_int_int_map =
.struct_size = sizeof(xen_int_int_map_contents),
.members = int_int_members
};
+
+static struct struct_member int_string_set_members[] =
+{
+ {
+ .type = &abstract_type_int,
+ .offset = offsetof(xen_int_string_set_map_contents, key)
+ },
+ {
+ .type = &abstract_type_string_set,
+ .offset = offsetof(xen_int_string_set_map_contents, val)
+ }
+};
+const abstract_type abstract_type_int_string_set_map =
+ {
+ .typename = MAP,
+ .struct_size = sizeof(xen_int_string_set_map_contents),
+ .members = int_string_set_members
+ };
diff --git a/tools/libxen/src/xen_int_string_set_map.c b/tools/libxen/src/xen_int_string_set_map.c
new file mode 100644
index 0000000000..1b37927034
--- /dev/null
+++ b/tools/libxen/src/xen_int_string_set_map.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library 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; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "xen_common.h"
+#include "xen_int_string_set_map.h"
+#include "xen_internal.h"
+#include "xen_string_set.h"
+
+
+xen_int_string_set_map *
+xen_int_string_set_map_alloc(size_t size)
+{
+ xen_int_string_set_map *result = calloc(1, sizeof(xen_int_string_set_map) +
+ size * sizeof(struct xen_int_string_set_map_contents));
+ result->size = size;
+ return result;
+}
+
+
+void
+xen_int_string_set_map_free(xen_int_string_set_map *map)
+{
+ if (map == NULL)
+ {
+ return;
+ }
+
+ size_t n = map->size;
+ for (size_t i = 0; i < n; i++)
+ {
+
+ xen_string_set_free(map->contents[i].val);
+ }
+
+ free(map);
+}
diff --git a/tools/libxen/src/xen_vm_metrics.c b/tools/libxen/src/xen_vm_metrics.c
index 3bf2fd7c29..267393a935 100644
--- a/tools/libxen/src/xen_vm_metrics.c
+++ b/tools/libxen/src/xen_vm_metrics.c
@@ -23,6 +23,7 @@
#include "xen_common.h"
#include "xen_int_float_map.h"
#include "xen_int_int_map.h"
+#include "xen_int_string_set_map.h"
#include "xen_internal.h"
#include "xen_string_string_map.h"
#include "xen_vm_metrics.h"
@@ -57,6 +58,9 @@ static const struct_member xen_vm_metrics_record_struct_members[] =
{ .key = "VCPUs_params",
.type = &abstract_type_string_string_map,
.offset = offsetof(xen_vm_metrics_record, vcpus_params) },
+ { .key = "VCPUs_flags",
+ .type = &abstract_type_int_string_set_map,
+ .offset = offsetof(xen_vm_metrics_record, vcpus_flags) },
{ .key = "state",
.type = &abstract_type_string_set,
.offset = offsetof(xen_vm_metrics_record, state) },
@@ -90,6 +94,7 @@ xen_vm_metrics_record_free(xen_vm_metrics_record *record)
xen_int_float_map_free(record->vcpus_utilisation);
xen_int_int_map_free(record->vcpus_cpu);
xen_string_string_map_free(record->vcpus_params);
+ xen_int_string_set_map_free(record->vcpus_flags);
xen_string_set_free(record->state);
free(record);
}
@@ -219,6 +224,23 @@ xen_vm_metrics_get_vcpus_params(xen_session *session, xen_string_string_map **re
bool
+xen_vm_metrics_get_vcpus_flags(xen_session *session, xen_int_string_set_map **result, xen_vm_metrics vm_metrics)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vm_metrics }
+ };
+
+ abstract_type result_type = abstract_type_int_string_set_map;
+
+ *result = NULL;
+ XEN_CALL_("VM_metrics.get_VCPUs_flags");
+ return session->ok;
+}
+
+
+bool
xen_vm_metrics_get_state(xen_session *session, struct xen_string_set **result, xen_vm_metrics vm_metrics)
{
abstract_value param_values[] =