Handle NVMe device attributes paths moving around in sysfs.

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2016-10-17 10:16:34 -04:00
parent 6609ae0c66
commit cec7707901
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From f9570dee464a879e908e6212518eca08ae138c8c Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
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 <pjones@redhat.com>
---
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

View File

@ -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 <pjones@redhat.com> - 30-4
- Handle NVMe device attributes paths moving around in sysfs.
* Wed Sep 28 2016 Peter Jones <pjones@redhat.com> - 30-3
- Maybe even provide the *right* old linker deps.