tools/testing/nvdimm/test/iomap.c
Source file repositories/reference/linux-study-clean/tools/testing/nvdimm/test/iomap.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/nvdimm/test/iomap.c- Extension
.c- Size
- 10083 bytes
- Lines
- 401
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/memremap.hlinux/rculist.hlinux/export.hlinux/ioport.hlinux/module.hlinux/types.hlinux/acpi.hlinux/io.hlinux/mm.hnfit_test.h
Detected Declarations
function nfit_test_setupfunction nfit_test_teardownfunction nfit_test_killfunction dev_pagemap_percpu_releasefunction __wrap_devm_memunmapfunction __wrap_iounmapfunction __wrap_memunmapfunction nfit_devres_releasefunction matchfunction nfit_test_release_regionfunction list_for_each_entryfunction list_for_each_entryfunction __wrap_insert_resourcefunction __wrap_remove_resourcefunction __wrap___release_regionfunction __wrap___devm_release_regionfunction __wrap_acpi_evaluate_objectfunction __wrap_acpi_evaluate_dsmexport nfit_test_setupexport nfit_test_teardownexport get_nfit_resexport __wrap_devm_ioremapexport __wrap_devm_memremapexport __wrap_devm_memremap_pagesexport __wrap_memremapexport __wrap_devm_memunmapexport __wrap_ioremapexport __wrap_ioremap_wcexport __wrap_iounmapexport __wrap_memunmapexport __wrap___request_regionexport __wrap_insert_resourceexport __wrap_remove_resourceexport __wrap___devm_request_regionexport __wrap___release_regionexport __wrap___devm_release_regionexport __wrap_acpi_evaluate_objectexport __wrap_acpi_evaluate_dsm
Annotated Snippet
if (nfit_res) {
struct nfit_test_request *req;
struct resource *res = NULL;
if (dev) {
devres_release(dev, nfit_devres_release, match,
&start);
return true;
}
spin_lock(&nfit_res->lock);
list_for_each_entry(req, &nfit_res->requests, list)
if (req->res.start == start) {
res = &req->res;
list_del(&req->list);
break;
}
spin_unlock(&nfit_res->lock);
WARN(!res || resource_size(res) != n,
"%s: start: %llx n: %llx mismatch: %pr\n",
__func__, start, n, res);
if (res)
kfree(req);
return true;
}
}
return false;
}
static struct resource *nfit_test_request_region(struct device *dev,
struct resource *parent, resource_size_t start,
resource_size_t n, const char *name, int flags)
{
struct nfit_test_resource *nfit_res;
if (parent == &iomem_resource) {
nfit_res = get_nfit_res(start);
if (nfit_res) {
struct nfit_test_request *req;
struct resource *res = NULL;
if (start + n > nfit_res->res.start
+ resource_size(&nfit_res->res)) {
pr_debug("%s: start: %llx n: %llx overflow: %pr\n",
__func__, start, n,
&nfit_res->res);
return NULL;
}
spin_lock(&nfit_res->lock);
list_for_each_entry(req, &nfit_res->requests, list)
if (start == req->res.start) {
res = &req->res;
break;
}
spin_unlock(&nfit_res->lock);
if (res) {
WARN(1, "%pr already busy\n", res);
return NULL;
}
req = kzalloc(sizeof(*req), GFP_KERNEL);
if (!req)
return NULL;
INIT_LIST_HEAD(&req->list);
res = &req->res;
res->start = start;
res->end = start + n - 1;
res->name = name;
res->flags = resource_type(parent);
res->flags |= IORESOURCE_BUSY | flags;
spin_lock(&nfit_res->lock);
list_add(&req->list, &nfit_res->requests);
spin_unlock(&nfit_res->lock);
if (dev) {
struct resource **d;
d = devres_alloc(nfit_devres_release,
sizeof(struct resource *),
GFP_KERNEL);
if (!d)
return NULL;
*d = res;
devres_add(dev, d);
}
Annotation
- Immediate include surface: `linux/memremap.h`, `linux/rculist.h`, `linux/export.h`, `linux/ioport.h`, `linux/module.h`, `linux/types.h`, `linux/acpi.h`, `linux/io.h`.
- Detected declarations: `function nfit_test_setup`, `function nfit_test_teardown`, `function nfit_test_kill`, `function dev_pagemap_percpu_release`, `function __wrap_devm_memunmap`, `function __wrap_iounmap`, `function __wrap_memunmap`, `function nfit_devres_release`, `function match`, `function nfit_test_release_region`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: integration 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.