Skip to content

Commit

Permalink
tools: Remove all DECLARE_* op macros in xc
Browse files Browse the repository at this point in the history
These macros were hiding that the ops are not zero-initialized by the
toolstack. This is needlessly opaque for something so simple, so this patch
removes them and replaces them with explicit zero-initialising versions.

The patch also removes PHYSDEV_OP from there, as that seems to be an old
dead macro.

Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
  • Loading branch information
Alejandro Vallejo authored and jbeulich committed Nov 15, 2023
1 parent 22b773d commit b24a0f3
Show file tree
Hide file tree
Showing 25 changed files with 186 additions and 192 deletions.
4 changes: 2 additions & 2 deletions tools/libs/ctrl/xc_arinc653.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ xc_sched_arinc653_schedule_set(
struct xen_sysctl_arinc653_schedule *schedule)
{
int rc;
DECLARE_SYSCTL;
struct xen_sysctl sysctl = {};
DECLARE_HYPERCALL_BOUNCE(
schedule,
sizeof(*schedule),
Expand Down Expand Up @@ -63,7 +63,7 @@ xc_sched_arinc653_schedule_get(
struct xen_sysctl_arinc653_schedule *schedule)
{
int rc;
DECLARE_SYSCTL;
struct xen_sysctl sysctl = {};
DECLARE_HYPERCALL_BOUNCE(
schedule,
sizeof(*schedule),
Expand Down
8 changes: 4 additions & 4 deletions tools/libs/ctrl/xc_cpu_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

int xc_cpu_online(xc_interface *xch, int cpu)
{
DECLARE_SYSCTL;
struct xen_sysctl sysctl = {};
int ret;

sysctl.cmd = XEN_SYSCTL_cpu_hotplug;
Expand All @@ -35,7 +35,7 @@ int xc_cpu_online(xc_interface *xch, int cpu)

int xc_cpu_offline(xc_interface *xch, int cpu)
{
DECLARE_SYSCTL;
struct xen_sysctl sysctl = {};
int ret;

sysctl.cmd = XEN_SYSCTL_cpu_hotplug;
Expand All @@ -48,7 +48,7 @@ int xc_cpu_offline(xc_interface *xch, int cpu)

int xc_smt_enable(xc_interface *xch)
{
DECLARE_SYSCTL;
struct xen_sysctl sysctl = {};
int ret;

sysctl.cmd = XEN_SYSCTL_cpu_hotplug;
Expand All @@ -61,7 +61,7 @@ int xc_smt_enable(xc_interface *xch)

int xc_smt_disable(xc_interface *xch)
{
DECLARE_SYSCTL;
struct xen_sysctl sysctl = {};
int ret;

sysctl.cmd = XEN_SYSCTL_cpu_hotplug;
Expand Down
14 changes: 7 additions & 7 deletions tools/libs/ctrl/xc_cpupool.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int xc_cpupool_create(xc_interface *xch,
uint32_t sched_id)
{
int err;
DECLARE_SYSCTL;
struct xen_sysctl sysctl = {};

sysctl.cmd = XEN_SYSCTL_cpupool_op;
sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_CREATE;
Expand All @@ -56,7 +56,7 @@ int xc_cpupool_create(xc_interface *xch,
int xc_cpupool_destroy(xc_interface *xch,
uint32_t poolid)
{
DECLARE_SYSCTL;
struct xen_sysctl sysctl = {};

sysctl.cmd = XEN_SYSCTL_cpupool_op;
sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_DESTROY;
Expand All @@ -70,7 +70,7 @@ xc_cpupoolinfo_t *xc_cpupool_getinfo(xc_interface *xch,
int err = 0;
xc_cpupoolinfo_t *info = NULL;
int local_size;
DECLARE_SYSCTL;
struct xen_sysctl sysctl = {};
DECLARE_HYPERCALL_BUFFER(uint8_t, local);

local_size = xc_get_cpumap_size(xch);
Expand Down Expand Up @@ -129,7 +129,7 @@ int xc_cpupool_addcpu(xc_interface *xch,
uint32_t poolid,
int cpu)
{
DECLARE_SYSCTL;
struct xen_sysctl sysctl = {};

sysctl.cmd = XEN_SYSCTL_cpupool_op;
sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_ADDCPU;
Expand All @@ -152,7 +152,7 @@ int xc_cpupool_removecpu(xc_interface *xch,
{
unsigned retries;
int err = 0;
DECLARE_SYSCTL;
struct xen_sysctl sysctl = {};

sysctl.cmd = XEN_SYSCTL_cpupool_op;
sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_RMCPU;
Expand All @@ -170,7 +170,7 @@ int xc_cpupool_movedomain(xc_interface *xch,
uint32_t poolid,
uint32_t domid)
{
DECLARE_SYSCTL;
struct xen_sysctl sysctl = {};

sysctl.cmd = XEN_SYSCTL_cpupool_op;
sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_MOVEDOMAIN;
Expand All @@ -184,7 +184,7 @@ xc_cpumap_t xc_cpupool_freeinfo(xc_interface *xch)
int err = -1;
xc_cpumap_t cpumap = NULL;
int mapsize;
DECLARE_SYSCTL;
struct xen_sysctl sysctl = {};
DECLARE_HYPERCALL_BUFFER(uint8_t, local);

mapsize = xc_get_cpumap_size(xch);
Expand Down
8 changes: 4 additions & 4 deletions tools/libs/ctrl/xc_csched.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ xc_sched_credit_domain_set(
uint32_t domid,
struct xen_domctl_sched_credit *sdom)
{
DECLARE_DOMCTL;
struct xen_domctl domctl = {};

domctl.cmd = XEN_DOMCTL_scheduler_op;
domctl.domain = domid;
Expand All @@ -49,7 +49,7 @@ xc_sched_credit_domain_get(
uint32_t domid,
struct xen_domctl_sched_credit *sdom)
{
DECLARE_DOMCTL;
struct xen_domctl domctl = {};

domctl.cmd = XEN_DOMCTL_scheduler_op;
domctl.domain = domid;
Expand All @@ -70,7 +70,7 @@ xc_sched_credit_params_set(
uint32_t cpupool_id,
struct xen_sysctl_credit_schedule *schedule)
{
DECLARE_SYSCTL;
struct xen_sysctl sysctl = {};

sysctl.cmd = XEN_SYSCTL_scheduler_op;
sysctl.u.scheduler_op.cpupool_id = cpupool_id;
Expand All @@ -93,7 +93,7 @@ xc_sched_credit_params_get(
uint32_t cpupool_id,
struct xen_sysctl_credit_schedule *schedule)
{
DECLARE_SYSCTL;
struct xen_sysctl sysctl = {};

sysctl.cmd = XEN_SYSCTL_scheduler_op;
sysctl.u.scheduler_op.cpupool_id = cpupool_id;
Expand Down
8 changes: 4 additions & 4 deletions tools/libs/ctrl/xc_csched2.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ xc_sched_credit2_domain_set(
uint32_t domid,
struct xen_domctl_sched_credit2 *sdom)
{
DECLARE_DOMCTL;
struct xen_domctl domctl = {};

domctl.cmd = XEN_DOMCTL_scheduler_op;
domctl.domain = domid;
Expand All @@ -49,7 +49,7 @@ xc_sched_credit2_domain_get(
uint32_t domid,
struct xen_domctl_sched_credit2 *sdom)
{
DECLARE_DOMCTL;
struct xen_domctl domctl = {};

domctl.cmd = XEN_DOMCTL_scheduler_op;
domctl.domain = domid;
Expand All @@ -70,7 +70,7 @@ xc_sched_credit2_params_set(
uint32_t cpupool_id,
struct xen_sysctl_credit2_schedule *schedule)
{
DECLARE_SYSCTL;
struct xen_sysctl sysctl = {};

sysctl.cmd = XEN_SYSCTL_scheduler_op;
sysctl.u.scheduler_op.cpupool_id = cpupool_id;
Expand All @@ -93,7 +93,7 @@ xc_sched_credit2_params_get(
uint32_t cpupool_id,
struct xen_sysctl_credit2_schedule *schedule)
{
DECLARE_SYSCTL;
struct xen_sysctl sysctl = {};

sysctl.cmd = XEN_SYSCTL_scheduler_op;
sysctl.u.scheduler_op.cpupool_id = cpupool_id;
Expand Down

0 comments on commit b24a0f3

Please sign in to comment.