B.02.19.2
This commit is contained in:
parent
b7602194b0
commit
fcfbecbff0
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ lshw-B.02.14.tar.gz
|
||||
/lshw-B.02.16.tar.gz
|
||||
/lshw-B.02.17.tar.gz
|
||||
/lshw-B.02.18.tar.gz
|
||||
/lshw-B.02.19.2.tar.gz
|
||||
|
133549
lshw-B.02.18-6cc0581.patch
133549
lshw-B.02.18-6cc0581.patch
File diff suppressed because it is too large
Load Diff
@ -1,303 +0,0 @@
|
||||
From 16e1d7b9e9a1aa69a59867de0aad6411c953fbfc Mon Sep 17 00:00:00 2001
|
||||
From: Harry Mallon <harry.mallon@codex.online>
|
||||
Date: Mon, 25 Mar 2019 19:44:14 +0000
|
||||
Subject: [PATCH] add support for /dev/nvmeX NVMe controllers
|
||||
|
||||
* Added nvme scanning for controllers /dev/nvme[0-9]+
|
||||
* Added nvme scanning for namespaces /dev/nvme[0-9]+n[0-9]+
|
||||
* Fill in namespaces as disks
|
||||
* Teach partition scanning about nvme partitions /dev/nvme[0-9]+n[0-9]+p[0-9]+
|
||||
---
|
||||
src/core/main.cc | 4 ++
|
||||
src/core/nvme.cc | 156 +++++++++++++++++++++++++++++++++++++++++
|
||||
src/core/nvme.h | 7 ++
|
||||
src/core/partitions.cc | 17 +++--
|
||||
src/core/sysfs.cc | 15 ++++
|
||||
src/core/sysfs.h | 3 +
|
||||
7 files changed, 199 insertions(+), 8 deletions(-)
|
||||
create mode 100644 src/core/nvme.cc
|
||||
create mode 100644 src/core/nvme.h
|
||||
|
||||
diff --git a/src/core/main.cc b/src/core/main.cc
|
||||
index c9a6e44..1dd109c 100644
|
||||
--- a/src/core/main.cc
|
||||
+++ b/src/core/main.cc
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "pcmcia-legacy.h"
|
||||
#include "ide.h"
|
||||
#include "scsi.h"
|
||||
+#include "nvme.h"
|
||||
#include "spd.h"
|
||||
#include "network.h"
|
||||
#include "isapnp.h"
|
||||
@@ -132,6 +133,9 @@ bool scan_system(hwNode & system)
|
||||
status("SCSI");
|
||||
if (enabled("scsi"))
|
||||
scan_scsi(computer);
|
||||
+ status("NVMe");
|
||||
+ if (enabled("nvme"))
|
||||
+ scan_nvme(computer);
|
||||
status("S/390 devices");
|
||||
if (enabled("s390"))
|
||||
scan_s390_devices(computer);
|
||||
diff --git a/src/core/nvme.cc b/src/core/nvme.cc
|
||||
new file mode 100644
|
||||
index 0000000..872d221
|
||||
--- /dev/null
|
||||
+++ b/src/core/nvme.cc
|
||||
@@ -0,0 +1,156 @@
|
||||
+#include "version.h"
|
||||
+#include "disk.h"
|
||||
+#include "osutils.h"
|
||||
+#include "sysfs.h"
|
||||
+#include "hw.h"
|
||||
+#include <glob.h>
|
||||
+#include <libgen.h>
|
||||
+
|
||||
+#include <string>
|
||||
+
|
||||
+__ID("@(#) $Id$");
|
||||
+
|
||||
+#define CLASS_NVME "nvme"
|
||||
+#define NVMEX "/dev/nvme[0-9]*"
|
||||
+#define NVMEXNX "/dev/nvme[0-9]*n[0-9]*"
|
||||
+
|
||||
+static void scan_controllers(hwNode & n)
|
||||
+{
|
||||
+ glob_t entries;
|
||||
+ size_t j;
|
||||
+
|
||||
+ if(glob(NVMEX, 0, NULL, &entries) == 0)
|
||||
+ {
|
||||
+ for(j=0; j < entries.gl_pathc; j++)
|
||||
+ {
|
||||
+ if(matches(entries.gl_pathv[j], "^/dev/nvme[[:digit:]]+$"))
|
||||
+ {
|
||||
+ string businfo = "";
|
||||
+ string logicalname = "";
|
||||
+ hwNode *device = NULL;
|
||||
+
|
||||
+ logicalname = basename(entries.gl_pathv[j]);
|
||||
+ if (logicalname.empty())
|
||||
+ continue;
|
||||
+
|
||||
+ businfo = sysfs::entry::byClass(CLASS_NVME, logicalname).businfo();
|
||||
+
|
||||
+ if (!businfo.empty())
|
||||
+ device = n.findChildByBusInfo(businfo);
|
||||
+
|
||||
+ if (!device)
|
||||
+ device = n.findChildByLogicalName(logicalname);
|
||||
+
|
||||
+ if (!device)
|
||||
+ {
|
||||
+ hwNode *core = n.getChild("core");
|
||||
+
|
||||
+ if (core)
|
||||
+ device = n.getChild("nvme");
|
||||
+
|
||||
+ if (core && !device)
|
||||
+ device = core->addChild(hwNode("nvme", hw::storage));
|
||||
+ }
|
||||
+
|
||||
+ if (!device)
|
||||
+ device = n.addChild(hwNode("nvme", hw::storage));
|
||||
+
|
||||
+ if (device)
|
||||
+ {
|
||||
+ if(device->getBusInfo().empty())
|
||||
+ device->setBusInfo(businfo);
|
||||
+ device->setLogicalName(logicalname);
|
||||
+ device->claim();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ globfree(&entries);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void scan_namespaces(hwNode & n)
|
||||
+{
|
||||
+ glob_t entries;
|
||||
+ size_t j;
|
||||
+
|
||||
+ if(glob(NVMEXNX, 0, NULL, &entries) == 0)
|
||||
+ {
|
||||
+ for(j=0; j < entries.gl_pathc; j++)
|
||||
+ {
|
||||
+ if(matches(entries.gl_pathv[j], "^/dev/nvme[[:digit:]]+n[[:digit:]]+$"))
|
||||
+ {
|
||||
+ // We get this information from sysfs rather than doing an NVMe Identify command
|
||||
+ // so they may not all be available from all kernels.
|
||||
+ string path = entries.gl_pathv[j];
|
||||
+ string logicalname = "";
|
||||
+ string parentlogicalname = "";
|
||||
+ string model;
|
||||
+ string serial;
|
||||
+ string firmware_rev;
|
||||
+ hwNode *parent = NULL;
|
||||
+ hwNode device = hwNode("disk", hw::disk);
|
||||
+
|
||||
+ logicalname = basename(entries.gl_pathv[j]);
|
||||
+ if (logicalname.empty())
|
||||
+ continue;
|
||||
+
|
||||
+ parentlogicalname = path.substr(0, path.find_last_of("n"));
|
||||
+
|
||||
+ sysfs::entry e = sysfs::entry::byClass("block", logicalname);
|
||||
+
|
||||
+ model = e.model();
|
||||
+ serial = e.serial();
|
||||
+ firmware_rev = e.firmware_rev();
|
||||
+
|
||||
+ device.setDescription("NVMe disk");
|
||||
+ device.setLogicalName(logicalname);
|
||||
+ device.claim();
|
||||
+
|
||||
+ if (!model.empty())
|
||||
+ device.setProduct(model);
|
||||
+ if (!serial.empty())
|
||||
+ device.setSerial(serial);
|
||||
+ if (!firmware_rev.empty())
|
||||
+ device.setVersion(firmware_rev);
|
||||
+
|
||||
+ scan_disk(device);
|
||||
+
|
||||
+ if (!parentlogicalname.empty())
|
||||
+ parent = n.findChildByLogicalName(parentlogicalname);
|
||||
+
|
||||
+ if (!parent)
|
||||
+ {
|
||||
+ hwNode *core = n.getChild("core");
|
||||
+
|
||||
+ if (core)
|
||||
+ parent = n.getChild("nvme");
|
||||
+
|
||||
+ if (core && !parent)
|
||||
+ parent = core->addChild(hwNode("nvme", hw::storage));
|
||||
+ }
|
||||
+
|
||||
+ if (!parent)
|
||||
+ parent = n.addChild(hwNode("nvme", hw::storage));
|
||||
+
|
||||
+ if (parent)
|
||||
+ {
|
||||
+ parent->addChild(device);
|
||||
+ parent->claim();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ globfree(&entries);
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
+
|
||||
+bool scan_nvme(hwNode & n)
|
||||
+{
|
||||
+ scan_controllers(n);
|
||||
+
|
||||
+ scan_namespaces(n);
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
diff --git a/src/core/nvme.h b/src/core/nvme.h
|
||||
new file mode 100644
|
||||
index 0000000..0b89acd
|
||||
--- /dev/null
|
||||
+++ b/src/core/nvme.h
|
||||
@@ -0,0 +1,7 @@
|
||||
+#ifndef _NVME_H_
|
||||
+#define _NVME_H_
|
||||
+
|
||||
+#include "hw.h"
|
||||
+
|
||||
+bool scan_nvme(hwNode & n);
|
||||
+#endif
|
||||
diff --git a/src/core/partitions.cc b/src/core/partitions.cc
|
||||
index 5682ee5..88a7188 100644
|
||||
--- a/src/core/partitions.cc
|
||||
+++ b/src/core/partitions.cc
|
||||
@@ -295,6 +295,7 @@ static bool guess_logicalname(source & s, const hwNode & disk, unsigned int n, h
|
||||
struct stat buf;
|
||||
char name[10];
|
||||
int dev = 0;
|
||||
+ string devname;
|
||||
|
||||
snprintf(name, sizeof(name), "%d", n);
|
||||
if(disk.getBusInfo()!="")
|
||||
@@ -304,9 +305,16 @@ static bool guess_logicalname(source & s, const hwNode & disk, unsigned int n, h
|
||||
if(!S_ISBLK(buf.st_mode)) return false;
|
||||
|
||||
if(s.diskname!="")
|
||||
- dev = open_dev(buf.st_rdev + n, S_IFBLK, s.diskname+string(name));
|
||||
+ devname = s.diskname;
|
||||
else
|
||||
- dev = open_dev(buf.st_rdev + n, S_IFBLK, disk.getLogicalName()+string(name));
|
||||
+ devname = disk.getLogicalName();
|
||||
+
|
||||
+ // NVMe partitions are like /dev/nvme0n1p2
|
||||
+ if(matches(devname, "^/dev/nvme[[:digit:]]+n[[:digit:]]+$"))
|
||||
+ devname += "p";
|
||||
+ devname += string(name);
|
||||
+
|
||||
+ dev = open_dev(buf.st_rdev + n, S_IFBLK, devname);
|
||||
|
||||
if(dev>=0)
|
||||
{
|
||||
@@ -330,10 +338,7 @@ static bool guess_logicalname(source & s, const hwNode & disk, unsigned int n, h
|
||||
if(memcmp(buffer1, buffer2, BLOCKSIZE)==0)
|
||||
{
|
||||
partition.claim();
|
||||
- if(s.diskname!="")
|
||||
- partition.setLogicalName(s.diskname+string(name));
|
||||
- else
|
||||
- partition.setLogicalName(disk.getLogicalName()+string(name));
|
||||
+ partition.setLogicalName(devname);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
diff --git a/src/core/sysfs.cc b/src/core/sysfs.cc
|
||||
index 06bce8e..d6b7511 100644
|
||||
--- a/src/core/sysfs.cc
|
||||
+++ b/src/core/sysfs.cc
|
||||
@@ -368,6 +368,21 @@ string entry::vendor() const
|
||||
return get_string(This->devpath+"/vendor");
|
||||
}
|
||||
|
||||
+string entry::model() const
|
||||
+{
|
||||
+ return get_string(This->devpath+"/model");
|
||||
+}
|
||||
+
|
||||
+string entry::serial() const
|
||||
+{
|
||||
+ return get_string(This->devpath+"/serial");
|
||||
+}
|
||||
+
|
||||
+string entry::firmware_rev() const
|
||||
+{
|
||||
+ return get_string(This->devpath+"/firmware_rev");
|
||||
+}
|
||||
+
|
||||
vector < entry > sysfs::entries_by_bus(const string & busname)
|
||||
{
|
||||
vector < entry > result;
|
||||
diff --git a/src/core/sysfs.h b/src/core/sysfs.h
|
||||
index 5f28d0c..d814c47 100644
|
||||
--- a/src/core/sysfs.h
|
||||
+++ b/src/core/sysfs.h
|
||||
@@ -28,6 +28,9 @@ namespace sysfs
|
||||
string modalias() const;
|
||||
string device() const;
|
||||
string vendor() const;
|
||||
+ string model() const;
|
||||
+ string serial() const;
|
||||
+ string firmware_rev() const;
|
||||
entry parent() const;
|
||||
string name_in_class(const string &) const;
|
||||
string string_attr(const string & name, const string & def = "") const;
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,13 +1,13 @@
|
||||
From c8a08ccb9a268c4d55bf80a236cd0ad2d149ce20 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Terje=20R=C3=B8sten?= <terje.rosten@ntnu.no>
|
||||
Date: Tue, 28 May 2019 19:32:24 +0200
|
||||
From 5da5b63bd38634834bb3e631a24e31a10ab60f27 Mon Sep 17 00:00:00 2001
|
||||
From: Terje Rosten <terje.rosten@ntnu.no>
|
||||
Date: Wed, 25 Mar 2020 21:57:53 +0100
|
||||
Subject: [PATCH] cmakeify
|
||||
|
||||
---
|
||||
CMakeLists.txt | 43 ++++++
|
||||
Makefile | 20 ---
|
||||
README.md | 51 ++++---
|
||||
lshw.spec.in | 62 +++-----
|
||||
lshw.spec.in | 66 +++-----
|
||||
src/CMakeLists.txt | 102 +++++++++++++
|
||||
src/Makefile | 144 ------------------
|
||||
src/core/Makefile | 80 ----------
|
||||
@ -23,7 +23,7 @@ Subject: [PATCH] cmakeify
|
||||
src/gui/stock.c | 1 +
|
||||
src/po/CMakeLists.txt | 16 ++
|
||||
src/po/Makefile | 23 ---
|
||||
19 files changed, 327 insertions(+), 415 deletions(-)
|
||||
19 files changed, 327 insertions(+), 419 deletions(-)
|
||||
create mode 100644 CMakeLists.txt
|
||||
delete mode 100644 Makefile
|
||||
create mode 100644 src/CMakeLists.txt
|
||||
@ -40,14 +40,14 @@ Subject: [PATCH] cmakeify
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
new file mode 100644
|
||||
index 0000000..d14a65c
|
||||
index 0000000..3b1d4d6
|
||||
--- /dev/null
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -0,0 +1,43 @@
|
||||
+cmake_minimum_required(VERSION 3.0)
|
||||
+
|
||||
+project(lshw)
|
||||
+set(VERSION "B.02.18")
|
||||
+set(VERSION "B.02.19.2")
|
||||
+
|
||||
+find_package(Git)
|
||||
+
|
||||
@ -193,10 +193,10 @@ index 30feaf1..294888c 100644
|
||||
+
|
||||
+ $ make refresh_hwdata
|
||||
diff --git a/lshw.spec.in b/lshw.spec.in
|
||||
index f7f88b3..3fe23c2 100644
|
||||
index e837fd4..3fe23c2 100644
|
||||
--- a/lshw.spec.in
|
||||
+++ b/lshw.spec.in
|
||||
@@ -7,9 +7,11 @@ Version: @VERSION@
|
||||
@@ -7,11 +7,11 @@ Version: @VERSION@
|
||||
Release: 2
|
||||
Source: http://www.ezix.org/software/files/%{name}-%{version}.tar.gz
|
||||
URL: http://lshw.ezix.org/
|
||||
@ -204,13 +204,15 @@ index f7f88b3..3fe23c2 100644
|
||||
+License: GPLv2
|
||||
Group: Applications/System
|
||||
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
-
|
||||
-%global debug_package %{nil}
|
||||
+BuildRequires: gcc
|
||||
+BuildRequires: gcc-c++
|
||||
+BuildRequires: cmake
|
||||
|
||||
%description
|
||||
lshw (Hardware Lister) is a small tool to provide detailed information on
|
||||
@@ -37,7 +39,7 @@ lshw (Hardware Lister) is a small tool to provide detailed informaton on
|
||||
@@ -39,7 +39,7 @@ lshw (Hardware Lister) is a small tool to provide detailed informaton on
|
||||
the hardware configuration of the machine. It can report exact memory
|
||||
configuration, firmware version, mainboard configuration, CPU version
|
||||
and speed, cache configuration, bus speed, etc. on DMI-capable x86s
|
||||
@ -219,7 +221,7 @@ index f7f88b3..3fe23c2 100644
|
||||
|
||||
This package provides a graphical user interface to display hardware
|
||||
information.
|
||||
@@ -52,59 +54,29 @@ http://lshw.ezix.org/
|
||||
@@ -54,61 +54,29 @@ http://lshw.ezix.org/
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
@ -228,6 +230,7 @@ index f7f88b3..3fe23c2 100644
|
||||
- SBINDIR="%{_sbindir}" \
|
||||
- MANDIR="%{_mandir}" \
|
||||
- DATADIR="%{_datadir}" \
|
||||
- VERSION="%{version}" \
|
||||
- all
|
||||
-%if %{!?_without_gui:1}0
|
||||
-%{__make} %{?_smp_mflags} \
|
||||
@ -235,6 +238,7 @@ index f7f88b3..3fe23c2 100644
|
||||
- SBINDIR="%{_sbindir}" \
|
||||
- MANDIR="%{_mandir}" \
|
||||
- DATADIR="%{_datadir}" \
|
||||
- VERSION="%{version}" \
|
||||
- gui
|
||||
-%endif
|
||||
+mkdir build && cd build
|
||||
@ -551,7 +555,7 @@ index 7ae8218..0000000
|
||||
-# DO NOT DELETE
|
||||
diff --git a/src/core/Makefile b/src/core/Makefile
|
||||
deleted file mode 100644
|
||||
index fbf6027..0000000
|
||||
index b429380..0000000
|
||||
--- a/src/core/Makefile
|
||||
+++ /dev/null
|
||||
@@ -1,80 +0,0 @@
|
||||
@ -565,7 +569,7 @@ index fbf6027..0000000
|
||||
-LDSTATIC=
|
||||
-LIBS=
|
||||
-
|
||||
-OBJS = hw.o main.o print.o mem.o dmi.o device-tree.o cpuinfo.o osutils.o pci.o version.o cpuid.o ide.o cdrom.o pcmcia-legacy.o scsi.o s390.o disk.o spd.o network.o isapnp.o pnp.o fb.o options.o usb.o sysfs.o display.o heuristics.o parisc.o cpufreq.o partitions.o blockio.o lvm.o ideraid.o pcmcia.o volumes.o mounts.o smp.o abi.o jedec.o dump.o fat.o virtio.o vio.o
|
||||
-OBJS = hw.o main.o print.o mem.o dmi.o device-tree.o cpuinfo.o osutils.o pci.o version.o cpuid.o ide.o cdrom.o pcmcia-legacy.o scsi.o s390.o disk.o spd.o network.o isapnp.o pnp.o fb.o options.o usb.o sysfs.o display.o heuristics.o parisc.o cpufreq.o partitions.o blockio.o lvm.o ideraid.o pcmcia.o volumes.o mounts.o smp.o abi.o jedec.o dump.o fat.o virtio.o vio.o nvme.o mmc.o
|
||||
-ifeq ($(SQLITE), 1)
|
||||
- OBJS+= db.o
|
||||
-endif
|
||||
@ -800,7 +804,7 @@ index 0000000..3489053
|
||||
+endif()
|
||||
diff --git a/src/gui/Makefile b/src/gui/Makefile
|
||||
deleted file mode 100644
|
||||
index 74be693..0000000
|
||||
index f003cfb..0000000
|
||||
--- a/src/gui/Makefile
|
||||
+++ /dev/null
|
||||
@@ -1,61 +0,0 @@
|
||||
@ -818,7 +822,7 @@ index 74be693..0000000
|
||||
-ifeq ($(SQLITE), 1)
|
||||
- CXXFLAGS+= -DSQLITE $(shell pkg-config --cflags sqlite3)
|
||||
-endif
|
||||
-CFLAGS=$(CXXFLAGS) $(DEFINES)
|
||||
-CFLAGS=$(CXXFLAGS) -g $(DEFINES)
|
||||
-GTKLIBS=$(shell pkg-config gtk+-2.0 gmodule-2.0 --libs)
|
||||
-LIBS+=-L../core -llshw -lresolv $(GTKLIBS)
|
||||
-ifeq ($(SQLITE), 1)
|
||||
@ -984,5 +988,5 @@ index 36fbdb7..0000000
|
||||
-clean:
|
||||
- rm -f $(CATALOGS) $(PACKAGENAME).pot
|
||||
--
|
||||
2.21.0
|
||||
2.25.1
|
||||
|
13
lshw.spec
13
lshw.spec
@ -1,16 +1,14 @@
|
||||
Summary: Hardware lister
|
||||
Name: lshw
|
||||
Version: B.02.18
|
||||
Release: 23%{?dist}
|
||||
Version: B.02.19.2
|
||||
Release: 1%{?dist}
|
||||
License: GPLv2
|
||||
URL: http://ezix.org/project/wiki/HardwareLiSter
|
||||
Source0: http://www.ezix.org/software/files/lshw-%{version}.tar.gz
|
||||
Source1: https://salsa.debian.org/openstack-team/third-party/lshw/raw/debian/stein/debian/patches/lshw-gtk.1
|
||||
Patch1: lshw-B.02.18-scandir.patch
|
||||
Patch2: lshw-B.02.18-6cc0581.patch
|
||||
Patch3: lshw-B.02.18-revert-json.patch
|
||||
Patch4: lshw-B.02.18-cmake.patch
|
||||
Patch5: lshw-B.02.18-nvme.patch
|
||||
Patch4: lshw-B.02.19.2-cmake.patch
|
||||
BuildRequires: cmake
|
||||
BuildRequires: desktop-file-utils
|
||||
BuildRequires: gcc
|
||||
@ -42,10 +40,8 @@ format.
|
||||
%prep
|
||||
%setup -q
|
||||
%patch01 -p1
|
||||
%patch02 -p1
|
||||
%patch03 -R -p1
|
||||
%patch04 -p1
|
||||
%patch05 -p1
|
||||
|
||||
%build
|
||||
mkdir build && pushd build
|
||||
@ -95,6 +91,9 @@ src/lshw -json \
|
||||
%{_datadir}/polkit-1/actions/org.ezix.lshw.gui.policy
|
||||
|
||||
%changelog
|
||||
* Tue Mar 24 2020 Terje Rosten <terje.rosten@ntnu.no> - B.02.19.2-1
|
||||
- B.02.19.2
|
||||
|
||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - B.02.18-23
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user