direct-io.hg

changeset 467:a40b7ac800c1

bitkeeper revision 1.239.1.1 (3ec8a54czDaKIhP-DcWe6orB0zUv-Q)

dom0_ops.c:
Correctly handle domain-not-found when executing a dom0 op.
author kaf24@scramble.cl.cam.ac.uk
date Mon May 19 09:35:08 2003 +0000 (2003-05-19)
parents 0086e866c0d6
children 6c2da3d4d892
files xen/common/dom0_ops.c
line diff
     1.1 --- a/xen/common/dom0_ops.c	Fri May 16 14:54:02 2003 +0000
     1.2 +++ b/xen/common/dom0_ops.c	Mon May 19 09:35:08 2003 +0000
     1.3 @@ -79,9 +79,13 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
     1.4      case DOM0_BUILDDOMAIN:
     1.5      {
     1.6          struct task_struct * p = find_domain_by_id(op.u.meminfo.domain);
     1.7 -        if ( (ret = final_setup_guestos(p, &op.u.meminfo)) == 0 )
     1.8 -            ret = p->domain;
     1.9 -        put_task_struct(p);
    1.10 +        ret = -EINVAL;
    1.11 +        if ( p != NULL )
    1.12 +        {
    1.13 +            if ( (ret = final_setup_guestos(p, &op.u.meminfo)) == 0 )
    1.14 +                ret = p->domain;
    1.15 +            put_task_struct(p);
    1.16 +        }
    1.17      }
    1.18      break;
    1.19  
    1.20 @@ -94,14 +98,14 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    1.21              wake_up(p);
    1.22              reschedule(p);
    1.23              ret = p->domain;
    1.24 +            put_task_struct(p);
    1.25          }
    1.26 -        put_task_struct(p);
    1.27      }
    1.28      break;
    1.29  
    1.30      case DOM0_STOPDOMAIN:
    1.31      {
    1.32 -        ret = stop_other_domain (op.u.meminfo.domain);
    1.33 +        ret = stop_other_domain(op.u.meminfo.domain);
    1.34      }
    1.35      break;
    1.36  
    1.37 @@ -153,14 +157,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    1.38      {
    1.39          unsigned int dom = op.u.killdomain.domain;
    1.40          int force = op.u.killdomain.force;
    1.41 -        if ( dom == IDLE_DOMAIN_ID )
    1.42 -        {
    1.43 -            ret = -EPERM;
    1.44 -        }
    1.45 -        else
    1.46 -        {
    1.47 -            ret = kill_other_domain(dom, force);
    1.48 -        }
    1.49 +        ret = (dom == IDLE_DOMAIN_ID) ? -EPERM : kill_other_domain(dom, force);
    1.50      }
    1.51      break;
    1.52  
    1.53 @@ -179,15 +176,10 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    1.54          unsigned long  warp    = op.u.adjustdom.warp;
    1.55          unsigned long  warpl   = op.u.adjustdom.warpl;
    1.56          unsigned long  warpu   = op.u.adjustdom.warpu;
    1.57 -        
    1.58 -        if ( dom == IDLE_DOMAIN_ID )
    1.59 -        {
    1.60 -            ret = -EPERM;
    1.61 -        }
    1.62 -        else
    1.63 -        {
    1.64 +
    1.65 +        ret = -EPERM;
    1.66 +        if ( dom != IDLE_DOMAIN_ID )
    1.67              ret = sched_adjdom(dom, mcu_adv, warp, warpl, warpu);
    1.68 -        }
    1.69      }
    1.70      break;
    1.71