On 16/06/2023 2:10 pm, Roger Pau Monne wrote:
> Currently libxl_cpuid_policy_list is an opaque type to the users of
> libxl, and internally it's an array of xc_xend_cpuid objects.
>
> Change the type to instead be a structure that contains one array for
> CPUID policies, in preparation for it also holding another array for
> MSR policies.
>
> Signed-off-by: Roger Pau Monné <roger....@citrix.com>
> ---
>  tools/include/libxl.h          |  6 +++--
>  tools/libs/light/gentest.py    |  2 +-
>  tools/libs/light/libxl_cpuid.c | 49 +++++++++++++++++++---------------
>  3 files changed, 32 insertions(+), 25 deletions(-)
>
> diff --git a/tools/include/libxl.h b/tools/include/libxl.h
> index cac641a7eba2..41e19f2af7f5 100644
> --- a/tools/include/libxl.h
> +++ b/tools/include/libxl.h
> @@ -1459,8 +1459,10 @@ void libxl_bitmap_dispose(libxl_bitmap *map);
>   * libxl_cpuid_policy is opaque in the libxl ABI.  Users of both libxl and
>   * libxc may not make assumptions about xc_xend_cpuid.
>   */
> -typedef struct xc_xend_cpuid libxl_cpuid_policy;
> -typedef libxl_cpuid_policy * libxl_cpuid_policy_list;
> +typedef struct libxl_cpu_policy {
> +    struct xc_xend_cpuid *cpuid;
> +} libxl_cpuid_policy;
> +typedef libxl_cpuid_policy libxl_cpuid_policy_list;

I don't think we can get away with doing this.  It makes the type
non-opaque, and you'll also break the libxl ABI in the next patch when
you change the size of this object.

For better or worse, I think

typedef libxl_cpuid_policy * libxl_cpuid_policy_list;

needs to stay here, and libxl_cpuid_policy get moved into
libxl_internal.h where it can then be altered.

~Andrew

Reply via email to