test_pinning.c 617 字节
Newer Older
1 2 3
// SPDX-License-Identifier: GPL-2.0

#include <linux/bpf.h>
4
#include <bpf/bpf_helpers.h>
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

struct {
	__uint(type, BPF_MAP_TYPE_ARRAY);
	__uint(max_entries, 1);
	__type(key, __u32);
	__type(value, __u64);
	__uint(pinning, LIBBPF_PIN_BY_NAME);
} pinmap SEC(".maps");

struct {
	__uint(type, BPF_MAP_TYPE_HASH);
	__uint(max_entries, 1);
	__type(key, __u32);
	__type(value, __u64);
} nopinmap SEC(".maps");

struct {
22
	__uint(type, BPF_MAP_TYPE_HASH);
23 24 25 26 27 28 29
	__uint(max_entries, 1);
	__type(key, __u32);
	__type(value, __u64);
	__uint(pinning, LIBBPF_PIN_NONE);
} nopinmap2 SEC(".maps");

char _license[] SEC("license") = "GPL";