search for: boolean_callback

Displaying 15 results from an estimated 15 matches for "boolean_callback".

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
2019 Nov 22
0
[PATCH nbdkit v2 05/10] python: Share common code in boolean callbacks.
...> 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 (); r = PyObject_CallFunctionObjArgs...
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
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.
2019 Nov 21
0
[PATCH nbdkit 6/8] python: Implement cache, can_cache.
...break; + default: abort (); + } + Py_DECREF (fn); + if (check_python_failure ("cache") == -1) + return -1; + Py_DECREF (r); + } + else { + nbdkit_error ("%s not implemented", "cache"); + return -1; + } + + return 0; +} + static int boolean_callback (void *handle, const char *can_fn, const char *plain_fn) { @@ -736,6 +769,12 @@ py_can_trim (void *handle) return boolean_callback (handle, "can_trim", "trim"); } +static int +py_can_cache (void *handle) +{ + return boolean_callback (handle, "can_cache", "...
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.
2020 Mar 19
5
[nbdkit PATCH 0/2] More caching of initial setup
When I added .can_FOO caching in 1.16, I missed the case that the sh plugin itself was calling .can_flush twice in some situations (in order to default .can_fua). Then right after, I regressed it to call .can_zero twice (in order to default .can_fast_zero). I also missed that .thread_model could use better caching, because at the time, I did not add testsuite coverage. Fix that now. Eric Blake
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.
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 22
0
[PATCH nbdkit v2 06/10] python: Implement cache.
...break; + default: abort (); + } + Py_DECREF (fn); + if (check_python_failure ("cache") == -1) + return -1; + Py_DECREF (r); + } + else { + nbdkit_error ("%s not implemented", "cache"); + return -1; + } + + return 0; +} + static int boolean_callback (void *handle, const char *can_fn, const char *plain_fn) { @@ -768,6 +801,7 @@ static struct nbdkit_plugin plugin = { .flush = py_flush, .trim = py_trim, .zero = py_zero, + .cache = py_cache, }; NBDKIT_REGISTER_PLUGIN (plugin) -- 2.2...
2020 Aug 10
0
Re: [PATCH nbdkit] python: Implement can_extents + extents.
...'import nbdkit', so... > +++ b/plugins/python/python.c > @@ -1020,6 +1020,79 @@ py_can_cache (void *handle) > return NBDKIT_CACHE_NONE; > } > > +static int > +py_can_extents (void *handle) > +{ > + ACQUIRE_PYTHON_GIL_FOR_CURRENT_SCOPE; > + return boolean_callback (handle, "can_extents", "extents"); > +} > + > +static int > +py_extents (void *handle, uint32_t count, uint64_t offset, > + uint32_t flags, struct nbdkit_extents *extents) > +{ > + ACQUIRE_PYTHON_GIL_FOR_CURRENT_SCOPE; > + struct handle *h =...
2020 Aug 10
5
[PATCH nbdkit] python: Implement can_extents + extents.
...plugins/python/python.c index 398473f5..585cd9e6 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -1020,6 +1020,79 @@ py_can_cache (void *handle) return NBDKIT_CACHE_NONE; } +static int +py_can_extents (void *handle) +{ + ACQUIRE_PYTHON_GIL_FOR_CURRENT_SCOPE; + return boolean_callback (handle, "can_extents", "extents"); +} + +static int +py_extents (void *handle, uint32_t count, uint64_t offset, + uint32_t flags, struct nbdkit_extents *extents) +{ + ACQUIRE_PYTHON_GIL_FOR_CURRENT_SCOPE; + struct handle *h = handle; + PyObject *fn; + PyObject *r...
2020 Aug 10
0
Re: [PATCH nbdkit] python: Implement can_extents + extents.
...44 > --- a/plugins/python/python.c > +++ b/plugins/python/python.c > @@ -1020,6 +1020,79 @@ py_can_cache (void *handle) > return NBDKIT_CACHE_NONE; > } > > +static int > +py_can_extents (void *handle) > +{ > + ACQUIRE_PYTHON_GIL_FOR_CURRENT_SCOPE; > + return boolean_callback (handle, "can_extents", "extents"); > +} > + > +static int > +py_extents (void *handle, uint32_t count, uint64_t offset, > + uint32_t flags, struct nbdkit_extents *extents) > +{ > + ACQUIRE_PYTHON_GIL_FOR_CURRENT_SCOPE; > + struct handle *h =...
2020 Feb 10
17
Cross-project NBD extension proposal: NBD_INFO_INIT_STATE
I will be following up to this email with four separate threads each addressed to the appropriate single list, with proposed changes to: - the NBD protocol - qemu: both server and client - libnbd: client - nbdkit: server The feature in question adds a new optional NBD_INFO_ packet to the NBD_OPT_GO portion of handshake, adding up to 16 bits of information that the server can advertise to the