linux/tools/testing/selftests/bpf/progs/test_pinning.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0
   2
   3#include <linux/bpf.h>
   4#include <bpf/bpf_helpers.h>
   5
   6int _version SEC("version") = 1;
   7
   8struct {
   9        __uint(type, BPF_MAP_TYPE_ARRAY);
  10        __uint(max_entries, 1);
  11        __type(key, __u32);
  12        __type(value, __u64);
  13        __uint(pinning, LIBBPF_PIN_BY_NAME);
  14} pinmap SEC(".maps");
  15
  16struct {
  17        __uint(type, BPF_MAP_TYPE_HASH);
  18        __uint(max_entries, 1);
  19        __type(key, __u32);
  20        __type(value, __u64);
  21} nopinmap SEC(".maps");
  22
  23struct {
  24        __uint(type, BPF_MAP_TYPE_HASH);
  25        __uint(max_entries, 1);
  26        __type(key, __u32);
  27        __type(value, __u64);
  28        __uint(pinning, LIBBPF_PIN_NONE);
  29} nopinmap2 SEC(".maps");
  30
  31char _license[] SEC("license") = "GPL";
  32