~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/lib/bpf/bpf_gen_internal.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */
  2 /* Copyright (c) 2021 Facebook */
  3 #ifndef __BPF_GEN_INTERNAL_H
  4 #define __BPF_GEN_INTERNAL_H
  5 
  6 #include "bpf.h"
  7 
  8 struct ksym_relo_desc {
  9         const char *name;
 10         int kind;
 11         int insn_idx;
 12         bool is_weak;
 13         bool is_typeless;
 14         bool is_ld64;
 15 };
 16 
 17 struct ksym_desc {
 18         const char *name;
 19         int ref;
 20         int kind;
 21         union {
 22                 /* used for kfunc */
 23                 int off;
 24                 /* used for typeless ksym */
 25                 bool typeless;
 26         };
 27         int insn;
 28         bool is_ld64;
 29 };
 30 
 31 struct bpf_gen {
 32         struct gen_loader_opts *opts;
 33         void *data_start;
 34         void *data_cur;
 35         void *insn_start;
 36         void *insn_cur;
 37         ssize_t cleanup_label;
 38         __u32 nr_progs;
 39         __u32 nr_maps;
 40         int log_level;
 41         int error;
 42         struct ksym_relo_desc *relos;
 43         int relo_cnt;
 44         struct bpf_core_relo *core_relos;
 45         int core_relo_cnt;
 46         char attach_target[128];
 47         int attach_kind;
 48         struct ksym_desc *ksyms;
 49         __u32 nr_ksyms;
 50         int fd_array;
 51         int nr_fd_array;
 52 };
 53 
 54 void bpf_gen__init(struct bpf_gen *gen, int log_level, int nr_progs, int nr_maps);
 55 int bpf_gen__finish(struct bpf_gen *gen, int nr_progs, int nr_maps);
 56 void bpf_gen__free(struct bpf_gen *gen);
 57 void bpf_gen__load_btf(struct bpf_gen *gen, const void *raw_data, __u32 raw_size);
 58 void bpf_gen__map_create(struct bpf_gen *gen,
 59                          enum bpf_map_type map_type, const char *map_name,
 60                          __u32 key_size, __u32 value_size, __u32 max_entries,
 61                          struct bpf_map_create_opts *map_attr, int map_idx);
 62 void bpf_gen__prog_load(struct bpf_gen *gen,
 63                         enum bpf_prog_type prog_type, const char *prog_name,
 64                         const char *license, struct bpf_insn *insns, size_t insn_cnt,
 65                         struct bpf_prog_load_opts *load_attr, int prog_idx);
 66 void bpf_gen__map_update_elem(struct bpf_gen *gen, int map_idx, void *value, __u32 value_size);
 67 void bpf_gen__map_freeze(struct bpf_gen *gen, int map_idx);
 68 void bpf_gen__record_attach_target(struct bpf_gen *gen, const char *name, enum bpf_attach_type type);
 69 void bpf_gen__record_extern(struct bpf_gen *gen, const char *name, bool is_weak,
 70                             bool is_typeless, bool is_ld64, int kind, int insn_idx);
 71 void bpf_gen__record_relo_core(struct bpf_gen *gen, const struct bpf_core_relo *core_relo);
 72 void bpf_gen__populate_outer_map(struct bpf_gen *gen, int outer_map_idx, int key, int inner_map_idx);
 73 
 74 #endif
 75 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php