Re: [libvirt-python][PATCH 1/4] Implement virStreamSendHole/virStreamRecvHole

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

 



On Mon, May 22, 2017 at 12:57:12PM +0200, Michal Privoznik wrote:
The return value for virStreamRecvHole is slightly different to
its C counterpart. In python, either it returns the hole size or
None if C API fails.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
generator.py                  |  2 ++
libvirt-override-virStream.py | 21 +++++++++++++++
libvirt-override.c            | 63 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 86 insertions(+)

diff --git a/libvirt-override.c b/libvirt-override.c
index a762941..b5e11ed 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -9463,6 +9463,65 @@ libvirt_virConnectSecretEventDeregisterAny(PyObject *self ATTRIBUTE_UNUSED,
}
#endif /* LIBVIR_CHECK_VERSION(3, 0, 0)*/

+
+#if LIBVIR_CHECK_VERSION(3, 4, 0)
+static PyObject *
+libvirt_virStreamRecvHole(PyObject *self ATTRIBUTE_UNUSED,
+                          PyObject *args)
+{
+    PyObject *pyobj_stream;
+    virStreamPtr stream;
+    long long length = -1;
+    unsigned int flags;
+    int ret;
+
+    if (!PyArg_ParseTuple(args, (char *) "OI:virStreamRecvHole",
+                          &pyobj_stream, &flags))
+        return NULL;
+
+    stream = PyvirStream_Get(pyobj_stream);
+
+    LIBVIRT_BEGIN_ALLOW_THREADS;
+    ret = virStreamRecvHole(stream, &length, flags);
+    LIBVIRT_END_ALLOW_THREADS;
+
+    DEBUG("StreamRecvHole ret=%d length=%lld\n", ret, length);
+
+    if (ret < 0)
+        return VIR_PY_NONE;
+
+    return libvirt_longlongWrap(length);
+}
+
+
+static PyObject *
+libvirt_virStreamSendHole(PyObject *self ATTRIBUTE_UNUSED,
+                          PyObject *args)
+{
+    PyObject *pyobj_stream;
+    virStreamPtr stream;
+    long long length;
+    unsigned int flags;
+    int ret;
+
+    if (!PyArg_ParseTuple(args, (char *) "OKI:virStreamSendHole",

s/OKI/OLI/, I believe

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux