ia64/xen-unstable

changeset 7237:ba0bbf9d29ff

Ensure that all fields of evtchn_op_t are initialised when
making an event_channel_op hypercall. Stefan Berger gets the
credit for diagnosing nasty domU driver problems that were a
result of garbage fields.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Oct 06 10:42:32 2005 +0100 (2005-10-06)
parents c344d6944d2f
children bd37123974b2
files linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c linux-2.6-xen-sparse/drivers/xen/blkback/interface.c linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/blktap/interface.c linux-2.6-xen-sparse/drivers/xen/netback/interface.c linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c linux-2.6-xen-sparse/include/asm-xen/evtchn.h tools/libxc/xc_evtchn.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c	Wed Oct 05 19:16:29 2005 -0400
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c	Thu Oct 06 10:42:32 2005 +0100
     1.3 @@ -180,14 +180,13 @@ static int find_unbound_irq(void)
     1.4  
     1.5  int bind_virq_to_irq(int virq)
     1.6  {
     1.7 -	evtchn_op_t op;
     1.8 +	evtchn_op_t op = { .cmd = EVTCHNOP_bind_virq };
     1.9  	int evtchn, irq;
    1.10  	int cpu = smp_processor_id();
    1.11  
    1.12  	spin_lock(&irq_mapping_update_lock);
    1.13  
    1.14  	if ((irq = per_cpu(virq_to_irq, cpu)[virq]) == -1) {
    1.15 -		op.cmd              = EVTCHNOP_bind_virq;
    1.16  		op.u.bind_virq.virq = virq;
    1.17  		op.u.bind_virq.vcpu = cpu;
    1.18  		BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
    1.19 @@ -212,7 +211,7 @@ EXPORT_SYMBOL(bind_virq_to_irq);
    1.20  
    1.21  void unbind_virq_from_irq(int virq)
    1.22  {
    1.23 -	evtchn_op_t op;
    1.24 +	evtchn_op_t op = { .cmd = EVTCHNOP_close };
    1.25  	int cpu    = smp_processor_id();
    1.26  	int irq    = per_cpu(virq_to_irq, cpu)[virq];
    1.27  	int evtchn = irq_to_evtchn[irq];
    1.28 @@ -220,7 +219,6 @@ void unbind_virq_from_irq(int virq)
    1.29  	spin_lock(&irq_mapping_update_lock);
    1.30  
    1.31  	if (--irq_bindcount[irq] == 0) {
    1.32 -		op.cmd          = EVTCHNOP_close;
    1.33  		op.u.close.dom  = DOMID_SELF;
    1.34  		op.u.close.port = evtchn;
    1.35  		BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
    1.36 @@ -245,14 +243,13 @@ EXPORT_SYMBOL(unbind_virq_from_irq);
    1.37  
    1.38  int bind_ipi_to_irq(int ipi)
    1.39  {
    1.40 -	evtchn_op_t op;
    1.41 +	evtchn_op_t op = { .cmd = EVTCHNOP_bind_ipi };
    1.42  	int evtchn, irq;
    1.43  	int cpu = smp_processor_id();
    1.44  
    1.45  	spin_lock(&irq_mapping_update_lock);
    1.46  
    1.47  	if ((evtchn = per_cpu(ipi_to_evtchn, cpu)[ipi]) == -1) {
    1.48 -		op.cmd = EVTCHNOP_bind_ipi;
    1.49  		op.u.bind_ipi.vcpu = cpu;
    1.50  		BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
    1.51  		evtchn = op.u.bind_ipi.port;
    1.52 @@ -278,7 +275,7 @@ EXPORT_SYMBOL(bind_ipi_to_irq);
    1.53  
    1.54  void unbind_ipi_from_irq(int ipi)
    1.55  {
    1.56 -	evtchn_op_t op;
    1.57 +	evtchn_op_t op = { .cmd = EVTCHNOP_close };
    1.58  	int cpu    = smp_processor_id();
    1.59  	int evtchn = per_cpu(ipi_to_evtchn, cpu)[ipi];
    1.60  	int irq    = evtchn_to_irq[evtchn];
    1.61 @@ -286,7 +283,6 @@ void unbind_ipi_from_irq(int ipi)
    1.62  	spin_lock(&irq_mapping_update_lock);
    1.63  
    1.64  	if (--irq_bindcount[irq] == 0) {
    1.65 -		op.cmd          = EVTCHNOP_close;
    1.66  		op.u.close.dom  = DOMID_SELF;
    1.67  		op.u.close.port = evtchn;
    1.68  		BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
    1.69 @@ -324,13 +320,12 @@ EXPORT_SYMBOL(bind_evtchn_to_irq);
    1.70  
    1.71  void unbind_evtchn_from_irq(unsigned int irq)
    1.72  {
    1.73 -	evtchn_op_t op;
    1.74 +	evtchn_op_t op = { .cmd = EVTCHNOP_close };
    1.75  	int evtchn = irq_to_evtchn[irq];
    1.76  
    1.77  	spin_lock(&irq_mapping_update_lock);
    1.78  
    1.79  	if ((--irq_bindcount[irq] == 0) && (evtchn != -1)) {
    1.80 -		op.cmd          = EVTCHNOP_close;
    1.81  		op.u.close.dom  = DOMID_SELF;
    1.82  		op.u.close.port = evtchn;
    1.83  		BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
    1.84 @@ -378,7 +373,7 @@ static void do_nothing_function(void *ig
    1.85  /* Rebind an evtchn so that it gets delivered to a specific cpu */
    1.86  static void rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
    1.87  {
    1.88 -	evtchn_op_t op;
    1.89 +	evtchn_op_t op = { .cmd = EVTCHNOP_bind_vcpu };
    1.90  	int evtchn;
    1.91  
    1.92  	spin_lock(&irq_mapping_update_lock);
    1.93 @@ -389,7 +384,6 @@ static void rebind_irq_to_cpu(unsigned i
    1.94  	}
    1.95  
    1.96  	/* Send future instances of this interrupt to other vcpu. */
    1.97 -	op.cmd = EVTCHNOP_bind_vcpu;
    1.98  	op.u.bind_vcpu.port = evtchn;
    1.99  	op.u.bind_vcpu.vcpu = tcpu;
   1.100  
   1.101 @@ -518,10 +512,9 @@ static inline void pirq_query_unmask(int
   1.102  
   1.103  static unsigned int startup_pirq(unsigned int irq)
   1.104  {
   1.105 -	evtchn_op_t op;
   1.106 +	evtchn_op_t op = { .cmd = EVTCHNOP_bind_pirq };
   1.107  	int evtchn;
   1.108  
   1.109 -	op.cmd               = EVTCHNOP_bind_pirq;
   1.110  	op.u.bind_pirq.pirq  = irq;
   1.111  	/* NB. We are happy to share unless we are probing. */
   1.112  	op.u.bind_pirq.flags = probing_irq(irq) ? 0 : BIND_PIRQ__WILL_SHARE;
   1.113 @@ -547,7 +540,7 @@ static unsigned int startup_pirq(unsigne
   1.114  
   1.115  static void shutdown_pirq(unsigned int irq)
   1.116  {
   1.117 -	evtchn_op_t op;
   1.118 +	evtchn_op_t op = { .cmd = EVTCHNOP_close };
   1.119  	int evtchn = irq_to_evtchn[irq];
   1.120  
   1.121  	if (!VALID_EVTCHN(evtchn))
   1.122 @@ -555,7 +548,6 @@ static void shutdown_pirq(unsigned int i
   1.123  
   1.124  	mask_evtchn(evtchn);
   1.125  
   1.126 -	op.cmd          = EVTCHNOP_close;
   1.127  	op.u.close.dom  = DOMID_SELF;
   1.128  	op.u.close.port = evtchn;
   1.129  	BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
   1.130 @@ -666,6 +658,7 @@ void irq_resume(void)
   1.131  			continue;
   1.132  
   1.133  		/* Get a new binding from Xen. */
   1.134 +		memset(&op, 0, sizeof(op));
   1.135  		op.cmd              = EVTCHNOP_bind_virq;
   1.136  		op.u.bind_virq.virq = virq;
   1.137  		op.u.bind_virq.vcpu = 0;
   1.138 @@ -689,6 +682,7 @@ void irq_resume(void)
   1.139  		evtchn_to_irq[evtchn] = -1;
   1.140  
   1.141  		/* Get a new binding from Xen. */
   1.142 +		memset(&op, 0, sizeof(op));
   1.143  		op.cmd = EVTCHNOP_bind_ipi;
   1.144  		op.u.bind_ipi.vcpu = 0;
   1.145  		BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Wed Oct 05 19:16:29 2005 -0400
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Thu Oct 06 10:42:32 2005 +0100
     2.3 @@ -68,8 +68,13 @@ static void unmap_frontend_page(blkif_t 
     2.4  int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn)
     2.5  {
     2.6  	blkif_sring_t *sring;
     2.7 -	evtchn_op_t op = { .cmd = EVTCHNOP_bind_interdomain };
     2.8  	int err;
     2.9 +	evtchn_op_t op = {
    2.10 +		.cmd = EVTCHNOP_bind_interdomain,
    2.11 +		.u.bind_interdomain.dom1 = DOMID_SELF,
    2.12 +		.u.bind_interdomain.dom2 = blkif->domid,
    2.13 +		.u.bind_interdomain.port1 = 0,
    2.14 +		.u.bind_interdomain.port2 = evtchn };
    2.15  
    2.16  	if ( (blkif->blk_ring_area = alloc_vm_area(PAGE_SIZE)) == NULL )
    2.17  		return -ENOMEM;
    2.18 @@ -80,10 +85,6 @@ int blkif_map(blkif_t *blkif, unsigned l
    2.19  		return err;
    2.20  	}
    2.21  
    2.22 -	op.u.bind_interdomain.dom1 = DOMID_SELF;
    2.23 -	op.u.bind_interdomain.dom2 = blkif->domid;
    2.24 -	op.u.bind_interdomain.port1 = 0;
    2.25 -	op.u.bind_interdomain.port2 = evtchn;
    2.26  	err = HYPERVISOR_event_channel_op(&op);
    2.27  	if (err) {
    2.28  		unmap_frontend_page(blkif);
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Wed Oct 05 19:16:29 2005 -0400
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Thu Oct 06 10:42:32 2005 +0100
     3.3 @@ -485,8 +485,11 @@ static void watch_for_status(struct xenb
     3.4  static int setup_blkring(struct xenbus_device *dev, struct blkfront_info *info)
     3.5  {
     3.6  	blkif_sring_t *sring;
     3.7 -	evtchn_op_t op;
     3.8  	int err;
     3.9 +	evtchn_op_t op = {
    3.10 +		.cmd = EVTCHNOP_alloc_unbound,
    3.11 +		.u.alloc_unbound.dom = DOMID_SELF,
    3.12 +		.u.alloc_unbound.remote_dom = info->backend_id };
    3.13  
    3.14  	info->ring_ref = GRANT_INVALID_REF;
    3.15  
    3.16 @@ -508,9 +511,6 @@ static int setup_blkring(struct xenbus_d
    3.17  	}
    3.18  	info->ring_ref = err;
    3.19  
    3.20 -	op.cmd = EVTCHNOP_alloc_unbound;
    3.21 -	op.u.alloc_unbound.dom = DOMID_SELF;
    3.22 -	op.u.alloc_unbound.remote_dom = info->backend_id;
    3.23  	err = HYPERVISOR_event_channel_op(&op);
    3.24  	if (err) {
    3.25  		gnttab_end_foreign_access(info->ring_ref, 0);
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/interface.c	Wed Oct 05 19:16:29 2005 -0400
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/interface.c	Thu Oct 06 10:42:32 2005 +0100
     4.3 @@ -68,8 +68,13 @@ static void unmap_frontend_page(blkif_t 
     4.4  int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn)
     4.5  {
     4.6  	blkif_sring_t *sring;
     4.7 -	evtchn_op_t op = { .cmd = EVTCHNOP_bind_interdomain };
     4.8  	int err;
     4.9 +	evtchn_op_t op = {
    4.10 +		.cmd = EVTCHNOP_bind_interdomain,
    4.11 +		.u.bind_interdomain.dom1 = DOMID_SELF,
    4.12 +		.u.bind_interdomain.dom2 = blkif->domid,
    4.13 +		.u.bind_interdomain.port1 = 0,
    4.14 +		.u.bind_interdomain.port2 = evtchn };
    4.15  
    4.16  	if ((blkif->blk_ring_area = alloc_vm_area(PAGE_SIZE)) == NULL)
    4.17  		return -ENOMEM;
    4.18 @@ -80,10 +85,6 @@ int blkif_map(blkif_t *blkif, unsigned l
    4.19  		return err;
    4.20  	}
    4.21  
    4.22 -	op.u.bind_interdomain.dom1 = DOMID_SELF;
    4.23 -	op.u.bind_interdomain.dom2 = blkif->domid;
    4.24 -	op.u.bind_interdomain.port1 = 0;
    4.25 -	op.u.bind_interdomain.port2 = evtchn;
    4.26  	err = HYPERVISOR_event_channel_op(&op);
    4.27  	if (err) {
    4.28  		unmap_frontend_page(blkif);
     5.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Wed Oct 05 19:16:29 2005 -0400
     5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Thu Oct 06 10:42:32 2005 +0100
     5.3 @@ -177,8 +177,13 @@ static void unmap_frontend_pages(netif_t
     5.4  int netif_map(netif_t *netif, unsigned long tx_ring_ref,
     5.5  	      unsigned long rx_ring_ref, unsigned int evtchn)
     5.6  {
     5.7 -	evtchn_op_t op = { .cmd = EVTCHNOP_bind_interdomain };
     5.8  	int err;
     5.9 +	evtchn_op_t op = {
    5.10 +		.cmd = EVTCHNOP_bind_interdomain,
    5.11 +		.u.bind_interdomain.dom1 = DOMID_SELF,
    5.12 +		.u.bind_interdomain.dom2 = netif->domid,
    5.13 +		.u.bind_interdomain.port1 = 0,
    5.14 +		.u.bind_interdomain.port2 = evtchn };
    5.15  
    5.16  	netif->comms_area = alloc_vm_area(2*PAGE_SIZE);
    5.17  	if (netif->comms_area == NULL)
    5.18 @@ -190,10 +195,6 @@ int netif_map(netif_t *netif, unsigned l
    5.19  		return err;
    5.20  	}
    5.21  
    5.22 -	op.u.bind_interdomain.dom1 = DOMID_SELF;
    5.23 -	op.u.bind_interdomain.dom2 = netif->domid;
    5.24 -	op.u.bind_interdomain.port1 = 0;
    5.25 -	op.u.bind_interdomain.port2 = evtchn;
    5.26  	err = HYPERVISOR_event_channel_op(&op);
    5.27  	if (err) {
    5.28  		unmap_frontend_pages(netif);
     6.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Wed Oct 05 19:16:29 2005 -0400
     6.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Thu Oct 06 10:42:32 2005 +0100
     6.3 @@ -972,8 +972,11 @@ static void watch_for_status(struct xenb
     6.4  
     6.5  static int setup_device(struct xenbus_device *dev, struct netfront_info *info)
     6.6  {
     6.7 -	evtchn_op_t op;
     6.8  	int err;
     6.9 +	evtchn_op_t op = {
    6.10 +		.cmd = EVTCHNOP_alloc_unbound,
    6.11 +		.u.alloc_unbound.dom = DOMID_SELF,
    6.12 +		.u.alloc_unbound.remote_dom = info->backend_id };
    6.13  
    6.14  	info->tx_ring_ref = GRANT_INVALID_REF;
    6.15  	info->rx_ring_ref = GRANT_INVALID_REF;
    6.16 @@ -1010,9 +1013,6 @@ static int setup_device(struct xenbus_de
    6.17  	}
    6.18  	info->rx_ring_ref = err;
    6.19  
    6.20 -	op.cmd = EVTCHNOP_alloc_unbound;
    6.21 -	op.u.alloc_unbound.dom = DOMID_SELF;
    6.22 -	op.u.alloc_unbound.remote_dom = info->backend_id;
    6.23  	err = HYPERVISOR_event_channel_op(&op);
    6.24  	if (err) {
    6.25  		xenbus_dev_error(dev, err, "allocating event channel");
     7.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c	Wed Oct 05 19:16:29 2005 -0400
     7.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c	Thu Oct 06 10:42:32 2005 +0100
     7.3 @@ -117,8 +117,13 @@ unmap_frontend_page(tpmif_t *tpmif)
     7.4  int
     7.5  tpmif_map(tpmif_t *tpmif, unsigned long shared_page, unsigned int evtchn)
     7.6  {
     7.7 -	evtchn_op_t op = {.cmd = EVTCHNOP_bind_interdomain };
     7.8  	int err;
     7.9 +	evtchn_op_t op = {
    7.10 +		.cmd = EVTCHNOP_bind_interdomain,
    7.11 +		.u.bind_interdomain.dom1 = DOMID_SELF,
    7.12 +		.u.bind_interdomain.dom2 = tpmif->domid,
    7.13 +		.u.bind_interdomain.port1 = 0,
    7.14 +		.u.bind_interdomain.port2 = evtchn };
    7.15  
    7.16  	if ((tpmif->tx_area = alloc_vm_area(PAGE_SIZE)) == NULL)
    7.17  		return -ENOMEM;
    7.18 @@ -129,10 +134,6 @@ tpmif_map(tpmif_t *tpmif, unsigned long 
    7.19  		return err;
    7.20  	}
    7.21  
    7.22 -	op.u.bind_interdomain.dom1 = DOMID_SELF;
    7.23 -	op.u.bind_interdomain.dom2 = tpmif->domid;
    7.24 -	op.u.bind_interdomain.port1 = 0;
    7.25 -	op.u.bind_interdomain.port2 = evtchn;
    7.26  	err = HYPERVISOR_event_channel_op(&op);
    7.27  	if (err) {
    7.28  		unmap_frontend_page(tpmif);
     8.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c	Wed Oct 05 19:16:29 2005 -0400
     8.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c	Thu Oct 06 10:42:32 2005 +0100
     8.3 @@ -244,8 +244,11 @@ static int setup_tpmring(struct xenbus_d
     8.4  {
     8.5  	tpmif_tx_interface_t *sring;
     8.6  	struct tpm_private *tp = &my_private;
     8.7 -	evtchn_op_t op;
     8.8  	int err;
     8.9 +	evtchn_op_t op = {
    8.10 +		.cmd = EVTCHNOP_alloc_unbound,
    8.11 +		.u.alloc_unbound.dom = DOMID_SELF,
    8.12 +		.u.alloc_unbound.remote_dom = backend_id } ;
    8.13  
    8.14  	sring = (void *)__get_free_page(GFP_KERNEL);
    8.15  	if (!sring) {
    8.16 @@ -268,9 +271,6 @@ static int setup_tpmring(struct xenbus_d
    8.17  	}
    8.18  	info->ring_ref = err;
    8.19  
    8.20 -	op.cmd = EVTCHNOP_alloc_unbound;
    8.21 -	op.u.alloc_unbound.dom = DOMID_SELF;
    8.22 -	op.u.alloc_unbound.remote_dom = backend_id;
    8.23  	err = HYPERVISOR_event_channel_op(&op);
    8.24  	if (err) {
    8.25  		gnttab_end_foreign_access(info->ring_ref, 0);
     9.1 --- a/linux-2.6-xen-sparse/include/asm-xen/evtchn.h	Wed Oct 05 19:16:29 2005 -0400
     9.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/evtchn.h	Thu Oct 06 10:42:32 2005 +0100
     9.3 @@ -123,9 +123,9 @@ static inline void clear_evtchn(int port
     9.4  
     9.5  static inline void notify_remote_via_evtchn(int port)
     9.6  {
     9.7 -	evtchn_op_t op;
     9.8 -	op.cmd = EVTCHNOP_send;
     9.9 -	op.u.send.local_port = port;
    9.10 +	evtchn_op_t op = {
    9.11 +		.cmd = EVTCHNOP_send,
    9.12 +		.u.send.local_port = port };
    9.13  	(void)HYPERVISOR_event_channel_op(&op);
    9.14  }
    9.15  
    10.1 --- a/tools/libxc/xc_evtchn.c	Wed Oct 05 19:16:29 2005 -0400
    10.2 +++ b/tools/libxc/xc_evtchn.c	Thu Oct 06 10:42:32 2005 +0100
    10.3 @@ -37,13 +37,12 @@ int xc_evtchn_alloc_unbound(int xc_handl
    10.4                              u32 dom,
    10.5                              int *port)
    10.6  {
    10.7 -    evtchn_op_t op;
    10.8      int         rc;
    10.9 -
   10.10 -    op.cmd = EVTCHNOP_alloc_unbound;
   10.11 -    op.u.alloc_unbound.remote_dom = (domid_t)remote_dom;
   10.12 -    op.u.alloc_unbound.dom  = (domid_t)dom;
   10.13 -    op.u.alloc_unbound.port = (port != NULL) ? *port : 0;
   10.14 +    evtchn_op_t op = {
   10.15 +        .cmd = EVTCHNOP_alloc_unbound,
   10.16 +        .u.alloc_unbound.remote_dom = (domid_t)remote_dom,
   10.17 +        .u.alloc_unbound.dom  = (domid_t)dom,
   10.18 +        .u.alloc_unbound.port = (port != NULL) ? *port : 0 };
   10.19  
   10.20      if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 )
   10.21      {
   10.22 @@ -61,15 +60,13 @@ int xc_evtchn_bind_interdomain(int xc_ha
   10.23                                 int *port1,
   10.24                                 int *port2)
   10.25  {
   10.26 -    evtchn_op_t op;
   10.27      int         rc;
   10.28 -
   10.29 -    op.cmd = EVTCHNOP_bind_interdomain;
   10.30 -    op.u.bind_interdomain.dom1  = (domid_t)dom1;
   10.31 -    op.u.bind_interdomain.dom2  = (domid_t)dom2;
   10.32 -    op.u.bind_interdomain.port1 = (port1 != NULL) ? *port1 : 0;
   10.33 -    op.u.bind_interdomain.port2 = (port2 != NULL) ? *port2 : 0;
   10.34 -
   10.35 +    evtchn_op_t op = {
   10.36 +        .cmd = EVTCHNOP_bind_interdomain,
   10.37 +        .u.bind_interdomain.dom1  = (domid_t)dom1,
   10.38 +        .u.bind_interdomain.dom2  = (domid_t)dom2,
   10.39 +        .u.bind_interdomain.port1 = (port1 != NULL) ? *port1 : 0,
   10.40 +        .u.bind_interdomain.port2 = (port2 != NULL) ? *port2 : 0 };
   10.41  
   10.42      if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 )
   10.43      {
   10.44 @@ -87,12 +84,11 @@ int xc_evtchn_bind_virq(int xc_handle,
   10.45                          int virq,
   10.46                          int *port)
   10.47  {
   10.48 -    evtchn_op_t op;
   10.49      int         rc;
   10.50 -
   10.51 -    op.cmd = EVTCHNOP_bind_virq;
   10.52 -    op.u.bind_virq.virq = (u32)virq;
   10.53 -    op.u.bind_virq.vcpu = 0;
   10.54 +    evtchn_op_t op = {
   10.55 +        .cmd = EVTCHNOP_bind_virq,
   10.56 +        .u.bind_virq.virq = (u32)virq,
   10.57 +        .u.bind_virq.vcpu = 0 };
   10.58  
   10.59      if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 )
   10.60      {
   10.61 @@ -108,10 +104,10 @@ int xc_evtchn_close(int xc_handle,
   10.62                      u32 dom,
   10.63                      int port)
   10.64  {
   10.65 -    evtchn_op_t op;
   10.66 -    op.cmd = EVTCHNOP_close;
   10.67 -    op.u.close.dom  = (domid_t)dom;
   10.68 -    op.u.close.port = port;
   10.69 +    evtchn_op_t op = {
   10.70 +        .cmd          = EVTCHNOP_close,
   10.71 +        .u.close.dom  = (domid_t)dom,
   10.72 +        .u.close.port = port };
   10.73      return do_evtchn_op(xc_handle, &op);
   10.74  }
   10.75  
   10.76 @@ -119,9 +115,9 @@ int xc_evtchn_close(int xc_handle,
   10.77  int xc_evtchn_send(int xc_handle,
   10.78                     int local_port)
   10.79  {
   10.80 -    evtchn_op_t op;
   10.81 -    op.cmd = EVTCHNOP_send;
   10.82 -    op.u.send.local_port = local_port;
   10.83 +    evtchn_op_t op = {
   10.84 +        .cmd = EVTCHNOP_send,
   10.85 +        .u.send.local_port = local_port };
   10.86      return do_evtchn_op(xc_handle, &op);
   10.87  }
   10.88  
   10.89 @@ -131,13 +127,12 @@ int xc_evtchn_status(int xc_handle,
   10.90                       int port,
   10.91                       xc_evtchn_status_t *status)
   10.92  {
   10.93 -    evtchn_op_t op;
   10.94      int         rc;
   10.95 +    evtchn_op_t op = {
   10.96 +        .cmd           = EVTCHNOP_status,
   10.97 +        .u.status.dom  = (domid_t)dom,
   10.98 +        .u.status.port = port };
   10.99  
  10.100 -    op.cmd = EVTCHNOP_status;
  10.101 -    op.u.status.dom  = (domid_t)dom;
  10.102 -    op.u.status.port = port;
  10.103 -   
  10.104      if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 )
  10.105          memcpy(status, &op.u.status, sizeof(*status));
  10.106