Displaying 20 results from an estimated 90 matches for "cbname".
Did you mean:
dbname
2020 Sep 10
1
[libnbd PATCH] python: Fix more memory leaks
...; n;
pr " Py_ssize_t %s;\n" count
| BytesPersistIn (n, _)
| BytesPersistOut (n, _) ->
@@ -279,11 +279,10 @@ let print_python_binding name { args; optargs; ret; may_set_error } =
n;
pr " struct py_aio_buffer *%s_buf;\n" n
| Closure { cbname } ->
- pr " struct user_data *%s_user_data = alloc_user_data ();\n" cbname;
- pr " if (%s_user_data == NULL) goto out;\n" cbname;
+ pr " struct user_data *%s_user_data = NULL;\n" cbname;
+ pr " PyObject *py_%s_fn;\n" cbname;...
2019 Aug 13
0
[PATCH libnbd 5/6] generator: Implement OClosure.
...- ) handle_calls;
-
(* Check functions using may_set_error. *)
List.iter (
function
@@ -3377,6 +3368,12 @@ let rec print_arg_list ?(handle = false) ?(types = true) args optargs =
if !comma then pr ", ";
comma := true;
match optarg with
+ | OClosure { cbname; cbargs } ->
+ if types then pr "nbd_%s_callback " cbname;
+ pr "%s_callback" cbname;
+ pr ", ";
+ if types then pr "void *";
+ pr "%s_user_data" cbname
| OFlags (n, _) ->
if types then...
2019 Aug 13
0
[PATCH libnbd v2 1/3] generator: Implement OClosure.
...optargs contains an OFlags parameter, may_set_error must be false" name
| _ -> ()
@@ -3388,6 +3380,12 @@ let rec print_arg_list ?(handle = false) ?(types = true) args optargs =
if !comma then pr ", ";
comma := true;
match optarg with
+ | OClosure { cbname; cbargs } ->
+ if types then pr "nbd_%s_callback " cbname;
+ pr "%s_callback" cbname;
+ pr ", ";
+ if types then pr "void *";
+ pr "%s_user_data" cbname
| OFlags (n, _) ->
if types then...
2020 Sep 08
2
[libnbd PATCH] python: Plug some memory leaks on error paths
...n.ml | 55 +++++++++++++++++++++++++++++----------------
1 file changed, 36 insertions(+), 19 deletions(-)
diff --git a/generator/Python.ml b/generator/Python.ml
index 4a96cf6..9a22f9e 100644
--- a/generator/Python.ml
+++ b/generator/Python.ml
@@ -177,6 +177,7 @@ let print_python_closure_wrapper { cbname; cbargs } =
pr " Py_DECREF (py_%s_modname);\n" n;
pr " if (!py_%s_mod) { PyErr_PrintEx (0); return -1; }\n" n;
pr " PyObject *py_%s = PyObject_CallMethod (py_%s_mod, \"c_int\", \"i\", *%s);\n" n n n;
+ pr " Py_...
2019 Jul 24
0
[PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
...* flags *)
| Int of string (* small int *)
| Int64 of string (* 64 bit signed int *)
@@ -921,8 +921,8 @@ Return the state of the debug flag on this handle.";
"set_debug_callback", {
default_call with
args = [ Closure (true,
- [{ cbname="debug_fn";
- cbargs=[String "context"; String "msg"] }]) ];
+ { cbname="debug_fn";
+ cbargs=[String "context"; String "msg"] }) ];
ret = RErr;
shortdesc = "...
2019 Aug 14
4
[PATCH libnbd 0/2] Use free callback to dereference NBD.Buffer.
In this patch series we use the newly introduced free callback
on the completion function to dererence the OCaml NBD.Buffer.
I will make the same kind of change for Python later in a
separate series.
The completion function is always called at the C level, even
if the OCaml program didn't use the optional argument. That's
because the free callback doesn't run otherwise.
There is a
2019 Jul 24
0
[PATCH libnbd 2/3] lib: Implement closure lifetimes.
...flags *)
| Int of string (* small int *)
| Int64 of string (* 64 bit signed int *)
@@ -920,9 +917,8 @@ Return the state of the debug flag on this handle.";
"set_debug_callback", {
default_call with
- args = [ Closure (true,
- { cbname="debug_fn";
- cbargs=[String "context"; String "msg"] }) ];
+ args = [ Closure { cbname="debug_fn";
+ cbargs=[String "context"; String "msg"] } ];
ret = RErr;
shortdesc = "set...
2019 Aug 14
5
[PATCH libnbd 0/3] Use free callback to hold ref to AIO buffer.
Basically the same as this patch series, but for Python:
https://www.redhat.com/archives/libguestfs/2019-August/msg00235.html
plus adding the 590 asynch test at the end.
Rich.
2019 Jul 24
6
[PATCH libnbd 0/3] Implement closure lifetimes.
This implements most of what I wrote here:
https://www.redhat.com/archives/libguestfs/2019-July/msg00213.html
2019 Aug 15
13
[PATCH libnbd v2 00/10] Callbacks and OCaml and Python persistent buffers.
This is a combination of these two earlier series:
https://www.redhat.com/archives/libguestfs/2019-August/msg00235.html
https://www.redhat.com/archives/libguestfs/2019-August/msg00240.html
plus changes to allow .callback = NULL / .free != NULL, and to reduce
the complexity of freeing callbacks.
Although it's rather long there's nothing complex here. We might
consider squashing some
2019 Jul 24
8
[PATCH libnbd v2 0/5] lib: Implement closure lifetimes.
v1 was here:
https://www.redhat.com/archives/libguestfs/2019-July/thread.html#00231
The changes address everything that Eric picked up in his review of
the first two patches. I have also added two more patches (4 and 5)
which respectively fix docs and change int status -> unsigned status,
as discussed.
Passes make, check, check-valgrind.
Rich.
2019 Aug 14
0
[PATCH libnbd 2/2] ocaml: Remove NBD.Buffer.free function, use the completion callback instead.
...to_bytes : t -> bytes = \"nbd_internal_ocaml_buffer_to_bytes\"
external of_bytes : bytes -> t = \"nbd_internal_ocaml_buffer_of_bytes\"
external size : t -> int = \"nbd_internal_ocaml_buffer_size\"
@@ -4945,6 +4940,12 @@ let print_ocaml_closure_wrapper { cbname; cbargs } =
pr " int r;\n";
pr " value args[%d];\n" (List.length argnames);
pr "\n";
+ pr " /* The C callback is always registered, even if there's no OCaml\n";
+ pr " * callback. This is because we may need to unregister an\n";...
2019 Jul 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...flags *)
| Int of string (* small int *)
| Int64 of string (* 64 bit signed int *)
@@ -920,9 +917,8 @@ Return the state of the debug flag on this handle.";
"set_debug_callback", {
default_call with
- args = [ Closure (true,
- { cbname="debug_fn";
- cbargs=[String "context"; String "msg"] }) ];
+ args = [ Closure { cbname="debug_fn";
+ cbargs=[String "context"; String "msg"] } ];
ret = RErr;
shortdesc = "set...
2019 Aug 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...goto error;
diff --git a/generator/generator b/generator/generator
index 4d3d7ad..ea32929 100755
--- a/generator/generator
+++ b/generator/generator
@@ -3226,10 +3226,7 @@ let rec print_arg_list ?(handle = false) ?(types = true) args optargs =
pr "%s" len
| Closure { cbname; cbargs } ->
if types then pr "nbd_%s_callback " cbname;
- pr "%s_callback" cbname;
- pr ", ";
- if types then pr "void *";
- pr "%s_user_data" cbname
+ pr "%s_callback" cbname
|...
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 Jul 25
0
[PATCH libnbd v3 1/2] lib: Implement closure lifetimes.
...flags *)
| Int of string (* small int *)
| Int64 of string (* 64 bit signed int *)
@@ -920,9 +917,8 @@ Return the state of the debug flag on this handle.";
"set_debug_callback", {
default_call with
- args = [ Closure (true,
- { cbname="debug_fn";
- cbargs=[String "context"; String "msg"] }) ];
+ args = [ Closure { cbname="debug_fn";
+ cbargs=[String "context"; String "msg"] } ];
ret = RErr;
shortdesc = "set...
2019 Aug 13
2
Re: [PATCH libnbd 5/6] generator: Implement OClosure.
On 8/13/19 5:06 AM, Richard W.M. Jones wrote:
> An optional Closure parameter, but otherwise works the same way as
> Closure.
> @@ -3778,6 +3777,7 @@ let generate_lib_api_c () =
> ) args;
> List.iter (
> function
> + | OClosure { cbname } -> pr ", %s_callback ? \"<fun>\" : \"NULL\"" cbname
Well, it also permits a NULL fn pointer.
> @@ -4383,6 +4387,16 @@ let print_python_binding name { args; optargs; ret; may_set_error } =
> ) args;
> List.iter (
> function
> +...
2019 Aug 13
0
[PATCH libnbd 1/6] generator: Share single list of all Closures.
...bef2a 100755
--- a/generator/generator
+++ b/generator/generator
@@ -916,6 +916,32 @@ let non_blocking_test_call_description = "\n
This call does not block, because it returns data that is saved in
the handle from the NBD protocol handshake."
+(* Closures. *)
+let chunk_closure = {
+ cbname = "chunk";
+ cbargs = [ CBBytesIn ("subbuf", "count");
+ CBUInt64 "offset"; CBUInt "status";
+ CBMutable (Int "error") ]
+}
+let completion_closure = {
+ cbname = "completion";
+ cbargs = [ CBMutable (I...
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 Jul 25
4
[PATCH libnbd v3 0/2] lib: Implement closure lifetimes.
I think I've addressed everything that was raised in review.
Some of the highlights:
- Callbacks should be freed reliably along all exit paths.
- There's a simple test of closure lifetimes.
- I've tried to use VALID|FREE in all the places where I'm confident
that it's safe and correct to do. There may be more places. Note
this is an optimization and shouldn't