Displaying 5 results from an estimated 5 matches for "s_in_permitted_state".
2019 Nov 02
1
[PATCH libnbd] lib: Use GCC hints to move debug and error handling code out of hot paths.
...r/generator b/generator/generator
index c2ff0db..eb3408d 100755
--- a/generator/generator
+++ b/generator/generator
@@ -4512,7 +4512,7 @@ let generate_lib_api_c () =
let value = match errcode with
| Some value -> value
| None -> assert false in
- pr " if (!%s_in_permitted_state (h)) {\n" name;
+ pr " if (unlikely (!%s_in_permitted_state (h))) {\n" name;
pr " ret = %s;\n" value;
pr " goto out;\n";
pr " }\n";
@@ -4525,7 +4525,7 @@ let generate_lib_api_c () =
| Some value -> value...
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
2019 Jun 08
0
[PATCH libnbd v3] lib: Atomically update h->state when leaving the locked region.
...33 @@ let permitted_state_text permitted_states =
let generate_lib_api_c () =
let print_wrapper (name, {args; ret; permitted_states;
is_locked; may_set_error}) =
+ if permitted_states <> [] then (
+ pr "static inline bool\n";
+ pr "%s_in_permitted_state (struct nbd_handle *h)\n" name;
+ pr "{\n";
+ pr " const enum state state = get_public_state (h);\n";
+ pr "\n";
+ let tests =
+ List.map (
+ function
+ | Created -> "nbd_internal_is_state_created (state)"...
2019 Jun 08
4
[PATCH libnbd v3] lib: Atomically update h->state when leaving the locked region.
v1 was here:
https://www.redhat.com/archives/libguestfs/2019-June/thread.html#00055
v2 was here:
https://www.redhat.com/archives/libguestfs/2019-June/thread.html#00067
v3:
- Fix atomicly -> atomically in commit message.
- Fix a comment.
- Fix TOCTTOU: There is now an inline function generated called
<name>_is_permitted_state, and this is called twice, first outside
the
2019 Jul 25
2
[libnbd PATCH] generator: Let nbd_aio_get_direction return unsigned
...11 @@ let generate_lib_api_c () =
if is_locked then
pr " pthread_mutex_lock (&h->lock);\n";
if permitted_states <> [] then (
+ let value = match errcode with
+ | Some value -> value
+ | None -> assert false in
pr " if (!%s_in_permitted_state (h)) {\n" name;
- pr " ret = %s;\n" errcode;
+ pr " ret = %s;\n" value;
pr " goto out;\n";
pr " }\n"
);
@@ -3412,31 +3421,37 @@ let print_api (name, { args; ret; permitted_states; shortdesc; longdesc;
match ret...