Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libzbc for openSUSE:Factory checked in at 2022-11-02 13:52:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libzbc (Old) and /work/SRC/openSUSE:Factory/.libzbc.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libzbc" Wed Nov 2 13:52:57 2022 rev:21 rq:1032863 version:5.13.0 Changes: -------- --- /work/SRC/openSUSE:Factory/libzbc/libzbc.changes 2021-08-23 10:20:23.775432129 +0200 +++ /work/SRC/openSUSE:Factory/.libzbc.new.2275/libzbc.changes 2022-11-02 13:52:58.069245609 +0100 @@ -1,0 +2,10 @@ +Wed Nov 2 10:55:20 UTC 2022 - Jan Engelhardt <jeng...@inai.de> + +- Update to release 5.13 + * Improve the detection of ATA devices with the scsi backend + driver + * Add the -scsi and -ata option to all command line tools to + respectively force the use of the SCSI or ATA backend + drivers. + +------------------------------------------------------------------- Old: ---- v5.12.0.tar.gz New: ---- v5.13.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libzbc.spec ++++++ --- /var/tmp/diff_new_pack.ltNUub/_old 2022-11-02 13:52:58.825249331 +0100 +++ /var/tmp/diff_new_pack.ltNUub/_new 2022-11-02 13:52:58.833249371 +0100 @@ -1,7 +1,7 @@ # # spec file for package libzbc # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ Name: libzbc %define lname libzbc5 -Version: 5.12.0 +Version: 5.13.0 Release: 0 Summary: Library for manipulating ZBC and ZAC disks License: BSD-2-Clause AND LGPL-3.0-or-later ++++++ v5.12.0.tar.gz -> v5.13.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzbc-5.12.0/CODE_OF_CONDUCT.md new/libzbc-5.13.0/CODE_OF_CONDUCT.md --- old/libzbc-5.12.0/CODE_OF_CONDUCT.md 1970-01-01 01:00:00.000000000 +0100 +++ new/libzbc-5.13.0/CODE_OF_CONDUCT.md 2022-11-02 00:21:21.000000000 +0100 @@ -0,0 +1,134 @@ + +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +[Open Source Inquiries][contact]. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available +at [https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations +[contact]: https://www.westerndigital.com/contact/contact-open-source diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzbc-5.12.0/Makefile.am new/libzbc-5.13.0/Makefile.am --- old/libzbc-5.12.0/Makefile.am 2021-08-17 08:43:26.000000000 +0200 +++ new/libzbc-5.13.0/Makefile.am 2022-11-02 00:21:21.000000000 +0100 @@ -11,9 +11,12 @@ SUBDIRS += test/programs endif -EXTRA_DIST = autogen.sh COPYING.BSD COPYING.LESSER README.md +EXTRA_DIST = autogen.sh \ + README.md \ + LICENSES/BSD-2-Clause.txt \ + LICENSES/LGPL-3.0-or-later.txt -if ENABLE_RPMBUILD +if BUILDING_RPM rpmdir = $(abs_top_builddir)/rpmbuild EXTRA_DIST += libzbc.spec @@ -22,14 +25,13 @@ rpm: dist @echo "Building RPM packages..." @mkdir -p $(rpmdir) - @mv libzbc-$(PACKAGE_VERSION).tar.gz v$(PACKAGE_VERSION).tar.gz - $(RPMBUILD) -ta --clean -D "_topdir $(rpmdir)" v$(PACKAGE_VERSION).tar.gz + $(RPMBUILD) -ta --clean -D "_topdir $(rpmdir)" libzbc-$(PACKAGE_VERSION).tar.gz @mv -f $(rpmdir)/RPMS/$(RPMARCH)/*.rpm $(abs_top_builddir) @mv -f $(rpmdir)/SRPMS/*.rpm $(abs_top_builddir) @rm -rf $(rpmdir) - @rm -f v$(PACKAGE_VERSION).tar.gz + @rm -f libzbc-$(PACKAGE_VERSION).tar.gz else rpm: - @echo "To build RPM packages, install the rpm and rpm-build packages" + @echo "Building RPM packages requires rpmbuild and rpm utilities" exit 1 endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzbc-5.12.0/README.md new/libzbc-5.13.0/README.md --- old/libzbc-5.12.0/README.md 2021-08-17 08:43:26.000000000 +0200 +++ new/libzbc-5.13.0/README.md 2022-11-02 00:21:21.000000000 +0100 @@ -1,7 +1,6 @@ Copyright (C) 2016, Western Digital.<br> Copyright (C) 2020 Western Digital Corporation or its affiliates. - # libzbc *libzbc* is a simple library providing functions for manipulating SCSI and ATA @@ -18,20 +17,28 @@ Several example applications using *libzbc* are available under the tools directory. -### Library version +## Online Documentation + +Information about *libzbc*, including examples, can be found on the +[zonedstorage.io](https://zonedstorage.io/docs/tools/libzbc) site. + +Detailed information on the execution of device compliance tests can be found +[here](https://zonedstorage.io/docs/tests/zbc-tests). + +## 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 library operation does not change, but applications written for previous *libzbc* versions must be updated to use the new API. -### ZBC and ZAC Standards Versions Supported +## ZBC and ZAC Standards Versions Supported *libzbc* latest version is implements ZBC and ZAC standards revision 05. Support for the older draft standards are available with [previous releases and pre-releases](https://github.com/hgst/libzbc/releases). -### License +## License *libzbc* source code is distributed under the terms of the BSD 2-clause license ("Simplified BSD License" or "FreeBSD License", SPDX: *BSD-2-Clause*) @@ -69,7 +76,7 @@ See [LICENSES/CC0-1.0.txt] for the full text of this license. -### Contributions and Bug Reports +## Contributions and Bug Reports Contributions are accepted as github pull requests. Any problem may also be reported through github issue page or by contacting: @@ -82,16 +89,20 @@ ## Compilation and installation +### Requirements + *libzbc* requires the following packages for compilation: +* m4 * autoconf -* autoconf-archive * automake * libtool The GTK3 and GTK3 development packages must be installed to automatically enable compiling the *gzbc* and *gzviewer* applications. +### Compilation + To compile the library and all example applications under the tools directory, execute the following commands. @@ -101,26 +112,7 @@ $ make ``` -To install the library and all example applications compiled under the tools -directory, execute the following command. - -``` -$ 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 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 -``` - -## Compilation with GUI tools +#### 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 @@ -132,7 +124,7 @@ $ ./configure --disable-gui ``` -## Compilation for device tests +#### Compilation for device tests The test directory contains several test programs and scripts allowing testing the compatibility of *libzbc* with a particular device. That is, testing if a @@ -167,7 +159,28 @@ 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 +### Installation + +To install the library and all example applications compiled under the tools +directory, execute the following command. + +``` +$ 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 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 +``` + +### Building RPM packages The *rpm* and *rpmbuild* utilities are necessary to build *libzbc* RPM packages. Once these utilities are installed, the RPM packages can be built diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzbc-5.12.0/configure.ac new/libzbc-5.13.0/configure.ac --- old/libzbc-5.12.0/configure.ac 2021-08-17 08:43:26.000000000 +0200 +++ new/libzbc-5.13.0/configure.ac 2022-11-02 00:21:21.000000000 +0100 @@ -4,34 +4,27 @@ # Copyright (c) 2009-2014, HGST, Inc. All rights reserved. # Copyright (c) 2020 Western Digital Corporation or its affiliates. -AC_INIT([libzbc], [5.12.0], +AC_INIT([libzbc], [5.13.0], [damien.lem...@wdc.com, dmitry.fomic...@wdc.com], [libzbc], [https://github.com/westerndigitalcorporation/libzbc]) -# Package version details: <major>.<minor>.<release> -PACKAGE_VERSION_MAJOR=$(echo $PACKAGE_VERSION | awk -F. '{print $1}') -PACKAGE_VERSION_MINOR=$(echo $PACKAGE_VERSION | awk -F. '{print $2}') -PACKAGE_VERSION_RELEASE=$(echo $PACKAGE_VERSION | awk -F. '{print $3}') - -# libtool friendly library version format -LIBZBC_VERSION_LT=$PACKAGE_VERSION_MAJOR:$PACKAGE_VERSION_MINOR:$PACKAGE_VERSION_RELEASE -AC_SUBST([LIBZBC_VERSION_LT]) - AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_HEADER([include/config.h]) +AC_CONFIG_HEADERS([include/config.h]) AC_PREFIX_DEFAULT(/usr) +AC_CANONICAL_TARGET AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) AM_SILENT_RULES([yes]) -RPM_RELEASE=1 -AC_SUBST(RPM_RELEASE) -AX_RPM_INIT +# Change default CFLAGS from "-g -O2" to "-O2" for regular builds. +AC_ARG_ENABLE(debug, + [ --enable-debug Compile with "-g" option], + [DBGCFLAGS="-g"], + [DBGCFLAGS="-O2"]) +CFLAGS="$CFLAGS $DBGCFLAGS" -AX_CHECK_ENABLE_DEBUG([no], [_DBG_]) AC_PROG_CC -AM_PROG_CC_C_O AC_PROG_INSTALL AC_CHECK_PROGS([DOXYGEN], [doxygen]) @@ -41,19 +34,19 @@ AC_USE_SYSTEM_EXTENSIONS AC_SYS_LARGEFILE -AC_GNU_SOURCE m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) m4_pattern_allow([AM_PROG_AR]) 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" -CC="$PTHREAD_CC" +# Package version details: <major>.<minor>.<release> +PACKAGE_VERSION_MAJOR=$(echo $PACKAGE_VERSION | awk -F. '{print $1}') +PACKAGE_VERSION_MINOR=$(echo $PACKAGE_VERSION | awk -F. '{print $2}') +PACKAGE_VERSION_RELEASE=$(echo $PACKAGE_VERSION | awk -F. '{print $3}') + +# libtool friendly library version format +LIBZBC_VERSION_LT=$PACKAGE_VERSION_MAJOR:$PACKAGE_VERSION_MINOR:$PACKAGE_VERSION_RELEASE +AC_SUBST([LIBZBC_VERSION_LT]) # Checks for header files. AC_CHECK_HEADERS([linux/fs.h], [], @@ -73,25 +66,22 @@ ]]) # Conditionals + +# Build gzbc only if GTK3 is installed and can be detected with pkg-config. AC_ARG_ENABLE([gui], - AS_HELP_STRING([--disable-gui], [Disable build of GUI tools (gzbc and gzviewer) [default=no]])) + AS_HELP_STRING([--disable-gui], + [Disable build of GUI tools (gzbc and gzviewer) [default=no]])) AS_IF([test "x$enable_gui" != "xno"], -[ - # Build gzbc only if GTK3 is installed and can be detected with pkg-config. - m4_ifdef([PKG_CHECK_MODULES], - [PKG_CHECK_MODULES([GTK], [gtk+-3.0], [HAVE_GTK3=1], [HAVE_GTK3=0])], - [HAVE_GTK3=0]) - AM_CONDITIONAL([BUILD_GUI], [test "$HAVE_GTK3" -eq 1]) -], -[ - AM_CONDITIONAL([BUILD_GUI], false) -]) + [m4_ifdef([PKG_CHECK_MODULES], + [PKG_CHECK_MODULES([GTK], [gtk+-3.0], [HAVE_GTK3=1], [HAVE_GTK3=0])], + [HAVE_GTK3=0]) + AM_CONDITIONAL([BUILD_GUI], [test "$HAVE_GTK3" -eq 1])], + [AM_CONDITIONAL([BUILD_GUI], false)]) # Build test suite AC_ARG_WITH([test], [AS_HELP_STRING([--with-test], [Build compatibility test suite [default=no]])], - [WITH_TEST=1], - [WITH_TEST=0]) + [WITH_TEST=1], [WITH_TEST=0]) AS_IF([test "$WITH_TEST" -eq 1], [ AM_CONDITIONAL([BUILD_TEST], true) @@ -104,7 +94,8 @@ # Checks for rpm package builds AC_PATH_PROG([RPMBUILD], [rpmbuild], [notfound]) AC_PATH_PROG([RPM], [rpm], [notfound]) -AM_CONDITIONAL(ENABLE_RPMBUILD, test "x$RPMBUILD" != "xnotfound" && test "x$RPM" != "xnotfound") +AM_CONDITIONAL([BUILDING_RPM], + [test "x$RPMBUILD" != "xnotfound" && test "x$RPM" != "xnotfound"]) AC_CONFIG_FILES([ Makefile diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzbc-5.12.0/lib/Makefile.am new/libzbc-5.13.0/lib/Makefile.am --- old/libzbc-5.12.0/lib/Makefile.am 2021-08-17 08:43:26.000000000 +0200 +++ new/libzbc-5.13.0/lib/Makefile.am 2022-11-02 00:21:21.000000000 +0100 @@ -5,8 +5,8 @@ # Copyright (c) 2020 Western Digital Corporation or its affiliates. AM_CFLAGS = \ - -Wall -Wextra -Wno-unused-parameter -AM_CPPFLAGS = \ + $(CFLAGS) \ + -Wall -Wextra -Wno-unused-parameter \ -I$(top_srcdir)/include pkgconfdir = $(libdir)/pkgconfig diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzbc-5.12.0/lib/zbc_ata.c new/libzbc-5.13.0/lib/zbc_ata.c --- old/libzbc-5.12.0/lib/zbc_ata.c 2021-08-17 08:43:26.000000000 +0200 +++ new/libzbc-5.13.0/lib/zbc_ata.c 2022-11-02 00:21:21.000000000 +0100 @@ -74,40 +74,40 @@ { switch (cmd->cdb[14]) { case ZBC_ATA_IDENTIFY: - return "IDENTIFY"; + return "/IDENTIFY"; case ZBC_ATA_EXEC_DEV_DIAGNOSTIC: - return "EXEC DEV DIAGNOSTIC"; + return "/EXEC DEV DIAGNOSTIC"; case ZBC_ATA_READ_LOG_DMA_EXT: - return "READ LOG DMA EXT"; + return "/READ LOG DMA EXT"; case ZBC_ATA_SET_FEATURES: - return "SET FEATURES"; + return "/SET FEATURES"; case ZBC_ATA_REQUEST_SENSE_DATA_EXT: - return "REQUEST SENSE DATA EXT"; + return "/REQUEST SENSE DATA EXT"; case ZBC_ATA_READ_DMA_EXT: - return "READ DMA EXT"; + return "/READ DMA EXT"; case ZBC_ATA_WRITE_DMA_EXT: - return "WRITE DMA EXT"; + return "/WRITE DMA EXT"; case ZBC_ATA_FLUSH_CACHE_EXT: - return "FLUSH CACHE EXT"; + return "/FLUSH CACHE EXT"; case ZBC_ATA_ENABLE_SENSE_DATA_REPORTING: - return "ENABLE SENSE DATA REPORTING"; + return "/ENABLE SENSE DATA REPORTING"; case ZBC_ATA_ZAC_MANAGEMENT_IN: - return "REPORT ZONES EXT"; + return "/REPORT ZONES EXT"; case ZBC_ATA_ZAC_MANAGEMENT_OUT: switch (cmd->cdb[4]) { case ZBC_ATA_CLOSE_ZONE_EXT_AF: - return "CLOSE ZONE EXT"; + return "/CLOSE ZONE EXT"; case ZBC_ATA_FINISH_ZONE_EXT_AF: - return "FINISH ZONE EXT"; + return "/FINISH ZONE EXT"; case ZBC_ATA_OPEN_ZONE_EXT_AF: - return "OPEN ZONE EXT"; + return "/OPEN ZONE EXT"; case ZBC_ATA_RESET_WRITE_POINTER_EXT_AF: - return "RESET WRITE POINTER EXT"; + return "/RESET WRITE POINTER EXT"; } break; } - return "UNKNOWN COMMAND"; + return "/UNKNOWN COMMAND"; } /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzbc-5.12.0/lib/zbc_scsi.c new/libzbc-5.13.0/lib/zbc_scsi.c --- old/libzbc-5.12.0/lib/zbc_scsi.c 2021-08-17 08:43:26.000000000 +0200 +++ new/libzbc-5.13.0/lib/zbc_scsi.c 2022-11-02 00:21:21.000000000 +0100 @@ -181,15 +181,19 @@ return ret; } - if (strncmp((char *)&buf[8], "ATA", 3) == 0) { - zbc_debug("%s: ATA device\n", dev->zbd_filename); - dev->zbd_drv_flags |= ZBC_IS_ATA; - } - /* This is a SCSI device */ dev->zbd_info.zbd_type = ZBC_DT_SCSI; /* + * Check if we are dealing with an ATA device by checking for the + * ATA Information VPD page (89h). + */ + if (zbc_scsi_vpd_page_supported(dev, 0x89)) { + dev->zbd_drv_flags |= ZBC_IS_ATA; + zbc_debug("%s: ATA device\n", dev->zbd_filename); + } + + /* * Concatenate vendor identification, product identification * and product revision strings. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzbc-5.12.0/libzbc.spec new/libzbc-5.13.0/libzbc.spec --- old/libzbc-5.12.0/libzbc.spec 2021-08-17 08:43:26.000000000 +0200 +++ new/libzbc-5.13.0/libzbc.spec 2022-11-02 00:21:21.000000000 +0100 @@ -1,33 +1,27 @@ -# SPDX-License-Identifier: BSD-2-Clause -# SPDX-License-Identifier: LGPL-3.0-or-later -# -# Copyright (c) 2020 Western Digital Corporation or its affiliates. Name: libzbc -Version: 5.12.0 +Version: 5.13.0 Release: 1%{?dist} -Summary: A library to control SCSI/ZBC and ATA/ZAC zoned devices +Summary: A library to control SCSI/ZBC and ATA/ZAC devices License: BSD and LGPLv3+ URL: https://github.com/westerndigitalcorporation/%{name} -Source0: https://github.com/westerndigitalcorporation/%{name}/archive/refs/tags/v%{version}.tar.gz +Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz -BuildRoot: %{_topdir}/BUILDROOT/ -BuildRequires: autoconf,autoconf-archive,automake,libtool +BuildRequires: gtk3-devel +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool +BuildRequires: make +BuildRequires: gcc %description -libzbc is a 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 ZBC and ZAC v1 standards -defined by INCITS technical committee T10 and T13 (respectively). - -%package static -Summary: Static library for libzbc -Requires: %{name}%{?_isa} = %{version}-%{release} - -%description static -This package provides libzbc static library. +libzbc is a SCSI and ATA passthrough command library providing functions for +managing SCSI and ATA devices supporting the Zoned Block Command (ZBC) and +Zoned-device ATA command set (ZAC) specifications. libzbc implementation is +compliant with the ZBC and ZAC r05 standards defined by INCITS technical +committee T10 and T13 (respectively). +# Development headers package %package devel Summary: Development header files for libzbc Requires: %{name}%{?_isa} = %{version}-%{release} @@ -35,6 +29,22 @@ %description devel This package provides development header files for libzbc. +# Command line tools package +%package cli-tools +Summary: Command line tools using libzbc +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description cli-tools +This package provides command line tools using libzbc. + +# Graphic tools package +%package gtk-tools +Summary: GTK tools using libzbc +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description gtk-tools +This package provides GTK-based graphical tools using libzbc. + %prep %autosetup @@ -44,32 +54,40 @@ %make_build %install -rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT -make install PREFIX=%{_prefix} DESTDIR=$RPM_BUILD_ROOT -chmod -x $RPM_BUILD_ROOT%{_mandir}/man8/*.8 +%make_install PREFIX=%{_prefix} +chmod -x ${RPM_BUILD_ROOT}%{_mandir}/man8/*.8* -find $RPM_BUILD_ROOT -name '*.la' -delete +find ${RPM_BUILD_ROOT} -name '*.la' -delete %ldconfig_scriptlets %files -%{_libdir}/*.so %{_libdir}/*.so.* -%{_bindir}/* -%{_mandir}/man8/* -%exclude %{_libdir}/pkgconfig - -%files static -%{_libdir}/*.a +%exclude %{_libdir}/*.a +%exclude %{_libdir}/pkgconfig/*.pc +%license LICENSES/BSD-2-Clause.txt +%license LICENSES/LGPL-3.0-or-later.txt +%doc README.md %files devel %{_includedir}/* -%{_libdir}/pkgconfig - -%license COPYING.BSD COPYING.LESSER -%doc README.md +%{_libdir}/*.so +%{_libdir}/pkgconfig/*.pc +%license LICENSES/BSD-2-Clause.txt +%license LICENSES/LGPL-3.0-or-later.txt + +%files cli-tools +%{_bindir}/zbc_* +%{_mandir}/man8/zbc_*.8* +%license LICENSES/LGPL-3.0-or-later.txt + +%files gtk-tools +%{_bindir}/gzbc +%{_bindir}/gzviewer +%{_mandir}/man8/gzbc.8* +%{_mandir}/man8/gzviewer.8* +%license LICENSES/LGPL-3.0-or-later.txt %changelog -* Wed Aug 17 2021 Damien Le Moal <damien.lem...@wdc.com> 5.12.0-1 -- Version 5.12.0 package +* Wed Nov 02 2022 Damien Le Moal <damien.lem...@wdc.com> 5.13.0-1 +- Version 5.13.0 package diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzbc-5.12.0/test/programs/Makefile.am new/libzbc-5.13.0/test/programs/Makefile.am --- old/libzbc-5.12.0/test/programs/Makefile.am 2021-08-17 08:43:26.000000000 +0200 +++ new/libzbc-5.13.0/test/programs/Makefile.am 2022-11-02 00:21:21.000000000 +0100 @@ -8,8 +8,7 @@ AM_CFLAGS = \ -O2 \ - -Wall -Wextra -Wno-unused-parameter -AM_CPPFLAGS = \ + -Wall -Wextra -Wno-unused-parameter \ -I$(top_srcdir)/include libzbc_ldadd = $(top_builddir)/lib/libzbc.la diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzbc-5.12.0/tools/Makefile.am new/libzbc-5.13.0/tools/Makefile.am --- old/libzbc-5.12.0/tools/Makefile.am 2021-08-17 08:43:26.000000000 +0200 +++ new/libzbc-5.13.0/tools/Makefile.am 2022-11-02 00:21:21.000000000 +0100 @@ -7,9 +7,9 @@ SUBDIRS = . $(subdirs) AM_CFLAGS = \ - -Wall -Wextra -Wno-unused-parameter -AM_CPPFLAGS = \ - -I$(top_srcdir)/include + $(CFLAGS) \ + -Wall -Wextra -Wno-unused-parameter \ + -I$(top_srcdir)/include libzbc_ldadd = $(top_builddir)/lib/libzbc.la diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzbc-5.12.0/tools/gui/Makefile.am new/libzbc-5.13.0/tools/gui/Makefile.am --- old/libzbc-5.12.0/tools/gui/Makefile.am 2021-08-17 08:43:26.000000000 +0200 +++ new/libzbc-5.13.0/tools/gui/Makefile.am 2022-11-02 00:21:21.000000000 +0100 @@ -12,6 +12,6 @@ gui/gzbc.h gzbc_CFLAGS = $(CFLAGS) $(GTK_CFLAGS) -gzbc_LDADD = $(libzbc_ldadd) $(GTK_LIBS) +gzbc_LDADD = $(libzbc_ldadd) $(GTK_LIBS) -lpthread dist_man8_MANS += gui/gzbc.8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzbc-5.12.0/tools/info/zbc_info.c new/libzbc-5.13.0/tools/info/zbc_info.c --- old/libzbc-5.12.0/tools/info/zbc_info.c 2021-08-17 08:43:26.000000000 +0200 +++ new/libzbc-5.13.0/tools/info/zbc_info.c 2022-11-02 00:21:21.000000000 +0100 @@ -17,14 +17,16 @@ #include <libzbc/zbc.h> -static int zbc_info_usage(char *bin_name) +static int zbc_info_usage(FILE *out, char *bin_name) { - printf("Usage: %s [options] <dev>\n" - "Options:\n" - " -h | --help : Display this help message and exit\n" - " -v : Verbose mode\n" - " -e : Print information for an emulated device\n", - basename(bin_name)); + fprintf(out, "Usage: %s [options] <dev>\n" + "Options:\n" + " -h | --help : Display this help message and exit\n" + " -v : Verbose mode\n" + " -scsi : Force the use of SCSI passthrough commands\n" + " -ata : Force the use of ATA passthrough commands\n" + " -e : Print information for an emulated device\n", + basename(bin_name)); return 1; } @@ -32,31 +34,41 @@ int main(int argc, char **argv) { struct zbc_device_info info; + struct zbc_device *dev; bool do_fake = false; - int ret, i; + int ret, i, oflags = 0; + char *path; /* Check command line */ if (argc < 2) - return zbc_info_usage(argv[0]); + return zbc_info_usage(stderr, argv[0]); /* Parse options */ for (i = 1; i < (argc - 1); i++) { if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) - return zbc_info_usage(argv[0]); + return zbc_info_usage(stdout, argv[0]); if (strcmp(argv[i], "-v") == 0) { zbc_set_log_level("debug"); + } else if (strcmp(argv[i], "-scsi") == 0) { + + oflags = ZBC_O_DRV_SCSI; + + } else if (strcmp(argv[i], "-ata") == 0) { + + oflags = ZBC_O_DRV_ATA; + } else if (strcmp(argv[i], "-e") == 0) { do_fake = true; } else if (argv[i][0] == '-') { - printf("Unknown option \"%s\"\n", - argv[i]); + fprintf(stderr, "Unknown option \"%s\"\n", + argv[i]); return 1; } else { @@ -67,22 +79,51 @@ } if (i != (argc - 1)) - return zbc_info_usage(argv[0]); + return zbc_info_usage(stderr, argv[0]); + + if (oflags & ZBC_O_DRV_SCSI && oflags & ZBC_O_DRV_ATA) { + fprintf(stderr, + "-scsi and -ata options are mutually exclusive\n"); + return 1; + } + + if (oflags && do_fake) { + fprintf(stderr, + "-e option is mutually exclusive with -scsi and -ata options\n"); + return 1; + } /* Open device */ - ret = zbc_device_is_zoned(argv[i], do_fake, &info); - if (ret == 1) { - printf("Device %s:\n", argv[i]); - zbc_print_device_info(&info, stdout); - ret = 0; - } else if (ret == 0) { - printf("%s is not a zoned block device\n", argv[i]); + path = argv[i]; + if (oflags) { + ret = zbc_open(path, oflags | O_RDONLY, &dev); + if (ret != 0) { + if (ret == -ENODEV) + goto not_zoned; + fprintf(stderr, "Open %s failed (%s)\n", + path, strerror(-ret)); + return 1; + } + zbc_get_device_info(dev, &info); } else { - fprintf(stderr, - "zbc_device_is_zoned failed %d (%s)\n", - ret, strerror(-ret)); - ret = 1; + ret = zbc_device_is_zoned(path, do_fake, &info); + if (ret < 0) { + fprintf(stderr, + "zbc_device_is_zoned failed %d (%s)\n", + ret, strerror(-ret)); + return 1; + } + if (ret == 0) + goto not_zoned; + } - return ret; + printf("Device %s:\n", argv[i]); + zbc_print_device_info(&info, stdout); + + return 0; +not_zoned: + printf("%s is not a zoned block device\n", path); + + return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzbc-5.12.0/tools/read_zone/zbc_read_zone.c new/libzbc-5.13.0/tools/read_zone/zbc_read_zone.c --- old/libzbc-5.12.0/tools/read_zone/zbc_read_zone.c 2021-08-17 08:43:26.000000000 +0200 +++ new/libzbc-5.13.0/tools/read_zone/zbc_read_zone.c 2022-11-02 00:21:21.000000000 +0100 @@ -43,28 +43,31 @@ zbc_read_zone_abort = 1; } -static int zbc_read_zone_usage(char *prog) +static int zbc_read_zone_usage(FILE *out, char *prog) { - printf("Usage: %s [options] <dev> <zone no> <I/O size (B)>\n" - " Read from a zone up to the zone write pointer position\n" - " or until specified number of I/Os are all executed.\n" - "Options:\n" - " -h | --help : Display this help message and exit\n" - " -v : Verbose mode\n" - " -dio : Use direct I/Os\n" - " -vio <num> : Use vectored I/Os with <num> buffers of\n" - " <I/O size> bytes, resulting in an actual\n" - " I/O size of <num> x <I/O size> B\n" - " -nio <num> : Limit the number of I/Os to <num>\n" - " -p <num> : Expect all bytes that are read to have the\n" - " value <num>. In case of a mismatch, the\n" - " offset of the mismatch is printed\n" - " -f <file> : Write the content of the zone to <file>\n" - " If <file> is \"-\", the zone content is\n" - " written to the standard output\n" - " -ofst <ofst> : Read the zone starting at sector <ofst>\n" - " instead of from the zone start sector\n", - basename(prog)); + fprintf(out, + "Usage: %s [options] <dev> <zone no> <I/O size (B)>\n" + " Read from a zone up to the zone write pointer position\n" + " or until specified number of I/Os are all executed.\n" + "Options:\n" + " -h | --help : Display this help message and exit\n" + " -v : Verbose mode\n" + " -scsi : Force the use of SCSI passthrough commands\n" + " -ata : Force the use of ATA passthrough commands\n" + " -dio : Use direct I/Os\n" + " -vio <num> : Use vectored I/Os with <num> buffers of\n" + " <I/O size> bytes, resulting in an actual\n" + " I/O size of <num> x <I/O size> B\n" + " -nio <num> : Limit the number of I/Os to <num>\n" + " -p <num> : Expect all bytes that are read to have the\n" + " value <num>. In case of a mismatch, the\n" + " offset of the mismatch is printed\n" + " -f <file> : Write the content of the zone to <file>\n" + " If <file> is \"-\", the zone content is\n" + " written to the standard output\n" + " -ofst <ofst> : Read the zone starting at sector <ofst>\n" + " instead of from the zone start sector\n", + basename(prog)); return 1; } @@ -90,6 +93,7 @@ long long sector_max = 0; long long zone_ofst = 0; int flags = O_RDONLY; + int oflags = 0; bool vio = false, ptrn_set = false; unsigned long pattern = 0; struct iovec *iov = NULL; @@ -97,14 +101,26 @@ /* Parse command line */ if (argc < 4) - return zbc_read_zone_usage(argv[0]); + return zbc_read_zone_usage(stderr, argv[0]); for (i = 1; i < (argc - 1); i++) { + if (strcmp(argv[i], "-h") == 0 || + strcmp(argv[i], "--help") == 0) + return zbc_read_zone_usage(stdout, argv[0]); + if (strcmp(argv[i], "-v") == 0) { zbc_set_log_level("debug"); + } else if (strcmp(argv[i], "-scsi") == 0) { + + oflags = ZBC_O_DRV_SCSI; + + } else if (strcmp(argv[i], "-ata") == 0) { + + oflags = ZBC_O_DRV_ATA; + } else if (strcmp(argv[i], "-p") == 0) { if (i >= (argc - 1)) @@ -194,6 +210,13 @@ /* Get parameters */ path = argv[i]; + + if (oflags & ZBC_O_DRV_SCSI && oflags & ZBC_O_DRV_ATA) { + fprintf(stderr, + "-scsi and -ata options are mutually exclusive\n"); + return 1; + } + zidx = atoi(argv[i + 1]); if (zidx < 0) { fprintf(stderr, "Invalid zone number %s\n", argv[i + 1]); @@ -212,7 +235,7 @@ signal(SIGTERM, zbc_read_zone_sigcatcher); /* Open device */ - ret = zbc_open(path, flags, &dev); + ret = zbc_open(path, oflags | flags, &dev); if (ret != 0) { if (ret == -ENODEV) fprintf(stderr, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzbc-5.12.0/tools/report_zones/zbc_report_zones.c new/libzbc-5.13.0/tools/report_zones/zbc_report_zones.c --- old/libzbc-5.12.0/tools/report_zones/zbc_report_zones.c 2021-08-17 08:43:26.000000000 +0200 +++ new/libzbc-5.13.0/tools/report_zones/zbc_report_zones.c 2022-11-02 00:21:21.000000000 +0100 @@ -83,33 +83,36 @@ } -static int zbc_report_zones_usage(char *prog) +static int zbc_report_zones_usage(FILE *out, char *prog) { - printf("Usage: %s [options] <dev>\n" - "Options:\n" - " -h | --help : Display this help message and exit\n" - " -v : Verbose mode\n" - " -lba : Use LBA size unit (default is 512B sectors)\n" - " -start <ofst> : Start offset of the report. if -lba is\n" - " specified, <ofst> is interpreted as an LBA\n" - " value. Otherwise, it is interpreted as a\n" - " 512B sector value. Default is 0\n" - " -n : Get only the number of zones in the report\n" - " -nz <num> : Report at most <num> zones\n" - " -ro <opt> : Specify a reporting option. <opt> can be:\n" - " - all: report all zones (default)\n" - " - empty: report only empty zones\n" - " - imp_open: report only implicitly open zones\n" - " - exp_open: report only explicitly open zones\n" - " - closed: report only closed zones\n" - " - full: report only full zones\n" - " - rdonly: report only read-only zones\n" - " - offline: report only offline zones\n" - " - rwp: report only offline zones\n" - " - non_seq: report only offline zones\n" - " - not_wp: report only zones that are not\n" - " write pointer zones (e.g. conventional zones)\n", - basename(prog)); + fprintf(out, + "Usage: %s [options] <dev>\n" + "Options:\n" + " -h | --help : Display this help message and exit\n" + " -v : Verbose mode\n" + " -scsi : Force the use of SCSI passthrough commands\n" + " -ata : Force the use of ATA passthrough commands\n" + " -lba : Use LBA size unit (default is 512B sectors)\n" + " -start <ofst> : Start offset of the report. if -lba is\n" + " specified, <ofst> is interpreted as an LBA\n" + " value. Otherwise, it is interpreted as a\n" + " 512B sector value. Default is 0\n" + " -n : Get only the number of zones in the report\n" + " -nz <num> : Report at most <num> zones\n" + " -ro <opt> : Specify a reporting option. <opt> can be:\n" + " - all: report all zones (default)\n" + " - empty: report only empty zones\n" + " - imp_open: report only implicitly open zones\n" + " - exp_open: report only explicitly open zones\n" + " - closed: report only closed zones\n" + " - full: report only full zones\n" + " - rdonly: report only read-only zones\n" + " - offline: report only offline zones\n" + " - rwp: report only offline zones\n" + " - non_seq: report only offline zones\n" + " - not_wp: report only zones that are not\n" + " write pointer zones (e.g. conventional zones)\n", + basename(prog)); return 1; } @@ -124,25 +127,33 @@ struct zbc_zone *z, *zones = NULL; bool lba_unit = false; unsigned long long start = 0; - int i, ret = 1; + int i, ret = 1, oflags = 0; int num = 0; char *path, *end; /* Check command line */ if (argc < 2) - return zbc_report_zones_usage(argv[0]); + return zbc_report_zones_usage(stderr, argv[0]); /* Parse options */ for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) - return zbc_report_zones_usage(argv[0]); + return zbc_report_zones_usage(stdout, argv[0]); if (strcmp(argv[i], "-v") == 0) { zbc_set_log_level("debug"); + } else if (strcmp(argv[i], "-scsi") == 0) { + + oflags = ZBC_O_DRV_SCSI; + + } else if (strcmp(argv[i], "-ata") == 0) { + + oflags = ZBC_O_DRV_ATA; + } else if (strcmp(argv[i], "-n") == 0) { num = 1; @@ -155,7 +166,7 @@ nz = strtol(argv[i], &end, 10); if (*end != '\0' || nz == 0) { - printf("Missing -nz value\n"); + fprintf(stderr, "Missing -nz value\n"); return 1; } @@ -171,8 +182,8 @@ start = strtoll(argv[i], &end, 10); if (*end != '\0') { - printf("Invalid start offset \"%s\"\n", - argv[i]); + fprintf(stderr, "Invalid start offset \"%s\"\n", + argv[i]); return 1; } @@ -212,8 +223,8 @@ } else if (argv[i][0] == '-') { - printf("Unknown option \"%s\"\n", - argv[i]); + fprintf(stderr, "Unknown option \"%s\"\n", + argv[i]); return 1; } else { @@ -225,13 +236,19 @@ } if (i != (argc - 1)) { - printf("No device specified\n"); + fprintf(stderr, "No device specified\n"); + return 1; + } + + if (oflags & ZBC_O_DRV_SCSI && oflags & ZBC_O_DRV_ATA) { + fprintf(stderr, + "-scsi and -ata options are mutually exclusive\n"); return 1; } /* Open device */ path = argv[i]; - ret = zbc_open(path, O_RDONLY, &dev); + ret = zbc_open(path, oflags | O_RDONLY, &dev); if (ret != 0) { if (ret == -ENODEV) fprintf(stderr, @@ -334,7 +351,7 @@ return ret; err: - printf("Invalid command line\n"); + fprintf(stderr, "Invalid command line\n"); return 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzbc-5.12.0/tools/viewer/gzviewer.h new/libzbc-5.13.0/tools/viewer/gzviewer.h --- old/libzbc-5.12.0/tools/viewer/gzviewer.h 2021-08-17 08:43:26.000000000 +0200 +++ new/libzbc-5.13.0/tools/viewer/gzviewer.h 2022-11-02 00:21:21.000000000 +0100 @@ -12,7 +12,6 @@ #define __GZWATCH_H__ #include <sys/time.h> -#include <pthread.h> #include <gtk/gtk.h> #include <libzbc/zbc.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzbc-5.12.0/tools/write_zone/zbc_write_zone.c new/libzbc-5.13.0/tools/write_zone/zbc_write_zone.c --- old/libzbc-5.12.0/tools/write_zone/zbc_write_zone.c 2021-08-17 08:43:26.000000000 +0200 +++ new/libzbc-5.13.0/tools/write_zone/zbc_write_zone.c 2022-11-02 00:21:21.000000000 +0100 @@ -38,32 +38,35 @@ (unsigned long long) tv.tv_usec; } -static int zbc_write_zone_usage(char *prog) +static int zbc_write_zone_usage(FILE *out, char *prog) { - printf("Usage: %s [options] <dev> <zone no> <I/O size (B)>\n" - " Write to a zone from the zone write pointer, until\n" - " the zone is full or until the specified number of I/Os\n" - " are all executed.\n" - "Options:\n" - " -h | --help : Display this help message and exit\n" - " -v : Verbose mode\n" - " -s : Run zbc_flush after writing (equivalent to\n" - " executing sync())\n" - " -dio : Use direct I/Os\n" - " -vio <num> : Use vectored I/Os with <num> buffers of\n" - " <I/O size> bytes, resulting in an actual I/O\n" - " size of <num> x <I/O size> bytes.\n" - " -p <num> : Set the byte pattern to write. If this option\n" - " is omitted, zeroes are written.\n" - " -nio <num> : Limit the number of I/O executed to <num>\n" - " -f <file> : Write the content of <file>\n" - " -loop : If a file is specified, repeatedly write the\n" - " file content to the zone until the zone is full\n" - " -ofst <ofst> : Write the zone starting form the sector offset\n" - " <ofst> instead of from the zone start sector.\n" - " This option should be used only with\n" - " conventional zones.\n", - basename(prog)); + fprintf(out, + "Usage: %s [options] <dev> <zone no> <I/O size (B)>\n" + " Write to a zone from the zone write pointer, until\n" + " the zone is full or until the specified number of I/Os\n" + " are all executed.\n" + "Options:\n" + " -h | --help : Display this help message and exit\n" + " -v : Verbose mode\n" + " -scsi : Force the use of SCSI passthrough commands\n" + " -ata : Force the use of ATA passthrough commands\n" + " -s : Run zbc_flush after writing (equivalent to\n" + " executing sync())\n" + " -dio : Use direct I/Os\n" + " -vio <num> : Use vectored I/Os with <num> buffers of\n" + " <I/O size> bytes, resulting in an actual I/O\n" + " size of <num> x <I/O size> bytes.\n" + " -p <num> : Set the byte pattern to write. If this option\n" + " is omitted, zeroes are written.\n" + " -nio <num> : Limit the number of I/O executed to <num>\n" + " -f <file> : Write the content of <file>\n" + " -loop : If a file is specified, repeatedly write the\n" + " file content to the zone until the zone is full\n" + " -ofst <ofst> : Write the zone starting form the sector offset\n" + " <ofst> instead of from the zone start sector.\n" + " This option should be used only with\n" + " conventional zones.\n", + basename(prog)); return 1; } @@ -96,20 +99,33 @@ bool flush = false, floop = false, vio = false; unsigned long pattern = 0; int flags = O_WRONLY; + int oflags = 0; struct iovec *iov = NULL; int iovcnt = 1, n; /* Check command line */ if (argc < 4) - return zbc_write_zone_usage(argv[0]); + return zbc_write_zone_usage(stderr, argv[0]); /* Parse options */ for (i = 1; i < (argc - 1); i++) { + if (strcmp(argv[i], "-h") == 0 || + strcmp(argv[i], "--help") == 0) + return zbc_write_zone_usage(stdout, argv[0]); + if (strcmp(argv[i], "-v") == 0) { zbc_set_log_level("debug"); + } else if (strcmp(argv[i], "-scsi") == 0) { + + oflags = ZBC_O_DRV_SCSI; + + } else if (strcmp(argv[i], "-ata") == 0) { + + oflags = ZBC_O_DRV_ATA; + } else if (strcmp(argv[i], "-dio") == 0) { flags |= O_DIRECT; @@ -207,6 +223,12 @@ /* Get parameters */ path = argv[i]; + if (oflags & ZBC_O_DRV_SCSI && oflags & ZBC_O_DRV_ATA) { + fprintf(stderr, + "-scsi and -ata options are mutually exclusive\n"); + return 1; + } + zidx = atoi(argv[i + 1]); if (zidx < 0) { fprintf(stderr, "Invalid zone number %s\n", @@ -226,7 +248,7 @@ signal(SIGTERM, zbc_write_zone_sigcatcher); /* Open device */ - ret = zbc_open(path, flags, &dev); + ret = zbc_open(path, oflags | flags, &dev); if (ret != 0) { if (ret == -ENODEV) fprintf(stderr, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzbc-5.12.0/tools/zone_op/zbc_zone_op.c new/libzbc-5.13.0/tools/zone_op/zbc_zone_op.c --- old/libzbc-5.12.0/tools/zone_op/zbc_zone_op.c 2021-08-17 08:43:26.000000000 +0200 +++ new/libzbc-5.13.0/tools/zone_op/zbc_zone_op.c 2022-11-02 00:21:21.000000000 +0100 @@ -33,22 +33,25 @@ } } -static int zbc_zone_op_usage(char *bin_name) +static int zbc_zone_op_usage(FILE *out, char *bin_name) { - printf("Usage: %s [options] <dev> [<zone>]\n" - " By default <zone> is interpreted as a zone number.\n" - " If the -lba option is used, <zone> is interpreted\n" - " as the start LBA of the target zone. If the\n" - " -sector option is used, <zone> is interpreted as\n" - " the start 512B sector of the target zone. If the\n" - " -all option is used, <zone> is ignored\n" - "Options:\n" - " -h | --help : Display this help message and exit\n" - " -v : Verbose mode\n" - " -sector : Interpret <zone> as a zone start sector\n" - " -lba : Interpret <zone> as a zone start LBA\n" - " -all : Operate on all sequential zones\n", - basename(bin_name)); + fprintf(out, + "Usage: %s [options] <dev> [<zone>]\n" + " By default <zone> is interpreted as a zone number.\n" + " If the -lba option is used, <zone> is interpreted\n" + " as the start LBA of the target zone. If the\n" + " -sector option is used, <zone> is interpreted as\n" + " the start 512B sector of the target zone. If the\n" + " -all option is used, <zone> is ignored\n" + "Options:\n" + " -h | --help : Display this help message and exit\n" + " -v : Verbose mode\n" + " -scsi : Force the use of SCSI passthrough commands\n" + " -ata : Force the use of ATA passthrough commands\n" + " -sector : Interpret <zone> as a zone start sector\n" + " -lba : Interpret <zone> as a zone start LBA\n" + " -all : Operate on all sequential zones\n", + basename(bin_name)); return 1; } @@ -62,7 +65,7 @@ long long start = 0; unsigned long long start_sector = 0, zone_start; unsigned int flags = 0; - int i, ret = 1; + int i, ret = 1, oflags = 0;; unsigned int nr_zones, tgt_idx; bool sector_unit = false; bool lba_unit = false; @@ -70,18 +73,26 @@ /* Check command line */ if (!argc) - return zbc_zone_op_usage(bin_name); + return zbc_zone_op_usage(stderr, bin_name); /* Parse options */ for (i = 0; i < argc; i++) { if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) - return zbc_zone_op_usage(bin_name); + return zbc_zone_op_usage(stdout, bin_name); if (strcmp(argv[i], "-v") == 0) { zbc_set_log_level("debug"); + } else if (strcmp(argv[i], "-scsi") == 0) { + + oflags = ZBC_O_DRV_SCSI; + + } else if (strcmp(argv[i], "-ata") == 0) { + + oflags = ZBC_O_DRV_ATA; + } else if (strcmp(argv[i], "-sector") == 0) { sector_unit = true; @@ -96,8 +107,8 @@ } else if ( argv[i][0] == '-' ) { - printf("Unknown option \"%s\"\n", - argv[i]); + fprintf(stderr, "Unknown option \"%s\"\n", + argv[i]); return 1; } else { @@ -112,6 +123,12 @@ return 1; } + if (oflags & ZBC_O_DRV_SCSI && oflags & ZBC_O_DRV_ATA) { + fprintf(stderr, + "-scsi and -ata options are mutually exclusive\n"); + return 1; + } + if (lba_unit && sector_unit) { fprintf(stderr, "-lba and -sector cannot be used together\n"); return 1; @@ -119,7 +136,7 @@ /* Open device */ path = argv[i]; - ret = zbc_open(path, O_RDWR, &dev); + ret = zbc_open(path, oflags | O_RDWR, &dev); if (ret != 0) { if (ret == -ENODEV) fprintf(stderr, @@ -222,7 +239,7 @@ } break; default: - printf("Unknown operation\n"); + fprintf(stderr, "Unknown operation\n"); ret = 1; }