search for: name_of_arg

Displaying 20 results from an estimated 52 matches for "name_of_arg".

Did you mean: name_of_argt
2019 Jun 25
3
[PATCH libnbd] generator: Add Mutable type to the generator.
...(* 64 bit signed int *) +| Mutable of arg (* mutable argument, eg. int* *) | Opaque of string (* opaque object, void* in C *) | Path of string (* filename or path *) | SockAddrAndLen of string * string (* struct sockaddr * + socklen_t *) @@ -2708,6 +2709,7 @@ let rec name_of_arg = function | Int n -> [n] | Int64 n -> [n] | Opaque n -> [n] +| Mutable arg -> name_of_arg arg | Path n -> [n] | SockAddrAndLen (n, len) -> [n; len] | String n -> [n] @@ -2741,6 +2743,8 @@ let rec print_c_arg_list ?(handle = false) args = | Flags n -> pr "u...
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 Jun 04
2
[PATCH libnbd] generator: Fix race condition when validating h->state.
...ion @@ -2842,8 +2841,6 @@ let generate_lib_api_c () = pr " }\n"; pr "\n" ); - if is_locked then - pr " pthread_mutex_lock (&h->lock);\n"; pr " ret = nbd_unlocked_%s (h" name; let argnames = List.flatten (List.map name_of_arg args) in List.iter (pr ", %s") argnames; -- 2.21.0
2019 Jul 16
0
[PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
...cbargs=[Int64 "cookie"; Mutable (Int "error")]} ]); Flags "flags" ]; ret = RInt64; permitted_states = [ Connected ]; @@ -3143,19 +3151,19 @@ let generate_lib_libnbd_syms () = pr " local: *;\n"; pr "};\n" -let rec name_of_arg = function -| ArrayAndLen (arg, n) -> name_of_arg arg @ [n] +let rec c_name_of_arg = function +| ArrayAndLen (arg, n) -> c_name_of_arg arg @ [n] | Bool n -> [n] | BytesIn (n, len) -> [n; len] | BytesOut (n, len) -> [n; len] | BytesPersistIn (n, len) -> [n; len] | BytesPersist...
2019 Jul 16
1
Re: [PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
.... Probably worth picking a style you like and then using it consistently, but that's cosmetic and doesn't affect the patch's operation. > @@ -3143,19 +3151,19 @@ let generate_lib_libnbd_syms () = > pr " local: *;\n"; > pr "};\n" > > -let rec name_of_arg = function > -| ArrayAndLen (arg, n) -> name_of_arg arg @ [n] > +let rec c_name_of_arg = function > +| ArrayAndLen (arg, n) -> c_name_of_arg arg @ [n] > | Bool n -> [n] > | BytesIn (n, len) -> [n; len] > | BytesOut (n, len) -> [n; len] > | BytesPersistIn (n,...
2019 Jun 27
1
[libnbd PATCH] python: Fix bindings for Path parameters
...), 4 deletions(-) diff --git a/generator/generator b/generator/generator index c29460c..fa12232 100755 --- a/generator/generator +++ b/generator/generator @@ -3608,7 +3608,9 @@ let print_python_binding name { args; ret } = | Mutable arg -> pr " PyObject *%s;\n" (List.hd (name_of_arg arg)) | Opaque _ -> () - | Path n -> pr " char *%s = NULL;\n" n + | Path n -> + pr " PyObject *py_%s = NULL;\n" n; + pr " char *%s = NULL;\n" n | SockAddrAndLen (n, _) -> pr " /* XXX Complicated - Python uses a t...
2019 Jul 16
3
[RFC libnbd PATCH 0/2] Start fixing python nbd.pread_structured_callback
Posting now that I got something to compile (at the expense of breaking OCaml bindings), but I'm open to ideas on how to improve it. Eric Blake (2): generator: Tweak print_c_arg_list to take alternate first arg RFC: generator: Handle shared callbacks in Python generator/generator | 556 ++++++++++++++++++++++---------------------- 1 file changed, 280 insertions(+), 276 deletions(-) --
2019 Jul 16
0
[libnbd PATCH 2/2] RFC: generator: Handle shared callbacks in Python
...cbargs=[ Int64 "cookie"; + Mutable (Int "error") ]}]); Flags "flags" ]; ret = RInt64; permitted_states = [ Connected ]; @@ -3150,11 +3171,11 @@ let rec name_of_arg = function | BytesOut (n, len) -> [n; len] | BytesPersistIn (n, len) -> [n; len] | BytesPersistOut (n, len) -> [n; len] -| Callback (n, _) | CallbackPersist (n, _) -> [n] | Flags n -> [n] | Int n -> [n] | Int64 n -> [n] -| Opaque n -> [n] +| OpaqueAndCallbacks (n, cbs)...
2020 Sep 08
2
Re: [libnbd PATCH 1/2] generator: Refactor handling of closures in unlocked functions
...rw.c | 76 ++++++++++++++++++++++++------------------------- > 5 files changed, 73 insertions(+), 71 deletions(-) > > diff --git a/generator/C.ml b/generator/C.ml > index deb77fa..280b319 100644 > --- a/generator/C.ml > +++ b/generator/C.ml > @@ -99,16 +99,17 @@ let rec name_of_arg = function > | UInt64 n -> [n] > > let rec print_arg_list ?(wrap = false) ?maxcol ?handle ?types ?(parens = true) > + ?(closure_mark) args optargs = You don't need parens around here, you can just write ?closure_mark > + if parens then pr "("; > +...
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 Jul 27
3
[PATCH libnbd] lib: Use symbol versions.
This patch adds support for symbol versions. It is based on what libvirt does. The generated syms file looks like: LIBNBD_1.0 { global: nbd_...; nbd_...; local: *; }; In a future stable 1.2 release, new symbols would go into a new section which would look like this: LIBNBD_1.2 { global: nbd_new_symbol; nbd_another_new_symbol; local: *; } LIBNBD_1.0; In my testing the
2019 Aug 09
0
[PATCH libnbd 1/2] generator: Handle closure args (cbargs) specially.
...; arg 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 end = struct @@ -3278,7 +3285,6 @@ let type_of_ret = | RUInt -> "unsigned" let rec name_of_arg = function -| ArrayAndLen (arg, n) -> name_of_arg arg @ [n] | Bool n -> [n] | BytesIn (n, len) -> [n; len] | BytesOut (n, len) -> [n; len] @@ -3289,7 +3295,6 @@ let rec name_of_arg = function | Flags n -> [n] | Int n -> [n] | Int64 n -> [n] -| Mutable arg -> name_of_ar...
2019 May 30
3
[PATCH libnbd 0/2] Avoid lock and error overhead on some calls.
This works. I'm in the middle of testing whether there is any noticable benefit. Rich.
2019 Jun 04
0
Re: [PATCH libnbd] generator: Fix race condition when validating h->state.
...->lock);\n"; but returning -1 without releasing the lock is wrong. I would expect a bit more change to keep the locking sane, but once that is in place, the patch does solve one race. > pr " ret = nbd_unlocked_%s (h" name; > let argnames = List.flatten (List.map name_of_arg args) in > List.iter (pr ", %s") argnames; > -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
2019 Jun 05
2
Re: [PATCH libnbd 4/4] lib: Atomically update h->state when leaving the locked region.
...k-compat issues to all existing AIO clients. > @@ -2866,8 +2866,11 @@ let generate_lib_api_c () = As said above, I think you're still missing a change at the beginning of the wrapper that grabs the lock to do the state check after the lock. > let argnames = List.flatten (List.map name_of_arg args) in > List.iter (pr ", %s") argnames; > pr ");\n"; > - if is_locked then > - pr " pthread_mutex_unlock (&h->lock);\n"; > + if is_locked then ( > + pr " if (h->state != h->next_state)\n"; > +...
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.
2019 Aug 10
0
[PATCH libnbd 6/9] generator: Add non-optional Flags type.
...aque *) | Enum of string * enum (* enum/union type, int in C *) +| Flags of string * flags (* flags, uint32_t in C *) | Int of string (* small int *) | Int64 of string (* 64 bit signed int *) | Path of string (* filename or path *) @@ -3324,6 +3325,7 @@ let rec name_of_arg = function | Closure { cbname } -> [ sprintf "%s_callback" cbname; sprintf "%s_user_data" cbname ] | Enum (n, _) -> [n] +| Flags (n, _) -> [n] | Int n -> [n] | Int64 n -> [n] | Path n -> [n] @@ -3371,6 +3373,9 @@ let rec print_arg_list ?(handle = false...
2019 Jun 08
0
Re: [PATCH libnbd 4/4] lib: Atomically update h->state when leaving the locked region.
...b_api_c () = > > As said above, I think you're still missing a change at the beginning of > the wrapper that grabs the lock to do the state check after the lock. AFAIK the code is safe now? I'm not sure what you mean by this. > > let argnames = List.flatten (List.map name_of_arg args) in > > List.iter (pr ", %s") argnames; > > pr ");\n"; > > - if is_locked then > > - pr " pthread_mutex_unlock (&h->lock);\n"; > > + if is_locked then ( > > + pr " if (h->state != h-&gt...
2019 Jun 05
0
[PATCH libnbd 4/4] lib: Atomically update h->state when leaving the locked region.
...- pr " switch (get_state (h))\n"; + pr " switch (get_next_state (h))\n"; pr " {\n"; List.iter ( fun ({ comment; parsed = { display_name; state_enum } }) -> @@ -2866,8 +2866,11 @@ let generate_lib_api_c () = let argnames = List.flatten (List.map name_of_arg args) in List.iter (pr ", %s") argnames; pr ");\n"; - if is_locked then - pr " pthread_mutex_unlock (&h->lock);\n"; + if is_locked then ( + pr " if (h->state != h->next_state)\n"; + pr " h->state = h-&g...
2020 Sep 06
0
[libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
...+ | RBool | RErr | RFd | RInt | REnum (_) -> "int" | RInt64 | RCookie -> "int64_t" | RStaticString -> "const char *" | RString -> "char *" - | RUInt -> "unsigned" + | RUInt | RFlags (_) -> "unsigned" let rec name_of_arg = function | Bool n -> [n] @@ -664,22 +664,22 @@ let generate_lib_api_c () = pr " nbd_internal_printable_string (ret);\n" | RBool | RErr | RFd | RInt | RInt64 | RCookie - | RUInt -> () + | RUInt | REnum (_) | RFlags (_) -> () ); pr...