SHA256
1
0
forked from pool/s390-tools
s390-tools/s390-tools-sles15-Drop-device_id-parameter.patch

82 lines
2.5 KiB
Diff
Raw Normal View History

From 320946c0e9b2a80c3569d8f736621c99392fc413 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 5 Oct 2017 10:11:57 +0200
Subject: [PATCH] dasdfmt: drop 'device_id' parameter
Drop device_id parameter from dasdfmt_info() and pass in 'optind'
directly.
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
dasdfmt/dasdfmt.c | 15 +++++++--------
dasdfmt/dasdfmt.h | 1 -
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/dasdfmt/dasdfmt.c b/dasdfmt/dasdfmt.c
index 3da7902..b79cff0 100644
--- a/dasdfmt/dasdfmt.c
+++ b/dasdfmt/dasdfmt.c
@@ -456,24 +456,24 @@ static void program_interrupt_signal(int sig)
/*
* check given device name for blanks and some special characters
*/
-static void get_device_name(dasdfmt_info_t *info, char *devname, int argc,
- char *argv[])
+static void get_device_name(char *devname,
+ int optind, int argc, char *argv[])
{
struct util_proc_dev_entry dev_entry;
struct stat dev_stat;
- if (info->device_id + 1 < argc)
+ if (optind + 1 < argc)
ERRMSG_EXIT(EXIT_MISUSE,
"%s: More than one device specified!\n", prog_name);
- if (info->device_id >= argc)
+ if (optind >= argc)
ERRMSG_EXIT(EXIT_MISUSE, "%s: No device specified!\n",
prog_name);
- if (strlen(argv[info->device_id]) >= PATH_MAX)
+ if (strlen(argv[optind]) >= PATH_MAX)
ERRMSG_EXIT(EXIT_MISUSE, "%s: device name too long!\n",
prog_name);
- strcpy(devname, argv[info->device_id]);
+ strcpy(devname, argv[optind]);
if (stat(devname, &dev_stat) != 0)
ERRMSG_EXIT(EXIT_MISUSE, "%s: Could not get information for "
@@ -1604,7 +1604,6 @@ int main(int argc, char *argv[])
break;
case -1:
/* End of options string - start of devices list */
- info.device_id = optind;
break;
default:
ERRMSG_EXIT(EXIT_MISUSE, "Try '%s --help' for more"
@@ -1635,7 +1634,7 @@ int main(int argc, char *argv[])
if (info.print_hashmarks)
PARSE_PARAM_INTO(info.hashstep, hashstep_str, 10, "hashstep");
- get_device_name(&info, dev_filename, argc, argv);
+ get_device_name(dev_filename, optind, argc, argv);
filedes = open(dev_filename, O_RDWR);
if (filedes == -1)
diff --git a/dasdfmt/dasdfmt.h b/dasdfmt/dasdfmt.h
index 9ce3b92..a5581f1 100644
--- a/dasdfmt/dasdfmt.h
+++ b/dasdfmt/dasdfmt.h
@@ -303,7 +303,6 @@ typedef struct dasdfmt_info {
int cdl_format;
int blksize_specified;
int reqsize_specified;
- int device_id;
int keep_volser;
int force_host;
int layout_specified;
--
1.7.12.4