Skip to content

Commit 6484f5d

Browse files
Johannes ThumshirnChristoph Hellwig
authored andcommitted
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>
1 parent 76451d7 commit 6484f5d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/nvme/host/core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,6 +1995,9 @@ static ssize_t wwid_show(struct device *dev, struct device_attribute *attr,
19951995
int serial_len = sizeof(ctrl->serial);
19961996
int model_len = sizeof(ctrl->model);
19971997

1998+
if (!uuid_is_null(&ns->uuid))
1999+
return sprintf(buf, "uuid.%pU\n", &ns->uuid);
2000+
19982001
if (memchr_inv(ns->nguid, 0, sizeof(ns->nguid)))
19992002
return sprintf(buf, "eui.%16phN\n", ns->nguid);
20002003

0 commit comments

Comments
 (0)