richardphibel / rpms / systemd

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