diff --git a/SOURCES/s390-tools-rhel.patch b/SOURCES/s390-tools-rhel.patch index 50d6733..cb9b262 100644 --- a/SOURCES/s390-tools-rhel.patch +++ b/SOURCES/s390-tools-rhel.patch @@ -1,7 +1,7 @@ From ab2402c95f031ad97544a86e4418cb765313eee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Fri, 31 Aug 2018 10:07:35 +0200 -Subject: [PATCH 01/61] drop LOADLIBES variable +Subject: [PATCH 01/65] drop LOADLIBES variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -134,7 +134,7 @@ index 778401b..61c2399 100644 From ed7cf76fd149a9fed3ce9f728e072bccc44997cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Fri, 31 Aug 2018 10:13:38 +0200 -Subject: [PATCH 02/61] zkey: Drop redundant include +Subject: [PATCH 02/65] zkey: Drop redundant include MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -163,7 +163,7 @@ index 68f35cf..725cb3b 100644 From 3a354d9d8e83a36edb9ce68fb85b3cc4afd19991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Fri, 31 Aug 2018 10:17:07 +0200 -Subject: [PATCH 03/61] zkey: Be consistent when refering to libutil.a +Subject: [PATCH 03/65] zkey: Be consistent when refering to libutil.a MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -206,7 +206,7 @@ index 725cb3b..7e2047a 100644 From 913721b06be3b4662593c3f1a344256c46ce841a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Fri, 31 Aug 2018 04:29:39 -0400 -Subject: [PATCH 04/61] zkey: Be explicit about linking the tools +Subject: [PATCH 04/65] zkey: Be explicit about linking the tools MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -243,7 +243,7 @@ index 7e2047a..901ddd4 100644 From 6a3da6ec34a0947bd14cd0a36ab08b607236a414 Mon Sep 17 00:00:00 2001 From: Ingo Franzki Date: Wed, 17 Oct 2018 13:52:48 +0200 -Subject: [PATCH 05/61] zkey: Makefile: Avoid relink of modules during 'make +Subject: [PATCH 05/65] zkey: Makefile: Avoid relink of modules during 'make install' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -301,7 +301,7 @@ index 901ddd4..bc7bc33 100644 From e7b59a9f7cc5d049ef68331855a881beb85a1347 Mon Sep 17 00:00:00 2001 From: Ingo Franzki Date: Thu, 25 Oct 2018 12:57:29 +0200 -Subject: [PATCH 06/61] zkey: Makefile: Don't rebuild .o.d files on 'make +Subject: [PATCH 06/65] zkey: Makefile: Don't rebuild .o.d files on 'make install' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -372,7 +372,7 @@ index bc7bc33..a44b14b 100644 From dc92c4ce7963dcf5018c3ef3672b6d217f29842f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Mon, 19 Nov 2018 11:26:40 +0100 -Subject: [PATCH 07/61] zpcictl: Add tool to manage PCI devices (#1525409) +Subject: [PATCH 07/65] zpcictl: Add tool to manage PCI devices (#1525409) Summary: zpcictl: Add tool to manage PCI devices Description: Use the zpcictl tool to manage PCI devices on the IBM Z @@ -982,7 +982,7 @@ index 0000000..5187e7c From c17b203ee85a63c812654e937f0c5cb3da6229e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Mon, 19 Nov 2018 11:35:09 +0100 -Subject: [PATCH 08/61] zpcictl: Read device link to obtain device address +Subject: [PATCH 08/65] zpcictl: Read device link to obtain device address (#1639220) Description: zpcictl: Read device link to obtain device address @@ -1189,7 +1189,7 @@ index 5f63b17..a9e38fb 100644 From 8d8e0a970dbde0ca4486192aed806d837f080370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Mon, 19 Nov 2018 11:36:36 +0100 -Subject: [PATCH 09/61] zpcictl: Change wording of man-page and help output +Subject: [PATCH 09/65] zpcictl: Change wording of man-page and help output (#1643451) Description: zpcictl: Change wording of man-page and help output @@ -1333,7 +1333,7 @@ index a9e38fb..7cfa0d3 100644 From 916022e17d4cb189c0d83028ed09d3f4600046dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Mon, 19 Nov 2018 11:37:34 +0100 -Subject: [PATCH 10/61] zdev: qeth BridgePort and VNICC attribute conflict +Subject: [PATCH 10/65] zdev: qeth BridgePort and VNICC attribute conflict (#1643452) Description: zdev: qeth BridgePort and VNICC attribute conflict @@ -1408,7 +1408,7 @@ index 46bc23d..6191ad1 100644 From e2916bdb493e9565d74b0334fa45f17c6f0f730c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Mon, 19 Nov 2018 11:38:30 +0100 -Subject: [PATCH 11/61] qethqoat: add OSA-Express7S support (#1644384) +Subject: [PATCH 11/65] qethqoat: add OSA-Express7S support (#1644384) Description: qethqoat: add OSA-Express7S support Symptom: qethqoat fails to report HW generation and link speed for @@ -1474,7 +1474,7 @@ index dd7e992..e692937 100644 From ba7eb5cd9d858f2ff8bd29e0b610337896587b94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Mon, 19 Nov 2018 11:39:35 +0100 -Subject: [PATCH 12/61] zcryptctl: add zcryptctl to manage multiple zcrypt +Subject: [PATCH 12/65] zcryptctl: add zcryptctl to manage multiple zcrypt nodes (#1646354) Summary: zcryptctl: add zcryptctl to manage multiple zcrypt nodes @@ -2719,7 +2719,7 @@ index 0000000..8326a08 From d5aab30ab6dd79a47d821b39e9f803d4afe8ed7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Mon, 19 Nov 2018 11:40:35 +0100 -Subject: [PATCH 13/61] lszcrypt: support for alternate zcrypt device drivers +Subject: [PATCH 13/65] lszcrypt: support for alternate zcrypt device drivers (#1646355) Summary: lszcrypt: support for alternate zcrypt device drivers @@ -3072,7 +3072,7 @@ index eb3cd6e..580407f 100644 From 47e15616b0c81f85918794a0af2073aac6455826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Tue, 11 Dec 2018 09:46:40 +0100 -Subject: [PATCH 14/61] zkey: Fails to run commands generated by 'zkey +Subject: [PATCH 14/65] zkey: Fails to run commands generated by 'zkey cryptsetup' (#1650628) Description: zkey: Fails to run commands generated by 'zkey cryptsetup' @@ -3108,7 +3108,7 @@ index 11f555c..a4ad634 100644 From 3328fadb3147a24bae10495259fa7fd00b973eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Tue, 11 Dec 2018 10:14:05 +0100 -Subject: [PATCH 15/61] zkey: Enhance error message about missing CCA library +Subject: [PATCH 15/65] zkey: Enhance error message about missing CCA library (#1655134) Description: zkey: Enhance error message about missing CCA library. @@ -3202,7 +3202,7 @@ index c9f7906..0837b27 100644 From ba7d612c055c887d5cbb596a369d32f00c47711d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Tue, 29 Jan 2019 13:06:21 +0100 -Subject: [PATCH 16/61] zfcpdump: add install script for zfcpdump kernel +Subject: [PATCH 16/65] zfcpdump: add install script for zfcpdump kernel (#1600480) Summary: zfcpdump: add install script for zfcpdump kernel @@ -3502,7 +3502,7 @@ index e6d2981..22d2549 100644 From eef1d70b8bd0ec96aa90f5dad9795196c85382ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Wed, 9 Jan 2019 13:58:10 +0100 -Subject: [PATCH 17/61] pkey: Support autoloading kernel pkey module (#1664632) +Subject: [PATCH 17/65] pkey: Support autoloading kernel pkey module (#1664632) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -3537,7 +3537,7 @@ index 0000000..972a099 From 7a3ba6fb39f015da0ee10e1dc0e14ae9fcf6347f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Tue, 21 May 2019 13:39:08 +0200 -Subject: [PATCH 18/61] zipl: Secure Boot support for SCSI IPL (#1659401) +Subject: [PATCH 18/65] zipl: Secure Boot support for SCSI IPL (#1659401) Description: The Secure Boot firmware feature ensures that only signed and verified code is executed during IPL. @@ -5335,7 +5335,7 @@ index fe72e9a..e57361e 100644 From 100c89a273fb4bcc1deb93aaf77ac9264d9ac3ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Thu, 2 May 2019 15:46:39 +0200 -Subject: [PATCH 19/61] zipl: update stage3 objcopy command for gcc9 (#1659401) +Subject: [PATCH 19/65] zipl: update stage3 objcopy command for gcc9 (#1659401) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -5367,7 +5367,7 @@ index da7e95f..a049797 100644 From 78f0479055e025ba849766aa2d60c22a7bcdbfba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Tue, 21 May 2019 13:49:09 +0200 -Subject: [PATCH 20/61] s390-tools: Add zcryptstats tool (#1658756) +Subject: [PATCH 20/65] s390-tools: Add zcryptstats tool (#1658756) Description: The zcryptstats tool displays usage statistics of IBM Crypto Express adapters. It obtains cryptographic @@ -8364,7 +8364,7 @@ index 0000000..136d5ba From c0670b62ccd7a9f1f1b3a8a49114c2e3c673ecd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B6ppner?= Date: Mon, 1 Apr 2019 09:53:06 +0200 -Subject: [PATCH 21/61] zpcictl: Check for regular directory (#1695001) +Subject: [PATCH 21/65] zpcictl: Check for regular directory (#1695001) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -8408,7 +8408,7 @@ index 7cfa0d3..f2a55ad 100644 From 9f0fe2e3d5bcc079577700d778e3f1a58fced510 Mon Sep 17 00:00:00 2001 From: Thomas Richter Date: Wed, 10 Jul 2019 13:01:09 +0200 -Subject: [PATCH 22/61] cpumf: Add support for CPU-Measurement Facility +Subject: [PATCH 22/65] cpumf: Add support for CPU-Measurement Facility counters SVN 6 (#1683276) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -8534,7 +8534,7 @@ index a8a2846..5729b95 100644 From f58ee5580cd6e357dce488d9cd3d999e7ad61f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Fri, 19 Jul 2019 09:41:08 +0200 -Subject: [PATCH 23/61] ziomon: fix utilization recording with multi-digit scsi +Subject: [PATCH 23/65] ziomon: fix utilization recording with multi-digit scsi hosts (#1731203) Description: ziomon: fix utilization recording with multi-digit scsi hosts @@ -8617,7 +8617,7 @@ index 87c4bc4..26fa269 100755 From ef93298c3f0a8d318c0568f3bec10b76279bb15b Mon Sep 17 00:00:00 2001 From: Peter Oberparleiter Date: Tue, 12 Mar 2019 14:05:17 +0100 -Subject: [PATCH 24/61] zdev: Do not export inacceptable attribute values +Subject: [PATCH 24/65] zdev: Do not export inacceptable attribute values (#1731960) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -8675,7 +8675,7 @@ index f1acb8a..a66db0b 100644 From de7f4178f2178268ed65292bf5e1f42894832d9a Mon Sep 17 00:00:00 2001 From: Stefan Haberland Date: Wed, 17 Jul 2019 17:26:40 +0200 -Subject: [PATCH 25/61] zipl: do not overwrite BOOT_IMAGE entry (#1728677) +Subject: [PATCH 25/65] zipl: do not overwrite BOOT_IMAGE entry (#1728677) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -8771,7 +8771,7 @@ index 91477b1..3a02001 100644 From d25f635ebdb0f2faa8ca018859c3223c3dac4d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B6ppner?= Date: Wed, 31 Jul 2019 15:25:00 +0200 -Subject: [PATCH 26/61] fdasd: Fix exit status in error cases (#1734816) +Subject: [PATCH 26/65] fdasd: Fix exit status in error cases (#1734816) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -8820,7 +8820,7 @@ index 085d2be..5de7955 100644 From 89ed5688c2b351f487e75e3035948aadcab73a8f Mon Sep 17 00:00:00 2001 From: Stefan Haberland Date: Wed, 7 Aug 2019 16:59:20 +0200 -Subject: [PATCH 27/61] zipl: fix zfcp dump image location (#1730707) +Subject: [PATCH 27/65] zipl: fix zfcp dump image location (#1730707) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -8892,7 +8892,7 @@ index 2d8de8f..e68d1b7 100644 From 9e5da1e34622725dd9fb7a681f99552bcdabe414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Thu, 7 Nov 2019 12:23:26 +0100 -Subject: [PATCH 28/61] dasdfmt/lsdasd: Add Thin provisioning base support +Subject: [PATCH 28/65] dasdfmt/lsdasd: Add Thin provisioning base support (#1651733) Summary: dasdfmt/lsdasd: Add Thin provisioning base support @@ -10409,7 +10409,7 @@ index a6c4333..20b53f5 100644 From 836d4b9f0f4387a3e35125be8ee50563501d6ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Thu, 7 Nov 2019 12:29:42 +0100 -Subject: [PATCH 29/61] zdsfs: add online vtoc refresh (#1685536) +Subject: [PATCH 29/65] zdsfs: add online vtoc refresh (#1685536) Description: Enable zdsfs to access datasets that were created after zdsfs was mounted without the need to remount zdsfs. @@ -11071,7 +11071,7 @@ index 462fda7..d7a83ee 100644 From db8ece16f1c2b4e514d39505397bc4d70052617b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Thu, 7 Nov 2019 12:31:54 +0100 -Subject: [PATCH 30/61] zdev: add zfcp dix parameter handling (#1723852) +Subject: [PATCH 30/65] zdev: add zfcp dix parameter handling (#1723852) Description: The zfcp kernel module was changed to introduce separate parameters for selecting DIF and DIF&DIX. This patch @@ -11141,7 +11141,7 @@ index 03aa252..82dac57 100644 From 41bb1d87abfe5f4b856ba885109749d42959a812 Mon Sep 17 00:00:00 2001 From: Philipp Rudo Date: Wed, 21 Aug 2019 12:34:43 +0200 -Subject: [PATCH 31/61] zipl: Fix error message printed with --dumptofs +Subject: [PATCH 31/65] zipl: Fix error message printed with --dumptofs (#1750307) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -11175,7 +11175,7 @@ index e68d1b7..5dcebaf 100644 From 47f3a82078811bd4dfad2726ed3ba38cc0fe2e3f Mon Sep 17 00:00:00 2001 From: Stefan Haberland Date: Wed, 4 Sep 2019 13:01:53 +0200 -Subject: [PATCH 32/61] zipl: set correct secure IPL default value (#1750326) +Subject: [PATCH 32/65] zipl: set correct secure IPL default value (#1750326) Set secure IPL to auto as default value to match documented behavior. @@ -11203,7 +11203,7 @@ index 5dcebaf..1178a7d 100644 From d64cb3431d7cd51a4b4c24ed3e0a2e50a024b50b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Thu, 7 Nov 2019 12:49:06 +0100 -Subject: [PATCH 33/61] zkey: various enhancements (#1725881) +Subject: [PATCH 33/65] zkey: various enhancements (#1725881) Description: Enhancements to zkey in response to first (customer) experiences @@ -13076,7 +13076,7 @@ index 3a8909a..2ecbb90 100644 From 86c3031204f6e52455bba1dfc89d619ce26debe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Thu, 7 Nov 2019 13:16:36 +0100 -Subject: [PATCH 34/61] zkey: check master key consistency (#1753153) +Subject: [PATCH 34/65] zkey: check master key consistency (#1753153) Description: Enhances the zkey tool to perform a cross check whether the APQNs associated with a secure key have the same master key. @@ -16375,7 +16375,7 @@ index 2ecbb90..a0dbc0b 100644 From c5e94c1cf3b03d290752227d21540b8786df8131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Thu, 7 Nov 2019 13:23:55 +0100 -Subject: [PATCH 35/61] zkey: Add support for CCA AES CIPHER keys (#1719623) +Subject: [PATCH 35/65] zkey: Add support for CCA AES CIPHER keys (#1719623) Description: With CCA 5 there is a new secure key type, the so called variable length symmetric cipher key token. This token format @@ -20987,7 +20987,7 @@ index a0dbc0b..3ae9a9b 100644 From a9fe5d1477161d658bcade0f85309eefe9fcb0bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Thu, 7 Nov 2019 13:29:28 +0100 -Subject: [PATCH 36/61] zcrypt: CEX7S exploitation support (#1723837) +Subject: [PATCH 36/65] zcrypt: CEX7S exploitation support (#1723837) Description: CEX7S exploitation support to lszcrypt, chzcrypt and zcryptstats. @@ -21296,7 +21296,7 @@ index 136d5ba..3bb2078 100644 From afcf268f8af2a6e925c44c057cb04c2dc38c9b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Thu, 7 Nov 2019 13:48:23 +0100 -Subject: [PATCH 37/61] lstape, lsluns: handle non-zfcp; lin_tape multiple +Subject: [PATCH 37/65] lstape, lsluns: handle non-zfcp; lin_tape multiple paths (#1766569) Symptom: lstape shows unexpected additional Device suffix numbers in @@ -21743,7 +21743,7 @@ index 544cb08..019b6e5 100644 From 164d283c73cc17b8a5927a449ed59671545f7066 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 1 Oct 2019 15:33:59 +0200 -Subject: [PATCH 38/61] zipl: fix the scanned tokens array size calculation +Subject: [PATCH 38/65] zipl: fix the scanned tokens array size calculation (#1751587) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -21816,7 +21816,7 @@ index e57361e..ee04251 100644 From ba8021cb17f74ea5130d7c5acdc267b6fb0a433c Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Wed, 12 Sep 2018 09:40:22 -0500 -Subject: [PATCH 39/61] zipl: use FIEMAP mapping ioctl if it exists (moved from +Subject: [PATCH 39/65] zipl: use FIEMAP mapping ioctl if it exists (moved from Patch101) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -21938,7 +21938,7 @@ index 0d8e779..43092bf 100644 From 658eef5bc3ea1ec9b917c35a36dcbe1219bd0b08 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 6 Nov 2018 13:29:32 +0100 -Subject: [PATCH 40/61] zipl: use the BLS "title" field as the IPL section name +Subject: [PATCH 40/65] zipl: use the BLS "title" field as the IPL section name (moved from Patch103) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -21999,7 +21999,7 @@ index ee04251..b8fea13 100644 From 2515287113812346ef8a3bb00a80632b698ab542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Thu, 7 Nov 2019 14:37:36 +0100 -Subject: [PATCH 41/61] zipl: config file handling improvements for CoreOS +Subject: [PATCH 41/65] zipl: config file handling improvements for CoreOS (#1764706) Use TOOLS_SYSCONFDIR for the default zipl.conf path - c01bcfa73a6d795f33df639ba36304a704d13561 @@ -22281,7 +22281,7 @@ index b8fea13..f4228d3 100644 From 1ca71226d392c59855432ee992e263be680644d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Mon, 27 Jan 2020 11:22:42 +0100 -Subject: [PATCH 42/61] zkey: Fix display of clear key size for XTS keys +Subject: [PATCH 42/65] zkey: Fix display of clear key size for XTS keys (#1794375) Description: zkey: Fix display of clear key size for XTS keys @@ -22338,7 +22338,7 @@ index 462f9fe..640ff86 100644 From 2beeedb4f5eca1cf2faf34d1a0db176ea887854f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Mon, 27 Jan 2020 11:39:24 +0100 -Subject: [PATCH 43/61] zkey: Fix listing of keys on file systems reporting +Subject: [PATCH 43/65] zkey: Fix listing of keys on file systems reporting DT_UNKNOWN (#1792957) Description: zkey: Fix listing of keys on file systems reporting DT_UNKNOWN. @@ -22387,7 +22387,7 @@ index af67721..e6be3a4 100644 From 931db1dba8822a14ad15c52ae95e0d8a219dd94b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Wed, 27 May 2020 10:29:10 +0200 -Subject: [PATCH 44/61] zipl/libc: Fix potential buffer overflow in printf +Subject: [PATCH 44/65] zipl/libc: Fix potential buffer overflow in printf (#1807973) Description: zipl/libc: Fix potential buffer overflow in printf @@ -22897,7 +22897,7 @@ index 1da3ce1..800b943 100644 From c3fe7d1b44512bb0e645b54476cafc4a27141022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B6ppner?= Date: Wed, 20 Nov 2019 22:03:54 +0100 -Subject: [PATCH 45/61] dasdview: Fix exit status in error cases (#1783288) +Subject: [PATCH 45/65] dasdview: Fix exit status in error cases (#1783288) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -23252,7 +23252,7 @@ index 3dc5890..1f837e9 100644 From 54b3e8b2d925fcd9083fc020b75c98b83c299f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Wed, 27 May 2020 10:37:10 +0200 -Subject: [PATCH 46/61] zkey: Fix display of XTS attribute for validate command +Subject: [PATCH 46/65] zkey: Fix display of XTS attribute for validate command (#1808494) Description: zkey: Fix display of XTS attribute for validate command @@ -23312,7 +23312,7 @@ index e6be3a4..4f90bdd 100644 From c1d79840cd820a58ad629bb18dd9b1643c1ca5a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Wed, 27 May 2020 10:38:25 +0200 -Subject: [PATCH 47/61] zkey: Fix display of clear key size for CCA-AESCIPHER +Subject: [PATCH 47/65] zkey: Fix display of clear key size for CCA-AESCIPHER keys (#1808492) Description: zkey: Fix display of clear key size for CCA-AESCIPHER keys @@ -23361,7 +23361,7 @@ index 640ff86..793ed9e 100644 From 8575d2798cfa9087fcdabe944e38c0ad2ac69e9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Wed, 27 May 2020 10:40:41 +0200 -Subject: [PATCH 48/61] zipl: fix secure boot config handling (#1814322) +Subject: [PATCH 48/65] zipl: fix secure boot config handling (#1814322) Description: zipl: fix secure boot config handling Symptom: The config file parsing for secure boot worked not as @@ -23706,7 +23706,7 @@ index 65eefdb..2c53489 100644 From 9c07b5194f80b57c6d3e74d868b52a96f831653a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Wed, 27 May 2020 10:42:25 +0200 -Subject: [PATCH 49/61] zpcictl: Initiate recover after reset (#1814303) +Subject: [PATCH 49/65] zpcictl: Initiate recover after reset (#1814303) Description: zpcictl: Initiate recover after reset Symptom: If a PCI function is reset using zpcictl --reset, the function @@ -23840,7 +23840,7 @@ index f2a55ad..7cbfad9 100644 From d9db8c5d6adfc0ee8665a6c51bce8b347fbfc212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Wed, 27 May 2020 10:47:35 +0200 -Subject: [PATCH 50/61] dbginfo.sh: Extend data collection (#1814323) +Subject: [PATCH 50/65] dbginfo.sh: Extend data collection (#1814323) Description: dbginfo.sh: Extend data collection Symptom: This update covers various symptoms on dbginfo.sh data @@ -24223,7 +24223,7 @@ index 4771192..ef9fe89 100644 From 40d2a0d3d48b798ff325b70c02f799ac3829160b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Wed, 27 May 2020 10:50:10 +0200 -Subject: [PATCH 51/61] lscpumf: New z15 CPU-MF counters not available +Subject: [PATCH 51/65] lscpumf: New z15 CPU-MF counters not available (#1821591) Description: lscpumf: New z15 CPU-MF counters not available @@ -24660,7 +24660,7 @@ index 5729b95..fec8048 100644 From 4dae25adb621f717938de97aefeb5cae61aec90b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Wed, 27 May 2020 11:24:08 +0200 -Subject: [PATCH 52/61] ipl_tools: support clear attribute for FCP and CCW +Subject: [PATCH 52/65] ipl_tools: support clear attribute for FCP and CCW re-IPL (#1812983) This patch adds support for the "clear" sysfs attribute for re-IPL, if @@ -24853,7 +24853,7 @@ index 9adb93a..91ddfad 100644 From cf5bfa1758a83d0bc29763214d1f194a259bc12a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Thu, 28 May 2020 09:51:52 +0200 -Subject: [PATCH 53/61] zipl: Rebase to 2.13.0 (#1821250) +Subject: [PATCH 53/65] zipl: Rebase to 2.13.0 (#1821250) Summary: zipl: Rebase to 2.13.0 Description: In order to prepare for the inclusion of the new genprotimg @@ -35720,7 +35720,7 @@ index f4228d3..38fa545 100644 From efd2e0495726f8890fbff31053081472f948aeca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Thu, 28 May 2020 09:54:34 +0200 -Subject: [PATCH 54/61] ipl-tools: Add nvme device support to zipl, +Subject: [PATCH 54/65] ipl-tools: Add nvme device support to zipl, lsreipl/chreipl (#1525178) Summary: ipl-tools: Add nvme device support to zipl, lsreipl/chreipl @@ -36581,7 +36581,7 @@ index 8abf668..5baeaeb 100644 From de78dc56b9fa81f78151f419396026f7c7214ac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Thu, 28 May 2020 10:00:16 +0200 -Subject: [PATCH 55/61] zkey: Add support for EP11 secure keys (#1723845) +Subject: [PATCH 55/65] zkey: Add support for EP11 secure keys (#1723845) Summary: zkey: Add support for EP11 secure keys Description: With z15 and the CEX7 there is new crypto infrastructure @@ -40935,7 +40935,7 @@ index 3ae9a9b..e6356c0 100644 From 03becee6f57d9ec59a593efe388de81fb5b72643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Thu, 28 May 2020 12:13:27 +0200 -Subject: [PATCH 56/61] zdev: report FC Endpoint Security of zfcp device +Subject: [PATCH 56/65] zdev: report FC Endpoint Security of zfcp device (#1723843) Summary: zdev: report FC Endpoint Security of zfcp devices @@ -41276,7 +41276,7 @@ index f16cbfd..6fb5637 100644 From 7a4e27a9c5c705cf12b4e4f94177941dbad9cc30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Wed, 17 Jun 2020 13:40:47 +0200 -Subject: [PATCH 57/61] zipl rebase: remove redundant files (#1849960) +Subject: [PATCH 57/65] zipl rebase: remove redundant files (#1849960) related #1821250 --- @@ -41797,7 +41797,7 @@ index a9f17fb..0000000 From 9980cc46d4ed02f8b1490224decdf98929fa209c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Fri, 24 Jul 2020 10:03:19 +0200 -Subject: [PATCH 58/61] zipl: Fix KVM IPL without bootindex (#1858842, +Subject: [PATCH 58/65] zipl: Fix KVM IPL without bootindex (#1858842, #1846960) Description: zipl: Fix KVM IPL without bootindex @@ -41923,7 +41923,7 @@ index bb490dc..254872d 100644 From 68744d76fabfe99e06760330ec43e2a2a03290da Mon Sep 17 00:00:00 2001 From: Thomas Richter Date: Thu, 4 Jun 2020 09:00:35 +0200 -Subject: [PATCH 59/61] vmcp: Change sequence of failed exit (#1858839) +Subject: [PATCH 59/65] vmcp: Change sequence of failed exit (#1858839) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -41976,7 +41976,7 @@ index e1a65cb..10b2361 100644 From 64999333d1ad2b85d1277aa732e4db3139af7291 Mon Sep 17 00:00:00 2001 From: Juergen Christ Date: Tue, 19 May 2020 11:05:25 +0200 -Subject: [PATCH 60/61] cpacfstats: Add ECC counters to cpacfstats (related +Subject: [PATCH 60/65] cpacfstats: Add ECC counters to cpacfstats (related #1861779) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -42403,7 +42403,7 @@ index 3fef119..77b0b76 100644 From 8fef250c83c16541c7a8fd3e37a35d5dea92cb78 Mon Sep 17 00:00:00 2001 From: Juergen Christ Date: Fri, 24 Jul 2020 17:57:45 +0200 -Subject: [PATCH 61/61] cpacfstats: Bugfix to remove libpfm from cpacfstats +Subject: [PATCH 61/65] cpacfstats: Bugfix to remove libpfm from cpacfstats (#1861779) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -42651,3 +42651,1956 @@ index 77b0b76..a1e2ddc 100644 -- 2.26.2 + +From 836b76edc986e9732eaec4d903933eb6d330a0f6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Dan=20Hor=C3=A1k?= +Date: Tue, 26 Jan 2021 11:50:47 +0100 +Subject: [PATCH 62/65] libdasd: Fix dasd_get_host_access_count() (#1905085) + +Description: libdasd: Fix dasd_get_host_access_count() +Symptom: fdasd and dasdfmt don't report host access count anymore. +Problem: The library function dasd_get_host_access_count() checks for + unsuccessful execution of util_sys_get_dev_addr() incorrectly. +Solution: Turn the check around. +Reproduction: Attach the same DASD on two different LPARs and run dasdfmt on + one of the LPARs on that DASD. +Upstream-ID: 353403824b5112c254f6788bad5edbbb19b96683 +--- + libdasd/dasd_sys.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libdasd/dasd_sys.c b/libdasd/dasd_sys.c +index 94c2d12..a308226 100644 +--- a/libdasd/dasd_sys.c ++++ b/libdasd/dasd_sys.c +@@ -214,7 +214,7 @@ int dasd_get_host_access_count(char *device) + char *path; + long value; + +- if (!util_sys_get_dev_addr(device, busid)) ++ if (util_sys_get_dev_addr(device, busid) != 0) + return 0; + + path = util_path_sysfs("bus/ccw/devices/%s/host_access_count", busid); +-- +2.26.2 + + +From e5f7e02c0348d1f4dcf637624f4d7d0909425622 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Dan=20Hor=C3=A1k?= +Date: Tue, 26 Jan 2021 11:52:14 +0100 +Subject: [PATCH 63/65] zcryptstats: Fix handling of partial results with many + domains (#1912479) + +Description: zcryptstats: Fix handling of partial results with many domains +Symptom: Running zcryptstats when many domains are available per cryto + card does not produce any output, and is hanging in a loop. +Problem: When many domains per card are available, then the results of + the SCDMD CHSC call may not fit into the output area, and a + partial result is returned. The further results must be + retrieved with another CHSC call. Fix the code to pass the + correct next-domain to the subsequent CHSC call of a partial + response. Otherwise the same set of domains 1 to n are retrieved + again, resulting in an infinite loop, because this will always + produce a partial result. +Solution: Fix the code to pass the correct next-domain to the subsequent + CHSC call of a partial response. +Reproduction: Run zcryptstats on a system with many domains per card. +Upstream-ID: cf2311f1f1de17435b49ba8c8697be91705ba031 +--- + zconf/zcrypt/zcryptstats.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/zconf/zcrypt/zcryptstats.c b/zconf/zcrypt/zcryptstats.c +index 3bb2078..2456e5d 100644 +--- a/zconf/zcrypt/zcryptstats.c ++++ b/zconf/zcrypt/zcryptstats.c +@@ -1178,8 +1178,14 @@ static int get_apqn_measurement_data(uint8_t card) + scdmd_area.request.header.code = 0x102d; + scdmd_area.request.header.length = + sizeof(struct chsc_scdmd_request); +- scdmd_area.request.first_drid.ap_index = card; +- scdmd_area.request.first_drid.domain_index = g.min_domain; ++ if (scdmd_area.response.p) { ++ scdmd_area.request.first_drid = ++ scdmd_area.response.crid; ++ } else { ++ scdmd_area.request.first_drid.ap_index = card; ++ scdmd_area.request.first_drid.domain_index = ++ g.min_domain; ++ } + scdmd_area.request.last_drid.ap_index = card; + scdmd_area.request.last_drid.domain_index = g.max_domain; + scdmd_area.request.s = 1; +@@ -1217,10 +1223,6 @@ static int get_apqn_measurement_data(uint8_t card) + rc = process_apqn_measurement_data(&scdmd_area); + if (rc != 0) + break; +- +- if (scdmd_area.response.p) +- scdmd_area.request.first_drid = +- scdmd_area.response.crid; + } while (scdmd_area.response.p); + + return rc; +-- +2.26.2 + + +From 9e134c9107a9dc7c6e6f23170a6db08d31986174 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Dan=20Hor=C3=A1k?= +Date: Tue, 26 Jan 2021 11:54:38 +0100 +Subject: [PATCH 64/65] dasdfmt: Fix bad file descriptor error when running on + symlinks (#1917853) + +Description: dasdfmt: Fix bad file descriptor error when running on symlinks +Symptom: When calling dasdfmt on device node symlinks like + /dev/disk/by-id/ccw-0X9300, dasdfmt fails with "dasdfmt: the + ioctl to get the blocksize of the device failed (Bad file + descriptor)" +Problem: This is because before the actual formatting process starts, the + disk will be disabled calling the BIODASDDISABLE ioctl, + resulting in the removal of the symlink. Trying to open this + file later in the process to retrieve e.g. blocksize information + results in the mentioned error, as the file doesn't exist any + longer. +Solution: In order to fix this without modifying the behaviour of libdasd, + introduce the two global variables dev_node and dev_path. + dev_path is the original device path entered by the user. + dev_node on the other hand is the reliable device node under + /dev/block/ using the major and minor numbers and is determined + in get_device_name(). The dev_path is used for message output + only and the dev_node variable is used for the actual disk + operations. +Reproduction: Simply call dasdfmt on a device node symlink in /dev/disk/ such + as /dev/disk/by-id/ccw-0X9300 for example. +Upstream-ID: 07ab32fa8bd863c321d617909c13e674f23bf421 +Upstream-ID: 65e18bff675b48ea200e1ed5bcb7cbb9e6575b52 +Upstream-ID: 09be935c541e359817bc5177d178e2a388f65a63 +Upstream-ID: cb76e39cef7637bd53c4acd3182eae00fbc0d777 +Upstream-ID: 732b3dddab8402bed1e10c41d3b839a7be7edc7a +Upstream-ID: 9fe491df276a28ac68a6d9fab9bd8bae861708f6 +Upstream-ID: da4fdeeb82ce22b166f4d39ca0f566ee55dcf08e +Upstream-ID: 148d3f9b64da599adf453baf65e7a8596e2e7d97 +Upstream-ID: cad450fdf9a9dd2562eec27157e4fd133a98813e +--- + dasdfmt/dasdfmt.c | 754 ++++++++++++++++++++++------------------------ + dasdfmt/dasdfmt.h | 72 ++--- + 2 files changed, 387 insertions(+), 439 deletions(-) + +diff --git a/dasdfmt/dasdfmt.c b/dasdfmt/dasdfmt.c +index c78080c..5665f64 100644 +--- a/dasdfmt/dasdfmt.c ++++ b/dasdfmt/dasdfmt.c +@@ -9,12 +9,14 @@ + */ + + #include ++#include + #include + #include + #include + + #include "lib/dasd_base.h" + #include "lib/dasd_sys.h" ++#include "lib/util_libc.h" + #include "lib/util_opt.h" + #include "lib/util_prg.h" + #include "lib/util_proc.h" +@@ -28,7 +30,6 @@ + #define SEC_PER_HOUR (60 * 60) + + static int filedes; +-static char dev_filename[PATH_MAX]; + static int disk_disabled; + static format_data_t format_params; + static format_mode_t mode; +@@ -50,6 +51,36 @@ static const struct util_prg prg = { + } + }; + ++/* ++ * Global variables for program options and other relevant information ++ */ ++static struct dasdfmt_globals { ++ dasd_information2_t dasd_info; ++ char *dev_path; /* device path entered by user */ ++ char *dev_node; /* reliable device node determined by dasdfmt */ ++ int verbosity; ++ int testmode; ++ int withoutprompt; ++ int print_progressbar; ++ int print_hashmarks, hashstep; ++ int print_percentage; ++ int force; ++ int writenolabel; ++ int labelspec; ++ int cdl_format; ++ int blksize_specified; ++ int reqsize_specified; ++ int keep_volser; ++ int force_host; ++ int layout_specified; ++ int check; ++ int mode_specified; ++ int ese; ++ int no_discard; ++} g = { ++ .dasd_info = { 0 }, ++}; ++ + /* Defines for options with no short command */ + #define OPT_CHECK 128 + #define OPT_NOZERO 129 +@@ -156,6 +187,23 @@ static struct util_opt opt_vec[] = { + UTIL_OPT_END + }; + ++/* Report error, free memory, and exit */ ++static void error(const char *format, ...) ++{ ++ va_list args; ++ ++ fprintf(stderr, "%s: ", prog_name); ++ va_start(args, format); ++ vfprintf(stderr, format, args); ++ va_end(args); ++ fprintf(stderr, "\n"); ++ ++ free(g.dev_node); ++ free(g.dev_path); ++ ++ exit(EXIT_FAILURE); ++} ++ + /* + * Helper function to calculate the days, hours, minutes, and seconds + * for a given timestamp in seconds +@@ -228,8 +276,7 @@ static void print_eta(int p_new, int started) + * Draw the progress indicator depending on what command line argument is set. + * This can either be a progressbar, hashmarks, or percentage. + */ +-static void draw_progress(dasdfmt_info_t *info, int cyl, unsigned int cylinders, +- int aborted) ++static void draw_progress(int cyl, unsigned int cylinders, int aborted) + { + static int hashcount; + static int started; +@@ -238,7 +285,7 @@ static void draw_progress(dasdfmt_info_t *info, int cyl, unsigned int cylinders, + int barlength; + int i; + +- if (info->print_progressbar) { ++ if (g.print_progressbar) { + printf("cyl %7d of %7d |", cyl, cylinders); + p_new = cyl * 100 / cylinders; + if (p_new != p_old || !started || aborted) { +@@ -259,14 +306,13 @@ static void draw_progress(dasdfmt_info_t *info, int cyl, unsigned int cylinders, + fflush(stdout); + } + +- if (info->print_hashmarks && +- (cyl / info->hashstep - hashcount) != 0) { ++ if (g.print_hashmarks && (cyl / g.hashstep - hashcount) != 0) { + printf("#"); + fflush(stdout); + hashcount++; + } + +- if (info->print_percentage) { ++ if (g.print_percentage) { + printf("cyl %7d of %7d |%3d%%\n", cyl, cylinders, + cyl * 100 / cylinders); + fflush(stdout); +@@ -322,8 +368,7 @@ static unsigned int recs_per_track(struct dasd_eckd_characteristics *rdc, + * Evaluate errors recognized by format checks and print appropriate error + * messages depending on the content of cdata. + */ +-static void evaluate_format_error(dasdfmt_info_t *info, format_check_t *cdata, +- unsigned int heads) ++static void evaluate_format_error(format_check_t *cdata, unsigned int heads) + { + struct dasd_eckd_characteristics *rdc; + /* Special blocksize values of the first 3 records of trk 0 of cyl 0 */ +@@ -336,7 +381,7 @@ static void evaluate_format_error(dasdfmt_info_t *info, format_check_t *cdata, + unsigned int kl = 0; + int blksize = cdata->expect.blksize; + +- if (info->print_progressbar || info->print_hashmarks) ++ if (g.print_progressbar || g.print_hashmarks) + printf("\n"); + + /* +@@ -345,7 +390,7 @@ static void evaluate_format_error(dasdfmt_info_t *info, format_check_t *cdata, + * Also, reading record zero will never happen. If the record in error + * is 0 nonetheless, the device is not formatted at all as well! + */ +- if ((info->dasd_info.format == DASD_FORMAT_NONE && mode != QUICK) || ++ if ((g.dasd_info.format == DASD_FORMAT_NONE && mode != QUICK) || + cdata->rec == 0) { + ERRMSG("WARNING: The specified device is not " + "formatted at all.\n"); +@@ -373,7 +418,7 @@ static void evaluate_format_error(dasdfmt_info_t *info, format_check_t *cdata, + } + + rdc = (struct dasd_eckd_characteristics *) +- &info->dasd_info.characteristics; ++ &g.dasd_info.characteristics; + + rpt = recs_per_track(rdc, kl, cdata->expect.blksize); + +@@ -412,9 +457,7 @@ static void disk_enable(void) + + err = dasd_disk_enable(filedes); + if (err != 0) +- ERRMSG_EXIT(EXIT_FAILURE, "%s: (prepare device) IOCTL " +- "BIODASDENABLE failed (%s)\n", prog_name, +- strerror(err)); ++ error("(prepare device) IOCTL BIODASDENABLE failed: %s", strerror(err)); + disk_disabled = 0; + } + +@@ -424,9 +467,7 @@ static void disk_disable(const char *device) + + err = dasd_disk_disable(device, &filedes); + if (err != 0) +- ERRMSG_EXIT(EXIT_FAILURE, "%s: (prepare device) IOCTL " +- "BIODASDDISABLE failed. (%s)\n", prog_name, +- strerror(err)); ++ error("(prepare device) IOCTL BIODASDDISABLE failed: %s", strerror(err)); + disk_disabled = 1; + } + +@@ -448,7 +489,7 @@ static void program_interrupt_signal(int sig) + } + + printf("Rereading the partition table...\n"); +- rc = dasd_reread_partition_table(dev_filename, 5); ++ rc = dasd_reread_partition_table(g.dev_node, 5); + if (rc) { + ERRMSG("%s: (signal handler) Re-reading partition table " + "failed. (%s)\n", prog_name, strerror(rc)); +@@ -461,76 +502,70 @@ static void program_interrupt_signal(int sig) + } + + /* +- * check given device name for blanks and some special characters ++ * Check given device name for blanks and some special characters. ++ * Retrieve reliable device node and store device information in global ++ * dev_node and dev_path accordingly. + */ +-static void get_device_name(char *devname, +- int optind, int argc, char *argv[]) ++static void get_device_name(int optind, int argc, char *argv[]) + { + struct util_proc_dev_entry dev_entry; ++ unsigned int maj, min; + struct stat dev_stat; + + if (optind + 1 < argc) +- ERRMSG_EXIT(EXIT_MISUSE, +- "%s: More than one device specified!\n", prog_name); ++ error("More than one device specified!"); + + if (optind >= argc) +- ERRMSG_EXIT(EXIT_MISUSE, "%s: No device specified!\n", +- prog_name); ++ error("No device specified!"); + + if (strlen(argv[optind]) >= PATH_MAX) +- ERRMSG_EXIT(EXIT_MISUSE, "%s: device name too long!\n", +- prog_name); +- strcpy(devname, argv[optind]); +- +- if (stat(devname, &dev_stat) != 0) +- ERRMSG_EXIT(EXIT_MISUSE, "%s: Could not get information for " +- "device node %s: %s\n", prog_name, devname, +- strerror(errno)); +- +- if (minor(dev_stat.st_rdev) & PARTN_MASK) { +- ERRMSG_EXIT(EXIT_MISUSE, "%s: Unable to format partition %s. " +- "Please specify a device.\n", prog_name, +- devname); +- } ++ error("device name too long!"); ++ util_asprintf(&g.dev_path, argv[optind]); ++ ++ if (stat(g.dev_path, &dev_stat) != 0) ++ error("Could not get information for device node %s: %s", ++ g.dev_path, strerror(errno)); ++ ++ maj = major(dev_stat.st_rdev); ++ min = minor(dev_stat.st_rdev); ++ if (min & PARTN_MASK) ++ error("Unable to format partition %s. Please specify a device.", g.dev_path); + + if (util_proc_dev_get_entry(dev_stat.st_rdev, 1, &dev_entry) == 0) { + if (strncmp(dev_entry.name, "dasd", 4) != 0) +- ERRMSG_EXIT(EXIT_MISUSE, +- "%s: Unsupported device type '%s'.\n", +- prog_name, dev_entry.name); ++ error("Unsupported device type '%s'.", dev_entry.name); + } else { + printf("%s WARNING: Unable to get driver name for device node %s", +- prog_name, devname); ++ prog_name, g.dev_path); + } ++ /* Get reliable device node */ ++ util_asprintf(&g.dev_node, "/dev/block/%d:%d", maj, min); + } + +-static void get_blocksize(const char *device, unsigned int *blksize) ++static void get_blocksize(unsigned int *blksize) + { + int err; + +- err = dasd_get_blocksize(device, blksize); ++ err = dasd_get_blocksize(g.dev_node, blksize); + if (err != 0) +- ERRMSG_EXIT(EXIT_FAILURE, "%s: the ioctl to get the blocksize " +- "of the device failed (%s).\n", prog_name, +- strerror(err)); ++ error("the ioctl to get the blocksize of the device failed: %s", strerror(err)); + } + + /* + * Check whether a specified blocksize matches the blocksize of the device + */ +-static void check_blocksize(dasdfmt_info_t *info, unsigned int blksize) ++static void check_blocksize(unsigned int blksize) + { + unsigned int dev_blksize; + +- if (!info->blksize_specified || +- info->dasd_info.format == DASD_FORMAT_NONE) ++ if (!g.blksize_specified || ++ g.dasd_info.format == DASD_FORMAT_NONE) + return; + +- get_blocksize(dev_filename, &dev_blksize); ++ get_blocksize(&dev_blksize); + if (dev_blksize != blksize) { +- ERRMSG_EXIT(EXIT_FAILURE, "WARNING: Device is formatted with a " +- "different blocksize (%d).\nUse --mode=full to " +- "perform a clean format.\n", dev_blksize); ++ warnx("WARNING: Device is formatted with a different blocksize (%d).", dev_blksize); ++ error("Use --mode=full to perform a clean format."); + } + } + +@@ -538,64 +573,54 @@ static void check_blocksize(dasdfmt_info_t *info, unsigned int blksize) + * Check whether a specified layout matches the layout + * a device is formatted with. + */ +-static void check_layout(dasdfmt_info_t *info, unsigned int intensity) ++static void check_layout(unsigned int intensity) + { + char layout[4]; + +- if (!info->layout_specified || +- info->dasd_info.format == DASD_FORMAT_NONE) ++ if (!g.layout_specified || ++ g.dasd_info.format == DASD_FORMAT_NONE) + return; + + if ((intensity & DASD_FMT_INT_COMPAT) && +- info->dasd_info.format == DASD_FORMAT_CDL) ++ g.dasd_info.format == DASD_FORMAT_CDL) + return; + + if (!(intensity & DASD_FMT_INT_COMPAT) && +- info->dasd_info.format == DASD_FORMAT_LDL) ++ g.dasd_info.format == DASD_FORMAT_LDL) + return; + +- if (info->dasd_info.format == DASD_FORMAT_CDL) ++ if (g.dasd_info.format == DASD_FORMAT_CDL) + sprintf(layout, "CDL"); +- if (info->dasd_info.format == DASD_FORMAT_LDL) ++ if (g.dasd_info.format == DASD_FORMAT_LDL) + sprintf(layout, "LDL"); + +- ERRMSG_EXIT(EXIT_FAILURE, "WARNING: Device is formatted with a " +- "different layout (%s).\n", layout); ++ error("WARNING: Device is formatted with a different layout (%s).", layout); + } + + /* + * check for disk type and set some variables (e.g. usage count) + */ +-static void check_disk(dasdfmt_info_t *info, char *devname) ++static void check_disk(void) + { + int err; + bool ro; + +- err = dasd_is_ro(devname, &ro); ++ err = dasd_is_ro(g.dev_node, &ro); + if (err != 0) +- ERRMSG_EXIT(EXIT_FAILURE, +- "%s: the ioctl call to retrieve read/write " +- "status information failed (%s)\n", +- prog_name, strerror(err)); +- ++ error("the ioctl call to retrieve read/write status information failed: %s", ++ strerror(err)); + if (ro) +- ERRMSG_EXIT(EXIT_FAILURE, "Disk is read only!\n"); +- +- if (!info->force) +- if (info->dasd_info.open_count > 1) +- ERRMSG_EXIT(EXIT_BUSY, "Disk in use!\n"); +- +- if (strncmp(info->dasd_info.type, "ECKD", 4) != 0) { +- ERRMSG_EXIT(EXIT_FAILURE, +- "%s: Unsupported disk type\n%s is not an " +- "ECKD disk!\n", prog_name, devname); ++ error("Disk is read only!"); ++ if (!g.force) { ++ if (g.dasd_info.open_count > 1) ++ error("Disk in use!"); + } +- +- if (dasd_sys_raw_track_access(devname)) { +- ERRMSG_EXIT(EXIT_FAILURE, +- "%s: Device '%s' is in raw-track access mode\n", +- prog_name, devname); ++ if (strncmp(g.dasd_info.type, "ECKD", 4) != 0) { ++ warnx("Unsupported disk type"); ++ error("%s is not an ECKD disk!", g.dev_path); + } ++ if (dasd_sys_raw_track_access(g.dev_node)) ++ error("Device '%s' is in raw-track access mode", g.dev_path); + } + + /* +@@ -669,16 +694,16 @@ static int check_param(char *s, size_t buffsize, format_data_t *data) + /* + * Retrieve disk information and set cylinders and heads accordingly. + */ +-static void set_geo(dasdfmt_info_t *info, unsigned int *cylinders, ++static void set_geo(unsigned int *cylinders, + unsigned int *heads) + { + struct dasd_eckd_characteristics *characteristics; + +- if (info->verbosity > 0) ++ if (g.verbosity > 0) + printf("Retrieving disk geometry...\n"); + + characteristics = (struct dasd_eckd_characteristics *) +- &info->dasd_info.characteristics; ++ &g.dasd_info.characteristics; + if (characteristics->no_cyl == LV_COMPAT_CYL && + characteristics->long_no_cyl) + *cylinders = characteristics->long_no_cyl; +@@ -690,13 +715,13 @@ static void set_geo(dasdfmt_info_t *info, unsigned int *cylinders, + /* + * Set VTOC label information + */ +-static void set_label(dasdfmt_info_t *info, volume_label_t *vlabel, ++static void set_label(volume_label_t *vlabel, + format_data_t *p, unsigned int cylinders) + { + char inp_buffer[5]; + +- if (info->writenolabel) { +- if (cylinders > LV_COMPAT_CYL && !info->withoutprompt) { ++ if (g.writenolabel) { ++ if (cylinders > LV_COMPAT_CYL && !g.withoutprompt) { + printf("\n--->> ATTENTION! <<---\n"); + printf("You specified to write no labels to a" + " volume with more then %u cylinders.\n" +@@ -714,16 +739,16 @@ static void set_label(dasdfmt_info_t *info, volume_label_t *vlabel, + } + } + } else { +- if (!info->labelspec && !info->keep_volser) { ++ if (!g.labelspec && !g.keep_volser) { + char buf[7]; + +- sprintf(buf, "0X%04x", info->dasd_info.devno); +- check_volser(buf, info->dasd_info.devno); ++ sprintf(buf, "0X%04x", g.dasd_info.devno); ++ check_volser(buf, g.dasd_info.devno); + vtoc_volume_label_set_volser(vlabel, buf); + } + + if (p->intensity & DASD_FMT_INT_COMPAT) { +- info->cdl_format = 1; ++ g.cdl_format = 1; + vtoc_volume_label_set_label(vlabel, "VOL1"); + vtoc_volume_label_set_key(vlabel, "VOL1"); + vtoc_set_cchhb(&vlabel->vtoc, 0x0000, 0x0001, 0x01); +@@ -736,19 +761,19 @@ static void set_label(dasdfmt_info_t *info, volume_label_t *vlabel, + /* + * Check whether hashsteps are within the correct interval. + */ +-static void check_hashmarks(dasdfmt_info_t *info) ++static void check_hashmarks(void) + { +- if (info->print_hashmarks) { +- if (info->hashstep < reqsize) +- info->hashstep = reqsize; +- if ((info->hashstep < 1) || (info->hashstep > 1000)) { ++ if (g.print_hashmarks) { ++ if (g.hashstep < reqsize) ++ g.hashstep = reqsize; ++ if (g.hashstep < 1 || g.hashstep > 1000) { + printf("Hashmark increment is not in range <1,1000>, " + "using the default.\n"); +- info->hashstep = 10; ++ g.hashstep = 10; + } + + printf("Printing hashmark every %d cylinders.\n", +- info->hashstep); ++ g.hashstep); + } + } + +@@ -756,7 +781,7 @@ static void check_hashmarks(dasdfmt_info_t *info) + * This function checks whether a range of tracks is in regular format + * with the specified block size. + */ +-static format_check_t check_track_format(dasdfmt_info_t *info, format_data_t *p) ++static format_check_t check_track_format(format_data_t *p) + { + format_check_t cdata = { + .expect = { +@@ -766,22 +791,20 @@ static format_check_t check_track_format(dasdfmt_info_t *info, format_data_t *p) + .stop_unit = p->stop_unit + }, 0 + }; ++ char msg[128] = ""; + int err; + +- err = dasd_check_format(dev_filename, &cdata); ++ err = dasd_check_format(g.dev_node, &cdata); + if (err != 0) { + if (err == ENOTTY) { +- ERRMSG("%s: Missing kernel support for format checking", +- prog_name); +- if (mode == EXPAND) { +- ERRMSG(". Mode 'expand' cannot be used"); +- } else if (!info->check) { +- ERRMSG(" (--force to override)"); +- } +- ERRMSG_EXIT(EXIT_FAILURE, ".\n"); ++ sprintf(msg, "Missing kernel support for format checking"); ++ if (mode == EXPAND) ++ strcat(msg, ". Mode 'expand' cannot be used"); ++ else if (!g.check) ++ strcat(msg, " (--force to override)"); ++ error("%s.", msg); + } +- ERRMSG_EXIT(EXIT_FAILURE, "%s: Could no check format: %s\n", +- prog_name, strerror(err)); ++ error("Could not check format: %s", strerror(err)); + } + + return cdata; +@@ -790,8 +813,8 @@ static format_check_t check_track_format(dasdfmt_info_t *info, format_data_t *p) + /* + * Either do the actual format or check depending on the check-value. + */ +-static int process_tracks(dasdfmt_info_t *info, unsigned int cylinders, +- unsigned int heads, format_data_t *format_params) ++static int process_tracks(unsigned int cylinders, unsigned int heads, ++ format_data_t *format_params) + { + format_check_t cdata = { .expect = {0}, 0}; + format_data_t step = *format_params; +@@ -799,7 +822,7 @@ static int process_tracks(dasdfmt_info_t *info, unsigned int cylinders, + unsigned long cur_trk; + int cyl = 0, err; + +- check_hashmarks(info); ++ check_hashmarks(); + + cur_trk = format_params->start_unit; + +@@ -811,31 +834,29 @@ static int process_tracks(dasdfmt_info_t *info, unsigned int cylinders, + else + step.stop_unit = cur_trk + step_value - 1; + +- if (info->check) { +- cdata = check_track_format(info, &step); ++ if (g.check) { ++ cdata = check_track_format(&step); + if (cdata.result) { + cyl = cur_trk / heads + 1; +- draw_progress(info, cyl, cylinders, 1); +- evaluate_format_error(info, &cdata, heads); ++ draw_progress(cyl, cylinders, 1); ++ evaluate_format_error(&cdata, heads); + break; + } + } else { + err = dasd_format_disk(filedes, &step); + if (err != 0) +- ERRMSG_EXIT(EXIT_FAILURE, "%s: the ioctl call " +- "to format tracks failed. (%s)\n", +- prog_name, strerror(err)); ++ error("the ioctl call to format tracks failed: %s", strerror(err)); + } + + cyl = cur_trk / heads + 1; +- draw_progress(info, cyl, cylinders, 0); ++ draw_progress(cyl, cylinders, 0); + + cur_trk += step_value; + } + /* We're done, draw the 100% mark */ + if (!cdata.result) { + cyl = step.stop_unit / heads + 1; +- draw_progress(info, cyl, cylinders, 0); ++ draw_progress(cyl, cylinders, 0); + printf("\n"); + } + +@@ -845,37 +866,35 @@ static int process_tracks(dasdfmt_info_t *info, unsigned int cylinders, + /* + * This function checks the format of the entire disk. + */ +-static void check_disk_format(dasdfmt_info_t *info, unsigned int cylinders, +- unsigned int heads, format_data_t *check_params) ++static void check_disk_format(unsigned int cylinders, unsigned int heads, ++ format_data_t *check_params) + { + check_params->start_unit = 0; + check_params->stop_unit = (cylinders * heads) - 1; + + printf("Checking format of the entire disk...\n"); + +- if (info->testmode) { ++ if (g.testmode) { + printf("Test mode active, omitting ioctl.\n"); + return; + } + +- check_blocksize(info, check_params->blksize); +- check_layout(info, check_params->intensity); ++ check_blocksize(check_params->blksize); ++ check_layout(check_params->intensity); + + /* + * If no layout was specified, set the intensity + * according to what the layout seems to be. + */ +- if (!info->layout_specified) { +- if (info->dasd_info.format == DASD_FORMAT_CDL) ++ if (!g.layout_specified) { ++ if (g.dasd_info.format == DASD_FORMAT_CDL) + check_params->intensity |= DASD_FMT_INT_COMPAT; +- else if (info->dasd_info.format == DASD_FORMAT_LDL) ++ else if (g.dasd_info.format == DASD_FORMAT_LDL) + check_params->intensity &= ~DASD_FMT_INT_COMPAT; + } + +- if (process_tracks(info, cylinders, heads, check_params)) { +- ERRMSG_EXIT(EXIT_FAILURE, "Use --mode=full to perform a " +- "clean format.\n"); +- } ++ if (process_tracks(cylinders, heads, check_params)) ++ error("Use --mode=full to perform a clean format."); + + printf("Done. Disk is fine.\n"); + } +@@ -917,10 +936,8 @@ static format_data_t ask_user_for_blksize(format_data_t params) + /* + * print all information needed to format the device + */ +-static void dasdfmt_print_info(dasdfmt_info_t *info, char *devname, +- volume_label_t *vlabel, +- unsigned int cylinders, unsigned int heads, +- format_data_t *p) ++static void dasdfmt_print_info(volume_label_t *vlabel, unsigned int cylinders, ++ unsigned int heads, format_data_t *p) + { + char volser[6], vollbl[4]; + +@@ -928,14 +945,14 @@ static void dasdfmt_print_info(dasdfmt_info_t *info, char *devname, + cylinders, heads, (cylinders * heads)); + + printf("Device Type: %s Provisioned\n", +- info->ese ? "Thinly" : "Fully"); ++ g.ese ? "Thinly" : "Fully"); + printf("\nI am going to format the device "); +- printf("%s in the following way:\n", devname); +- printf(" Device number of device : 0x%x\n", info->dasd_info.devno); ++ printf("%s in the following way:\n", g.dev_path); ++ printf(" Device number of device : 0x%x\n", g.dasd_info.devno); + printf(" Labelling device : %s\n", +- (info->writenolabel) ? "no" : "yes"); ++ (g.writenolabel) ? "no" : "yes"); + +- if (!info->writenolabel) { ++ if (!g.writenolabel) { + vtoc_volume_label_get_label(vlabel, vollbl); + printf(" Disk label : %.4s\n", vollbl); + vtoc_volume_label_get_volser(vlabel, volser); +@@ -947,30 +964,29 @@ static void dasdfmt_print_info(dasdfmt_info_t *info, char *devname, + (p->intensity & DASD_FMT_INT_COMPAT) ? "yes" : "no"); + printf(" Blocksize : %d\n", p->blksize); + printf(" Mode : %s\n", mode_str[mode]); +- if (info->ese) { ++ if (g.ese) { + printf(" Full Space Release : %s\n", +- (info->no_discard || mode == FULL) ? "no" : "yes"); ++ (g.no_discard || mode == FULL) ? "no" : "yes"); + } +- if (info->testmode) ++ if (g.testmode) + printf("Test mode active, omitting ioctl.\n"); + } + + /* + * get volser + */ +-static int dasdfmt_get_volser(char *devname, dasd_information2_t *dasd_info, +- char *volser) ++static int dasdfmt_get_volser(char *volser) + { + unsigned int blksize; + volume_label_t vlabel; + +- get_blocksize(devname, &blksize); ++ get_blocksize(&blksize); + +- if ((strncmp(dasd_info->type, "ECKD", 4) == 0) && +- !dasd_info->FBA_layout) { ++ if ((strncmp(g.dasd_info.type, "ECKD", 4) == 0) && ++ !g.dasd_info.FBA_layout) { + /* OS/390 and zOS compatible disk layout */ +- vtoc_read_volume_label(devname, +- dasd_info->label_block * blksize, ++ vtoc_read_volume_label(g.dev_node, ++ g.dasd_info.label_block * blksize, + &vlabel); + vtoc_volume_label_get_volser(&vlabel, volser); + return 0; +@@ -982,7 +998,7 @@ static int dasdfmt_get_volser(char *devname, dasd_information2_t *dasd_info, + /* + * do all the labeling (volume label and initial VTOC) + */ +-static void dasdfmt_write_labels(dasdfmt_info_t *info, volume_label_t *vlabel, ++static void dasdfmt_write_labels(volume_label_t *vlabel, + unsigned int cylinders, unsigned int heads) + { + int label_position; +@@ -995,33 +1011,31 @@ static void dasdfmt_write_labels(dasdfmt_info_t *info, volume_label_t *vlabel, + void *ipl1_record, *ipl2_record; + int ipl1_record_len, ipl2_record_len; + +- if (info->verbosity > 0) ++ if (g.verbosity > 0) + printf("Retrieving dasd information... "); + +- get_blocksize(dev_filename, &blksize); ++ get_blocksize(&blksize); + + /* + * Don't rely on the cylinders returned by HDIO_GETGEO, they might be + * to small. geo is only used to get the number of sectors, which may + * vary depending on the format. + */ +- rc = dasd_get_geo(dev_filename, &geo); ++ rc = dasd_get_geo(g.dev_node, &geo); + if (rc != 0) +- ERRMSG_EXIT(EXIT_FAILURE, "%s: (write labels) IOCTL " +- "HDIO_GETGEO failed (%s).\n", +- prog_name, strerror(rc)); ++ error("(write labels) IOCTL HDIO_GETGEO failed: %s", strerror(rc)); + +- if (info->verbosity > 0) ++ if (g.verbosity > 0) + printf("ok\n"); + + /* write empty bootstrap (initial IPL records) */ +- if (info->verbosity > 0) ++ if (g.verbosity > 0) + printf("Writing empty bootstrap...\n"); + + /* + * Note: ldl labels do not contain the key field + */ +- if (info->cdl_format) { ++ if (g.cdl_format) { + /* Prepare copy with key (CDL) */ + ipl1_record = &ipl1; + ipl2_record = &ipl2; +@@ -1035,68 +1049,59 @@ static void dasdfmt_write_labels(dasdfmt_info_t *info, volume_label_t *vlabel, + ipl2_record_len = sizeof(ipl2.data); + } + +- fd = open(dev_filename, O_RDWR); ++ fd = open(g.dev_node, O_RDWR); + if (fd < 0) +- ERRMSG_EXIT(EXIT_FAILURE, "%s: Unable to open device " +- "'%s' (%s)\n", prog_name, dev_filename, +- strerror(errno)); ++ error("Unable to open device '%s': %s", g.dev_path, strerror(errno)); + + if (lseek(fd, 0, SEEK_SET) != 0) { + close(fd); +- ERRMSG_EXIT(EXIT_FAILURE, "%s: lseek command 0 failed " +- "(%s)\n", prog_name, strerror(errno)); ++ error("lseek command 0 failed: %s", strerror(errno)); + } + + rc = write(fd, ipl1_record, ipl1_record_len); + if (rc != ipl1_record_len) { + close(fd); +- ERRMSG_EXIT(EXIT_FAILURE, "%s: Writing the bootstrap IPL1 " +- "failed, only wrote %d bytes.\n", prog_name, rc); ++ error("Writing the bootstrap IPL1 failed, only wrote %d bytes.", rc); + } + + label_position = blksize; + rc = lseek(fd, label_position, SEEK_SET); + if (rc != label_position) { + close(fd); +- ERRMSG_EXIT(EXIT_FAILURE, "%s: lseek command to %i failed " +- "(%s).\n", prog_name, label_position, +- strerror(errno)); ++ error("lseek command to %i failed: %s", label_position, strerror(errno)); + } + + rc = write(fd, ipl2_record, ipl2_record_len); + if (rc != ipl2_record_len) { + close(fd); +- ERRMSG_EXIT(EXIT_FAILURE, "%s: Writing the bootstrap IPL2 " +- "failed, only wrote %d bytes.\n", prog_name, rc); ++ error("Writing the bootstrap IPL2 failed, only wrote %d bytes.", rc); + } + + /* write VTOC */ + vtoc_init_format4_label(&f4, geo.cylinders, cylinders, heads, +- geo.sectors, blksize, info->dasd_info.dev_type); ++ geo.sectors, blksize, g.dasd_info.dev_type); + + vtoc_init_format5_label(&f5); + vtoc_init_format7_label(&f7); + vtoc_set_freespace(&f4, &f5, &f7, '+', 0, FIRST_USABLE_TRK, + (cylinders * heads - 1), cylinders, heads); + +- label_position = info->dasd_info.label_block * blksize; ++ label_position = g.dasd_info.label_block * blksize; + +- if (info->verbosity > 0) ++ if (g.verbosity > 0) + printf("Writing label...\n"); + + rc = lseek(fd, label_position, SEEK_SET); + if (rc != label_position) { + close(fd); +- ERRMSG_EXIT(EXIT_FAILURE, "%s: lseek command to %i failed " +- "(%s).\n", prog_name, label_position, +- strerror(errno)); ++ error("lseek command to %i failed: %s", label_position, strerror(errno)); + } + + /* + * Note: cdl volume labels do not contain the 'formatted_blocks' part + * and ldl labels do not contain the key field + */ +- if (info->cdl_format) { ++ if (g.cdl_format) { + rc = write(fd, vlabel, (sizeof(*vlabel) - + sizeof(vlabel->formatted_blocks))); + } else { +@@ -1107,15 +1112,14 @@ static void dasdfmt_write_labels(dasdfmt_info_t *info, volume_label_t *vlabel, + } + + if (((rc != sizeof(*vlabel) - sizeof(vlabel->formatted_blocks)) && +- info->cdl_format) || ++ g.cdl_format) || + ((rc != (sizeof(*vlabel) - sizeof(vlabel->volkey))) && +- !info->cdl_format)) { ++ !g.cdl_format)) { + close(fd); +- ERRMSG_EXIT(EXIT_FAILURE, "%s: Error writing volume label " +- "(%d).\n", prog_name, rc); ++ error("Error writing volume label (%d).", rc); + } + +- if (info->verbosity > 0) ++ if (g.verbosity > 0) + printf("Writing VTOC... "); + + label_position = (VTOC_START_CC * heads + VTOC_START_HH) * +@@ -1124,17 +1128,14 @@ static void dasdfmt_write_labels(dasdfmt_info_t *info, volume_label_t *vlabel, + rc = lseek(fd, label_position, SEEK_SET); + if (rc != label_position) { + close(fd); +- ERRMSG_EXIT(EXIT_FAILURE, "%s: lseek command to %i failed " +- "(%s).\n", prog_name, label_position, +- strerror(errno)); ++ error("lseek command to %i failed: %s", label_position, strerror(errno)); + } + + /* write VTOC FMT4 DSCB */ + rc = write(fd, &f4, sizeof(format4_label_t)); + if (rc != sizeof(format4_label_t)) { + close(fd); +- ERRMSG_EXIT(EXIT_FAILURE, "%s: Error writing FMT4 label " +- "(%d).\n", prog_name, rc); ++ error("Error writing FMT4 label (%d).", rc); + } + + label_position += blksize; +@@ -1142,16 +1143,14 @@ static void dasdfmt_write_labels(dasdfmt_info_t *info, volume_label_t *vlabel, + rc = lseek(fd, label_position, SEEK_SET); + if (rc != label_position) { + close(fd); +- ERRMSG_EXIT(EXIT_FAILURE, "%s: lseek to %i failed (%s).\n", +- prog_name, label_position, strerror(errno)); ++ error("lseek to %i failed: %s", label_position, strerror(errno)); + } + + /* write VTOC FMT5 DSCB */ + rc = write(fd, &f5, sizeof(format5_label_t)); + if (rc != sizeof(format5_label_t)) { + close(fd); +- ERRMSG_EXIT(EXIT_FAILURE, "%s: Error writing FMT5 label " +- "(%d).\n", prog_name, rc); ++ error("Error writing FMT5 label (%d).", rc); + } + + if ((cylinders * heads) > BIG_DISK_SIZE) { +@@ -1160,17 +1159,14 @@ static void dasdfmt_write_labels(dasdfmt_info_t *info, volume_label_t *vlabel, + rc = lseek(fd, label_position, SEEK_SET); + if (rc != label_position) { + close(fd); +- ERRMSG_EXIT(EXIT_FAILURE, "%s: lseek to %i failed " +- "(%s).\n", prog_name, label_position, +- strerror(errno)); ++ error("lseek to %i failed: %s", label_position, strerror(errno)); + } + + /* write VTOC FMT 7 DSCB (only on big disks) */ + rc = write(fd, &f7, sizeof(format7_label_t)); + if (rc != sizeof(format7_label_t)) { + close(fd); +- ERRMSG_EXIT(EXIT_FAILURE, "%s: Error writing FMT7 " +- "label (rc=%d).\n", prog_name, rc); ++ error("Error writing FMT7 label (rc=%d).", rc); + } + } + +@@ -1178,7 +1174,7 @@ static void dasdfmt_write_labels(dasdfmt_info_t *info, volume_label_t *vlabel, + + close(fd); + +- if (info->verbosity > 0) ++ if (g.verbosity > 0) + printf("ok\n"); + } + +@@ -1188,8 +1184,8 @@ static void dasdfmt_write_labels(dasdfmt_info_t *info, volume_label_t *vlabel, + * that the device is formatted to a certain extent. Otherwise the + * process is terminated. + */ +-static void dasdfmt_find_start(dasdfmt_info_t *info, unsigned int cylinders, +- unsigned heads, format_data_t *format_params) ++static void dasdfmt_find_start(unsigned int cylinders, unsigned int heads, ++ format_data_t *format_params) + { + format_check_t cdata; + unsigned int middle; +@@ -1197,16 +1193,15 @@ static void dasdfmt_find_start(dasdfmt_info_t *info, unsigned int cylinders, + unsigned int right = (cylinders * heads) - 1; + unsigned int first = left; + +- check_blocksize(info, format_params->blksize); ++ check_blocksize(format_params->blksize); + + format_params->start_unit = 0; + format_params->stop_unit = 4; +- cdata = check_track_format(info, format_params); ++ cdata = check_track_format(format_params); + + if (cdata.result) { +- evaluate_format_error(info, &cdata, heads); +- ERRMSG_EXIT(EXIT_FAILURE, "Use --mode=full to perform a " +- "clean format.\n"); ++ evaluate_format_error(&cdata, heads); ++ error("Use --mode=full to perform a clean format."); + } + + printf("Expansion mode active. Searching for starting position...\n"); +@@ -1217,7 +1212,7 @@ static void dasdfmt_find_start(dasdfmt_info_t *info, unsigned int cylinders, + + format_params->start_unit = middle; + format_params->stop_unit = middle; +- cdata = check_track_format(info, format_params); ++ cdata = check_track_format(format_params); + if (cdata.blksize != format_params->blksize) { + first = middle; + right = middle - 1; +@@ -1227,8 +1222,7 @@ static void dasdfmt_find_start(dasdfmt_info_t *info, unsigned int cylinders, + } + + if (first == 2 && cdata.blksize == format_params->blksize) +- ERRMSG_EXIT(EXIT_FAILURE, +- "No unformatted part found, aborting.\n"); ++ error("No unformatted part found, aborting."); + + printf("Done. Unformatted part starts at track %d.\n", first); + +@@ -1236,16 +1230,7 @@ static void dasdfmt_find_start(dasdfmt_info_t *info, unsigned int cylinders, + format_params->start_unit = first; + } + +-/* +- * formats the disk cylinderwise +- */ +-static void dasdfmt_format(dasdfmt_info_t *info, unsigned int cylinders, +- unsigned int heads, format_data_t *format_params) +-{ +- process_tracks(info, cylinders, heads, format_params); +-} +- +-static void dasdfmt_release_space(dasdfmt_info_t *info) ++static void dasdfmt_release_space(void) + { + format_data_t r = { + .start_unit = 0, +@@ -1254,20 +1239,17 @@ static void dasdfmt_release_space(dasdfmt_info_t *info) + }; + int err = 0; + +- if (!info->ese || info->no_discard) ++ if (!g.ese || g.no_discard) + return; + + printf("Releasing space for the entire device...\n"); +- err = dasd_release_space(dev_filename, &r); +- if (err) { +- ERRMSG_EXIT(EXIT_FAILURE, "%s: Could not release space (%s)\n", +- prog_name, strerror(err)); +- } ++ err = dasd_release_space(g.dev_node, &r); ++ if (err) ++ error("Could not release space: %s", strerror(err)); + } + +-static void dasdfmt_prepare_and_format(dasdfmt_info_t *info, +- unsigned int cylinders, +- unsigned int heads, format_data_t *p) ++static void dasdfmt_prepare_and_format(unsigned int cylinders, unsigned int heads, ++ format_data_t *p) + { + format_data_t temp = { + .start_unit = 0, +@@ -1278,44 +1260,40 @@ static void dasdfmt_prepare_and_format(dasdfmt_info_t *info, + }; + int err; + +- if (!(info->withoutprompt && (info->verbosity < 1))) ++ if (!(g.withoutprompt && g.verbosity < 1)) + printf("Formatting the device. This may take a while " + "(get yourself a coffee).\n"); + +- if (info->verbosity > 0) ++ if (g.verbosity > 0) + printf("Detaching the device...\n"); + +- disk_disable(dev_filename); ++ disk_disable(g.dev_node); + +- if (info->verbosity > 0) ++ if (g.verbosity > 0) + printf("Invalidate first track...\n"); + + err = dasd_format_disk(filedes, &temp); + if (err != 0) +- ERRMSG_EXIT(EXIT_FAILURE, "%s: (invalidate first track) IOCTL " +- "BIODASDFMT failed. (%s)\n", prog_name, +- strerror(err)); ++ error("(invalidate first track) IOCTL BIODASDFMT failed: %s", strerror(err)); + + /* except track 0 from standard formatting procss */ + p->start_unit = 1; + +- dasdfmt_format(info, cylinders, heads, p); ++ process_tracks(cylinders, heads, p); + +- if (info->verbosity > 0) ++ if (g.verbosity > 0) + printf("formatting tracks complete...\n"); + + temp.intensity = p->intensity; + +- if (info->verbosity > 0) ++ if (g.verbosity > 0) + printf("Revalidate first track...\n"); + + err = dasd_format_disk(filedes, &temp); + if (err != 0) +- ERRMSG_EXIT(EXIT_FAILURE, "%s: (re-validate first track) IOCTL" +- " BIODASDFMT failed (%s)\n", prog_name, +- strerror(err)); ++ error("(re-validate first track) IOCTL BIODASDFMT failed: %s", strerror(err)); + +- if (info->verbosity > 0) ++ if (g.verbosity > 0) + printf("Re-accessing the device...\n"); + + disk_enable(); +@@ -1324,24 +1302,24 @@ static void dasdfmt_prepare_and_format(dasdfmt_info_t *info, + /* + * This function will start the expand format process. + */ +-static void dasdfmt_expand_format(dasdfmt_info_t *info, unsigned int cylinders, +- unsigned int heads, format_data_t *p) ++static void dasdfmt_expand_format(unsigned int cylinders, unsigned int heads, ++ format_data_t *p) + { +- if (!(info->withoutprompt && (info->verbosity < 1))) ++ if (!(g.withoutprompt && g.verbosity < 1)) + printf("Formatting the device. This may take a while " + "(get yourself a coffee).\n"); + +- if (info->verbosity > 0) ++ if (g.verbosity > 0) + printf("Detaching the device...\n"); + +- disk_disable(dev_filename); ++ disk_disable(g.dev_node); + +- dasdfmt_format(info, cylinders, heads, p); ++ process_tracks(cylinders, heads, p); + +- if (info->verbosity > 0) ++ if (g.verbosity > 0) + printf("Formatting tracks complete...\n"); + +- if (info->verbosity > 0) ++ if (g.verbosity > 0) + printf("Re-accessing the device...\n"); + + disk_enable(); +@@ -1351,60 +1329,56 @@ static void dasdfmt_expand_format(dasdfmt_info_t *info, unsigned int cylinders, + * This function will only format the first two tracks of a DASD. + * The rest of the DASD is untouched and left as is. + */ +-static void dasdfmt_quick_format(dasdfmt_info_t *info, unsigned int cylinders, +- unsigned int heads, format_data_t *p) ++static void dasdfmt_quick_format(unsigned int cylinders, unsigned int heads, ++ format_data_t *p) + { + format_check_t cdata = { .expect = {0}, 0 }; + format_data_t tmp = *p; + int err; + +- if (info->force) { ++ if (g.force) { + printf("Skipping format check due to --force.\n"); +- } else if (info->ese) { ++ } else if (g.ese) { + printf("Skipping format check due to thin-provisioned device.\n"); + } else { +- check_blocksize(info, p->blksize); ++ check_blocksize(p->blksize); + + printf("Checking the format of selected tracks...\n"); + + /* Check device format on the first and last 3 regular tracks */ + tmp.start_unit = 2; + tmp.stop_unit = 4; +- cdata = check_track_format(info, &tmp); ++ cdata = check_track_format(&tmp); + if (!cdata.result) { + tmp.start_unit = (cylinders * heads) - 3; + tmp.stop_unit = (cylinders * heads) - 1; +- cdata = check_track_format(info, &tmp); ++ cdata = check_track_format(&tmp); + } + if (cdata.result) { +- evaluate_format_error(info, &cdata, heads); +- ERRMSG_EXIT(EXIT_FAILURE, "Use --mode=full to perform " +- "a clean format.\n"); ++ evaluate_format_error(&cdata, heads); ++ error("Use --mode=full to perform a clean format."); + } else { + printf("Done. Disk seems fine.\n"); + } + } + +- if (!(info->withoutprompt && (info->verbosity < 1))) ++ if (!(g.withoutprompt && g.verbosity < 1)) + printf("Formatting the first two tracks of the device.\n"); + + /* Disable the device before we do anything */ +- disk_disable(dev_filename); ++ disk_disable(g.dev_node); + + /* Now do the actual formatting of our first two tracks */ + err = dasd_format_disk(filedes, p); + if (err != 0) +- ERRMSG_EXIT(EXIT_FAILURE, "%s: the ioctl to format the device " +- "failed. (%s)\n", prog_name, strerror(err)); ++ error("the ioctl to format the device failed: %s", strerror(err)); + + /* Re-Enable the device so that we can continue working with it */ + disk_enable(); + } + +-static void do_format_dasd(dasdfmt_info_t *info, char *devname, +- volume_label_t *vlabel, +- format_data_t *p, unsigned int cylinders, +- unsigned int heads) ++static void do_format_dasd(volume_label_t *vlabel, format_data_t *p, ++ unsigned int cylinders, unsigned int heads) + { + char inp_buffer[5]; + int count, err; +@@ -1419,25 +1393,25 @@ static void do_format_dasd(dasdfmt_info_t *info, char *devname, + p->stop_unit = 1; + break; + case EXPAND: /* only the end of the disk */ +- dasdfmt_find_start(info, cylinders, heads, p); ++ dasdfmt_find_start(cylinders, heads, p); + p->stop_unit = (cylinders * heads) - 1; + break; + } + +- if ((info->verbosity > 0) || !info->withoutprompt || info->testmode) +- dasdfmt_print_info(info, devname, vlabel, cylinders, heads, p); ++ if (g.verbosity > 0 || !g.withoutprompt || g.testmode) ++ dasdfmt_print_info(vlabel, cylinders, heads, p); + +- count = dasd_get_host_access_count(devname); +- if (info->force_host) { ++ count = dasd_get_host_access_count(g.dev_node); ++ if (g.force_host) { + if (count > 1) { +- ERRMSG_EXIT(EXIT_FAILURE, +- "\n%s: Disk %s is online on OS instances in %d different LPARs.\n" +- "Note: Your installation might include z/VM systems that are configured to\n" +- "automatically vary on disks, regardless of whether they are subsequently used.\n\n", +- prog_name, devname, count); ++ printf("\n"); ++ warnx("Disk %s is online on OS instances in %d different LPARs.", ++ g.dev_path, count); ++ warnx("Note: Your installation might include z/VM systems that are configured to"); ++ error("automatically vary on disks, regardless of whether they are subsequently used.\n"); + } else if (count < 0) { + ERRMSG("\nHosts access information not available for disk %s.\n\n", +- devname); ++ g.dev_path); + return; + } + } else if (count > 1) +@@ -1446,10 +1420,10 @@ static void do_format_dasd(dasdfmt_info_t *info, char *devname, + "Ensure that the disk is not being used by a system outside your LPAR.\n" + "Note: Your installation might include z/VM systems that are configured to\n" + "automatically vary on disks, regardless of whether they are subsequently used.\n", +- devname, count); ++ g.dev_path, count); + +- if (!info->testmode) { +- if (!info->withoutprompt) { ++ if (!g.testmode) { ++ if (!g.withoutprompt) { + printf("\n"); + if (mode != EXPAND) + printf("--->> ATTENTION! <<---\nAll data of " +@@ -1468,24 +1442,24 @@ static void do_format_dasd(dasdfmt_info_t *info, char *devname, + + switch (mode) { + case FULL: +- dasdfmt_prepare_and_format(info, cylinders, heads, p); ++ dasdfmt_prepare_and_format(cylinders, heads, p); + break; + case QUICK: +- dasdfmt_release_space(info); +- dasdfmt_quick_format(info, cylinders, heads, p); ++ dasdfmt_release_space(); ++ dasdfmt_quick_format(cylinders, heads, p); + break; + case EXPAND: +- dasdfmt_expand_format(info, cylinders, heads, p); ++ dasdfmt_expand_format(cylinders, heads, p); + break; + } + + printf("Finished formatting the device.\n"); + +- if (!(info->writenolabel || mode == EXPAND)) +- dasdfmt_write_labels(info, vlabel, cylinders, heads); ++ if (!(g.writenolabel || mode == EXPAND)) ++ dasdfmt_write_labels(vlabel, cylinders, heads); + + printf("Rereading the partition table... "); +- err = dasd_reread_partition_table(dev_filename, 5); ++ err = dasd_reread_partition_table(g.dev_node, 5); + if (err != 0) { + ERRMSG("%s: error during rereading the partition " + "table: %s.\n", prog_name, strerror(err)); +@@ -1495,24 +1469,34 @@ static void do_format_dasd(dasdfmt_info_t *info, char *devname, + } + } + +-static void eval_format_mode(dasdfmt_info_t *info) ++static void eval_format_mode(void) + { +- if (!info->force && info->mode_specified && info->ese && mode == EXPAND) { +- ERRMSG_EXIT(EXIT_FAILURE, +- "WARNING: The specified device is thin-provisioned\n" +- "Format mode 'expand' is not feasible.\n" +- "Use --mode=full or --mode=quick to perform a clean format\n"); ++ if (!g.force && g.mode_specified && g.ese && mode == EXPAND) { ++ warnx("WARNING: The specified device is thin-provisioned"); ++ warnx("Format mode 'expand' is not feasible."); ++ error("Use --mode=full or --mode=quick to perform a clean format"); + } + +- if (!info->mode_specified) +- mode = info->ese ? QUICK : FULL; ++ if (!g.mode_specified) ++ mode = g.ese ? QUICK : FULL; ++} ++ ++/* ++ * Set prog_name to the last component of the program name to be in line with ++ * err() and warn() function (and its derivatives). ++ */ ++static void set_prog_name(char *s) ++{ ++ char *p = strrchr(s, '/'); ++ ++ if (p == NULL) ++ prog_name = s; ++ else ++ prog_name = p + 1; + } + + int main(int argc, char *argv[]) + { +- dasdfmt_info_t info = { +- .dasd_info = {0}, +- }; + volume_label_t vlabel; + char old_volser[7]; + +@@ -1532,7 +1516,7 @@ int main(int argc, char *argv[]) + signal(SIGQUIT, program_interrupt_signal); + + /******************* initialization ********************/ +- prog_name = argv[0]; ++ set_prog_name(argv[0]); + + util_prg_init(&prg); + util_opt_init(opt_vec, NULL); +@@ -1550,51 +1534,49 @@ int main(int argc, char *argv[]) + + switch (rc) { + case 'F': +- info.force = 1; ++ g.force = 1; + break; + case 'd': + if (strcasecmp(optarg, "cdl") == 0) { + format_params.intensity |= DASD_FMT_INT_COMPAT; +- if (info.writenolabel) { +- printf("WARNING: using the cdl " +- "format without writing a " +- "label doesn't make much " +- "sense!\n"); +- exit(1); ++ if (g.writenolabel) { ++ error("WARNING: using the cdl " ++ "format without writing a " ++ "label doesn't make much " ++ "sense!"); + } + } else if (strcasecmp(optarg, "ldl") == 0) { + format_params.intensity &= ~DASD_FMT_INT_COMPAT; + } else { +- printf("%s is not a valid option!\n", optarg); +- exit(1); ++ error("%s is not a valid option!", optarg); + } +- info.layout_specified = 1; ++ g.layout_specified = 1; + break; + case 'y': +- info.withoutprompt = 1; ++ g.withoutprompt = 1; + break; + case OPT_NOZERO: + format_params.intensity |= DASD_FMT_INT_FMT_NOR0; + break; + case 't': +- info.testmode = 1; ++ g.testmode = 1; + break; + case 'p': +- if (!(info.print_hashmarks || info.print_percentage)) +- info.print_progressbar = 1; ++ if (!(g.print_hashmarks || g.print_percentage)) ++ g.print_progressbar = 1; + break; + case 'm': +- if (!(info.print_progressbar || info.print_percentage)) { ++ if (!(g.print_progressbar || g.print_percentage)) { + hashstep_str = optarg; +- info.print_hashmarks = 1; ++ g.print_hashmarks = 1; + } + break; + case 'P': +- if (!(info.print_hashmarks || info.print_progressbar)) +- info.print_percentage = 1; ++ if (!(g.print_hashmarks || g.print_progressbar)) ++ g.print_percentage = 1; + break; + case 'v': +- info.verbosity = 1; ++ g.verbosity = 1; + break; + case 'h': + util_prg_print_help(); +@@ -1608,30 +1590,29 @@ int main(int argc, char *argv[]) + if (check_volser(buf, 0) < 0) + break; + vtoc_volume_label_set_volser(&vlabel, buf); +- info.labelspec = 1; ++ g.labelspec = 1; + break; + case 'L': + if (format_params.intensity & DASD_FMT_INT_COMPAT) { +- printf("WARNING: using the cdl format " +- "without writing a label doesn't " +- "make much sense!\n"); +- exit(1); ++ error("WARNING: using the cdl format " ++ "without writing a label doesn't " ++ "make much sense!"); + } +- info.writenolabel = 1; ++ g.writenolabel = 1; + break; + case 'b': + blksize_param_str = optarg; +- info.blksize_specified = 1; ++ g.blksize_specified = 1; + break; + case 'r': + reqsize_param_str = optarg; +- info.reqsize_specified = 1; ++ g.reqsize_specified = 1; + break; + case 'k': +- info.keep_volser = 1; ++ g.keep_volser = 1; + break; + case 'C': +- info.force_host = 1; ++ g.force_host = 1; + break; + case 'M': + if (strcasecmp(optarg, "full") == 0) +@@ -1641,104 +1622,91 @@ int main(int argc, char *argv[]) + else if (strcasecmp(optarg, "expand") == 0) + mode = EXPAND; + else +- ERRMSG_EXIT(EXIT_FAILURE, +- "%s: The specified mode '%s' is " +- "invalid. Consult the man page for " +- "more information.\n", +- prog_name, optarg); +- info.mode_specified = 1; ++ error("The specified mode '%s' is invalid. " ++ "Consult the man page for more information.", ++ optarg); ++ g.mode_specified = 1; + break; + case OPT_NODISCARD: +- info.no_discard = 1; ++ g.no_discard = 1; + break; + case OPT_CHECK: +- info.check = 1; ++ g.check = 1; + break; + case -1: + /* End of options string - start of devices list */ + break; + default: +- ERRMSG_EXIT(EXIT_MISUSE, "Try '%s --help' for more" +- " information.\n", prog_name); ++ error("Try '%s --help' for more information.", prog_name); + } + + if (rc == -1) + break; /* exit loop if finished */ + } + +- CHECK_SPEC_MAX_ONCE(info.blksize_specified, "blocksize"); +- CHECK_SPEC_MAX_ONCE(info.labelspec, "label"); +- CHECK_SPEC_MAX_ONCE(info.writenolabel, "omit-label-writing flag"); ++ CHECK_SPEC_MAX_ONCE(g.blksize_specified, "blocksize"); ++ CHECK_SPEC_MAX_ONCE(g.labelspec, "label"); ++ CHECK_SPEC_MAX_ONCE(g.writenolabel, "omit-label-writing flag"); + +- if (info.blksize_specified) ++ if (g.blksize_specified) + PARSE_PARAM_INTO(format_params.blksize, blksize_param_str, 10, + "blocksize"); +- if (info.reqsize_specified) { ++ if (g.reqsize_specified) { + PARSE_PARAM_INTO(reqsize, reqsize_param_str, 10, "requestsize"); + if (reqsize < 1 || reqsize > 255) +- ERRMSG_EXIT(EXIT_FAILURE, +- "invalid requestsize %d specified\n", +- reqsize); ++ error("invalid requestsize %d specified", reqsize); + } else { + reqsize = DEFAULT_REQUESTSIZE; + } + +- if (info.print_hashmarks) +- PARSE_PARAM_INTO(info.hashstep, hashstep_str, 10, "hashstep"); ++ if (g.print_hashmarks) ++ PARSE_PARAM_INTO(g.hashstep, hashstep_str, 10, "hashstep"); + +- get_device_name(dev_filename, optind, argc, argv); ++ get_device_name(optind, argc, argv); + +- rc = dasd_get_info(dev_filename, &info.dasd_info); ++ rc = dasd_get_info(g.dev_node, &g.dasd_info); + if (rc != 0) +- ERRMSG_EXIT(EXIT_FAILURE, "%s: the ioctl call to retrieve " +- "device information failed (%s).\n", +- prog_name, strerror(rc)); ++ error("the ioctl call to retrieve device information failed: %s", strerror(rc)); + +- info.ese = dasd_sys_ese(dev_filename); +- eval_format_mode(&info); ++ g.ese = dasd_sys_ese(g.dev_node); ++ eval_format_mode(); + + /* Either let the user specify the blksize or get it from the kernel */ +- if (!info.blksize_specified) { ++ if (!g.blksize_specified) { + if (!(mode == FULL || +- info.dasd_info.format == DASD_FORMAT_NONE) || info.check) +- get_blocksize(dev_filename, &format_params.blksize); ++ g.dasd_info.format == DASD_FORMAT_NONE) || g.check) ++ get_blocksize(&format_params.blksize); + else + format_params = ask_user_for_blksize(format_params); + } + +- if (info.keep_volser) { +- if (info.labelspec) { +- ERRMSG_EXIT(EXIT_MISUSE, "%s: The -k and -l options " +- "are mutually exclusive\n", prog_name); +- } +- if (!(format_params.intensity & DASD_FMT_INT_COMPAT)) { +- printf("WARNING: VOLSER cannot be kept " +- "when using the ldl format!\n"); +- exit(1); +- } ++ if (g.keep_volser) { ++ if (g.labelspec) ++ error("The -k and -l options are mutually exclusive"); ++ if (!(format_params.intensity & DASD_FMT_INT_COMPAT)) ++ error("WARNING: VOLSER cannot be kept when using the ldl format!"); + +- if (dasdfmt_get_volser(dev_filename, +- &info.dasd_info, old_volser) == 0) ++ if (dasdfmt_get_volser(old_volser) == 0) + vtoc_volume_label_set_volser(&vlabel, old_volser); + else +- ERRMSG_EXIT(EXIT_FAILURE, +- "%s: VOLSER not found on device %s\n", +- prog_name, dev_filename); ++ error("VOLSER not found on device %s", g.dev_path); + } + +- check_disk(&info, dev_filename); ++ check_disk(); + + if (check_param(str, ERR_LENGTH, &format_params) < 0) +- ERRMSG_EXIT(EXIT_MISUSE, "%s: %s\n", prog_name, str); ++ error("%s", str); + +- set_geo(&info, &cylinders, &heads); +- set_label(&info, &vlabel, &format_params, cylinders); ++ set_geo(&cylinders, &heads); ++ set_label(&vlabel, &format_params, cylinders); + +- if (info.check) +- check_disk_format(&info, cylinders, heads, &format_params); ++ if (g.check) ++ check_disk_format(cylinders, heads, &format_params); + else +- do_format_dasd(&info, dev_filename, &vlabel, +- &format_params, cylinders, heads); ++ do_format_dasd(&vlabel, &format_params, cylinders, heads); ++ ++ free(g.dev_path); ++ free(g.dev_node); + + return 0; + } +diff --git a/dasdfmt/dasdfmt.h b/dasdfmt/dasdfmt.h +index 2f53a0d..4d6fbb5 100644 +--- a/dasdfmt/dasdfmt.h ++++ b/dasdfmt/dasdfmt.h +@@ -41,6 +41,10 @@ static const char mode_str[3][10] = { + "Full", "Quick", "Expand" + }; + ++/* Report error, free memory, and exit */ ++static void error(const char *format, ...) ++ __attribute__((__noreturn__, __format__(__printf__, 1, 2))); ++ + #define DASD_PARTN_BITS 2 + #define PARTN_MASK ((1 << DASD_PARTN_BITS) - 1) + +@@ -65,47 +69,24 @@ static const char mode_str[3][10] = { + "is in invalid format\n",prog_name);} + + typedef struct bootstrap1 { +- u_int32_t key; +- u_int32_t data[6]; ++ u_int32_t key; ++ u_int32_t data[6]; + } __attribute__ ((packed)) bootstrap1_t; + + typedef struct bootstrap2 { +- u_int32_t key; +- u_int32_t data[36]; ++ u_int32_t key; ++ u_int32_t data[36]; + } __attribute__ ((packed)) bootstrap2_t; + +-typedef struct dasdfmt_info { +- dasd_information2_t dasd_info; +- int verbosity; +- int testmode; +- int withoutprompt; +- int print_progressbar; +- int print_hashmarks, hashstep; +- int print_percentage; +- int force; +- int writenolabel; +- int labelspec; +- int cdl_format; +- int blksize_specified; +- int reqsize_specified; +- int keep_volser; +- int force_host; +- int layout_specified; +- int check; +- int mode_specified; +- int ese; +- int no_discard; +-} dasdfmt_info_t; +- + + /* + C9D7D3F1 000A0000 0000000F 03000000 00000001 00000000 00000000 + */ + static bootstrap1_t ipl1 = { +- 0xC9D7D3F1, { +- 0x000A0000, 0x0000000F, 0x03000000, +- 0x00000001, 0x00000000, 0x00000000 +- } ++ 0xC9D7D3F1, { ++ 0x000A0000, 0x0000000F, 0x03000000, ++ 0x00000001, 0x00000000, 0x00000000 ++ } + }; + + /* +@@ -116,21 +97,20 @@ C9D7D3F2 07003AB8 40000006 31003ABE 40000005 08003AA0 00000000 06000000 + 00000000 00000000 00000000 00000000 00000000 + */ + static bootstrap2_t ipl2 = { +- 0xC9D7D3F2, { +- 0x07003AB8, 0x40000006, 0x31003ABE, +- 0x40000005, 0x08003AA0, 0x00000000, +- 0x06000000, 0x20000000, 0x00000000, +- 0x00000000, 0x00000400, 0x00000000, +- 0x00000000, 0x00000000, 0x00000000, +- 0x00000000, 0x00000000, 0x00000000, +- 0x00000000, 0x00000000, 0x00000000, +- 0x00000000, 0x00000000, 0x00000000, +- 0x00000000, 0x00000000, 0x00000000, +- 0x00000000, 0x00000000, 0x00000000, +- 0x00000000, 0x00000000, 0x00000000, +- 0x00000000, 0x00000000, 0x00000000 +- } ++ 0xC9D7D3F2, { ++ 0x07003AB8, 0x40000006, 0x31003ABE, ++ 0x40000005, 0x08003AA0, 0x00000000, ++ 0x06000000, 0x20000000, 0x00000000, ++ 0x00000000, 0x00000400, 0x00000000, ++ 0x00000000, 0x00000000, 0x00000000, ++ 0x00000000, 0x00000000, 0x00000000, ++ 0x00000000, 0x00000000, 0x00000000, ++ 0x00000000, 0x00000000, 0x00000000, ++ 0x00000000, 0x00000000, 0x00000000, ++ 0x00000000, 0x00000000, 0x00000000, ++ 0x00000000, 0x00000000, 0x00000000, ++ 0x00000000, 0x00000000, 0x00000000 ++ } + }; + + #endif /* DASDFMT_H */ +- +-- +2.26.2 + + +From 2157757448f02ae4e7060170ce7461ec802d46ae Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Dan=20Hor=C3=A1k?= +Date: Tue, 26 Jan 2021 11:56:51 +0100 +Subject: [PATCH 65/65] lscpumf: adjust output for raw event number (#1917854) + +Description: s390-tools: lscpumf adjust output for raw event number +Symptom: Output of command lscpumf -c displays the raw counter + always with a starting rXXX with XXX being a hex number. +Problem: This raw counter number is not valid when the PMU + measurement facility device driver has been registered + with a different type number than PERF_TYPE_RAW(4). In + this case the raw event number is :DDD with DDD + being a decimal number. + To find out with PMU type number has been assigned to + the PMU Measurement facility device driver, type command + cat /sys/devices/cpum_cf/type (for counters) + cat /sys/devices/cpum_cf/type (for sampling) +Solution: Read out the PMU type numbers assigned by the linux kernel + and output corresponding raw event format. +Reproduction: Run command lscpumf -c + Raw counter number should be displayed as rXXX with + XXX being hexdecimal number or Y:ZZZ with Y and ZZZ + being decimal numbers. +Upstream-ID: - +--- + cpumf/bin/lscpumf.in | 37 ++++++++++++++++++++++------- + cpumf/data/cpum-cf-extended-z15.ctr | 2 +- + 2 files changed, 30 insertions(+), 9 deletions(-) + +diff --git a/cpumf/bin/lscpumf.in b/cpumf/bin/lscpumf.in +index c705865..e55f12a 100644 +--- a/cpumf/bin/lscpumf.in ++++ b/cpumf/bin/lscpumf.in +@@ -258,15 +258,15 @@ out: + return 0; + } + +-sub print_counters($$) ++sub print_counters($$$) + { +- my ($ctrdef, $header) = @_; ++ my ($type, $ctrdef, $header) = @_; + my $set_name_map = invoke_cpumf_helper('--ctr-set-names'); + my $out = []; + + my ($ctr_perf, $ctr_num, $set, $name, $desc); + format PERF_CTR_FORM = +-r@<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ++@<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + $ctr_perf, $name + + ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +@@ -280,7 +280,11 @@ $ctr_perf, $name + print $header; + $~ = "PERF_CTR_FORM"; + foreach my $ctr (sort { $a <=> $b } keys %$ctrdef) { +- $ctr_perf = sprintf "%x", $ctr; ++ if ($type eq "r" or $type eq "4") { ++ $ctr_perf = sprintf "r%x", $ctr; ++ } else { ++ $ctr_perf = sprintf "$type:%d", $ctr; ++ } + $ctr_num = $ctr < (1 << 16) ? $ctr : ""; + $name = $ctrdef->{$ctr}->{name}; + $desc = $ctrdef->{$ctr}->{shortdesc} ? +@@ -297,6 +301,17 @@ $ctr_perf, $name + } + } + ++sub get_cpumf_type($) ++{ ++ my $f = shift(); ++ ++ open my $fh, '<', $f or die "Can't open file $!"; ++ read $fh, my $file_content, -s $fh; ++ close $fh; ++ chomp($file_content); ++ return "$file_content"; ++} ++ + sub do_show_ctr($;$) + { + my $c = shift(); +@@ -317,6 +332,9 @@ sub do_show_ctr($;$) + return 3; + } + ++ # Retrieve cpumf type ++ my $cf_type = get_cpumf_type("/sys/devices/cpum_cf/type"); ++ + # Retrieve hardware type + my $hwtype = invoke_cpumf_helper("--hardware-type"); + my $model = length $hwtype->[1] ? "for $hwtype->[1]" : ""; +@@ -325,10 +343,10 @@ Perf event counter list $model + ============================================================================== + + Raw +-event Name Description ++event Name Description + ------------------------------------------------------------------------------ + EoHeader +- print_counters($ctrs, $header); ++ print_counters($cf_type, $ctrs, $header); + + return 0; + } +@@ -354,16 +372,19 @@ sub do_show_sf_events($) + return 3; + } + ++ # Retrieve cpumf type ++ my $sf_type = get_cpumf_type("/sys/devices/cpum_sf/type"); ++ + # Display sampling facility events (aka. counters) + my $header = <<"EoHeader"; + Perf events for activating the sampling facility + ============================================================================== + + Raw +-event Name Description ++event Name Description + ------------------------------------------------------------------------------ + EoHeader +- print_counters($events, $header); ++ print_counters($sf_type, $events, $header); + + return 0; + } +diff --git a/cpumf/data/cpum-cf-extended-z15.ctr b/cpumf/data/cpum-cf-extended-z15.ctr +index 0fc935c..f08c6af 100644 +--- a/cpumf/data/cpum-cf-extended-z15.ctr ++++ b/cpumf/data/cpum-cf-extended-z15.ctr +@@ -356,7 +356,7 @@ Short-Description:Increments by one for every DEFLATE CONVERSION CALL instructio + Description: + Increments by one for every DEFLATE CONVERSION CALL instruction executed + . +-Counter:265 Name:DFLT_CCERROR ++Counter:265 Name:DFLT_CCFINISH + Short-Description:Increments by one for every DEFLATE CONVERSION CALL instruction executed that ended in Condition Codes 0, 1 or 2 + Description: + Increments by one for every DEFLATE CONVERSION CALL instruction executed that ended in Condition Codes 0, 1 or 2 +-- +2.26.2 + diff --git a/SPECS/s390utils.spec b/SPECS/s390utils.spec index e47e001..6b598b5 100644 --- a/SPECS/s390utils.spec +++ b/SPECS/s390utils.spec @@ -9,7 +9,7 @@ Name: s390utils Summary: Utilities and daemons for IBM z Systems Group: System Environment/Base Version: 2.6.0 -Release: 33%{?dist} +Release: 33%{?dist}.2 Epoch: 2 License: MIT ExclusiveArch: s390 s390x @@ -875,6 +875,17 @@ User-space development files for the s390/s390x architecture. %changelog +* Thu Feb 04 2021 Dan Horák - 2:2.6.0-33.2 +- bump and rebuild +- Related: #1905085 #1912479 #1917853 #1917854 + +* Tue Jan 26 2021 Dan Horák - 2:2.6.0-33.1 +- lscpumf: adjust output for raw event number (#1917854) +- dasdfmt: Fix bad file descriptor error when running on symlinks (#1917853) +- zcryptstats: Fix handling of partial results with many domains (#1912479) +- libdasd: Fix dasd_get_host_access_count() (#1905085) +- Resolves: #1905085 #1912479 #1917853 #1917854 + * Fri Jul 31 2020 Dan Horák - 2:2.6.0-33 - cpacfstats: Bugfix to remove libpfm from cpacfstats (#1861779) - Resolves: (#1861779)