search for: py_open

Displaying 12 results from an estimated 12 matches for "py_open".

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
2018 Apr 06
0
[nbdkit PATCH 2/2] python: Simplify calling into plugin
...BuildValue() format string, instead of creating one-shot arguments ourselves. In fact, for our py_config(), this makes it easier to not worry about python 2 String vs. python 3 Unicode. Similarly, PyObject_CallFunctionObjArgs is nicer when we already have PyObjects for all parameters (including in py_open(), where we can't use a Py_BuildValue() string for converting a C int into Py_True or Py_False, but can easily avoid the tuple wrapper). py_zero() is not converted, as it will be changed differently to make 'may_trim' an optional callback parameter. Signed-off-by: Eric Blake <eblak...
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 Sep 01
0
[nbdkit PATCH 1/2] python: Implement .list_exports and friends
...lp = py_config_help, - .thread_model = py_thread_model, - .get_ready = py_get_ready, + .thread_model = py_thread_model, + .get_ready = 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_flu...
2018 Apr 11
0
[nbdkit PATCH v2 5/5] RFC: python: Track and cache per-connection state in C struct
...gins/python/python.c index ad79c80..757a0e9 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -389,51 +389,66 @@ py_config_complete (void) return 0; } +/* All per-connection state */ +typedef struct ConnHandle { + PyObject *obj; + int fua; +} ConnHandle; + static void * py_open (int readonly) { PyObject *fn; - PyObject *handle; + ConnHandle *h = malloc (sizeof *h); + if (!h) { + nbdkit_error ("%s: %m", script); + return NULL; + } if (!callback_defined ("open", &fn)) { nbdkit_error ("%s: missing callback: %s", script...
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 19
1
Re: [nbdkit PATCH v2 5/5] RFC: python: Track and cache per-connection state in C struct
...python/python.c > +++ b/plugins/python/python.c > @@ -389,51 +389,66 @@ py_config_complete (void) > return 0; > } > > +/* All per-connection state */ > +typedef struct ConnHandle { > + PyObject *obj; > + int fua; > +} ConnHandle; > + > static void * > py_open (int readonly) > { > PyObject *fn; > - PyObject *handle; > + ConnHandle *h = malloc (sizeof *h); > > + if (!h) { > + nbdkit_error ("%s: %m", script); > + return NULL; > + } > if (!callback_defined ("open", &fn)) { > nbd...
2020 Feb 25
6
[PATCH nbdkit 0/5] server: Add .get_ready callback.
I like this change. I think we were overloading the config_complete method before to do two different things (complete configuration; do any allocation/housekeeping necessary before we can start serving). The only questions in my mind are whether we want this before 1.18, and whether the name ("get_ready") is a good one. Rich.
2020 Aug 05
5
[PATCH NOT WORKING nbdkit 0/3] python: Allow thread model to be set from Python plugins.
Patch 2 certainly allows you to set the thread model. However patch 3 shows that if you set it to nbdkit.THREAD_MODEL_PARALLEL it will crash. If you look closely at the stack trace (attached below) you can see that ignoring threads which are in parts of nbdkit unrelated to Python: Thread 4: In pread, waiting in time.sleep(). This thread has released the GIL. Thread 2: Started to
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 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
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