tools/testing/selftests/bpf/progs/crypto_common.h
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/crypto_common.h
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/crypto_common.h- Extension
.h- Size
- 1735 bytes
- Lines
- 67
- 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
errno.hstdbool.h
Detected Declarations
struct __crypto_ctx_valuestruct array_mapfunction crypto_ctx_insert
Annotated Snippet
struct __crypto_ctx_value {
struct bpf_crypto_ctx __kptr * ctx;
};
struct array_map {
__uint(type, BPF_MAP_TYPE_ARRAY);
__type(key, int);
__type(value, struct __crypto_ctx_value);
__uint(max_entries, 1);
} __crypto_ctx_map SEC(".maps");
static inline struct __crypto_ctx_value *crypto_ctx_value_lookup(void)
{
u32 key = 0;
return bpf_map_lookup_elem(&__crypto_ctx_map, &key);
}
static inline int crypto_ctx_insert(struct bpf_crypto_ctx *ctx)
{
struct __crypto_ctx_value local, *v;
struct bpf_crypto_ctx *old;
u32 key = 0;
int err;
local.ctx = NULL;
err = bpf_map_update_elem(&__crypto_ctx_map, &key, &local, 0);
if (err) {
bpf_crypto_ctx_release(ctx);
return err;
}
v = bpf_map_lookup_elem(&__crypto_ctx_map, &key);
if (!v) {
bpf_crypto_ctx_release(ctx);
return -ENOENT;
}
old = bpf_kptr_xchg(&v->ctx, ctx);
if (old) {
bpf_crypto_ctx_release(old);
return -EEXIST;
}
return 0;
}
#endif /* _CRYPTO_COMMON_H */
Annotation
- Immediate include surface: `errno.h`, `stdbool.h`.
- Detected declarations: `struct __crypto_ctx_value`, `struct array_map`, `function crypto_ctx_insert`.
- 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.