search for: py_is_rot

Displaying 19 results from an estimated 19 matches for "py_is_rot".

2019 Nov 22
0
[PATCH nbdkit v2 05/10] python: Share common code in boolean callbacks.
...‘pwrite’) callback defined, return 1. (In C + * modules, nbdkit would do this). */ - else if (callback_defined ("pwrite", NULL)) + else if (plain_fn && callback_defined (plain_fn, NULL)) return 1; else return 0; } static int -py_can_flush (void *handle) +py_is_rotational (void *handle) { - PyObject *obj = handle; - PyObject *fn; - PyObject *r; - int ret; - - if (callback_defined ("can_flush", &fn)) { - PyErr_Clear (); - - r = PyObject_CallFunctionObjArgs (fn, obj, NULL); - Py_DECREF (fn); - if (check_python_failure ("can_...
2018 Apr 11
0
[nbdkit PATCH v2 5/5] RFC: python: Track and cache per-connection state in C struct
...PyErr_Clear (); - r = PyObject_CallFunctionObjArgs (fn, obj, NULL); + r = PyObject_CallFunctionObjArgs (fn, h->obj, NULL); Py_DECREF (fn); if (check_python_failure ("can_flush") == -1) return -1; @@ -764,7 +779,7 @@ py_can_flush (void *handle) static int py_is_rotational (void *handle) { - PyObject *obj = handle; + ConnHandle *h = handle; PyObject *fn; PyObject *r; int ret; @@ -772,7 +787,7 @@ py_is_rotational (void *handle) if (callback_defined ("is_rotational", &fn)) { PyErr_Clear (); - r = PyObject_CallFunctionObjArgs...
2019 Nov 22
1
Re: [PATCH nbdkit v2 05/10] python: Share common code in boolean callbacks.
...with can_FOO that return tristate, but for this 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....
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
...bject_CallFunctionObjArgs (fn, obj, NULL); > + r = PyObject_CallFunctionObjArgs (fn, h->obj, NULL); > Py_DECREF (fn); > if (check_python_failure ("can_flush") == -1) > return -1; > @@ -764,7 +779,7 @@ py_can_flush (void *handle) > static int > py_is_rotational (void *handle) > { > - PyObject *obj = handle; > + ConnHandle *h = handle; > PyObject *fn; > PyObject *r; > int ret; > @@ -772,7 +787,7 @@ py_is_rotational (void *handle) > if (callback_defined ("is_rotational", &fn)) { > PyErr_Cle...
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
...py_get_ready, + .list_exports = py_list_exports, + .default_export = py_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...
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.
2018 Apr 11
0
[nbdkit PATCH v2 2/5] python: Expose can_zero callback
...+ return ret; + } + /* No Python can_zero callback, so check for Python zero callback. */ + return callback_defined ("zero", NULL); } #define py_config_help \ @@ -743,6 +751,7 @@ static struct nbdkit_plugin plugin = { .can_flush = py_can_flush, .is_rotational = py_is_rotational, .can_trim = py_can_trim, + .can_zero = py_can_zero, .pread = py_pread, .pwrite = py_pwrite, diff --git a/tests/test.py b/tests/test.py index 518cdd4..852af55 100644 --- a/tests/test.py +++ b/tests/test.py @@ -30,6 +30,10 @@ def can_trim(h)...
2018 Apr 06
0
[nbdkit PATCH 2/2] python: Simplify calling into plugin
...PyTuple_SetItem (args, 0, obj); - r = PyObject_CallObject (fn, args); + r = PyObject_CallFunctionObjArgs (fn, obj, NULL); Py_DECREF (fn); - Py_DECREF (args); if (check_python_failure ("can_flush") == -1) return -1; ret = r == Py_True; @@ -634,19 +577,14 @@ py_is_rotational (void *handle) { PyObject *obj = handle; PyObject *fn; - PyObject *args; PyObject *r; int ret; if (callback_defined ("is_rotational", &fn)) { PyErr_Clear (); - args = PyTuple_New (1); - Py_INCREF (obj); /* decremented by Py_DECREF (args) */ - Py...
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
2018 Apr 11
0
[nbdkit PATCH v2 4/5] python: Expose FUA support
...T_FUA_NONE; + + return fua; +} + #define py_config_help \ "script=<FILENAME> (required) The Python plugin to run.\n" \ "[other arguments may be used by the plugin that you load]" @@ -759,6 +891,7 @@ static struct nbdkit_plugin plugin = { .is_rotational = py_is_rotational, .can_trim = py_can_trim, .can_zero = py_can_zero, + .can_fua = py_can_fua, .pread = py_pread, .pwrite = py_pwrite, diff --git a/plugins/python/example.py b/plugins/python/example.py index 9205f10..ca7c266 100644 --- a/plugins/...
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
2020 Mar 19
2
Re: [nbdkit PATCH 1/2] sh, eval: Cache .can_zero and .can_flush
On 3/18/20 8:21 PM, Eric Blake wrote: > In commit c306fa93ab and neighbors (v1.15.1), a concerted effort went > into caching the results of .can_FOO callbacks, with commit messages > demonstrating that a plugin with a slow callback should not have that > delay magnified multiple times. But nothing was added to the > testsuite at the time, and with the sh and eval plugins, we still
2020 Aug 05
5
[PATCH nbdkit 3/4] python: Allow thread model to be set from Python plugins.
This is working for me now, although possibly only on Python 3.9. Dan suggested PyEval_InitThreads but that was deprecated in Python 3.7. Rich.
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
2019 Nov 25
6
[nbdkit PATCH 0/5] Counterproposal for python v2 interfaces
As mentioned in my reviews, I wonder if we should make our python callbacks look a bit more Pythonic by having kwargs added for each new flag that we want to expose. The idea was first floated here: https://www.redhat.com/archives/libguestfs/2018-April/msg00108.html Note that with my proposal, there is no need for a python script to expose a global API_VERSION variable; new flags are added
2020 Sep 21
18
[nbdkit PATCH v3 00/14] exportname filter
It's been several weeks since I posted v2 (I got distracted by improving libnbd to better test things, which in turn surfaced some major memory leak problems in nbdsh that are now fixed). Many of the patches are minor rebases from v2, with the biggest changes being fallout from: - patch 2: rename nbdkit_add_default_export to nbdkit_use_default_export - overall: this missed 1.22, so update