SHA256
1
0
forked from pool/s390-tools
s390-tools/s390-tools-sles12sp3-dasdfmt-02-Fix-trailing-whitespace.patch
2017-02-21 11:14:26 +00:00

251 lines
7.3 KiB
Diff

Subject: [PATCH] [FEAT LS1501] dasdfmt: Add new formatting modes
From: Jan Höppner <hoeppner@linux.vnet.ibm.com>
Summary: dasdfmt: Add new formatting modes
Description: Introduce new formatting modes 'quick' and 'expand' to either
format an earlier formatted DASD that could potentially be
re-initialized very easily or format unformatted tracks at the
end of a device that was previously extended.
Also add the command line argument --check to provide a function
that checks a DASD volume for correct formatting.
Upstream-ID: -
Problem-ID: LS1501
Upstream-Description:
dasdfmt: Fix trailing whitespace
Signed-off-by: Jan Höppner <hoeppner@linux.vnet.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.vnet.ibm.com>
---
dasdfmt/dasdfmt.c | 58 +++++++++++++++++++++++++++---------------------------
1 file changed, 29 insertions(+), 29 deletions(-)
--- a/dasdfmt/dasdfmt.c
+++ b/dasdfmt/dasdfmt.c
@@ -133,7 +133,7 @@ static void program_interrupt_signal (in
rc = close(filedes);
if (rc)
- ERRMSG("%s: (signal handler) Unable to close device (%s)\n",
+ ERRMSG("%s: (signal handler) Unable to close device (%s)\n",
prog_name, strerror(errno));
signal (sig, SIG_DFL);
@@ -329,7 +329,7 @@ retry:
/*
- * check the volume serial for special
+ * check the volume serial for special
* characters and move blanks to the end
*/
static int check_volser(char *s, int devno)
@@ -345,7 +345,7 @@ static int check_volser(char *s, int dev
s[i] = ' ';
s[i] = toupper(s[i]);
}
- s[6] = 0x00;
+ s[6] = 0x00;
for (i=0; i<6; i++) {
if (s[i] == ' ')
@@ -416,16 +416,16 @@ static format_data_t ask_user_for_blksiz
break;
rc = sscanf(buffer,"%d%c", &params.blksize, &c);
- if ((rc == 2) && (c == '\n'))
+ if ((rc == 2) && (c == '\n'))
rc = 1;
- if (rc == -1)
+ if (rc == -1)
rc = 1; /* this happens, if enter is pressed */
- if (rc != 1)
+ if (rc != 1)
printf(" -- wrong input, try again.\n");
if (check_param(str, ERR_LENGTH, &params) < 0) {
- printf(" -- %s\n",str);
- rc = 0;
+ printf(" -- %s\n",str);
+ rc = 0;
}
} while (rc != 1);
@@ -479,7 +479,7 @@ static int dasdfmt_get_volser(char * dev
volume_label_t vlabel;
if ((f = open(devname, O_RDONLY)) == -1)
- ERRMSG_EXIT(EXIT_FAILURE,"%s: Unable to open device %s: %s\n",
+ ERRMSG_EXIT(EXIT_FAILURE,"%s: Unable to open device %s: %s\n",
prog_name, devname, strerror(errno));
if (ioctl(f, BIODASDINFO, &dasd_info) != 0)
@@ -491,7 +491,7 @@ static int dasdfmt_get_volser(char * dev
"failed (%s).\n", prog_name, strerror(errno));
if (close(f) != 0)
- ERRMSG("%s: error during close: %s\ncontinuing...\n",
+ ERRMSG("%s: error during close: %s\ncontinuing...\n",
prog_name, strerror(errno));
if ((strncmp(dasd_info.type, "ECKD", 4) == 0) &&
@@ -505,7 +505,7 @@ static int dasdfmt_get_volser(char * dev
return -1;
}
}
-
+
/*
* do all the labeling (volume label and initial VTOC)
*/
@@ -577,7 +577,7 @@ static void dasdfmt_write_labels(dasdfmt
rc = lseek(filedes, label_position, SEEK_SET);
if (rc != label_position)
ERRMSG_EXIT(EXIT_FAILURE, "%s: lseek command to %i failed "
- "(%s).\n", prog_name, label_position,
+ "(%s).\n", prog_name, label_position,
strerror(errno));
rc = write(filedes, ipl2_record, ipl2_record_len);
@@ -633,9 +633,9 @@ static void dasdfmt_write_labels(dasdfmt
rc = lseek(filedes, label_position, SEEK_SET);
if (rc != label_position)
ERRMSG_EXIT(EXIT_FAILURE, "%s: lseek command to %i failed "
- "(%s).\n", prog_name, label_position,
+ "(%s).\n", prog_name, label_position,
strerror(errno));
-
+
/* write VTOC FMT4 DSCB */
rc = write(filedes, &f4, sizeof(format4_label_t));
if (rc != sizeof(format4_label_t))
@@ -695,21 +695,21 @@ static void dasdfmt_format(dasdfmt_info_
"using the default.\n");
info->hashstep = 10;
}
-
+
if(!info->yast_mode) printf("Printing hashmark every %d cylinders.\n",
info->hashstep);
}
format_step.blksize = format_params->blksize;
format_step.intensity = format_params->intensity;
-
+
k = 0;
cyl = 1;
if ((info->print_progressbar || info->print_hashmarks) && !info->yast_mode)
printf("\n");
while (1) {
- p1 = -1;
+ p1 = -1;
p2 = 0;
if (k + heads * reqsize >= format_params->stop_unit)
reqsize = 1;
@@ -734,7 +734,7 @@ static void dasdfmt_format(dasdfmt_info_
tmp = cyl*50/cylinders;
for (j=1; j<=tmp; j++)
printf("#");
- for (j=tmp+1; j<=50; j++)
+ for (j=tmp+1; j<=50; j++)
printf("-");
printf("|%3d%%", p1);
}
@@ -758,15 +758,15 @@ static void dasdfmt_format(dasdfmt_info_
k += reqsize * heads;
cyl += reqsize;
}
- else
+ else
k += format_params->stop_unit % heads;
- if (k > format_params->stop_unit)
+ if (k > format_params->stop_unit)
break;
}
if ((info->print_progressbar || info->print_hashmarks) && !info->yast_mode)
- printf("\n\n");
+ printf("\n\n");
}
@@ -790,7 +790,7 @@ static void dasdfmt_prepare_and_format (
if (ioctl(filedes, BIODASDDISABLE, p) != 0)
ERRMSG_EXIT(EXIT_FAILURE, "%s: (prepare device) IOCTL "
- "BIODASDDISABLE failed. (%s)\n", prog_name,
+ "BIODASDDISABLE failed. (%s)\n", prog_name,
strerror(errno));
disk_disabled = 1;
@@ -798,7 +798,7 @@ static void dasdfmt_prepare_and_format (
if (ioctl(filedes, BIODASDFMT, &temp) != 0)
ERRMSG_EXIT(EXIT_FAILURE, "%s: (invalidate first track) IOCTL "
- "BIODASDFMT failed. (%s)\n", prog_name,
+ "BIODASDFMT failed. (%s)\n", prog_name,
strerror(errno));
/* except track 0 from standard formatting procss */
@@ -814,14 +814,14 @@ static void dasdfmt_prepare_and_format (
if (ioctl(filedes, BIODASDFMT, &temp) != 0)
ERRMSG_EXIT(EXIT_FAILURE, "%s: (re-validate first track) IOCTL"
- " BIODASDFMT failed (%s)\n", prog_name,
+ " BIODASDFMT failed (%s)\n", prog_name,
strerror(errno));
if (info->verbosity > 0) printf("Re-accessing the device...\n");
if (ioctl(filedes, BIODASDENABLE, p) != 0)
ERRMSG_EXIT(EXIT_FAILURE, "%s: (prepare device) IOCTL "
- "BIODASDENABLE failed. (%s)\n", prog_name,
+ "BIODASDENABLE failed. (%s)\n", prog_name,
strerror(errno));
disk_disabled = 0;
}
@@ -830,7 +830,7 @@ static void dasdfmt_prepare_and_format (
/*
*
*/
-static void do_format_dasd(dasdfmt_info_t *info, format_data_t *p,
+static void do_format_dasd(dasdfmt_info_t *info, format_data_t *p,
volume_label_t *vlabel)
{
char inp_buffer[5];
@@ -943,7 +943,7 @@ static void do_format_dasd(dasdfmt_info_
if (!info->yast_mode)
printf("Finished formatting the device.\n");
- if (!info->writenolabel)
+ if (!info->writenolabel)
dasdfmt_write_labels(info, vlabel, cylinders, heads);
if (!info->yast_mode)
@@ -959,7 +959,7 @@ static void do_format_dasd(dasdfmt_info_
}
-int main(int argc,char *argv[])
+int main(int argc,char *argv[])
{
dasdfmt_info_t info;
volume_label_t vlabel;
@@ -1001,7 +1001,7 @@ int main(int argc,char *argv[])
rc=getopt_long(argc, argv, dasdfmt_getopt_string,
dasdfmt_getopt_long_options, &index);
- switch (rc)
+ switch (rc)
{
case 'F':
info.force=1;