rust/helpers/io.c
Source file repositories/reference/linux-study-clean/rust/helpers/io.c
File Facts
- System
- Linux kernel
- Corpus path
rust/helpers/io.c- Extension
.c- Size
- 3040 bytes
- Lines
- 147
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/io.hlinux/ioport.h
Detected Declarations
function rust_helper_iounmapfunction rust_helper_readbfunction rust_helper_readwfunction rust_helper_readlfunction rust_helper_readqfunction rust_helper_writebfunction rust_helper_writewfunction rust_helper_writelfunction rust_helper_writeqfunction rust_helper_readb_relaxedfunction rust_helper_readw_relaxedfunction rust_helper_readl_relaxedfunction rust_helper_readq_relaxedfunction rust_helper_writeb_relaxedfunction rust_helper_writew_relaxedfunction rust_helper_writel_relaxedfunction rust_helper_writeq_relaxedfunction rust_helper_resource_sizefunction rust_helper_request_mem_regionfunction rust_helper_release_mem_regionfunction rust_helper_request_muxed_regionfunction rust_helper_release_region
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include <linux/io.h>
#include <linux/ioport.h>
__rust_helper void __iomem *rust_helper_ioremap(phys_addr_t offset, size_t size)
{
return ioremap(offset, size);
}
__rust_helper void __iomem *rust_helper_ioremap_np(phys_addr_t offset,
size_t size)
{
return ioremap_np(offset, size);
}
__rust_helper void rust_helper_iounmap(void __iomem *addr)
{
iounmap(addr);
}
__rust_helper u8 rust_helper_readb(const void __iomem *addr)
{
return readb(addr);
}
__rust_helper u16 rust_helper_readw(const void __iomem *addr)
{
return readw(addr);
}
__rust_helper u32 rust_helper_readl(const void __iomem *addr)
{
return readl(addr);
}
#ifdef CONFIG_64BIT
__rust_helper u64 rust_helper_readq(const void __iomem *addr)
{
return readq(addr);
}
#endif
__rust_helper void rust_helper_writeb(u8 value, void __iomem *addr)
{
writeb(value, addr);
}
__rust_helper void rust_helper_writew(u16 value, void __iomem *addr)
{
writew(value, addr);
}
__rust_helper void rust_helper_writel(u32 value, void __iomem *addr)
{
writel(value, addr);
}
#ifdef CONFIG_64BIT
__rust_helper void rust_helper_writeq(u64 value, void __iomem *addr)
{
writeq(value, addr);
}
#endif
__rust_helper u8 rust_helper_readb_relaxed(const void __iomem *addr)
{
return readb_relaxed(addr);
}
__rust_helper u16 rust_helper_readw_relaxed(const void __iomem *addr)
{
return readw_relaxed(addr);
}
__rust_helper u32 rust_helper_readl_relaxed(const void __iomem *addr)
{
return readl_relaxed(addr);
}
#ifdef CONFIG_64BIT
__rust_helper u64 rust_helper_readq_relaxed(const void __iomem *addr)
{
return readq_relaxed(addr);
}
#endif
__rust_helper void rust_helper_writeb_relaxed(u8 value, void __iomem *addr)
{
writeb_relaxed(value, addr);
Annotation
- Immediate include surface: `linux/io.h`, `linux/ioport.h`.
- Detected declarations: `function rust_helper_iounmap`, `function rust_helper_readb`, `function rust_helper_readw`, `function rust_helper_readl`, `function rust_helper_readq`, `function rust_helper_writeb`, `function rust_helper_writew`, `function rust_helper_writel`, `function rust_helper_writeq`, `function rust_helper_readb_relaxed`.
- Atlas domain: Rust Kernel Layer / Rust API Membrane.
- 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.