search for: callbackpersist

Displaying 20 results from an estimated 29 matches for "callbackpersist".

2019 Jul 16
0
[libnbd PATCH 2/2] RFC: generator: Handle shared callbacks in Python
...o 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 object, and ALL of the Python Callables that reuse that same opaque object. We could either add lots of static checking that a Callback/CallbackPersist cannot appear in the argument list until after an earlier Opaque, and that the argument name for top-level Opaque also appears as the first argument for the callback function. Or, we could bundle the construct through a better constructor that tracks that an opaque argument and one or more callback...
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 Jun 29
0
[libnbd PATCH 3/6] generator: Allow Int64 in callbacks
...\");\n" n; pr " if (!py_%s_modname) { PyErr_PrintEx (0); return -1; }\n" n; @@ -3525,7 +3526,7 @@ let print_python_binding name { args; ret } = | ArrayAndLen _ | Bool _ | BytesOut _ | BytesPersistIn _ | BytesPersistOut _ | Callback _ | CallbackPersist _ - | Flags _ | Int64 _ | Mutable _ + | Flags _ | Mutable _ | Path _ | SockAddrAndLen _ | StringList _ | UInt _ | UInt32 _ -> assert false ) args; @@ -3537,6 +3538,7 @@ let print_python_binding name { args; ret } = | ArrayAndLen (UInt32 n, le...
2019 Jul 16
0
[PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
...generator/generator @@ -849,13 +849,14 @@ and arg = written by the function *) | BytesPersistIn of string * string (* same as above, but buffer persists *) | BytesPersistOut of string * string -| Callback of string * arg list (* callback function returning int *) -| CallbackPersist of string * arg list (* as above, but callback persists *) +| Closure of bool * closure list (* void *opaque + one or more closures + flag if true means callbacks persist + in the handle, false means they only +...
2019 Jun 21
0
[libnbd PATCH v2 1/5] generator: Allow Int in callbacks
...a = %s;\n" name cb_name n | String n @@ -3268,7 +3269,7 @@ let print_python_binding name { args; ret } = (* The following not yet implemented for callbacks XXX *) | ArrayAndLen _ | Bool _ | BytesOut _ | BytesPersistIn _ | BytesPersistOut _ | Callback _ | CallbackPersist _ - | Flags _ | Int _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _ + | Flags _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _ | UInt _ | UInt32 _ -> assert false ) args; pr "\n"; @@ -3278,13 +3279,14 @@ let print_python_binding na...
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
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 Jun 25
3
[PATCH libnbd] generator: Add Mutable type to the generator.
...pr " struct %s_%s_data *_data = %s;\n" name cb_name n | String n | UInt64 n -> () (* The following not yet implemented for callbacks XXX *) | ArrayAndLen _ | Bool _ | BytesOut _ - | BytesPersistIn _ | BytesPersistOut _ | Callback _ | CallbackPersist _ - | Flags _ | Int _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _ + | BytesPersistIn _ | BytesPersistOut _ + | Callback _ | CallbackPersist _ + | Flags _ | Int _ | Int64 _ | Mutable _ + | Path _ | SockAddrAndLen _ | StringList _ | UInt _ |...
2019 Jun 03
0
[PATCH libnbd discussion only 4/5] api: Implement concurrent writer.
...ator/generator @@ -1094,6 +1094,35 @@ C<\"qemu:dirty-bitmap:...\"> for qemu-nbd (see qemu-nbd I<-B> option). See also C<nbd_block_status>."; }; + "set_concurrent_writer", { + default_call with + args = [ Opaque "data"; + CallbackPersist ("writer", [Opaque "data"; + BytesIn ("buf", "len")]) ]; + ret = RErr; + permitted_states = [ Created; Connecting; Connected ]; + shortdesc = "set a concurrent writer thread"; + longdesc = "\...
2019 Jun 18
0
[libnbd PATCH 6/8] states: Add nbd_pread_callback API
...has completed. Other parameters behave as documented in C<nbd_pread>."; }; + "aio_pread_callback", { + default_call with + args = [ BytesPersistOut ("buf", "count"); UInt64 "offset"; + Opaque "data"; + CallbackPersist ("chunk", [Opaque "data"; + BytesIn ("buf", "count"); + UInt64 "offset"; + Int "status";]); + Flags "flag...
2019 Jul 11
2
[libnbd] Slight API inconsistency
...efined to return `int` instead. So my question is, should all callbacks just return nothing and if there is a need for some information to get back they will just use a pointer to some data (like with the `int *error`)? Or do we need different return types for callbacks and should `Callback` and `CallbackPersist` be defined as: `string * arg list * ret` ? Have a nice day, Martin
2019 Jun 29
0
[libnbd PATCH 5/6] api: Add new nbd_aio_FOO_notify functions
...+has completed. Other parameters behave as documented in +C<nbd_pread>."; + }; + + "aio_pread_notify", { + default_call with + args = [ BytesPersistOut ("buf", "count"); UInt64 "offset"; + Opaque "data"; + CallbackPersist ("notify", [ Opaque "data"; Int64 "handle"; + Mutable (Int "error") ]); + Flags "flags" ]; + ret = RInt64; + permitted_states = [ Connected ]; + shortdesc = "read from the NBD server...
2019 Jun 20
1
Re: [libnbd PATCH 6/8] states: Add nbd_pread_callback API
...ame n > | String n > @@ -3272,7 +3358,7 @@ let print_python_binding name { args; ret } = > (* The following not yet implemented for callbacks XXX *) > | ArrayAndLen _ | Bool _ | BytesOut _ > | BytesPersistIn _ | BytesPersistOut _ | Callback _ | CallbackPersist _ > - | Flags _ | Int _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _ > + | Flags _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _ > | UInt _ | UInt32 _ -> assert false > ) args; > pr "\n"; > @@ -3282,13 +3368,14...
2019 Jul 16
1
Re: [PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
...> | RConstString (* return a const string, NULL for error *) > @@ -915,9 +920,9 @@ Return the state of the debug flag on this handle."; > > "set_debug_callback", { > default_call with > - args = [ Opaque "data"; > - CallbackPersist ("debug_fn", [Opaque "data"; > - String "context"; String "msg"]) ]; > + args = [ Closure (true, > + [{ cbname="debug_fn"; > + cbargs=[String &quot...
2019 Jul 11
1
Re: [libnbd] Slight API inconsistency
...on is, should all callbacks just return nothing and if there >> is a >> need for some information to get back they will just use a pointer to >> some data >> (like with the `int *error`)?  Or do we need different return types for >> callbacks and should `Callback` and `CallbackPersist` be defined as: >> `string * arg list * ret` ? >> > >If we ever need a callback that returns void or something other than >int, we can worry about that later. But for now, ALL callbacks should be >returning int, and the documentation should then cover what that return >va...
2019 Jun 29
1
Re: [libnbd PATCH 5/6] api: Add new nbd_aio_FOO_notify functions
...een is to programmatically generate the notify variants of commands, something like this: let make_notify_variant_of_call ({ args; longdesc } as call) = let args = List.rev args in let flags, args = List.hd args, List.tl args in assert (flags = Flags "flags"); let args = flags :: CallbackPersist ("notify", [ etc ]) :: args in let args = List.rev args in let longdesc = longdesc ^ "\nThe C<notify> callback blah blah ..." in { call with args; longdesc } let aio_pwrite_call = { default_call with args = [ BytesPersistIn ("buf", "count");...
2019 Jun 29
19
[libnbd PATCH 0/6] new APIs: aio_in_flight, aio_FOO_notify
I still need to wire in the use of *_notify functions into nbdkit to prove whether it makes the code any faster or easier to maintain, but at least the added example shows one good use case for the new API. Eric Blake (6): api: Add nbd_aio_in_flight generator: Allow DEAD state actions to run generator: Allow Int64 in callbacks states: Prepare for aio notify callback api: Add new
2019 Jun 03
10
[PATCH libnbd discussion only 0/5] api: Implement concurrent writer.
This works, but there's no time saving and I'm still investigating whether it does what I think it does. Nevertheless I thought I would post it because it (probably) implements the idea I had last night outlined in: https://www.redhat.com/archives/libguestfs/2019-June/msg00010.html The meat of the change is patch 4. Patch 5 is an example which I would probably fold into patch 4 for
2019 Jun 04
0
[PATCH libnbd v2 2/4] generator: Callback returns int instead of void.
...written by the function *) | BytesPersistIn of string * string (* same as above, but buffer persists *) | BytesPersistOut of string * string -| Callback of string * arg list (* callback function returning void *) +| Callback of string * arg list (* callback function returning int *) | CallbackPersist of string * arg list (* as above, but callback persists *) | Flags of string (* NBD_CMD_FLAG_* flags *) | Int of string (* small int *) @@ -2680,7 +2680,7 @@ let rec print_c_arg_list ?(handle = false) args = | BytesPersistOut (n, len) -> pr "void *%s, size_t %s&...
2019 Jun 21
9
[libnbd PATCH v2 0/5] nbd_pread_structured
Since v1: - rebase to applied patches - split out support for Int in callbacks - sort of test that callbacks work in OCaml (see comment in patch 5) - rename API to nbd_pread_structured - expose error as explicit parameter to callback Eric Blake (5): generator: Allow Int in callbacks states: Wire in a read callback states: Add nbd_pread_structured API states: Add tests for