direct-io.hg

changeset 6812:481a4ce27c15

Fix xc_domain_memory_decrease_reservation().

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Sep 14 15:56:06 2005 +0000 (2005-09-14)
parents a8edb2655c5d
children c9c49385c26e 541a3239f352
files tools/libxc/xc_domain.c
line diff
     1.1 --- a/tools/libxc/xc_domain.c	Wed Sep 14 15:47:48 2005 +0000
     1.2 +++ b/tools/libxc/xc_domain.c	Wed Sep 14 15:56:06 2005 +0000
     1.3 @@ -134,7 +134,7 @@ int xc_domain_getinfolist(int xc_handle,
     1.4      int ret = 0;
     1.5      dom0_op_t op;
     1.6  
     1.7 -    if(mlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0)
     1.8 +    if ( mlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0 )
     1.9          return -1;
    1.10      
    1.11      op.cmd = DOM0_GETDOMAININFOLIST;
    1.12 @@ -142,12 +142,12 @@ int xc_domain_getinfolist(int xc_handle,
    1.13      op.u.getdomaininfolist.max_domains  = max_domains;
    1.14      op.u.getdomaininfolist.buffer       = info;
    1.15  
    1.16 -    if(xc_dom0_op(xc_handle, &op) < 0)
    1.17 +    if ( xc_dom0_op(xc_handle, &op) < 0 )
    1.18          ret = -1;
    1.19      else
    1.20          ret = op.u.getdomaininfolist.num_domains;
    1.21      
    1.22 -    if(munlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0)
    1.23 +    if ( munlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0 )
    1.24          ret = -1;
    1.25      
    1.26      return ret;
    1.27 @@ -277,15 +277,18 @@ int xc_domain_memory_increase_reservatio
    1.28      };
    1.29  
    1.30      err = xc_memory_op(xc_handle, XENMEM_increase_reservation, &reservation);
    1.31 -    if (err == nr_extents)
    1.32 +    if ( err == nr_extents )
    1.33          return 0;
    1.34  
    1.35 -    if (err > 0) {
    1.36 -        fprintf(stderr,"Failed alocation for dom %d : %ld pages order %d addr_bits %d\n",
    1.37 -                                 domid, nr_extents, extent_order, address_bits);
    1.38 +    if ( err > 0 )
    1.39 +    {
    1.40 +        fprintf(stderr, "Failed allocation for dom %d: "
    1.41 +                "%ld pages order %d addr_bits %d\n",
    1.42 +                domid, nr_extents, extent_order, address_bits);
    1.43          errno = ENOMEM;
    1.44          err = -1;
    1.45      }
    1.46 +
    1.47      return err;
    1.48  }
    1.49  
    1.50 @@ -304,24 +307,24 @@ int xc_domain_memory_decrease_reservatio
    1.51          .domid        = domid
    1.52      };
    1.53  
    1.54 -    if (extent_start == NULL)
    1.55 +    if ( extent_start == NULL )
    1.56      {
    1.57          fprintf(stderr,"decrease_reservation extent_start is NULL!\n");
    1.58          errno = EINVAL;
    1.59 -        err = -1;
    1.60 -	goto out;
    1.61 +        return -1;
    1.62      }
    1.63  
    1.64 -    err = xc_memory_op(xc_handle, XENMEM_increase_reservation, &reservation);
    1.65 -    if (err == nr_extents)
    1.66 +    err = xc_memory_op(xc_handle, XENMEM_decrease_reservation, &reservation);
    1.67 +    if ( err == nr_extents )
    1.68          return 0;
    1.69  
    1.70 -    if (err > 0) {
    1.71 -        fprintf(stderr,"Failed de-alocation for dom %d : %ld pages order %d\n",
    1.72 -                                 domid, nr_extents, extent_order);
    1.73 +    if ( err > 0 )
    1.74 +    {
    1.75 +        fprintf(stderr,"Failed deallocation for dom %d: %ld pages order %d\n",
    1.76 +                domid, nr_extents, extent_order);
    1.77          errno = EBUSY;
    1.78          err = -1;
    1.79      }
    1.80 -out:
    1.81 +
    1.82      return err;
    1.83  }