richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
923a60
From ee5aadde983315e72a82241dee95c0e041af15f4 Mon Sep 17 00:00:00 2001
923a60
From: Michal Sekletar <msekleta@redhat.com>
923a60
Date: Fri, 6 Jan 2017 17:30:53 +0100
923a60
Subject: [PATCH] udev/path_id: introduce support for NVMe devices (#4169)
923a60
923a60
This appends the nvme name and namespace identifier attribute the the
923a60
PCI path for by-path links. Symlinks like the following are now present:
923a60
923a60
lrwxrwxrwx. 1 root root 13 Sep 16 12:12 pci-0000:01:00.0-nvme-1 -> ../../nvme0n1
923a60
lrwxrwxrwx. 1 root root 15 Sep 16 12:12 pci-0000:01:00.0-nvme-1-part1 -> ../../nvme0n1p1
923a60
923a60
Cc: Michal Sekletar <sekletar.m@gmail.com>
923a60
Signed-off-by: Keith Busch <keith.busch@intel.com>
923a60
923a60
Cherry-picked from: b4c6f71b827d41a4af8007b735edf21ef7609f99
923a60
Resolves: #1373150
923a60
---
923a60
 src/udev/udev-builtin-path_id.c | 9 +++++++++
923a60
 1 file changed, 9 insertions(+)
923a60
923a60
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
923a60
index a3b019bfc5..88a812ff53 100644
923a60
--- a/src/udev/udev-builtin-path_id.c
923a60
+++ b/src/udev/udev-builtin-path_id.c
923a60
@@ -709,6 +709,15 @@ restart:
923a60
                         parent = skip_subsystem(parent, "scm");
923a60
                         supported_transport = true;
923a60
                         supported_parent = true;
923a60
+                } else if (streq(subsys, "nvme")) {
923a60
+                        const char *nsid = udev_device_get_sysattr_value(dev, "nsid");
923a60
+
923a60
+                        if (nsid) {
923a60
+                                path_prepend(&path, "nvme-%s", nsid);
923a60
+                                parent = skip_subsystem(parent, "nvme");
923a60
+                                supported_parent = true;
923a60
+                                supported_transport = true;
923a60
+                        }
923a60
                 }
923a60
 
923a60
                 parent = udev_device_get_parent(parent);