Displaying 13 results from an estimated 13 matches for "print_extern_and_define".
2019 Jun 03
1
[libnbd PATCH] generator: Add #define witnesses for all API
...1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/generator/generator b/generator/generator
index db7c10f..7d0ea3f 100755
--- a/generator/generator
+++ b/generator/generator
@@ -2712,6 +2712,12 @@ let print_extern name args ret =
print_call name args ret;
pr ";\n"
+let print_extern_and_define name args ret =
+ let name_upper = String.uppercase_ascii name in
+ print_extern name args ret;
+ pr "#define LIBNBD_HAVE_NBD_%s 1\n" name_upper;
+ pr "\n"
+
let generate_include_libnbd_h () =
generate_header CStyle;
@@ -2729,14 +2735,23 @@ let generate_include_libnbd_h...
2019 Jun 27
3
[libnbd PATCH] generator: Add support for namespace constants
...+let metadata_namespaces = [
+ "base", [ "allocation", [
+ "STATE_HOLE", 1 lsl 0;
+ "STATE_ZERO", 1 lsl 1;
+ ] ];
+]
+
(*----------------------------------------------------------------------*)
(* Helper functions. *)
@@ -2908,6 +2915,25 @@ let print_extern_and_define name args ret =
pr "#define LIBNBD_HAVE_NBD_%s 1\n" name_upper;
pr "\n"
+let print_ns_ctxt ns ns_upper ctxt consts =
+ let ctxt_upper = String.uppercase_ascii ctxt in
+ pr "#define LIBNBD_CONTEXT_%s_%s \"%s:%s\"\n"
+ ns_upper ctxt_upper ns ctxt;...
2019 Jul 25
0
[PATCH libnbd v3 2/2] lib: Remove nbd_add_close_callback.
...quot;;
- pr " nbd_close_callback cb,\n";
- pr " void *user_data);\n";
- pr "#define LIBNBD_HAVE_NBD_ADD_CLOSE_CALLBACK 1\n";
- pr "\n";
List.iter (
fun (name, { args; ret }) -> print_extern_and_define name args ret
) handle_calls;
@@ -3536,18 +3530,6 @@ errors have corresponding errnos, so even if there has been an error
this may return C<0>. Error codes are the standard ones from
C<E<lt>errno.hE<gt>>.
-=head1 CLOSE CALLBACKS
-
-You can register close callbacks wi...
2019 Aug 09
0
[PATCH libnbd 2/2] generator: Change handling of Flags to be a true optional argument.
...s optargs ret =
pr "extern ";
- print_call name args ret;
+ print_call name args optargs ret;
pr ";\n"
let print_cbarg_list ?(valid_flag = true) ?(types = true) cbargs =
@@ -3444,9 +3458,9 @@ let print_closure_typedefs () =
) unique_cls;
pr "\n"
-let print_extern_and_define name args ret =
+let print_extern_and_define name args optargs ret =
let name_upper = String.uppercase_ascii name in
- print_extern name args ret;
+ print_extern name args optargs ret;
pr "#define LIBNBD_HAVE_NBD_%s 1\n" name_upper;
pr "\n"
@@ -3511,7 +3525,8 @@ let...
2019 Aug 13
0
[PATCH libnbd 1/6] generator: Share single list of all Closures.
...= compare n1 n2 in
- let unique_cls = sort_uniq ~cmp all_cls in
List.iter (
fun { cbname; cbargs } ->
pr "typedef int (*nbd_%s_callback) " cbname;
print_cbarg_list cbargs;
pr ";\n";
- ) unique_cls;
+ ) all_closures;
pr "\n"
let print_extern_and_define name args optargs ret =
--
2.22.0
2019 Aug 03
1
[PATCH libnbd] generator: Generate typedefs automatically for Closure arguments.
...1 n2 in
+ let unique_cls = sort_uniq ~cmp all_cls in
+ List.iter (
+ fun { cbname; cbargs } ->
+ pr "typedef int (*nbd_%s_callback) " cbname;
+ print_arg_list ~valid_flag:true ~user_data:true cbargs;
+ pr ";\n";
+ ) unique_cls;
+ pr "\n"
+
let print_extern_and_define name args ret =
let name_upper = String.uppercase_ascii name in
print_extern name args ret;
@@ -3355,6 +3413,7 @@ let generate_include_libnbd_h () =
pr "extern int nbd_get_errno (void);\n";
pr "#define LIBNBD_HAVE_NBD_GET_ERRNO 1\n";
pr "\n";
+ print_cl...
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 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...lback) ";
print_cbarg_list cbargs;
pr ";\n";
+ pr "} nbd_%s_callback;\n" cbname;
+ pr "\n";
) all_closures;
+ pr "#define NBD_NULL_CALLBACK(name) ((nbd_## name ##_callback) { .callback = NULL })\n";
pr "\n"
let print_extern_and_define name args optargs ret =
@@ -3434,7 +3433,7 @@ let generate_include_libnbd_h () =
pr "extern int nbd_get_errno (void);\n";
pr "#define LIBNBD_HAVE_NBD_GET_ERRNO 1\n";
pr "\n";
- print_closure_typedefs ();
+ print_closure_structs ();
List.iter (
fun (n...
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 13
8
[PATCH libnbd 0/4] Add free function to callbacks.
Patches 1 & 2 are rather complex, but the end result is that we pass
closures + user_data + free function in single struct parameters as I
described previously in this email:
https://www.redhat.com/archives/libguestfs/2019-August/msg00210.html
Patch 3 adds a convenient FREE_CALLBACK macro which seems a worthwhile
simplification if you buy into 1 & 2.
Patch 4 adds another macro which is
2019 Jul 25
4
[PATCH libnbd v3 0/2] lib: Implement closure lifetimes.
I think I've addressed everything that was raised in review.
Some of the highlights:
- Callbacks should be freed reliably along all exit paths.
- There's a simple test of closure lifetimes.
- I've tried to use VALID|FREE in all the places where I'm confident
that it's safe and correct to do. There may be more places. Note
this is an optimization and shouldn't
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 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