similar to: [PATCH libnbd] generator: Add SizeT type, maps to C size_t.

Displaying 20 results from an estimated 3000 matches similar to: "[PATCH libnbd] generator: Add SizeT type, maps to C size_t."

2019 Aug 09
0
[PATCH libnbd 1/2] generator: Handle closure args (cbargs) specially.
If we accept that callbacks will never handle the full range of parameters then we can simplify the generator quite a bit by using a special type for closure args vs normal method args. This removes many asserts and quite a bit of unreachable code (eg. Python code for handling ArrayAndLen in normal methods that was never used). The output of the generator after this commit should be identical.
2019 Oct 04
0
[PATCH libnbd 3/4] api: Add nbd_connect_socket.
This allows us to connect directly to a connected socket. How exactly the socket is created and connected to the NBD server is left up to the main program. The only real complexity in this patch is allowing file descriptors to be passed to libnbd APIs. Luckily in C and Python we can treat them exactly as integers, and in OCaml they are also integers but with a different type. ---
2019 Aug 09
0
[PATCH libnbd 2/2] generator: Change handling of Flags to be a true optional argument.
In libguestfs generator we have the concept of optargs which is different from plain arguments. These are mapped to optional arguments in languages that support them such as Python. This commit adds a new concept of optargs. At the moment it is simply limited to handling the optional (in some bindings) flags parameter which is used to handle the NBD_CMD_FLAG_* flags. If present, the old Flags
2019 Jul 16
0
[libnbd PATCH 2/2] RFC: generator: Handle shared callbacks in Python
[RFC because generated OCaml code needs the same treatment, but I ran out of time to play with that. At least 'make -C python check' passes, although coverage is not complete yet, as there is no python/t/5XX-pread-structured-callback.py...] [Also RFC because I'm not sure if the use of a record type for 'callback' is the best approach or most idiomatic OCaml - but hey, it
2019 Jun 21
0
[libnbd PATCH v2 1/5] generator: Allow Int in callbacks
An upcoming patch to add callbacks during structured reads wants to expose Int as a callback parameter. It's time to wire that up. --- generator/generator | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/generator/generator b/generator/generator index e1a97a5..2d1a4e5 100755 --- a/generator/generator +++ b/generator/generator @@ -3260,7 +3260,8
2019 Jun 25
3
[PATCH libnbd] generator: Add Mutable type to the generator.
Mutable (Int n) => int *n This can currently only be used for callback arguments of type int (not for other types, nor for any ordinary function arguments), but it could be implemented more generally in future. --- generator/generator | 75 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 63 insertions(+), 12 deletions(-) diff --git a/generator/generator b/generator/generator
2019 Jun 29
0
[libnbd PATCH 3/6] generator: Allow Int64 in callbacks
An upcoming patch to add callbacks for aio completion notification wants to expose Int64 as a callback parameter. It's time to wire that up. --- generator/generator | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/generator/generator b/generator/generator index 45a030f..c5988e2 100755 --- a/generator/generator +++ b/generator/generator @@ -3508,7
2019 Jul 24
0
[PATCH libnbd v2 5/5] lib: Use unsigned for pread_structured status parameter.
This is a bitmask so using an unsigned type is slightly safer. This is not an ABI change since the types are compatible. Thanks: Eric Blake. --- examples/strict-structured-reads.c | 2 +- generator/generator | 67 ++++++++++++++++-------------- interop/structured-read.c | 2 +- lib/internal.h | 2 +- tests/oldstyle.c | 2 +- 5
2019 Jun 18
0
[libnbd RFC PATCH 9/8] wip: generator: Add ReadStatus enum type
Exploration of what it would take to treat the nbd_pread_callback status parameter as a language-appropriate enum rather than a bare integer. While I've identified a rough set of the places to change, I have not actually got it working with Python or OCaml bindings. --- Posting this more for an idea of whether we want to pursue it further. I have no hard feelings if we decide to ditch it;
2019 Jul 24
0
[PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
In preparation for closure lifetimes, split up the Closure so it no longer describes a list of closures, but a single callback. This changes the API because functions which take 2 or more closures now pass a separate user_data for each one. --- docs/libnbd.pod | 3 +- examples/strict-structured-reads.c | 2 +- generator/generator | 760
2019 Jun 18
0
[libnbd PATCH 6/8] states: Add nbd_pread_callback API
Time to wire up user access to react to structured reads as the chunks come in, exposing the framework added in the last patch. I chose to use an int for the callback status rather than an enum for ease of wiring things up to the various language bindings. Still, it required quite a few tweaks to the generator to support an Int type in a callback. It's easy to test callback behavior for
2019 Jun 20
1
Re: [libnbd PATCH 6/8] states: Add nbd_pread_callback API
On Mon, Jun 17, 2019 at 07:07:56PM -0500, Eric Blake wrote: > diff --git a/generator/generator b/generator/generator > index 2614689..ce77f17 100755 > --- a/generator/generator > +++ b/generator/generator > @@ -1305,7 +1305,72 @@ Issue a read command to the NBD server for the range starting > at C<offset> and ending at C<offset> + C<count> - 1. NBD > can
2019 Jun 20
1
Re: [libnbd RFC PATCH 9/8] wip: generator: Add ReadStatus enum type
On Mon, Jun 17, 2019 at 08:39:43PM -0500, Eric Blake wrote: > Exploration of what it would take to treat the nbd_pread_callback > status parameter as a language-appropriate enum rather than a bare > integer. While I've identified a rough set of the places to change, I > have not actually got it working with Python or OCaml bindings. > --- > > Posting this more for an
2019 Aug 10
0
[PATCH libnbd 6/9] generator: Add non-optional Flags type.
This works just like OFlags but is a non-optional argument. --- generator/generator | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/generator/generator b/generator/generator index 2b37cea..96d1148 100755 --- a/generator/generator +++ b/generator/generator @@ -856,6 +856,7 @@ and arg = | BytesPersistOut of string * string | Closure of closure (* function pointer
2019 Jun 27
1
[libnbd PATCH] python: Fix bindings for Path parameters
Our use of PyUnicode_FSConverter was wrong - the result is a PyObject* rather than a char* (where dereferencing then calling free() on that pointer as char* has catastrophic effects). With this patch, I was able to set up a qemu-nbd encrypted server over a Unix socket (using a pending patch on the qemu list), coupled with a python connection to that socket: $ ~/qemu/qemu-nbd -r -k /tmp/nbdsock
2019 Jul 16
0
[PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
A Closure is a list of (usually one, but can be more) closures. In C there is also a singe ‘void *user_data’ parameter which is passed by the caller into the function and through as the first parameter of each callback invocation. By grouping the previously separate Opaque and Callback* parameters together we can avoid the awkward situation where we have to scan through the argument list to try
2019 Jun 03
0
[PATCH libnbd discussion only 4/5] api: Implement concurrent writer.
--- docs/libnbd.pod | 73 +++++++++++++++++++++++++++++++++++++++++++++ generator/generator | 52 +++++++++++++++++++++++++++----- lib/handle.c | 32 ++++++++++++++++++++ lib/internal.h | 7 +++++ lib/socket.c | 22 +++++++++++--- podwrapper.pl.in | 3 +- 6 files changed, 177 insertions(+), 12 deletions(-) diff --git a/docs/libnbd.pod b/docs/libnbd.pod index
2019 Aug 10
0
[PATCH libnbd 3/9] generator: Add Enum type for enumerated types / unions.
Previously nbd_set_tls had an integer argument which was 0 for disable, 1 for allow and 2 for require. This commit adds a proper enumerated type to describe this, defining LIBNBD_TLS_DISABLE = 0, LIBNBD_TLS_ALLOW = 1 and LIBNBD_TLS_REQUIRE = 2. (Note the C API doesn't change). In C the enumerated type is still defined and passed as an int (not as an enum). While we could define an enum
2020 Mar 17
0
[PATCH libnbd v2 3/3] golang: Add straightforward bindings, without callbacks.
--- generator/GoLang.ml | 336 +++++++++++++++++- .../libnbd/libnbd_200_connect_command_test.go | 35 ++ 2 files changed, 367 insertions(+), 4 deletions(-) diff --git a/generator/GoLang.ml b/generator/GoLang.ml index 1b8f20b..e5fb97c 100644 --- a/generator/GoLang.ml +++ b/generator/GoLang.ml @@ -23,6 +23,304 @@ open Printf open API open Utils +let go_name_of_arg =
2020 Sep 08
2
[libnbd PATCH] python: Plug some memory leaks on error paths
Inspection of the generated code showed several places where we did not release references on all error paths. In particular, switching things to always jump to an out: label, even when the underlying C function cannot fail, makes it easier to clean up when the user passes wrong types to a function call. One of the easiest triggers without this patch was this one-liner: $ nbdsh -c