root/tools/testing/selftests/bpf/progs/test_core_reloc_ints.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. SEC

   1 // SPDX-License-Identifier: GPL-2.0
   2 // Copyright (c) 2019 Facebook
   3 
   4 #include <linux/bpf.h>
   5 #include <stdint.h>
   6 #include "bpf_helpers.h"
   7 
   8 char _license[] SEC("license") = "GPL";
   9 
  10 static volatile struct data {
  11         char in[256];
  12         char out[256];
  13 } data;
  14 
  15 struct core_reloc_ints {
  16         uint8_t         u8_field;
  17         int8_t          s8_field;
  18         uint16_t        u16_field;
  19         int16_t         s16_field;
  20         uint32_t        u32_field;
  21         int32_t         s32_field;
  22         uint64_t        u64_field;
  23         int64_t         s64_field;
  24 };
  25 
  26 SEC("raw_tracepoint/sys_enter")
  27 int test_core_ints(void *ctx)
  28 {
  29         struct core_reloc_ints *in = (void *)&data.in;
  30         struct core_reloc_ints *out = (void *)&data.out;
  31 
  32         if (BPF_CORE_READ(&out->u8_field, &in->u8_field) ||
  33             BPF_CORE_READ(&out->s8_field, &in->s8_field) ||
  34             BPF_CORE_READ(&out->u16_field, &in->u16_field) ||
  35             BPF_CORE_READ(&out->s16_field, &in->s16_field) ||
  36             BPF_CORE_READ(&out->u32_field, &in->u32_field) ||
  37             BPF_CORE_READ(&out->s32_field, &in->s32_field) ||
  38             BPF_CORE_READ(&out->u64_field, &in->u64_field) ||
  39             BPF_CORE_READ(&out->s64_field, &in->s64_field))
  40                 return 1;
  41 
  42         return 0;
  43 }
  44 

/* [<][>][^][v][top][bottom][index][help] */