diff options
author | Johannes Thumshirn <jthumshirn@suse.de> | 2017-07-12 15:38:56 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2017-07-25 17:58:22 +0200 |
commit | 6484f5d16f9d5368afac61091972242f3bd695a9 (patch) | |
tree | 26b941af4dc9633d50ab729aa2c910ffbadbed27 /drivers | |
parent | 76451d79bde6bed17e113f057e58e1fa5fb79e78 (diff) | |
download | linux-stable-6484f5d16f9d5368afac61091972242f3bd695a9.tar.gz linux-stable-6484f5d16f9d5368afac61091972242f3bd695a9.tar.bz2 linux-stable-6484f5d16f9d5368afac61091972242f3bd695a9.zip |
nvme: also provide a UUID in the WWID sysfs attribute
The WWID sysfs attribute can provide multiple means of a World Wide ID
for a NVMe device. It can either be a NGUID, a EUI-64 or a concatenation
of VID, Serial Number, Model and the Namespace ID in this order of
preference.
If the target also sends us a UUID use the UUID for identification and
give it the highest priority.
This eases generation of /dev/disk/by-* symlinks.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/nvme/host/core.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 3b77cfe5aa1e..4cacab331f2a 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1995,6 +1995,9 @@ static ssize_t wwid_show(struct device *dev, struct device_attribute *attr, int serial_len = sizeof(ctrl->serial); int model_len = sizeof(ctrl->model); + if (!uuid_is_null(&ns->uuid)) + return sprintf(buf, "uuid.%pU\n", &ns->uuid); + if (memchr_inv(ns->nguid, 0, sizeof(ns->nguid))) return sprintf(buf, "eui.%16phN\n", ns->nguid); |