From cec770790190386521f0d4b120d40e7ea7557124 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 17 Oct 2016 10:16:34 -0400 Subject: [PATCH] Handle NVMe device attributes paths moving around in sysfs. Signed-off-by: Peter Jones --- ...Me-EUI-in-the-base-sysfs-dir-for-the.patch | 42 +++++++++++++++++++ efivar.spec | 6 ++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 0001-Check-for-the-NVMe-EUI-in-the-base-sysfs-dir-for-the.patch diff --git a/0001-Check-for-the-NVMe-EUI-in-the-base-sysfs-dir-for-the.patch b/0001-Check-for-the-NVMe-EUI-in-the-base-sysfs-dir-for-the.patch new file mode 100644 index 0000000..c1b6436 --- /dev/null +++ b/0001-Check-for-the-NVMe-EUI-in-the-base-sysfs-dir-for-the.patch @@ -0,0 +1,42 @@ +From f9570dee464a879e908e6212518eca08ae138c8c Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 17 Oct 2016 10:04:48 -0400 +Subject: [PATCH] Check for the NVMe EUI in the base sysfs dir for the device + as well + +Kernel commit 779ff75617099f4defe14e20443b95019a4c5ae8 moves the NVMe +attributes from being under nvme0n1/device/* to just being in the +nvme0n1/ directory. So now we get to check for both things. Thanks, +sysfs. + +This resolves github issue #65 +This resolves https://github.com/rhinstaller/efibootmgr/issues/48 + +Signed-off-by: Peter Jones +--- + src/linux.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/linux.c b/src/linux.c +index 30b5cd0..dd59551 100644 +--- a/src/linux.c ++++ b/src/linux.c +@@ -363,9 +363,14 @@ sysfs_parse_nvme(uint8_t *buf, ssize_t size, ssize_t *off, + * now fish the eui out of sysfs is there is one... + */ + rc = read_sysfs_file(&filebuf, ++ "/sys/class/block/nvme%dn%d/eui", ++ ctrl_id, ns_id); ++ if (rc < 0 && errno == ENOENT) { ++ rc = read_sysfs_file(&filebuf, + "/sys/class/block/nvme%dn%d/device/eui", + ctrl_id, ns_id); +- if (rc >= 0) { ++ } ++ if (rc >= 0) + uint8_t eui[8]; + if (rc < 23) { + errno = EINVAL; +-- +2.10.0 + diff --git a/efivar.spec b/efivar.spec index ee9b7e9..50e14da 100644 --- a/efivar.spec +++ b/efivar.spec @@ -1,6 +1,6 @@ Name: efivar Version: 30 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Tools to manage UEFI variables License: LGPLv2.1 URL: https://github.com/rhinstaller/efivar @@ -10,6 +10,7 @@ ExclusiveArch: %{ix86} x86_64 aarch64 BuildRequires: popt-devel popt-static git glibc-static Source0: https://github.com/rhinstaller/efivar/releases/download/efivar-%{version}/efivar-%{version}.tar.bz2 Patch0001: 0001-lib-provide-LIBEFIVAR_1.28-etc.patch +Patch0002: 0001-Check-for-the-NVMe-EUI-in-the-base-sysfs-dir-for-the.patch %description efivar provides a simple command line interface to the UEFI variable facility. @@ -70,6 +71,9 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/*.so.* %changelog +* Mon Oct 17 2016 Peter Jones - 30-4 +- Handle NVMe device attributes paths moving around in sysfs. + * Wed Sep 28 2016 Peter Jones - 30-3 - Maybe even provide the *right* old linker deps.