libnvdimm/labels: Add uuid helpers
authorDan Williams <dan.j.williams@intel.com>
Thu, 9 Sep 2021 05:11:37 +0000 (22:11 -0700)
committerDan Williams <dan.j.williams@intel.com>
Tue, 21 Sep 2021 20:44:55 +0000 (13:44 -0700)
commitd1c6e08e7503649e4a4f3f9e700e2c05300b6379
tree0cd9f734279f846287617dc3a93ab80c146620c7
parente4e737bb5c170df6135a127739a9e6148ee3da82
libnvdimm/labels: Add uuid helpers

In preparation for CXL labels that move the uuid to a different offset
in the label, add nsl_{ref,get,validate}_uuid(). These helpers use the
proper uuid_t type. That type definition predated the libnvdimm
subsystem, so now is as a good a time as any to convert all the uuid
handling in the subsystem to uuid_t to match the helpers.

Note that the uuid fields in the label data and superblocks is not
replaced per Andy's expectation that uuid_t is a kernel internal type
not to appear in external ABI interfaces. So, in those case
{import,export}_uuid() is used to go between the 2 types.

Also note that this rework uncovered some unnecessary copies for label
comparisons, those are cleaned up with nsl_uuid_equal().

As for the whitespace changes, all new code is clang-format compliant.

Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/163116429748.2460985.15659993454313919977.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/nvdimm/btt.c
drivers/nvdimm/btt_devs.c
drivers/nvdimm/core.c
drivers/nvdimm/label.c
drivers/nvdimm/namespace_devs.c
drivers/nvdimm/nd-core.h
drivers/nvdimm/nd.h
drivers/nvdimm/pfn_devs.c
include/linux/nd.h