Hello community,

here is the log from the commit of package libzbc for openSUSE:Factory checked 
in at 2020-08-03 14:12:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libzbc (Old)
 and      /work/SRC/openSUSE:Factory/.libzbc.new.3592 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libzbc"

Mon Aug  3 14:12:06 2020 rev:17 rq:823629 version:5.9.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/libzbc/libzbc.changes    2020-03-19 
19:48:39.424127233 +0100
+++ /work/SRC/openSUSE:Factory/.libzbc.new.3592/libzbc.changes  2020-08-03 
14:12:11.856307248 +0200
@@ -1,0 +2,8 @@
+Thu Jul 30 15:53:24 UTC 2020 - Jan Engelhardt <jeng...@inai.de>
+
+- Update to release 5.9.0
+  * Compilation warning fixes
+- Drop 0001-build-avoid-double-definition-of-zbc_log_drv-etc.patch
+  (merged)
+
+-------------------------------------------------------------------

Old:
----
  0001-build-avoid-double-definition-of-zbc_log_drv-etc.patch
  v5.8.5.tar.gz

New:
----
  v5.9.0.tar.gz

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

Other differences:
------------------
++++++ libzbc.spec ++++++
--- /var/tmp/diff_new_pack.A8QXEj/_old  2020-08-03 14:12:12.736308131 +0200
+++ /var/tmp/diff_new_pack.A8QXEj/_new  2020-08-03 14:12:12.740308135 +0200
@@ -17,8 +17,8 @@
 
 
 Name:           libzbc
-%define lname   libzbc-5_8_5
-Version:        5.8.5
+%define lname   libzbc-5_9_0
+Version:        5.9.0
 Release:        0
 Summary:        Library for manipulating ZBC and ZAC disks
 License:        BSD-2-Clause AND LGPL-3.0-or-later
@@ -26,7 +26,6 @@
 URL:            https://github.com/hgst/libzbc
 
 Source:         https://github.com/hgst/libzbc/archive/v%version.tar.gz
-Patch1:         0001-build-avoid-double-definition-of-zbc_log_drv-etc.patch
 BuildRequires:  autoconf-archive
 BuildRequires:  libtool >= 2
 BuildRequires:  pkg-config

++++++ v5.8.5.tar.gz -> v5.9.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libzbc-5.8.5/.gitignore new/libzbc-5.9.0/.gitignore
--- old/libzbc-5.8.5/.gitignore 2020-03-09 06:44:41.000000000 +0100
+++ new/libzbc-5.9.0/.gitignore 2020-07-30 04:59:13.000000000 +0200
@@ -64,6 +64,15 @@
 .depfile
 .depend
 
+# rpm build temporary files
+rpmbuild/BUILD
+rpmbuild/RPMS
+rpmbuild/SOURCES
+rpmbuild/SPECS
+rpmbuild/SRPMS
+*.tar.gz
+*.rpm
+
 # Windows-specific files
 Thumbs.db
 desktop.ini
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libzbc-5.8.5/Makefile.am new/libzbc-5.9.0/Makefile.am
--- old/libzbc-5.8.5/Makefile.am        2020-03-09 06:44:41.000000000 +0100
+++ new/libzbc-5.9.0/Makefile.am        2020-07-30 04:59:13.000000000 +0200
@@ -12,12 +12,13 @@
        exports
 
 AM_CPPFLAGS = \
-       -O2 \
+       $(CFLAGS) \
        -Wall -Wextra -Wno-unused-parameter \
        -I$(top_builddir)/include \
        -I$(top_srcdir)/include
 
 pkgconfdir = $(libdir)/pkgconfig
+rpmdir = $(abs_top_builddir)/rpmbuild
 
 pkgconf_DATA = libzbc.pc
 pkginclude_HEADERS =
@@ -60,3 +61,28 @@
 include test/programs/write_zone/Makemodule.am
 endif
 
+rpm: dist
+       @mkdir -p $(rpmdir)/BUILD
+       @mkdir -p $(rpmdir)/RPMS
+       @mkdir -p $(rpmdir)/SOURCES
+       @mkdir -p $(rpmdir)/SPECS
+       @mkdir -p $(rpmdir)/SRPMS
+       @mv libzbc-$(PACKAGE_VERSION).tar.gz $(rpmdir)/SOURCES
+       @echo "Version:        $(PACKAGE_VERSION)" > $(rpmdir)/SPECS/libzbc.spec
+       @cat $(rpmdir)/libzbc.spec.in >> $(rpmdir)/SPECS/libzbc.spec
+       @rpmbuild -bs -v \
+               --target="$(build_cpu)" \
+               -D "_topdir $(rpmdir)" \
+               --nodebuginfo "$(rpmdir)/SPECS/libzbc.spec"
+       @mv -f $(rpmdir)/SRPMS/*.rpm $(abs_top_builddir)
+       @rpmbuild -bb -v \
+               --target="$(build_cpu)" \
+               -D "_topdir $(rpmdir)" \
+               --nodebuginfo "$(rpmdir)/SPECS/libzbc.spec"
+       @mv -f $(rpmdir)/RPMS/$(build_cpu)/*.rpm $(abs_top_builddir)
+       @rm -rf $(rpmdir)/SRPMS
+       @rm -rf $(rpmdir)/SPECS
+       @rm -rf $(rpmdir)/SOURCES
+       @rm -rf $(rpmdir)/RPMS
+       @rm -rf $(rpmdir)/BUILDROOT
+       @rm -rf $(rpmdir)/BUILD
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libzbc-5.8.5/README.md new/libzbc-5.9.0/README.md
--- old/libzbc-5.8.5/README.md  2020-03-09 06:44:41.000000000 +0100
+++ new/libzbc-5.9.0/README.md  2020-07-30 04:59:13.000000000 +0200
@@ -1,9 +1,5 @@
-SPDX-License-Identifier: BSD-2-Clause
-SPDX-License-Identifier: LGPL-3.0-or-later
-
-SPDX-FileCopyrightText: 2009-2014, HGST, Inc.
-SPDX-FileCopyrightText: 2016, Western Digital.
-SPDX-FileCopyrightText: 2020 Western Digital Corporation or its affiliates.
+Copyright (C) 2016, Western Digital.<br>
+Copyright (C) 2020 Western Digital Corporation or its affiliates.
 
 
 # libzbc
@@ -25,7 +21,7 @@
 ### Library version
 
 *libzbc* current major version is 5. Due to interface changes, this version is
-not compatible with previous *libzbc+ versions (version 4.x). Overall, the
+not compatible with previous *libzbc* versions (version 4.x). Overall, the
 library operation does not change, but applications written for previous
 *libzbc* versions must be updated to use the new API.
 
@@ -37,10 +33,15 @@
 
 ### License
 
-*libzbc* is dual licensed and distributed under the terms of the BSD 2-clause
+*libzbc* source code is distributed under the terms of the BSD 2-clause
 license ("Simplified BSD License" or "FreeBSD License", SPDX: *BSD-2-Clause*)
 and under the terms of the GNU Lesser General Public License version 3, or any
 later version (SPDX: *LGPL-3.0-or-later*).
+A copy of these licenses with *libzbc* copyright can be found in the files
+[LICENSES/BSD-2-Clause.txt] and [COPYING.BSD] for the BSD 2-clause license and
+[LICENSES/LGPL-3.0-or-later.txt] and [COPYING.LESSER] for the LGPL-v3 license.
+If not, please see
+http://opensource.org/licenses/BSD-2-Clause and http://www.gnu.org/licenses/.
 
 All example applications under the tools directory are distributed under the
 terms of the GNU Lesser General Public License version 3, or any later version
@@ -50,15 +51,29 @@
 technical support, and WITHOUT ANY WARRANTY, without even the implied warranty
 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
-Along with *libzbc*, you should have received a copy of the BSD 2-clause
-license in the file [COPYING.BSD] and of the GNU Lesser General Public License
-version 3 in the file [COPYING.LESSER]. If not, please see
-http://opensource.org/licenses/BSD-2-Clause and http://www.gnu.org/licenses/.
+All source files in *libzbc* contain the BSD 2-clause and LGPL v3 license SPDX
+short identifiers in place of the full license text.
+
+```
+SPDX-License-Identifier: BSD-2-Clause
+SPDX-License-Identifier: LGPL-3.0-or-later
+```
+
+Some files such as the `.gitignore` file are public domain specified by the
+CC0 1.0 Universal (CC0 1.0) Public Domain Dedication. These files are
+identified with the following SPDX header.
+
+```
+SPDX-License-Identifier: CC0-1.0
+```
+
+See [LICENSES/CC0-1.0.txt] for the full text of this license.
 
 ### Contributions and Bug Reports
 
 Contributions are accepted as github pull requests. Any problem may also be
 reported through github issue page or by contacting:
+
 * Damien Le Moal (damien.lem...@wdc.com)
 * Dmitry Fomichev (dmitry.fomic...@wdc.com)
 
@@ -67,47 +82,54 @@
 
 ## Compilation and installation
 
-*libzbc* requires that the autoconf, automake and libtool development packages
-be installed on the host used for compilation. The GTK3 and GTK3 development
-packages are necessary to compile the *gzbc* application. Installing these
-packages will automatically enable the compilation of gzbc.
+*libzbc* requires the following packages for compilation:
+
+* autoconf
+* autoconf-archive
+* automake
+* libtool
+
+The GTK3 and GTK3 development packages must be installed to automatically 
enable
+compiling the *gzbc* and *gzviewer* applications.
 
 To compile the library and all example applications under the tools directory,
 execute the following commands.
 
 ```
-# sh ./autogen.sh
-# ./configure
-# make
+$ sh ./autogen.sh
+$ ./configure
+$ make
 ```
 
 To install the library and all example applications compiled under the tools
 directory, execute the following command.
 
 ```
-# sudo make install
+$ sudo make install
 ```
 
-The library file is by default installed under /usr/lib (or /usr/lib64). The
-library header file is installed in /usr/include/libzbc. The executable files
-for the example applications are installed under /usr/bin. These defaults can 
be
-changed using the configure script. Executing the following command displays 
the
-options used to control the installation paths.
+The library file is by default installed under `/usr/lib` (or `/usr/lib64`).
+The library header file is installed in `/usr/include/libzbc`. The executable
+files for the example applications are installed under `/usr/bin`.
+
+These default installation locations can be changed using the configure script.
+Executing the following command displays the options used to control the
+installation paths.
 
 ```
-# ./configure --help
+$ ./configure --help
 ```
 
 ## Compilation with GUI tools
 
 The *gzbc* and *gzviewer* tools implement a graphical user interface (GUI) 
using
 the GTK3 toolkit. The configure script will automatically detect the presence 
of
-GTK3 development headers and compile these tools if the header files are found.
-This behavior can be manually changed and the compilation of *gzbc* and
-*gzviewer* disabled using the `--disable-gui` configuration option.
+GTK3 and its development header files and compile these tools if the header
+files are found. This behavior can be manually changed and the compilation of
+*gzbc* and *gzviewer* disabled using the `--disable-gui` configuration option.
 
 ```
-# ./configure --disable-gui
+$ ./configure --disable-gui
 ```
 
 ## Compilation for device tests
@@ -120,17 +142,17 @@
 To compile the test programs, *libzbc* must be configured as follows.
 
 ```
-# ./configure --with-test
+$ ./configure --with-test
 ```
 
 The test programs and scripts are not affected by the execution of "make
 install". All defined tests must be executed directly from the test directory
-using the zbc_test.sh script. To test the device /dev/<SG node>, the following
-can be executed.
+using the *zbc_test.sh* script. To test the device `/dev/<SG node>`, the
+following can be executed.
 
 ```
-# cd test
-# sudo ./zbc_test.sh /dev/<SG node>
+$ cd test
+$ sudo ./zbc_test.sh /dev/<SG node>
 ```
 
 By default, the script will run through all the test cases. Detailed control
@@ -145,6 +167,24 @@
 Each test outputs a log file in the `test/log` directory. These files can be
 consulted in case of a failed test to identify the reason for the test failure.
 
+## Building rpm packages
+
+The following command will build redistributable rpm packages.
+
+```
+$ make rpm
+```
+
+Three rpm packages are built: a binary package providing the library and
+executable tools, a development package providing *libzbc* header files and a
+source package. The source package can be used to build the binary and
+development rpm packages outside of *libzbc* source tree using the following
+command.
+
+```
+$ rpmbuild --rebuild libzbc-<version>.src.rpm
+```
+
 ## Library Overview
 
 *libzbc* functions operate using a device handle obtained by executing the
@@ -191,41 +231,40 @@
 
 The main functions provided by *libzbc* are as follows.
 
-Function               | Description
------------------------|---------------------------------------------
-zbc_open()             | Open a zoned device
-zbc_close()            | Close a zoned device
-zbc_get_device_info()  | Get device information
-zbc_report_nr_zones()  | Get the number of zones of the device
-zbc_report_zones()<br>
-zbc_list_zones()       | Get zone information
-zbc_zone_operation()   | Execute a zone operation
-zbc_open_zone()        | Explicitely open a zone
-zbc_close_zone()       | Close an open zone
-zbc_finish_zone()      | Finish a zone
-zbc_reset_zone()       | Reset a zone write pointer
-zbc_pread()            | Read data from a zone
-zbc_preadv()           | Read data from a zone using vectored buffer
-zbc_pwrite()           | Write data to a zone
-zbc_pwritev()          | Write data to a zone using vectored buffer
-zbc_flush()            | Flush data to disk
+Function                 | Description
+-------------------------|---------------------------------------------
+*zbc_open()*             | Open a zoned device
+*zbc_close()*            | Close a zoned device
+*zbc_get_device_info()*  | Get device information
+*zbc_report_nr_zones()*  | Get the number of zones of the device
+*zbc_report_zones()* <br> *zbc_list_zones()* | Get zone information
+*zbc_zone_operation()*   | Execute a zone operation
+*zbc_open_zone()*        | Explicitely open a zone
+*zbc_close_zone()*       | Close an open zone
+*zbc_finish_zone()*      | Finish a zone
+*zbc_reset_zone()*       | Reset a zone write pointer
+*zbc_pread()*            | Read data from a zone
+*zbc_preadv()*           | Read data from a zone using vectored buffer
+*zbc_pwrite()*           | Write data to a zone
+*zbc_pwritev()*          | Write data to a zone using vectored buffer
+*zbc_flush()*            | Flush data to disk
 
 Additionally, the following functions are also provided to facilitate
 application development and tests.
 
-Function                 | Description
--------------------------|----------------------------
-zbc_map_iov()            | Map a vectored buffer using a single buffer
-zbc_set_log_level()      | Set the logging level of the library functions
-zbc_device_is_zoned()    | Test if a device is a zoned block device
-zbc_print_device_info()  | Print device information to a file (stream)
-zbc_device_type_str()    | Get a string description of a device type
-zbc_device_model_str()   | Get a string description of a device model
-zbc_zone_type_str()      | Get a string description of a zone type
-zbc_zone_condition_str() | Get a string description of a zone condition
-zbc_errno()              | Get the sense key and code of the last function call
-zbc_sk_str()             | Get a string description of a sense key
-zbc_asc_ascq_str()       | Get a string description of a sense code
+Function                   | Description
+---------------------------|---------------------------------------------------
+*zbc_map_iov()*            | Map a vectored buffer using a single buffer
+*zbc_set_log_level()*      | Set the logging level of the library functions
+*zbc_device_is_zoned()*    | Test if a device is a zoned block device
+*zbc_print_device_info()*  | Print device information to a file (stream)
+*zbc_device_type_str()*    | Get a string description of a device type
+*zbc_device_model_str()*   | Get a string description of a device model
+*zbc_zone_type_str()*      | Get a string description of a zone type
+*zbc_zone_condition_str()* | Get a string description of a zone condition
+*zbc_errno()*              | Get the sense key and code of the last function 
call
+*zbc_sk_str()*             | Get a string description of a sense key
+*zbc_asc_ascq_str()*       | Get a string description of a sense code
 
 *libzbc* does not implement any synchronization mechanism for multiple threads
 or processes to safely operate simultaneously on the same zone. In particular,
@@ -239,9 +278,9 @@
 Linux kernels older than version 4.10 do not create a block device file for
 host-managed ZBC and ZAC devices. As a result, these devices can only be
 accessed through their associated SG node (/dev/sgx device file). For these
-older kernels, opening a ZBC or ZAC host managed disk with *libzbc* must thus 
be
-done using the device SG node. For kernel versions 4.10 and beyond compiled 
with
-zoned block device support, the device will be exposed also through a block
+older kernels, opening a ZBC or ZAC host managed disk with *libzbc* must thus
+be done using the device SG node. For kernel versions 4.10 and beyond compiled
+with zoned block device support, the device will be exposed also through a 
block
 device file which can be used with *libzbc* to identify the device.
 
 For host-aware devices, a block device file and an SG node file will exist and
@@ -269,8 +308,8 @@
 be generated using the doxygen project file documentation/libzbc.doxygen.
 
 ```
-# cd documentation
-# doxygen libzbc.doxygen
+$ cd documentation
+$ doxygen libzbc.doxygen
 ```
 
 ## Tools
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libzbc-5.8.5/configure.ac 
new/libzbc-5.9.0/configure.ac
--- old/libzbc-5.8.5/configure.ac       2020-03-09 06:44:41.000000000 +0100
+++ new/libzbc-5.9.0/configure.ac       2020-07-30 04:59:13.000000000 +0200
@@ -4,7 +4,7 @@
 # Copyright (c) 2009-2014, HGST, Inc. All rights reserved.
 # Copyright (c) 2020 Western Digital Corporation or its affiliates.
 
-AC_INIT([libzbc], [5.8.5],
+AC_INIT([libzbc], [5.9.0],
        [damien.lem...@wdc.com, dmitry.fomic...@wdc.com],
        [libzbc], [https://github.com/hgst/libzbc])
 AC_CONFIG_AUX_DIR([build-aux])
@@ -15,8 +15,19 @@
 AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
 AM_SILENT_RULES([yes])
 
+RPM_RELEASE=1
+AC_SUBST(RPM_RELEASE)
+AX_RPM_INIT
+
+AX_CHECK_ENABLE_DEBUG([no], [_DBG_])
 AC_PROG_CC
 AM_PROG_CC_C_O
+AC_PROG_INSTALL
+
+AC_CHECK_PROGS([DOXYGEN], [doxygen])
+if test -z "$DOXYGEN"; then
+       AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
+fi
 
 AC_USE_SYSTEM_EXTENSIONS
 AC_SYS_LARGEFILE
@@ -27,15 +38,29 @@
 LT_INIT
 
 ACX_PTHREAD
+CFLAGS="$CFLAGS --std=gnu90 $EXTRA_CFLAGS $PTHREAD_CFLAGS"
+if test "x$enable_debug" == "xno"; then
+       CFLAGS="-O2 $CFLAGS"
+fi
 LIBS="$PTHREAD_LIBS $LIBS"
-CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
 CC="$PTHREAD_CC"
 
 # Checks for header files.
-AC_CHECK_HEADER(scsi/scsi.h, [], [AC_MSG_ERROR([Couldn't find scsi/scsi.h])])
-AC_CHECK_HEADER(scsi/sg.h, [], [AC_MSG_ERROR([Couldn't find scsi/sg.h])])
-AC_CHECK_HEADER(libgen.h, [], [AC_MSG_ERROR([Couldn't find libgen.h])])
-AC_CHECK_HEADERS([linux/fs.h linux/blkzoned.h])
+AC_CHECK_HEADERS([linux/fs.h], [],
+               [AC_MSG_ERROR([Couldn't find linux/fs.h])],
+               [[
+                       #ifdef HAVE_LINUX_FS_H
+                       #include <linux/fs.h>
+                       int main(int argc, char **argv) { return 0; }
+                       #endif
+               ]])
+AC_CHECK_HEADERS([linux/blkzoned.h], [], [],
+               [[
+                       #ifdef HAVE_LINUX_BLKZONED_H
+                       #include <linux/blkzoned.h>
+                       int main(int argc, char **argv) { return 0; }
+                       #endif
+               ]])
 
 # Conditionals
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libzbc-5.8.5/include/libzbc/zbc.h 
new/libzbc-5.9.0/include/libzbc/zbc.h
--- old/libzbc-5.8.5/include/libzbc/zbc.h       2020-03-09 06:44:41.000000000 
+0100
+++ new/libzbc-5.9.0/include/libzbc/zbc.h       2020-07-30 04:59:13.000000000 
+0200
@@ -14,6 +14,10 @@
 #ifndef _LIBZBC_H_
 #define _LIBZBC_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <stdio.h>
 #include <unistd.h>
 #include <stdbool.h>
@@ -1160,4 +1164,8 @@
  * @}
  */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _LIBZBC_H_ */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libzbc-5.8.5/lib/zbc.c new/libzbc-5.9.0/lib/zbc.c
--- old/libzbc-5.8.5/lib/zbc.c  2020-03-09 06:44:41.000000000 +0100
+++ new/libzbc-5.9.0/lib/zbc.c  2020-07-30 04:59:13.000000000 +0200
@@ -276,8 +276,7 @@
 /**
  * zbc_device_is_zoned - Test if a physical device is zoned.
  */
-int zbc_device_is_zoned(const char *filename,
-                       bool fake,
+int zbc_device_is_zoned(const char *filename, bool allow_fake,
                        struct zbc_device_info *info)
 {
        struct zbc_device *dev = NULL;
@@ -290,6 +289,8 @@
 
        /* Test all backends until one accepts the drive. */
        for (i = 0; zbc_drv[i]; i++) {
+               if (!allow_fake && zbc_drv[i] == &zbc_fake_drv)
+                       continue;
                ret = zbc_drv[i]->zbd_open(path, O_RDONLY, &dev);
                if (ret == 0) {
                        /* This backend accepted the device */
@@ -301,14 +302,10 @@
        }
 
        if (dev && dev->zbd_drv) {
-               if (dev->zbd_drv == &zbc_fake_drv && !fake) {
-                       ret = 0;
-               } else {
-                       ret = 1;
-                       if (info)
-                               memcpy(info, &dev->zbd_info,
-                                      sizeof(struct zbc_device_info));
-               }
+               ret = 1;
+               if (info)
+                       memcpy(info, &dev->zbd_info,
+                              sizeof(struct zbc_device_info));
                dev->zbd_drv->zbd_close(dev);
        } else {
                if ((ret != -EPERM) && (ret != -EACCES))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libzbc-5.8.5/lib/zbc.h new/libzbc-5.9.0/lib/zbc.h
--- old/libzbc-5.8.5/lib/zbc.h  2020-03-09 06:44:41.000000000 +0100
+++ new/libzbc-5.9.0/lib/zbc.h  2020-07-30 04:59:13.000000000 +0200
@@ -177,22 +177,22 @@
 /**
  * Block device driver (requires kernel support).
  */
-struct zbc_drv zbc_block_drv;
+extern struct zbc_drv zbc_block_drv;
 
 /**
  * ZAC (ATA) device driver (uses SG_IO).
  */
-struct zbc_drv zbc_ata_drv;
+extern struct zbc_drv zbc_ata_drv;
 
 /**
  * ZBC (SCSI) device driver (uses SG_IO).
  */
-struct zbc_drv zbc_scsi_drv;
+extern struct zbc_drv zbc_scsi_drv;
 
 /**
  * ZBC emulation driver (file or block device).
  */
-struct zbc_drv zbc_fake_drv;
+extern struct zbc_drv zbc_fake_drv;
 
 #define container_of(ptr, type, member) \
     ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
@@ -266,7 +266,7 @@
 /**
  * Library log level.
  */
-int zbc_log_level;
+extern int zbc_log_level;
 
 #define zbc_print(stream,format,args...)               \
        do {                                            \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libzbc-5.8.5/lib/zbc_ata.c 
new/libzbc-5.9.0/lib/zbc_ata.c
--- old/libzbc-5.8.5/lib/zbc_ata.c      2020-03-09 06:44:41.000000000 +0100
+++ new/libzbc-5.9.0/lib/zbc_ata.c      2020-07-30 04:59:13.000000000 +0200
@@ -459,7 +459,7 @@
        int ret;
 
        if (!zbc_dev_is_zoned(dev))
-               return 0;
+               return -ENXIO;
 
        /* Get zoned block device information */
        ret = zbc_ata_read_log(dev,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libzbc-5.8.5/lib/zbc_block.c 
new/libzbc-5.9.0/lib/zbc_block.c
--- old/libzbc-5.8.5/lib/zbc_block.c    2020-03-09 06:44:41.000000000 +0100
+++ new/libzbc-5.9.0/lib/zbc_block.c    2020-07-30 04:59:13.000000000 +0200
@@ -116,6 +116,7 @@
        struct zbc_block_device *zbd = zbc_dev_to_block(dev);
        char str[128];
        FILE *file;
+       int ret;
 
        /* Open the start offset file of the partition */
        snprintf(str, sizeof(str),
@@ -132,7 +133,12 @@
                return ret;
        }
 
-       fscanf(file, "%llu", &zbd->part_offset);
+       ret = fscanf(file, "%llu", &zbd->part_offset);
+       if (ret <= 0) {
+               zbc_error("%s: can't read partition offset from %s\n",
+                         zbd->part_name, str);
+               return ret;
+       }
        fclose(file);
 
        zbc_debug("%s: Partition of %s, start sector offset %llu\n",
@@ -239,6 +245,7 @@
        struct zbc_block_device *zbd = zbc_dev_to_block(dev);
        char str[128];
        FILE *file;
+       int ret;
 
        /* Check that this is a zoned block device */
        snprintf(str, sizeof(str),
@@ -253,7 +260,12 @@
                return -ENXIO;
 
        memset(str, 0, sizeof(str));
-       fscanf(file, "%s", str);
+       ret = fscanf(file, "%s", str);
+       if (ret <= 0) {
+               zbc_error("%s: can't read zoned model from %s\n",
+                         zbd->part_name, str);
+               return ret;
+       }
        fclose(file);
 
        if (strcmp(str, "host-aware") == 0) {
@@ -359,6 +371,7 @@
        struct zbc_block_device *zbd = zbc_dev_to_block(dev);
        char str[128];
        FILE *file;
+       int ret;
 
        /* Open the chunk_sectors file */
        snprintf(str, sizeof(str),
@@ -374,7 +387,12 @@
                return ret;
        }
 
-       fscanf(file, "%llu", &zbd->zone_sectors);
+       ret = fscanf(file, "%llu", &zbd->zone_sectors);
+       if (ret <= 0) {
+               zbc_error("%s: can't read zone sectors from %s\n",
+                         zbd->part_name, str);
+               return ret;
+       }
        fclose(file);
 
        zbc_debug("%s: Zones of %llu sectors\n",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libzbc-5.8.5/lib/zbc_scsi.c 
new/libzbc-5.9.0/lib/zbc_scsi.c
--- old/libzbc-5.8.5/lib/zbc_scsi.c     2020-03-09 06:44:41.000000000 +0100
+++ new/libzbc-5.9.0/lib/zbc_scsi.c     2020-07-30 04:59:13.000000000 +0200
@@ -708,7 +708,7 @@
        int ret;
 
        if (!zbc_dev_is_zoned(dev))
-               return 0;
+               return -ENXIO;
 
        ret = zbc_scsi_inquiry(dev, 0xB6, buf, ZBC_SCSI_VPD_PAGE_B6_LEN);
        if (ret != 0) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libzbc-5.8.5/rpmbuild/libzbc.spec.in 
new/libzbc-5.9.0/rpmbuild/libzbc.spec.in
--- old/libzbc-5.8.5/rpmbuild/libzbc.spec.in    1970-01-01 01:00:00.000000000 
+0100
+++ new/libzbc-5.9.0/rpmbuild/libzbc.spec.in    2020-07-30 04:59:13.000000000 
+0200
@@ -0,0 +1,52 @@
+Name:           libzbc
+Release:        1%{?dist}
+Summary:        A library to control zoned SCSI/ATA devices
+Group:         System Environment/Libraries
+License:        BSD-2-Clause
+URL:           https://github.com/hgst/libzbc
+Source:         %{name}-%{version}.tar.gz
+
+BuildRequires:  autoconf
+BuildRequires:  automake
+BuildRequires:  libtool
+BuildRequires:  gcc
+
+%description
+libzbc is a simple library providing functions for manipulating SCSI and ATA
+devices supporting the Zoned Block Command (ZBC) and Zoned-device ATA command
+set (ZAC) specifications.
+libzbc implementation is compliant with the latest drafts of the ZBC and ZAC
+standards defined by INCITS technical committee T10 and T13 (respectively).
+
+%package devel
+Summary: Development header files for libzbc
+Group: Development/System
+Requires: %{name}%{?_isa} = %{version}-%{release}
+
+%description devel
+This package provides development header files for libzbc.
+
+%prep
+%setup
+rm -rf $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT
+
+%build
+sh autogen.sh
+%configure --libdir="%{_libdir}" --includedir="%{_includedir}"
+%make_build
+
+%install
+make install PREFIX=%{_prefix} DESTDIR=$RPM_BUILD_ROOT
+
+find $RPM_BUILD_ROOT -name '*.la' -delete
+
+%ldconfig_scriptlets
+
+%files
+%{_bindir}/*
+%{_libdir}/*
+
+%files devel
+%{_includedir}/*
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libzbc-5.8.5/test/zbc_test.sh 
new/libzbc-5.9.0/test/zbc_test.sh
--- old/libzbc-5.8.5/test/zbc_test.sh   2020-03-09 06:44:41.000000000 +0100
+++ new/libzbc-5.9.0/test/zbc_test.sh   2020-07-30 04:59:13.000000000 +0200
@@ -41,6 +41,17 @@
        exit 1
 }
 
+is_scsi_device()
+{
+       local d f
+
+       d=$(basename "$dev")
+       for f in /sys/class/scsi_device/*/device/block/"$d"; do
+               [ -e "$f" ] && return 0
+       done
+       return 1
+}
+
 if [ $# -lt 1 ]; then
     zbc_print_usage
 fi
@@ -157,7 +168,6 @@
 
 # Check device path if one was specified
 if [ ! -z ${device} ]; then
-
        # Resolve symbolic links
        device="`readlink -e -n ${device}`"
        if [ ! -e ${device} ]; then
@@ -165,15 +175,8 @@
                exit 1
        fi
 
-       # Only SG nodes (character device files of SCSI or ATA disks) are
-       # allowed
-       if [ ! -c ${device} ]; then
-                echo "Device \"${device}\" is not an SG node"
-                exit 1
-        fi
-
        dev_name=`basename "${device}"`
-       if [ ! -e /sys/class/scsi_generic/${dev_name} ]; then
+       if ! is_scsi_device "$dev_name"; then
                 echo "Device \"${device}\" is not a SCSI/ATA device"
                 exit 1
         fi
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libzbc-5.8.5/tools/gzbc/gzbc_if_dev.c 
new/libzbc-5.9.0/tools/gzbc/gzbc_if_dev.c
--- old/libzbc-5.8.5/tools/gzbc/gzbc_if_dev.c   2020-03-09 06:44:41.000000000 
+0100
+++ new/libzbc-5.9.0/tools/gzbc/gzbc_if_dev.c   2020-07-30 04:59:13.000000000 
+0200
@@ -1421,7 +1421,6 @@
                          char *op_name, char *msg)
 {
        GtkWidget *dialog;
-       char str[128];
        int ret;
 
        dzd->zone_no = dzd->zlist_selection;
@@ -1431,17 +1430,20 @@
        if (ret != 0) {
 
                if (dzd->zone_no == -1)
-                       sprintf(str, "%s all zones failed\n",
-                               op_name);
+                       dialog = gtk_message_dialog_new(GTK_WINDOW(dz.window),
+                                       GTK_DIALOG_MODAL | 
GTK_DIALOG_DESTROY_WITH_PARENT,
+                                       GTK_MESSAGE_ERROR,
+                                       GTK_BUTTONS_OK,
+                                       "%s all zones failed\n",
+                                       op_name);
                else
-                       sprintf(str, "%s zone %d failed\n",
-                               op_name, dzd->zone_no);
+                       dialog = gtk_message_dialog_new(GTK_WINDOW(dz.window),
+                                       GTK_DIALOG_MODAL | 
GTK_DIALOG_DESTROY_WITH_PARENT,
+                                       GTK_MESSAGE_ERROR,
+                                       GTK_BUTTONS_OK,
+                                       "%s zone %d failed\n",
+                                       op_name, dzd->zone_no);
 
-               dialog = gtk_message_dialog_new(GTK_WINDOW(dz.window),
-                                               GTK_DIALOG_MODAL | 
GTK_DIALOG_DESTROY_WITH_PARENT,
-                                               GTK_MESSAGE_ERROR,
-                                               GTK_BUTTONS_OK,
-                                               str);
                
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
                                                         "Error %d (%s)",
                                                         ret, strerror(ret));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libzbc-5.8.5/tools/report_zones/zbc_report_zones.c 
new/libzbc-5.9.0/tools/report_zones/zbc_report_zones.c
--- old/libzbc-5.8.5/tools/report_zones/zbc_report_zones.c      2020-03-09 
06:44:41.000000000 +0100
+++ new/libzbc-5.9.0/tools/report_zones/zbc_report_zones.c      2020-07-30 
04:59:13.000000000 +0200
@@ -91,7 +91,7 @@
        unsigned long long start = 0;
        int i, ret = 1;
        int num = 0;
-       char *path;
+       char *path, *end;
 
        /* Check command line */
        if (argc < 2) {
@@ -131,8 +131,8 @@
                                goto usage;
                        i++;
 
-                       nz = strtol(argv[i], NULL, 10);
-                       if (nz <= 0)
+                       nz = strtol(argv[i], &end, 10);
+                       if (*end != '\0' || nz == 0)
                                goto usage;
 
                } else if (strcmp(argv[i], "-lba") == 0) {
@@ -141,11 +141,18 @@
 
                } else if (strcmp(argv[i], "-start") == 0) {
 
-                       if (i >= (argc - 1))
+                       if (i >= (argc - 1)) {
+                               printf("Missing -start value\n");
                                goto usage;
+                       }
                        i++;
 
-                       start = strtoll(argv[i], NULL, 10);
+                       start = strtoll(argv[i], &end, 10);
+                       if (*end != '\0') {
+                               printf("Invalid start offset \"%s\"\n",
+                                      argv[i]);
+                               goto usage;
+                       }
 
                } else if (strcmp(argv[i], "-ro") == 0) {
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libzbc-5.8.5/tools/zone_op/Makemodule.am 
new/libzbc-5.9.0/tools/zone_op/Makemodule.am
--- old/libzbc-5.8.5/tools/zone_op/Makemodule.am        2020-03-09 
06:44:41.000000000 +0100
+++ new/libzbc-5.9.0/tools/zone_op/Makemodule.am        2020-07-30 
04:59:13.000000000 +0200
@@ -4,6 +4,7 @@
 # Copyright (c) 2020 Western Digital Corporation or its affiliates.
 
 noinst_LTLIBRARIES = libzone_op.la   
-libzone_op_la_SOURCES = tools/zone_op/zbc_zone_op.c
+libzone_op_la_SOURCES = tools/zone_op/zbc_zone_op.c \
+                        tools/zone_op/zbc_zone_op.h
 libzone_op_la_LIBADD = $(libzbc_ldadd)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libzbc-5.8.5/tools/zone_op/zbc_zone_op.c 
new/libzbc-5.9.0/tools/zone_op/zbc_zone_op.c
--- old/libzbc-5.8.5/tools/zone_op/zbc_zone_op.c        2020-03-09 
06:44:41.000000000 +0100
+++ new/libzbc-5.9.0/tools/zone_op/zbc_zone_op.c        2020-07-30 
04:59:13.000000000 +0200
@@ -37,15 +37,15 @@
 {
        struct zbc_device_info info;
        struct zbc_device *dev;
-       struct zbc_zone *zones = NULL, *tgt = NULL;;
-       long long start = -1LL;
-       unsigned long long start_sector = -1ULL;
+       struct zbc_zone *zones = NULL, *tgt = NULL;
+       long long start = 0;
+       unsigned long long start_sector = 0, zone_start;
        unsigned int flags = 0;
        int i, ret = 1;
        unsigned int nr_zones, tgt_idx;
        bool sector_unit = false;
        bool lba_unit = false;
-       char *path;
+       char *path, *end;
 
        /* Check command line */
        if (!argc) {
@@ -147,26 +147,19 @@
        if (flags & ZBC_OP_ALL_ZONES) {
 
                printf("Operating on all zones...\n");
-               start_sector = 0;
 
        } else {
 
                /* Get target zone */
-               start = strtoll(argv[i + 1], NULL, 10);
-               if (start < 0) {
+               start = strtoll(argv[i + 1], &end, 10);
+               if (*end != '\0' || start < 0) {
                        fprintf(stderr, "Invalid zone\n");
                        ret = 1;
                        goto out;
                }
-               if (lba_unit)
-                       start_sector = zbc_lba2sect(&info, start);
-               else if (sector_unit)
-                       start_sector = start;
-               else
-                       start_sector = 0;
 
                /* Get zone list */
-               ret = zbc_list_zones(dev, start, ZBC_RO_ALL, &zones, &nr_zones);
+               ret = zbc_list_zones(dev, 0, ZBC_RO_ALL, &zones, &nr_zones);
                if ( ret != 0 ) {
                        fprintf(stderr, "zbc_list_zones failed\n");
                        ret = 1;
@@ -174,18 +167,25 @@
                }
 
                if (lba_unit || sector_unit) {
+                       struct zbc_zone *z;
+
                        /* Search target zone */
-                       for (i = 0; i < (int)nr_zones; i++) {
-                               if (start_sector >= zbc_zone_start(&zones[i]) &&
-                                   start_sector < zbc_zone_start(&zones[i]) + 
zbc_zone_length(&zones[i])) {
-                                       tgt = &zones[i];
-                                       tgt_idx = i;
+                       if (lba_unit)
+                               start_sector = zbc_lba2sect(&info, start);
+                       else
+                               start_sector = start;
+                       z = &zones[0];
+                       for (tgt_idx = 0; tgt_idx < nr_zones; tgt_idx++, z++) {
+                               if (start_sector >= zbc_zone_start(z) &&
+                                   start_sector < zbc_zone_start(z) + 
zbc_zone_length(z)) {
+                                       tgt = z;
                                        break;
                                }
                        }
                } else if (start < nr_zones) {
                        tgt = &zones[start];
                        tgt_idx = start;
+                       start_sector = zbc_zone_start(tgt);
                }
                if (!tgt) {
                        fprintf(stderr, "Target zone not found\n");
@@ -193,19 +193,12 @@
                        goto out;
                }
 
+               zone_start = zbc_sect2lba(&info, zbc_zone_start(tgt));
                if (lba_unit)
-                       printf("%s zone %d/%d, LBA %llu...\n",
-                              zbc_zone_op_name(op),
-                              tgt_idx, nr_zones,
-                              (unsigned long long)zbc_sect2lba(&info, 
zbc_zone_start(tgt)));
-               else
-                       printf("%s zone %d/%d, sector %llu...\n",
-                              zbc_zone_op_name(op),
-                              tgt_idx, nr_zones,
-                              (unsigned long long)zbc_zone_start(tgt));
-
-               start_sector = zbc_zone_start(tgt);
-
+                       zone_start = zbc_sect2lba(&info, zone_start);
+               printf("%s zone %d/%d, %s %llu...\n",
+                      zbc_zone_op_name(op), tgt_idx, nr_zones,
+                      lba_unit ? "LBA" : "sector", zone_start);
        }
 
        switch (op) {


Reply via email to