tools: Remove all DECLARE_* op macros in xc
PATCH 1/1 tools: Remove all DECLARE_* op macros in xc
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.
---
@Daniel: I CC'd you due to the DECLARE_FLASK_OP removal, though it shouldn't functionally affect anything at all.
The patch looks big, but all changes are reproducible via this snippet in the "tools/libs" folder, followed by manually removing the #defines in "xc_private.h"
for f in `find -name "*.[ch]"`; do \
sed -i 's/DECLARE_FLASK_OP/struct xen_flask_op op = {0}/g' $f; \
sed -i 's/DECLARE_SYSCTL/struct xen_sysctl sysctl = {0}/g' $f; \
sed -i 's/DECLARE_DOMCTL/struct xen_domctl domctl = {0}/g' $f; \
sed -i 's/DECLARE_PLATFORM_OP/struct xen_platform_op platform_op = {0}/g' $f; \
done
---
tools/libs/ctrl/xc_arinc653.c | 4 +-
tools/libs/ctrl/xc_cpu_hotplug.c | 8 +-
tools/libs/ctrl/xc_cpupool.c | 14 +--
tools/libs/ctrl/xc_csched.c | 8 +-
tools/libs/ctrl/xc_csched2.c | 8 +-
tools/libs/ctrl/xc_domain.c | 108 ++++++++++++------------
tools/libs/ctrl/xc_flask.c | 34 ++++----
tools/libs/ctrl/xc_memshr.c | 2 +-
tools/libs/ctrl/xc_misc.c | 40 ++++-----
tools/libs/ctrl/xc_monitor.c | 30 +++----
tools/libs/ctrl/xc_pm.c | 32 +++----
tools/libs/ctrl/xc_private.c | 4 +-
tools/libs/ctrl/xc_private.h | 6 --
tools/libs/ctrl/xc_psr.c | 22 ++---
tools/libs/ctrl/xc_resource.c | 2 +-
tools/libs/ctrl/xc_rt.c | 8 +-
tools/libs/ctrl/xc_tbuf.c | 12 +--
tools/libs/ctrl/xc_vm_event.c | 4 +-
tools/libs/guest/xg_cpuid_x86.c | 8 +-
tools/libs/guest/xg_dom_arm.c | 2 +-
tools/libs/guest/xg_dom_boot.c | 2 +-
tools/libs/guest/xg_dom_x86.c | 2 +-
tools/libs/guest/xg_offline_page.c | 6 +-
tools/libs/guest/xg_resume.c | 6 +-
tools/libs/guest/xg_sr_restore_x86_pv.c | 6 +-
25 files changed, 186 insertions(+), 192 deletions(-)tools/libs/ctrl/xc_arinc653.c +2 -2
@@ -33,7 +33,7 @@ xc_sched_arinc653_schedule_set( struct xen_sysctl_arinc653_schedule *schedule) {int rc; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; DECLARE_HYPERCALL_BOUNCE( schedule, sizeof(*schedule),
@@ -63,7 +63,7 @@ xc_sched_arinc653_schedule_get( struct xen_sysctl_arinc653_schedule *schedule) {int rc; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; DECLARE_HYPERCALL_BOUNCE( schedule, sizeof(*schedule),
tools/libs/ctrl/xc_cpu_hotplug.c +4 -4
@@ -22,7 +22,7 @@int xc_cpu_online (xc_interface *xch,int cpu) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };int ret; sysctl.cmd = XEN_SYSCTL_cpu_hotplug;
@@ -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 = {0 };int ret; sysctl.cmd = XEN_SYSCTL_cpu_hotplug;
@@ -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 = {0 };int ret; sysctl.cmd = XEN_SYSCTL_cpu_hotplug;
@@ -61,7 +61,7 @@ int xc_smt_enable(xc_interface *xch)int xc_smt_disable (xc_interface *xch) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };int ret; sysctl.cmd = XEN_SYSCTL_cpu_hotplug;
tools/libs/ctrl/xc_cpupool.c +7 -7
@@ -39,7 +39,7 @@ int xc_cpupool_create(xc_interface *xch, uint32_t sched_id) {int err; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; sysctl.cmd = XEN_SYSCTL_cpupool_op; sysctl.u.cpupool_op.op =XEN_SYSCTL_CPUPOOL_OP_CREATE ;
@@ -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 = {0 }; sysctl.cmd = XEN_SYSCTL_cpupool_op; sysctl.u.cpupool_op.op =XEN_SYSCTL_CPUPOOL_OP_DESTROY ;
@@ -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 = {0 };DECLARE_HYPERCALL_BUFFER (uint8_t, local); local_size =xc_get_cpumap_size (xch);
@@ -129,7 +129,7 @@ int xc_cpupool_addcpu(xc_interface *xch, uint32_t poolid, int cpu) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; sysctl.cmd = XEN_SYSCTL_cpupool_op; sysctl.u.cpupool_op.op =XEN_SYSCTL_CPUPOOL_OP_ADDCPU ;
@@ -152,7 +152,7 @@ int xc_cpupool_removecpu(xc_interface *xch, {unsigned retries;int err =0 ; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; sysctl.cmd = XEN_SYSCTL_cpupool_op; sysctl.u.cpupool_op.op =XEN_SYSCTL_CPUPOOL_OP_RMCPU ;
@@ -170,7 +170,7 @@ int xc_cpupool_movedomain(xc_interface *xch, uint32_t poolid, uint32_t domid) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; sysctl.cmd = XEN_SYSCTL_cpupool_op; sysctl.u.cpupool_op.op =XEN_SYSCTL_CPUPOOL_OP_MOVEDOMAIN ;
@@ -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 = {0 };DECLARE_HYPERCALL_BUFFER (uint8_t, local); mapsize =xc_get_cpumap_size (xch);
tools/libs/ctrl/xc_csched.c +4 -4
@@ -29,7 +29,7 @@ xc_sched_credit_domain_set(uint32_t domid, struct xen_domctl_sched_credit *sdom) { -DECLARE_DOMCTL ; + struct xen_domctl domctl = {0}; domctl.cmd = XEN_DOMCTL_scheduler_op; domctl.domain = domid;
@@ -49,7 +49,7 @@ xc_sched_credit_domain_get(uint32_t domid, struct xen_domctl_sched_credit *sdom) { -DECLARE_DOMCTL ; + struct xen_domctl domctl = {0}; domctl.cmd = XEN_DOMCTL_scheduler_op; domctl.domain = domid;
@@ -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 = {0}; sysctl.cmd = XEN_SYSCTL_scheduler_op; sysctl.u.scheduler_op.cpupool_id = cpupool_id;
@@ -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 = {0}; sysctl.cmd = XEN_SYSCTL_scheduler_op; sysctl.u.scheduler_op.cpupool_id = cpupool_id;
tools/libs/ctrl/xc_csched2.c +4 -4
@@ -29,7 +29,7 @@ xc_sched_credit2_domain_set(uint32_t domid, struct xen_domctl_sched_credit2 *sdom) { -DECLARE_DOMCTL ; + struct xen_domctl domctl = {0}; domctl.cmd = XEN_DOMCTL_scheduler_op; domctl.domain = domid;
@@ -49,7 +49,7 @@ xc_sched_credit2_domain_get(uint32_t domid, struct xen_domctl_sched_credit2 *sdom) { -DECLARE_DOMCTL ; + struct xen_domctl domctl = {0}; domctl.cmd = XEN_DOMCTL_scheduler_op; domctl.domain = domid;
@@ -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 = {0}; sysctl.cmd = XEN_SYSCTL_scheduler_op; sysctl.u.scheduler_op.cpupool_id = cpupool_id;
@@ -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 = {0}; sysctl.cmd = XEN_SYSCTL_scheduler_op; sysctl.u.scheduler_op.cpupool_id = cpupool_id;
tools/libs/ctrl/xc_domain.c +54 -54
432 lines not on this page · raw message
tools/libs/ctrl/xc_flask.c +17 -17
@@ -64,7 +64,7 @@ int xc_flask_op(xc_interface *xch, xen_flask_op_t *op)int xc_flask_load (xc_interface *xch,char *buf,uint32_t size) {int err; -DECLARE_FLASK_OP ; +struct xen_flask_op op = {0 };DECLARE_HYPERCALL_BOUNCE (buf, size,XC_HYPERCALL_BUFFER_BOUNCE_IN );if (xc_hypercall_bounce_pre (xch, buf) ) {
@@ -86,7 +86,7 @@ int xc_flask_load(xc_interface *xch, char *buf, uint32_t size)int xc_flask_context_to_sid (xc_interface *xch,char *buf,uint32_t size,uint32_t *sid) {int err; -DECLARE_FLASK_OP ; +struct xen_flask_op op = {0 };DECLARE_HYPERCALL_BOUNCE (buf, size,XC_HYPERCALL_BUFFER_BOUNCE_IN );if (xc_hypercall_bounce_pre (xch, buf) )
@@ -112,7 +112,7 @@ int xc_flask_context_to_sid(xc_interface *xch, char *buf, uint32_t size, uint32_int xc_flask_sid_to_context (xc_interface *xch,int sid,char *buf,uint32_t size) {int err; -DECLARE_FLASK_OP ; +struct xen_flask_op op = {0 };DECLARE_HYPERCALL_BOUNCE (buf, size,XC_HYPERCALL_BUFFER_BOUNCE_OUT );if (xc_hypercall_bounce_pre (xch, buf) )
@@ -135,7 +135,7 @@ int xc_flask_sid_to_context(xc_interface *xch, int sid, char *buf, uint32_t sizeint xc_flask_getenforce (xc_interface *xch) { -DECLARE_FLASK_OP ; +struct xen_flask_op op = {0 }; op.cmd =FLASK_GETENFORCE ;return xc_flask_op (xch, &op);
@@ -143,7 +143,7 @@ int xc_flask_getenforce(xc_interface *xch)int xc_flask_setenforce (xc_interface *xch,int mode) { -DECLARE_FLASK_OP ; +struct xen_flask_op op = {0 }; op.cmd =FLASK_SETENFORCE ; op.u.enforce.enforcing = mode;
@@ -153,7 +153,7 @@ int xc_flask_setenforce(xc_interface *xch, int mode)int xc_flask_getbool_byid (xc_interface *xch,int id,char *name,uint32_t size,int *curr,int *pend) {int rv; -DECLARE_FLASK_OP ; +struct xen_flask_op op = {0 };DECLARE_HYPERCALL_BOUNCE (name, size,XC_HYPERCALL_BUFFER_BOUNCE_OUT );if (xc_hypercall_bounce_pre (xch, name) )
@@ -185,7 +185,7 @@ int xc_flask_getbool_byid(xc_interface *xch, int id, char *name, uint32_t size,int xc_flask_getbool_byname (xc_interface *xch,char *name,int *curr,int *pend) {int rv; -DECLARE_FLASK_OP ; +struct xen_flask_op op = {0 };DECLARE_HYPERCALL_BOUNCE (name,strlen (name),XC_HYPERCALL_BUFFER_BOUNCE_IN );if (xc_hypercall_bounce_pre (xch, name) )
@@ -217,7 +217,7 @@ int xc_flask_getbool_byname(xc_interface *xch, char *name, int *curr, int *pend)int xc_flask_setbool (xc_interface *xch,char *name,int value,int commit) {int rv; -DECLARE_FLASK_OP ; +struct xen_flask_op op = {0 };DECLARE_HYPERCALL_BOUNCE (name,strlen (name),XC_HYPERCALL_BUFFER_BOUNCE_IN );if (xc_hypercall_bounce_pre (xch, name) )
@@ -245,7 +245,7 @@ static int xc_flask_add(xc_interface *xch, uint32_t ocon, uint64_t low, uint64_t {uint32_t sid;int err; -DECLARE_FLASK_OP ; +struct xen_flask_op op = {0 }; err =xc_flask_context_to_sid (xch, scontext,strlen (scontext), &sid);if ( err )
@@ -284,7 +284,7 @@ int xc_flask_add_device(xc_interface *xch, unsigned long device, char *scontext)static int xc_flask_del (xc_interface *xch,uint32_t ocon,uint64_t low,uint64_t high) { -DECLARE_FLASK_OP ; +struct xen_flask_op op = {0 }; op.cmd =FLASK_DEL_OCONTEXT ; op.u.ocontext.ocon = ocon;
@@ -320,7 +320,7 @@ int xc_flask_access(xc_interface *xch, const char *scon, const char *tcon, uint32_t *auditallow, uint32_t *auditdeny, uint32_t *seqno) { -DECLARE_FLASK_OP ; + struct xen_flask_op op = {0};int err; err =xc_flask_context_to_sid (xch, (char *)scon,strlen (scon), &op.u.access.ssid);
@@ -359,7 +359,7 @@ int xc_flask_access(xc_interface *xch, const char *scon, const char *tcon,int xc_flask_avc_hashstats (xc_interface *xch,char *buf,int size) {int err; -DECLARE_FLASK_OP ; +struct xen_flask_op op = {0 }; op.cmd =FLASK_AVC_HASHSTATS ;
@@ -377,7 +377,7 @@ int xc_flask_avc_cachestats(xc_interface *xch, char *buf, int size) {int err, n;int i =0 ; -DECLARE_FLASK_OP ; +struct xen_flask_op op = {0 }; n =snprintf (buf, size,"lookups hits misses allocations reclaims frees\n" ); buf += n;
@@ -406,7 +406,7 @@ int xc_flask_avc_cachestats(xc_interface *xch, char *buf, int size)int xc_flask_policyvers (xc_interface *xch) { -DECLARE_FLASK_OP ; +struct xen_flask_op op = {0 }; op.cmd =FLASK_POLICYVERS ;return xc_flask_op (xch, &op);
@@ -414,7 +414,7 @@ int xc_flask_policyvers(xc_interface *xch)int xc_flask_getavc_threshold (xc_interface *xch) { -DECLARE_FLASK_OP ; +struct xen_flask_op op = {0 }; op.cmd =FLASK_GETAVC_THRESHOLD ;return xc_flask_op (xch, &op);
@@ -422,7 +422,7 @@ int xc_flask_getavc_threshold(xc_interface *xch)int xc_flask_setavc_threshold (xc_interface *xch,int threshold) { -DECLARE_FLASK_OP ; +struct xen_flask_op op = {0 }; op.cmd =FLASK_SETAVC_THRESHOLD ; op.u.setavc_threshold.threshold = threshold;
@@ -431,7 +431,7 @@ int xc_flask_setavc_threshold(xc_interface *xch, int threshold)int xc_flask_relabel_domain (xc_interface *xch,uint32_t domid,uint32_t sid) { -DECLARE_FLASK_OP ; +struct xen_flask_op op = {0 }; op.cmd =FLASK_RELABEL_DOMAIN ; op.u.relabel.domid = domid; op.u.relabel.sid = sid;
tools/libs/ctrl/xc_memshr.c +1 -1
@@ -28,7 +28,7 @@ int xc_memshr_control(xc_interface *xch, uint32_t domid, int enable) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 };struct xen_domctl_mem_sharing_op *op; domctl.cmd = XEN_DOMCTL_mem_sharing_op;
tools/libs/ctrl/xc_misc.c +20 -20
@@ -138,7 +138,7 @@ int xc_readconsolering(xc_interface *xch, {int ret;unsigned int nr_chars = *pnr_chars; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };DECLARE_HYPERCALL_BOUNCE (buffer, nr_chars,XC_HYPERCALL_BUFFER_BOUNCE_OUT );if (xc_hypercall_bounce_pre (xch, buffer) )
@@ -170,7 +170,7 @@ int xc_readconsolering(xc_interface *xch,int xc_send_debug_keys (xc_interface *xch,const char *keys) {int ret, len =strlen (keys); -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };DECLARE_HYPERCALL_BOUNCE_IN (keys, len);if (xc_hypercall_bounce_pre (xch, keys) )
@@ -191,7 +191,7 @@ int xc_physinfo(xc_interface *xch, xc_physinfo_t *put_info) {int ret; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; sysctl.cmd = XEN_SYSCTL_physinfo;
@@ -206,7 +206,7 @@ int xc_physinfo(xc_interface *xch,int xc_microcode_update (xc_interface *xch,const void *buf,size_t len) {int ret; -DECLARE_PLATFORM_OP ; +struct xen_platform_op platform_op = {0 }; DECLARE_HYPERCALL_BUFFER(struct xenpf_microcode_update, uc); uc =xc_hypercall_buffer_alloc (xch, uc, len);
@@ -265,7 +265,7 @@ int xc_cputopoinfo(xc_interface *xch, unsigned *max_cpus, xc_cputopo_t *cputopo) {int ret; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };DECLARE_HYPERCALL_BOUNCE (cputopo, *max_cpus *sizeof (*cputopo),XC_HYPERCALL_BUFFER_BOUNCE_OUT );
@@ -292,7 +292,7 @@ int xc_numainfo(xc_interface *xch, unsigned *max_nodes, xc_meminfo_t *meminfo, uint32_t *distance) {int ret; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };DECLARE_HYPERCALL_BOUNCE (meminfo, *max_nodes *sizeof (*meminfo),XC_HYPERCALL_BUFFER_BOUNCE_OUT ); DECLARE_HYPERCALL_BOUNCE(distance,
@@ -328,7 +328,7 @@ int xc_pcitopoinfo(xc_interface *xch, unsigned num_devs, {int ret =0 ;unsigned processed =0 ; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };DECLARE_HYPERCALL_BOUNCE (devs, num_devs *sizeof (*devs),XC_HYPERCALL_BUFFER_BOUNCE_IN ); DECLARE_HYPERCALL_BOUNCE(nodes, num_devs* sizeof(*nodes),
@@ -366,7 +366,7 @@ int xc_sched_id(xc_interface *xch, int *sched_id) {int ret; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; sysctl.cmd = XEN_SYSCTL_sched_id;
@@ -451,7 +451,7 @@ out:int xc_perfc_reset (xc_interface *xch) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; sysctl.cmd = XEN_SYSCTL_perfc_op; sysctl.u.perfc_op.cmd = XEN_SYSCTL_PERFCOP_reset;
@@ -466,7 +466,7 @@ int xc_perfc_query_number(xc_interface *xch, int *nbr_val) {int rc; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; sysctl.cmd = XEN_SYSCTL_perfc_op; sysctl.u.perfc_op.cmd = XEN_SYSCTL_PERFCOP_query;
@@ -487,7 +487,7 @@ int xc_perfc_query(xc_interface *xch,struct xc_hypercall_buffer *desc, struct xc_hypercall_buffer *val) { -DECLARE_SYSCTL ; + struct xen_sysctl sysctl = {0};DECLARE_HYPERCALL_BUFFER_ARGUMENT (desc);DECLARE_HYPERCALL_BUFFER_ARGUMENT (val);
@@ -501,7 +501,7 @@ int xc_perfc_query(xc_interface *xch,int xc_lockprof_reset (xc_interface *xch) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; sysctl.cmd = XEN_SYSCTL_lockprof_op; sysctl.u.lockprof_op.cmd = XEN_SYSCTL_LOCKPROF_reset;
@@ -514,7 +514,7 @@ int xc_lockprof_query_number(xc_interface *xch, uint32_t *n_elems) {int rc; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; sysctl.cmd = XEN_SYSCTL_lockprof_op; sysctl.u.lockprof_op.max_elem =0 ;
@@ -534,7 +534,7 @@ int xc_lockprof_query(xc_interface *xch, struct xc_hypercall_buffer *data) {int rc; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };DECLARE_HYPERCALL_BUFFER_ARGUMENT (data); sysctl.cmd = XEN_SYSCTL_lockprof_op;
@@ -553,7 +553,7 @@ int xc_getcpuinfo(xc_interface *xch, int max_cpus, xc_cpuinfo_t *info, int *nr_cpus) {int rc; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };DECLARE_HYPERCALL_BOUNCE (info, max_cpus*sizeof (*info),XC_HYPERCALL_BUFFER_BOUNCE_OUT );if (xc_hypercall_bounce_pre (xch, info) )
@@ -579,7 +579,7 @@ int xc_livepatch_upload(xc_interface *xch, uint32_t size) {int rc; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };DECLARE_HYPERCALL_BUFFER (char, local);DECLARE_HYPERCALL_BOUNCE (name,0 /* later */ ,XC_HYPERCALL_BUFFER_BOUNCE_IN );struct xen_livepatch_name def_name = { };
@@ -632,7 +632,7 @@ int xc_livepatch_get(xc_interface *xch, struct xen_livepatch_status *status) {int rc; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };DECLARE_HYPERCALL_BOUNCE (name,0 /*adjust later */ ,XC_HYPERCALL_BUFFER_BOUNCE_IN );struct xen_livepatch_name def_name = { };
@@ -689,7 +689,7 @@ int xc_livepatch_list_get_sizes(xc_interface *xch, unsigned int *nr,uint32_t *name_total_size, uint32_t *metadata_total_size) { -DECLARE_SYSCTL ; + struct xen_sysctl sysctl = {0};int rc;if ( !nr || !name_total_size || !metadata_total_size )
@@ -770,7 +770,7 @@ int xc_livepatch_list(xc_interface *xch, const unsigned int max, unsigned int *done, unsigned int *left) { int rc; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };/* The sizes are adjusted later - hence zero. */ DECLARE_HYPERCALL_BOUNCE (info,0 ,XC_HYPERCALL_BUFFER_BOUNCE_OUT );DECLARE_HYPERCALL_BOUNCE (name,0 ,XC_HYPERCALL_BUFFER_BOUNCE_OUT );
@@ -965,7 +965,7 @@ static int _xc_livepatch_action(xc_interface *xch, uint32_t flags) {int rc; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };/* The size is figured out when we strlen(name) */ DECLARE_HYPERCALL_BOUNCE (name,0 ,XC_HYPERCALL_BUFFER_BOUNCE_IN );struct xen_livepatch_name def_name = { };
tools/libs/ctrl/xc_monitor.c +15 -15
@@ -48,7 +48,7 @@ int xc_monitor_get_capabilities(xc_interface *xch, uint32_t domain_id, uint32_t *capabilities) {int rc; -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 };if ( !capabilities ) {
@@ -72,7 +72,7 @@ int xc_monitor_write_ctrlreg(xc_interface *xch, uint32_t domain_id, uint16_t index, bool enable, bool sync, uint64_t bitmask, bool onchangeonly) { -DECLARE_DOMCTL ; + struct xen_domctl domctl = {0}; domctl.cmd = XEN_DOMCTL_monitor_op; domctl.domain = domain_id;
@@ -92,7 +92,7 @@ int xc_monitor_write_ctrlreg(xc_interface *xch, uint32_t domain_id,int xc_monitor_mov_to_msr (xc_interface *xch,uint32_t domain_id,uint32_t msr,bool enable,bool onchangeonly) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_monitor_op; domctl.domain = domain_id;
@@ -108,7 +108,7 @@ int xc_monitor_mov_to_msr(xc_interface *xch, uint32_t domain_id, uint32_t msr,int xc_monitor_software_breakpoint (xc_interface *xch,uint32_t domain_id,bool enable) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_monitor_op; domctl.domain = domain_id;
@@ -122,7 +122,7 @@ int xc_monitor_software_breakpoint(xc_interface *xch, uint32_t domain_id,int xc_monitor_singlestep (xc_interface *xch,uint32_t domain_id,bool enable) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_monitor_op; domctl.domain = domain_id;
@@ -136,7 +136,7 @@ int xc_monitor_singlestep(xc_interface *xch, uint32_t domain_id,int xc_monitor_descriptor_access (xc_interface *xch,uint32_t domain_id,bool enable) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_monitor_op; domctl.domain = domain_id;
@@ -150,7 +150,7 @@ int xc_monitor_descriptor_access(xc_interface *xch, uint32_t domain_id,int xc_monitor_guest_request (xc_interface *xch,uint32_t domain_id,bool enable,bool sync,bool allow_userspace) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_monitor_op; domctl.domain = domain_id;
@@ -166,7 +166,7 @@ int xc_monitor_guest_request(xc_interface *xch, uint32_t domain_id, bool enable,int xc_monitor_inguest_pagefault (xc_interface *xch,uint32_t domain_id,bool disable) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_monitor_op; domctl.domain = domain_id;
@@ -180,7 +180,7 @@ int xc_monitor_inguest_pagefault(xc_interface *xch, uint32_t domain_id,int xc_monitor_emulate_each_rep (xc_interface *xch,uint32_t domain_id,bool enable) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_monitor_op; domctl.domain = domain_id;
@@ -193,7 +193,7 @@ int xc_monitor_emulate_each_rep(xc_interface *xch, uint32_t domain_id,int xc_monitor_debug_exceptions (xc_interface *xch,uint32_t domain_id,bool enable,bool sync) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_monitor_op; domctl.domain = domain_id;
@@ -207,7 +207,7 @@ int xc_monitor_debug_exceptions(xc_interface *xch, uint32_t domain_id,int xc_monitor_cpuid (xc_interface *xch,uint32_t domain_id,bool enable) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_monitor_op; domctl.domain = domain_id;
@@ -221,7 +221,7 @@ int xc_monitor_cpuid(xc_interface *xch, uint32_t domain_id, bool enable)int xc_monitor_privileged_call (xc_interface *xch,uint32_t domain_id,bool enable) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_monitor_op; domctl.domain = domain_id;
@@ -235,7 +235,7 @@ int xc_monitor_privileged_call(xc_interface *xch, uint32_t domain_id,int xc_monitor_emul_unimplemented (xc_interface *xch,uint32_t domain_id,bool enable) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_monitor_op; domctl.domain = domain_id;
@@ -249,7 +249,7 @@ int xc_monitor_emul_unimplemented(xc_interface *xch, uint32_t domain_id,int xc_monitor_vmexit (xc_interface *xch,uint32_t domain_id,bool enable,bool sync) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_monitor_op; domctl.domain = domain_id;
@@ -263,7 +263,7 @@ int xc_monitor_vmexit(xc_interface *xch, uint32_t domain_id, bool enable,int xc_monitor_io (xc_interface *xch,uint32_t domain_id,bool enable) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_monitor_op; domctl.domain = domain_id;
tools/libs/ctrl/xc_pm.c +16 -16
@@ -28,7 +28,7 @@*/ int xc_pm_get_max_px (xc_interface *xch,int cpuid,int *max_px) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };int ret; sysctl.cmd = XEN_SYSCTL_get_pmstat;
@@ -44,7 +44,7 @@ int xc_pm_get_max_px(xc_interface *xch, int cpuid, int *max_px)int xc_pm_get_pxstat (xc_interface *xch,int cpuid,struct xc_px_stat *pxpt) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };/* Sizes unknown until xc_pm_get_max_px */ DECLARE_NAMED_HYPERCALL_BOUNCE (trans, pxpt->trans_pt,0 ,XC_HYPERCALL_BUFFER_BOUNCE_BOTH );DECLARE_NAMED_HYPERCALL_BOUNCE (pt, pxpt->pt,0 ,XC_HYPERCALL_BUFFER_BOUNCE_BOTH );
@@ -99,7 +99,7 @@ int xc_pm_get_pxstat(xc_interface *xch, int cpuid, struct xc_px_stat *pxpt)int xc_pm_reset_pxstat (xc_interface *xch,int cpuid) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; sysctl.cmd = XEN_SYSCTL_get_pmstat; sysctl.u.get_pmstat.type = PMSTAT_reset_pxstat;
@@ -110,7 +110,7 @@ int xc_pm_reset_pxstat(xc_interface *xch, int cpuid)int xc_pm_get_max_cx (xc_interface *xch,int cpuid,int *max_cx) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };int ret =0 ; sysctl.cmd = XEN_SYSCTL_get_pmstat;
@@ -125,7 +125,7 @@ int xc_pm_get_max_cx(xc_interface *xch, int cpuid, int *max_cx)int xc_pm_get_cxstat (xc_interface *xch,int cpuid,struct xc_cx_stat *cxpt) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };DECLARE_NAMED_HYPERCALL_BOUNCE (triggers, cxpt->triggers, cxpt->nr *sizeof (*cxpt->triggers),XC_HYPERCALL_BUFFER_BOUNCE_OUT );
@@ -183,7 +183,7 @@ unlock_0:int xc_pm_reset_cxstat (xc_interface *xch,int cpuid) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; sysctl.cmd = XEN_SYSCTL_get_pmstat; sysctl.u.get_pmstat.type = PMSTAT_reset_cxstat;
@@ -200,7 +200,7 @@ int xc_pm_reset_cxstat(xc_interface *xch, int cpuid)int xc_get_cpufreq_para (xc_interface *xch,int cpuid,struct xc_get_cpufreq_para *user_para) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };int ret =0 ;struct xen_get_cpufreq_para *sys_para = &sysctl.u.pm_op.u.get_para; DECLARE_NAMED_HYPERCALL_BOUNCE(affected_cpus,
@@ -310,7 +310,7 @@ unlock_1:int xc_set_cpufreq_gov (xc_interface *xch,int cpuid,char *govname) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };char *scaling_governor = sysctl.u.pm_op.u.set_gov.scaling_governor;if ( !xch || !govname )
@@ -330,7 +330,7 @@ int xc_set_cpufreq_gov(xc_interface *xch, int cpuid, char *govname)int xc_set_cpufreq_para (xc_interface *xch,int cpuid,int ctrl_type,int ctrl_value) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };if ( !xch ) {
@@ -349,7 +349,7 @@ int xc_set_cpufreq_para(xc_interface *xch, int cpuid,int xc_set_cpufreq_cppc (xc_interface *xch,int cpuid,xc_set_cppc_para_t *set_cppc) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };int ret;if ( !xch )
@@ -372,7 +372,7 @@ int xc_set_cpufreq_cppc(xc_interface *xch, int cpuid,int xc_get_cpufreq_avgfreq (xc_interface *xch,int cpuid,int *avg_freq) {int ret =0 ; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };if ( !xch || !avg_freq ) {
@@ -395,7 +395,7 @@ int xc_get_cpufreq_avgfreq(xc_interface *xch, int cpuid, int *avg_freq)int xc_set_sched_opt_smt (xc_interface *xch,uint32_t value) {int rc; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; sysctl.cmd = XEN_SYSCTL_pm_op; sysctl.u.pm_op.cmd = XEN_SYSCTL_pm_op_set_sched_opt_smt;
@@ -409,7 +409,7 @@ int xc_set_sched_opt_smt(xc_interface *xch, uint32_t value)static int get_max_cstate (xc_interface *xch,uint32_t *value,uint32_t type) {int rc; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };if ( !xch || !value ) {
@@ -438,7 +438,7 @@ int xc_get_cpuidle_max_csubstate(xc_interface *xch, uint32_t *value)static int set_max_cstate (xc_interface *xch,uint32_t value,uint32_t type) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };if ( !xch ) {
@@ -465,7 +465,7 @@ int xc_set_cpuidle_max_csubstate(xc_interface *xch, uint32_t value)int xc_enable_turbo (xc_interface *xch,int cpuid) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };if ( !xch ) {
@@ -480,7 +480,7 @@ int xc_enable_turbo(xc_interface *xch, int cpuid)int xc_disable_turbo (xc_interface *xch,int cpuid) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };if ( !xch ) {
tools/libs/ctrl/xc_private.c +2 -2
@@ -229,7 +229,7 @@ int xc_get_pfn_type_batch(xc_interface *xch, uint32_t dom, unsigned int num, xen_pfn_t *arr) { int rc; -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 };DECLARE_HYPERCALL_BOUNCE (arr,sizeof (*arr) * num,XC_HYPERCALL_BUFFER_BOUNCE_BOTH );if (xc_hypercall_bounce_pre (xch, arr) )return -1 ;
@@ -398,7 +398,7 @@ int xc_maximum_ram_page(xc_interface *xch, unsigned long *max_mfn)long long xc_domain_get_cpu_usage (xc_interface *xch,uint32_t domid,int vcpu) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_getvcpuinfo; domctl.domain = domid;
tools/libs/ctrl/xc_private.h +0 -6
@@ -62,12 +62,6 @@ struct iovec {#include <sys/uio.h> #endif -#define DECLARE_DOMCTL struct xen_domctl domctl -#define DECLARE_SYSCTL struct xen_sysctl sysctl -#define DECLARE_PHYSDEV_OP struct physdev_op physdev_op -#define DECLARE_FLASK_OP struct xen_flask_op op -#define DECLARE_PLATFORM_OP struct xen_platform_op platform_op -#undef PAGE_SHIFT#undef PAGE_SIZE#undef PAGE_MASK
tools/libs/ctrl/xc_psr.c +11 -11
@@ -29,7 +29,7 @@int xc_psr_cmt_attach (xc_interface *xch,uint32_t domid) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_psr_cmt_op; domctl.domain = domid;
@@ -40,7 +40,7 @@ int xc_psr_cmt_attach(xc_interface *xch, uint32_t domid)int xc_psr_cmt_detach (xc_interface *xch,uint32_t domid) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_psr_cmt_op; domctl.domain = domid;
@@ -53,7 +53,7 @@ int xc_psr_cmt_get_domain_rmid(xc_interface *xch, uint32_t domid, uint32_t *rmid) {int rc; -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_psr_cmt_op; domctl.domain = domid;
@@ -71,7 +71,7 @@ int xc_psr_cmt_get_total_rmid(xc_interface *xch, uint32_t *total_rmid) {static int val =0 ;int rc; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };if ( val ) {
@@ -95,7 +95,7 @@ int xc_psr_cmt_get_l3_upscaling_factor(xc_interface *xch, {static int val =0 ;int rc; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };if ( val ) {
@@ -118,7 +118,7 @@ int xc_psr_cmt_get_l3_upscaling_factor(xc_interface *xch,int xc_psr_cmt_get_l3_event_mask (xc_interface *xch,uint32_t *event_mask) {int rc; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; sysctl.cmd = XEN_SYSCTL_psr_cmt_op; sysctl.u.psr_cmt_op.cmd =
@@ -137,7 +137,7 @@ int xc_psr_cmt_get_l3_cache_size(xc_interface *xch, uint32_t cpu, {static int val =0 ;int rc; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };if ( val ) {
@@ -230,7 +230,7 @@ int xc_psr_cmt_enabled(xc_interface *xch) {static int val =-1 ;int rc; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };if ( val >=0 )return val;
@@ -252,7 +252,7 @@ int xc_psr_set_domain_data(xc_interface *xch, uint32_t domid, xc_psr_type type, uint32_t target, uint64_t data) { -DECLARE_DOMCTL ; + struct xen_domctl domctl = {0};uint32_t cmd; switch ( type )
@@ -291,7 +291,7 @@ int xc_psr_get_domain_data(xc_interface *xch, uint32_t domid, uint64_t *data) {int rc; -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 };uint32_t cmd; switch ( type )
@@ -333,7 +333,7 @@ int xc_psr_get_hw_info(xc_interface *xch, uint32_t socket, xc_psr_feat_type type, xc_psr_hw_info *hw_info) { int rc = -1; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };if ( !hw_info ) {
tools/libs/ctrl/xc_resource.c +1 -1
@@ -22,7 +22,7 @@static int xc_resource_op_one (xc_interface *xch,xc_resource_op_t *op) {int rc; -DECLARE_PLATFORM_OP ; +struct xen_platform_op platform_op = {0 };DECLARE_NAMED_HYPERCALL_BOUNCE (entries, op->entries, op->nr_entries *sizeof (*op->entries),XC_HYPERCALL_BUFFER_BOUNCE_BOTH );
tools/libs/ctrl/xc_rt.c +4 -4
@@ -29,7 +29,7 @@ int xc_sched_rtds_domain_set(xc_interface *xch, struct xen_domctl_sched_rtds *sdom) {int rc; -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_scheduler_op; domctl.domain = domid;
@@ -48,7 +48,7 @@ int xc_sched_rtds_domain_get(xc_interface *xch, struct xen_domctl_sched_rtds *sdom) {int rc; -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_scheduler_op; domctl.domain = domid;
@@ -70,7 +70,7 @@ int xc_sched_rtds_vcpu_set(xc_interface *xch, {int rc =0 ;unsigned processed =0 ; -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 };DECLARE_HYPERCALL_BOUNCE (vcpus,sizeof (*vcpus) * num_vcpus,XC_HYPERCALL_BUFFER_BOUNCE_IN );
@@ -104,7 +104,7 @@ int xc_sched_rtds_vcpu_get(xc_interface *xch, {int rc =0 ;unsigned processed =0 ; -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 };DECLARE_HYPERCALL_BOUNCE (vcpus,sizeof (*vcpus) * num_vcpus,XC_HYPERCALL_BUFFER_BOUNCE_BOTH );
tools/libs/ctrl/xc_tbuf.c +6 -6
@@ -27,7 +27,7 @@static int tbuf_enable (xc_interface *xch,int enable) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; sysctl.cmd = XEN_SYSCTL_tbuf_op; sysctl.interface_version =XEN_SYSCTL_INTERFACE_VERSION ;
@@ -41,7 +41,7 @@ static int tbuf_enable(xc_interface *xch, int enable)int xc_tbuf_set_size (xc_interface *xch,unsigned long size) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; sysctl.cmd = XEN_SYSCTL_tbuf_op; sysctl.interface_version =XEN_SYSCTL_INTERFACE_VERSION ;
@@ -55,7 +55,7 @@ int xc_tbuf_get_size(xc_interface *xch, unsigned long *size) {struct t_info *t_info;int rc; -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; sysctl.cmd = XEN_SYSCTL_tbuf_op; sysctl.interface_version =XEN_SYSCTL_INTERFACE_VERSION ;
@@ -82,7 +82,7 @@ int xc_tbuf_get_size(xc_interface *xch, unsigned long *size)int xc_tbuf_enable (xc_interface *xch,unsigned long pages,unsigned long *mfn,unsigned long *size) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };int rc;/*
@@ -116,7 +116,7 @@ int xc_tbuf_disable(xc_interface *xch)int xc_tbuf_set_cpu_mask (xc_interface *xch,xc_cpumap_t mask) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };DECLARE_HYPERCALL_BOUNCE (mask,0 ,XC_HYPERCALL_BUFFER_BOUNCE_IN );int ret =-1 ;int bits, cpusize;
@@ -160,7 +160,7 @@ int xc_tbuf_set_cpu_mask(xc_interface *xch, xc_cpumap_t mask)int xc_tbuf_set_evt_mask (xc_interface *xch,uint32_t mask) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 }; sysctl.cmd = XEN_SYSCTL_tbuf_op; sysctl.interface_version =XEN_SYSCTL_INTERFACE_VERSION ;
tools/libs/ctrl/xc_vm_event.c +2 -2
@@ -25,7 +25,7 @@int xc_vm_event_control (xc_interface *xch,uint32_t domain_id,unsigned int op,unsigned int mode,uint32_t *port) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 };int rc; domctl.cmd = XEN_DOMCTL_vm_event_op;
@@ -158,7 +158,7 @@ void *xc_vm_event_enable(xc_interface *xch, uint32_t domain_id, int param,int xc_vm_event_get_version (xc_interface *xch) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 };int rc; domctl.cmd = XEN_DOMCTL_vm_event_op;
tools/libs/guest/xg_cpuid_x86.c +4 -4
@@ -38,7 +38,7 @@ enum {int xc_get_cpu_levelling_caps (xc_interface *xch,uint32_t *caps) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };int ret; sysctl.cmd = XEN_SYSCTL_get_cpu_levelling_caps;
@@ -53,7 +53,7 @@ int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps)int xc_get_cpu_featureset (xc_interface *xch,uint32_t index,uint32_t *nr_features,uint32_t *featureset) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };DECLARE_HYPERCALL_BOUNCE (featureset, *nr_features *sizeof (*featureset),XC_HYPERCALL_BUFFER_BOUNCE_OUT );
@@ -167,7 +167,7 @@ static int get_domain_cpu_policy(xc_interface *xch, uint32_t domid, uint32_t *nr_leaves, xen_cpuid_leaf_t *leaves, uint32_t *nr_msrs, xen_msr_entry_t *msrs) { -DECLARE_DOMCTL ; + struct xen_domctl domctl = {0};DECLARE_HYPERCALL_BOUNCE (leaves, *nr_leaves *sizeof (*leaves),XC_HYPERCALL_BUFFER_BOUNCE_OUT );
@@ -207,7 +207,7 @@ int xc_set_domain_cpu_policy(xc_interface *xch, uint32_t domid, uint32_t *err_leaf_p, uint32_t *err_subleaf_p, uint32_t *err_msr_p) { -DECLARE_DOMCTL ; + struct xen_domctl domctl = {0};DECLARE_HYPERCALL_BOUNCE (leaves, nr_leaves *sizeof (*leaves),XC_HYPERCALL_BUFFER_BOUNCE_IN );
tools/libs/guest/xg_dom_arm.c +1 -1
@@ -204,7 +204,7 @@ static int set_mode(xc_interface *xch, uint32_t domid, const char *guest_type) { "xen-3.0-aarch64", 64 }, { "xen-3.0-armv7l", 32 }, }; -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 };int i,rc; domctl.domain = domid;
tools/libs/guest/xg_dom_boot.c +1 -1
@@ -39,7 +39,7 @@static int setup_hypercall_page (struct xc_dom_image *dom) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 };xen_pfn_t pfn;int rc;
tools/libs/guest/xg_dom_x86.c +1 -1
@@ -1158,7 +1158,7 @@ static int x86_compat(xc_interface *xch, uint32_t domid, { "xen-3.0-x86_32p", 32 }, { "xen-3.0-x86_64", 64 }, }; -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 };int i,rc;memset (&domctl,0 ,sizeof (domctl));
tools/libs/guest/xg_offline_page.c +3 -3
@@ -51,7 +51,7 @@ static struct domain_info_context *dinfo = &_dinfo;int xc_mark_page_online (xc_interface *xch,unsigned long start,unsigned long end,uint32_t *status) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };DECLARE_HYPERCALL_BOUNCE (status,sizeof (uint32_t )*(end - start +1 ),XC_HYPERCALL_BUFFER_BOUNCE_BOTH );int ret =-1 ;
@@ -81,7 +81,7 @@ int xc_mark_page_online(xc_interface *xch, unsigned long start,int xc_mark_page_offline (xc_interface *xch,unsigned long start,unsigned long end,uint32_t *status) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };DECLARE_HYPERCALL_BOUNCE (status,sizeof (uint32_t )*(end - start +1 ),XC_HYPERCALL_BUFFER_BOUNCE_BOTH );int ret =-1 ;
@@ -111,7 +111,7 @@ int xc_mark_page_offline(xc_interface *xch, unsigned long start,int xc_query_page_offline_status (xc_interface *xch,unsigned long start,unsigned long end,uint32_t *status) { -DECLARE_SYSCTL ; +struct xen_sysctl sysctl = {0 };DECLARE_HYPERCALL_BOUNCE (status,sizeof (uint32_t )*(end - start +1 ),XC_HYPERCALL_BUFFER_BOUNCE_BOTH );int ret =-1 ;
tools/libs/guest/xg_resume.c +3 -3
@@ -93,7 +93,7 @@ static int modify_returncode(xc_interface *xch, uint32_t domid)static int xc_domain_resume_cooperative (xc_interface *xch,uint32_t domid) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 };int rc;/*
@@ -111,7 +111,7 @@ static int xc_domain_resume_cooperative(xc_interface *xch, uint32_t domid)#if defined(__i386__) || defined(__x86_64__)static int xc_domain_resume_hvm (xc_interface *xch,uint32_t domid) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 };/* * The domctl XEN_DOMCTL_resumedomain unpause each vcpu. After
@@ -132,7 +132,7 @@ static int xc_domain_resume_hvm(xc_interface *xch, uint32_t domid)static int xc_domain_resume_any (xc_interface *xch,uint32_t domid) { -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 };xc_domaininfo_t info;int i, rc =-1 ;#if defined(__i386__) || defined(__x86_64__)
tools/libs/guest/xg_sr_restore_x86_pv.c +3 -3
@@ -376,7 +376,7 @@ static int process_vcpu_extended(struct xc_sr_context *ctx,xc_interface *xch = ctx->xch;struct xc_sr_x86_pv_restore_vcpu *vcpu = &ctx->x86.pv.restore.vcpus[vcpuid]; -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 }; domctl.cmd = XEN_DOMCTL_set_ext_vcpucontext; domctl.domain = ctx->domid;
@@ -401,7 +401,7 @@ static int process_vcpu_xsave(struct xc_sr_context *ctx,struct xc_sr_x86_pv_restore_vcpu *vcpu = &ctx->x86.pv.restore.vcpus[vcpuid];int rc; -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 };DECLARE_HYPERCALL_BUFFER (void, buffer); buffer =xc_hypercall_buffer_alloc (xch, buffer, vcpu->xsave.size);
@@ -439,7 +439,7 @@ static int process_vcpu_msrs(struct xc_sr_context *ctx,struct xc_sr_x86_pv_restore_vcpu *vcpu = &ctx->x86.pv.restore.vcpus[vcpuid];int rc; -DECLARE_DOMCTL ; +struct xen_domctl domctl = {0 };DECLARE_HYPERCALL_BUFFER (void, buffer); buffer =xc_hypercall_buffer_alloc (xch, buffer, vcpu->msr.size);
Signature · 1 line
2.34.1
Mon, 6 Nov 2023 08:19:46 +0000 Alejandro Vallejo <[email protected]>:
Quoted 1 line
+ struct
xen_sysctlsysctl = {0};
What is that zero doing here? I think a plain {} will do it as well.
Olaf
Hi,
Quoted 5 lines · Olaf Hering
Mon, 6 Nov 2023 08:19:46 +0000 Alejandro Vallejo <[email protected]>:
Quoted 1 line
+ struct
xen_sysctlsysctl = {0};What is that zero doing here?
Some context:
https://gcc.gnu.org/legacy-ml/gcc/2019-07/msg00066.html
{0} is the standardized form of zero-initialization. I don't mind terribly using either, but {} requires an extra extension.
Quoted 4 lines
I think a plain {} will do it as well.
Olaf
It would, but only on compilers implementing GNU C extensions.
Thanks,
Alejandro
Quoted 4 lines · Olaf Hering
Mon, 6 Nov 2023 08:19:46 +0000 Alejandro Vallejo <[email protected]>:
Quoted 1 line
+ struct
xen_sysctlsysctl = {0};What is that zero doing here? I think a plain {} will do it as well.
Indeed. It needs to be {} and not {0} to compile on some obsolete but still supported versions of GCC.
~Andrew
Quoted 10 lines · Andrew Cooper
Quoted 4 lines · Olaf Hering
Mon, 6 Nov 2023 08:19:46 +0000 Alejandro Vallejo <[email protected]>:
Quoted 1 line
+ struct
xen_sysctlsysctl = {0};What is that zero doing here? I think a plain {} will do it as well.
Indeed. It needs to be {} and not {0} to compile on some obsolete but still supported versions of GCC.
~Andrew
I tried to find out what you're talking about and all I could find was:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36750
I'm guessing we are already inhibiting that warning because grepping for {0} shows a bunch of uses of this pattern both in toolstack and the hypervisor. If this breaks something it's already broken.
Either way, sure. Let me re-generate the diff. I have strong philosophical objections to keeping support for >10yo toolchains in detriment of >20yo standards, but I'll just save the rant for another day.
Cheers,
Alejandro
Quoted 10 lines · Alejandro Vallejo
Quoted 9 lines · Andrew Cooper
Quoted 4 lines · Olaf Hering
Mon, 6 Nov 2023 08:19:46 +0000 Alejandro Vallejo <[email protected]>:
Quoted 1 line
+ struct
xen_sysctlsysctl = {0};What is that zero doing here? I think a plain {} will do it as well.
Indeed. It needs to be {} and not {0} to compile on some obsolete but still supported versions of GCC.
Quoted 8 lines
Quoted 1 line
~Andrew
I tried to find out what you're talking about and all I could find was:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36750
I'm guessing we are already inhibiting that warning because grepping for {0} shows a bunch of uses of this pattern both in toolstack and the hypervisor. If this breaks something it's already broken.
But it depends on the nature of the structure / union whether old gcc would have an issue here. Just seeing the pattern in some places doesn't mean they're also fine to have elsewhere.
Jan