[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH V5 23/32] libxl: introduce libxl_cpuid_policy_list_length
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxl/libxl.h | 1 + tools/libxl/libxl_cpuid.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 3886b9e..4b75802 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -573,6 +573,7 @@ void libxl_bitmap_dispose(libxl_bitmap *map); typedef struct libxl__cpuid_policy libxl_cpuid_policy; typedef libxl_cpuid_policy * libxl_cpuid_policy_list; void libxl_cpuid_dispose(libxl_cpuid_policy_list *cpuid_list); +int libxl_cpuid_policy_list_length(libxl_cpuid_policy_list *l); #define LIBXL_PCI_FUNC_ALL (~0U) diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c index d9007b2..fe14b87 100644 --- a/tools/libxl/libxl_cpuid.c +++ b/tools/libxl/libxl_cpuid.c @@ -455,6 +455,18 @@ int libxl_cpuid_policy_list_parse_json(libxl__gc *gc, return 0; } +int libxl_cpuid_policy_list_length(libxl_cpuid_policy_list *pl) +{ + int i = 0; + libxl_cpuid_policy_list l = *pl; + + if (l) + while (l[i].input[0] != XEN_CPUID_INPUT_UNUSED) + i++; + + return i; +} + /* * Local variables: * mode: C -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |