]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
libbpf.h: add BPF_JMP_A macro
authorRoman Gushchin <guro@fb.com>
Thu, 23 Aug 2018 17:45:26 +0000 (10:45 -0700)
committerRoman Gushchin <guro@fb.com>
Tue, 9 Oct 2018 16:46:36 +0000 (09:46 -0700)
Add unconditional jump macro to use in generated bpf programs.

src/shared/linux/libbpf.h

index ad131fcb12c3f8a248319aa688a1d5e0b9244115..391eee5a4e35667c0bb0b032abb2a996b198fad4 100644 (file)
@@ -174,6 +174,16 @@ struct bpf_insn;
                 .off   = OFF,                                  \
                 .imm   = IMM })
 
+/* Unconditional jumps */
+
+#define BPF_JMP_A(OFF)                                         \
+        ((struct bpf_insn) {                                   \
+                .code  = BPF_JMP | BPF_JA,                     \
+                .dst_reg = 0,                                  \
+                .src_reg = 0,                                  \
+                .off   = OFF,                                  \
+                .imm   = 0 })
+
 /* Raw code statement block */
 
 #define BPF_RAW_INSN(CODE, DST, SRC, OFF, IMM)                 \