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

[lvm-devel] [PATCH 03/12] Add support for lvm_percent_to_float



Signed-off-by: Tony Asleson <tasleson redhat com>
---
 liblvm.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/liblvm.c b/liblvm.c
index 4c6dcec..a5bd730 100644
--- a/liblvm.c
+++ b/liblvm.c
@@ -192,6 +192,21 @@ liblvm_lvm_list_vg_uuids(lvmobject *self)
 }
 
 static PyObject *
+liblvm_lvm_percent_to_float(lvmobject *self, PyObject *arg)
+{
+    double converted;
+    int percent;
+
+    LVM_VALID(self);
+
+    if (!PyArg_ParseTuple(arg, "i", &percent))
+        return NULL;
+
+    converted = lvm_percent_to_float(percent);
+    return Py_BuildValue("d", converted);
+}
+
+static PyObject *
 liblvm_lvm_vgname_from_pvid(lvmobject *self, PyObject *arg)
 {
     const char *pvid;
@@ -1082,6 +1097,7 @@ static PyMethodDef Liblvm_methods[] = {
     { "scan",                   (PyCFunction)liblvm_lvm_scan, METH_NOARGS },
     { "listVgNames",          (PyCFunction)liblvm_lvm_list_vg_names, METH_NOARGS },
     { "listVgUuids",          (PyCFunction)liblvm_lvm_list_vg_uuids, METH_NOARGS },
+    { "percentToFloat",        (PyCFunction)liblvm_lvm_percent_to_float, METH_VARARGS },
     { "vgNameFromPvid",        (PyCFunction)liblvm_lvm_vgname_from_pvid, METH_VARARGS },
     { "vgNameFromDevice",        (PyCFunction)liblvm_lvm_vgname_from_device, METH_VARARGS },
 
-- 
1.7.11.4


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