[ovs-dev] [port-ranges 1/3] flow: Add a couple of missing build assertions on FLOW_WC_SEQ.
Ethan Jackson
ethan at nicira.com
Thu Feb 2 02:36:33 UTC 2012
Looks good.
Ethan
On Fri, Jan 27, 2012 at 17:18, Ben Pfaff <blp at nicira.com> wrote:
> Every piece of code that may need to change whenever struct flow or struct
> flow_wildcards changes, but might easily get overlooked, should have a
> build assertion on the value of FLOW_WC_SEQ, but these functions did not.
>
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
> lib/flow.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/lib/flow.c b/lib/flow.c
> index 29714b1..dc2bb1c 100644
> --- a/lib/flow.c
> +++ b/lib/flow.c
> @@ -699,6 +699,8 @@ flow_wildcards_combine(struct flow_wildcards *dst,
> {
> int i;
>
> + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 7);
> +
> dst->wildcards = src1->wildcards | src2->wildcards;
> dst->tun_id_mask = src1->tun_id_mask & src2->tun_id_mask;
> dst->nw_src_mask = src1->nw_src_mask & src2->nw_src_mask;
> @@ -732,6 +734,8 @@ flow_wildcards_equal(const struct flow_wildcards *a,
> {
> int i;
>
> + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 7);
> +
> if (a->wildcards != b->wildcards
> || a->tun_id_mask != b->tun_id_mask
> || a->nw_src_mask != b->nw_src_mask
> @@ -760,6 +764,8 @@ flow_wildcards_has_extra(const struct flow_wildcards *a,
> int i;
> struct in6_addr ipv6_masked;
>
> + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 7);
> +
> for (i = 0; i < FLOW_N_REGS; i++) {
> if ((a->reg_masks[i] & b->reg_masks[i]) != b->reg_masks[i]) {
> return true;
> --
> 1.7.2.5
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
More information about the dev
mailing list