direct-io.hg

changeset 7411:eea0e77b7683

Allow interdomain channels to bind DOMID_SELF to DOMID_SELF.
Signed-off-by: Steve King <steven.r.king@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Oct 18 11:04:48 2005 +0100 (2005-10-18)
parents 76a413a8eef0
children 7155eafc858a
files xen/common/event_channel.c xen/include/public/event_channel.h
line diff
     1.1 --- a/xen/common/event_channel.c	Tue Oct 18 10:53:30 2005 +0100
     1.2 +++ b/xen/common/event_channel.c	Tue Oct 18 11:04:48 2005 +0100
     1.3 @@ -89,7 +89,8 @@ static long evtchn_alloc_unbound(evtchn_
     1.4      chn = evtchn_from_port(d, port);
     1.5  
     1.6      chn->state = ECS_UNBOUND;
     1.7 -    chn->u.unbound.remote_domid = alloc->remote_dom;
     1.8 +    if ( (chn->u.unbound.remote_domid = alloc->remote_dom) == DOMID_SELF )
     1.9 +        chn->u.unbound.remote_domid = current->domain->domain_id;
    1.10  
    1.11      alloc->port = port;
    1.12  
    1.13 @@ -107,9 +108,13 @@ static long evtchn_bind_interdomain(evtc
    1.14      struct evtchn *lchn, *rchn;
    1.15      struct domain *ld = current->domain, *rd;
    1.16      int            lport, rport = bind->remote_port;
    1.17 +    domid_t        rdom = bind->remote_dom;
    1.18      long           rc = 0;
    1.19  
    1.20 -    if ( (rd = find_domain_by_id(bind->remote_dom)) == NULL )
    1.21 +    if ( rdom == DOMID_SELF )
    1.22 +        rdom = current->domain->domain_id;
    1.23 +
    1.24 +    if ( (rd = find_domain_by_id(rdom)) == NULL )
    1.25          return -ESRCH;
    1.26  
    1.27      /* Avoid deadlock by first acquiring lock of domain with smaller id. */
     2.1 --- a/xen/include/public/event_channel.h	Tue Oct 18 10:53:30 2005 +0100
     2.2 +++ b/xen/include/public/event_channel.h	Tue Oct 18 11:04:48 2005 +0100
     2.3 @@ -15,6 +15,7 @@
     2.4   * is allocated in <dom> and returned as <port>.
     2.5   * NOTES:
     2.6   *  1. If the caller is unprivileged then <dom> must be DOMID_SELF.
     2.7 + *  2. <rdom> may be DOMID_SELF, allowing loopback connections.
     2.8   */
     2.9  #define EVTCHNOP_alloc_unbound    6
    2.10  typedef struct evtchn_alloc_unbound {
    2.11 @@ -30,6 +31,8 @@ typedef struct evtchn_alloc_unbound {
    2.12   * a port that is unbound and marked as accepting bindings from the calling
    2.13   * domain. A fresh port is allocated in the calling domain and returned as
    2.14   * <local_port>.
    2.15 + * NOTES:
    2.16 + *  2. <remote_dom> may be DOMID_SELF, allowing loopback connections.
    2.17   */
    2.18  #define EVTCHNOP_bind_interdomain 0
    2.19  typedef struct evtchn_bind_interdomain {