Lines Matching refs:map_fd

21 static void map_info(int map_fd, struct bpf_map_info *info)
28 ret = bpf_obj_get_info_by_fd(map_fd, info, &len);
50 static __u32 map_count_elements(__u32 type, int map_fd)
55 while (!bpf_map_get_next_key(map_fd, &key, &key))
62 static void delete_and_lookup_batch(int map_fd, void *keys, __u32 count)
69 ret = bpf_map_lookup_and_delete_batch(map_fd,
88 static void delete_all_elements(__u32 type, int map_fd, bool batch)
99 for (n = 0; !bpf_map_get_next_key(map_fd, &key, &key); n++)
107 delete_and_lookup_batch(map_fd, keys, n);
114 ret = bpf_map_delete_elem(map_fd, keyp);
118 ret = bpf_map_lookup_and_delete_elem(map_fd, keyp, val);
142 int map_fd;
149 int map_fd;
151 map_fd = bpf_map_create(BPF_MAP_TYPE_HASH, "small", 4, 4, 4, NULL);
152 CHECK(map_fd < 0, "bpf_map_create()", "error:%s (name=%s)\n",
155 return map_fd;
186 ret = map_update_retriable(opts->map_fd, &i, val_ptr, 0,
189 ret = bpf_map_update_elem(opts->map_fd, &i, val_ptr, 0);
263 static void check_expected_number_elements(__u32 n_inserted, int map_fd,
272 n_real = map_count_elements(info->type, map_fd);
291 static void __test(int map_fd)
294 .map_fd = map_fd,
298 map_info(map_fd, &info);
323 check_expected_number_elements(opts.n, map_fd, &info);
324 delete_all_elements(info.type, map_fd, !BATCH);
325 check_expected_number_elements(0, map_fd, &info);
329 check_expected_number_elements(opts.n, map_fd, &info);
330 delete_all_elements(info.type, map_fd, BATCH);
331 check_expected_number_elements(0, map_fd, &info);
333 close(map_fd);
341 int map_fd;
348 map_fd = bpf_map_create(type, name, key_size, val_size, max_entries, map_opts);
349 CHECK(map_fd < 0, "bpf_map_create()", "error:%s (name=%s)\n",
352 return map_fd;