mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
dasdfmt: drop 'device_id' parameter
Drop device_id parameter from dasdfmt_info() and pass in 'optind' directly. Closes: #8 Signed-off-by: Hannes Reinecke <hare@suse.com> Acked-by: Jan Höppner <hoeppner@linux.vnet.ibm.com> Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
This commit is contained in:
committed by
Michael Holzheu
parent
0028f166aa
commit
496c257bf2
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user