[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Added a pages_to_kib function, which converts a page count into a number of



# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID e6d64c356d63a3528fb202bf91bcd38d248b8065
# Parent  28ce48573771c0f7b07a931dcc35011c7c942af7
Added a pages_to_kib function, which converts a page count into a number of
KiB.  This allows us to compute the correct amount to balloon out to support
a migration.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 28ce48573771 -r e6d64c356d63 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Wed Nov 30 19:55:08 2005
+++ b/tools/python/xen/lowlevel/xc/xc.c Thu Dec  1 03:19:40 2005
@@ -576,6 +576,17 @@
 }
 
 
+static PyObject *pyxc_pages_to_kib(XcObject *self, PyObject *args)
+{
+    unsigned long pages;
+
+    if (!PyArg_ParseTuple(args, "l", &pages))
+        return NULL;
+
+    return PyLong_FromUnsignedLong(pages * (XC_PAGE_SIZE / 1024));
+}
+
+
 static unsigned long pages_to_mb(unsigned long pages)
 {
     return (pages * (XC_PAGE_SIZE / 1024) + 1023) / 1024;
@@ -1058,6 +1069,12 @@
       " nr_ports     [int]: Number of IO ports\n"
       " allow_access [int]: Non-zero means enable access; else disable 
access\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
+
+    { "pages_to_kib",
+      (PyCFunction)pyxc_pages_to_kib,
+      METH_VARARGS, "\n"
+      "Returns: [int]: The size in KiB of memory spanning the given number "
+      "of pages.\n" },
 
     { NULL, NULL, 0, NULL }
 };

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.