• Home
  • Raw
  • Download

Lines Matching refs:cands

7700 	} cands[];  member
7703 static void bpf_free_cands(struct bpf_cand_cache *cands) in bpf_free_cands() argument
7705 if (!cands->cnt) in bpf_free_cands()
7708 kfree(cands); in bpf_free_cands()
7711 static void bpf_free_cands_from_cache(struct bpf_cand_cache *cands) in bpf_free_cands_from_cache() argument
7713 kfree(cands->name); in bpf_free_cands_from_cache()
7714 kfree(cands); in bpf_free_cands_from_cache()
7738 bpf_log(log, "%d", cc->cands[j].id); in __print_cand_cache()
7757 static u32 hash_cands(struct bpf_cand_cache *cands) in hash_cands() argument
7759 return jhash(cands->name, cands->name_len, 0); in hash_cands()
7762 static struct bpf_cand_cache *check_cand_cache(struct bpf_cand_cache *cands, in check_cand_cache() argument
7766 struct bpf_cand_cache *cc = cache[hash_cands(cands) % cache_size]; in check_cand_cache()
7768 if (cc && cc->name_len == cands->name_len && in check_cand_cache()
7769 !strncmp(cc->name, cands->name, cands->name_len)) in check_cand_cache()
7776 return offsetof(struct bpf_cand_cache, cands[cnt]); in sizeof_cands()
7779 static struct bpf_cand_cache *populate_cand_cache(struct bpf_cand_cache *cands, in populate_cand_cache() argument
7783 struct bpf_cand_cache **cc = &cache[hash_cands(cands) % cache_size], *new_cands; in populate_cand_cache()
7789 new_cands = kmemdup(cands, sizeof_cands(cands->cnt), GFP_KERNEL); in populate_cand_cache()
7791 bpf_free_cands(cands); in populate_cand_cache()
7797 new_cands->name = kmemdup_nul(cands->name, cands->name_len, GFP_KERNEL); in populate_cand_cache()
7798 bpf_free_cands(cands); in populate_cand_cache()
7831 if (cc->cands[j].btf == btf) { in __purge_cand_cache()
7849 bpf_core_add_cands(struct bpf_cand_cache *cands, const struct btf *targ_btf, in bpf_core_add_cands() argument
7861 if (btf_kind(t) != cands->kind) in bpf_core_add_cands()
7873 if (strncmp(cands->name, targ_name, cands->name_len) != 0) in bpf_core_add_cands()
7877 if (targ_essent_len != cands->name_len) in bpf_core_add_cands()
7881 new_cands = kmalloc(sizeof_cands(cands->cnt + 1), GFP_KERNEL); in bpf_core_add_cands()
7883 bpf_free_cands(cands); in bpf_core_add_cands()
7887 memcpy(new_cands, cands, sizeof_cands(cands->cnt)); in bpf_core_add_cands()
7888 bpf_free_cands(cands); in bpf_core_add_cands()
7889 cands = new_cands; in bpf_core_add_cands()
7890 cands->cands[cands->cnt].btf = targ_btf; in bpf_core_add_cands()
7891 cands->cands[cands->cnt].id = i; in bpf_core_add_cands()
7892 cands->cnt++; in bpf_core_add_cands()
7894 return cands; in bpf_core_add_cands()
7900 struct bpf_cand_cache *cands, *cc, local_cand = {}; in bpf_core_find_cands() local
7924 cands = &local_cand; in bpf_core_find_cands()
7925 cands->name = name; in bpf_core_find_cands()
7926 cands->kind = btf_kind(local_type); in bpf_core_find_cands()
7927 cands->name_len = local_essent_len; in bpf_core_find_cands()
7929 cc = check_cand_cache(cands, vmlinux_cand_cache, VMLINUX_CAND_CACHE_SIZE); in bpf_core_find_cands()
7938 cands = bpf_core_add_cands(cands, main_btf, 1); in bpf_core_find_cands()
7939 if (IS_ERR(cands)) in bpf_core_find_cands()
7940 return ERR_CAST(cands); in bpf_core_find_cands()
7945 cc = populate_cand_cache(cands, vmlinux_cand_cache, VMLINUX_CAND_CACHE_SIZE); in bpf_core_find_cands()
7955 cc = check_cand_cache(cands, module_cand_cache, MODULE_CAND_CACHE_SIZE); in bpf_core_find_cands()
7970 cands = bpf_core_add_cands(cands, mod_btf, btf_nr_types(main_btf)); in bpf_core_find_cands()
7972 if (IS_ERR(cands)) in bpf_core_find_cands()
7973 return ERR_CAST(cands); in bpf_core_find_cands()
7982 return populate_cand_cache(cands, module_cand_cache, MODULE_CAND_CACHE_SIZE); in bpf_core_find_cands()
7989 struct bpf_core_cand_list cands = {}; in bpf_core_apply() local
8014 cands.cands = kcalloc(cc->cnt, sizeof(*cands.cands), GFP_KERNEL); in bpf_core_apply()
8015 if (!cands.cands) { in bpf_core_apply()
8023 btf_kind_str[cc->kind], cc->name, cc->cands[i].id); in bpf_core_apply()
8024 cands.cands[i].btf = cc->cands[i].btf; in bpf_core_apply()
8025 cands.cands[i].id = cc->cands[i].id; in bpf_core_apply()
8027 cands.len = cc->cnt; in bpf_core_apply()
8035 err = bpf_core_calc_relo_insn((void *)ctx->log, relo, relo_idx, ctx->btf, &cands, specs, in bpf_core_apply()
8046 kfree(cands.cands); in bpf_core_apply()