diff options
author | Dan Williams <dan.j.williams@intel.com> | 2021-09-09 07:11:42 +0200 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2021-09-21 22:44:55 +0200 |
commit | 8172db92527c936c638b52274fbd06a0a624a56b (patch) | |
tree | 9cc931dfba36b5cb0350afcc7ae08a1a83fe4b28 /drivers/nvdimm/nd.h | |
parent | libnvdimm/labels: Add uuid helpers (diff) | |
download | linux-8172db92527c936c638b52274fbd06a0a624a56b.tar.xz linux-8172db92527c936c638b52274fbd06a0a624a56b.zip |
libnvdimm/label: Add a helper for nlabel validation
In the CXL namespace label there is no need for nlabel since that is
inferred from the region. Add a helper that moves nsl_get_label() behind
a helper that validates the number of labels relative to the region.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/163116430293.2460985.12693942353621355232.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm/nd.h')
-rw-r--r-- | drivers/nvdimm/nd.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h index ec3c9aad7f50..036638bdb7e3 100644 --- a/drivers/nvdimm/nd.h +++ b/drivers/nvdimm/nd.h @@ -342,6 +342,13 @@ struct nd_region { struct nd_mapping mapping[]; }; +static inline bool nsl_validate_nlabel(struct nd_region *nd_region, + struct nvdimm_drvdata *ndd, + struct nd_namespace_label *nd_label) +{ + return nsl_get_nlabel(ndd, nd_label) == nd_region->ndr_mappings; +} + struct nd_blk_region { int (*enable)(struct nvdimm_bus *nvdimm_bus, struct device *dev); int (*do_io)(struct nd_blk_region *ndbr, resource_size_t dpa, |