libs/guest: Don't hide the indirection on xc_cpu_policy_t
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 4 May 2021 18:40:47 +0000 (19:40 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 5 May 2021 19:20:42 +0000 (20:20 +0100)
commite19b01c186e061e23fac80ff7cbf83e622f384fe
tree822b8bc17ba9d22975d03d57befcab47ffc6f6be
parente921931feccc8406d5a968e3f97827095b02ce96
libs/guest: Don't hide the indirection on xc_cpu_policy_t

It is bad form in C, perhaps best demonstrated by trying to read
xc_cpu_policy_destroy(), and causes const qualification to have
less-than-obvious behaviour (the hidden pointer becomes const, not the thing
it points at).

xc_cpu_policy_set_domain() needs to drop its (now normal) const qualification,
as the policy object is modified by the serialisation operation.

This also shows up a problem with the x86_cpu_policies_are_compatible(), where
the intermediate pointers are non-const.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
tools/include/xenctrl.h
tools/libs/guest/xg_cpuid_x86.c
tools/libs/guest/xg_sr_common_x86.c
tools/misc/xen-cpuid.c