rust/helpers/pci.c
Source file repositories/reference/linux-study-clean/rust/helpers/pci.c
File Facts
- System
- Linux kernel
- Corpus path
rust/helpers/pci.c- Extension
.c- Size
- 1062 bytes
- Lines
- 47
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pci.h
Detected Declarations
function rust_helper_pci_dev_idfunction rust_helper_pci_resource_startfunction rust_helper_pci_resource_lenfunction rust_helper_dev_is_pcifunction rust_helper_pci_alloc_irq_vectorsfunction rust_helper_pci_free_irq_vectorsfunction rust_helper_pci_irq_vector
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include <linux/pci.h>
__rust_helper u16 rust_helper_pci_dev_id(struct pci_dev *dev)
{
return PCI_DEVID(dev->bus->number, dev->devfn);
}
__rust_helper resource_size_t
rust_helper_pci_resource_start(struct pci_dev *pdev, int bar)
{
return pci_resource_start(pdev, bar);
}
__rust_helper resource_size_t rust_helper_pci_resource_len(struct pci_dev *pdev,
int bar)
{
return pci_resource_len(pdev, bar);
}
__rust_helper bool rust_helper_dev_is_pci(const struct device *dev)
{
return dev_is_pci(dev);
}
#ifndef CONFIG_PCI_MSI
__rust_helper int rust_helper_pci_alloc_irq_vectors(struct pci_dev *dev,
unsigned int min_vecs,
unsigned int max_vecs,
unsigned int flags)
{
return pci_alloc_irq_vectors(dev, min_vecs, max_vecs, flags);
}
__rust_helper void rust_helper_pci_free_irq_vectors(struct pci_dev *dev)
{
pci_free_irq_vectors(dev);
}
__rust_helper int rust_helper_pci_irq_vector(struct pci_dev *pdev,
unsigned int nvec)
{
return pci_irq_vector(pdev, nvec);
}
#endif
Annotation
- Immediate include surface: `linux/pci.h`.
- Detected declarations: `function rust_helper_pci_dev_id`, `function rust_helper_pci_resource_start`, `function rust_helper_pci_resource_len`, `function rust_helper_dev_is_pci`, `function rust_helper_pci_alloc_irq_vectors`, `function rust_helper_pci_free_irq_vectors`, `function rust_helper_pci_irq_vector`.
- Atlas domain: Rust Kernel Layer / Rust API Membrane.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.