File s390-tools-sles15-Implement-f-for-backwards-compability.patch of Package s390-tools

From 8f05578d90df49dce6e13ee850fdc8bab84916ba Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Fri, 6 Oct 2017 12:23:32 +0200
Subject: [PATCH] dasdfmt: Implement '-f' for backwards compability

YaST is calling dasdfmt with '-f device', which used to be the old
calling convention. So to not keel over when used with an older
version of YaST we should accept this option, too.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 dasdfmt/dasdfmt.8 | 6 +++++-
 dasdfmt/dasdfmt.c | 8 ++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/dasdfmt/dasdfmt.8 b/dasdfmt/dasdfmt.8
index 3fd10a2..7fdb4bd 100644
--- a/dasdfmt/dasdfmt.8
+++ b/dasdfmt/dasdfmt.8
@@ -11,7 +11,7 @@ dasdfmt \- formatting of DASD (ECKD) disk drives.
 .br
         [-r \fIcylinder\fR] [-b \fIblksize\fR] [-l \fIvolser\fR] [-d \fIlayout\fR]
 .br
-        [-L] [-V] [-F] [-k] [-C] [-M \fImode\fR] \fIdevice\fR [\fIdevice\fR]
+        [-L] [-V] [-F] [-k] [-C] [-M \fImode\fR] [-f \fIdevice\fR] [\fIdevice\fR]
 
 .SH DESCRIPTION
 \fBdasdfmt\fR formats one or several DASD (ECKD) disk drive to prepare it
@@ -42,6 +42,10 @@ out, what it \fBwould\fR do.
 Increases verbosity.
 
 .TP
+\fB-f\fR \fIdevice\fR or \fB--device\fR=\fIdevice\fR
+Specify device to format. For backwards compability only.
+
+.TP
 \fB-y\fR 
 Start formatting without further user-confirmation.
 
diff --git a/dasdfmt/dasdfmt.c b/dasdfmt/dasdfmt.c
index 5b6023a..cdd80df 100644
--- a/dasdfmt/dasdfmt.c
+++ b/dasdfmt/dasdfmt.c
@@ -77,6 +77,10 @@ static struct util_opt opt_vec[] = {
 		.desc = "Format devices in parallel",
 		.flags = UTIL_OPT_FLAG_NOLONG,
 	},
+	{
+		.option = { "device", required_argument, NULL, 'f' },
+		.desc = "Spedify device to format",
+	},
 	UTIL_OPT_SECTION("FORMAT OPTIONS"),
 	{
 		.option = { "blocksize", required_argument, NULL, 'b' },
@@ -1649,6 +1653,10 @@ int main(int argc, char *argv[])
 			}
 			info.layout_specified = 1;
 			break;
+		case 'f':
+			get_device_name(dev_filename, numdev, optarg);
+			numdev++;
+			break;
 		case 'y':
 			info.withoutprompt = 1;
 			break;
-- 
1.7.12.4

openSUSE Build Service is sponsored by