drivers/nvdimm/nd.h
Source file repositories/reference/linux-study-clean/drivers/nvdimm/nd.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/nvdimm/nd.h- Extension
.h- Size
- 18582 bytes
- Lines
- 692
- Domain
- Driver Families
- Bucket
- drivers/nvdimm
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/libnvdimm.hlinux/badblocks.hlinux/blkdev.hlinux/device.hlinux/mutex.hlinux/ndctl.hlinux/types.hlinux/nd.hlabel.h
Detected Declarations
struct nvdimm_drvdatastruct nd_region_datastruct nd_label_entstruct nd_mappingstruct nd_lanestruct nd_regionstruct bttstruct nd_bttstruct nd_pfnstruct nd_daxstruct nvdimmstruct nd_gen_sbstruct rangeenum nd_label_flagsenum nd_mapping_lock_classenum nd_pfn_modeenum nd_async_modefunction nsl_get_slotfunction nsl_set_slotfunction nsl_get_checksumfunction nsl_set_checksumfunction nsl_get_flagsfunction nsl_set_flagsfunction nsl_get_dpafunction nsl_set_dpafunction nsl_get_rawsizefunction nsl_set_rawsizefunction nsl_get_isetcookiefunction nsl_set_isetcookiefunction nsl_validate_isetcookiefunction nsl_get_positionfunction nsl_set_positionfunction nsl_get_nlabelfunction nsl_set_nlabelfunction nsl_get_nrangefunction nsl_set_nrangefunction nsl_get_lbasizefunction nsl_set_lbasizefunction nsl_uuid_equalfunction ndrd_set_flush_wpqfunction nsl_validate_nlabelfunction nd_inc_seqfunction nd_info_block_reservefunction nvdimm_security_unlockfunction nd_btt_probefunction is_nd_bttfunction nd_pfn_probefunction is_nd_pfn
Annotated Snippet
struct nvdimm_drvdata {
struct device *dev;
int nslabel_size;
struct nd_cmd_get_config_size nsarea;
void *data;
bool cxl;
int ns_current, ns_next;
struct resource dpa;
struct kref kref;
};
static inline const u8 *nsl_ref_name(struct nvdimm_drvdata *ndd,
struct nd_namespace_label *nd_label)
{
if (ndd->cxl)
return nd_label->cxl.name;
return nd_label->efi.name;
}
static inline u8 *nsl_get_name(struct nvdimm_drvdata *ndd,
struct nd_namespace_label *nd_label, u8 *name)
{
if (ndd->cxl)
return memcpy(name, nd_label->cxl.name, NSLABEL_NAME_LEN);
return memcpy(name, nd_label->efi.name, NSLABEL_NAME_LEN);
}
static inline u8 *nsl_set_name(struct nvdimm_drvdata *ndd,
struct nd_namespace_label *nd_label, u8 *name)
{
if (!name)
return NULL;
if (ndd->cxl)
return memcpy(nd_label->cxl.name, name, NSLABEL_NAME_LEN);
return memcpy(nd_label->efi.name, name, NSLABEL_NAME_LEN);
}
static inline u32 nsl_get_slot(struct nvdimm_drvdata *ndd,
struct nd_namespace_label *nd_label)
{
if (ndd->cxl)
return __le32_to_cpu(nd_label->cxl.slot);
return __le32_to_cpu(nd_label->efi.slot);
}
static inline void nsl_set_slot(struct nvdimm_drvdata *ndd,
struct nd_namespace_label *nd_label, u32 slot)
{
if (ndd->cxl)
nd_label->cxl.slot = __cpu_to_le32(slot);
else
nd_label->efi.slot = __cpu_to_le32(slot);
}
static inline u64 nsl_get_checksum(struct nvdimm_drvdata *ndd,
struct nd_namespace_label *nd_label)
{
if (ndd->cxl)
return __le64_to_cpu(nd_label->cxl.checksum);
return __le64_to_cpu(nd_label->efi.checksum);
}
static inline void nsl_set_checksum(struct nvdimm_drvdata *ndd,
struct nd_namespace_label *nd_label,
u64 checksum)
{
if (ndd->cxl)
nd_label->cxl.checksum = __cpu_to_le64(checksum);
else
nd_label->efi.checksum = __cpu_to_le64(checksum);
}
static inline u32 nsl_get_flags(struct nvdimm_drvdata *ndd,
struct nd_namespace_label *nd_label)
{
if (ndd->cxl)
return __le32_to_cpu(nd_label->cxl.flags);
return __le32_to_cpu(nd_label->efi.flags);
}
static inline void nsl_set_flags(struct nvdimm_drvdata *ndd,
struct nd_namespace_label *nd_label, u32 flags)
{
if (ndd->cxl)
nd_label->cxl.flags = __cpu_to_le32(flags);
else
nd_label->efi.flags = __cpu_to_le32(flags);
}
static inline u64 nsl_get_dpa(struct nvdimm_drvdata *ndd,
Annotation
- Immediate include surface: `linux/libnvdimm.h`, `linux/badblocks.h`, `linux/blkdev.h`, `linux/device.h`, `linux/mutex.h`, `linux/ndctl.h`, `linux/types.h`, `linux/nd.h`.
- Detected declarations: `struct nvdimm_drvdata`, `struct nd_region_data`, `struct nd_label_ent`, `struct nd_mapping`, `struct nd_lane`, `struct nd_region`, `struct btt`, `struct nd_btt`, `struct nd_pfn`, `struct nd_dax`.
- Atlas domain: Driver Families / drivers/nvdimm.
- 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.