On Wed, Apr 11, 2018 at 12:03:40AM -0500, Eric Blake wrote:
Adjust internal functions in preparation for FUA support; although
at this point, the default plugins.c can_fua implementation
correctly reports python as needing emulation, and we can assert
that we aren't seeing a FUA flag.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
plugins/python/python.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/plugins/python/python.c b/plugins/python/python.c
index d75b36a..a50bf85 100644
--- a/plugins/python/python.c
+++ b/plugins/python/python.c
@@ -49,6 +49,7 @@
#include <assert.h>
#include <errno.h>
+#define NBDKIT_API_VERSION 2
#include <nbdkit-plugin.h>
/* XXX Apparently global state is technically wrong in Python 3, see:
@@ -430,12 +431,13 @@ py_get_size (void *handle)
static int
py_pread (void *handle, void *buf,
- uint32_t count, uint64_t offset)
+ uint32_t count, uint64_t offset, uint32_t flags)
{
PyObject *obj = handle;
PyObject *fn;
PyObject *r;
+ assert (!flags);
I'm confused by the assertions here (I understand that these are
relaxed in the next patch, but still present).
Shouldn't this return an error instead of segfaulting the daemon?
Do we assume that the nbdkit python plugin is special because you're
basically always running the version that ships with the daemon?
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages.
http://libguestfs.org