search for: s_user_data

Displaying 20 results from an estimated 48 matches for "s_user_data".

2020 Sep 08
2
[libnbd PATCH] python: Plug some memory leaks on error paths
...;; List.iter ( function | Bool n -> pr " int %s;\n" n @@ -279,7 +280,7 @@ let print_python_binding name { args; optargs; ret; may_set_error } = 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) return NULL;\n" cbname; + pr " if (%s_user_data == NULL) goto out;\n" cbname; pr " nbd_%s_callback %s = { .callback = %s_wrapper,\n" cbname cbname cbname; pr...
2020 Sep 10
1
[libnbd PATCH] python: Fix more memory leaks
...| 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; pr " nbd_%s_callback %s = { .callback = %s_wrap...
2019 Aug 13
1
Re: [PATCH libnbd v2 1/3] generator: Implement OClosure.
...+++++++--------- > 1 file changed, 46 insertions(+), 11 deletions(-) > > @@ -4394,6 +4399,16 @@ let print_python_binding name { args; optargs; ret; may_set_error } = > ) args; > List.iter ( > function > + | OClosure { cbname } -> > + pr " if (%s_user_data != Py_None) {\n" cbname; > + pr " /* Increment refcount since pointer may be saved by libnbd. */\n"; > + pr " Py_INCREF (%s_user_data);\n" cbname; > + pr " if (!PyCallable_Check (%s_user_data)) {\n" cbname; > + pr &quot...
2019 Aug 13
0
[PATCH libnbd 5/6] generator: Implement OClosure.
...ot;; 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 pr "uint32_t "; pr "%s" n @@ -3707,6 +3704,7 @@ let generate_lib_api_c () = ) args; List.iter ( function + | OClosure _ -> () | OFlags (n, flags) -> print_fla...
2019 Aug 13
0
[PATCH libnbd v2 1/3] generator: Implement OClosure.
...ot;; 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 pr "uint32_t "; pr "%s" n @@ -3718,6 +3716,7 @@ let generate_lib_api_c () = ) args; List.iter ( function + | OClosure _ -> () | OFlags (n, flags) -> print_fla...
2019 Aug 13
2
Re: [PATCH libnbd 5/6] generator: Implement OClosure.
...t; : \"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 > + | OClosure { cbname } -> > + pr " if (%s_user_data) {\n" cbname; > + pr " /* Increment refcount since pointer may be saved by libnbd. */\n"; > + pr " Py_INCREF (%s_user_data);\n" cbname; > + pr " if (!PyCallable_Check (%s_user_data)) {\n" cbname; I don't think PyNone is cal...
2019 Jul 24
0
[PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
...g = function | BytesOut (n, len) -> [n; len] | BytesPersistIn (n, len) -> [n; len] | BytesPersistOut (n, len) -> [n; len] -| Closure (_, closures) -> - List.map (fun { cbname } -> cbname) closures @ ["user_data"] +| Closure (_, { cbname }) -> [cbname; sprintf "%s_user_data" cbname ] | Flags n -> [n] | Int n -> [n] | Int64 n -> [n] @@ -3241,19 +3228,16 @@ let rec print_arg_list ?(handle = false) ?(user_data = false) pr "%s, " n; if types then pr "size_t "; pr "%s" len - | Closure (_, cls...
2019 Aug 12
0
[PATCH libnbd 3/7] ocaml: Remove NBD.Buffer.free function, use a free callback instead.
...%s = caml_string_length (%sv);\n" count n | BytesPersistIn (n, count) -> + pr " /* The function may save a reference to the Buffer, so we\n"; + pr " * must treat it as a possible GC root.\n"; + pr " */\n"; + pr " value *%s_user_data;\n" n; + pr " %s_user_data = malloc (sizeof (value));\n" n; + pr " if (%s_user_data == NULL) caml_raise_out_of_memory ();\n" n; + pr " *%s_user_data = %sv;\n" n n; + pr " caml_register_generational_global_root (%s_user_data);\n&quo...
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 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 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 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...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 | Enum (n, _) -> if types then pr "int "; pr "%s" n @@ -3271,10 +3268,7 @@ let rec print_arg_list ?(handle = false) ?(types = true) args optargs = match optarg with | OClosure {...
2019 Jul 24
0
[PATCH libnbd 2/3] lib: Implement closure lifetimes.
...arg list -> unit end = struct (* Check the API definition. *) @@ -3174,7 +3157,7 @@ let rec name_of_arg = function | BytesOut (n, len) -> [n; len] | BytesPersistIn (n, len) -> [n; len] | BytesPersistOut (n, len) -> [n; len] -| Closure (_, { cbname }) -> [cbname; sprintf "%s_user_data" cbname ] +| Closure { cbname } -> [cbname; sprintf "%s_user_data" cbname ] | Flags n -> [n] | Int n -> [n] | Int64 n -> [n] @@ -3187,7 +3170,8 @@ let rec name_of_arg = function | UInt32 n -> [n] | UInt64 n -> [n] -let rec print_arg_list ?(handle = false) ?(u...
2019 Aug 12
0
[PATCH libnbd 5/7] ocaml: Use free callback to free closure root, instead of valid_flag == FREE.
..._FREE)\n"; - pr " free_root (NULL, user_data);\n"; - pr "\n"; pr " return ret;\n"; pr "}\n"; pr "\n" @@ -5348,7 +5345,11 @@ let print_ocaml_binding (name, { args; optargs; ret }) = pr " if (%s_user_data == NULL) caml_raise_out_of_memory ();\n" cbname; pr " *%s_user_data = %sv;\n" cbname cbname; pr " caml_register_generational_global_root (%s_user_data);\n" cbname; - pr " const void *%s_callback = %s_%s_wrapper;\n" cbname name cbname +...
2019 Jul 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...arg list -> unit end = struct (* Check the API definition. *) @@ -3174,7 +3157,7 @@ let rec name_of_arg = function | BytesOut (n, len) -> [n; len] | BytesPersistIn (n, len) -> [n; len] | BytesPersistOut (n, len) -> [n; len] -| Closure (_, { cbname }) -> [cbname; sprintf "%s_user_data" cbname ] +| Closure { cbname } -> [cbname; sprintf "%s_user_data" cbname ] | Flags n -> [n] | Int n -> [n] | Int64 n -> [n] @@ -3187,7 +3170,8 @@ let rec name_of_arg = function | UInt32 n -> [n] | UInt64 n -> [n] -let rec print_arg_list ?(handle = false) ?(u...
2019 Aug 14
0
[PATCH libnbd 2/2] ocaml: Remove NBD.Buffer.free function, use the completion callback instead.
...rint_ocaml_binding (name, { args; optargs; ret }) = List.iter ( function | OClosure { cbname } -> - pr " nbd_%s_callback %s_callback = {0};\n" cbname cbname; + pr " nbd_%s_callback %s_callback;\n" cbname cbname; + pr " struct user_data *%s_user_data = alloc_user_data ();\n" cbname; pr " if (%sv != Val_int (0)) { /* Some closure */\n" cbname; pr " /* The function may save a reference to the closure, so we\n"; pr " * must treat it as a possible GC root.\n"; pr "...
2019 Jul 25
0
[PATCH libnbd v3 1/2] lib: Implement closure lifetimes.
...arg list -> unit end = struct (* Check the API definition. *) @@ -3090,7 +3073,7 @@ let rec name_of_arg = function | BytesOut (n, len) -> [n; len] | BytesPersistIn (n, len) -> [n; len] | BytesPersistOut (n, len) -> [n; len] -| Closure (_, { cbname }) -> [cbname; sprintf "%s_user_data" cbname ] +| Closure { cbname } -> [cbname; sprintf "%s_user_data" cbname ] | Flags n -> [n] | Int n -> [n] | Int64 n -> [n] @@ -3103,7 +3086,8 @@ let rec name_of_arg = function | UInt32 n -> [n] | UInt64 n -> [n] -let rec print_arg_list ?(handle = false) ?(u...
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 10
0
[PATCH libnbd 3/9] generator: Add Enum type for enumerated types / unions.
...Require an encrypted and authenticated TLS connection. Always fail to connect if the connection is not encrypted @@ -3307,6 +3323,7 @@ let rec name_of_arg = function | BytesPersistOut (n, len) -> [n; len] | Closure { cbname } -> [ sprintf "%s_callback" cbname; sprintf "%s_user_data" cbname ] +| Enum (n, _) -> [n] | Int n -> [n] | Int64 n -> [n] | Path n -> [n] @@ -3351,6 +3368,9 @@ let rec print_arg_list ?(handle = false) ?(types = true) args optargs = pr ", "; if types then pr "void *"; pr "%s_user_da...