search for: generate_python_methods_c

Displaying 14 results from an estimated 14 matches for "generate_python_methods_c".

2019 Aug 14
0
[PATCH libnbd 2/3] python: Hold a refcount to persistent AIO buffer until command completion.
...y be saved by libnbd. */\n"; + pr " Py_INCREF (%s);\n" n; + pr " completion_user_data->buf = %s;\n" n; + | _ -> () + ) args; + (* Call the underlying C function. *) pr " ret = nbd_%s (h" name; List.iter ( @@ -4384,7 +4405,8 @@ let generate_python_methods_c () = pr " * and freed in the free_user_data function below.\n"; pr " */\n"; pr "struct user_data {\n"; - pr " PyObject *fn; /* Pointer to Python function. */\n"; + pr " PyObject *fn; /* Optional pointer to Python function. */\n";...
2020 Sep 08
0
[libnbd PATCH] hack for testing python closure leaks: NOT FOR COMMIT
...track down memory leaks related to python closures. --- generator/Python.ml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/generator/Python.ml b/generator/Python.ml index 4a96cf6..2ff17dd 100644 --- a/generator/Python.ml +++ b/generator/Python.ml @@ -578,9 +578,27 @@ let generate_python_methods_c () = pr " PyObject *buf; /* Optional pointer to persistent buffer. */\n"; pr "};\n"; pr "\n"; + pr "static size_t alloc_count;\n"; + pr "void\n"; + pr "dump_alloc_count (void)\n"; + pr "{\n"; + pr " char *c...
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 Aug 12
0
[PATCH libnbd 6/7] python: Use free callback to free closure root.
..." decref, NULL) == -1) {\n"; + pr " PyErr_NoMemory ();\n"; + pr " return NULL;\n"; pr " }\n" | Enum _ -> () | Flags (n, _) -> pr " %s_u32 = %s;\n" n n @@ -4600,6 +4602,12 @@ let generate_python_methods_c () = pr "\n"; pr "#include <methods.h>\n"; pr "\n"; + pr "static void\n"; + pr "decref (void *ptr, void *user_data)\n"; + pr "{\n"; + pr " Py_DECREF (ptr);\n"; + pr "}\n"; + pr "\n"; L...
2020 Sep 08
2
[libnbd PATCH] python: Plug some memory leaks on error paths
...; + List.iter ( + function + | OClosure { cbname } -> + pr " if (%s_user_data) free_user_data (%s_user_data);\n" cbname cbname + | OFlags _ -> () + ) optargs; pr " return py_ret;\n"; pr "}\n"; pr "\n" @@ -594,10 +613,8 @@ let generate_python_methods_c () = pr "{\n"; pr " struct user_data *data = user_data;\n"; pr "\n"; - pr " if (data->fn != NULL)\n"; - pr " Py_DECREF (data->fn);\n"; - pr " if (data->buf != NULL)\n"; - pr " Py_DECREF (data->buf);\n...
2019 Aug 13
0
[PATCH libnbd 2/6] generator: Create only one Python wrapper per closure.
...n | Closure { cbname } -> - pr ", %s_%s_wrapper" name cbname; + pr ", %s_wrapper" cbname; pr ", %s_user_data" cbname | Enum (n, _) -> pr ", %s" n | Flags (n, _) -> pr ", %s_u32" n @@ -4503,6 +4499,7 @@ let generate_python_methods_c () = pr "\n"; pr "#include <methods.h>\n"; pr "\n"; + List.iter print_python_closure_wrapper all_closures; List.iter ( fun (name, fn) -> print_python_binding name fn -- 2.22.0
2020 Sep 10
1
[libnbd PATCH] python: Fix more memory leaks
...function | OClosure { cbname } -> - pr " if (%s_user_data) free_user_data (%s_user_data);\n" cbname cbname + pr " free_user_data (%s_user_data);\n" cbname | OFlags _ -> () ) optargs; pr " return py_ret;\n"; @@ -613,9 +608,11 @@ let generate_python_methods_c () = pr "{\n"; pr " struct user_data *data = user_data;\n"; pr "\n"; - pr " Py_XDECREF (data->fn);\n"; - pr " Py_XDECREF (data->buf);\n"; - pr " free (data);\n"; + pr " if (data) {\n"; + pr " Py_X...
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 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 Aug 12
14
[PATCH libnbd 0/7] Add free callbacks and remove valid_flag.
As proposed here: https://www.redhat.com/archives/libguestfs/2019-August/msg00130.html I didn't actually read Eric's replies to that yet because I've been concentrating on writing these patches all day. Anyway here they are and I'll look at what Eric said about the proposal next. Rich.
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 16
0
[PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
...pr "\n"; List.iter print_ocaml_binding handle_calls +*) (*----------------------------------------------------------------------*) @@ -4954,6 +4975,8 @@ let () = output_to "python/libnbdmod.c" generate_python_libnbdmod_c; output_to "python/methods.c" generate_python_methods_c; output_to "python/nbd.py" generate_python_nbd_py; +(* output_to "ocaml/NBD.mli" generate_ocaml_nbd_mli; output_to "ocaml/NBD.ml" generate_ocaml_nbd_ml; output_to "ocaml/nbd-c.c" generate_ocaml_nbd_c; + *) diff --git a/generator/states-reply-simpl...
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 May 23
2
[PATCH libnbd] api: Get rid of nbd_connection.
This isn't quite finished because not all of the tests or examples have been updated, but it demonstrates an idea: Should we forget about the concept of having multiple connections managed under a single handle? In this patch there is a single ‘struct nbd_handle *’ which manages a single state machine and connection (and therefore no nbd_connection). To connect to a multi-conn server you must