tools/testing/selftests/bpf/prog_tests/lookup_and_delete.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/prog_tests/lookup_and_delete.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/prog_tests/lookup_and_delete.c- Extension
.c- Size
- 7373 bytes
- Lines
- 292
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
test_progs.htest_lookup_and_delete.skel.h
Detected Declarations
function fill_valuesfunction fill_values_percpufunction trigger_tpfunction test_lookup_and_delete_hashfunction test_lookup_and_delete_percpu_hashfunction test_lookup_and_delete_lru_hashfunction test_lookup_and_delete_lru_percpu_hashfunction test_lookup_and_delete
Annotated Snippet
if (val) {
if (CHECK(val != NEW_VALUE, "map value",
"unexpected for cpu %d: %lld\n", i, val))
goto cleanup;
cpucnt++;
}
}
if (CHECK(cpucnt != 1, "map value", "set for %d CPUs instead of 1!\n",
cpucnt))
goto cleanup;
/* Check that entries 3 and 1 are non existent. */
err = bpf_map_lookup_elem(map_fd, &key, &value);
if (!ASSERT_ERR(err, "bpf_map_lookup_elem"))
goto cleanup;
key = 1;
err = bpf_map_lookup_elem(map_fd, &key, &value);
if (!ASSERT_ERR(err, "bpf_map_lookup_elem"))
goto cleanup;
cleanup:
test_lookup_and_delete__destroy(skel);
}
void test_lookup_and_delete(void)
{
nr_cpus = bpf_num_possible_cpus();
if (test__start_subtest("lookup_and_delete"))
test_lookup_and_delete_hash();
if (test__start_subtest("lookup_and_delete_percpu"))
test_lookup_and_delete_percpu_hash();
if (test__start_subtest("lookup_and_delete_lru"))
test_lookup_and_delete_lru_hash();
if (test__start_subtest("lookup_and_delete_lru_percpu"))
test_lookup_and_delete_lru_percpu_hash();
}
Annotation
- Immediate include surface: `test_progs.h`, `test_lookup_and_delete.skel.h`.
- Detected declarations: `function fill_values`, `function fill_values_percpu`, `function trigger_tp`, `function test_lookup_and_delete_hash`, `function test_lookup_and_delete_percpu_hash`, `function test_lookup_and_delete_lru_hash`, `function test_lookup_and_delete_lru_percpu_hash`, `function test_lookup_and_delete`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.