Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package mhvtl for openSUSE:Leap:16.0 checked 
in at 2025-06-19 01:27:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:16.0/mhvtl (Old)
 and      /work/SRC/openSUSE:Leap:16.0/.mhvtl.new.19631 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "mhvtl"

Thu Jun 19 01:27:10 2025 rev:3 rq:1286668 version:1.72_release+6.a11b6777660b

Changes:
--------
--- /work/SRC/openSUSE:Leap:16.0/mhvtl/mhvtl.changes    2025-04-29 
12:59:48.458248040 +0200
+++ /work/SRC/openSUSE:Leap:16.0/.mhvtl.new.19631/mhvtl.changes 2025-06-19 
01:29:06.865558283 +0200
@@ -1,0 +2,22 @@
+Tue Jun 03 18:16:05 UTC 2025 - [email protected]
+
+- Update to version 1.72_release+6.a11b6777660b:
+  * Add SET/GET TIMESTAMP op code support
+  * RPM SPEC: Update to require tar 1.28
+  * LBP: verify_lbp_crc should return a signed value
+  * library: Fix vendor 'QUANTUM' not 'SCALAR'
+- Add 4 patches submitted upstream, to fix build issues:
+  * 0001-kernel-config-replace-fgrep-with-grep-F.patch
+  * 0002-kernel-config-put-braces-around-debug-stmnt.patch
+  * 0003-Fix-external-declarations-of-crc32c.patch
+  * 0004-kernel-config-handle-del_timer_sync-kABI-rename.patch
+
+-------------------------------------------------------------------
+Mon May 12 14:30:12 UTC 2025 - [email protected]
+
+- Update to version 1.72_release+2.94d8d07c8d71:
+  * mhvtl.ko: Bump version string to account for SPIN_LOCK_ fixes
+  * mhvtl: kernel: fix build issue if RealTime kernel (which fixes
+    a OBS build issue for "16.0")
+
+-------------------------------------------------------------------
@@ -467 +488,0 @@
--------------------------------------------------------------------

Old:
----
  mhvtl-1.72_release+0.70719883aae2.tar.xz

New:
----
  0001-kernel-config-replace-fgrep-with-grep-F.patch
  0002-kernel-config-put-braces-around-debug-stmnt.patch
  0003-Fix-external-declarations-of-crc32c.patch
  0004-kernel-config-handle-del_timer_sync-kABI-rename.patch
  mhvtl-1.72_release+6.a11b6777660b.tar.xz

----------(New B)----------
  New:- Add 4 patches submitted upstream, to fix build issues:
  * 0001-kernel-config-replace-fgrep-with-grep-F.patch
  * 0002-kernel-config-put-braces-around-debug-stmnt.patch
  New:  * 0001-kernel-config-replace-fgrep-with-grep-F.patch
  * 0002-kernel-config-put-braces-around-debug-stmnt.patch
  * 0003-Fix-external-declarations-of-crc32c.patch
  New:  * 0002-kernel-config-put-braces-around-debug-stmnt.patch
  * 0003-Fix-external-declarations-of-crc32c.patch
  * 0004-kernel-config-handle-del_timer_sync-kABI-rename.patch
  New:  * 0003-Fix-external-declarations-of-crc32c.patch
  * 0004-kernel-config-handle-del_timer_sync-kABI-rename.patch
----------(New E)----------

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

Other differences:
------------------
++++++ mhvtl.spec ++++++
--- /var/tmp/diff_new_pack.2zdCnN/_old  2025-06-19 01:29:07.197572104 +0200
+++ /var/tmp/diff_new_pack.2zdCnN/_new  2025-06-19 01:29:07.197572104 +0200
@@ -26,7 +26,7 @@
 
 Name:           mhvtl
 URL:            http://sites.google.com/site/linuxvtl2/
-Version:        1.72_release+0.70719883aae2
+Version:        1.72_release+6.a11b6777660b
 Release:        0
 Requires:       mhvtl-kmp
 Requires:       module-init-tools
@@ -39,6 +39,7 @@
 BuildRequires:  fdupes
 BuildRequires:  modutils
 BuildRequires:  openssl-devel
+BuildRequires:  policycoreutils-python-utils
 BuildRequires:  systemd-rpm-macros
 BuildRequires:  zlib-devel
 Summary:        Virtual Tape Library system
@@ -46,6 +47,10 @@
 Group:          System/Daemons
 Source:         %{name}-%{version}.tar.xz
 Source2:        %{name}.preamble
+Patch1:         0001-kernel-config-replace-fgrep-with-grep-F.patch
+Patch2:         0002-kernel-config-put-braces-around-debug-stmnt.patch
+Patch3:         0003-Fix-external-declarations-of-crc32c.patch
+Patch4:         0004-kernel-config-handle-del_timer_sync-kABI-rename.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 %{?systemd_ordering}
 

++++++ 0001-kernel-config-replace-fgrep-with-grep-F.patch ++++++
>From 3d320c937ceedc1e9b086328c553cc57d33a4bb9 Mon Sep 17 00:00:00 2001
From: Lee Duncan <[email protected]>
Date: Tue, 3 Jun 2025 10:50:37 -0700
Subject: [PATCH 1/4] kernel config: replace fgrep with grep -F

fgrep is deprecated and can cause noise (messages)

Signed-off-by: Lee Duncan <[email protected]>
---
 kernel/config.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/config.sh b/kernel/config.sh
index da038ae3ed74..1bb32d2918e7 100755
--- a/kernel/config.sh
+++ b/kernel/config.sh
@@ -121,7 +121,7 @@ fi >> "${output}"
 # check if scsi_host_template argument to scsi_host_alloc
 # is const
 #
-if fgrep -q 'extern struct Scsi_Host *scsi_host_alloc(const' \
+if grep -F -q 'extern struct Scsi_Host *scsi_host_alloc(const' \
         "${hdrs}/scsi/scsi_host.h"; then
     # the first argument to scsi_host_alloc needs to be a "const"
     echo "#ifndef DEFINE_CONST_STRUCT_SCSI_HOST_TEMPLATE"
@@ -146,7 +146,7 @@ bus_type_def_file=$(grep -rl 'struct bus_type {' ${hdrs})
 
 # Now check for the 2nd argument needs a "const"
 if [ -r "$bus_type_def_file" ] &&
-   fgrep -q "$pat" "$bus_type_def_file"; then
+    grep -F -q "$pat" "$bus_type_def_file"; then
     # the second argument needs a "const" definition
     echo "#ifndef DEFINE_CONST_STRUCT_DEVICE_DRIVER"
     echo "#define DEFINE_CONST_STRUCT_DEVICE_DRIVER"
@@ -159,7 +159,7 @@ fi >> "${output}"
 # check if slave_configure has been renamed to sdev_configure
 #
 pat='int (* sdev_configure)(struct scsi_device *, struct queue_limits *lim);'
-if fgrep -q "$pat" "${hdrs}/scsi/scsi_host.h"; then
+if grep -F -q "$pat" "${hdrs}/scsi/scsi_host.h"; then
     echo "#ifndef DEFINE_QUEUE_LIMITS_SCSI_DEV_CONFIGURE"
     echo "#define DEFINE_QUEUE_LIMITS_SCSI_DEV_CONFIGURE"
     echo "#endif"
-- 
2.43.0


++++++ 0002-kernel-config-put-braces-around-debug-stmnt.patch ++++++
>From 4d4ee09b0e4c29e9992db6185509c65e472bd360 Mon Sep 17 00:00:00 2001
From: Lee Duncan <[email protected]>
Date: Tue, 3 Jun 2025 10:52:48 -0700
Subject: [PATCH 2/4] kernel config: put braces around debug stmnt

In some cases this code:

>       if (cmd)
>               MHVTL_DBG_PRT_CDB(1, serial_number, cmd, SCpnt->cmd_len);

Can causee issues because the debug macro translates to being empty.
So put braces around the debug print statement.

Signed-off-by: Lee Duncan <[email protected]>
---
 kernel/mhvtl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/mhvtl.c b/kernel/mhvtl.c
index 6e1b707bdb4e..983d7db91e23 100644
--- a/kernel/mhvtl.c
+++ b/kernel/mhvtl.c
@@ -597,8 +597,9 @@ static int _mhvtl_queuecommand_lck(struct scsi_cmnd *SCpnt, 
done_funct_t done)
        if (done == NULL)
                return 0;       /* assume mid level reprocessing command */
 
-       if (cmd)
+       if (cmd) {
                MHVTL_DBG_PRT_CDB(1, serial_number, cmd, SCpnt->cmd_len);
+       }
 
        if (SCpnt->device->id == mhvtl_driver_template.this_id) {
                pr_err("initiator's id used as target!\n");
-- 
2.43.0


++++++ 0003-Fix-external-declarations-of-crc32c.patch ++++++
>From be40f77c7d1b7236ae49be61763b6f9016be9ed7 Mon Sep 17 00:00:00 2001
From: Lee Duncan <[email protected]>
Date: Wed, 4 Jun 2025 08:00:05 -0700
Subject: [PATCH 3/4] Fix external declarations of crc32c()

The function uses the last (3rd) argument of
for size ("sz"), and it should be declared as
size_t, not int, as is done elsewhere.

This fixes a warning about mismatched declarations.

Signed-off-by: Lee Duncan <[email protected]>
---
 usr/ssc.c          | 2 +-
 usr/validate_crc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr/ssc.c b/usr/ssc.c
index 6bc17281d2ff..c67a5e16919e 100644
--- a/usr/ssc.c
+++ b/usr/ssc.c
@@ -2332,7 +2332,7 @@ uint8_t ssc_recv_diagnostics(struct scsi_cmd *cmd)
 }
 
 uint32_t GenerateRSCRC(uint32_t seed, int sz, const uint8_t *buf);
-uint32_t crc32c(uint32_t seed, const uint8_t *buf, int sz);
+uint32_t crc32c(uint32_t seed, const uint8_t *buf, size_t sz);
 
 uint8_t ssc_send_diagnostics(struct scsi_cmd *cmd)
 {
diff --git a/usr/validate_crc.c b/usr/validate_crc.c
index 1405b8a5d4c0..d26f685c1e5b 100644
--- a/usr/validate_crc.c
+++ b/usr/validate_crc.c
@@ -13,7 +13,7 @@
 #include <assert.h>
 #include <inttypes.h>
 
-uint32_t crc32c(uint32_t seed, const uint8_t *buf, int sz);
+uint32_t crc32c(uint32_t seed, const uint8_t *buf, size_t sz);
 uint32_t GenerateRSCRC(uint32_t seed, int sz, const uint8_t *buf);
 
 int main(int argc, char *argv[])
-- 
2.43.0


++++++ 0004-kernel-config-handle-del_timer_sync-kABI-rename.patch ++++++
>From ad0ad22e21a470981a801ddf2a14e5165431f88a Mon Sep 17 00:00:00 2001
From: Lee Duncan <[email protected]>
Date: Wed, 4 Jun 2025 09:45:39 -0700
Subject: [PATCH 4/4] kernel config: handle del_timer_sync() kABI rename

In newer kernels (starting with 6.10), the del_timer_sync()
kABI has been replaced/renamed to timer_delete_sync().

Signed-off-by: Lee Duncan <[email protected]>
---
 kernel/config.sh | 11 +++++++++++
 kernel/mhvtl.c   | 15 ++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/kernel/config.sh b/kernel/config.sh
index 1bb32d2918e7..2c9da68d6eb6 100755
--- a/kernel/config.sh
+++ b/kernel/config.sh
@@ -167,4 +167,15 @@ else
     echo "#undef DEFINE_QUEUE_LIMITS_SCSI_DEV_CONFIGURE"
 fi >> "${output}"
 
+#
+# check if del_timer_sync() has been renamed to timer_delete()
+#
+if grep -F -q 'int timer_delete_sync(' "${hdrs}/linux/timer.h"; then
+    echo "#ifndef USE_TIMER_DELETE_NOT_DEL_TIMER"
+    echo "#define USE_TIMER_DELETE_NOT_DEL_TIMER"
+    echo "#endif"
+else
+    echo "#undef USE_TIMER_DELETE_NOT_DEL_TIMER"
+fi >> "${output}"
+
 printf '\n\n#endif /* _MHVTL_KERNEL_CONFIG_H */\n' >> "${output}"
diff --git a/kernel/mhvtl.c b/kernel/mhvtl.c
index 983d7db91e23..8bfee8770221 100644
--- a/kernel/mhvtl.c
+++ b/kernel/mhvtl.c
@@ -1002,7 +1002,11 @@ static int mhvtl_stop_queued_cmnd(struct scsi_cmnd 
*SCpnt)
        spin_lock_irqsave(&lu->cmd_list_lock, iflags);
        list_for_each_entry_safe(sqcp, n, &lu->cmd_list, queued_sibling) {
                if (sqcp->state && (SCpnt == sqcp->a_cmnd)) {
+#ifdef USE_TIMER_DELETE_NOT_DEL_TIMER
+                       timer_delete_sync(&sqcp->cmnd_timer);
+#else
                        del_timer_sync(&sqcp->cmnd_timer);
+#endif
                        sqcp->state = CMD_STATE_FREE;
                        sqcp->a_cmnd = NULL;
                        found = 1;
@@ -1031,7 +1035,11 @@ static void mhvtl_stop_all_queued(void)
                list_for_each_entry_safe(sqcp, n, &lu->cmd_list,
                        queued_sibling) {
                        if (sqcp->state && sqcp->a_cmnd) {
+#ifdef USE_TIMER_DELETE_NOT_DEL_TIMER
+                               timer_delete_sync(&sqcp->cmnd_timer);
+#else
                                del_timer_sync(&sqcp->cmnd_timer);
+#endif
                                sqcp->state = CMD_STATE_FREE;
                                sqcp->a_cmnd = NULL;
                                __mhvtl_remove_sqcp(sqcp);
@@ -1599,9 +1607,14 @@ static int mhvtl_put_user_data(unsigned int minor, char 
__user *arg)
                                s[2],
                                s[12],
                                s[13]);
-       } else
+       } else {
                sqcp->a_cmnd->result = DID_OK << 16;
+       }
+#ifdef USE_TIMER_DELETE_NOT_DEL_TIMER
+       timer_delete_sync(&sqcp->cmnd_timer);
+#else
        del_timer_sync(&sqcp->cmnd_timer);
+#endif
        if (sqcp->done_funct)
                sqcp->done_funct(sqcp->a_cmnd);
        else
-- 
2.43.0


++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.2zdCnN/_old  2025-06-19 01:29:07.285575767 +0200
+++ /var/tmp/diff_new_pack.2zdCnN/_new  2025-06-19 01:29:07.289575933 +0200
@@ -1,6 +1,6 @@
 <servicedata>
 <service name="tar_scm">
                 <param name="url">https://github.com/markh794/mhvtl.git</param>
-              <param 
name="changesrevision">70719883aae2b3507fddd36ea73e72cd7fa9fd01</param></service></servicedata>
+              <param 
name="changesrevision">a11b6777660b969318bd1b849203164fcbae3eca</param></service></servicedata>
 (No newline at EOF)
 

++++++ mhvtl-1.72_release+0.70719883aae2.tar.xz -> 
mhvtl-1.72_release+6.a11b6777660b.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.72_release+0.70719883aae2/kernel/mhvtl.c 
new/mhvtl-1.72_release+6.a11b6777660b/kernel/mhvtl.c
--- old/mhvtl-1.72_release+0.70719883aae2/kernel/mhvtl.c        2025-03-10 
02:12:54.000000000 +0100
+++ new/mhvtl-1.72_release+6.a11b6777660b/kernel/mhvtl.c        2025-05-29 
03:09:36.000000000 +0200
@@ -104,9 +104,9 @@
  #define VTL_VERSION "1.75"
 */
 #ifndef MHVTL_VERSION
-#define MHVTL_VERSION "0.18.34"
+#define MHVTL_VERSION "0.18.35"
 #endif
-static const char *mhvtl_version_date = "20250212-0";
+static const char *mhvtl_version_date = "20250512-0";
 static const char mhvtl_driver_name[] = "mhvtl";
 
 /* Additional Sense Code (ASC) used */
@@ -1104,7 +1104,7 @@
        lu->mhvtl_hba = mhvtl_hba;
        lu->reset = 0;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
-       lu->cmd_list_lock = __SPIN_LOCK_UNLOCKED(lu.cmd_list_lock);
+       spin_lock_init(&lu->cmd_list_lock);
 #else
        lu->cmd_list_lock = SPIN_LOCK_UNLOCKED;
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.72_release+0.70719883aae2/mhvtl-utils.spec 
new/mhvtl-1.72_release+6.a11b6777660b/mhvtl-utils.spec
--- old/mhvtl-1.72_release+0.70719883aae2/mhvtl-utils.spec      2025-03-10 
02:12:54.000000000 +0100
+++ new/mhvtl-1.72_release+6.a11b6777660b/mhvtl-utils.spec      2025-05-29 
03:09:36.000000000 +0200
@@ -30,6 +30,7 @@
 
 Requires:sg3_utils
 Requires: policycoreutils
+Requires: tar >= 1.28
 
 BuildRequires: systemd
 BuildRequires: systemd-rpm-macros
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.72_release+0.70719883aae2/usr/be_byteshift.h 
new/mhvtl-1.72_release+6.a11b6777660b/usr/be_byteshift.h
--- old/mhvtl-1.72_release+0.70719883aae2/usr/be_byteshift.h    2025-03-10 
02:12:54.000000000 +0100
+++ new/mhvtl-1.72_release+6.a11b6777660b/usr/be_byteshift.h    2025-05-29 
03:09:36.000000000 +0200
@@ -50,6 +50,12 @@
        return __get_unaligned_be32((const uint8_t *)p);
 }
 
+static inline uint64_t get_unaligned_be48(const void *p)
+{
+       return (uint64_t)__get_unaligned_be32(p) << 32 |
+               __get_unaligned_be16(p + 4);
+}
+
 static inline uint64_t get_unaligned_be64(const void *p)
 {
        return __get_unaligned_be64((const uint8_t *)p);
@@ -72,6 +78,12 @@
        __put_unaligned_be32(val, (uint8_t *)p);
 }
 
+static inline void put_unaligned_be48(uint64_t val, void *p)
+{
+       __put_unaligned_be32(val >> 32, (uint8_t *)p);
+       __put_unaligned_be16(val, p + 4);
+}
+
 static inline void put_unaligned_be64(uint64_t val, void *p)
 {
        __put_unaligned_be64(val, (uint8_t *)p);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.72_release+0.70719883aae2/usr/mhvtl_io.c 
new/mhvtl-1.72_release+6.a11b6777660b/usr/mhvtl_io.c
--- old/mhvtl-1.72_release+0.70719883aae2/usr/mhvtl_io.c        2025-03-10 
02:12:54.000000000 +0100
+++ new/mhvtl-1.72_release+6.a11b6777660b/usr/mhvtl_io.c        2025-05-29 
03:09:36.000000000 +0200
@@ -480,7 +480,7 @@
  **
  ** Return -1 on error or 0 on success (LBP CRC match)
  */
-static uint32_t get_lbp_crc(int lbp_method, unsigned char const *buf, size_t 
src_sz, uint32_t crc32c)
+static int32_t get_lbp_crc(int lbp_method, unsigned char const *buf, size_t 
src_sz, uint32_t crc32c)
 {
        uint32_t lbp_crc = 0;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.72_release+0.70719883aae2/usr/mhvtl_scsi.h 
new/mhvtl-1.72_release+6.a11b6777660b/usr/mhvtl_scsi.h
--- old/mhvtl-1.72_release+0.70719883aae2/usr/mhvtl_scsi.h      2025-03-10 
02:12:54.000000000 +0100
+++ new/mhvtl-1.72_release+6.a11b6777660b/usr/mhvtl_scsi.h      2025-05-29 
03:09:36.000000000 +0200
@@ -142,6 +142,8 @@
 #define CHANGE_ALIASES         0x0b
 #define REPORT_ALIASES         0x0b
 #define REPORT_SUPPORTED_OPCODES 0x0c
+#define REPORT_TIMESTAMP       0x0f
+#define SET_TIMESTAMP          0x0f
 
 /* No Sense Errors */
 #define NO_ADDITIONAL_SENSE            0x0000
@@ -218,6 +220,7 @@
 #define E_MICROCODE_DOWNLOADED         0x3f01
 #define E_FAILURE_PREDICTION_FALSE     0x5dff
 #define E_MODE_PARAMETERS_CHANGED      0x2a01
+#define E_TIMESTAMP_CHANGED            0x2a10
 #define E_INQUIRY_DATA_HAS_CHANGED     0x3f03
 
 /* Data Protect */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.72_release+0.70719883aae2/usr/ssc.c 
new/mhvtl-1.72_release+6.a11b6777660b/usr/ssc.c
--- old/mhvtl-1.72_release+0.70719883aae2/usr/ssc.c     2025-03-10 
02:12:54.000000000 +0100
+++ new/mhvtl-1.72_release+6.a11b6777660b/usr/ssc.c     2025-05-29 
03:09:36.000000000 +0200
@@ -34,6 +34,7 @@
 #include <ctype.h>
 #include <inttypes.h>
 #include <assert.h>
+#include <sys/time.h>
 #include "be_byteshift.h"
 #include "mhvtl_scsi.h"
 #include "mhvtl_list.h"
@@ -703,6 +704,104 @@
        return SAM_STAT_GOOD;
 }
 
+#define REPORT_TIMESTAMP_DATA_LEN 0x0a
+
+/* If timestamp_source == 0 : timestamp is num of uS at logical unit 
initialization - get_timestamp will return delta of mS between init and now
+ * If timestamp_source == 2 : timestamp is set to that provided by initiator - 
get_timestamp will return delta + timestamp
+ */
+
+static uint64_t timestamp;     /* Used for device clock - number uS since 
initialization */
+static int64_t timestamp_offset;       /* Used for device clock - offset of 
local clock and initiator 'set timestamp' value */
+static uint8_t timestamp_source;
+
+void set_timestamp(uint8_t source, uint64_t ts)
+{
+       struct timeval tv;
+       uint64_t now;
+
+       timestamp_source = source;
+       gettimeofday(&tv, NULL);
+       now = 1000000 * tv.tv_sec + tv.tv_usec;
+       if (source) {
+               timestamp = ts * 1000;  /* save as uSec */
+               timestamp_offset = now - timestamp;
+       } else {
+               timestamp = now;
+               timestamp_offset = 0;
+       }
+       MHVTL_DBG(1, "SET timestamp: source %u, timestamp is %lu, offset is 
%ld", source, timestamp, timestamp_offset);
+}
+
+static uint64_t get_timestamp()
+{
+       struct timeval tv;
+       uint64_t now;
+
+       gettimeofday(&tv, NULL);
+       now = 1000000 * tv.tv_sec + tv.tv_usec;
+
+       if (timestamp_source) {
+               MHVTL_DBG(1, "now: %lx, offset: %ld, ret val:  0x%lx", now, 
timestamp_offset, (now - timestamp_offset) / 1000);
+               return (now - timestamp_offset) / 1000; /* Account for any 
offset between local time and initiator set time */
+       } else {
+               MHVTL_DBG(1, "now: %lx, timestamp: %lx, ret val: 0x%lx", now, 
timestamp, (now - timestamp) / 1000);
+               return (now - timestamp) / 1000;        /* Num of mS since init 
*/
+       }
+}
+
+static uint8_t report_timestamp(struct scsi_cmd *cmd)
+{
+       uint8_t *data;
+
+       data = cmd->dbuf_p->data;
+       memset(data, 0, REPORT_TIMESTAMP_DATA_LEN + 2);
+
+       put_unaligned_be16(REPORT_TIMESTAMP_DATA_LEN, &data[0]);
+       data[2] = timestamp_source;     /* Timestamp origin - Timestamp 
initialised to zero at power-on */
+       put_unaligned_be48(get_timestamp() & 0xffffffffffff, &data[4]);
+
+       MHVTL_DBG(1, "Returning timestamp 0x%08lx (%lu)", 
get_unaligned_be48(&data[4]), get_unaligned_be48(&data[4]));
+       cmd->dbuf_p->sz = REPORT_TIMESTAMP_DATA_LEN + 2;
+       cmd->dbuf_p->sam_stat = SAM_STAT_GOOD;
+       return SAM_STAT_GOOD;
+}
+
+static uint8_t configure_timestamp(struct scsi_cmd *cmd)
+{
+       struct s_sd sd;
+       uint8_t *data;
+
+       cmd->dbuf_p->sz = get_unaligned_be32(&cmd->scb[6]);
+       if (cmd->dbuf_p->sz == 0)
+               return SAM_STAT_GOOD;
+       if (cmd->dbuf_p->sz != 0x0c) {
+               cmd->dbuf_p->sz = 0;
+               sd.byte0 = SKSV;
+               sd.field_pointer = 6;
+               MHVTL_LOG("Unexpected timestamp parameter length..");
+               sam_illegal_request(E_INVALID_FIELD_IN_PARMS, &sd, 
&cmd->dbuf_p->sam_stat);
+               return SAM_STAT_CHECK_CONDITION;
+       }
+
+       retrieve_CDB_data(cmd->cdev, cmd->dbuf_p);
+       data = cmd->dbuf_p->data;
+
+       if (data[4] > 0xf0) {   /* overflow - Illegal request */
+               cmd->dbuf_p->sz = 0;
+               sd.byte0 = SKSV;
+               sd.field_pointer = 4;
+               MHVTL_LOG("Unexpected set timestamp value.. Value too large");
+               sam_illegal_request(E_INVALID_FIELD_IN_PARMS, &sd, 
&cmd->dbuf_p->sam_stat);
+               return SAM_STAT_CHECK_CONDITION;
+       }
+
+       set_timestamp(2, get_unaligned_be48(&data[4]));
+
+       cmd->dbuf_p->sz = 0;
+       cmd->dbuf_p->sam_stat = SAM_STAT_GOOD;
+       return SAM_STAT_GOOD;
+}
+
 uint8_t ssc_a3_service_action(struct scsi_cmd *cmd)
 {
        switch (cmd->scb[1]) {
@@ -715,6 +814,10 @@
        case REPORT_SUPPORTED_OPCODES:
                log_opcode("REPORT SUPPORTED OPCODES **", cmd);
                break;
+       case REPORT_TIMESTAMP:
+               MHVTL_DBG(1, "REPORT TIMESTAMP (%ld) **", 
(long)cmd->dbuf_p->serialNo);
+               return report_timestamp(cmd);
+               break;
        default:
                log_opcode("UNKNOWN SERVICE ACTION A3 **", cmd);
                break;
@@ -734,6 +837,10 @@
        case FORCED_EJECT:
                log_opcode("FORCED EJECT **", cmd);
                break;
+       case SET_TIMESTAMP:
+               MHVTL_DBG(1, "SET TIMESTAMP (%ld) **", 
(long)cmd->dbuf_p->serialNo);
+               return configure_timestamp(cmd);
+               break;
        default:
                log_opcode("UNKNOWN SERVICE ACTION A4 **", cmd);
                break;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.72_release+0.70719883aae2/usr/ssc.h 
new/mhvtl-1.72_release+6.a11b6777660b/usr/ssc.h
--- old/mhvtl-1.72_release+0.70719883aae2/usr/ssc.h     2025-03-10 
02:12:54.000000000 +0100
+++ new/mhvtl-1.72_release+6.a11b6777660b/usr/ssc.h     2025-05-29 
03:09:36.000000000 +0200
@@ -298,3 +298,4 @@
 void unloadTape(int update_library, uint8_t *sam_stat);
 void delay_opcode(int what, int value);
 void set_current_state(int state);
+void set_timestamp(uint8_t source, uint64_t ts);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.72_release+0.70719883aae2/usr/vtllibrary.c 
new/mhvtl-1.72_release+6.a11b6777660b/usr/vtllibrary.c
--- old/mhvtl-1.72_release+0.70719883aae2/usr/vtllibrary.c      2025-03-10 
02:12:54.000000000 +0100
+++ new/mhvtl-1.72_release+6.a11b6777660b/usr/vtllibrary.c      2025-05-29 
03:09:36.000000000 +0200
@@ -1606,7 +1606,9 @@
                customise_hp_lu(lu);
        else if (!strncasecmp(lu->product_id, "OVERLAND", 8))
                init_overland_smc(lu);
-       else if (!strncasecmp(lu->product_id, "scalar", 6))
+       else if (!strncasecmp(lu->product_id, "ADIC", 4))
+               init_scalar_smc(lu);
+       else if (!strncasecmp(lu->product_id, "QUANTUM", 7))
                init_scalar_smc(lu);
        else if (!strncasecmp(lu->vendor_id, "SPECTRA ", 7))
                customise_spectra_lu(lu);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mhvtl-1.72_release+0.70719883aae2/usr/vtltape.c 
new/mhvtl-1.72_release+6.a11b6777660b/usr/vtltape.c
--- old/mhvtl-1.72_release+0.70719883aae2/usr/vtltape.c 2025-03-10 
02:12:54.000000000 +0100
+++ new/mhvtl-1.72_release+6.a11b6777660b/usr/vtltape.c 2025-05-29 
03:09:36.000000000 +0200
@@ -1943,6 +1943,7 @@
                                                lu_ssc.pm->drive_supports_LBP 
== 0 ? "No" :
                                                        
lu_ssc.pm->drive_supports_LBP == 1 ? "RS-CRC only" :
                                                                
lu_ssc.pm->drive_supports_LBP == 2 ? "RS-CRC and CRC32C" : "Invalid");
+       set_timestamp(0, 0);    /* timestamp source - num mS from 
initialisation */
 }
 
 static void cleanup_drive_media_list(struct lu_phy_attr *lu)

Reply via email to