search for: py_can_writ

Displaying 20 results from an estimated 25 matches for "py_can_writ".

Did you mean: py_can_write
2019 Nov 22
0
[PATCH nbdkit v2 05/10] python: Share common code in boolean callbacks.
...oolean =item C<can_trim> diff --git a/plugins/python/python.c b/plugins/python/python.c index 20e05e0..9445343 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -684,110 +684,56 @@ py_zero (void *handle, uint32_t count, uint64_t offset, uint32_t flags) } static int -py_can_write (void *handle) +boolean_callback (void *handle, const char *can_fn, const char *plain_fn) { PyObject *obj = handle; PyObject *fn; PyObject *r; int ret; - if (callback_defined ("can_write", &fn)) { + if (callback_defined (can_fn, &fn)) { PyErr_Clear ();...
2018 Apr 11
0
[nbdkit PATCH v2 5/5] RFC: python: Track and cache per-connection state in C struct
...ot;OiL", obj, count, offset); + args = Py_BuildValue ("OiL", h->obj, count, offset); if (!args) { check_python_failure ("zero"); Py_DECREF (fn); @@ -718,7 +733,7 @@ py_zero (void *handle, uint32_t count, uint64_t offset, uint32_t flags) static int py_can_write (void *handle) { - PyObject *obj = handle; + ConnHandle *h = handle; PyObject *fn; PyObject *r; int ret; @@ -726,7 +741,7 @@ py_can_write (void *handle) if (callback_defined ("can_write", &fn)) { PyErr_Clear (); - r = PyObject_CallFunctionObjArgs (fn, obj, NUL...
2019 Nov 21
10
[PATCH nbdkit 0/8] Implement nbdkit API v2 for Python plugins.
And fill out most of the missing bits of the API. Rich.
2018 Apr 19
1
Re: [nbdkit PATCH v2 5/5] RFC: python: Track and cache per-connection state in C struct
...> + args = Py_BuildValue ("OiL", h->obj, count, offset); > if (!args) { > check_python_failure ("zero"); > Py_DECREF (fn); > @@ -718,7 +733,7 @@ py_zero (void *handle, uint32_t count, uint64_t offset, uint32_t flags) > static int > py_can_write (void *handle) > { > - PyObject *obj = handle; > + ConnHandle *h = handle; > PyObject *fn; > PyObject *r; > int ret; > @@ -726,7 +741,7 @@ py_can_write (void *handle) > if (callback_defined ("can_write", &fn)) { > PyErr_Clear (); > &...
2018 Apr 11
10
[nbdkit PATCH v2 0/5] FUA support in Python scripts
First out of our four language bindings to add FUA support (for reference, I added 'zero' support for python, perl, and ruby back in 1.1.13, then Rich had to add it for ocaml in 1.1.20). I tested this heavily under python 2, but for now only compile tested under python 3; I plan to do further testing there and make any tweaks if necessary. I wrote patch 5 early on, but then realized I
2020 Sep 01
0
[nbdkit PATCH 1/2] python: Implement .list_exports and friends
...default_export, - .open = py_open, - .close = py_close, + .open = py_open, + .close = py_close, - .get_size = py_get_size, - .is_rotational = py_is_rotational, - .can_multi_conn = py_can_multi_conn, - .can_write = py_can_write, - .can_flush = py_can_flush, - .can_trim = py_can_trim, - .can_zero = py_can_zero, - .can_fast_zero = py_can_fast_zero, - .can_fua = py_can_fua, - .can_cache = py_can_cache, - .can_extents = py_can_extents, + .export_description = py_e...
2019 Nov 21
0
[PATCH nbdkit 6/8] python: Implement cache, can_cache.
...quot;, "cache"); +} + #define py_config_help \ "script=<FILENAME> (required) The Python plugin to run.\n" \ "[other arguments may be used by the plugin that you load]" @@ -762,12 +801,14 @@ static struct nbdkit_plugin plugin = { .can_write = py_can_write, .can_flush = py_can_flush, .can_trim = py_can_trim, + .can_cache = py_can_cache, .pread = py_pread, .pwrite = py_pwrite, .flush = py_flush, .trim = py_trim, .zero = py_zero, + .cache...
2018 Apr 11
0
[nbdkit PATCH v2 2/5] python: Expose can_zero callback
...lean +=item C<can_zero> + +(Optional) + + def can_zero(h): + # return a boolean + =item C<pread> (Required) diff --git a/plugins/python/python.c b/plugins/python/python.c index 07559a5..d75b36a 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -629,13 +629,8 @@ py_can_write (void *handle) Py_DECREF (r); return ret; } - /* No Python can_write callback, but there's a Python pwrite callback - * defined, so return 1. (In C modules, nbdkit would do this). - */ - else if (callback_defined ("pwrite", NULL)) - return 1; - else - retur...
2019 Nov 22
1
Re: [PATCH nbdkit v2 05/10] python: Share common code in boolean callbacks.
...patch you really did simplify true bool/error return functions). > @@ -812,9 +758,9 @@ static struct nbdkit_plugin plugin = { > .close = py_close, > > .get_size = py_get_size, > + .is_rotational = py_is_rotational, > .can_write = py_can_write, > .can_flush = py_can_flush, > - .is_rotational = py_is_rotational, > .can_trim = py_can_trim, > > .pread = py_pread, > -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.or...
2019 Nov 22
18
[PATCH nbdkit v2 00/10] Implement nbdkit API v2 for Python plugins.
v1: https://www.redhat.com/archives/libguestfs/2019-November/msg00153.html v2: - Fix implementation of can_cache. - Add implementation of can_fua. - Add a very thorough test suite which tests every command + flag combination.
2017 Jan 26
0
[nbdkit PATCH v2 6/6] python: Support zero callback
..._DECREF (r); + PyErr_Clear (); + return -1; + } + if (check_python_failure ("zero") == -1) + return -1; + Py_DECREF (r); + return 0; + } + + nbdkit_debug ("zero missing, falling back to pwrite"); + errno = EOPNOTSUPP; + return -1; +} + +static int py_can_write (void *handle) { PyObject *obj = handle; @@ -597,6 +642,7 @@ static struct nbdkit_plugin plugin = { .pwrite = py_pwrite, .flush = py_flush, .trim = py_trim, + .zero = py_zero, }; NBDKIT_REGISTER_PLUGIN(plugin) -- 2.9.3
2017 Jan 27
0
[nbdkit PATCH v3 4/4] python: Support zero callback
...; + PyErr_Clear (); + return -1; + } + if (check_python_failure ("zero") == -1) + return -1; + Py_DECREF (r); + return 0; + } + + nbdkit_debug ("zero missing, falling back to pwrite"); + nbdkit_set_error (EOPNOTSUPP); + return -1; +} + +static int py_can_write (void *handle) { PyObject *obj = handle; @@ -607,6 +652,7 @@ static struct nbdkit_plugin plugin = { .pwrite = py_pwrite, .flush = py_flush, .trim = py_trim, + .zero = py_zero, .errno_is_reliable = py_errno_is_reliable, }; -- 2.9....
2019 Nov 22
1
Re: [PATCH nbdkit v2 03/10] python: Implement nbdkit API version 2.
On 11/22/19 3:14 PM, Richard W.M. Jones wrote: >>> @@ -54,20 +61,20 @@ def get_size(h): >>> return len(disk) >>> -def pread(h, count, offset): >>> +def pread(h, count, offset, flags): >>> global disk >>> return disk[offset:offset+count] >> >> Do we really want to be passing 'flags' as an integer that the
2018 Apr 06
0
[nbdkit PATCH 2/2] python: Simplify calling into plugin
...ongLong (offset)); - r = PyObject_CallObject (fn, args); + r = PyObject_CallFunction (fn, "OiL", obj, count, offset, NULL); Py_DECREF (fn); - Py_DECREF (args); if (check_python_failure ("trim") == -1) return -1; Py_DECREF (r); @@ -568,19 +521,14 @@ py_can_write (void *handle) { PyObject *obj = handle; PyObject *fn; - PyObject *args; PyObject *r; int ret; if (callback_defined ("can_write", &fn)) { PyErr_Clear (); - args = PyTuple_New (1); - Py_INCREF (obj); /* decremented by Py_DECREF (args) */ - PyTuple_SetI...
2020 Sep 01
4
[nbdkit PATCH 0/2] More language bindings for .list_exports
This picks up python and ocaml. Some of our languages are lacking a number of bindings (for example, lua and perl lack .extents, so I didn't have anything to copy from), and I felt less comfortable with golang and rust. But for python and ocaml, I was able to test a working implementation. Eric Blake (2): python: Implement .list_exports and friends ocaml: Implement .list_exports and
2019 Nov 25
7
[PATCH nbdkit v2 0/7] Implement nbdkit API v2 for Python plugins.
v3 was here: https://www.redhat.com/archives/libguestfs/2019-November/msg00209.html In v4: - Rebase on top of current master. Includes various fixes and updates required because of Nir's patches that went into master. - Fix api_version() -> API_VERSION in patch 2 noted previously on the mailing list. Rich.
2019 Nov 23
8
[PATCH nbdkit v3 0/7] Implement nbdkit API v2 for Python plugins.
v2 was here: https://www.redhat.com/archives/libguestfs/2019-November/msg00163.html I pushed patch 1 (with spelling fix), patch 4 and patch 5 since those were previously ACKed on the list. Differences in v3: - Add error checking to PyModule_AddIntConstant. - Use API_VERSION constant instead of function. - Add max API version supported to --dump-plugin output. - Print API_VERSION selected by
2018 Apr 06
6
[nbdkit PATCH 0/2] Python cleanups
I noticed these while working on adding fua support into python, these are independent enough to push now (and I'll have to rebase my 'optional may_trim' patch on top of this). Eric Blake (2): python: Use Py_XDEFREF() python: Simplify calling into plugin plugins/python/python.c | 106 ++++++++---------------------------------------- 1 file changed, 18 insertions(+), 88
2017 Jan 26
10
[nbdkit PATCH v2 0/6] bind .zero to Python
Fix some things I noticed while reviewing v1, and follow Rich's idea to add a new nbdkit_set_error() utility function with a binding for Python users to request a particular error (rather than being forced to live with whatever stale value is in errno after all the intermediate binding glue code). I could not easily find out how to register a C function callable from perl bindings, and have
2017 Jan 24
4
[nbdkit PATCH 0/2] bind .zero to more languages
Begin the language binding followups to my new .zero callback, since Rich was indeed correct that we want them. I'm more familiar with python and perl (at least to the point that I was able to modify the appropriate example files and prove to myself that the bindings worked), so I've started with those. I'm less familiar with ruby and ocaml, so I've left those for tomorrow (it