search for: errcode_of_ret

Displaying 20 results from an estimated 64 matches for "errcode_of_ret".

2020 Sep 07
2
Re: [libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
...cbname : string; (** name of callback function *) > cbargs : cbarg list; (** all closures return int for now *) > diff --git a/generator/C.ml b/generator/C.ml > index 6b65f6e..1eb5e85 100644 > --- a/generator/C.ml > +++ b/generator/C.ml > @@ -66,15 +66,15 @@ let errcode_of_ret = > function > | RBool | RErr | RFd | RInt | RInt64 | RCookie -> Some "-1" > | RStaticString | RString -> Some "NULL" > - | RUInt -> None (* errors not possible *) > + | RUInt | REnum (_) | RFlags (_) -> None (* errors not possible *) >...
2015 Jun 06
0
[PATCH 2/5] threads: Acquire and release the lock around each public guestfs_* API.
...One |`ErrorIsNULL) as e -> e in + pr " RELEASE_LOCK (g);\n"; pr " return %s;\n" (string_of_errcode errcode); pr " }\n"; pr_newline := true @@ -1297,6 +1298,7 @@ and generate_client_actions hash () = match errcode_of_ret ret with | `CannotReturnError -> assert false | (`ErrorIsMinusOne |`ErrorIsNULL) as e -> e in + pr " RELEASE_LOCK (g);\n"; pr " return %s;\n" (string_of_errcode errcode); pr " }\n"; pr_new...
2016 Jan 27
2
[PATCH 1/2] generator: add TestRunOrUnsupported test type
...let ret = match ret with Some ret -> ret | None -> gensym "ret" in let name, args = @@ -561,7 +579,11 @@ and generate_test_command_call ?(expect_error = false) ?test ?ret test_name cmd= if expect_error then pr " guestfs_pop_error_handler (g);\n"; - (match errcode_of_ret style_ret, expect_error with + let ret_errcode = + if do_return then errcode_of_ret style_ret + else `CannotReturnError in + + (match ret_errcode, expect_error with | `CannotReturnError, _ -> () | `ErrorIsMinusOne, false -> pr " if (%s == -1)\n" ret; diff --git a...
2015 Feb 10
4
[PATCH 1/4] php: fix invalid memory access with OptString
OptString maps to a "s!" argument, which makes zend_parse_parameters not touch the variables (char* and length) when NULL is passed as parameter. Hence, set both to NULL/0, and check for non-NULL char* variable before checking its length. --- generator/php.ml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/generator/php.ml b/generator/php.ml index
2020 Sep 07
0
Re: [libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
On 9/7/20 9:13 AM, Richard W.M. Jones wrote: >> +++ b/generator/C.ml >> @@ -66,15 +66,15 @@ let errcode_of_ret = >> function >> | RBool | RErr | RFd | RInt | RInt64 | RCookie -> Some "-1" >> | RStaticString | RString -> Some "NULL" >> - | RUInt -> None (* errors not possible *) >> + | RUInt | REnum (_) | RFlags (_) -> None (* errors...
2023 May 02
1
[libnbd PATCH v2 2/2] generator/C: lib/api.c: indent arg list 2 spaces relative to function name
...ng patch in the series generator/C.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/generator/C.ml b/generator/C.ml index e68fd70382cf..f772117cd3c9 100644 --- a/generator/C.ml +++ b/generator/C.ml @@ -566,7 +566,8 @@ let let ret_c_type = type_of_ret ret and errcode = errcode_of_ret ret in pr "%s\n" ret_c_type; pr "nbd_%s " name; - print_arg_list ~wrap:true ~handle:true args optargs; + print_arg_list ~wrap:true ~handle:true ~parens:(ParensNewLineWithIndent 0) + args optargs; pr "\n"; pr "{\n"; if permi...
2015 Feb 10
0
[PATCH 4/4] php: fix memory leak in OStringList optargs
...pr " if ((optargs_s.bitmask & %s_%s_BITMASK) != 0)\n" + c_optarg_prefix uc_n; + pr " guestfs_efree_stringlist ((char **) optargs_s.%s);\n" n; + pr "\n" + ) optargs; (* Check for errors. *) (match errcode_of_ret ret with -- 1.9.3
2020 Sep 07
1
Re: [libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
On Mon, Sep 07, 2020 at 09:38:15AM -0500, Eric Blake wrote: > On 9/7/20 9:13 AM, Richard W.M. Jones wrote: > > >>+++ b/generator/C.ml > >>@@ -66,15 +66,15 @@ let errcode_of_ret = > >> function > >> | RBool | RErr | RFd | RInt | RInt64 | RCookie -> Some "-1" > >> | RStaticString | RString -> Some "NULL" > >>- | RUInt -> None (* errors not possible *) > >>+ | RUInt | REnum (_) | RFlags (_)...
2019 Nov 02
1
[PATCH libnbd] lib: Use GCC hints to move debug and error handling code out of hot paths.
...= %s;\n" value; @@ -4658,7 +4658,7 @@ let generate_lib_api_c () = pr ");\n" (* Print the trace when we leave a call with debugging enabled. *) and print_trace_leave ret = - pr " if (h->debug) {\n"; + pr " if_debug (h) {\n"; let errcode = errcode_of_ret ret in (match errcode with | Some r -> diff --git a/lib/crypto.c b/lib/crypto.c index 07d06c0..8d86911 100644 --- a/lib/crypto.c +++ b/lib/crypto.c @@ -676,7 +676,7 @@ nbd_internal_crypto_handshake (struct nbd_handle *h) void nbd_internal_crypto_debug_tls_enabled (struct nbd_handle...
2015 Jun 06
7
[PATCH 0/5] Add support for thread-safe handle.
This patch isn't ready to go upstream. In fact, I think we might do a quick 1.30 release soon, and save this patch, and also the extensive changes proposed for the test suite[1], to after 1.30. Currently it is not safe to use the same handle from multiple threads, unless you implement your own mutexes. See: http://libguestfs.org/guestfs.3.html#multiple-handles-and-multiple-threads These
2023 May 02
4
[libnbd PATCH v2 0/2] continue wrapping generated C code harder
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2172516 v1: https://listman.redhat.com/archives/libguestfs/2023-April/031375.html In v2, move the declaration of the "p" helper variable next to the top of the function. Thanks! Laszlo Laszlo Ersek (2): generator/C: print_wrapper: use helper variable for permitted state check generator/C: lib/api.c: indent arg list 2
2012 Jul 14
6
[PATCH 0/6] Allow non-optargs functions to gain optional arguments.
This rather complex set of patches allow non-optargs functions to gain optional arguments, while preserving source and binary backwards compatibility. The problem is that we cannot add an optional argument to an existing function. For example, we might want to add flags to the 'lvresize' API which currently has no optional arguments.
2019 Aug 09
0
[PATCH libnbd 2/2] generator: Change handling of Flags to be a true optional argument.
...- val print_arg_list : ?handle:bool -> ?types:bool -> arg list -> unit + val print_arg_list : ?handle:bool -> ?types:bool -> + arg list -> optarg list -> unit val print_cbarg_list : ?valid_flag:bool -> ?types:bool -> cbarg list -> unit val errcode_of_ret : ret -> string option val type_of_ret : ret -> string @@ -3157,17 +3169,14 @@ end = struct (* Check the API definition. *) let () = - (* Flags must only appear once in the final argument position. *) + (* Currently optargs can only be [] or [OFlags]. This condition + * will be re...
2020 Sep 06
0
[libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
...r possible *) and closure = { cbname : string; (** name of callback function *) cbargs : cbarg list; (** all closures return int for now *) diff --git a/generator/C.ml b/generator/C.ml index 6b65f6e..1eb5e85 100644 --- a/generator/C.ml +++ b/generator/C.ml @@ -66,15 +66,15 @@ let errcode_of_ret = function | RBool | RErr | RFd | RInt | RInt64 | RCookie -> Some "-1" | RStaticString | RString -> Some "NULL" - | RUInt -> None (* errors not possible *) + | RUInt | REnum (_) | RFlags (_) -> None (* errors not possible *) let type_of_ret = function...
2012 Aug 14
7
[PATCH 0/7] Add tar compress, numericowner, excludes flags.
https://bugzilla.redhat.com/show_bug.cgi?id=847880 https://bugzilla.redhat.com/show_bug.cgi?id=847881 This patch series adds various optional arguments to the tar-in and tar-out commands. Firstly (1/7) an optional "compress" flag is added to select compression. This makes the calls tgz-in/tgz-out/txz-in/txz-out deprecated, and expands the range of compression types available.
2020 Sep 08
2
[libnbd PATCH] python: Plug some memory leaks on error paths
...r " %s_user_data = NULL;\n" cbname + | _ -> () + ) args; + List.iter ( + function + | OClosure { cbname } -> pr " %s_user_data = NULL;\n" cbname + | _ -> () + ) optargs; if may_set_error then ( pr " if (ret == %s) {\n" (match C.errcode_of_ret ret with Some s -> s | None -> assert false); pr " raise_exception ();\n"; - pr " py_ret = NULL;\n"; pr " goto out;\n"; pr " }\n" ); @@ -529,14 +542,14 @@ let print_python_binding name { args; optargs; ret; may_set_error }...
2019 Aug 14
0
[PATCH libnbd 2/2] ocaml: Remove NBD.Buffer.free function, use the completion callback instead.
...istIn (n, _) | BytesPersistOut (n, _) -> + pr " completion_user_data->bufv = %sv;\n" n; + pr " caml_register_generational_global_root (&completion_user_data->bufv);\n" + | _ -> () + ) args; + let ret_c_type = C.type_of_ret ret and errcode = C.errcode_of_ret ret in pr " %s r;\n" ret_c_type; pr "\n"; @@ -5252,7 +5267,8 @@ let generate_ocaml_nbd_c () = pr " * and freed in the free_user_data function below.\n"; pr " */\n"; pr "struct user_data {\n"; - pr " value fnv; /* GC root...
2019 Jun 27
0
[PATCH 7/9] Rust bindings: Complete actions
...| _ -> () ); + if optargs <> [] then ( + pr ", &optargs_raw as *const RawOptArgs%s" cname; + ); pr ") };\n"; - pr "unimplemented!()\n"; + let _pr = pr in + let pr fs = indent 2; pr fs in + (match errcode_of_ret ret with + | `CannotReturnError -> () + | `ErrorIsMinusOne -> + pr "if r == -1 {\n"; + pr " return Err(self.get_error_from_handle (\"%s\"));\n" name; + pr "}\n" + | `ErrorIsNULL -> + pr "if r....
2019 Aug 09
4
[PATCH libnbd 0/2] generator: Preparatory changes to the generator.
These are some simplifications to the generator. They don't probably make much sense on their own, but they are preparatory to better handling of enums, and or'd lists of flags. Rich.
2020 Sep 06
8
[libnbd PATCH 0/3] Improve type-safety of ocaml/golang getters
Natural fallout after my recent testsuite additions that fixed a couple of ocaml bugs in the setters. However, on at least the OCaml code, I'm not sure what we should do if a newer libnbd ever returns a bit that an older NBD.mli was not expecting at the time the OCaml compiler ran (see below). I'm also not sure if there is a more efficient way to avoid outputting Val_FOO() converters for