Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package mhvtl for openSUSE:Factory checked 
in at 2022-06-04 23:27:13
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/mhvtl (Old)
 and      /work/SRC/openSUSE:Factory/.mhvtl.new.1548 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "mhvtl"

Sat Jun  4 23:27:13 2022 rev:17 rq:980731 version:1.70_release+862.561d4d5b473f

Changes:
--------
--- /work/SRC/openSUSE:Factory/mhvtl/mhvtl.changes      2022-01-20 
00:13:36.106640553 +0100
+++ /work/SRC/openSUSE:Factory/.mhvtl.new.1548/mhvtl.changes    2022-06-04 
23:27:19.068772912 +0200
@@ -1,0 +2,41 @@
+Fri Jun 03 16:46:44 UTC 2022 - ldun...@suse.com
+
+- Update to version 1.70_release+862.561d4d5b473f, to fix a build
+  issue (include of genhd.h fails, since the include file is
+  gone now):
+  * Standardise using -m <barcode>
+  * kernel/config.sh: use $KDIR for the kernel build directory
+  * Add include guard to generated config.h
+  * kernel: Re-work compat symbols detection
+  * vtlcart: Replace calls to creat() with calls to open()
+  * mhvtl.spec: Bump version to 1.7
+  * systemd device config: touch up error logging
+  * systemd device config: Dummy-spit if we can't find the config file
+  * CodeQL
+  * SEND_DIAGNOSTICS: Check for valid MAM structure size and CRC sanity checks
+  * Makefile: Fix path to mhvtl-utils.spec
+  * etc/Makefile: run bash scripts using bash, not sh
+  * device-conf-generator: Drop path qualifier from comment
+  * Makefile: add new file to 'tar' target missed in previous commit
+  * Makefile infrastructure: fix passing variables
+  * Makefile: Correctly pass top-level variables
+  * Build process was failing if not following a clean
+  * LTO media: Set Encryption capable bit for LTO6, 7 & 8 media
+  * Fix issue with too many bytes returned on short block read
+  * Add script to check CRC32C & RS-CRC
+  * Handle systemd directory paths correctly.
+  * Handle our queue command correctly
+  * Add new preload_tape to git ignore
+  * Remove duplicate def of systemd generator dir.
+  * Handle sysfs_emit correctly
+  * Make preload_tape a link to dump_tape
+  * Silence compiler complaints about string too long
+  This removed these patches (no longer needed):
+  * mhvtl-fix-systemd-generator-dir.patch
+  * mhvtl-handle-systemd-location-correctly-for-generator.patch
+  * mhvtl-kernel-module-fix-queuecommand-arg-change.patch
+  * mhvtl-kernel-module-fix-sysfs_emit-decl.patch
+  And added (not yet upstream):
+  * mhvtl-fix-removal-of-genhd-h.patch
+
+-------------------------------------------------------------------

Old:
----
  mhvtl-1.64_release+835.6beb0aa01437.tar.xz
  mhvtl-fix-systemd-generator-dir.patch
  mhvtl-handle-systemd-location-correctly-for-generator.patch
  mhvtl-kernel-module-fix-queuecommand-arg-change.patch
  mhvtl-kernel-module-fix-sysfs_emit-decl.patch

New:
----
  mhvtl-1.70_release+862.561d4d5b473f.tar.xz
  mhvtl-fix-removal-of-genhd-h.patch

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

Other differences:
------------------
++++++ mhvtl.spec ++++++
--- /var/tmp/diff_new_pack.eV4Rmc/_old  2022-06-04 23:27:19.588773437 +0200
+++ /var/tmp/diff_new_pack.eV4Rmc/_new  2022-06-04 23:27:19.592773442 +0200
@@ -26,7 +26,7 @@
 
 Name:           mhvtl
 URL:            http://sites.google.com/site/linuxvtl2/
-Version:        1.64_release+835.6beb0aa01437
+Version:        1.70_release+862.561d4d5b473f
 Release:        0
 Requires:       mhvtl-kmp
 Requires:       module-init-tools
@@ -45,10 +45,7 @@
 Group:          System/Daemons
 Source:         %{name}-%{version}.tar.xz
 Source2:        %{name}.preamble
-Patch1:         %{name}-kernel-module-fix-queuecommand-arg-change.patch
-Patch2:         %{name}-kernel-module-fix-sysfs_emit-decl.patch
-Patch3:         %{name}-handle-systemd-location-correctly-for-generator.patch
-Patch4:         %{name}-fix-systemd-generator-dir.patch
+Patch1:         %{name}-fix-removal-of-genhd-h.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 %{?systemd_ordering}
 
@@ -82,9 +79,6 @@
 %prep
 %setup -qn %{name}-%{version}
 %patch1 -p1
-%patch2 -p1
-%patch3 -p1
-%patch4 -p1
 
 %build
 make MHVTL_HOME_PATH=%{mhvtl_home_dir} VERSION=%{version} \
@@ -92,6 +86,7 @@
        SYSTEMD_SERVICE_DIR=%{_unitdir}
 %if 0%{buildkmp} == 1
 for flavor in %flavors_to_build; do
+       make -C kernel config.h
        rm -rf obj/$flavor
        mkdir -p obj/$flavor
        cp -a kernel/* obj/$flavor

++++++ _service ++++++
--- /var/tmp/diff_new_pack.eV4Rmc/_old  2022-06-04 23:27:19.620773470 +0200
+++ /var/tmp/diff_new_pack.eV4Rmc/_new  2022-06-04 23:27:19.624773474 +0200
@@ -4,8 +4,8 @@
     <param name="url">https://github.com/markh794/mhvtl.git</param>
     <param name="subdir"></param>
     <param name="filename">mhvtl</param>
-    <param name="revision">6beb0aa01437</param>
-    <param name="versionformat">1.6-4_release+@TAG_OFFSET@.%h</param>
+    <param name="revision">HEAD</param>
+    <param name="versionformat">1.7-0_release+@TAG_OFFSET@.%h</param>
     <param name="match-tag">1.[0-0]-[0-0]_release</param>
     <param name="changesgenerate">enable</param>
   </service>

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.eV4Rmc/_old  2022-06-04 23:27:19.644773494 +0200
+++ /var/tmp/diff_new_pack.eV4Rmc/_new  2022-06-04 23:27:19.648773499 +0200
@@ -1,6 +1,6 @@
 <servicedata>
 <service name="tar_scm">
                 <param name="url">https://github.com/markh794/mhvtl.git</param>
-              <param 
name="changesrevision">6beb0aa01437ae4092e67a4b6f359ae108ce6d5e</param></service></servicedata>
+              <param 
name="changesrevision">561d4d5b473f29c44961cd4a64c2ff3e0c02ed2c</param></service></servicedata>
 (No newline at EOF)
 

++++++ mhvtl-1.64_release+835.6beb0aa01437.tar.xz -> 
mhvtl-1.70_release+862.561d4d5b473f.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/mhvtl-1.64_release+835.6beb0aa01437/.github/workflows/codeql.yml 
new/mhvtl-1.70_release+862.561d4d5b473f/.github/workflows/codeql.yml
--- old/mhvtl-1.64_release+835.6beb0aa01437/.github/workflows/codeql.yml        
1970-01-01 01:00:00.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/.github/workflows/codeql.yml        
2022-06-01 03:40:51.000000000 +0200
@@ -0,0 +1,70 @@
+# For most projects, this workflow file will not need changing; you simply need
+# to commit it to your repository.
+#
+# You may wish to alter this file to override the set of languages analyzed,
+# or to provide custom queries or build logic.
+#
+# ******** NOTE ********
+# We have attempted to detect the languages in your repository. Please check
+# the `language` matrix defined below to confirm you have the correct set of
+# supported CodeQL languages.
+#
+name: "CodeQL"
+
+on:
+  push:
+    branches: [ master ]
+  pull_request:
+    # The branches below must be a subset of the branches above
+    branches: [ master ]
+  schedule:
+    - cron: '43 6 * * 5'
+
+jobs:
+  analyze:
+    name: Analyze
+    runs-on: ubuntu-latest
+    permissions:
+      actions: read
+      contents: read
+      security-events: write
+
+    strategy:
+      fail-fast: false
+      matrix:
+        language: [ 'cpp' ]
+        # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 
'python', 'ruby' ]
+        # Learn more about CodeQL language support at 
https://git.io/codeql-language-support
+
+    steps:
+    - name: Checkout repository
+      uses: actions/checkout@v2
+
+    # Initializes the CodeQL tools for scanning.
+    - name: Initialize CodeQL
+      uses: github/codeql-action/init@v1
+      with:
+        languages: ${{ matrix.language }}
+        # If you wish to specify custom queries, you can do so here or in a 
config file.
+        # By default, queries listed here will override any specified in a 
config file.
+        # Prefix the list here with "+" to use these queries and those in the 
config file.
+        # queries: ./path/to/local/query, your-org/your-repo/queries@main
+
+    # Autobuild attempts to build any compiled languages  (C/C++, C#, or Java).
+    # If this step fails, then you should remove it and run the build manually 
(see below)
+    - name: Autobuild
+      uses: github/codeql-action/autobuild@v1
+
+    # ?????? Command-line programs to run using the OS shell.
+    # ???? https://git.io/JvXDl
+
+    # ?????? If the Autobuild fails above, remove it and uncomment the 
following three lines
+    #    and modify them (or add more) to build your code if your project
+    #    uses a compiled language
+
+    #- run: |
+    #   make bootstrap
+    #   make release
+
+    - name: Perform CodeQL Analysis
+      uses: github/codeql-action/analyze@v1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/ChangeLog 
new/mhvtl-1.70_release+862.561d4d5b473f/ChangeLog
--- old/mhvtl-1.64_release+835.6beb0aa01437/ChangeLog   2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/ChangeLog   2022-06-01 
03:40:51.000000000 +0200
@@ -1,3 +1,21 @@
+* Thu Mar 10 10:30:00 AEST 2022 Mark Harvey <markh...@gmail.com> 
<mark.har...@nutanix.com>
+- Updated default drives in library 10 from LTO4/LTO5 to LTO6 & LTO8
+- Added initial support for Data Integrity Validation (via Logical Block 
Protection) - IBM LTO6,LTO7 & LTO8 with this release.
+- mhvtl.ko: Various updates to match the latest kernels
+- Additional checks for Vagrant build on CentOS, Ubuntu and OpenSUSE
+- Improve tape load/unload handshake to make it more robust
+- Improve handling of missing slot numbers in library_contents.xx
+- Makefile - Move variables to a common location (config.mk)
+- SEND DIAGNOSTICS: Implement basic sanity check for SSC devices
+- VERIFY(6) op code support
+- Update install instructions with sg3_utils vs sg3-utils package names
+- LTO-6 media load to match LTO standards (LTO8 cannot read LTO6 media)
+- New utility 'preload_tape' bypassing need to write via /dev/st*
+- Add missing 'ENCRYPTION capable' bit for LTO6, 7 & 8 media
+- systemd device config: Best effort, log errors via klog
+- Obligatory spelling fixes
+- Bump version to 1.7 : Beginning of LBP, VERIFY(6) and SEND DIAGNOSTICS 
support
+
 * Thu Oct 07 10:40:00 AEST 2021 Mark Harvey <markh...@gmail.com> 
<mark.har...@nutanix.com>
 - rename list.h to avoid generic name conflict
 - rename scsi.h to avoid generic name conflict
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/Makefile 
new/mhvtl-1.70_release+862.561d4d5b473f/Makefile
--- old/mhvtl-1.64_release+835.6beb0aa01437/Makefile    2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/Makefile    2022-06-01 
03:40:51.000000000 +0200
@@ -10,36 +10,17 @@
 #      kernel  to build kernel module
 #
 
-VER = $(shell awk '/Version/ {print $$2}'  mhvtl-utils.spec)
-REL = $(shell awk '/Release/ {print $$2}'  mhvtl-utils.spec | sed 
s/%{?dist}//g)
-
-TOPDIR = $(shell basename $$PWD)
-
-VERSION ?= $(VER).$(REL)
-EXTRAVERSION =  $(if $(shell git show-ref 2>/dev/null),-git-$(shell git branch 
|awk '/\*/ {print $$2}'))
+include config.mk
 
 PARENTDIR = mhvtl-$(VER)
-PREFIX ?= /usr
-MHVTL_HOME_PATH ?= /opt/mhvtl
-MHVTL_CONFIG_PATH ?= /etc/mhvtl
 CHECK_CC = cgcc
 CHECK_CC_FLAGS = '$(CHECK_CC) -Wbitwise -Wno-return-void -no-compile $(ARCH)'
-SYSTEMD_GENERATOR_DIR ?= /lib/systemd/system-generators
-ifeq ($(shell whoami),root)
-ROOTUID = "YES"
-endif
 
 TAR_FILE := mhvtl-$(shell date +%F)-$(VERSION)$(EXTRAVERSION).tgz
 
 MAKE_VTL_MEDIA = usr/make_vtl_media
 
-export PREFIX DESTDIR
-
-ifeq ($(shell grep lib64$ /etc/ld.so.conf /etc/ld.so.conf.d/* | wc -l),0)
-LIBDIR ?= $(PREFIX)/lib
-else
-LIBDIR ?= $(PREFIX)/lib64
-endif
+export PREFIX DESTDIR TOPDIR
 
 CFLAGS=-Wall -g -O2 -D_LARGEFILE64_SOURCE $(RPM_OPT_FLAGS)
 CLFLAGS=-shared
@@ -47,13 +28,13 @@
 all:   usr etc scripts
 
 scripts:       patch
-       $(MAKE) -C scripts MHVTL_HOME_PATH=$(MHVTL_HOME_PATH) 
MHVTL_CONFIG_PATH=$(MHVTL_CONFIG_PATH)
+       $(MAKE) -C scripts
 
 etc:   patch
-       $(MAKE) -C etc MHVTL_HOME_PATH=$(MHVTL_HOME_PATH) 
MHVTL_CONFIG_PATH=$(MHVTL_CONFIG_PATH)
+       $(MAKE) -C etc
 
 usr:   patch
-       $(MAKE) -C usr MHVTL_HOME_PATH=$(MHVTL_HOME_PATH) 
MHVTL_CONFIG_PATH=$(MHVTL_CONFIG_PATH) 
SYSTEMD_GENERATOR_DIR=$(SYSTEMD_GENERATOR_DIR)
+       $(MAKE) -C usr
 
 kernel: patch
        $(MAKE) -C kernel
@@ -86,13 +67,13 @@
        $(RM) ../$(TAR_FILE)
 
 install: all
-       $(MAKE) -C usr install $(LIBDIR) $(PREFIX) $(DESTDIR)
-       $(MAKE) -C scripts install $(PREFIX) $(DESTDIR)
-       $(MAKE) -i -C etc install $(DESTDIR) $(SYSTEMD_SERVICE_DIR)
+       $(MAKE) -C usr install
+       $(MAKE) -C scripts install
+       $(MAKE) -i -C etc install
        $(MAKE) -C man man
-       $(MAKE) -C man install $(PREFIX) $(DESTDIR)
+       $(MAKE) -C man install
        [ -d $(DESTDIR)$(MHVTL_HOME_PATH) ] || mkdir -p 
$(DESTDIR)$(MHVTL_HOME_PATH)
-ifdef ROOTUID
+ifeq ($(ROOTUID),YES)
        ldconfig
        systemctl daemon-reload
 endif
@@ -116,6 +97,7 @@
                 $(PARENTDIR)/tcopy/ \
                 $(PARENTDIR)/include \
                 $(PARENTDIR)/Makefile \
+                $(PARENTDIR)/config.mk \
                 $(PARENTDIR)/README \
                 $(PARENTDIR)/INSTALL \
                 $(PARENTDIR)/ChangeLog \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/config.mk 
new/mhvtl-1.70_release+862.561d4d5b473f/config.mk
--- old/mhvtl-1.64_release+835.6beb0aa01437/config.mk   1970-01-01 
01:00:00.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/config.mk   2022-06-01 
03:40:51.000000000 +0200
@@ -0,0 +1,30 @@
+TOPDIR ?= $(CURDIR)
+
+VER ?= $(shell awk '/Version/ {print $$2}'  $(TOPDIR)/mhvtl-utils.spec)
+REL ?= $(shell awk -F'[ %]' '/Release/ {print $$2}' $(TOPDIR)/mhvtl-utils.spec)
+
+VERSION ?= $(VER).$(REL)
+EXTRAVERSION ?= $(if $(shell git show-ref 2>/dev/null),-git-$(shell git 
rev-parse --abbrev-ref HEAD))
+
+PREFIX ?= /usr
+MANDIR ?= /share/man
+
+MHVTL_HOME_PATH ?= /opt/mhvtl
+MHVTL_CONFIG_PATH ?= /etc/mhvtl
+SYSTEMD_GENERATOR_DIR ?= /lib/systemd/system-generators
+SYSTEMD_SERVICE_DIR ?= /lib/systemd/system
+
+ifeq ($(shell whoami),root)
+ROOTUID = YES
+endif
+
+ifeq ($(shell grep lib64$ /etc/ld.so.conf /etc/ld.so.conf.d/* | wc -l),0)
+LIBDIR ?= $(PREFIX)/lib
+else
+LIBDIR ?= $(PREFIX)/lib64
+endif
+
+-include $(TOPDIR)/local.mk
+
+HOME_PATH = $(subst /,\/,$(MHVTL_HOME_PATH))
+CONFIG_PATH = $(subst /,\/,$(MHVTL_CONFIG_PATH))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/etc/Makefile 
new/mhvtl-1.70_release+862.561d4d5b473f/etc/Makefile
--- old/mhvtl-1.64_release+835.6beb0aa01437/etc/Makefile        2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/etc/Makefile        2022-06-01 
03:40:51.000000000 +0200
@@ -2,9 +2,8 @@
 # etc/Makefile
 #
 
-TOP_DIR ?= ..
-
-USR_DIR = $(TOP_DIR)/usr
+CURDIR = "../"
+include ../config.mk
 
 TAPE_SERVICE_FILE = vtltape@.service
 LIB_SERVICE_FILE = vtllibrary@.service
@@ -17,14 +16,6 @@
 GENERATE_DEVICE_CONF = generate_device_conf
 GENERATE_LIB_CONTENTS = generate_library_contents
 
-SYSTEMD_SERVICE_DIR ?= /lib/systemd/system
-
-MHVTL_CONFIG_PATH ?= /etc/mhvtl
-MHVTL_HOME_PATH ?= /opt/mhvtl
-
-CONFIG_PATH = $(shell echo $(MHVTL_CONFIG_PATH) | sed -e s'/\//\\\//g')
-HOME_PATH = $(shell echo $(MHVTL_HOME_PATH) | sed -e s'/\//\\\//g')
-
 # files that need to be generated
 GENERATOR_FILES=$(MHVTL_CONF_FILE).in \
                $(TAPE_SERVICE_FILE).in \
@@ -53,10 +44,10 @@
        chmod 755 $@
 
 $(DEVICE_CONF_FILE): $(GENERATE_DEVICE_CONF)
-       sh ./$(GENERATE_DEVICE_CONF) --force --home-dir=$(MHVTL_HOME_PATH) 
--override-home
+       bash ./$(GENERATE_DEVICE_CONF) --force --home-dir=$(MHVTL_HOME_PATH) 
--override-home
 
 $(LIB_CONTENTS_FILES): $(GENERATE_LIB_CONTENTS) $(DEVICE_CONF_FILE)
-       sh ./$(GENERATE_LIB_CONTENTS) --force --config=.
+       bash ./$(GENERATE_LIB_CONTENTS) --force --config=.
 
 .PHONY: distclean
 distclean: clean
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/kernel/Makefile 
new/mhvtl-1.70_release+862.561d4d5b473f/kernel/Makefile
--- old/mhvtl-1.64_release+835.6beb0aa01437/kernel/Makefile     2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/kernel/Makefile     2022-06-01 
03:40:51.000000000 +0200
@@ -1,12 +1,6 @@
 #
 # $Id: Makefile,v 1.2.2.3 2006-08-30 06:35:14 markh Exp $
 #
-# For Debian/Ubuntu systems
-# make ubuntu=1
-#
-# or for SuSE / RedHat systems
-# make
-#
 
 # CC=/usr/bin/gcc
 #
@@ -18,17 +12,26 @@
 
 V      ?= $(shell uname -r)
 
-ifeq ($(ubuntu),)
- KDIR  := /lib/modules/$(V)/build
+ifeq ($(KDIR),)
+ifneq ($(wildcard /lib/modules/$(V)/build),)
+KDIR := /lib/modules/$(V)/build
 else
- KDIR  := /usr/src/linux-headers-$(V)/
+ifneq ($(wildcard /usr/src/linux-headers-$(V)),)
+KDIR := /usr/src/linux-headers-$(V)
+endif
 endif
+endif
+
+export KDIR
 
 PWD    := $(shell pwd)
 
-default:
+default:       config.h
        $(MAKE) -C $(KDIR) M=$(PWD) modules
 
+config.h:
+       ./config.sh
+
 clean:
        rm -f mhvtl.ko
        $(RM) TAGS
@@ -36,7 +39,7 @@
 distclean:
        rm -f mhvtl.o mhvtl.ko \
        *.o \
-       *.o.d \
+       .*.o.d \
        mhvtl.mod.c \
        Modules.symvers \
        Module.symvers \
@@ -53,7 +56,8 @@
        modules.order \
        mhvtl.ko.unsigned \
        .mhvtl.ko.unsigned.cmd \
-       TAGS
+       TAGS \
+       config.h
        rm -rf .tmp_versions
 
 install:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/mhvtl-1.64_release+835.6beb0aa01437/kernel/backport.h 
new/mhvtl-1.70_release+862.561d4d5b473f/kernel/backport.h
--- old/mhvtl-1.64_release+835.6beb0aa01437/kernel/backport.h   2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/kernel/backport.h   2022-06-01 
03:40:51.000000000 +0200
@@ -2,6 +2,8 @@
  * Include wrappers for older kernels as interfaces change
  */
 
+#include "config.h"
+
 #ifndef SG_SEGMENT_SZ
 #define SG_SEGMENT_SZ  65536
 #endif
@@ -13,6 +15,7 @@
 /*
  * Copied kmem_cache_create_usercopy() from scst project
  */
+#if !defined(HAVE_KMEM_CACHE_CREATE_USERCOPY)
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)
 static inline struct kmem_cache *kmem_cache_create_usercopy(const char *name,
                        unsigned int size, unsigned int align,
@@ -32,8 +35,9 @@
        return kmem_cache_create(name, size, align, flags, ctor);
 }
 #endif
+#endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
+#if !defined(HAVE_FILE_INODE)
 /*
  * See also patch "new helper: file_inode(file)" (commit ID
  * 496ad9aa8ef448058e36ca7a787c61f2e63f0f54).
@@ -49,7 +53,7 @@
 #define HAVE_UNLOCKED_IOCTL 1
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
+#if !defined(HAVE_SYSFS_EMIT)
 /* 
https://patches.linaro.org/project/stable/patch/20210305120853.392925...@linuxfoundation.org/
 */
 /**
  *     sysfs_emit - scnprintf equivalent, aware of PAGE_SIZE buffer.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/kernel/config.sh 
new/mhvtl-1.70_release+862.561d4d5b473f/kernel/config.sh
--- old/mhvtl-1.64_release+835.6beb0aa01437/kernel/config.sh    1970-01-01 
01:00:00.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/kernel/config.sh    2022-06-01 
03:40:51.000000000 +0200
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+# vim: tabstop=4 shiftwidth=4 expandtab colorcolumn=80 foldmethod=marker :
+
+declare -A syms
+syms[kmem_cache_create_usercopy]='slab.h'
+syms[file_inode]='fs.h'
+syms[sysfs_emit]='sysfs.h'
+
+output='config.h'
+kparent="${KDIR%/*}"
+
+if [ -e "${KDIR}/include/linux/fs.h" ]
+then
+    hdrs="${KDIR}"
+elif [ -e "${kparent}/source/include/linux/fs.h" ]
+then
+    hdrs="${kparent}/source"
+else
+    echo "Cannot infer kernel headers location"
+    exit 1
+fi
+
+rm -f "${output}"
+
+cat <<EOF >"${output}"
+/* Autogenerated by kernel/config.sh - do not edit
+ */
+
+#ifndef _MHVTL_KERNEL_CONFIG_H
+#define _MHVTL_KERNEL_CONFIG_H
+
+
+EOF
+
+for sym in ${!syms[@]}
+do
+    grep -q "${sym}" "${hdrs}/include/linux/${syms[$sym]}"
+    if [ $? -eq 0 ]
+    then
+        printf '#define HAVE_%s\n' "$( echo "${sym}" | tr [:lower:] [:upper:] 
)" >> "${output}"
+    else
+        printf '#undef HAVE_%s\n' "$( echo "${sym}" | tr [:lower:] [:upper:] 
)" >> "${output}"
+    fi
+done
+
+printf '\n\n#endif /* _MHVTL_KERNEL_CONFIG_H */\n' >> "${output}"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/kernel/mhvtl.c 
new/mhvtl-1.70_release+862.561d4d5b473f/kernel/mhvtl.c
--- old/mhvtl-1.64_release+835.6beb0aa01437/kernel/mhvtl.c      2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/kernel/mhvtl.c      2022-06-01 
03:40:51.000000000 +0200
@@ -275,8 +275,12 @@
                                        int reason);
 #endif
 #endif
-static int mhvtl_queuecommand_lck(struct scsi_cmnd *,
-                                       void (*done) (struct scsi_cmnd *));
+static int mhvtl_queuecommand_lck(struct scsi_cmnd *
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,16,0)
+               , done_funct_t done
+#endif
+               );
+
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
 static int mhvtl_b_ioctl(struct scsi_device *, unsigned int, void __user *);
 #else
@@ -593,8 +597,15 @@
 /**********************************************************************
  *                Main interface from SCSI mid level
  **********************************************************************/
-static int mhvtl_queuecommand_lck(struct scsi_cmnd *SCpnt, done_funct_t done)
+static int mhvtl_queuecommand_lck(struct scsi_cmnd *SCpnt
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,16,0)
+               , done_funct_t done
+#endif
+               )
 {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0)
+       void (*done)(struct scsi_cmnd *) = scsi_done;
+#endif
        unsigned char *cmd = (unsigned char *) SCpnt->cmnd;
        int errsts = 0;
        struct mhvtl_lu_info *lu = NULL;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/man/Makefile 
new/mhvtl-1.70_release+862.561d4d5b473f/man/Makefile
--- old/mhvtl-1.64_release+835.6beb0aa01437/man/Makefile        2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/man/Makefile        2022-06-01 
03:40:51.000000000 +0200
@@ -15,23 +15,13 @@
 # @ at the beginning of the first line tell make not to echo the commands as 
it run it.
 #
 
-VER = $(shell awk '/Version/ {print $$2}' ../mhvtl-utils.spec)
-REL = $(shell awk '/Release/ {print $$2}' ../mhvtl-utils.spec)
+CURDIR = "../"
 
-VERSION ?= $(VER)
-EXTRAVERSION =  $(if $(shell git show-ref 2>/dev/null),-git-$(shell git 
show-ref --head --abbrev|head -1|awk '{print $$1}'))
+include ../config.mk
 
 MONTH = $(shell date -r ../ChangeLog +%B)
 YEAR = $(shell date -r ../ChangeLog +%Y)
 
-PREFIX ?= /usr
-MHVTL_HOME_PATH ?= /opt/mhvtl
-MHVTL_CONFIG_PATH ?= /etc/mhvtl
-MANDIR ?= /share/man
-
-CONFIG_PATH = $(shell echo $(MHVTL_CONFIG_PATH) | sed -e s'/\//\\\//g')
-HOME_PATH = $(shell echo $(MHVTL_HOME_PATH) | sed -e s'/\//\\\//g')
-
 objects = $(patsubst %.in,%,$(wildcard *.in))
 
 man: $(objects)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/mhvtl-1.64_release+835.6beb0aa01437/man/dump_tape.1.in 
new/mhvtl-1.70_release+862.561d4d5b473f/man/dump_tape.1.in
--- old/mhvtl-1.64_release+835.6beb0aa01437/man/dump_tape.1.in  2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/man/dump_tape.1.in  2022-06-01 
03:40:51.000000000 +0200
@@ -27,7 +27,7 @@
 \fB\-l n\fR
 Where lib_no is the library index number (default library index numbers 10 & 
30).
 .TP
-\fB\-f PCL\fR
+\fB\-m PCL\fR
 where PCL is the Physical Cartridge Label (barcode). This is required.
 .TP
 .B \-D
@@ -48,5 +48,6 @@
 .BR library_contents(5),
 .BR vtlcmd(1),
 .BR vtllibrary(1),
-.BR vtltape(1)
-.BR edit_tape(1)
+.BR vtltape(1),
+.BR edit_tape(1),
+.BR preload_tape(1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/mhvtl-1.64_release+835.6beb0aa01437/man/preload_tape.1.in 
new/mhvtl-1.70_release+862.561d4d5b473f/man/preload_tape.1.in
--- old/mhvtl-1.64_release+835.6beb0aa01437/man/preload_tape.1.in       
2022-01-11 08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/man/preload_tape.1.in       
2022-06-01 03:40:51.000000000 +0200
@@ -27,7 +27,7 @@
 \fB\-l n\fR
 Where lib_no is the library index number (default library index numbers 10 & 
30).
 .TP
-\fB\-f PCL\fR
+\fB\-m PCL\fR
 where PCL is the Physical Cartridge Label (barcode). This is required.
 .TP
 \fB\-F <filename>\fR
@@ -57,5 +57,5 @@
 .BR vtlcmd(1),
 .BR dump_tape(1),
 .BR vtllibrary(1),
-.BR vtltape(1)
+.BR vtltape(1),
 .BR edit_tape(1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/mhvtl-utils.spec 
new/mhvtl-1.70_release+862.561d4d5b473f/mhvtl-utils.spec
--- old/mhvtl-1.64_release+835.6beb0aa01437/mhvtl-utils.spec    2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/mhvtl-utils.spec    2022-06-01 
03:40:51.000000000 +0200
@@ -12,9 +12,9 @@
 Summary: Virtual tape library. kernel pseudo HBA driver + userspace daemons
 %define real_name mhvtl
 Name: mhvtl-utils
-%define real_version 2021-10-07
-Version: 1.6
-Release: 4%{?dist}
+%define real_version 2022-03-10
+Version: 1.7
+Release: 0%{?dist}
 License: GPL
 Group: System/Kernel
 URL: http://sites.google.com/site/linuxvtl2/
@@ -29,9 +29,6 @@
 %{?systemd_requires}
 %{?systemd_ordering}
 
-%{?!_systemdgeneratordir:%define _systemdgeneratordir 
/usr/lib/systemd/system-generators}
-
-
 Obsoletes: mhvtl <= %{version}-%{release}
 Provides: mhvtl = %{version}-%{release}
 
@@ -75,7 +72,8 @@
 
 %build
 make MHVTL_HOME_PATH=%{mhvtl_home_dir} VERSION=%{version} \
-       SYSTEMD_GENERATOR_DIR=%{_systemdgeneratordir}
+       SYSTEMD_GENERATOR_DIR=%{_systemdgeneratordir} \
+       SYSTEMD_SERVICE_DIR=%{_unitdir}
 
 %install
 %make_install \
@@ -140,6 +138,9 @@
 %dir /opt/mhvtl/
 
 %changelog
+* Thu Mar 10 2022 Mark Harvey <markh...@gmail.com> - 1.7-0
+- Updated to release 1.7-0 (2022-02-10).
+
 * Thu Oct 07 2021 Mark Harvey <markh...@gmail.com> - 1.6-4
 - Updated to release 1.6-4 (2021-10-07).
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/scripts/Makefile 
new/mhvtl-1.70_release+862.561d4d5b473f/scripts/Makefile
--- old/mhvtl-1.64_release+835.6beb0aa01437/scripts/Makefile    2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/scripts/Makefile    2022-06-01 
03:40:51.000000000 +0200
@@ -1,9 +1,9 @@
 
+CURDIR = "../"
+include ../config.mk
+
 RCFILE = update_device.conf
-PREFIX ?= /usr
-MHVTL_CONFIG_PATH ?= /etc/mhvtl
 
-CONFIG_PATH = $(shell echo $(MHVTL_CONFIG_PATH) | sed -e s'/\//\\\//g')
 $(RCFILE): $(RCFILE).in
        sed -e s'/@CONF_PATH@/$(CONFIG_PATH)/' $< > $@
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/tcopy/Makefile 
new/mhvtl-1.70_release+862.561d4d5b473f/tcopy/Makefile
--- old/mhvtl-1.64_release+835.6beb0aa01437/tcopy/Makefile      2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/tcopy/Makefile      2022-06-01 
03:40:51.000000000 +0200
@@ -1,10 +1,13 @@
 # Makefile for linux port of Tcopy
 # By Nicholas Harbour, 2000
 
+CURDIR = "../"
+include ../config.mk
+
 BINARY=tcopy
 MANPAGE=tcopy.1
-BIN_PATH=/usr/bin/
-MAN_PATH=/usr/local/man/man1/
+BIN_PATH=$(PREFIX)/bin/
+MAN_PATH=$(PREFIX)/$(MANDIR)/man1/
 OBJS=tcopy.o
 CC=gcc
 OPTS=-Wall
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/test_lbp.sh 
new/mhvtl-1.70_release+862.561d4d5b473f/test_lbp.sh
--- old/mhvtl-1.64_release+835.6beb0aa01437/test_lbp.sh 1970-01-01 
01:00:00.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/test_lbp.sh 2022-06-01 
03:40:51.000000000 +0200
@@ -0,0 +1,81 @@
+#!/bin/bash
+
+#systemctl stop mhvtl
+#systemctl start mhvtl
+
+# Library source slot to move tape to/from
+SOURCE_SLOT=1
+# Which drive are we testing - /etc/mhvtl/device.conf
+DRV_INDEX=18
+
+i=`grep -A6 "^Drive: ${DRV_INDEX} " /etc/mhvtl/device.conf | awk '/Library/ 
{print $5}'`
+# Convert into hex - leading '0' typically means it's an octal value
+TARGET_DRIVE=$((16#$i-1))
+
+read -r channel id lun <<< `grep "^Drive: ${DRV_INDEX} " 
/etc/mhvtl/device.conf | awk '{print $4,$6,$8}'`
+#echo "Channel: $channel, id: $id, lun: $lun"
+
+HBA=`lsscsi -H | awk '/mhvtl/ {print $1}' | sed -e 's/\[//g' -e 's/\]//g'`
+SG=`lsscsi -g ${HBA} ${channel} ${id} ${lun} | awk '{print $7}'`
+ST=`lsscsi -g ${HBA} ${channel} ${id} ${lun} | awk '{print $6}'`
+
+MTX=`lsscsi -g ${HBA} 0 0 0 | awk '{print $7}'`
+
+#echo "HBA: ${HBA}"
+#echo "st : ${ST}"
+#echo "sg : ${SG}"
+#echo "mtx : ${MTX}"
+
+echo "++ Moving tape slot: ${SOURCE_SLOT} to drive: ${TARGET_DRIVE}"
+mtx -f ${MTX} load ${SOURCE_SLOT} ${TARGET_DRIVE}
+vtlcmd ${DRV_INDEX} verbose
+vtlcmd ${DRV_INDEX} verbose
+
+echo
+
+echo "++ Checking status of ${ST}"
+mt -f ${ST} status
+
+echo
+
+CRC32C=2
+RSCRC=1
+LBP_W="40"
+LBP_R="80"
+LBP_RW="c0"
+## Set LBP_W
+#sg_wr_mode -p 0x0a,0xf0 -d -c 
0a,f0,00,1c,${CRC32C},4,${LBP_W},0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 
${SG}
+## Set LBP_R
+#sg_wr_mode -p 0x0a,0xf0 -d -c 
0a,f0,00,1c,${CRC32C},4,${LBP_R},0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 
${SG}
+
+# Set LBP_R & LBP_W
+echo -e "++ Enable LBP CRC32C RW\n"
+sg_wr_mode -p 0x0a,0xf0 -d -c 
0a,f0,00,1c,${CRC32C},4,${LBP_RW},0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 
${SG}
+
+echo -e "++ Reading 64k + 4 to /tmp/CRC32c.out"
+dd if=${ST} of=/tmp/CRC32c.out bs=65540 count=1
+
+echo
+
+echo -e "++ Enable LBP Reed-Solomon CRC RW\n"
+sg_wr_mode -p 0x0a,0xf0 -d -c 
0a,f0,00,1c,${RSCRC},4,${LBP_RW},0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 
${SG}
+
+echo "++ Reading 64k + 4 to /tmp/RS-CRC.out"
+dd if=${ST} of=/tmp/RS-CRC.out bs=65540 count=1
+
+echo
+
+# Turn off LBP
+echo -e "++ Turn off LBP\n"
+sg_wr_mode -p 0x0a,0xf0 -d -c 
0a,f0,00,1c,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ${SG}
+
+echo "++ Reading 64k to /tmp/NO_LBP.out"
+dd if=${ST} of=/tmp/NO_LBP.out bs=65540 count=1
+
+echo
+
+echo "Offline drive"
+mt -f ${ST} offline
+
+echo "Moving tape from drive: ${TARGET_DRIVE} to slot: ${SOURCE_SLOT}"
+mtx -f ${MTX} unload ${SOURCE_SLOT} ${TARGET_DRIVE}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/usr/Makefile 
new/mhvtl-1.70_release+862.561d4d5b473f/usr/Makefile
--- old/mhvtl-1.64_release+835.6beb0aa01437/usr/Makefile        2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/usr/Makefile        2022-06-01 
03:40:51.000000000 +0200
@@ -15,24 +15,9 @@
 # @ at the beginning of the first line tell make not to echo the commands as 
it run it.
 #
 
-VER = $(shell awk '/Version/ {print $$2}' ../mhvtl-utils.spec)
-REL = $(shell awk '/Release/ {print $$2}' ../mhvtl-utils.spec | sed 
's/%{?dist}//g')
+CURDIR = "../"
 
-VERSION ?= $(VER).$(REL)
-EXTRAVERSION =  $(if $(shell git show-ref 2>/dev/null),-git-$(shell git 
show-ref --head --abbrev|head -1|awk '{print $$1}'))
-
-PREFIX ?= /usr
-SYSTEMD_GENERATOR_DIR ?= /lib/systemd/system-generators
-MHVTL_HOME_PATH ?= /opt/mhvtl
-MHVTL_CONFIG_PATH ?= /etc/mhvtl
-CONFIG_PATH = $(shell echo $(MHVTL_CONFIG_PATH) | sed -e s'/\//\\\//g')
-HOME_PATH = $(shell echo $(MHVTL_HOME_PATH) | sed -e s'/\//\\\//g')
-
-ifeq ($(shell grep lib64$ /etc/ld.so.conf /etc/ld.so.conf.d/* | wc -l),0)
-LIBDIR ?= $(PREFIX)/lib
-else
-LIBDIR ?= $(PREFIX)/lib64
-endif
+include ../config.mk
 
 CFLAGS=-Wall -Wshadow -g -O2 -D_LARGEFILE64_SOURCE $(RPM_OPT_FLAGS) 
-I../kernel -I../ccan
 CFLAGS += -DMHVTL_VERSION=\"$(VERSION)$(EXTRAVERSION)\"
@@ -40,6 +25,7 @@
 CFLAGS += -DMHVTL_DEBUG
 CFLAGS += -DMHVTL_HOME_PATH=\"$(MHVTL_HOME_PATH)\"
 CFLAGS += -DMHVTL_CONFIG_PATH=\"$(MHVTL_CONFIG_PATH)\"
+CFLAGS += -DSYSTEMD_SERVICE_DIR=\"$(SYSTEMD_SERVICE_DIR)\"
 
 CLFLAGS=-shared ${RPM_OPT_FLAGS}
 
@@ -110,12 +96,9 @@
        @rm -f ./validate_crc
 
 
-preload_tape:  tape_util.o vtlcart.o libvtlscsi.so vtltape.h mhvtl_scsi.h \
-               ../kernel/vtl_common.h minilzo.c minilzo.h minilzo.o \
-               crc32c.o crc32c.c mhvtl_io.o mhvtl_io.c \
-               reed-solomon.o reed-solomon.c
-       $(CC) $(CFLAGS) -o preload_tape crc32c.o mhvtl_io.o reed-solomon.o 
tape_util.o minilzo.o default_ssc_pm.o -L. \
-               -lz -L. -lvtlcart -lvtlscsi
+preload_tape:  dump_tape
+               @rm -f $@
+               ln $? $@
 
 dump_tape:     tape_util.o vtlcart.o libvtlscsi.so vtltape.h mhvtl_scsi.h \
                ../kernel/vtl_common.h minilzo.c minilzo.h minilzo.o \
@@ -241,7 +224,8 @@
        install -m 755 vtlcmd $(DESTDIR)$(PREFIX)/bin/
        install -m 755 mktape $(DESTDIR)$(PREFIX)/bin/
        install -m 755 dump_tape $(DESTDIR)$(PREFIX)/bin/
-       install -m 755 preload_tape $(DESTDIR)$(PREFIX)/bin/
+       @rm -f $(DESTDIR)$(PREFIX)/bin/preload_tape
+       ln $(DESTDIR)$(PREFIX)/bin/dump_tape 
$(DESTDIR)$(PREFIX)/bin/preload_tape 
        install -m 755 edit_tape $(DESTDIR)$(PREFIX)/bin/
        install -m 755 tapeexerciser $(DESTDIR)$(PREFIX)/bin/
        install -m 755 make_vtl_media $(DESTDIR)$(PREFIX)/bin/
@@ -250,4 +234,3 @@
 
 tar:
        make -C ../ tar
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/usr/edit_tape.c 
new/mhvtl-1.70_release+862.561d4d5b473f/usr/edit_tape.c
--- old/mhvtl-1.64_release+835.6beb0aa01437/usr/edit_tape.c     2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/usr/edit_tape.c     2022-06-01 
03:40:51.000000000 +0200
@@ -185,7 +185,7 @@
        }
 
        if (pcl == NULL) {
-               printf("Please supply a barcode (-b barcode)\n\n");
+               printf("Please supply a barcode (-m barcode)\n\n");
                usage(progname);
                exit(1);
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/mhvtl-1.64_release+835.6beb0aa01437/usr/hp_ultrium_pm.c 
new/mhvtl-1.70_release+862.561d4d5b473f/usr/hp_ultrium_pm.c
--- old/mhvtl-1.64_release+835.6beb0aa01437/usr/hp_ultrium_pm.c 2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/usr/hp_ultrium_pm.c 2022-06-01 
03:40:51.000000000 +0200
@@ -214,13 +214,28 @@
        if (lu_priv->load_status == TAPE_LOADED) {
                switch (mam.MediaType) {
                case Media_LTO4:
-                       MHVTL_DBG(1, "LTO4 Medium");
+                       MHVTL_DBG(1, "LTO4 Medium - Setting AVFMV");
                        buf[24] |= 0x80; /* AVFMV */
                        break;
                case Media_LTO5:
-                       MHVTL_DBG(1, "LTO5 Medium");
+                       MHVTL_DBG(1, "LTO5 Medium - Setting AVFMV");
                        buf[24] |= 0x80; /* AVFMV */
                        break;
+               case Media_LTO6:
+                       MHVTL_DBG(1, "LTO6 Medium - Setting AVFMV");
+                       buf[24] |= 0x80; /* AVFMV */
+                       break;
+               case Media_LTO7:
+                       MHVTL_DBG(1, "LTO7 Medium - Setting AVFMV");
+                       buf[24] |= 0x80; /* AVFMV */
+                       break;
+               case Media_LTO8:
+                       MHVTL_DBG(1, "LTO8 Medium - Setting AVFMV");
+                       buf[24] |= 0x80; /* AVFMV */
+                       break;
+               default:
+                       MHVTL_DBG(1, "Unable to set Encryption (AVFMV) bit on 
mounted media");
+                       break;
                }
        }
        buf[32] |= 0x08; /* RDMC_C == 4 */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/mhvtl-1.64_release+835.6beb0aa01437/usr/mhvtl-device-conf-generator.c 
new/mhvtl-1.70_release+862.561d4d5b473f/usr/mhvtl-device-conf-generator.c
--- old/mhvtl-1.64_release+835.6beb0aa01437/usr/mhvtl-device-conf-generator.c   
2022-01-11 08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/usr/mhvtl-device-conf-generator.c   
2022-06-01 03:40:51.000000000 +0200
@@ -10,6 +10,7 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -24,6 +25,7 @@
 #define                MHVTL_CONFIG_PATH "/etc/mhvtl"
 #endif
 
+extern char *__progname;
 static int     debug_mode = 0;
 static char    *device_conf = MHVTL_CONFIG_PATH "/device.conf";
 
@@ -39,6 +41,49 @@
 static struct vtl_info *last_library = &our_libraries;
 
 /*
+ * A very thin wrapper to print to the kernel log. Since when the device
+ * config generator is run, syslog is not up yet, generally, nothing is up yet,
+ * the only place really to print information that needs to be preserved to
+ * is the kernel log. Since it is the only place, it is done here on a
+ * best-effort basis.
+ * For the description of the levels, see
+ * https://www.kernel.org/doc/html/latest/core-api/printk-basics.html
+ * Broadly speaking, 3 (ERR) or 2 (CRIT) should cover this tool's needs
+ */
+__attribute__((__format__ (__printf__, 2, 3)))
+static void pr_klog(int level, const char *fmt, ...)
+{
+       int fd;
+       char buf[1024];
+       va_list ap;
+       int rc;
+       int saved_errno = errno; /* Don't clobber errno */
+
+       if (level < 0 || level > 7)
+               level = 3;
+
+       snprintf(buf, sizeof(buf), "<%d>", level);
+       va_start(ap, fmt);
+       vsnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), fmt, ap);
+       va_end(ap);
+
+       fd = open("/dev/kmsg", O_WRONLY);
+       if (fd == -1) {
+               if (debug_mode)
+                       (void ) fprintf(stderr, "Cannot open /dev/kmsg: %s\n", 
strerror(errno));
+               errno = saved_errno;
+               return;
+       }
+
+       rc = write(fd, buf, strlen(buf));
+       if (rc) { }; /* Silence warn_unused_result - not much to do if it fails 
*/
+       close(fd);
+
+       errno = saved_errno;
+       return;
+}
+
+/*
  * return 1 if path is a writable directory, else return 0
  */
 static int is_writable_dir(char *path)
@@ -167,7 +212,7 @@
  * this order. But DO assume that a library will not be referenced
  * before it is mentioned by a drive that uses it
  */
-static void parse_config_file(char *path)
+static int parse_config_file(char *path)
 {
        FILE                    *fp = NULL;
        char                    line_buf[MAX_LINE_WIDTH+1];
@@ -179,9 +224,12 @@
                (void) fprintf(stderr, "DEBUG: parsing config file: %s\n",
                                path);
        if ((fp = fopen(path, "r")) == NULL) {
+               pr_klog(3, "%s: Cannot open config file %s: %s\n",
+                       __progname, path, strerror(errno));
                if (debug_mode)
-                       (void) fprintf(stderr, "DEBUG: error: can't open: %s\n",
-                                       path);
+                       (void) fprintf(stderr, "DEBUG: error: cannot open 
config file %s: %s\n",
+                                       path, strerror(errno));
+               return -1;
        }
 
        while ((cp = fgets(line_buf, MAX_LINE_WIDTH, fp)) != NULL) {
@@ -206,6 +254,7 @@
 
 dun:
        (void) fclose(fp);
+       return 0;
 }
 
 int main(int argc, char **argv)
@@ -214,6 +263,7 @@
        struct vtl_info *ip;
        const char      dirname[] = "mhvtl.target.wants";
        char            *path;
+       int             rc;
 
 
        working_dir = get_working_dir(argc, argv);
@@ -221,7 +271,7 @@
                exit(1);
 
        /*
-        * parse the config file /etc/mhvtl/device.conf
+        * parse the device.conf config file
         *
         * for each library found:
         *      - set up vtllibrary unit
@@ -230,7 +280,9 @@
         */
 
        /* put config in our_tape_library */
-       parse_config_file(device_conf);
+       rc = parse_config_file(device_conf);
+       if (rc == -1)
+               exit(1);
 
        if (debug_mode) {
                (void) printf("DEBUG: Libraries:\n");
@@ -250,8 +302,8 @@
                printf("DEBUG: creating dir: %s\n", path);
        if (mkdir(path, 0755) < 0) {
                if (debug_mode)
-                       (void) fprintf(stderr, "DEBUG: error: can't mkdir: 
%s\n",
-                                       path);
+                       (void) fprintf(stderr, "DEBUG: error: can't mkdir %s: 
%s\n",
+                                       path, strerror(errno));
                // clean up?
                exit(1);
        }
@@ -260,42 +312,45 @@
        if (debug_mode)
                printf("DEBUG: scanning libraries ...\n");
        for (ip = our_libraries.next; ip != NULL; ip = ip->next) {
-               const char to_path[] = 
"/usr/lib/systemd/system/vtllibrary@.service";
-               if (asprintf(&path, "%s/%s/vtllibrary@%d.service", working_dir, 
dirname, ip->num) < 0) {
+               char *from_path, *to_path;
+               if ((asprintf(&from_path, "%s/%s/vtllibrary@%d.service", 
working_dir, dirname, ip->num) < 0) ||
+                   (asprintf(&to_path, "%s/vtllibrary@.service", 
SYSTEMD_SERVICE_DIR) < 0)) {
                        perror("Could not allocate memory (for vtllibrary 
template symlink)");
                        exit(1);
                }
                if (debug_mode)
-                       (void) fprintf(stderr, "DEBUG: creating symlink: %s => 
%s\n", path, to_path);
-               if (symlink(to_path, path) < 0) {
+                       (void) fprintf(stderr, "DEBUG: creating symlink: %s => 
%s\n", from_path, to_path);
+               if (symlink(to_path, from_path) < 0) {
                        if (debug_mode)
                                (void) fprintf(stderr, "DEBUG: error: can't 
create symlink (%d): %s => %s\n",
-                                               errno, path, to_path);
+                                               errno, from_path, to_path);
                        // clean up?
                        exit(1);
                }
-               free(path);
+               free(from_path);
+               free(to_path);
        }
        if (debug_mode)
                printf("DEBUG: scanning tapes ...\n");
        for (ip = our_tapes.next; ip != NULL; ip = ip->next) {
-               const char *to_path = 
"/usr/lib/systemd/system/vtltape@.service";
-               if (asprintf(&path, "%s/%s/vtltape@%d.service", working_dir, 
dirname, ip->num) < 0) {
+               char *from_path, *to_path;
+               if ((asprintf(&from_path, "%s/%s/vtltape@%d.service", 
working_dir, dirname, ip->num) < 0) ||
+                   (asprintf(&to_path, "%s/vtltape@.service", 
SYSTEMD_SERVICE_DIR) < 0)) {
                        perror("Could not allocate memory (for vtltape template 
symlink)");
                        exit(1);
                }
                if (debug_mode)
-                       (void) fprintf(stderr, "DEBUG: creating symlink: %s => 
%s\n", path, to_path);
-               if (symlink(to_path, path) < 0) {
+                       (void) fprintf(stderr, "DEBUG: creating symlink: %s => 
%s\n", from_path, to_path);
+               if (symlink(to_path, from_path) < 0) {
                        if (debug_mode)
                                (void) fprintf(stderr, "DEBUG: error: can't 
create symlink (%d): %s => %s\n",
-                                               errno, path, to_path);
+                                               errno, from_path, to_path);
                        // clean up?
                        exit(1);
                }
-               free(path);
+               free(from_path);
+               free(to_path);
        }
 
-
        exit(0);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/usr/mhvtl_io.c 
new/mhvtl-1.70_release+862.561d4d5b473f/usr/mhvtl_io.c
--- old/mhvtl-1.64_release+835.6beb0aa01437/usr/mhvtl_io.c      2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/usr/mhvtl_io.c      2022-06-01 
03:40:51.000000000 +0200
@@ -332,7 +332,8 @@
        blk_flags = c_pos->blk_flags;
 
        if (blk_size > request_sz) {
-               bounce_buffer = malloc(blk_size);
+               /* Add a fudge of 4 bytes in caes LBP is calculated */
+               bounce_buffer = malloc(blk_size + 4);
                if (!bounce_buffer) {
                        MHVTL_ERR("Unable to allocate %d bytes for bounce 
buffer",
                                        blk_size);
@@ -359,8 +360,10 @@
                rc = blk_size;
        }
 
+       /* At this point, rc should now contain the actual uncompressed size of 
the block just read */
+
        if (blk_flags & BLKHDR_FLG_CRC) {
-               post_crc = mhvtl_crc32c(bounce_buffer, blk_size);
+               post_crc = mhvtl_crc32c(bounce_buffer, rc);
 
                if (pre_crc != post_crc) {
                        MHVTL_ERR("Recorded CRC: 0x%08x, Calculated CRC: 
0x%08x", pre_crc, post_crc);
@@ -373,7 +376,7 @@
        /* Update Logical Block Protection CRC */
        switch (lbp_method) {
        case 1:
-               lbp_crc = mhvtl_rscrc(bounce_buffer, blk_size);
+               lbp_crc = mhvtl_rscrc(bounce_buffer, rc);
                put_unaligned_be32(lbp_crc, &bounce_buffer[rc]);
                MHVTL_DBG(2, "Logical Block Protection - Reed-Solomon CRC, rc: 
%d, request_sz: %d, lbp_size: %d, RS-CRC: 0x%08x",
                                                        rc, request_sz, lbp_sz, 
lbp_crc);
@@ -382,7 +385,7 @@
        case 2:
                MHVTL_DBG(2, "rc: %d, request_sz: %d bounce buffer before LBP: 
0x%08x %08x", rc, request_sz, get_unaligned_be32(&bounce_buffer[rc - 4]), 
get_unaligned_be32(&bounce_buffer[rc]));
                /* If we don't have a LBP CRC32C format, re-calculate now */
-               lbp_crc = (blk_flags & BLKHDR_FLG_CRC) ? pre_crc : 
mhvtl_crc32c(bounce_buffer, blk_size);
+               lbp_crc = (blk_flags & BLKHDR_FLG_CRC) ? pre_crc : 
mhvtl_crc32c(bounce_buffer, rc);
                put_unaligned_be32(lbp_crc, &bounce_buffer[rc]);
                MHVTL_DBG(2, "Logical Block Protection - CRC32C, rc: %d, 
request_sz: %d, lbp_size: %d, CRC32C: 0x%8x",
                                                        rc, request_sz, lbp_sz, 
lbp_crc);
@@ -404,6 +407,7 @@
         * data back into buf
        */
        if (bounce_buffer != buf) {
+               MHVTL_DBG(1, "Bounce buffer in use: request_sz: %d", 
request_sz);
                memcpy(buf, bounce_buffer, request_sz);
                free(bounce_buffer);
                rc = request_sz;
@@ -440,7 +444,7 @@
                with the fixed bit set to zero).
        */
        if (rc != request_sz)
-               mk_sense_short_block(lbp_sz, rc, sam_stat);
+               mk_sense_short_block(request_sz, rc, sam_stat);
        else if (!sili) {
                if (lbp_sz < blk_size)
                        mk_sense_short_block(lbp_sz, blk_size, sam_stat);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/usr/mktape.c 
new/mhvtl-1.70_release+862.561d4d5b473f/usr/mktape.c
--- old/mhvtl-1.64_release+835.6beb0aa01437/usr/mktape.c        2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/usr/mktape.c        2022-06-01 
03:40:51.000000000 +0200
@@ -153,7 +153,7 @@
        }
 
        if (pcl == NULL) {
-               fprintf(stderr, "error: Please supply a barcode (-b 
barcode)\n\n");
+               fprintf(stderr, "error: Please supply a barcode (-m 
barcode)\n\n");
                usage(progname);
                exit(1);
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/usr/ssc.c 
new/mhvtl-1.70_release+862.561d4d5b473f/usr/ssc.c
--- old/mhvtl-1.64_release+835.6beb0aa01437/usr/ssc.c   2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/usr/ssc.c   2022-06-01 
03:40:51.000000000 +0200
@@ -2110,3 +2110,88 @@
        return SAM_STAT_CHECK_CONDITION;
 }
 
+uint8_t ssc_recv_diagnostics(struct scsi_cmd *cmd)
+{
+       struct s_sd sd;
+       uint8_t *sam_stat;
+
+       sam_stat = &cmd->dbuf_p->sam_stat;
+
+       MHVTL_DBG(1, "SSC RECEIVE DIAGNOSTICS (%ld) **", 
(long)cmd->dbuf_p->serialNo);
+
+       cmd->dbuf_p->sz = 0;
+       sd.byte0 = SKSV | CD;
+       sd.field_pointer = 2;
+       sam_illegal_request(E_INVALID_FIELD_IN_CDB, &sd, sam_stat);
+       return SAM_STAT_CHECK_CONDITION;
+}
+
+uint32_t GenerateRSCRC(uint32_t seed, int sz, const uint8_t *buf);
+uint32_t crc32c(uint32_t seed, const uint8_t *buf, int sz);
+
+uint8_t ssc_send_diagnostics(struct scsi_cmd *cmd)
+{
+       uint8_t *sam_stat;
+       int crc_check_failed = 0;
+
+       const uint8_t block1[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 
41, 43,
+                               47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 
101, 103, 107, 109, 113, 127,
+                               131, 137, 139, 149, 151, 157};
+
+       const uint8_t block2[] = {163, 167, 173, 179, 181, 191, 193, 197, 199, 
211,
+                               223, 227, 229, 233, 239, 241, 251};
+
+
+       sam_stat = &cmd->dbuf_p->sam_stat;
+
+       MHVTL_DBG(1, "SSC SEND DIAGNOSTICS (%ld) **", 
(long)cmd->dbuf_p->serialNo);
+
+       /* Sanity check - the MAM should be 1024 bytes in size */
+       if (sizeof(struct MAM) != 1024) {
+               MHVTL_ERR("Structure of MAM should be 1024 bytes, but is %ld", 
sizeof(struct MAM));
+               sam_hardware_error(E_INTERNAL_TARGET_FAILURE, sam_stat);
+               return SAM_STAT_CHECK_CONDITION;
+       }
+
+       /* Now check the CRC32C routines pass basic sanity check */
+       uint32_t computedCRC1 = crc32c(0, block1, sizeof(block1));
+       uint32_t computedCRC2 = crc32c(~computedCRC1, block2, sizeof(block2));
+       uint32_t computedCRC3 = crc32c(~crc32c(0, block1, sizeof(block1)), 
block2, sizeof(block2));
+
+       if (computedCRC1 != 0xE8174F48) {
+               MHVTL_ERR("CRC32C #1 error");
+               crc_check_failed = 1;
+       }
+       if (computedCRC2 != 0x56DAB0A6) {
+               MHVTL_ERR("CRC32C #2 error");
+               crc_check_failed = 1;
+       }
+       if (computedCRC3 != 0x56DAB0A6) {
+               MHVTL_ERR("CRC32C #3 error");
+               crc_check_failed = 1;
+       }
+
+       /* Now check the Reed/Solomon CRC routines pass basic sanity check */
+       computedCRC1 = GenerateRSCRC(0, sizeof(block1), block1);
+       computedCRC2 = GenerateRSCRC(computedCRC1, sizeof(block2), block2);
+       computedCRC3 = GenerateRSCRC(GenerateRSCRC(0, sizeof(block1), block1), 
sizeof(block2), block2);
+
+       if (computedCRC1 != 0x733D4DCA) {
+               MHVTL_ERR("RS-CRC #1 error");
+               crc_check_failed = 1;
+       }
+       if (computedCRC2 != 0x754ED37E) {
+               MHVTL_ERR("RS-CRC #2 error");
+               crc_check_failed = 1;
+       }
+       if (computedCRC3 != 0x754ED37E) {
+               MHVTL_ERR("RS-CRC #3 error");
+               crc_check_failed = 1;
+       }
+
+       if (crc_check_failed) {
+               sam_hardware_error(E_INTERNAL_TARGET_FAILURE, sam_stat);
+               return SAM_STAT_CHECK_CONDITION;
+       }
+       return SAM_STAT_GOOD;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/usr/ssc.h 
new/mhvtl-1.70_release+862.561d4d5b473f/usr/ssc.h
--- old/mhvtl-1.64_release+835.6beb0aa01437/usr/ssc.h   2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/usr/ssc.h   2022-06-01 
03:40:51.000000000 +0200
@@ -230,6 +230,8 @@
 uint8_t ssc_reserve(struct scsi_cmd *cmd);
 uint8_t ssc_rewind(struct scsi_cmd *cmd);
 uint8_t ssc_locate(struct scsi_cmd *cmd);
+uint8_t ssc_send_diagnostics(struct scsi_cmd *cmd);
+uint8_t ssc_recv_diagnostics(struct scsi_cmd *cmd);
 uint8_t ssc_space_6(struct scsi_cmd *cmd);
 uint8_t ssc_space_16(struct scsi_cmd *cmd);
 uint8_t ssc_spin(struct scsi_cmd *cmd);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/usr/tape_util.c 
new/mhvtl-1.70_release+862.561d4d5b473f/usr/tape_util.c
--- old/mhvtl-1.64_release+835.6beb0aa01437/usr/tape_util.c     2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/usr/tape_util.c     2022-06-01 
03:40:51.000000000 +0200
@@ -127,7 +127,7 @@
        lu->lu_private = priv_lu;
        lu->sense_p = sense;
        strncpy(lu->lu_serial_no, "ABC123", 7);
-       strncpy(lu->vendor_id, "TAPE_UTIL", 9);
+       strncpy(lu->vendor_id, "TAPE_UTL", 9);
        strncpy(lu->product_id, "xyzz", 5);
        INIT_LIST_HEAD(&lu->den_list);
        INIT_LIST_HEAD(&lu->mode_pg);
@@ -412,10 +412,10 @@
        if (dump_tape == 1) {
                printf("  -D               Dump data\n");
                printf("  -l lib_no        Look in specified library\n");
-               printf("  -f pcl           Look for specified PCL\n");
+               printf("  -m pcl           Look for specified PCL\n");
        } else if (dump_tape == 2) {
                printf("  -l lib_no        Look in specified library\n");
-               printf("  -f pcl           Look for specified PCL\n");
+               printf("  -m pcl           Look for specified PCL\n");
                printf("  -b <block size>  tape block size\n");
                printf("  -c <compression> Compression type (NONE|LZO|ZLIB)\n");
                printf("  -F <inputfile>   Filename to read data from\n");
@@ -491,11 +491,11 @@
                                debug++;
                                verbose = 9;    /* If debug, make verbose... */
                                break;
-                       case 'f':
+                       case 'm':
                                if (argc > 1)
                                        pcl = argv[2];
                                else
-                                       usage("More args needed for -f");
+                                       usage("More args needed for -m");
                                break;
                        case 'l':
                                if (argc > 1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/usr/ult3580_pm.c 
new/mhvtl-1.70_release+862.561d4d5b473f/usr/ult3580_pm.c
--- old/mhvtl-1.64_release+835.6beb0aa01437/usr/ult3580_pm.c    2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/usr/ult3580_pm.c    2022-06-01 
03:40:51.000000000 +0200
@@ -252,13 +252,28 @@
        if (lu_priv->load_status == TAPE_LOADED) {
                switch (mam.MediaType) {
                case Media_LTO4:
-                       MHVTL_DBG(1, "LTO4 Medium");
+                       MHVTL_DBG(1, "LTO4 Medium - Setting AVFMV");
                        buf[24] |= 0x80; /* AVFMV */
                        break;
                case Media_LTO5:
-                       MHVTL_DBG(1, "LTO5 Medium");
+                       MHVTL_DBG(1, "LTO5 Medium - Setting AVFMV");
                        buf[24] |= 0x80; /* AVFMV */
                        break;
+               case Media_LTO6:
+                       MHVTL_DBG(1, "LTO6 Medium - Setting AVFMV");
+                       buf[24] |= 0x80; /* AVFMV */
+                       break;
+               case Media_LTO7:
+                       MHVTL_DBG(1, "LTO7 Medium - Setting AVFMV");
+                       buf[24] |= 0x80; /* AVFMV */
+                       break;
+               case Media_LTO8:
+                       MHVTL_DBG(1, "LTO8 Medium - Setting AVFMV");
+                       buf[24] |= 0x80; /* AVFMV */
+                       break;
+               default:
+                       MHVTL_DBG(1, "Unable to set Encryption (AVFMV) bit on 
mounted media");
+                       break;
                }
        }
        buf[32] |= 0x08; /* RDMC_C == 4 */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/usr/vtlcart.c 
new/mhvtl-1.70_release+862.561d4d5b473f/usr/vtlcart.c
--- old/mhvtl-1.64_release+835.6beb0aa01437/usr/vtlcart.c       2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/usr/vtlcart.c       2022-06-01 
03:40:51.000000000 +0200
@@ -695,7 +695,7 @@
 
        if (verbose)
                printf("Creating new media data file: %s\n", newMedia_data);
-       datafile = creat(newMedia_data, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
+       datafile = open(newMedia_data, O_CREAT|O_TRUNC|O_WRONLY, 
S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
        if (datafile == -1) {
                MHVTL_ERR("Failed to create file %s: %s", newMedia_data,
                        strerror(errno));
@@ -704,7 +704,7 @@
        }
        if (verbose)
                printf("Creating new media index file: %s\n", newMedia_indx);
-       indxfile = creat(newMedia_indx, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
+       indxfile = open(newMedia_indx, O_CREAT|O_TRUNC|O_WRONLY, 
S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
        if (indxfile == -1) {
                MHVTL_ERR("Failed to create file %s: %s", newMedia_indx,
                        strerror(errno));
@@ -714,7 +714,7 @@
        }
        if (verbose)
                printf("Creating new media meta file: %s\n", newMedia_meta);
-       metafile = creat(newMedia_meta, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
+       metafile = open(newMedia_meta, O_CREAT|O_TRUNC|O_WRONLY, 
S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
        if (metafile == -1) {
                MHVTL_ERR("Failed to create file %s: %s", newMedia_meta,
                        strerror(errno));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/usr/vtlcart_v1.c 
new/mhvtl-1.70_release+862.561d4d5b473f/usr/vtlcart_v1.c
--- old/mhvtl-1.64_release+835.6beb0aa01437/usr/vtlcart_v1.c    2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/usr/vtlcart_v1.c    2022-06-01 
03:40:51.000000000 +0200
@@ -589,7 +589,7 @@
 
        sprintf((char *)newMedia, "%s/%s", MHVTL_HOME_PATH, pcl);
        syslog(LOG_DAEMON|LOG_INFO, "%s being created", newMedia);
-       datafile = creat((char *)newMedia,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
+       datafile = open((char *)newMedia, O_CREAT|O_TRUNC|O_WRONLY, 
S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
        if (datafile == -1) {
                perror("Failed creating file");
                return 2;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/mhvtl-1.64_release+835.6beb0aa01437/usr/vtlcart_v1_mtr.c 
new/mhvtl-1.70_release+862.561d4d5b473f/usr/vtlcart_v1_mtr.c
--- old/mhvtl-1.64_release+835.6beb0aa01437/usr/vtlcart_v1_mtr.c        
2022-01-11 08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/usr/vtlcart_v1_mtr.c        
2022-06-01 03:40:51.000000000 +0200
@@ -627,7 +627,7 @@
         */
        sprintf((char *)newMedia, "%s/%s", MHVTL_HOME_PATH, pcl);
        syslog(LOG_DAEMON|LOG_INFO, "%s being created", newMedia);
-       datafile = creat((char *)newMedia, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
+       datafile = open((char *)newMedia, O_CREAT|O_TRUNC|O_WRONLY, 
S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
        if (datafile == -1) {
                perror("Failed creating file");
                return 2;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.64_release+835.6beb0aa01437/usr/vtltape.c 
new/mhvtl-1.70_release+862.561d4d5b473f/usr/vtltape.c
--- old/mhvtl-1.64_release+835.6beb0aa01437/usr/vtltape.c       2022-01-11 
08:46:35.000000000 +0100
+++ new/mhvtl-1.70_release+862.561d4d5b473f/usr/vtltape.c       2022-06-01 
03:40:51.000000000 +0200
@@ -1841,8 +1841,8 @@
                {ssc_erase,},
                {spc_mode_sense,},
                {ssc_load_unload,},
-               {spc_recv_diagnostics,},
-               {spc_send_diagnostics,},
+               {ssc_recv_diagnostics,},
+               {ssc_send_diagnostics,},
                {ssc_allow_prevent_removal,},
                {spc_illegal_op,},
 

++++++ mhvtl-fix-removal-of-genhd-h.patch ++++++
diff --git a/kernel/mhvtl.c b/kernel/mhvtl.c
index 099c781b1f52..461c79f429a9 100644
--- a/kernel/mhvtl.c
+++ b/kernel/mhvtl.c
@@ -50,7 +50,6 @@
 #include <linux/timer.h>
 #include <linux/types.h>
 #include <linux/string.h>
-#include <linux/genhd.h>
 #include <linux/fs.h>
 #include <linux/init.h>
 #include <linux/moduleparam.h>
@@ -74,6 +73,10 @@
 #include <linux/smp_lock.h>
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0)
+#include <linux/genhd.h>
+#endif
+
 #ifndef _SCSI_H
 #define _SCSI_H
 

Reply via email to