/* Copyright (c) 2017 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. */ #include <linux/slab.h> #include <linux/bpf.h> #include "map_in_map.h"
struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd) { struct bpf_map *inner_map, *inner_map_meta; struct fd f; f = fdget(inner_map_ufd); inner_map = __bpf_map_get(f); if (IS_ERR(inner_map)) return inner_map; /* prog_array->owner_prog_type and owner_jited * is a runtime binding. Doing static check alone * in the verifier is not enough. */ if (inner_map->map_type == BPF_MAP_TYPE_PROG_ARRAY) { fdput(f); return ERR_PTR(-ENOTSUPP); } /* Does not support >1 level map-in-map */ if (inner_map->inner_map_meta) { fdput(f); return ERR_PTR(-EINVAL); } inner_map_meta = kzalloc(sizeof(*inner_map_meta), GFP_USER); if (!inner_map_meta) { fdput(f); return ERR_PTR(-ENOMEM); } inner_map_meta->map_type = inner_map->map_type; inner_map_meta->key_size = inner_map->key_size; inner_map_meta->value_size = inner_map->value_size; inner_map_meta->map_flags = inner_map->map_flags; inner_map_meta->ops = inner_map->ops; inner_map_meta->max_entries = inner_map->max_entries; fdput(f); return inner_map_meta; }Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin KaFai Lau | 178 | 100.00% | 1 | 100.00% |
Total | 178 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Martin KaFai Lau | 15 | 100.00% | 1 | 100.00% |
Total | 15 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Martin KaFai Lau | 59 | 100.00% | 1 | 100.00% |
Total | 59 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Martin KaFai Lau | 90 | 100.00% | 1 | 100.00% |
Total | 90 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Martin KaFai Lau | 15 | 100.00% | 1 | 100.00% |
Total | 15 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Martin KaFai Lau | 21 | 100.00% | 1 | 100.00% |
Total | 21 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Martin KaFai Lau | 388 | 100.00% | 2 | 100.00% |
Total | 388 | 100.00% | 2 | 100.00% |