Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests/bpf: Use __BYTE_ORDER__

Use the compiler-defined __BYTE_ORDER__ instead of the libc-defined
__BYTE_ORDER for consistency.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211026010831.748682-4-iii@linux.ibm.com

authored by

Ilya Leoshkevich and committed by
Andrii Nakryiko
06fca841 3930198d

+16 -16
+3 -3
tools/testing/selftests/bpf/prog_tests/btf_endian.c
··· 7 7 #include <bpf/btf.h> 8 8 9 9 void test_btf_endian() { 10 - #if __BYTE_ORDER == __LITTLE_ENDIAN 10 + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 11 11 enum btf_endianness endian = BTF_LITTLE_ENDIAN; 12 - #elif __BYTE_ORDER == __BIG_ENDIAN 12 + #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 13 13 enum btf_endianness endian = BTF_BIG_ENDIAN; 14 14 #else 15 - #error "Unrecognized __BYTE_ORDER" 15 + #error "Unrecognized __BYTE_ORDER__" 16 16 #endif 17 17 enum btf_endianness swap_endian = 1 - endian; 18 18 struct btf *btf = NULL, *swap_btf = NULL;
+2 -2
tools/testing/selftests/bpf/test_sysctl.c
··· 124 124 .descr = "ctx:write sysctl:write read ok narrow", 125 125 .insns = { 126 126 /* u64 w = (u16)write & 1; */ 127 - #if __BYTE_ORDER == __LITTLE_ENDIAN 127 + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 128 128 BPF_LDX_MEM(BPF_H, BPF_REG_7, BPF_REG_1, 129 129 offsetof(struct bpf_sysctl, write)), 130 130 #else ··· 184 184 .descr = "ctx:file_pos sysctl:read read ok narrow", 185 185 .insns = { 186 186 /* If (file_pos == X) */ 187 - #if __BYTE_ORDER == __LITTLE_ENDIAN 187 + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 188 188 BPF_LDX_MEM(BPF_B, BPF_REG_7, BPF_REG_1, 189 189 offsetof(struct bpf_sysctl, file_pos)), 190 190 #else
+7 -7
tools/testing/selftests/bpf/verifier/ctx_skb.c
··· 502 502 "check skb->hash byte load permitted", 503 503 .insns = { 504 504 BPF_MOV64_IMM(BPF_REG_0, 0), 505 - #if __BYTE_ORDER == __LITTLE_ENDIAN 505 + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 506 506 BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 507 507 offsetof(struct __sk_buff, hash)), 508 508 #else ··· 537 537 "check skb->hash byte load permitted 3", 538 538 .insns = { 539 539 BPF_MOV64_IMM(BPF_REG_0, 0), 540 - #if __BYTE_ORDER == __LITTLE_ENDIAN 540 + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 541 541 BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 542 542 offsetof(struct __sk_buff, hash) + 3), 543 543 #else ··· 646 646 "check skb->hash half load permitted", 647 647 .insns = { 648 648 BPF_MOV64_IMM(BPF_REG_0, 0), 649 - #if __BYTE_ORDER == __LITTLE_ENDIAN 649 + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 650 650 BPF_LDX_MEM(BPF_H, BPF_REG_0, BPF_REG_1, 651 651 offsetof(struct __sk_buff, hash)), 652 652 #else ··· 661 661 "check skb->hash half load permitted 2", 662 662 .insns = { 663 663 BPF_MOV64_IMM(BPF_REG_0, 0), 664 - #if __BYTE_ORDER == __LITTLE_ENDIAN 664 + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 665 665 BPF_LDX_MEM(BPF_H, BPF_REG_0, BPF_REG_1, 666 666 offsetof(struct __sk_buff, hash) + 2), 667 667 #else ··· 676 676 "check skb->hash half load not permitted, unaligned 1", 677 677 .insns = { 678 678 BPF_MOV64_IMM(BPF_REG_0, 0), 679 - #if __BYTE_ORDER == __LITTLE_ENDIAN 679 + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 680 680 BPF_LDX_MEM(BPF_H, BPF_REG_0, BPF_REG_1, 681 681 offsetof(struct __sk_buff, hash) + 1), 682 682 #else ··· 693 693 "check skb->hash half load not permitted, unaligned 3", 694 694 .insns = { 695 695 BPF_MOV64_IMM(BPF_REG_0, 0), 696 - #if __BYTE_ORDER == __LITTLE_ENDIAN 696 + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 697 697 BPF_LDX_MEM(BPF_H, BPF_REG_0, BPF_REG_1, 698 698 offsetof(struct __sk_buff, hash) + 3), 699 699 #else ··· 951 951 "check skb->data half load not permitted", 952 952 .insns = { 953 953 BPF_MOV64_IMM(BPF_REG_0, 0), 954 - #if __BYTE_ORDER == __LITTLE_ENDIAN 954 + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 955 955 BPF_LDX_MEM(BPF_H, BPF_REG_0, BPF_REG_1, 956 956 offsetof(struct __sk_buff, data)), 957 957 #else
+1 -1
tools/testing/selftests/bpf/verifier/lwt.c
··· 174 174 "check skb->tc_classid half load not permitted for lwt prog", 175 175 .insns = { 176 176 BPF_MOV64_IMM(BPF_REG_0, 0), 177 - #if __BYTE_ORDER == __LITTLE_ENDIAN 177 + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 178 178 BPF_LDX_MEM(BPF_H, BPF_REG_0, BPF_REG_1, 179 179 offsetof(struct __sk_buff, tc_classid)), 180 180 #else
+3 -3
tools/testing/selftests/bpf/verifier/perf_event_sample_period.c
··· 2 2 "check bpf_perf_event_data->sample_period byte load permitted", 3 3 .insns = { 4 4 BPF_MOV64_IMM(BPF_REG_0, 0), 5 - #if __BYTE_ORDER == __LITTLE_ENDIAN 5 + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 6 6 BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 7 7 offsetof(struct bpf_perf_event_data, sample_period)), 8 8 #else ··· 18 18 "check bpf_perf_event_data->sample_period half load permitted", 19 19 .insns = { 20 20 BPF_MOV64_IMM(BPF_REG_0, 0), 21 - #if __BYTE_ORDER == __LITTLE_ENDIAN 21 + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 22 22 BPF_LDX_MEM(BPF_H, BPF_REG_0, BPF_REG_1, 23 23 offsetof(struct bpf_perf_event_data, sample_period)), 24 24 #else ··· 34 34 "check bpf_perf_event_data->sample_period word load permitted", 35 35 .insns = { 36 36 BPF_MOV64_IMM(BPF_REG_0, 0), 37 - #if __BYTE_ORDER == __LITTLE_ENDIAN 37 + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 38 38 BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 39 39 offsetof(struct bpf_perf_event_data, sample_period)), 40 40 #else