search for: print_flags_check

Displaying 13 results from an estimated 13 matches for "print_flags_check".

2019 Aug 10
0
[PATCH libnbd 7/9] generator: On entry to API functions, check Flags and OFlags parameters.
...++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/generator/generator b/generator/generator index 96d1148..a6aea26 100755 --- a/generator/generator +++ b/generator/generator @@ -3689,6 +3689,19 @@ let generate_lib_api_c () = ); (* Check parameters are valid. *) + let print_flags_check n { flag_prefix; flags } = + let value = match errcode with + | Some value -> value + | None -> assert false in + let mask = List.fold_left (lor) 0 (List.map snd flags) in + pr " if ((%s & ~%d) != 0) {\n" n mask; + pr " set_error (EINVA...
2020 Sep 11
0
[libnbd PATCH v2 2/5] generator: Refactor filtering of accepted OFlags
..."%s%s_callback" mark cbname - | OFlags (n, _) -> + | OFlags (n, _, _) -> if types then pr "uint32_t "; pr "%s" n ) optargs @@ -494,11 +494,21 @@ let generate_lib_api_c () = ); (* Check parameters are valid. *) - let print_flags_check n { flag_prefix } = + let print_flags_check n { flag_prefix; flags } subset = let value = match errcode with | Some value -> value | None -> assert false in - pr " if (unlikely ((%s & ~LIBNBD_%s_MASK) != 0)) {\n" n flag_prefix; + let mask =...
2020 Sep 11
10
[libnbd PATCH v2 0/5] Add knobs for client- vs. server-side validation
In v2: - now based on my proposal to add LIBNBD_SHUTDOWN_IMMEDIATE - four flags instead of two: STRICT_FLAGS is new (patch 4), and STRICT_BOUNDS is separate from STRICT_ZERO_SIZE (patch 5) - various refactorings for more shared code and less duplication Eric Blake (5): api: Add xxx_MASK constant for each Flags type generator: Refactor filtering of accepted OFlags api: Add
2019 Aug 10
2
Re: [PATCH libnbd 7/9] generator: On entry to API functions, check Flags and OFlags parameters.
.... > > diff --git a/generator/generator b/generator/generator > index 96d1148..a6aea26 100755 > --- a/generator/generator > +++ b/generator/generator > @@ -3689,6 +3689,19 @@ let generate_lib_api_c () = > ); > > (* Check parameters are valid. *) > + let print_flags_check n { flag_prefix; flags } = > + let value = match errcode with > + | Some value -> value > + | None -> assert false in > + let mask = List.fold_left (lor) 0 (List.map snd flags) in > + pr " if ((%s & ~%d) != 0) {\n" n mask; > +...
2020 Sep 11
0
[libnbd PATCH v2 4/5] api: Add STRICT_FLAGS to set_strict_mode
...* int) list (** flag names and their values in C *) } and permitted_state = diff --git a/generator/C.ml b/generator/C.ml index 86d9c5c..5f68b14 100644 --- a/generator/C.ml +++ b/generator/C.ml @@ -494,7 +494,7 @@ let generate_lib_api_c () = ); (* Check parameters are valid. *) - let print_flags_check n { flag_prefix; flags } subset = + let print_flags_check n { flag_prefix; flags; guard } subset = let value = match errcode with | Some value -> value | None -> assert false in @@ -508,7 +508,10 @@ let generate_lib_api_c () = ) flags; sprin...
2020 Sep 11
0
[libnbd PATCH v2 1/5] api: Add xxx_MASK constant for each Flags type
...) flags; + let flag = sprintf "LIBNBD_%s_MASK" flag_prefix in + pr "#define %-40s 0x%02x\n" flag !mask; pr "\n" ) all_flags; List.iter ( @@ -490,13 +494,12 @@ let generate_lib_api_c () = ); (* Check parameters are valid. *) - let print_flags_check n { flag_prefix; flags } = + let print_flags_check n { flag_prefix } = let value = match errcode with | Some value -> value | None -> assert false in - let mask = List.fold_left (lor) 0 (List.map snd flags) in - pr " if (unlikely ((%s & ~%d) !=...
2019 Aug 11
0
Re: [PATCH libnbd 7/9] generator: On entry to API functions, check Flags and OFlags parameters.
...erator b/generator/generator > > index 96d1148..a6aea26 100755 > > --- a/generator/generator > > +++ b/generator/generator > > @@ -3689,6 +3689,19 @@ let generate_lib_api_c () = > > ); > > > > (* Check parameters are valid. *) > > + let print_flags_check n { flag_prefix; flags } = > > + let value = match errcode with > > + | Some value -> value > > + | None -> assert false in > > + let mask = List.fold_left (lor) 0 (List.map snd flags) in > > + pr " if ((%s & ~%d) != 0) {\n&...
2020 Sep 17
2
Re: [libnbd PATCH v2 4/5] api: Add STRICT_FLAGS to set_strict_mode
...; } > and permitted_state = > diff --git a/generator/C.ml b/generator/C.ml > index 86d9c5c..5f68b14 100644 > --- a/generator/C.ml > +++ b/generator/C.ml > @@ -494,7 +494,7 @@ let generate_lib_api_c () = > ); > > (* Check parameters are valid. *) > - let print_flags_check n { flag_prefix; flags } subset = > + let print_flags_check n { flag_prefix; flags; guard } subset = > let value = match errcode with > | Some value -> value > | None -> assert false in > @@ -508,7 +508,10 @@ let generate_lib_api_c () = >...
2019 Aug 13
0
[PATCH libnbd 5/6] generator: Implement OClosure.
...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_flags_check n flags ) optargs; @@ -3756,6 +3754,7 @@ let generate_lib_api_c () = ) args; List.iter ( function + | OClosure { cbname } -> pr " %s=%%s" cbname | OFlags (n, _) -> pr " %s=0x%%x" n ) optargs; pr "\""; @@ -3778,6 +3...
2019 Aug 13
0
[PATCH libnbd v2 1/3] generator: Implement OClosure.
...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_flags_check n flags ) optargs; @@ -3767,6 +3766,7 @@ let generate_lib_api_c () = ) args; List.iter ( function + | OClosure { cbname } -> pr " %s=%%s" cbname | OFlags (n, _) -> pr " %s=0x%%x" n ) optargs; pr "\""; @@ -3789,6 +3...
2019 Aug 10
17
[PATCH libnbd 0/9] Add Enum and Flags types.
This largish series adds several new features to the generator. Enum maps to enumerated types (like enum in C). The only current use for this is replacing the nbd_set_tls (nbd, 0/1/2) parameter with LIBNBD_TLS_DISABLE, LIBNBD_TLS_ALLOW, LIBNBD_TLS_REQUIRE (and natural equivalents in other programming languages). Flags maps to any uint32_t bitmask. It is basically a non-optional, generalized
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 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