On 03/14/2015 05:59 AM, Alexei Starovoitov wrote:
also note that this case and twsk_build_assert are different.
twsk_build_assert has no other choice then to have one function
that covers logic in the whole file, whereas in this patch:
+ BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, mark) != 4);
+ *insn++ = BPF_LDX_MEM(BPF_W, dst_reg, src_reg,
+ offsetof(struct sk_buff, mark));
the build_bug_on protect the line directly below.
Separating them just doesn't make sense at all.
I also like the above approach better, I only suggested that as a
possible alternative since you were saying earlier in this thread:
I thought about it, but didn't add it, since we already have them
in the same file several lines above this spot. I think one build
error per .c file should be enough to attract attention. Though
I'll add a comment to convert_bpf_extensions() that build_bug_on
errors should be addressed in two places.