search for: aio_pread_structured_callback

Displaying 20 results from an estimated 23 matches for "aio_pread_structured_callback".

2019 Aug 13
0
[PATCH libnbd 6/6] lib: Make all completion callbacks into OClosures.
...hat it is now permitted to pass NULL, NULL for the completion callback. For the Python and OCaml APIs the parameter changes to be an optional parameter. --- generator/generator | 36 +++++++++---------- ocaml/examples/asynch_copy.ml | 5 +-- .../test_505_aio_pread_structured_callback.ml | 12 ++++--- ocaml/tests/test_590_aio_copy.ml | 5 +-- 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/generator/generator b/generator/generator index 3add9a4..7f20950 100755 --- a/generator/generator +++ b/generator/generator @@ -1836,9 +1836,8 @@ C<nbd_pread&...
2019 Aug 13
0
[PATCH libnbd v2 2/3] lib: Make all completion callbacks into OClosures.
...hat it is now permitted to pass NULL, NULL for the completion callback. For the Python and OCaml APIs the parameter changes to be an optional parameter. --- generator/generator | 36 +++++++++---------- ocaml/examples/asynch_copy.ml | 5 +-- .../test_505_aio_pread_structured_callback.ml | 12 ++++--- ocaml/tests/test_590_aio_copy.ml | 5 +-- 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/generator/generator b/generator/generator index 8f15786..6ccfc5f 100755 --- a/generator/generator +++ b/generator/generator @@ -1836,9 +1836,8 @@ C<nbd_pread&...
2019 Aug 13
7
[PATCH libnbd v2 0/3] Implement OClosures.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-August/msg00168.html I pushed uncontroversial patches 1-4 v2: - The implementation of OClosure (new patch 1) in Python is fixed. - Patch 2 (old patch 5) is unchanged. - I added a new API for removing debug callbacks. I think this approach has some advantages over using OClosure. - I didn't yet do any work on changing the
2019 Aug 10
0
[PATCH libnbd 1/5] python: Change aio_buffer into nbd.Buffer class.
...py index 9246616..e552db8 100644 --- a/python/t/505-aio-pread-callback.py +++ b/python/t/505-aio-pread-callback.py @@ -43,21 +43,21 @@ def callback (user_data, err): assert user_data == 42 # First try: succeed in both callbacks -buf = nbd.aio_buffer (512) +buf = nbd.Buffer (512) cookie = h.aio_pread_structured_callback (buf, 0, lambda *args: chunk (42, *args), lambda *args: callback (42, *args)) while not (h.aio_command_completed (cookie)): h.poll (-1) -buf = nbd.aio_buffer_to_bytearray (buf) +buf = buf.to_bytearray ()...
2019 Aug 10
7
[PATCH libnbd 0/5] WIP: python: Add test for doing asynch copy.
This doesn't yet work. However it does make me more convinced than ever that we really need to sort out persistent buffer lifetimes in the library (similar to what we did for closures). Rich.
2019 Aug 13
0
[PATCH libnbd] api: Rename nbd_aio_*_callback to nbd_aio_*.
...ctured-reads.c | 6 +- examples/threaded-reads-and-writes.c | 4 +- generator/generator | 184 ++++-------------- lib/rw.c | 139 ++++--------- ocaml/examples/asynch_copy.ml | 4 +- .../test_505_aio_pread_structured_callback.ml | 8 +- ocaml/tests/test_590_aio_copy.ml | 4 +- python/t/505-aio-pread-callback.py | 24 +-- python/t/510-aio-pwrite.py | 2 +- tests/aio-parallel-load.c | 4 +- tests/aio-parallel.c | 4 +- tests...
2019 Aug 13
12
[PATCH 0/6] Implement OClosure.
Patches 1-4 are basically uncontroversial, straightforward refactoring and IMHO we should just push them. Possibly 1-3 should be squashed together, but I posted them separately so they are easier to review. Patches 5 and 6 together implement OClosure. Patch 5 adds the feature and is simple to understand. Patch 6 changes the Closure completion callbacks into OClosure, but because it doesn't
2019 Aug 13
2
[PATCH libnbd] api: Rename nbd_aio_*_callback to nbd_aio_*.
This applies on top of the OClosure v2 series posted a few minutes ago. Rich.
2019 Jul 17
0
Re: [PATCH libnbd v2] examples: Include an example of integrating with the glib main loop.
...tracks the Python Callable associated with any Closure, and currently don't free that C struct until nbd_close. Basically, we have: nbd_internal_py_aio_pread_structured data = malloc() nbd_aio_pread_structured(, chunk_wrapper, data) nbd_add_close_callback(data_free, data) nbd_internal_py_aio_pread_structured_callback data = malloc() nbd_aio_pread_structured_callback(, chunk_wrapper, callback_wrapper, data) nbd_add_close_callback(data_free, data) where there is no convenient way for the generator to insert cleanup for the data malloc'd in aio_pread_structured (for aio_pread_structured_callback, it cou...
2019 Jul 17
2
Re: [PATCH libnbd v2] examples: Include an example of integrating with the glib main loop.
On 7/17/19 8:00 AM, Richard W.M. Jones wrote: > --- > .gitignore | 1 + > README | 2 + > configure.ac | 9 + > examples/Makefile.am | 22 ++ > examples/glib-main-loop.c | 511 ++++++++++++++++++++++++++++++++++++++ > 5 files changed, 545 insertions(+) Looks good. > > + revents = g_source_query_unix_fd
2019 Jul 16
1
Re: [PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
...2 > + assert user_data == 42 > assert buf2 == expected > assert offset == 0 > assert s == nbd.READ_DATA > > -buf = h.pread_structured (512, 0, 42, f) > +buf = h.pread_structured (512, 0, lambda *args: f (42, *args)) Nice. We still need to add coverage of h.aio_pread_structured_callback, to prove that this actually did what we wanted when two callbacks are present (the test will fail without this patch). -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
2019 Aug 13
0
[PATCH libnbd 1/6] generator: Share single list of all Closures.
...CBMutable (Int "error")] } ]; + Closure chunk_closure ]; optargs = [ OFlags ("flags", cmd_flags) ]; ret = RInt64; permitted_states = [ Connected ]; @@ -1862,13 +1873,8 @@ documented in C<nbd_pread_structured>."; "aio_pread_structured_callback", { default_call with args = [ BytesPersistOut ("buf", "count"); UInt64 "offset"; - Closure { cbname="chunk"; - cbargs=[CBBytesIn ("subbuf", "count"); - CBUInt6...
2019 Jul 16
2
[PATCH libnbd] generator: Define new Closure type
** INCOMPLETE ** This is the generator change as discussed on the list already. The Python and OCaml bindings are not yet done. It passes all [C only] tests and valgrind. Note that nbd_add_close_callback is inconsistent with other closure types because it passes the user_data parameter after the function. (This is not caused by the current patch, it was already inconsistent). We decided that
2019 Jul 16
2
[PATCH libnbd v2] generator: Define new Closure type
As before, but this one has working Python bindings. OCaml still TBD. Rich.
2019 Jul 16
0
[libnbd PATCH 2/2] RFC: generator: Handle shared callbacks in Python
...39; is the best approach or most idiomatic OCaml - but hey, it taught me a lot about OCaml. Writing a 'string * callback list' proved to be a rather interesting exercise] Our C code has a couple of functions that want to take multiple callback functions that share a single opaque data (nbd_aio_pread_structured_callback; nbd_aio_block_status_callback). However, the mapping of this construct to Python passed only the opaque handle of the first function to the second callback wrapper, which means we would invoke the wrong Python Callable; better is tracking a single malloc()d structure containing the Python opaque o...
2019 Jul 24
0
[PATCH libnbd 2/3] lib: Implement closure lifetimes.
...Int "status"; + Mutable (Int "error");]}; Flags "flags" ]; ret = RInt64; permitted_states = [ Connected ]; @@ -1777,16 +1769,14 @@ documented in C<nbd_pread_structured>."; "aio_pread_structured_callback", { default_call with args = [ BytesPersistOut ("buf", "count"); UInt64 "offset"; - Closure (true, - { cbname="chunk"; - cbargs=[BytesIn ("subbuf", "count"); -...
2019 Jul 16
3
[RFC libnbd PATCH 0/2] Start fixing python nbd.pread_structured_callback
Posting now that I got something to compile (at the expense of breaking OCaml bindings), but I'm open to ideas on how to improve it. Eric Blake (2): generator: Tweak print_c_arg_list to take alternate first arg RFC: generator: Handle shared callbacks in Python generator/generator | 556 ++++++++++++++++++++++---------------------- 1 file changed, 280 insertions(+), 276 deletions(-) --
2019 Jul 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...Int "status"; + Mutable (Int "error");]}; Flags "flags" ]; ret = RInt64; permitted_states = [ Connected ]; @@ -1777,16 +1769,14 @@ documented in C<nbd_pread_structured>."; "aio_pread_structured_callback", { default_call with args = [ BytesPersistOut ("buf", "count"); UInt64 "offset"; - Closure (true, - { cbname="chunk"; - cbargs=[BytesIn ("subbuf", "count"); -...
2019 Jul 25
0
[PATCH libnbd v3 1/2] lib: Implement closure lifetimes.
...Mutable (Int "error");]} ); + Mutable (Int "error");]}; Flags "flags" ]; ret = RInt64; permitted_states = [ Connected ]; @@ -1766,16 +1758,14 @@ documented in C<nbd_pread_structured>."; "aio_pread_structured_callback", { default_call with args = [ BytesPersistOut ("buf", "count"); UInt64 "offset"; - Closure (true, - { cbname="chunk"; + Closure { cbname="chunk"; cbargs=[BytesIn (...
2019 Jul 16
0
[PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
...Int "status"; + Mutable (Int "error");]} ]); Flags "flags" ]; ret = RInt64; permitted_states = [ Connected ]; @@ -1769,14 +1776,15 @@ documented in C<nbd_pread_structured>."; "aio_pread_structured_callback", { default_call with args = [ BytesPersistOut ("buf", "count"); UInt64 "offset"; - Opaque "data"; - CallbackPersist ("chunk", [ Opaque "data"; - BytesIn (&quot...