WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Fix xc_domain_memory_decrease_reservation().

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Fix xc_domain_memory_decrease_reservation().
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 14 Sep 2005 15:56:10 +0000
Delivery-date: Wed, 14 Sep 2005 15:54:38 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 481a4ce27c15f4ece0293d0e015890b4a20cb694
# Parent  a8edb2655c5d220b1bbf2b8d8415aae0ac136da3
Fix xc_domain_memory_decrease_reservation().

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r a8edb2655c5d -r 481a4ce27c15 tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c   Wed Sep 14 15:47:48 2005
+++ b/tools/libxc/xc_domain.c   Wed Sep 14 15:56:06 2005
@@ -134,7 +134,7 @@
     int ret = 0;
     dom0_op_t op;
 
-    if(mlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0)
+    if ( mlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0 )
         return -1;
     
     op.cmd = DOM0_GETDOMAININFOLIST;
@@ -142,12 +142,12 @@
     op.u.getdomaininfolist.max_domains  = max_domains;
     op.u.getdomaininfolist.buffer       = info;
 
-    if(xc_dom0_op(xc_handle, &op) < 0)
+    if ( xc_dom0_op(xc_handle, &op) < 0 )
         ret = -1;
     else
         ret = op.u.getdomaininfolist.num_domains;
     
-    if(munlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0)
+    if ( munlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0 )
         ret = -1;
     
     return ret;
@@ -277,15 +277,18 @@
     };
 
     err = xc_memory_op(xc_handle, XENMEM_increase_reservation, &reservation);
-    if (err == nr_extents)
+    if ( err == nr_extents )
         return 0;
 
-    if (err > 0) {
-        fprintf(stderr,"Failed alocation for dom %d : %ld pages order %d 
addr_bits %d\n",
-                                 domid, nr_extents, extent_order, 
address_bits);
+    if ( err > 0 )
+    {
+        fprintf(stderr, "Failed allocation for dom %d: "
+                "%ld pages order %d addr_bits %d\n",
+                domid, nr_extents, extent_order, address_bits);
         errno = ENOMEM;
         err = -1;
     }
+
     return err;
 }
 
@@ -304,24 +307,24 @@
         .domid        = domid
     };
 
-    if (extent_start == NULL)
+    if ( extent_start == NULL )
     {
         fprintf(stderr,"decrease_reservation extent_start is NULL!\n");
         errno = EINVAL;
-        err = -1;
-       goto out;
-    }
-
-    err = xc_memory_op(xc_handle, XENMEM_increase_reservation, &reservation);
-    if (err == nr_extents)
+        return -1;
+    }
+
+    err = xc_memory_op(xc_handle, XENMEM_decrease_reservation, &reservation);
+    if ( err == nr_extents )
         return 0;
 
-    if (err > 0) {
-        fprintf(stderr,"Failed de-alocation for dom %d : %ld pages order %d\n",
-                                 domid, nr_extents, extent_order);
+    if ( err > 0 )
+    {
+        fprintf(stderr,"Failed deallocation for dom %d: %ld pages order %d\n",
+                domid, nr_extents, extent_order);
         errno = EBUSY;
         err = -1;
     }
-out:
+
     return err;
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Fix xc_domain_memory_decrease_reservation()., Xen patchbot -unstable <=