Skip to content

Commit

Permalink
udev/path_id: introduce support for NVMe devices
Browse files Browse the repository at this point in the history
This appends the nvme name and namespace identifier attribute the the
PCI path for by-path links. Symlinks like the following are now present:

lrwxrwxrwx. 1 root root 13 Sep 16 12:12 pci-0000:01:00.0-nvme-1 -> ../../nvme0n1
lrwxrwxrwx. 1 root root 15 Sep 16 12:12 pci-0000:01:00.0-nvme-1-part1 -> ../../nvme0n1p1

Cc: Michal Sekletar <sekletar.m@gmail.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
  • Loading branch information
Keith Busch authored and mscdex committed Dec 31, 2023
1 parent f2d455e commit cad674e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/udev/udev-builtin-path_id.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,15 @@ static int builtin_path_id(struct udev_device *dev, int argc __attribute__((unus
parent = skip_subsystem(parent, "scm");
supported_transport = true;
supported_parent = true;
} else if (streq(subsys, "nvme")) {
const char *nsid = udev_device_get_sysattr_value(dev, "nsid");

if (nsid) {
path_prepend(&path, "nvme-%s", nsid);
parent = skip_subsystem(parent, "nvme");
supported_parent = true;
supported_transport = true;
}
}

parent = udev_device_get_parent(parent);
Expand Down

0 comments on commit cad674e

Please sign in to comment.