SHA256
1
0
forked from pool/s390-tools
s390-tools/s390-tools-sles15sp3-Implement-Y-yast_mode.patch
Nikolay Gueorguiev 6a6c0cb679 * Upgrade s390-tools to version 2.34 (jsc#PED-3223,jsc#PED-9591)
*** v2.34.0
* Changes of existing tools:
  - ap_tools/ap-check: Add support for vfio-ap dynamic configuration
  - dbginfo.sh: Update/Add additional DASD data collection
  - dumpconf: Add new parameter 'SCP_DATA' for SCSI/NVMe/ECKD dump devices
  - libutil: Make formatted meta-data configurable
  - s390-tools: Replace 'which' with built-in 'command -v'
  - zdump/dfi_elf: Support core dumps of vr-kernels
* Bug Fixes:
  - chzdev: Fix warning about failed ATTR writes by udev
  - rust/pv: Try again if first CRL-URI is invalid
  - rust/pvattest: Add short option for --arpk
  - zdump: Fix 'zgetdump -i' ioctl error on s390 formatted dump file
*** v2.33.1
* Bug Fixes:
  - s390-tools: Fix formatting and typos in README.md
  - s390-tools: Fix release string
*** v2.33.0
* Add new tools / libraries:
  - chpstat: New tool for displaying channel path statistics
  - libutil: Add output format helpers(util_fmt: JSON, JSON-SEQ, CSV, text pairs)
* Changes of existing tools / libraries:
  - chzdev: Add --is-owner to identify files created by zdev
  - dasdfmt: Change default mode to always use full-format (Note: affects ESE DASD)
  - libap: Significantly reduce delay time between file lock retries
  - pvattest: Rewrite from C to Rust
  - pvattest: Support additional data & user-data
  - rust/pv: Support for Attestation
* Bug Fixes:
  - chreipl: Improve disk type detection when running under QEMU
  - dbginfo.sh: Use POSIX option with uname
  - s390-tools: Fix missing hyphen escapes in the man page for many tools
  - zipl/src: Fix bugs in disk_get_info() reproducible in corner cases
 *** v2.32.0
* Changes of existing tools:
  - cpumf/lscpumf: add support for machine type 3932
  - genprotimg, pvattest, and pvsecret accept IBM signing key with Armonk as
    subject locality
  - zdump/zipl: Support for List-Directed dump from ECKD DASD
  - zkey: Detect FIPS mode and generate PBKDF for luksFormat according to it
* Bug Fixes:
  - dbginfo.sh: dash compatible copy sequence
  - rust/pv_core: Fix UvDeviceInfo::get() method
  - zipl/src: Fix leak of files if run with a broken configuration
  - zkey: Fix convert command to accept only keys of type CCA-AESDATA
* Revendored vendor.tar.gz
* Removed obsolete patches
  - s390-tools-sles15sp5-01-rust-pv-support-Armonk-in-IBM-signing-key-subject.patch
  - s390-tools-sles15sp6-02-genprotimg-support-Armonk-in-IBM-signing-key-subject.patch
  - s390-tools-sles15sp6-03-libpv-support-Armonk-in-IBM-signing-key-subject.patch
  - s390-tools-sles15sp6-04-pvattest-Fix-root-ca-parsing.patch
  - s390-tools-sles15sp6-genprotimg-makefile.patch

OBS-URL: https://build.opensuse.org/package/show/Base:System/s390-tools?expand=0&rev=219
2024-08-20 08:44:18 +00:00

197 lines
4.9 KiB
Diff

From eabcb26fa4a91d410a6f75a9915a9ebb9f702c6b Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Fri, 6 Oct 2017 09:55:40 +0200
Subject: [PATCH] dasdfmt: Implement '-Y/--yast_mode'
Implement an option '-Y' to suppress most output.
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
dasdfmt/dasdfmt.8 | 7 ++++-
dasdfmt/dasdfmt.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++------
2 files changed, 72 insertions(+), 8 deletions(-)
--- a/dasdfmt/dasdfmt.8
+++ b/dasdfmt/dasdfmt.8
@@ -7,7 +7,7 @@
dasdfmt \- formatting of DASD (ECKD) disk drives.
.SH SYNOPSIS
-\fBdasdfmt\fR [\-h] [\-t] [\-v] [\-y] [\-p] [\-Q] [\-P] [\-m \fIstep\fR]
+\fBdasdfmt\fR [\-h] [\-t] [\-v] [\-y] [\-p] [\-Q] [\-P] [\-Y] [\-m \fIstep\fR]
.br
[\-r \fIcylinder\fR] [\-b \fIblksize\fR] [\-l \fIvolser\fR] [\-d \fIlayout\fR]
.br
@@ -112,6 +112,11 @@
.br
.TP
+\fB-Y\fR or \fB--yast_mode\fR
+YaST mode; suppress most output.
+.br
+
+.TP
\fB\-M\fR \fImode\fR or \fB\-\-mode\fR=\fImode\fR
Specify the \fImode\fR to be used to format the device. Valid modes are:
.RS
--- a/dasdfmt/dasdfmt.c
+++ b/dasdfmt/dasdfmt.c
@@ -83,6 +83,7 @@
int ese;
int no_discard;
int procnum;
+ int yast_mode;
} g = {
.dasd_info = { 0 },
};
@@ -172,6 +173,10 @@
.option = { "percentage", no_argument, NULL, 'Q' },
.desc = "Show progress in percent",
},
+ {
+ .option = { "yast_mode", no_argument, NULL, 'Y' },
+ .desc = "YaST mode",
+ },
UTIL_OPT_SECTION("MISC"),
{
.option = { "check_host_count", no_argument, NULL, 'C' },
@@ -318,7 +323,9 @@
}
if (g.print_hashmarks && (cyl / g.hashstep - hashcount) != 0) {
- printf("%d|", g.procnum);
+ if (g.yast_mode)
+ printf("%d|", g.procnum);
+ else printf("#");
fflush(stdout);
hashcount++;
}
@@ -392,7 +399,7 @@
unsigned int kl = 0;
int blksize = cdata->expect.blksize;
- if (g.print_progressbar || g.print_hashmarks)
+ if ((g.print_progressbar || g.print_hashmarks) && !g.yast_mode)
printf("\n");
/*
@@ -780,8 +787,9 @@
g.hashstep = 10;
}
- printf("Printing hashmark every %d cylinders.\n",
- g.hashstep);
+ if (!g.yast_mode)
+ printf("Printing hashmark every %d cylinders.\n",
+ g.hashstep);
}
}
@@ -1462,17 +1470,19 @@
break;
}
- printf("Finished formatting the %s device.\n", g.dev_path);
+ if (!g.yast_mode)
+ printf("Finished formatting the %s device.\n", g.dev_path);
if (!(g.writenolabel || mode == EXPAND))
dasdfmt_write_labels(vlabel, cylinders, heads);
- printf("Rereading the partition table for %s... ", g.dev_path);
+ if (!g.yast_mode)
+ printf("Rereading the partition table for %s... ", g.dev_path);
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));
- } else {
+ } else if (!g.yast_mode) {
printf("ok\n");
}
}
@@ -1548,6 +1558,7 @@
error("%s", str);
set_geo(&cylinders, &heads);
+
set_label(&vlabel, &format_params, cylinders);
if (g.check)
@@ -1557,6 +1568,29 @@
}
+static void yast_print_cylinfo(const char *dev_filename)
+{
+ unsigned int cylinders = -1u;
+ int fd;
+ dasd_information2_t dasd_info;
+ struct dasd_eckd_characteristics *characteristics;
+
+ fd = open(dev_filename, O_RDONLY);
+ if ((fd != -1) && ( ! ioctl(fd, BIODASDINFO2, &dasd_info))) {
+
+ characteristics = (struct dasd_eckd_characteristics *) &dasd_info.characteristics;
+ if (characteristics->no_cyl == LV_COMPAT_CYL && characteristics->long_no_cyl)
+ cylinders = characteristics->long_no_cyl;
+ else
+ cylinders = characteristics->no_cyl;
+ }
+
+ if (fd != -1)
+ close(fd);
+ printf("%u\n", cylinders);
+ fflush(stdout);
+}
+
int main(int argc, char *argv[])
{
volume_label_t vlabel;
@@ -1693,6 +1727,10 @@
case OPT_NODISCARD:
g.no_discard = 1;
break;
+ case 'Y':
+ /* YaST mode */
+ g.yast_mode = 1;
+ break;
case 'P':
max_parallel = atoi(optarg);
break;
@@ -1728,6 +1766,21 @@
reqsize = DEFAULT_REQUESTSIZE;
}
+/* If -Y (YaST mode) was specified by the caller, then we need to suppress
+ * most of all the other output that might be generated. But, we _do_ want
+ * hashmarks printed so that YaST can track what's going on. If it wasn't
+ * specified on the command line, set it to a default of 10 cylinders.
+ */
+ if (g.yast_mode) {
+ g.verbosity = 0;
+ g.print_progressbar = 0;
+ g.print_percentage = 0;
+ if (! g.print_hashmarks) {
+ g.print_hashmarks = 1;
+ hashstep_str = "10";
+ }
+ }
+
if (g.print_hashmarks)
PARSE_PARAM_INTO(g.hashstep, hashstep_str, 10, "hashstep");
@@ -1747,6 +1800,12 @@
if (numdev > 1 && g.labelspec)
error("Specifying a volser to be written doesn't make sense when formatting multiple DASD volumes.");
+ if (g.yast_mode) {
+ for (numproc = 0; numproc < numdev; numproc++)
+ yast_print_cylinfo(g.dev_path_array[numproc]);
+
+ }
+
for (numproc = 0; numproc < numdev; numproc++) {
chpid = fork();
if (chpid == -1 )