direct-io.hg

changeset 2283:0871ff6c8784

bitkeeper revision 1.1159.1.81 (41238d2cHqbklCcCkVBI3g3Q45Y0dg)

Fix dom_mem_op properly. :-)
author kaf24@scramble.cl.cam.ac.uk
date Wed Aug 18 17:09:00 2004 +0000 (2004-08-18)
parents 238feb30380b
children b7320c51e09a
files xen/common/dom_mem_ops.c
line diff
     1.1 --- a/xen/common/dom_mem_ops.c	Wed Aug 18 17:05:17 2004 +0000
     1.2 +++ b/xen/common/dom_mem_ops.c	Wed Aug 18 17:09:00 2004 +0000
     1.3 @@ -98,8 +98,11 @@ long do_dom_mem_op(unsigned int   op,
     1.4      struct domain *d;
     1.5      long           rc;
     1.6  
     1.7 -    d = ( (domid == DOMID_SELF) || (!IS_PRIV(current)) ) ? current : find_domain_by_id(domid);
     1.8 -    if ( d == NULL )
     1.9 +    if ( likely(domid == DOMID_SELF) )
    1.10 +        d = current;
    1.11 +    else if ( unlikely(!IS_PRIV(current)) )
    1.12 +        return -EPERM;
    1.13 +    else if ( unlikely((d = find_domain_by_id(domid)) == NULL) )
    1.14  	return -ESRCH;
    1.15  
    1.16      switch ( op )
    1.17 @@ -115,7 +118,7 @@ long do_dom_mem_op(unsigned int   op,
    1.18          break;
    1.19      }
    1.20  
    1.21 -    if ( domid != DOMID_SELF )
    1.22 +    if ( unlikely(domid != DOMID_SELF) )
    1.23  	put_domain(d);
    1.24  
    1.25      return rc;