rust/helpers/atomic.c
Source file repositories/reference/linux-study-clean/rust/helpers/atomic.c
File Facts
- System
- Linux kernel
- Corpus path
rust/helpers/atomic.c- Extension
.c- Size
- 19918 bytes
- Lines
- 1036
- Domain
- Rust Kernel Layer
- Bucket
- Rust API Membrane
- Inferred role
- Rust Kernel Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
Rust-side wrappers and abstractions around kernel C APIs, ownership contracts, allocation, synchronization, and module integration.
- Rust-side wrappers and abstractions around kernel C APIs, ownership contracts, allocation, synchronization, and module integration.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
Dependency Surface
linux/atomic.h
Detected Declarations
function rust_helper_atomic_readfunction rust_helper_atomic_read_acquirefunction rust_helper_atomic_setfunction rust_helper_atomic_set_releasefunction rust_helper_atomic_addfunction rust_helper_atomic_add_returnfunction rust_helper_atomic_add_return_acquirefunction rust_helper_atomic_add_return_releasefunction rust_helper_atomic_add_return_relaxedfunction rust_helper_atomic_fetch_addfunction rust_helper_atomic_fetch_add_acquirefunction rust_helper_atomic_fetch_add_releasefunction rust_helper_atomic_fetch_add_relaxedfunction rust_helper_atomic_subfunction rust_helper_atomic_sub_returnfunction rust_helper_atomic_sub_return_acquirefunction rust_helper_atomic_sub_return_releasefunction rust_helper_atomic_sub_return_relaxedfunction rust_helper_atomic_fetch_subfunction rust_helper_atomic_fetch_sub_acquirefunction rust_helper_atomic_fetch_sub_releasefunction rust_helper_atomic_fetch_sub_relaxedfunction rust_helper_atomic_incfunction rust_helper_atomic_inc_returnfunction rust_helper_atomic_inc_return_acquirefunction rust_helper_atomic_inc_return_releasefunction rust_helper_atomic_inc_return_relaxedfunction rust_helper_atomic_fetch_incfunction rust_helper_atomic_fetch_inc_acquirefunction rust_helper_atomic_fetch_inc_releasefunction rust_helper_atomic_fetch_inc_relaxedfunction rust_helper_atomic_decfunction rust_helper_atomic_dec_returnfunction rust_helper_atomic_dec_return_acquirefunction rust_helper_atomic_dec_return_releasefunction rust_helper_atomic_dec_return_relaxedfunction rust_helper_atomic_fetch_decfunction rust_helper_atomic_fetch_dec_acquirefunction rust_helper_atomic_fetch_dec_releasefunction rust_helper_atomic_fetch_dec_relaxedfunction rust_helper_atomic_andfunction rust_helper_atomic_fetch_andfunction rust_helper_atomic_fetch_and_acquirefunction rust_helper_atomic_fetch_and_releasefunction rust_helper_atomic_fetch_and_relaxedfunction rust_helper_atomic_andnotfunction rust_helper_atomic_fetch_andnotfunction rust_helper_atomic_fetch_andnot_acquire
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
// Generated by scripts/atomic/gen-rust-atomic-helpers.sh
// DO NOT MODIFY THIS FILE DIRECTLY
/*
* This file provides helpers for the various atomic functions for Rust.
*/
#ifndef _RUST_ATOMIC_API_H
#define _RUST_ATOMIC_API_H
#include <linux/atomic.h>
__rust_helper int
rust_helper_atomic_read(const atomic_t *v)
{
return atomic_read(v);
}
__rust_helper int
rust_helper_atomic_read_acquire(const atomic_t *v)
{
return atomic_read_acquire(v);
}
__rust_helper void
rust_helper_atomic_set(atomic_t *v, int i)
{
atomic_set(v, i);
}
__rust_helper void
rust_helper_atomic_set_release(atomic_t *v, int i)
{
atomic_set_release(v, i);
}
__rust_helper void
rust_helper_atomic_add(int i, atomic_t *v)
{
atomic_add(i, v);
}
__rust_helper int
rust_helper_atomic_add_return(int i, atomic_t *v)
{
return atomic_add_return(i, v);
}
__rust_helper int
rust_helper_atomic_add_return_acquire(int i, atomic_t *v)
{
return atomic_add_return_acquire(i, v);
}
__rust_helper int
rust_helper_atomic_add_return_release(int i, atomic_t *v)
{
return atomic_add_return_release(i, v);
}
__rust_helper int
rust_helper_atomic_add_return_relaxed(int i, atomic_t *v)
{
return atomic_add_return_relaxed(i, v);
}
__rust_helper int
rust_helper_atomic_fetch_add(int i, atomic_t *v)
{
return atomic_fetch_add(i, v);
}
__rust_helper int
rust_helper_atomic_fetch_add_acquire(int i, atomic_t *v)
{
return atomic_fetch_add_acquire(i, v);
}
__rust_helper int
rust_helper_atomic_fetch_add_release(int i, atomic_t *v)
{
return atomic_fetch_add_release(i, v);
}
__rust_helper int
rust_helper_atomic_fetch_add_relaxed(int i, atomic_t *v)
{
return atomic_fetch_add_relaxed(i, v);
}
Annotation
- Immediate include surface: `linux/atomic.h`.
- Detected declarations: `function rust_helper_atomic_read`, `function rust_helper_atomic_read_acquire`, `function rust_helper_atomic_set`, `function rust_helper_atomic_set_release`, `function rust_helper_atomic_add`, `function rust_helper_atomic_add_return`, `function rust_helper_atomic_add_return_acquire`, `function rust_helper_atomic_add_return_release`, `function rust_helper_atomic_add_return_relaxed`, `function rust_helper_atomic_fetch_add`.
- Atlas domain: Rust Kernel Layer / Rust API Membrane.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.