Hello community,

here is the log from the commit of package lsvpd for openSUSE:Factory checked 
in at 2019-11-10 22:46:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/lsvpd (Old)
 and      /work/SRC/openSUSE:Factory/.lsvpd.new.2990 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "lsvpd"

Sun Nov 10 22:46:21 2019 rev:51 rq:747187 version:1.7.10

Changes:
--------
--- /work/SRC/openSUSE:Factory/lsvpd/lsvpd.changes      2018-11-09 
07:54:44.931688503 +0100
+++ /work/SRC/openSUSE:Factory/.lsvpd.new.2990/lsvpd.changes    2019-11-10 
22:46:22.793786828 +0100
@@ -1,0 +2,8 @@
+Mon Nov  4 12:51:31 UTC 2019 - Josef Möllers <[email protected]>
+
+- Upgrade to 1.7.10
+  * vpdupdate: Delete vpd.db when program gets aborted
+  * Enable NVME f1h log page VPD information parsing
+  [jsc#SLE-8327, bsc#1155795]
+
+-------------------------------------------------------------------

Old:
----
  lsvpd-1.7.9.tar.gz

New:
----
  lsvpd-1.7.10.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ lsvpd.spec ++++++
--- /var/tmp/diff_new_pack.ATGC4W/_old  2019-11-10 22:46:24.009788406 +0100
+++ /var/tmp/diff_new_pack.ATGC4W/_new  2019-11-10 22:46:24.017788417 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package lsvpd
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,15 +12,15 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 Name:           lsvpd
-Version:        1.7.9
+Version:        1.7.10
 Release:        0
 Summary:        VPD Hardware Inventory Utilities for Linux
-License:        GPL-2.0+
+License:        GPL-2.0-or-later
 Group:          System/Monitoring
 Url:            http://sourceforge.net/projects/linux-diag/
 Source0:        
http://sourceforge.net/projects/linux-diag/files/lsvpd-new/%{version}/%{name}-%{version}.tar.gz

++++++ lsvpd-1.7.9.tar.gz -> lsvpd-1.7.10.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lsvpd-1.7.9/ChangeLog new/lsvpd-1.7.10/ChangeLog
--- old/lsvpd-1.7.9/ChangeLog   2018-06-12 12:35:31.000000000 +0200
+++ new/lsvpd-1.7.10/ChangeLog  2019-10-24 12:29:53.000000000 +0200
@@ -1,3 +1,7 @@
+1.7.10: Vasant Hegde <[email protected]> - Thu Oct 24 2019
+- vpdupdate: Delete vpd.db when program gets aborted
+- Enable NVME f1h log page VPD information parsing
+
 1.7.9: Vasant Hegde <[email protected]> - Tue Jun 12 2018
 vpdupdate: Remove old archive db
 Add support to parse OPFR record format
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lsvpd-1.7.9/Makefile.am new/lsvpd-1.7.10/Makefile.am
--- old/lsvpd-1.7.9/Makefile.am 2018-06-12 12:35:31.000000000 +0200
+++ new/lsvpd-1.7.10/Makefile.am        2019-10-24 12:29:53.000000000 +0200
@@ -84,7 +84,10 @@
 install-exec-hook:
        install -D --mode=644 scsi_templates.conf \
                ${DESTDIR}/etc/lsvpd/scsi_templates.conf
+       install -D --mode=644 nvme_templates.conf \
+               ${DESTDIR}/etc/lsvpd/nvme_templates.conf
        install -D --mode=644 cpu_mod_conv.conf \
                ${DESTDIR}/etc/lsvpd/cpu_mod_conv.conf
 
-EXTRA_DIST = $(man8_MANS) bootstrap.sh scsi_templates.conf cpu_mod_conv.conf
+EXTRA_DIST = $(man8_MANS) bootstrap.sh scsi_templates.conf cpu_mod_conv.conf \
+            nvme_templates.conf
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lsvpd-1.7.9/Makefile.in new/lsvpd-1.7.10/Makefile.in
--- old/lsvpd-1.7.9/Makefile.in 2018-06-12 12:35:41.000000000 +0200
+++ new/lsvpd-1.7.10/Makefile.in        2019-10-24 12:31:24.000000000 +0200
@@ -490,7 +490,9 @@
 lsmcode_LDADD = -lz -lstdc++ -lvpd_cxx
 lsmcode_LDFLAGS = -Wall
 AM_CXXFLAGS = -DDEST_DIR='"${exec_prefix}"' -DVPD_VERSION='"@VERSION@"'
-EXTRA_DIST = $(man8_MANS) bootstrap.sh scsi_templates.conf cpu_mod_conv.conf
+EXTRA_DIST = $(man8_MANS) bootstrap.sh scsi_templates.conf cpu_mod_conv.conf \
+            nvme_templates.conf
+
 all: all-am
 
 .SUFFIXES:
@@ -1152,6 +1154,8 @@
 install-exec-hook:
        install -D --mode=644 scsi_templates.conf \
                ${DESTDIR}/etc/lsvpd/scsi_templates.conf
+       install -D --mode=644 nvme_templates.conf \
+               ${DESTDIR}/etc/lsvpd/nvme_templates.conf
        install -D --mode=644 cpu_mod_conv.conf \
                ${DESTDIR}/etc/lsvpd/cpu_mod_conv.conf
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lsvpd-1.7.9/bootstrap.sh 
new/lsvpd-1.7.10/bootstrap.sh
--- old/lsvpd-1.7.9/bootstrap.sh        2018-06-12 12:35:31.000000000 +0200
+++ new/lsvpd-1.7.10/bootstrap.sh       2019-10-24 12:29:53.000000000 +0200
@@ -11,5 +11,5 @@
 fi
 
 aclocal && libtoolize --force && autoheader && automake --add-missing --copy 
&& autoconf && \
-chmod 644 lsvpd.spec.in Makefile.am README scsi_templates.conf \
+chmod 644 lsvpd.spec.in Makefile.am README scsi_templates.conf 
nvme_templates.conf \
 COPYING configure.ac ChangeLog cpu_mod_conv.conf
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lsvpd-1.7.9/configure new/lsvpd-1.7.10/configure
--- old/lsvpd-1.7.9/configure   2018-06-12 12:35:42.000000000 +0200
+++ new/lsvpd-1.7.10/configure  2019-10-24 12:31:24.000000000 +0200
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for lsvpd 1.7.9.
+# Generated by GNU Autoconf 2.69 for lsvpd 1.7.10.
 #
-# Report bugs to <[email protected]>.
+# Report bugs to <[email protected], [email protected]>.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -275,10 +275,11 @@
     $as_echo "$0: be upgraded to zsh 4.3.4 or later."
   else
     $as_echo "$0: Please tell [email protected] and
-$0: [email protected] about your system, including any
-$0: error possibly output before this message. Then install
-$0: a modern shell, or manually run the script under such a
-$0: shell if you do have one."
+$0: [email protected], [email protected]
+$0: about your system, including any error possibly output
+$0: before this message. Then install a modern shell, or
+$0: manually run the script under such a shell if you do
+$0: have one."
   fi
   exit 1
 fi
@@ -590,9 +591,9 @@
 # Identity of this package.
 PACKAGE_NAME='lsvpd'
 PACKAGE_TARNAME='lsvpd'
-PACKAGE_VERSION='1.7.9'
-PACKAGE_STRING='lsvpd 1.7.9'
-PACKAGE_BUGREPORT='[email protected]'
+PACKAGE_VERSION='1.7.10'
+PACKAGE_STRING='lsvpd 1.7.10'
+PACKAGE_BUGREPORT='[email protected], [email protected]'
 PACKAGE_URL=''
 
 # Factoring default headers for most tests.
@@ -1325,7 +1326,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures lsvpd 1.7.9 to adapt to many kinds of systems.
+\`configure' configures lsvpd 1.7.10 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1395,7 +1396,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of lsvpd 1.7.9:";;
+     short | recursive ) echo "Configuration of lsvpd 1.7.10:";;
    esac
   cat <<\_ACEOF
 
@@ -1440,7 +1441,7 @@
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
-Report bugs to <[email protected]>.
+Report bugs to <[email protected], [email protected]>.
 _ACEOF
 ac_status=$?
 fi
@@ -1503,7 +1504,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-lsvpd configure 1.7.9
+lsvpd configure 1.7.10
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2065,9 +2066,9 @@
 $as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" 
>&2;}
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the 
compiler's result" >&5
 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( $as_echo "## ------------------------------------- ##
-## Report this to [email protected] ##
-## ------------------------------------- ##"
+( $as_echo "## sssssssssssssssssssssssssssssssssssssssssssss ##
+## Report this to [email protected] ##
+## sssssssssssssssssssssssssssssssssssssssssssss ##"
      ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
@@ -2156,7 +2157,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by lsvpd $as_me 1.7.9, which was
+It was created by lsvpd $as_me 1.7.10, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3024,7 +3025,7 @@
 
 # Define the identity of the package.
  PACKAGE='lsvpd'
- VERSION='1.7.9'
+ VERSION='1.7.10'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -17166,7 +17167,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by lsvpd $as_me 1.7.9, which was
+This file was extended by lsvpd $as_me 1.7.10, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -17226,13 +17227,13 @@
 Configuration commands:
 $config_commands
 
-Report bugs to <[email protected]>."
+Report bugs to <[email protected], [email protected]>."
 
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-lsvpd config.status 1.7.9
+lsvpd config.status 1.7.10
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lsvpd-1.7.9/configure.ac 
new/lsvpd-1.7.10/configure.ac
--- old/lsvpd-1.7.9/configure.ac        2018-06-12 12:35:31.000000000 +0200
+++ new/lsvpd-1.7.10/configure.ac       2019-10-24 12:29:53.000000000 +0200
@@ -3,7 +3,7 @@
 AC_PREREQ([2.69])
 
 #base
-AC_INIT([lsvpd],[1.7.9],[[email protected]])
+AC_INIT([lsvpd],[1.7.10],[[email protected], [email protected]])
 AC_CONFIG_HEADER([config/config.h])
 AC_SUBST(DATE, [`date`])
 AC_CONFIG_MACRO_DIR([m4])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lsvpd-1.7.9/lsvpd.spec.in 
new/lsvpd-1.7.10/lsvpd.spec.in
--- old/lsvpd-1.7.9/lsvpd.spec.in       2018-06-12 12:35:31.000000000 +0200
+++ new/lsvpd-1.7.10/lsvpd.spec.in      2019-10-24 12:29:53.000000000 +0200
@@ -71,11 +71,16 @@
 %{_mandir}/man8/lsvio.8.gz
 %{_mandir}/man8/lsmcode.8.gz
 %config %{_sysconfdir}/lsvpd/scsi_templates.conf
+%config %{_sysconfdir}/lsvpd/nvme_templates.conf
 %config %{_sysconfdir}/lsvpd/cpu_mod_conv.conf
 %dir %{_sysconfdir}/lsvpd
 
 
 %changelog
+* Thu Oct 24 2019 - Vasant Hegde <[email protected]> - 1.7.10
+- vpdupdate: Delete vpd.db when program gets aborted
+- Enable NVME f1h log page VPD information parsing
+
 * Tue Jun 12 2018 - Vasant Hegde <[email protected]> - 1.7.9
 - vpdupdate: Remove old archive db
 - Add support to parse OPFR record format
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lsvpd-1.7.9/nvme_templates.conf 
new/lsvpd-1.7.10/nvme_templates.conf
--- old/lsvpd-1.7.9/nvme_templates.conf 1970-01-01 01:00:00.000000000 +0100
+++ new/lsvpd-1.7.10/nvme_templates.conf        2019-10-24 12:29:53.000000000 
+0200
@@ -0,0 +1 @@
+"0001", 
"_:4,ID:40,PN:12,EC:10,FN:12,AN:12,FC:4,CC:4,SN:8,Z0:8,Z1:4,Z2:10,Z3:12,Z4:1,Z5:2,Z6:8,Z7:3,Z8:5,Z9:2,ZA:4,ZB:4,ZC:2,MN:20,FR:8"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lsvpd-1.7.9/src/include/sysfstreecollector.hpp 
new/lsvpd-1.7.10/src/include/sysfstreecollector.hpp
--- old/lsvpd-1.7.9/src/include/sysfstreecollector.hpp  2018-06-12 
12:35:31.000000000 +0200
+++ new/lsvpd-1.7.10/src/include/sysfstreecollector.hpp 2019-10-24 
12:29:53.000000000 +0200
@@ -29,6 +29,7 @@
 #include <devicelookup.hpp>
 
 #define SCSI_TEMPLATES_FILE "/etc/lsvpd/scsi_templates.conf"
+#define NVME_TEMPLATES_FILE "/etc/lsvpd/nvme_templates.conf"
 
 #include <string>
 
@@ -49,6 +50,23 @@
        #define DEVICE_SCSI_SG_DEFAULT_STD_LEN 36
        #define MAXBUFSIZE 4096
 
+
+       /*
+        * NVME admin command opcode for getting the log page as defined in
+        * linux header file (nvme.h).
+        */
+       #define NVME_ADMIN_GET_LOG_PAGE         0x02
+
+       /* NVME device ioctl return values */
+       #define NVME_RC_SUCCESS                 0x0
+       #define NVME_RC_NS_NOT_READY            0x82
+       #define NVME_RC_INVALID_LOG_PAGE        0x109
+
+       #define NVME_NSID_ALL                   0xffffffff
+
+       /* NVME f1h log page VPD size */
+       #define NVME_VPD_INFO_SIZE              199
+
        /**
         * SysFSTreeCollector contains the logic for device discovery and VPD
         * retrieval from /sys and sg_utils.
@@ -104,6 +122,10 @@
                        DeviceLookup* mUsbTable;
                        bool mLimitSCSISize;
 
+                       // nvme specific
+                       int load_nvme_templates(const string& filename);
+                       int interpretNVMEf1hLogPage(Component *fillMe, char 
*data);
+
                        // scsi specific
                        int load_scsi_templates(const string&);
                        int interpretPage(Component *fillMe,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lsvpd-1.7.9/src/internal/sys_interface/icollector.cpp 
new/lsvpd-1.7.10/src/internal/sys_interface/icollector.cpp
--- old/lsvpd-1.7.9/src/internal/sys_interface/icollector.cpp   2018-06-12 
12:35:31.000000000 +0200
+++ new/lsvpd-1.7.10/src/internal/sys_interface/icollector.cpp  2019-10-24 
12:29:53.000000000 +0200
@@ -279,6 +279,12 @@
                        fillMe->addDeviceSpecific( key, "Device Specific", val, 
90 );
                else if( key[ 0 ] == 'P' )
                        fillMe->addDeviceSpecific( key, "Device Specific", val, 
90 );
+               else if( key == "AN" )
+                       fillMe->addDeviceSpecific( key, "Final Assembly PN", 
val, 90 );
+               else if( key == "ID" )
+                       fillMe->addDeviceSpecific( key, "Device Specific", val, 
90 );
+               else if( key == "FR" )
+                       fillMe->addDeviceSpecific( key, "Device Specific", val, 
90 );
 
        }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lsvpd-1.7.9/src/internal/sys_interface/sysfs_SCSI_Fill.cpp 
new/lsvpd-1.7.10/src/internal/sys_interface/sysfs_SCSI_Fill.cpp
--- old/lsvpd-1.7.9/src/internal/sys_interface/sysfs_SCSI_Fill.cpp      
2018-06-12 12:35:31.000000000 +0200
+++ new/lsvpd-1.7.10/src/internal/sys_interface/sysfs_SCSI_Fill.cpp     
2019-10-24 12:29:53.000000000 +0200
@@ -59,6 +59,7 @@
 #include <scsi/scsi.h>
 #include <sys/types.h>
 #include <linux/types.h>
+#include <linux/nvme_ioctl.h>
 #include <stdint.h>
 #include <fcntl.h>
 #include <sys/stat.h>
@@ -110,6 +111,12 @@
 
        static vector<scsi_template*> scsi_templates;
 
+       struct nvme_template {
+               string log_page_version;
+               string format_str; // The format followed by f1h log page
+       };
+       static vector<nvme_template*> nvme_templates;
+
        typedef struct my_scsi_idlun {
                int dev_id;
                int host_unique_id;
@@ -396,6 +403,20 @@
                }
        }
 
+       const nvme_template *findNVMeTemplate(string version)
+       {
+               vector<nvme_template*>::iterator i, end;
+
+               for (i = nvme_templates.begin(), end = nvme_templates.end(); i 
!= end; ++i) {
+                       if (!matches((*i)->log_page_version, version))
+                               continue;
+
+                       return *i;
+               }
+
+               return NULL;
+       }
+
        /**
         * Attempts to match a template specification to device discovered
         * values.
@@ -1046,6 +1067,164 @@
                return 0;
        }
 
+       int SysFSTreeCollector::load_nvme_templates(const string& filename)
+       {
+               char tmp_line[512]; // version 0001 has 136 characters, good 
size for future
+               string line;
+               nvme_template *tmp;
+               ostringstream err;
+               Logger logger;
+               ifstream fin(filename.c_str());
+
+               if (fin.fail()) {
+                       err << "Error opening NVMe template file : "
+                               << filename;
+                       logger.log(err.str( ), LOG_NOTICE);
+                       return -ENOENT;
+               }
+
+               while(!fin.eof()) {
+                       tmp = new nvme_template;
+                       if (tmp == NULL) {
+                               err << "Cannot allocate memory for NVMe 
templates";
+                               logger.log(err.str( ), LOG_NOTICE);
+                               return -ENOMEM;
+                       }
+
+                       fin.getline(tmp_line, 512);
+                       line = string(tmp_line);
+
+                       HelperFunctions::parseString(line, 1, 
tmp->log_page_version);
+                       HelperFunctions::parseString(line, 2, tmp->format_str);
+
+                       nvme_templates.push_back(tmp);
+               }
+               return 0;
+       }
+
+        int SysFSTreeCollector::interpretNVMEf1hLogPage(Component *fillMe, 
char *data)
+       {
+               int eof[50]; // version 0001 has 24 ',' separated fields, more 
for future
+               int fieldTotal = 0;
+               int fieldNum;
+               int tempCurLoc, dataCurLoc;
+               string fieldTemplate;
+               string fieldName;
+               int fieldSize;
+               string dataVal;  // Data as read from data stream for single 
field
+               ostringstream err;
+               Logger logger;
+               int rc;
+
+               if (nvme_templates.size() == 0) {
+                       rc = load_nvme_templates(NVME_TEMPLATES_FILE);
+                       if (rc)
+                               return rc;
+               }
+
+               // The first 4 characters specify the version
+               string version = strdupTrim(data, 4);
+               if (version.c_str() == NULL) {
+                       err << "Failed to allocate memory";
+                       logger.log(err.str(), LOG_NOTICE);
+                       return -1;
+               }
+
+               const nvme_template *logPageTemplate = 
findNVMeTemplate(version);
+               // No template - unknown device
+               if (logPageTemplate == NULL) {
+                       err << "No template found for NVMe f1h logpage version: 
"
+                               << version << " in the template file";
+                       logger.log(err.str( ), LOG_NOTICE);
+                       return -1;
+               }
+
+               string *format = new string(logPageTemplate->format_str);
+               if (format == NULL) {
+                       err << "Cannot allocate memory for NVMe format string";
+                       logger.log(err.str( ), LOG_NOTICE);
+                       return -ENOMEM;
+               }
+
+               for (int i = 0; i < (int) (*format).length(); i++) {
+                       if ((*format)[i] == ',') {
+                               eof[fieldTotal] = i;
+                               fieldTotal++;
+                       }
+               }
+
+               if (fieldTotal > 0) {
+                       eof[fieldTotal] = logPageTemplate->format_str.length();
+                       fieldTotal++;
+               }
+
+               // Walk each field in the template, grabbing data as we go
+               tempCurLoc = 4; // Skip the version specifier, ie "_:4,"
+               dataCurLoc = 4; // Skip the version string which 4 characters 
wide
+               fieldNum = 1;
+               while (fieldNum < fieldTotal) {
+                       fieldTemplate = (*format).substr(tempCurLoc,
+                                                       eof[fieldNum] - 
tempCurLoc);
+
+                       fieldName = getFieldName(fieldTemplate);
+                       fieldSize = getFieldValue(fieldTemplate);
+
+                       dataVal = strdupTrim(data + dataCurLoc, fieldSize);
+                       if (dataVal.c_str() == NULL )  {
+                               delete format;
+                               return -ENOMEM;
+                       }
+
+                       dataCurLoc += fieldSize;
+                       tempCurLoc = eof[fieldNum] + 1;
+                       fieldNum++;
+                       if (dataVal.length() == 0) {
+                               continue;
+                       }
+
+                       setVPDField(fillMe, fieldName, dataVal , __FILE__, 
__LINE__);
+               }
+
+               delete format;
+               return 0;
+       }
+
+
+        int nvme_read_vpd(int device_fd, void *buf)
+       {
+               int rc, ret = -1;
+               nvme_admin_cmd *cmd = new nvme_admin_cmd();
+               ostringstream err;
+               __u32 numd = (NVME_VPD_INFO_SIZE >> 2) - 1;
+               __u16 numdl = numd & 0xffff;
+               Logger logger;
+
+               if (cmd == NULL) {
+                       err << "Cannot allocate memory for NVMe command";
+                       logger.log(err.str( ), LOG_NOTICE);
+                       return -ENOMEM;
+               }
+
+               cmd->opcode = NVME_ADMIN_GET_LOG_PAGE;
+               cmd->nsid = NVME_NSID_ALL;
+               cmd->addr = (__u64)(uintptr_t) buf;
+               cmd->data_len = NVME_VPD_INFO_SIZE;
+               cmd->cdw10 = 0xf1 | (numdl << 16);
+
+               rc = ioctl(device_fd, NVME_IOCTL_ADMIN_CMD, cmd);
+               /* Page is optional so, present if NVME_RC_SUCCESS, or
+                * NVME_RC_INVALID_LOG_PAGE if page is not there. 
NVME_RC_NS_NOT_READY may
+                * be a valid return asking for retry after 127 seconds. Not 
retrying here
+                * as we do lazy run.
+                */
+               if (rc == NVME_RC_SUCCESS) {
+                       ret = 0; // we have valid data
+               }
+
+               delete cmd;
+               return ret;
+       }
+
        /********************************************************************
         * @brief: High-level data collection call, using ioctl and doSGQuery
         *      to collect relevant data which is returned for interpretation.
@@ -1081,13 +1260,28 @@
                int rc;
                char vendor[32], model[32], firmware[32];
 
+               if ((fillMe->devBus.getValue()).empty()) {
+                       if ((fillMe->getDevClass() == "nvme")) {
+                               char data[NVME_VPD_INFO_SIZE];
+
+                               rc = nvme_read_vpd(device_fd, data);
+                               if (rc)
+                                       return rc;
+
+                               rc = interpretNVMEf1hLogPage(fillMe, data);
+                               if (rc)
+                                       return rc;
+
+                               return 0;
+                       }
+
+                       return -1;
+               }
+
                memset(vendor, '\0', 32);
                memset(model, '\0', 32);
                memset(firmware, '\0', 32);
 
-               if ((fillMe->devBus.getValue()).empty())
-                       return -1;
-
                if (scsi_templates.size() == 0) {
                        rc = load_scsi_templates(SCSI_TEMPLATES_FILE);
                        if (rc != 0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lsvpd-1.7.9/src/internal/updater.cpp 
new/lsvpd-1.7.10/src/internal/updater.cpp
--- old/lsvpd-1.7.9/src/internal/updater.cpp    2018-06-12 12:35:31.000000000 
+0200
+++ new/lsvpd-1.7.10/src/internal/updater.cpp   2019-10-24 12:29:53.000000000 
+0200
@@ -499,6 +499,7 @@
 
 void lsvpdSighandler(int sig)
 {
+       int fp;
        struct sigaction sigact;
 
        switch (sig) {
@@ -514,6 +515,15 @@
                sigact.sa_handler = SIG_DFL;
                sigemptyset(&sigact.sa_mask);
                sigaction(sig, &sigact, NULL);
+
+               /* Remove temporary file */
+               unlink((env + "/" + file).c_str());
+               fp = open(env.c_str(), O_RDWR);
+               if (fp >= 0) {
+                       fsync(fp);
+                       close(fp);
+               }
+
                __lsvpdFini();
                raise(sig);
                break;


Reply via email to