Accepting request 531962 from Base:System
Upgrade to version 2.1.0 per Fate#323291. OBS-URL: https://build.opensuse.org/request/show/531962 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/s390-tools?expand=0&rev=8
This commit is contained in:
commit
24761c730a
@ -8,7 +8,7 @@
|
||||
-# on device add set request queue scheduler to deadline
|
||||
-SUBSYSTEM!="block", GOTO="sched_end"
|
||||
-
|
||||
-ACTION!="add", GOTO="sched_end"
|
||||
-KERNEL=="dasd*[!0-9]", WAIT_FOR="queue/scheduler", ATTR{queue/scheduler}="deadline"
|
||||
-ACTION!="change", GOTO="sched_end"
|
||||
-KERNEL=="dasd*[!0-9]", TEST=="queue/scheduler", ATTR{queue/scheduler}="deadline"
|
||||
-
|
||||
-LABEL="sched_end"
|
||||
|
56
boot.cpi
56
boot.cpi
@ -1,56 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2001-2002 SuSE Linux AG, Nuernberg, Germany.
|
||||
# Copyright (c) 2008 SuSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# All rights reserved.
|
||||
#
|
||||
# /etc/init.d/boot.cpi
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: boot.cpi
|
||||
# Required-Start: boot.rootfsck
|
||||
# Required-Stop: $null
|
||||
# Should-Start:
|
||||
# X-Start-Before:
|
||||
# Default-Start: B S
|
||||
# Default-Stop:
|
||||
# Description: Set Control Program Identification data
|
||||
# Short-Description: Set Control Program Identification data
|
||||
### END INIT INFO
|
||||
|
||||
. /etc/rc.status
|
||||
. /etc/sysconfig/cpi
|
||||
|
||||
rc_reset
|
||||
|
||||
case "$1" in
|
||||
start|restart|reload)
|
||||
if test "$CPI_SET" == "yes"; then
|
||||
if test ! -e /sys/firmware/cpi; then
|
||||
echo -n "sclp_cpi interface not found"
|
||||
rc_status -s
|
||||
rc_exit
|
||||
fi
|
||||
echo "$CPI_SYSTEM_NAME" >/sys/firmware/cpi/system_name
|
||||
echo "$CPI_SYSPLEX_NAME" >/sys/firmware/cpi/sysplex_name
|
||||
echo "LINUX " >/sys/firmware/cpi/system_type
|
||||
awk "BEGIN { split(\"`uname -r`\",x,\".\"); printf(\"0x0000000000%02x%02x%02x\", x[1],x[2],x[3]) }" >/sys/firmware/cpi/system_level
|
||||
echo 1 >/sys/firmware/cpi/set 2>/dev/null
|
||||
rc_status -v -r
|
||||
else
|
||||
rc_status -u
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
rc_status -s
|
||||
;;
|
||||
status)
|
||||
rc_status -s
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|status|restart|reload}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
rc_exit
|
@ -23,49 +23,44 @@ diff --git a/dasdfmt/dasdfmt.c b/dasdfmt/dasdfmt.c
|
||||
index e1877ac..f03cbad 100644
|
||||
--- a/dasdfmt/dasdfmt.c
|
||||
+++ b/dasdfmt/dasdfmt.c
|
||||
@@ -270,7 +270,7 @@ static void init_info(dasdfmt_info_t *info)
|
||||
@@ -588,7 +616,7 @@
|
||||
*/
|
||||
static void check_disk(dasdfmt_info_t *info)
|
||||
{
|
||||
dasd_information_t dasd_info;
|
||||
- int ro, errno_save;
|
||||
+ int ro, errno_save, i = 0;
|
||||
|
||||
if (ioctl(filedes, BLKROGET, &ro) != 0) {
|
||||
errno_save = errno;
|
||||
@@ -283,7 +283,7 @@ static void check_disk(dasdfmt_info_t *info)
|
||||
if (ro) {
|
||||
@@ -602,9 +630,27 @@
|
||||
if (ro)
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "Disk is read only!\n");
|
||||
}
|
||||
-
|
||||
+retry:
|
||||
if (ioctl(filedes, BIODASDINFO, &dasd_info) != 0) {
|
||||
errno_save = errno;
|
||||
close(filedes);
|
||||
@@ -294,8 +294,23 @@ static void check_disk(dasdfmt_info_t *info)
|
||||
}
|
||||
|
||||
if (!info->force)
|
||||
- if (dasd_info.open_count > 1)
|
||||
- if (!info->force)
|
||||
+ if (!info->force) {
|
||||
+ /*
|
||||
+ * udev strikes again.
|
||||
+ * Modern udev will issue a 'change' event whenever
|
||||
+ * a device opened with O_RDWR is closed again.
|
||||
+ * On the ground that program _might_ have changed
|
||||
+ * On the grounds that program _might_ have changed
|
||||
+ * the partition table.
|
||||
+ * And confusing the hell out ouf anyone else.
|
||||
+ * Bah.
|
||||
+ */
|
||||
+ if (dasd_info.open_count > 1) {
|
||||
+ if (i < 5) {
|
||||
+ ++i;
|
||||
+ */
|
||||
+ for ( i = 0 ; i < 6 ; i++ ) {
|
||||
+ if (info->dasd_info.open_count > 1) {
|
||||
+ get_device_info(info);
|
||||
+ sleep(1);
|
||||
+ goto retry;
|
||||
+ }
|
||||
ERRMSG_EXIT(EXIT_BUSY, "Disk in use!\n");
|
||||
+ else break;
|
||||
+
|
||||
+ }
|
||||
if (info->dasd_info.open_count > 1)
|
||||
ERRMSG_EXIT(EXIT_BUSY, "Disk in use!\n");
|
||||
+ }
|
||||
|
||||
info->usage_count = dasd_info.open_count;
|
||||
info->devno = dasd_info.devno;
|
||||
if (strncmp(info->dasd_info.type, "ECKD", 4) != 0) {
|
||||
ERRMSG_EXIT(EXIT_FAILURE,
|
||||
--
|
||||
1.8.4.5
|
||||
|
||||
|
2
mkdump.8
2
mkdump.8
@ -6,7 +6,7 @@ mkdump \- Preparing disks for use as S/390 dump device.
|
||||
.B mkdump
|
||||
[\fIOPTIONS\fR] [\fIDEVICE\fR]...
|
||||
.SH DESCRIPTION
|
||||
mkdump 2.0.2
|
||||
mkdump 2.0.3
|
||||
.PP
|
||||
Prepare one or more volumes for use as S/390 dump device. Supported devices
|
||||
are ECKD DASD and SCSI over zFCP disks, while multi\-volumes are limited to DASD.
|
||||
|
24
mkdump.pl
24
mkdump.pl
@ -4,7 +4,8 @@
|
||||
# mkdump.pl - Preparing disks for use as S/390 dump device
|
||||
#
|
||||
# Copyright (c) 2011 Tim Hardeck, SUSE LINUX Products GmbH
|
||||
# bases on mkdump.sh (c) 2004 Hannes Reinecke, SuSE AG
|
||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Based on mkdump.sh (c) 2004 Hannes Reinecke, SuSE AG
|
||||
#
|
||||
# License:
|
||||
#
|
||||
@ -30,7 +31,7 @@ use warnings;
|
||||
use Fcntl;
|
||||
use Getopt::Long;
|
||||
|
||||
my $VERSION = "2.0.2";
|
||||
my $VERSION = "2.0.3";
|
||||
|
||||
my $BLKID = "/sbin/blkid";
|
||||
my $PARTED = "/usr/sbin/parted";
|
||||
@ -41,7 +42,6 @@ my $ZIPL = "/sbin/zipl";
|
||||
my $UDEVADM = "/sbin/udevadm";
|
||||
my $ZGETDUMP = "/sbin/zgetdump";
|
||||
|
||||
my $MNTPOINT = "/var/run/mkdump." . getppid();
|
||||
# temporary DASD device configuration file for Zipl
|
||||
my $MDPATH = "/tmp/mvdump.conf";
|
||||
# zFCP dump dir, without a leading '/'
|
||||
@ -57,11 +57,6 @@ sub cleanup
|
||||
if (-e $MDPATH) {
|
||||
system("rm -f $MDPATH");
|
||||
}
|
||||
# zFCP
|
||||
if (-d $MNTPOINT) {
|
||||
system("umount $MNTPOINT");
|
||||
system("rmdir $MNTPOINT");
|
||||
}
|
||||
}
|
||||
|
||||
sub exit_with
|
||||
@ -230,15 +225,10 @@ sub print_device
|
||||
$output .= "\t$adapter\t$wwpn\t$lun";
|
||||
|
||||
# check for dump record
|
||||
system("mkdir -p $MNTPOINT");
|
||||
if (get_partition_num($device) == 1 and system("mount -o ro ${device}1 $MNTPOINT 2>/dev/null") == 0) {
|
||||
if ( -r "$MNTPOINT/bootmap" and -d "$MNTPOINT/$ZFCP_DUMP_DIR") {
|
||||
$dump_device = 1;
|
||||
$output .= "\tdumpdevice";
|
||||
}
|
||||
system("umount $MNTPOINT");
|
||||
if (system("$ZGETDUMP -d ${device} >/dev/null 2>&1") == 0) {
|
||||
$dump_device = 1;
|
||||
$output .= "\tdumpdevice";
|
||||
}
|
||||
system("rmdir $MNTPOINT");
|
||||
}
|
||||
if ($only_dump_disks) {
|
||||
if ($dump_device) {
|
||||
@ -324,7 +314,7 @@ sub prepare_dasd
|
||||
# check formatting
|
||||
for my $device (@devices) {
|
||||
# determine disk layout
|
||||
my ($fmtstr) = `$DASDVIEW -x -f $device` =~ /(\w\w\w) formatted/;
|
||||
my ($fmtstr) = `$DASDVIEW -x $device` =~ /(\w\w\w) formatted/;
|
||||
|
||||
SWITCH:
|
||||
for($fmtstr) {
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6f4e9d6f27cfad77ff84ac7a332a7fb2e17b620b3c2da4fc2ba47d2c77c94287
|
||||
size 814967
|
3
s390-tools-2.1.0.tar.gz
Normal file
3
s390-tools-2.1.0.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b5ce3fa0de074dfe7d16c74771fcb5092c4a6f575168bf4e13f88275a6370122
|
||||
size 1046910
|
@ -19,27 +19,9 @@ diff --git a/fdasd/fdasd.c b/fdasd/fdasd.c
|
||||
index 4503d3e..f04dc3d 100644
|
||||
--- a/fdasd/fdasd.c
|
||||
+++ b/fdasd/fdasd.c
|
||||
@@ -826,7 +826,7 @@ fdasd_check_conffile_input (fdasd_anchor_t *anc,
|
||||
* Verifies the specified block device.
|
||||
*/
|
||||
static void
|
||||
-fdasd_verify_device (fdasd_anchor_t *anc, char *name)
|
||||
+fdasd_verify_device (fdasd_anchor_t *anc, char *name)
|
||||
{
|
||||
struct stat dst;
|
||||
char err_str[ERROR_STRING_SIZE];
|
||||
@@ -847,7 +847,7 @@ fdasd_verify_device (fdasd_anchor_t *anc, char *name)
|
||||
fdasd_error(anc, device_verification_failed, err_str);
|
||||
@@ -1247,9 +1247,12 @@
|
||||
}
|
||||
|
||||
- if (minor (dst.st_rdev) & PARTN_MASK) {
|
||||
+ if (!anc->force_virtual && minor (dst.st_rdev) & PARTN_MASK) {
|
||||
snprintf(err_str, ERROR_STRING_SIZE,
|
||||
"Partition '%s' (%d/%d) detected where device is "
|
||||
"required\n", name,
|
||||
@@ -1156,9 +1156,12 @@ fdasd_reread_partition_table (fdasd_anchor_t *anc)
|
||||
}
|
||||
|
||||
if (ioctl(fd, BLKRRPART, NULL) != 0) {
|
||||
- close(fd);
|
||||
- fdasd_error(anc, unable_to_ioctl, "Error while rereading "
|
||||
@ -52,6 +34,4 @@ index 4503d3e..f04dc3d 100644
|
||||
+ }
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
--
|
||||
1.8.5.2
|
||||
}
|
||||
|
@ -10,12 +10,12 @@
|
||||
- [-r \fIcylinder\fR] [-b \fIblksize\fR] [-l \fIvolser\fR] [-d \fIlayout\fR]
|
||||
+ [-r \fIcylinder\fR] [-b \fIblksize\fR] [-l \fIvolser\fR] [-d \fIlayout\fR] [-P maxpar]
|
||||
.br
|
||||
- [-L] [-V] [-F] [-k] [-C] \fIdevice\fR
|
||||
+ [-L] [-V] [-F] [-k] [-C] \fIdevice\fR ...
|
||||
- [-L] [-V] [-F] [-k] [-C] [-M \fImode\fR] \fIdevice\fR
|
||||
+ [-L] [-V] [-F] [-k] [-C] [-M \fImode\fR] \fIdevice\fR ...
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBdasdfmt\fR formats a DASD (ECKD) disk drive to prepare it
|
||||
@@ -91,7 +91,7 @@
|
||||
@@ -95,7 +95,7 @@
|
||||
running in background or redirecting the output to a file.
|
||||
|
||||
.TP
|
||||
@ -24,7 +24,7 @@
|
||||
Print one line for each formatted cylinder showing the number of the
|
||||
cylinder and percentage of formatting process.
|
||||
Intended to be used by higher level interfaces.
|
||||
@@ -123,6 +123,20 @@
|
||||
@@ -152,6 +152,20 @@
|
||||
and always be a power of two. The recommended blocksize is 4096 bytes.
|
||||
|
||||
.TP
|
||||
@ -47,7 +47,7 @@
|
||||
to disk after formatting. If no label is specified, a sensible default
|
||||
--- s390-tools-1.34.0/dasdfmt/dasdfmt.h 2016-04-14 16:43:51.000000000 -0400
|
||||
+++ s390-tools-1.34.0/dasdfmt/dasdfmt.h 2016-04-14 16:35:01.000000000 -0400
|
||||
@@ -195,6 +195,7 @@
|
||||
@@ -260,6 +260,7 @@
|
||||
#define LABEL_LENGTH 14
|
||||
#define VLABEL_CHARS 84
|
||||
#define LINE_LENGTH 80
|
||||
|
@ -1,13 +1,16 @@
|
||||
--- s390-tools-1.24.1/zipl/boot/menu.c 2013-12-18 11:11:45.000000000 -0500
|
||||
+++ s390-tools-1.24.1/zipl/boot/menu.c 2013-12-18 11:59:18.000000000 -0500
|
||||
@@ -166,7 +166,9 @@
|
||||
@@ -167,8 +167,11 @@
|
||||
/* print config list */
|
||||
menu_list();
|
||||
|
||||
if (is_zvm())
|
||||
- if (is_zvm())
|
||||
- printf("Note: VM users please use '#cp vi vmsg <input>'\n");
|
||||
+ if (is_zvm()) {
|
||||
+ printf(" \n");
|
||||
+ printf("Note: VM users please use '#cp vi vmsg <input> <kernel-parameters>'\n");
|
||||
+ printf(" \n");
|
||||
+ }
|
||||
|
||||
value = menu_read();
|
||||
|
||||
|
@ -1,35 +0,0 @@
|
||||
Subject: [PATCH] [BZ 141695] chiucvallow: correct verification return code
|
||||
From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
|
||||
|
||||
Description: chiucvallow: correct verification return code
|
||||
Symptom: When running test_chiucvallow.sh, the script is
|
||||
failing to validate filter files with special
|
||||
characters.
|
||||
because the chiucvallow.in -V is
|
||||
Problem: The chiucvallow -V is returning code 2 and for
|
||||
this reason, the script gives an error message,
|
||||
but the filter file is validated successfully
|
||||
manually.
|
||||
Solution: Correct the return code of chiucvallow to handle
|
||||
verification failures correctly.
|
||||
Reproduction: See Symptom.
|
||||
Upstream-ID: -
|
||||
Problem-ID: 141695
|
||||
|
||||
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
|
||||
---
|
||||
iucvterm/bin/chiucvallow.in | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/iucvterm/bin/chiucvallow.in
|
||||
+++ b/iucvterm/bin/chiucvallow.in
|
||||
@@ -115,7 +115,8 @@ verify_filter(){
|
||||
|
||||
printf "\n$PRG: Verification summary: verified=%d failed=%d size=%d bytes\n" \
|
||||
$count $failed $fsize
|
||||
- return 2
|
||||
+
|
||||
+ test $failed -eq 0 || return 2
|
||||
}
|
||||
|
||||
#
|
@ -1,49 +0,0 @@
|
||||
Subject: [PATCH] [BZ 143839] chreipl/virtio: fix chreipl node for virtio-blk disks
|
||||
From: Christian Borntraeger <borntraeger@de.ibm.com>
|
||||
|
||||
Description: chreipl/virtio: fix chreipl node for virtio-blk disks
|
||||
Symptom: chreipl node <mount point> for a virtio-blk disk fails:
|
||||
Could not find DASD CCW device "virtio1"
|
||||
Problem: The sysfs walking code to resolve the device is not
|
||||
handling virtio devices correctly.
|
||||
Solution: Use the realpath of the device to get the busid for all
|
||||
supported devices.
|
||||
Reproduction: Run chreipl node <mountpoint> with virtio-blk devices as
|
||||
backing for mount point.
|
||||
Upstream-ID: -
|
||||
Problem-ID: 143839
|
||||
|
||||
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
|
||||
---
|
||||
ipl_tools/ccw.c | 12 +++++-------
|
||||
1 file changed, 5 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/ipl_tools/ccw.c
|
||||
+++ b/ipl_tools/ccw.c
|
||||
@@ -76,21 +76,19 @@ out_fclose:
|
||||
static int ccw_busid_get_sysfs_new(const char *device, char *busid)
|
||||
{
|
||||
char path[PATH_MAX], buf[4096];
|
||||
- char *ptr;
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
snprintf(path, sizeof(path), "/sys/block/%s/device", device);
|
||||
- if (readlink(path, buf, sizeof(buf) - 1) == -1)
|
||||
+ if (realpath(path, buf) == NULL)
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* The output has the following format:
|
||||
- * ../../../0.0.4e13
|
||||
+ * /sys/devices/css0/0.0.0119/0.0.3f19/block/dasda
|
||||
+ * /sys/devices/css0/0.0.0000/0.0.0000/virtio0/block/vda
|
||||
*/
|
||||
- ptr = strrchr(buf, '/');
|
||||
- if (!ptr)
|
||||
- ERR_EXIT("Could not read \"%s\"", path);
|
||||
- strncpy(busid, ptr + 1, 9);
|
||||
+ if (sscanf(buf, "/sys/devices/css0/%*[0-9a-f.]/%[0-9a-f.]", busid) != 1)
|
||||
+ return -1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,32 +0,0 @@
|
||||
Subject: [PATCH] [BZ 147113] chzdev: Disable root device update mechanism
|
||||
From: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
|
||||
|
||||
Description: chzdev: Disable root device update mechanism
|
||||
Symptom: chzdev reports problems updating /etc/zipl.conf and running
|
||||
zipl.
|
||||
Problem: When chzdev changes the root device persistent configuration,
|
||||
it performs additional steps to ensure that these changes are
|
||||
correctly applied. Example for such steps are: updating the
|
||||
initial RAM disk, modifying the zipl.conf configuration file
|
||||
and running zipl. As these steps are incompatible with the target
|
||||
distribution, they fail.
|
||||
Solution: Suppress chzdev's root device update mechanism.
|
||||
Reproduction: chzdev --enable --persistent --by-path /
|
||||
Upstream-ID: -
|
||||
Problem-ID: 147113
|
||||
|
||||
Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
|
||||
---
|
||||
zdev/src/chzdev.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/zdev/src/chzdev.c
|
||||
+++ b/zdev/src/chzdev.c
|
||||
@@ -233,6 +233,7 @@ static void init_options(struct options
|
||||
opts->settings = strlist_new();
|
||||
opts->remove = strlist_new();
|
||||
opts->base = strlist_new();
|
||||
+ opts->no_root_check = 1;
|
||||
}
|
||||
|
||||
/* Release memory used in options data structure. */
|
@ -1,744 +0,0 @@
|
||||
Subject: [PATCH] [FEAT LS1213] dasd: add query host access to volume support
|
||||
From: Stefan Haberland <sth@linux.vnet.ibm.com>
|
||||
|
||||
Summary: dasd: add query host access to volume support
|
||||
Description: With this feature, applications can query if a DASD volume is
|
||||
online to another operating system instances by checking the
|
||||
online status of all attached hosts from the storage server.
|
||||
Upstream-ID: -
|
||||
Problem-ID: LS1213
|
||||
|
||||
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
|
||||
---
|
||||
dasdfmt/dasdfmt.8 | 7 ++
|
||||
dasdfmt/dasdfmt.c | 38 ++++++++++++--
|
||||
dasdfmt/dasdfmt.h | 4 +
|
||||
fdasd/fdasd.8 | 9 ++-
|
||||
fdasd/fdasd.c | 32 ++++++++++++
|
||||
fdasd/fdasd.h | 28 +++++-----
|
||||
include/libzds.h | 1
|
||||
include/u2s.h | 5 +
|
||||
libu2s/u2s.c | 43 ++++++++++++++++
|
||||
libzds/Makefile | 2
|
||||
libzds/libzds.c | 46 +++++++++++++++--
|
||||
zconf/lsdasd | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
zconf/lsdasd.8 | 5 +
|
||||
zdsfs/zdsfs.1 | 4 +
|
||||
zdsfs/zdsfs.c | 18 ++++++
|
||||
15 files changed, 345 insertions(+), 36 deletions(-)
|
||||
|
||||
--- a/dasdfmt/dasdfmt.8
|
||||
+++ b/dasdfmt/dasdfmt.8
|
||||
@@ -7,7 +7,7 @@ dasdfmt \- formatting of DASD (ECKD) dis
|
||||
.br
|
||||
[-r \fIcylinder\fR] [-b \fIblksize\fR] [-l \fIvolser\fR] [-d \fIlayout\fR]
|
||||
.br
|
||||
- [-L] [-V] [-F] [-k] \fIdevice\fR
|
||||
+ [-L] [-V] [-F] [-k] [-C] \fIdevice\fR
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBdasdfmt\fR formats a DASD (ECKD) disk drive to prepare it
|
||||
@@ -70,6 +70,11 @@ Print version number and exit.
|
||||
Formats the device without checking, if the device is in use.
|
||||
|
||||
.TP
|
||||
+\fB-C\fR or \fB--check_host_count\fR
|
||||
+Force dasdfmt to check the host access open count to ensure the device
|
||||
+is not online on another operating system instance
|
||||
+
|
||||
+.TP
|
||||
\fB-d\fR \fIlayout\fR or \fB--disk_layout\fR=\fIlayout\fR
|
||||
Formats the device with compatible disk layout or linux disk layout.
|
||||
\fIlayout\fR is either \fIcdl\fR for the compatible disk layout
|
||||
--- a/dasdfmt/dasdfmt.c
|
||||
+++ b/dasdfmt/dasdfmt.c
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "util_proc.h"
|
||||
#include "dasd_sys.h"
|
||||
|
||||
+#define BUSIDSIZE 8
|
||||
+
|
||||
/* Full tool name */
|
||||
static const char tool_name[] = "dasdfmt: zSeries DASD format program";
|
||||
|
||||
@@ -46,7 +48,7 @@ print_version (void)
|
||||
*/
|
||||
static void exit_usage(int exitcode)
|
||||
{
|
||||
- printf("Usage: %s [-htvypPLVFk]\n"
|
||||
+ printf("Usage: %s [-htvypPLVFkC]\n"
|
||||
" [-l <volser> | --label=<volser>]\n"
|
||||
" [-b <blocksize> | --blocksize=<blocksize>]\n"
|
||||
" [-d <disk layout> | --disk_layout=<disk layout>]\n"
|
||||
@@ -65,6 +67,9 @@ static void exit_usage(int exitcode)
|
||||
" -v means verbose mode\n"
|
||||
" -F means don't check if the device is in use\n"
|
||||
" -k means keep volume serial\n"
|
||||
+ " -C or --check_host_count means force dasdfmt to check\n"
|
||||
+ " the host access open count to ensure the device\n"
|
||||
+ " is not online on another operating system instance\n"
|
||||
" --norecordzero prevent storage server from modifying"
|
||||
" record 0\n\n"
|
||||
" <volser> is the volume identifier, which is converted\n"
|
||||
@@ -190,7 +195,6 @@ static void get_device_name(dasdfmt_info
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
/*
|
||||
* initialize the dasdfmt info structure
|
||||
*/
|
||||
@@ -214,6 +218,7 @@ static void init_info(dasdfmt_info_t *in
|
||||
info->node_specified = 0;
|
||||
info->device_id = 0;
|
||||
info->keep_volser = 0;
|
||||
+ info->force_host = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -776,6 +781,7 @@ static void do_format_dasd(dasdfmt_info_
|
||||
dasd_information_t dasd_info;
|
||||
struct dasd_eckd_characteristics *characteristics;
|
||||
unsigned int cylinders, heads;
|
||||
+ int count;
|
||||
|
||||
if (info->verbosity > 0) printf("Retrieving disk geometry...\n");
|
||||
|
||||
@@ -835,6 +841,27 @@ static void do_format_dasd(dasdfmt_info_
|
||||
if ((info->verbosity > 0) || (!info->withoutprompt))
|
||||
dasdfmt_print_info(info, vlabel, cylinders, heads, p);
|
||||
|
||||
+ count = u2s_get_host_access_count(info->devname);
|
||||
+ if (info->force_host) {
|
||||
+ if (count > 1) {
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE,
|
||||
+ "\n%s: Disk %s is online on OS instances in %d different LPARs.\n"
|
||||
+ "Note: Your installation might include z/VM systems that are configured to\n"
|
||||
+ "automatically vary on disks, regardless of whether they are subsequently used.\n\n",
|
||||
+ prog_name, info->devname, count);
|
||||
+ } else if (count < 0) {
|
||||
+ ERRMSG("\nHosts access information not available for disk %s.\n\n",
|
||||
+ info->devname);
|
||||
+ return;
|
||||
+ }
|
||||
+ } else if (count > 1)
|
||||
+ ERRMSG("\nWARNING:\n"
|
||||
+ "Disk %s is online on operating system instances in %d different LPARs.\n"
|
||||
+ "Ensure that the disk is not being used by a system outside your LPAR.\n"
|
||||
+ "Note: Your installation might include z/VM systems that are configured to\n"
|
||||
+ "automatically vary on disks, regardless of whether they are subsequently used.\n",
|
||||
+ info->devname, count);
|
||||
+
|
||||
if (!info->testmode) {
|
||||
if (!info->withoutprompt) {
|
||||
printf("\n--->> ATTENTION! <<---\n");
|
||||
@@ -916,10 +943,6 @@ int main(int argc,char *argv[])
|
||||
info.force=1;
|
||||
break;
|
||||
|
||||
- case 'C':
|
||||
- format_params.intensity |= DASD_FMT_INT_COMPAT;
|
||||
- break;
|
||||
-
|
||||
case 'd' :
|
||||
if (strncmp(optarg,"cdl",3)==0)
|
||||
{
|
||||
@@ -1017,6 +1040,9 @@ int main(int argc,char *argv[])
|
||||
case 'k' :
|
||||
info.keep_volser=1;
|
||||
break;
|
||||
+ case 'C':
|
||||
+ info.force_host = 1;
|
||||
+ break;
|
||||
case -1:
|
||||
/* End of options string - start of devices list */
|
||||
info.device_id = optind;
|
||||
--- a/dasdfmt/dasdfmt.h
|
||||
+++ b/dasdfmt/dasdfmt.h
|
||||
@@ -214,7 +214,7 @@ typedef struct format_data_t {
|
||||
if (*endptr) ERRMSG_EXIT(EXIT_MISUSE,"%s: " str " " \
|
||||
"is in invalid format\n",prog_name);}
|
||||
|
||||
-#define dasdfmt_getopt_string "b:n:l:f:d:m:r:hpPLtyvVFk"
|
||||
+#define dasdfmt_getopt_string "b:n:l:f:d:m:r:hpPLtyvVFkC"
|
||||
|
||||
static struct option dasdfmt_getopt_long_options[]=
|
||||
{
|
||||
@@ -233,6 +233,7 @@ static struct option dasdfmt_getopt_long
|
||||
{ "help", 0, 0, 'h'},
|
||||
{ "keep_volser", 0, 0, 'k'},
|
||||
{ "norecordzero", 0, 0, 'z'},
|
||||
+ { "check_host_count", 0, 0, 'C'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
@@ -265,6 +266,7 @@ typedef struct dasdfmt_info {
|
||||
int node_specified;
|
||||
int device_id;
|
||||
int keep_volser;
|
||||
+ int force_host;
|
||||
} dasdfmt_info_t;
|
||||
|
||||
|
||||
--- a/fdasd/fdasd.8
|
||||
+++ b/fdasd/fdasd.8
|
||||
@@ -4,11 +4,11 @@ fdasd \- partitioning tool.
|
||||
.SH SYNOPSIS
|
||||
interactive mode:
|
||||
.br
|
||||
- \fBfdasd\fR [-s] [-r] \fIdevice\fR
|
||||
+ \fBfdasd\fR [-s] [-r] [-C] \fIdevice\fR
|
||||
.br
|
||||
command line mode:
|
||||
.br
|
||||
- \fBfdasd\fR [-s] [-r] {-a[-k|-l \fIvolser\fR]|-i|-p|-c \fIconf_file\fR}
|
||||
+ \fBfdasd\fR [-s] [-r] [-C] {-a[-k|-l \fIvolser\fR]|-i|-p|-c \fIconf_file\fR}
|
||||
[-f \fI[type,blocksize]\fR] \fIdevice\fR
|
||||
.br
|
||||
help:
|
||||
@@ -131,6 +131,11 @@ In combination with the -s option fdasd
|
||||
partition table.
|
||||
|
||||
.TP
|
||||
+\fB-C\fR or \fB--check_host_count\fR
|
||||
+Force fdasd to check the host access open count to ensure the device
|
||||
+is not online on another operating system instance
|
||||
+
|
||||
+.TP
|
||||
\fB-f\fR \fI[type,blocksize]\fR or \fB--force\fR \fI[type,blocksize]\fR
|
||||
Force fdasd to work on non DASD devices.
|
||||
.br
|
||||
--- a/fdasd/fdasd.c
|
||||
+++ b/fdasd/fdasd.c
|
||||
@@ -369,7 +369,10 @@ fdasd_usage (void)
|
||||
" found in CONFIGFILE\n"
|
||||
"-i, --volser Print volume serial\n"
|
||||
"-p, --table Print partition table\n"
|
||||
- "-f, --force Force fdasd to work on non DASD devices\n");
|
||||
+ "-f, --force Force fdasd to work on non DASD devices\n"
|
||||
+ "-C, --check_host_count Force fdasd to check the host access\n"
|
||||
+ " open count to ensure the device is not\n"
|
||||
+ " online on another operating system instance\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -572,6 +575,9 @@ fdasd_parse_options (fdasd_anchor_t *anc
|
||||
anc->force_virtual++;
|
||||
fdasd_parse_force_options(anc, optarg);
|
||||
break;
|
||||
+ case 'C':
|
||||
+ anc->force_host++;
|
||||
+ break;
|
||||
case -1:
|
||||
/* End of options string - start of devices list */
|
||||
break;
|
||||
@@ -824,6 +830,7 @@ fdasd_verify_device (fdasd_anchor_t *anc
|
||||
{
|
||||
struct stat dst;
|
||||
char err_str[ERROR_STRING_SIZE];
|
||||
+ int count;
|
||||
|
||||
if ((stat(name, &dst)) < 0 ) {
|
||||
snprintf(err_str, ERROR_STRING_SIZE,
|
||||
@@ -856,6 +863,29 @@ fdasd_verify_device (fdasd_anchor_t *anc
|
||||
fdasd_error(anc, device_verification_failed, err_str);
|
||||
}
|
||||
|
||||
+ count = u2s_get_host_access_count(name);
|
||||
+ if (anc->force_host) {
|
||||
+ if (count > 1) {
|
||||
+ snprintf(err_str, ERROR_STRING_SIZE,
|
||||
+ "Disk %s is online on operating system instances in %d different LPARs.\n"
|
||||
+ "Note: Your installation might include z/VM systems that are configured to\n"
|
||||
+ "automatically vary on disks, regardless of whether they are subsequently used.\n",
|
||||
+ name, count);
|
||||
+ fdasd_error(anc, device_verification_failed, err_str);
|
||||
+ } else if (count < 0) {
|
||||
+ snprintf(err_str, ERROR_STRING_SIZE,
|
||||
+ "Hosts access information not available for disk %s.\n",
|
||||
+ name);
|
||||
+ fdasd_error(anc, device_verification_failed, err_str);
|
||||
+ }
|
||||
+ } else if (count > 1)
|
||||
+ printf("\nWARNING:\n"
|
||||
+ "Disk %s is online on operating system instances in %d different LPARs.\n"
|
||||
+ "Ensure that the disk is not being used by a system outside your LPAR.\n"
|
||||
+ "Note: Your installation might include z/VM systems that are configured to\n"
|
||||
+ "automatically vary on disks, regardless of whether they are subsequently used.\n\n",
|
||||
+ name, count);
|
||||
+
|
||||
if (anc->verbose)
|
||||
printf("Verification successful for '%s' (%d/%d)\n", name,
|
||||
(unsigned short) major(dst.st_rdev),
|
||||
--- a/fdasd/fdasd.h
|
||||
+++ b/fdasd/fdasd.h
|
||||
@@ -157,22 +157,23 @@ struct dasd_eckd_characteristics {
|
||||
#define PARTITION_GPFS 5
|
||||
|
||||
static struct option fdasd_long_options[] = {
|
||||
- { "version", no_argument, NULL, 'v'},
|
||||
- { "auto", no_argument, NULL, 'a'},
|
||||
- { "silent", no_argument, NULL, 's'},
|
||||
- { "verbose", no_argument, NULL, 'r'},
|
||||
- { "label", required_argument, NULL, 'l'},
|
||||
- { "config", required_argument, NULL, 'c'},
|
||||
- { "help", no_argument, NULL, 'h'},
|
||||
- { "table", no_argument, NULL, 'p'},
|
||||
- { "volser", no_argument, NULL, 'i'},
|
||||
- { "keep_volser", no_argument, NULL, 'k'},
|
||||
- { "force", optional_argument, NULL, 'f'},
|
||||
- { 0, 0, 0, 0 }
|
||||
+ { "version", no_argument, NULL, 'v'},
|
||||
+ { "auto", no_argument, NULL, 'a'},
|
||||
+ { "silent", no_argument, NULL, 's'},
|
||||
+ { "verbose", no_argument, NULL, 'r'},
|
||||
+ { "label", required_argument, NULL, 'l'},
|
||||
+ { "config", required_argument, NULL, 'c'},
|
||||
+ { "help", no_argument, NULL, 'h'},
|
||||
+ { "table", no_argument, NULL, 'p'},
|
||||
+ { "volser", no_argument, NULL, 'i'},
|
||||
+ { "keep_volser", no_argument, NULL, 'k'},
|
||||
+ { "force", optional_argument, NULL, 'f'},
|
||||
+ { "check_host_count", no_argument, NULL, 'C'},
|
||||
+ { 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
/* Command line option abbreviations */
|
||||
-static const char option_string[] = "vasrl:c:hpikf::";
|
||||
+static const char option_string[] = "vasrl:c:hpikf::C";
|
||||
|
||||
struct fdasd_options {
|
||||
char *device;
|
||||
@@ -214,6 +215,7 @@ typedef struct fdasd_anchor {
|
||||
int print_volser;
|
||||
int keep_volser;
|
||||
int force_virtual;
|
||||
+ int force_host;
|
||||
int big_disk;
|
||||
int silent;
|
||||
int verbose;
|
||||
--- a/include/libzds.h
|
||||
+++ b/include/libzds.h
|
||||
@@ -803,6 +803,7 @@ int lzds_zdsroot_extract_datasets_from_d
|
||||
void lzds_DS1RECFM_to_recfm(char DS1RECFM, char *buffer);
|
||||
|
||||
|
||||
+int lzds_analyse_open_count(struct zdsroot *root, int warn);
|
||||
|
||||
/** @} */ /* end of group libzds_functions_helper */
|
||||
|
||||
--- a/include/u2s.h
|
||||
+++ b/include/u2s.h
|
||||
@@ -13,7 +13,8 @@
|
||||
|
||||
#define U2S_BUS_ID_SIZE 32
|
||||
|
||||
-int
|
||||
-u2s_getbusid(char * devicenode, char * busid);
|
||||
+int u2s_getbusid(char *, char *);
|
||||
+int u2s_read_attribute(char *, char *, char *, size_t);
|
||||
+int u2s_get_host_access_count(char *);
|
||||
|
||||
#endif /* U2S_H */
|
||||
--- a/libu2s/u2s.c
|
||||
+++ b/libu2s/u2s.c
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <dirent.h>
|
||||
+#include <stdlib.h>
|
||||
|
||||
#include "u2s.h"
|
||||
|
||||
@@ -282,3 +283,45 @@ int u2s_getbusid(char *devicenode, char
|
||||
|
||||
return rc;
|
||||
}
|
||||
+
|
||||
+/*
|
||||
+ * Attempts to find the sysfs entry for the given busid and reads
|
||||
+ * the contents of a specified attribute to the buffer
|
||||
+ */
|
||||
+int u2s_read_attribute(char *busid, char *attribute, char *buffer,
|
||||
+ size_t count)
|
||||
+{
|
||||
+ char path[100];
|
||||
+ int rc, fd;
|
||||
+ ssize_t rcount;
|
||||
+
|
||||
+ rc = 0;
|
||||
+ snprintf(path, sizeof(path), "/sys/bus/ccw/devices/%s/%s",
|
||||
+ busid, attribute);
|
||||
+ fd = open(path, O_RDONLY);
|
||||
+ if (fd < 0)
|
||||
+ return errno;
|
||||
+ rcount = read(fd, buffer, count);
|
||||
+ if (rcount < 0)
|
||||
+ rc = errno;
|
||||
+ close(fd);
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+int u2s_get_host_access_count(char *devicenode)
|
||||
+{
|
||||
+ char busid[BUSIDSIZE];
|
||||
+ unsigned long value;
|
||||
+ char buffer[10];
|
||||
+ char *endp;
|
||||
+
|
||||
+ u2s_getbusid(devicenode, busid);
|
||||
+ u2s_read_attribute(busid, "host_access_count", buffer, sizeof(buffer));
|
||||
+
|
||||
+ value = strtoul(buffer, &endp, 0);
|
||||
+
|
||||
+ if (endp == buffer)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ return value;
|
||||
+}
|
||||
--- a/libzds/Makefile
|
||||
+++ b/libzds/Makefile
|
||||
@@ -8,7 +8,7 @@ CFLAGS += -D_FILE_OFFSET_BITS=64
|
||||
|
||||
all: libzds.a
|
||||
|
||||
-libzds.a: libzds.o $(rootdir)/libutil/util_list.o $(rootdir)/libvtoc/vtoc.o
|
||||
+libzds.a: libzds.o $(rootdir)/libutil/util_list.o $(rootdir)/libvtoc/vtoc.o $(rootdir)/libu2s/u2s.o
|
||||
|
||||
libzds.o: ../include/libzds.h
|
||||
|
||||
--- a/libzds/libzds.c
|
||||
+++ b/libzds/libzds.c
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "libzds.h"
|
||||
|
||||
#include "util.h"
|
||||
+#include "u2s.h"
|
||||
|
||||
#include <malloc.h>
|
||||
#include <linux/types.h>
|
||||
@@ -72,6 +73,8 @@ struct errorlog {
|
||||
*/
|
||||
#define ERRORMSG 240
|
||||
|
||||
+#define BUSIDSIZE 8
|
||||
+
|
||||
/**
|
||||
* @brief An internal structure that represents an entry in the error log.
|
||||
*/
|
||||
@@ -3760,15 +3763,46 @@ void lzds_DS1RECFM_to_recfm(char DS1RECF
|
||||
*/
|
||||
}
|
||||
|
||||
+int lzds_analyse_open_count(struct zdsroot *root, int warn)
|
||||
+{
|
||||
+ struct dasd *dasd;
|
||||
+ int value;
|
||||
+ int rc = 0;
|
||||
|
||||
+ util_list_iterate(root->dasdlist, dasd) {
|
||||
+ value = u2s_get_host_access_count(dasd->device);
|
||||
|
||||
+ if (value < 0) {
|
||||
+ fprintf(stderr,
|
||||
+ "Hosts access information not available for disk %s.\n",
|
||||
+ dasd->device);
|
||||
+ rc = value;
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
+ if (value == 1)
|
||||
+ continue;
|
||||
|
||||
+ if (warn)
|
||||
+ fprintf(stderr,
|
||||
+ "\nWARNING:\n"
|
||||
+ "Disk %s is online on operating system instances in %d different LPARs.\n"
|
||||
+ "Ensure that the disk is not being used by a system outside your LPAR.\n"
|
||||
+ "Note: Your installation might include z/VM systems that are configured to\n"
|
||||
+ "automatically vary on disks, regardless of whether they are subsequently used.\n",
|
||||
+ dasd->device, value);
|
||||
+ else {
|
||||
+ fprintf(stderr,
|
||||
+ "\nERROR:\n"
|
||||
+ "Disk %s is online on operating system instances in %d different LPARs.\n"
|
||||
+ "Ensure that the disk is not being used by a system outside your LPAR.\n"
|
||||
+ "Note: Your installation might include z/VM systems that are configured to\n"
|
||||
+ "automatically vary on disks, regardless of whether they are subsequently used.\n",
|
||||
+ dasd->device, value);
|
||||
+ rc = -EACCES;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
+ return rc;
|
||||
+}
|
||||
|
||||
--- a/zconf/lsdasd
|
||||
+++ b/zconf/lsdasd
|
||||
@@ -30,6 +30,8 @@ function PrintUsage() {
|
||||
Print old version of lsdasd output.
|
||||
-l|--long
|
||||
Print extended information about DASDs.
|
||||
+ -H|--host-access-list
|
||||
+ Print information about hosts accessing DASDs.
|
||||
-v|--verbose
|
||||
For compatibility/future use. Currently ignored.
|
||||
--version
|
||||
@@ -115,6 +117,33 @@ function listDASDDeviceDirectories() {
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
+# find dasd directory in debugfs
|
||||
+#------------------------------------------------------------------------------
|
||||
+function findDASDDebugfsDirectorie() {
|
||||
+ local mntentries
|
||||
+
|
||||
+ while read -a mntentries
|
||||
+ do
|
||||
+ if [[ "${mntentries[2]}" == "debugfs" ]]
|
||||
+ then
|
||||
+ DASD_DBF_DIR="${mntentries[1]}"
|
||||
+ break;
|
||||
+ fi
|
||||
+ done < /etc/mtab
|
||||
+ if [[ "$DASD_DBF_DIR" == "" ]]
|
||||
+ then
|
||||
+ echo "$CMD: No debugfs mount point found" >&2
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ DASD_DBF_DIR="$DASD_DBF_DIR/dasd"
|
||||
+ if [[ ! -d "$DASD_DBF_DIR" ]]
|
||||
+ then
|
||||
+ echo "$CMD: Default DASD debugfs directory $DASD_DBF_DIR does not exist" >&2
|
||||
+ exit 1
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+#------------------------------------------------------------------------------
|
||||
# gather device data and call appropriate output function
|
||||
#------------------------------------------------------------------------------
|
||||
function gatherDeviceData() {
|
||||
@@ -197,6 +226,8 @@ function gatherDeviceData() {
|
||||
extended
|
||||
elif [[ "$PRINTUID" == "true" ]]; then
|
||||
uid
|
||||
+ elif [[ "$OUTPUT" == "host" ]]; then
|
||||
+ host
|
||||
else
|
||||
newoutput
|
||||
fi
|
||||
@@ -527,6 +558,104 @@ function extended()
|
||||
"${HPF_PATHS[@]}" ;
|
||||
}
|
||||
|
||||
+function host()
|
||||
+{
|
||||
+findDASDDebugfsDirectorie
|
||||
+
|
||||
+if [[ ! -f "$DASD_DBF_DIR/$BUSID/host_access_list" ]]
|
||||
+then
|
||||
+ printf "\n%s: hosts access information not available\n" "$BUSID"
|
||||
+ return
|
||||
+fi
|
||||
+
|
||||
+local temp=`mktemp /tmp/lsdasd.XXXXXX`
|
||||
+if test -w $temp ; then :; else
|
||||
+ printf "\nCreating temporary file failed\n"
|
||||
+ return
|
||||
+fi
|
||||
+
|
||||
+cat $DASD_DBF_DIR/$BUSID/host_access_list > $temp 2> /dev/null
|
||||
+ret=$?
|
||||
+if [[ $ret -ne 0 ]]
|
||||
+then
|
||||
+ printf "%s: hosts access information not available\n" "$BUSID"
|
||||
+ rm -f $temp
|
||||
+ return $ret
|
||||
+fi
|
||||
+
|
||||
+unset index
|
||||
+unset array
|
||||
+declare -a array
|
||||
+
|
||||
+index=(pgid status_flags sysplex_name supported_cylinder timestamp)
|
||||
+
|
||||
+for element in ${index[@]}
|
||||
+do
|
||||
+ count=0
|
||||
+
|
||||
+ declare -a $element
|
||||
+ OLDIFS=$IFS
|
||||
+ IFS=$'\n'
|
||||
+ for value in `grep $element $temp`
|
||||
+ do
|
||||
+ (( ++count ))
|
||||
+ value=$(echo -e $value | cut -d ' ' -f2)
|
||||
+ eval $element[$count]=$value
|
||||
+ done
|
||||
+ IFS=$OLDIFS
|
||||
+done
|
||||
+
|
||||
+printf "Host information for %s\n" "$BUSID";
|
||||
+printf "Path-Group-ID LPAR CPU FL Status Sysplex Max_Cyls Time\n";
|
||||
+printf "================================================================================\n";
|
||||
+
|
||||
+# mask bits for online and reserved state
|
||||
+online_reserved_mask=0xE0
|
||||
+
|
||||
+# print name value lists
|
||||
+for i in `seq 1 $count`;
|
||||
+do
|
||||
+ # get flags field
|
||||
+ value=${status_flags[$i]}
|
||||
+ # mark as hex value
|
||||
+ value=0x$value
|
||||
+ # mask online and reserved bits
|
||||
+ value=$(($value & $online_reserved_mask))
|
||||
+
|
||||
+ case $value in
|
||||
+ 0 ) # 0x00
|
||||
+ STATE="OFF"
|
||||
+ ;;
|
||||
+ 32 ) # 0x20
|
||||
+ STATE="OFF-RSV"
|
||||
+ ;;
|
||||
+ 64 ) # 0x40
|
||||
+ STATE="ON"
|
||||
+ ;;
|
||||
+ 96 ) # 0x60
|
||||
+ STATE="ON-RSV"
|
||||
+ ;;
|
||||
+ * )
|
||||
+ STATE="-"
|
||||
+ ;;
|
||||
+ esac
|
||||
+
|
||||
+ printf "%22s %02s %07s %02s %-6s %-8s %11u %10lu\n" \
|
||||
+ "${pgid[$i]}" \
|
||||
+ "${pgid[$i]:4:2}" \
|
||||
+ "${pgid[$i]:6:4}" \
|
||||
+ "${status_flags[$i]}" \
|
||||
+ "$STATE" \
|
||||
+ "${sysplex_name[$i]}" \
|
||||
+ "${supported_cylinder[$i]}" \
|
||||
+ "${timestamp[$i]}" \
|
||||
+ ;
|
||||
+done
|
||||
+printf "\n";
|
||||
+
|
||||
+rm -f $temp
|
||||
+}
|
||||
+
|
||||
function uid()
|
||||
{
|
||||
#-------------------------------------------#
|
||||
@@ -586,6 +715,9 @@ while [ $# -gt 0 ]; do
|
||||
--long|-l)
|
||||
OUTPUT="extended"
|
||||
;;
|
||||
+ --host-access-list|-H)
|
||||
+ OUTPUT="host"
|
||||
+ ;;
|
||||
--version)
|
||||
PrintVersion
|
||||
exit 0
|
||||
@@ -626,8 +758,13 @@ fi
|
||||
|
||||
# gather information on devices in list
|
||||
PROCESSING=" $PROCESSING | gatherDeviceData "
|
||||
+
|
||||
# sort resulting list
|
||||
-PROCESSING=" $PROCESSING | sort -t: -k1n -k2 | cut -d: -f3- "
|
||||
+if [[ "$OUTPUT" == "host" ]]; then
|
||||
+ PROCESSING=" $PROCESSING"
|
||||
+else
|
||||
+ PROCESSING=" $PROCESSING | sort -t: -k1n -k2 | cut -d: -f3- "
|
||||
+fi
|
||||
|
||||
if [[ "$PRINTUID" == "true" ]] && [[ "$OUTPUT" != "old" ]]; then
|
||||
printf "Bus-ID Name UID\n"
|
||||
--- a/zconf/lsdasd.8
|
||||
+++ b/zconf/lsdasd.8
|
||||
@@ -40,11 +40,14 @@ Include only base devices.
|
||||
Old output of lsdasd for compatibility.
|
||||
.TP
|
||||
.BR -l | --long
|
||||
-Extended output of lsdasd including UID, attributes and path information.
|
||||
+Extended output of lsdasd including UID and attributes.
|
||||
.TP
|
||||
.BR -u | --uid
|
||||
Output includes and is sorted by UID.
|
||||
.TP
|
||||
+.BR -H | --host-acces
|
||||
+Show information about all hosts using this device.
|
||||
+.TP
|
||||
.BR -v | --verbose
|
||||
Only for compatibility (and maybe future) use. This option currently does
|
||||
nothing.
|
||||
--- a/zdsfs/zdsfs.1
|
||||
+++ b/zdsfs/zdsfs.1
|
||||
@@ -150,6 +150,10 @@ If \fI<s>\fR is set to 0, no seek histor
|
||||
case `seek' is still supported, but a `seek' operation might result in a
|
||||
read from the beginning of the data set.
|
||||
|
||||
+.TP
|
||||
+\fB\-o\fR check_host_count
|
||||
+Stop processing if the device is used by another operating system instance.
|
||||
+
|
||||
.SS "Applicable FUSE options (version 2.8):"
|
||||
This is a selected subset of all FUSE options. Use the zdsfs
|
||||
\fB\--help\fR option to print a full list.
|
||||
--- a/zdsfs/zdsfs.c
|
||||
+++ b/zdsfs/zdsfs.c
|
||||
@@ -39,6 +39,7 @@ struct zdsfs_info {
|
||||
int devcount;
|
||||
int allow_inclomplete_multi_volume;
|
||||
int keepRDW;
|
||||
+ int host_count;
|
||||
unsigned int tracks_per_frame;
|
||||
unsigned long long seek_buffer_size;
|
||||
struct zdsroot *zdsroot;
|
||||
@@ -765,6 +766,7 @@ static const struct fuse_opt zdsfs_opts[
|
||||
FUSE_OPT_KEY("seekbuffer=", KEY_SEEKBUFFER),
|
||||
ZDSFS_OPT("rdw", keepRDW, 1),
|
||||
ZDSFS_OPT("ignore_incomplete", allow_inclomplete_multi_volume, 1),
|
||||
+ ZDSFS_OPT("check_host_count", host_count, 1),
|
||||
FUSE_OPT_END
|
||||
};
|
||||
|
||||
@@ -790,7 +792,10 @@ static void usage(const char *progname)
|
||||
" data set are missing\n"
|
||||
" -o tracks=N Size of the track buffer in tracks (default 128)\n"
|
||||
" -o seekbuffer=S Upper limit in bytes for the seek history buffer\n"
|
||||
-" size (default 1048576)\n", progname);
|
||||
+" size (default 1048576)\n"
|
||||
+" -o check_host_count Stop processing if the device is used by another\n"
|
||||
+" operating system instance\n"
|
||||
+ , progname);
|
||||
}
|
||||
|
||||
static void zdsfs_process_device(const char *device)
|
||||
@@ -1014,6 +1019,17 @@ int main(int argc, char *argv[])
|
||||
argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
+
|
||||
+ if (zdsfsinfo.host_count) {
|
||||
+ /* check, print error and exit if multiple online */
|
||||
+ rc = lzds_analyse_open_count(zdsfsinfo.zdsroot, 0);
|
||||
+ if (rc == -EACCES)
|
||||
+ goto cleanup;
|
||||
+ } else {
|
||||
+ /* check, print warning if multiple online */
|
||||
+ lzds_analyse_open_count(zdsfsinfo.zdsroot, 1);
|
||||
+ }
|
||||
+
|
||||
rc = zdsfs_verify_datasets();
|
||||
if (rc)
|
||||
goto cleanup;
|
@ -1,37 +0,0 @@
|
||||
Subject: [PATCH] [BZ 140500] libu2s: Fix busid parsing
|
||||
From: Jan Höppner <hoeppner@linux.vnet.ibm.com>
|
||||
|
||||
Description: libu2s: Fix busid parsing
|
||||
Symptom: dasdview displays a wrong busid and shows the error message
|
||||
"Error: dasdview: Could not retrieve raw_track_access mode
|
||||
information.", which is wrong as well.
|
||||
Problem: dasdview retrieves the busid information from libu2s. Whenever
|
||||
an FBA DASD is listed prior to the target DASD in
|
||||
/proc/dasd/devices, the parsing will fail due to an additional
|
||||
whitespace character. For example, an entry for ECKD devices
|
||||
starts with "0.0.5e30(ECKD)...", while an entry for FBA starts
|
||||
with "0.0.8000(FBA )...".
|
||||
Solution: Change the busid parsing in libu2s by explicitly looking for the
|
||||
closing bracket.
|
||||
Reproduction: Add an FBA device and then an ECKD device to the system and use
|
||||
dasdview to display information about the ECKD device.
|
||||
# dasdview -i /dev/dasdX
|
||||
Upstream-ID: -
|
||||
Problem-ID: 140500
|
||||
|
||||
Signed-off-by: Jan Höppner <hoeppner@linux.vnet.ibm.com>
|
||||
---
|
||||
libu2s/u2s.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/libu2s/u2s.c
|
||||
+++ b/libu2s/u2s.c
|
||||
@@ -237,7 +237,7 @@ static int find_busid_in_proc(int maja,
|
||||
filp = fopen("/proc/dasd/devices", "r");
|
||||
if (!filp)
|
||||
return rc;
|
||||
- while (fscanf(filp, "%[^(] %*s at ( %d : %d %*[^\n]\n",
|
||||
+ while (fscanf(filp, "%[^(] %*[^)] ) at ( %d : %d %*[^\n]\n",
|
||||
bus, &majb, &minb) != EOF) {
|
||||
if ((maja == majb) && (mina == minb)) {
|
||||
strncpy(busid, bus, BUSIDSIZE + 1);
|
@ -1,37 +0,0 @@
|
||||
Subject: lscss: allow to specify devices from ssid > 2
|
||||
From: Sebastian Ott <sebott@linux.vnet.ibm.com>
|
||||
|
||||
Description: lscss: allow to specify devices from ssid > 2
|
||||
Symptom: Specifying devices with ssid > 2 results in:
|
||||
"Syntax error: 0.3.0000"
|
||||
Problem: SSIDs > 2 are disallowed
|
||||
Solution: allow SSIDs > 2
|
||||
Reproduction: lscss 0.3.0000
|
||||
Upstream-ID: -
|
||||
Problem-ID: 150872
|
||||
|
||||
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
|
||||
---
|
||||
zconf/lscss | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/zconf/lscss
|
||||
+++ b/zconf/lscss
|
||||
@@ -61,7 +61,7 @@ SUBCHANNEL_TYPE_IO=0
|
||||
SUBCHANNEL_TYPE_CHSC=1
|
||||
SUBCHANNEL_TYPE_EADM=3
|
||||
|
||||
-IDFORMAT=[[:xdigit:]]*.[0-3].[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]]
|
||||
+IDFORMAT=[[:xdigit:]]*.[[:xdigit:]].[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]]
|
||||
|
||||
unset SCH_IO SCH_CHSC SCH_EADM SHOW_AVAIL UPPERCASE SHORTID DEVTYPES DEVRANGE
|
||||
unset RANGE SHOW_VPM
|
||||
@@ -81,7 +81,7 @@ function check_id() #return 0 if $1 has
|
||||
fi
|
||||
;;
|
||||
3)
|
||||
- if [ ${#__ID[2]} != 4 -o ${#__ID[1]} != 1 -o "${__ID[1]//[012]/}" \
|
||||
+ if [ ${#__ID[2]} != 4 -o ${#__ID[1]} != 1 \
|
||||
-o \( ${#__ID[0]} != 2 -a ${#__ID[0]} != 1 \) ] ;then
|
||||
return 1
|
||||
fi
|
@ -1,35 +0,0 @@
|
||||
Subject: [PATCH] [BZ 143050] zipl/boot: fix failed start subchannel in FBA loader
|
||||
From: Stefan Haberland <sth@linux.vnet.ibm.com>
|
||||
|
||||
Description: zipl/boot: fix failed start subchannel in FBA loader
|
||||
Symptom: IPL of a FBA device fails with:
|
||||
Start subchannel failed
|
||||
disabled wait PSW 00020000 80000000 00000000 00004502
|
||||
Problem: The FBA loader has only a limited amount of memory to build CCW
|
||||
requests. Therefore larger I/O requests need to be split.
|
||||
This splitting was off by one leading to the fact that one CCW
|
||||
request uses memory of another data structure which in turn leads
|
||||
to corrupted data.
|
||||
Solution: Fix by correcting the split rule.
|
||||
Reproduction: IPL a FBA device.
|
||||
The error might occur randomly depending on the size of the
|
||||
kernel image and offsets within it.
|
||||
Upstream-ID: -
|
||||
Problem-ID: 143050
|
||||
|
||||
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
|
||||
---
|
||||
zipl/boot/fba2.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/zipl/boot/fba2.c
|
||||
+++ b/zipl/boot/fba2.c
|
||||
@@ -59,7 +59,7 @@ restart:
|
||||
memset(irb, 0, sizeof(struct irb));
|
||||
memset(&orb, 0, sizeof(struct orb));
|
||||
|
||||
- if (blockptr->blockct > MAX_BLOCKCT) {
|
||||
+ if (blockptr->blockct >= MAX_BLOCKCT) {
|
||||
record_number = MAX_BLOCKCT - 1;
|
||||
blockptr->blockct -= MAX_BLOCKCT;
|
||||
} else {
|
@ -1,35 +0,0 @@
|
||||
Subject: [PATCH] [BZ 156627] chmem: try to online memory to zone movable
|
||||
From: Gerald Schaefer <gerald.schaefer@de.ibm.com>
|
||||
|
||||
Description: chmem: try to online memory to zone movable
|
||||
Symptom: Standby/reserved memory that is onlined with chmem will be set
|
||||
online to zone normal, instead of zone movable, and so it is much
|
||||
less likely to be able to be offlined again.
|
||||
Problem: With recent kernels, the default zone for hotplug memory was
|
||||
changed from zone movable to zone normal.
|
||||
Solution: Let chmem first try to online memory to the zone movable, before
|
||||
setting it online to the default zone.
|
||||
Reproduction: Set standby/reserved memory online with chmem, and check
|
||||
/proc/zoneinfo for zone allocation.
|
||||
Upstream-ID: -
|
||||
Problem-ID: 156627
|
||||
|
||||
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
|
||||
---
|
||||
zconf/chmem | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/zconf/chmem
|
||||
+++ b/zconf/chmem
|
||||
@@ -86,7 +86,10 @@ sub chmem_online($)
|
||||
{
|
||||
my $block = shift;
|
||||
|
||||
- qx(echo online > $memdir/memory$block/state 2>/dev/null);
|
||||
+ qx(echo online_movable > $memdir/memory$block/state 2>/dev/null);
|
||||
+ if ($? >> 8 != 0) {
|
||||
+ qx(echo online > $memdir/memory$block/state 2>/dev/null);
|
||||
+ }
|
||||
return $? >> 8;
|
||||
}
|
||||
|
@ -1,42 +0,0 @@
|
||||
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: 9e49066f5c779e6591b06d2276add744ea8ca4d0
|
||||
Problem-ID: LS1501
|
||||
|
||||
Upstream-Description:
|
||||
|
||||
dasdfmt: Fix behaviour of -t combined with -y
|
||||
|
||||
When -t (testmode) is being combined with -y (noprompt), the
|
||||
informations about what dasdfmt *would* do, is not being displayed.
|
||||
|
||||
Simply fix this by checking whether testmode is set.
|
||||
|
||||
Signed-off-by: Jan Höppner <hoeppner@linux.vnet.ibm.com>
|
||||
|
||||
|
||||
Signed-off-by: Jan Höppner <hoeppner@linux.vnet.ibm.com>
|
||||
---
|
||||
dasdfmt/dasdfmt.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/dasdfmt/dasdfmt.c
|
||||
+++ b/dasdfmt/dasdfmt.c
|
||||
@@ -894,7 +894,7 @@ static void do_format_dasd(dasdfmt_info_
|
||||
vtoc_volume_label_set_label(vlabel, "LNX1");
|
||||
}
|
||||
|
||||
- if ((info->verbosity > 0) || (!info->withoutprompt))
|
||||
+ if ((info->verbosity > 0) || !info->withoutprompt || info->testmode)
|
||||
dasdfmt_print_info(info, vlabel, cylinders, heads, p);
|
||||
|
||||
count = u2s_get_host_access_count(info->devname);
|
@ -1,250 +0,0 @@
|
||||
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", ¶ms.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, ¶ms) < 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;
|
@ -1,892 +0,0 @@
|
||||
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: Apply coding convention
|
||||
|
||||
Improve the overall readability of the code by applying the Kernel
|
||||
coding convention.
|
||||
|
||||
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 | 362 +++++++++++++++++++++++++-----------------------------
|
||||
1 file changed, 171 insertions(+), 191 deletions(-)
|
||||
|
||||
--- a/dasdfmt/dasdfmt.c
|
||||
+++ b/dasdfmt/dasdfmt.c
|
||||
@@ -37,11 +37,10 @@ int reqsize;
|
||||
/*
|
||||
* Print version information.
|
||||
*/
|
||||
-static void
|
||||
-print_version (void)
|
||||
+static void print_version(void)
|
||||
{
|
||||
- printf ("%s version %s\n", tool_name, RELEASE_STRING);
|
||||
- printf ("%s\n", copyright_notice);
|
||||
+ printf("%s version %s\n", tool_name, RELEASE_STRING);
|
||||
+ printf("%s\n", copyright_notice);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -54,7 +53,7 @@ static void exit_usage(int exitcode)
|
||||
" [-b <blocksize> | --blocksize=<blocksize>]\n"
|
||||
" [-d <disk layout> | --disk_layout=<disk layout>]\n"
|
||||
" [-r <cylinder> | --requestsize=<cylinder>]\n"
|
||||
- " <device>\n\n",prog_name);
|
||||
+ " <device>\n\n", prog_name);
|
||||
|
||||
printf(" -t or --test means testmode\n"
|
||||
" -V or --version means print version\n"
|
||||
@@ -71,13 +70,13 @@ static void exit_usage(int exitcode)
|
||||
" -C or --check_host_count means force dasdfmt to check\n"
|
||||
" the host access open count to ensure the device\n"
|
||||
" is not online on another operating system instance\n"
|
||||
- " --norecordzero prevent storage server from modifying"
|
||||
- " record 0\n\n"
|
||||
+ " --norecordzero prevent storage server from modifying"
|
||||
+ " record 0\n\n"
|
||||
" <volser> is the volume identifier, which is converted\n"
|
||||
- " to EBCDIC and written to disk. \n"
|
||||
+ " to EBCDIC and written to disk.\n"
|
||||
" (6 characters, e.g. LNX001\n"
|
||||
" <blocksize> has to be power of 2 and at least 512\n"
|
||||
- " <disk layout> is either \n"
|
||||
+ " <disk layout> is either\n"
|
||||
" 'cdl' for compatible disk layout (default) or\n"
|
||||
" 'ldl' for linux disk layout\n"
|
||||
" <device> device node of the device to format\n");
|
||||
@@ -106,38 +105,39 @@ static int reread_partition_table(void)
|
||||
* signal handler:
|
||||
* enables the disk again in case of SIGTERM, SIGINT and SIGQUIT
|
||||
*/
|
||||
-static void program_interrupt_signal (int sig)
|
||||
+static void program_interrupt_signal(int sig)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (program_interrupt_in_progress)
|
||||
- raise (sig);
|
||||
+ raise(sig);
|
||||
program_interrupt_in_progress = 1;
|
||||
|
||||
if (disk_disabled) {
|
||||
- printf("Re-accessing the device... \n");
|
||||
+ printf("Re-accessing the device...\n");
|
||||
rc = ioctl(filedes, BIODASDENABLE, &format_params);
|
||||
if (rc)
|
||||
- ERRMSG_EXIT(EXIT_FAILURE,
|
||||
- "%s: (signal handler) IOCTL BIODASDENABLE "
|
||||
- "failed (%s)\n",prog_name,strerror(errno));
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "%s: (signal handler) IOCTL "
|
||||
+ "BIODASDENABLE failed (%s)\n", prog_name,
|
||||
+ strerror(errno));
|
||||
}
|
||||
|
||||
- printf("Rereading the partition table... \n");
|
||||
+ printf("Rereading the partition table...\n");
|
||||
rc = reread_partition_table();
|
||||
if (rc) {
|
||||
ERRMSG("%s: (signal handler) Re-reading partition table "
|
||||
"failed. (%s)\n", prog_name, strerror(errno));
|
||||
- } else
|
||||
+ } else {
|
||||
printf("Exiting...\n");
|
||||
+ }
|
||||
|
||||
rc = close(filedes);
|
||||
if (rc)
|
||||
ERRMSG("%s: (signal handler) Unable to close device (%s)\n",
|
||||
prog_name, strerror(errno));
|
||||
|
||||
- signal (sig, SIG_DFL);
|
||||
- raise (sig);
|
||||
+ signal(sig, SIG_DFL);
|
||||
+ raise(sig);
|
||||
}
|
||||
|
||||
|
||||
@@ -171,13 +171,13 @@ static void get_device_name(dasdfmt_info
|
||||
char* device;
|
||||
int i;
|
||||
|
||||
- if ((strchr(name, ' ') != NULL)||(strchr(name, '#') != NULL)||
|
||||
- (strchr(name, '[') != NULL)||(strchr(name, ']') != NULL)||
|
||||
- (strchr(name, '!') != NULL)||(strchr(name, '>') != NULL)||
|
||||
- (strchr(name, '(') != NULL)||(strchr(name, '<') != NULL)||
|
||||
- (strchr(name, ')') != NULL)||(strchr(name, ':') != NULL)||
|
||||
- (strchr(name, '&') != NULL)||(strchr(name, ';') != NULL))
|
||||
- ERRMSG_EXIT(EXIT_MISUSE,"%s: Your filename contains "
|
||||
+ if ((strchr(name, ' ') != NULL) || (strchr(name, '#') != NULL) ||
|
||||
+ (strchr(name, '[') != NULL) || (strchr(name, ']') != NULL) ||
|
||||
+ (strchr(name, '!') != NULL) || (strchr(name, '>') != NULL) ||
|
||||
+ (strchr(name, '(') != NULL) || (strchr(name, '<') != NULL) ||
|
||||
+ (strchr(name, ')') != NULL) || (strchr(name, ':') != NULL) ||
|
||||
+ (strchr(name, '&') != NULL) || (strchr(name, ';') != NULL))
|
||||
+ ERRMSG_EXIT(EXIT_MISUSE, "%s: Your filename contains "
|
||||
"blanks or special characters!\n",
|
||||
prog_name);
|
||||
|
||||
@@ -215,14 +215,14 @@ static void get_device_name(dasdfmt_info
|
||||
info->devname[PATH_MAX - 1] = '\0';
|
||||
|
||||
if (stat(info->devname, &dev_stat) != 0)
|
||||
- ERRMSG_EXIT(EXIT_MISUSE,
|
||||
- "%s: Could not get information for device node %s: %s\n",
|
||||
- prog_name, info->devname, strerror(errno));
|
||||
+ ERRMSG_EXIT(EXIT_MISUSE, "%s: Could not get information for "
|
||||
+ "device node %s: %s\n", prog_name, info->devname,
|
||||
+ strerror(errno));
|
||||
|
||||
if (minor(dev_stat.st_rdev) & PARTN_MASK) {
|
||||
- ERRMSG_EXIT(EXIT_MISUSE,
|
||||
- "%s: Unable to format partition %s. Please specify a device.\n",
|
||||
- prog_name, info->devname);
|
||||
+ ERRMSG_EXIT(EXIT_MISUSE, "%s: Unable to format partition %s. "
|
||||
+ "Please specify a device.\n", prog_name,
|
||||
+ info->devname);
|
||||
}
|
||||
|
||||
if (util_proc_dev_get_entry(dev_stat.st_rdev, 1, &dev_entry) == 0) {
|
||||
@@ -253,7 +253,7 @@ static void init_info(dasdfmt_info_t *in
|
||||
info->force = 0;
|
||||
info->writenolabel = 0;
|
||||
info->labelspec = 0;
|
||||
- info->cdl_format = 0;
|
||||
+ info->cdl_format = 0;
|
||||
info->blksize_specified = 0;
|
||||
info->reqsize_specified = 0;
|
||||
info->node_specified = 0;
|
||||
@@ -263,7 +263,6 @@ static void init_info(dasdfmt_info_t *in
|
||||
info->yast_mode = 0;
|
||||
}
|
||||
|
||||
-
|
||||
/*
|
||||
* check for disk type and set some variables (e.g. usage count)
|
||||
*/
|
||||
@@ -280,9 +279,9 @@ static void check_disk(dasdfmt_info_t *i
|
||||
"status information failed (%s)\n",
|
||||
prog_name, strerror(errno_save));
|
||||
}
|
||||
- if (ro) {
|
||||
+ if (ro)
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "Disk is read only!\n");
|
||||
- }
|
||||
+
|
||||
retry:
|
||||
if (ioctl(filedes, BIODASDINFO, &dasd_info) != 0) {
|
||||
errno_save = errno;
|
||||
@@ -314,7 +313,7 @@ retry:
|
||||
|
||||
info->usage_count = dasd_info.open_count;
|
||||
info->devno = dasd_info.devno;
|
||||
- if (strncmp(dasd_info.type, "ECKD",4) != 0) {
|
||||
+ if (strncmp(dasd_info.type, "ECKD", 4) != 0) {
|
||||
ERRMSG_EXIT(EXIT_FAILURE,
|
||||
"%s: Unsupported disk type\n%s is not an "
|
||||
"ECKD disk!\n", prog_name, info->devname);
|
||||
@@ -327,29 +326,28 @@ retry:
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
/*
|
||||
* check the volume serial for special
|
||||
* characters and move blanks to the end
|
||||
*/
|
||||
static int check_volser(char *s, int devno)
|
||||
{
|
||||
- int i,j;
|
||||
+ int i, j;
|
||||
|
||||
- for (i=0; i<6; i++) {
|
||||
+ for (i = 0; i < 6; i++) {
|
||||
if ((s[i] < 0x20) || (s[i] > 0x7a) ||
|
||||
- ((s[i] >= 0x21)&&(s[i] <= 0x22)) || /* !" */
|
||||
- ((s[i] >= 0x26)&&(s[i] <= 0x2f)) || /* &'()*+,-./ */
|
||||
- ((s[i] >= 0x3a)&&(s[i] <= 0x3f)) || /* :;<=>? */
|
||||
- ((s[i] >= 0x5b)&&(s[i] <= 0x60))) /* \]^_` */
|
||||
+ ((s[i] >= 0x21) && (s[i] <= 0x22)) || /* !" */
|
||||
+ ((s[i] >= 0x26) && (s[i] <= 0x2f)) || /* &'()*+,-./ */
|
||||
+ ((s[i] >= 0x3a) && (s[i] <= 0x3f)) || /* :;<=>? */
|
||||
+ ((s[i] >= 0x5b) && (s[i] <= 0x60))) /* \]^_` */
|
||||
s[i] = ' ';
|
||||
s[i] = toupper(s[i]);
|
||||
}
|
||||
s[6] = 0x00;
|
||||
|
||||
- for (i=0; i<6; i++) {
|
||||
+ for (i = 0; i < 6; i++) {
|
||||
if (s[i] == ' ')
|
||||
- for (j=i; j<6; j++)
|
||||
+ for (j = i; j < 6; j++)
|
||||
if (s[j] != ' ') {
|
||||
s[i] = s[j];
|
||||
s[j] = ' ';
|
||||
@@ -360,7 +358,7 @@ static int check_volser(char *s, int dev
|
||||
if (s[0] == ' ') {
|
||||
printf("Usage error, switching to default.\n");
|
||||
sprintf(s, "0X%04x", devno);
|
||||
- for (i=0; i<6; i++)
|
||||
+ for (i = 0; i < 6; i++)
|
||||
s[i] = toupper(s[i]);
|
||||
return -1;
|
||||
}
|
||||
@@ -368,7 +366,6 @@ static int check_volser(char *s, int dev
|
||||
return 0;
|
||||
}
|
||||
|
||||
-
|
||||
/*
|
||||
* do some blocksize checks
|
||||
*/
|
||||
@@ -377,7 +374,7 @@ static int check_param(char *s, size_t b
|
||||
int tmp = data->blksize;
|
||||
|
||||
if ((tmp < 512) || (tmp > 4096)) {
|
||||
- strncpy(s,"Blocksize must be one of the following positive "
|
||||
+ strncpy(s, "Blocksize must be one of the following positive "
|
||||
"integers:\n512, 1024, 2048, 4096.", buffsize);
|
||||
if (buffsize > 0)
|
||||
s[buffsize - 1] = '\0';
|
||||
@@ -386,7 +383,7 @@ static int check_param(char *s, size_t b
|
||||
|
||||
while (tmp > 0) {
|
||||
if ((tmp % 2) && (tmp != 1)) {
|
||||
- strncpy(s,"Blocksize must be a power of 2.", buffsize);
|
||||
+ strncpy(s, "Blocksize must be a power of 2.", buffsize);
|
||||
if (buffsize > 0)
|
||||
s[buffsize - 1] = '\0';
|
||||
return -1;
|
||||
@@ -397,7 +394,6 @@ static int check_param(char *s, size_t b
|
||||
return 0;
|
||||
}
|
||||
|
||||
-
|
||||
/*
|
||||
* ask the user to specify a blocksize
|
||||
*/
|
||||
@@ -415,7 +411,7 @@ static format_data_t ask_user_for_blksiz
|
||||
if (fgets(buffer, sizeof(buffer), stdin) == NULL)
|
||||
break;
|
||||
|
||||
- rc = sscanf(buffer,"%d%c", ¶ms.blksize, &c);
|
||||
+ rc = sscanf(buffer, "%d%c", ¶ms.blksize, &c);
|
||||
if ((rc == 2) && (c == '\n'))
|
||||
rc = 1;
|
||||
if (rc == -1)
|
||||
@@ -424,7 +420,7 @@ static format_data_t ask_user_for_blksiz
|
||||
printf(" -- wrong input, try again.\n");
|
||||
|
||||
if (check_param(str, ERR_LENGTH, ¶ms) < 0) {
|
||||
- printf(" -- %s\n",str);
|
||||
+ printf(" -- %s\n", str);
|
||||
rc = 0;
|
||||
}
|
||||
} while (rc != 1);
|
||||
@@ -432,7 +428,6 @@ static format_data_t ask_user_for_blksiz
|
||||
return params;
|
||||
}
|
||||
|
||||
-
|
||||
/*
|
||||
* print all information needed to format the device
|
||||
*/
|
||||
@@ -449,7 +444,7 @@ static void dasdfmt_print_info(dasdfmt_i
|
||||
printf("%s in the following way:\n", info->devname);
|
||||
printf(" Device number of device : 0x%x\n", info->devno);
|
||||
printf(" Labelling device : %s\n",
|
||||
- (info->writenolabel)?"no":"yes");
|
||||
+ (info->writenolabel) ? "no" : "yes");
|
||||
|
||||
if (!info->writenolabel) {
|
||||
vtoc_volume_label_get_label(vlabel, vollbl);
|
||||
@@ -460,31 +455,31 @@ static void dasdfmt_print_info(dasdfmt_i
|
||||
printf(" Extent start (trk no) : %u\n", p->start_unit);
|
||||
printf(" Extent end (trk no) : %u\n", p->stop_unit);
|
||||
printf(" Compatible Disk Layout : %s\n",
|
||||
- (p->intensity & DASD_FMT_INT_COMPAT)?"yes":"no");
|
||||
+ (p->intensity & DASD_FMT_INT_COMPAT) ? "yes" : "no");
|
||||
printf(" Blocksize : %d\n", p->blksize);
|
||||
|
||||
if (info->testmode)
|
||||
printf("Test mode active, omitting ioctl.\n");
|
||||
}
|
||||
|
||||
-
|
||||
/*
|
||||
* get volser
|
||||
*/
|
||||
-static int dasdfmt_get_volser(char * devname, char * volser)
|
||||
+static int dasdfmt_get_volser(char *devname, char *volser)
|
||||
{
|
||||
- dasd_information_t dasd_info;
|
||||
+ dasd_information_t dasd_info;
|
||||
int blksize;
|
||||
int f;
|
||||
volume_label_t vlabel;
|
||||
|
||||
- if ((f = open(devname, O_RDONLY)) == -1)
|
||||
- ERRMSG_EXIT(EXIT_FAILURE,"%s: Unable to open device %s: %s\n",
|
||||
+ f = open(devname, O_RDONLY);
|
||||
+ if (f == -1)
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "%s: Unable to open device %s: %s\n",
|
||||
prog_name, devname, strerror(errno));
|
||||
|
||||
if (ioctl(f, BIODASDINFO, &dasd_info) != 0)
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "%s: (label pos) IOCTL BIODASD"
|
||||
- "INFO failed (%s).\n",prog_name, strerror(errno));
|
||||
+ "INFO failed (%s).\n", prog_name, strerror(errno));
|
||||
|
||||
if (ioctl(f, BLKSSZGET, &blksize) != 0)
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "%s: (label pos) IOCTL BLKSSZGET "
|
||||
@@ -500,8 +495,7 @@ static int dasdfmt_get_volser(char * dev
|
||||
vtoc_read_volume_label(devname, dasd_info.label_block * blksize, &vlabel);
|
||||
vtoc_volume_label_get_volser(&vlabel, volser);
|
||||
return 0;
|
||||
- }
|
||||
- else {
|
||||
+ } else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -512,22 +506,24 @@ static int dasdfmt_get_volser(char * dev
|
||||
static void dasdfmt_write_labels(dasdfmt_info_t *info, volume_label_t *vlabel,
|
||||
unsigned int cylinders, unsigned int heads)
|
||||
{
|
||||
- int label_position;
|
||||
- dasd_information_t dasd_info;
|
||||
- struct hd_geometry geo;
|
||||
- format4_label_t f4;
|
||||
- format5_label_t f5;
|
||||
- format7_label_t f7;
|
||||
+ int label_position;
|
||||
+ dasd_information_t dasd_info;
|
||||
+ struct hd_geometry geo;
|
||||
+ format4_label_t f4;
|
||||
+ format5_label_t f5;
|
||||
+ format7_label_t f7;
|
||||
int rc, blksize;
|
||||
void *ipl1_record, *ipl2_record;
|
||||
int ipl1_record_len, ipl2_record_len;
|
||||
|
||||
|
||||
- if (info->verbosity > 0) printf("Retrieving dasd information... ");
|
||||
+ if (info->verbosity > 0)
|
||||
+ printf("Retrieving dasd information... ");
|
||||
|
||||
if (ioctl(filedes, BIODASDINFO, &dasd_info) != 0)
|
||||
- ERRMSG_EXIT(EXIT_FAILURE, "%s: (write labels) IOCTL BIODASD"
|
||||
- "INFO failed (%s).\n",prog_name, strerror(errno));
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "%s: (write labels) IOCTL "
|
||||
+ "BIODASDINFO failed (%s).\n",
|
||||
+ prog_name, strerror(errno));
|
||||
|
||||
if (ioctl(filedes, BLKSSZGET, &blksize) != 0)
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "%s: (write labels) IOCTL BLKSSZGET "
|
||||
@@ -539,13 +535,16 @@ static void dasdfmt_write_labels(dasdfmt
|
||||
* vary depending on the format.
|
||||
*/
|
||||
if (ioctl(filedes, HDIO_GETGEO, &geo) != 0)
|
||||
- ERRMSG_EXIT(EXIT_FAILURE, "%s: (write labels) IOCTL HDIO_GET"
|
||||
- "GEO failed (%s).\n", prog_name, strerror(errno));
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "%s: (write labels) IOCTL "
|
||||
+ "HDIO_GETGEO failed (%s).\n",
|
||||
+ prog_name, strerror(errno));
|
||||
|
||||
- if (info->verbosity > 0) printf("ok\n");
|
||||
+ if (info->verbosity > 0)
|
||||
+ printf("ok\n");
|
||||
|
||||
/* write empty bootstrap (initial IPL records) */
|
||||
- if (info->verbosity > 0) printf("Writing empty bootstrap...\n");
|
||||
+ if (info->verbosity > 0)
|
||||
+ printf("Writing empty bootstrap...\n");
|
||||
|
||||
/*
|
||||
* Note: ldl labels do not contain the key field
|
||||
@@ -596,7 +595,8 @@ static void dasdfmt_write_labels(dasdfmt
|
||||
|
||||
label_position = dasd_info.label_block * blksize;
|
||||
|
||||
- if (info->verbosity > 0) printf("Writing label...\n");
|
||||
+ if (info->verbosity > 0)
|
||||
+ printf("Writing label...\n");
|
||||
|
||||
rc = lseek(filedes, label_position, SEEK_SET);
|
||||
if (rc != label_position)
|
||||
@@ -608,10 +608,10 @@ static void dasdfmt_write_labels(dasdfmt
|
||||
* Note: cdl volume labels do not contain the 'formatted_blocks' part
|
||||
* and ldl labels do not contain the key field
|
||||
*/
|
||||
- if (info->cdl_format)
|
||||
+ if (info->cdl_format) {
|
||||
rc = write(filedes, vlabel, (sizeof(*vlabel) -
|
||||
sizeof(vlabel->formatted_blocks)));
|
||||
- else {
|
||||
+ } else {
|
||||
vlabel->ldl_version = 0xf2; /* EBCDIC '2' */
|
||||
vlabel->formatted_blocks = cylinders * heads * geo.sectors;
|
||||
rc = write(filedes, &vlabel->vollbl, (sizeof(*vlabel)
|
||||
@@ -625,7 +625,8 @@ static void dasdfmt_write_labels(dasdfmt
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "%s: Error writing volume label "
|
||||
"(%d).\n", prog_name, rc);
|
||||
|
||||
- if (info->verbosity > 0) printf("Writing VTOC... ");
|
||||
+ if (info->verbosity > 0)
|
||||
+ printf("Writing VTOC... ");
|
||||
|
||||
label_position = (VTOC_START_CC * heads + VTOC_START_HH) *
|
||||
geo.sectors * blksize;
|
||||
@@ -673,10 +674,10 @@ static void dasdfmt_write_labels(dasdfmt
|
||||
|
||||
fsync(filedes);
|
||||
|
||||
- if (info->verbosity > 0) printf("ok\n");
|
||||
+ if (info->verbosity > 0)
|
||||
+ printf("ok\n");
|
||||
}
|
||||
|
||||
-
|
||||
/*
|
||||
* formats the disk cylinderwise
|
||||
*/
|
||||
@@ -720,21 +721,20 @@ static void dasdfmt_format(dasdfmt_info_
|
||||
format_step.start_unit += 1;
|
||||
|
||||
if (ioctl(filedes, BIODASDFMT, &format_step) != 0)
|
||||
- ERRMSG_EXIT(EXIT_FAILURE,"%s: (format cylinder) IOCTL "
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "%s: (format cylinder) IOCTL "
|
||||
"BIODASDFMT failed. (%s)\n",
|
||||
prog_name, strerror(errno));
|
||||
|
||||
if (info->print_progressbar) {
|
||||
printf("cyl %7d of %7d |", cyl, cylinders);
|
||||
p2 = p1;
|
||||
- p1 = cyl*100/cylinders;
|
||||
- if (p1 != p2)
|
||||
- {
|
||||
+ p1 = cyl * 100 / cylinders;
|
||||
+ if (p1 != p2) {
|
||||
/* percent value has changed */
|
||||
- tmp = cyl*50/cylinders;
|
||||
- for (j=1; j<=tmp; j++)
|
||||
+ 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);
|
||||
}
|
||||
@@ -748,6 +748,7 @@ static void dasdfmt_format(dasdfmt_info_
|
||||
fflush(stdout);
|
||||
hashcount++;
|
||||
}
|
||||
+
|
||||
if (info->print_percentage) {
|
||||
printf("cyl %7d of %7d |%3d%%\n", cyl, cylinders,
|
||||
cyl*100/cylinders);
|
||||
@@ -757,9 +758,9 @@ static void dasdfmt_format(dasdfmt_info_
|
||||
if (k % heads == 0) {
|
||||
k += reqsize * heads;
|
||||
cyl += reqsize;
|
||||
- }
|
||||
- else
|
||||
+ } else {
|
||||
k += format_params->stop_unit % heads;
|
||||
+ }
|
||||
|
||||
if (k > format_params->stop_unit)
|
||||
break;
|
||||
@@ -769,14 +770,9 @@ static void dasdfmt_format(dasdfmt_info_
|
||||
printf("\n\n");
|
||||
}
|
||||
|
||||
-
|
||||
-/*
|
||||
- *
|
||||
- */
|
||||
-static void dasdfmt_prepare_and_format (dasdfmt_info_t *info,
|
||||
- unsigned int cylinders,
|
||||
- unsigned int heads,
|
||||
- format_data_t *p)
|
||||
+static void dasdfmt_prepare_and_format(dasdfmt_info_t *info,
|
||||
+ unsigned int cylinders,
|
||||
+ unsigned int heads, format_data_t *p)
|
||||
{
|
||||
format_data_t temp = {
|
||||
start_unit: 0,
|
||||
@@ -786,7 +782,8 @@ static void dasdfmt_prepare_and_format (
|
||||
| DASD_FMT_INT_INVAL)
|
||||
};
|
||||
|
||||
- if (info->verbosity > 0) printf("Detaching the device...\n");
|
||||
+ if (info->verbosity > 0)
|
||||
+ printf("Detaching the device...\n");
|
||||
|
||||
if (ioctl(filedes, BIODASDDISABLE, p) != 0)
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "%s: (prepare device) IOCTL "
|
||||
@@ -794,7 +791,8 @@ static void dasdfmt_prepare_and_format (
|
||||
strerror(errno));
|
||||
disk_disabled = 1;
|
||||
|
||||
- if (info->verbosity > 0) printf("Invalidate first track...\n");
|
||||
+ if (info->verbosity > 0)
|
||||
+ printf("Invalidate first track...\n");
|
||||
|
||||
if (ioctl(filedes, BIODASDFMT, &temp) != 0)
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "%s: (invalidate first track) IOCTL "
|
||||
@@ -806,18 +804,21 @@ static void dasdfmt_prepare_and_format (
|
||||
|
||||
dasdfmt_format(info, cylinders, heads, p);
|
||||
|
||||
- if (info->verbosity > 0) printf("formatting tracks complete...\n");
|
||||
+ if (info->verbosity > 0)
|
||||
+ printf("formatting tracks complete...\n");
|
||||
|
||||
temp.intensity = p->intensity;
|
||||
|
||||
- if (info->verbosity > 0) printf("Revalidate first track...\n");
|
||||
+ if (info->verbosity > 0)
|
||||
+ printf("Revalidate first track...\n");
|
||||
|
||||
if (ioctl(filedes, BIODASDFMT, &temp) != 0)
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "%s: (re-validate first track) IOCTL"
|
||||
" BIODASDFMT failed (%s)\n", prog_name,
|
||||
strerror(errno));
|
||||
|
||||
- if (info->verbosity > 0) printf("Re-accessing the device...\n");
|
||||
+ if (info->verbosity > 0)
|
||||
+ printf("Re-accessing the device...\n");
|
||||
|
||||
if (ioctl(filedes, BIODASDENABLE, p) != 0)
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "%s: (prepare device) IOCTL "
|
||||
@@ -826,20 +827,17 @@ static void dasdfmt_prepare_and_format (
|
||||
disk_disabled = 0;
|
||||
}
|
||||
|
||||
-
|
||||
-/*
|
||||
- *
|
||||
- */
|
||||
static void do_format_dasd(dasdfmt_info_t *info, format_data_t *p,
|
||||
volume_label_t *vlabel)
|
||||
{
|
||||
- char inp_buffer[5];
|
||||
+ char inp_buffer[5];
|
||||
dasd_information_t dasd_info;
|
||||
struct dasd_eckd_characteristics *characteristics;
|
||||
unsigned int cylinders, heads;
|
||||
int count;
|
||||
|
||||
- if (info->verbosity > 0) printf("Retrieving disk geometry...\n");
|
||||
+ if (info->verbosity > 0)
|
||||
+ printf("Retrieving disk geometry...\n");
|
||||
|
||||
if (ioctl(filedes, BIODASDINFO, &dasd_info) != 0)
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "%s: (retrieving disk information) "
|
||||
@@ -877,22 +875,23 @@ static void do_format_dasd(dasdfmt_info_
|
||||
}
|
||||
}
|
||||
} else {
|
||||
- if (!info->labelspec && !info->keep_volser) {
|
||||
+ if (!info->labelspec && !info->keep_volser) {
|
||||
char buf[7];
|
||||
|
||||
- sprintf(buf, "0X%04x", info->devno);
|
||||
+ sprintf(buf, "0X%04x", info->devno);
|
||||
check_volser(buf, info->devno);
|
||||
vtoc_volume_label_set_volser(vlabel, buf);
|
||||
}
|
||||
|
||||
- if (p->intensity & DASD_FMT_INT_COMPAT) {
|
||||
+ if (p->intensity & DASD_FMT_INT_COMPAT) {
|
||||
info->cdl_format = 1;
|
||||
vtoc_volume_label_set_label(vlabel, "VOL1");
|
||||
vtoc_volume_label_set_key(vlabel, "VOL1");
|
||||
vtoc_set_cchhb(&vlabel->vtoc, 0x0000, 0x0001, 0x01);
|
||||
- } else
|
||||
+ } else {
|
||||
vtoc_volume_label_set_label(vlabel, "LNX1");
|
||||
- }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
if ((info->verbosity > 0) || !info->withoutprompt || info->testmode)
|
||||
dasdfmt_print_info(info, vlabel, cylinders, heads, p);
|
||||
@@ -926,15 +925,15 @@ static void do_format_dasd(dasdfmt_info_
|
||||
"untouched: ");
|
||||
if (fgets(inp_buffer, sizeof(inp_buffer), stdin) == NULL)
|
||||
return;
|
||||
- if (strcasecmp(inp_buffer,"yes") &&
|
||||
- strcasecmp(inp_buffer,"yes\n")) {
|
||||
+ if (strcasecmp(inp_buffer, "yes") &&
|
||||
+ strcasecmp(inp_buffer, "yes\n")) {
|
||||
printf("Omitting ioctl call (disk will "
|
||||
"NOT be formatted).\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
- if (!((info->withoutprompt)&&(info->verbosity<1)))
|
||||
+ if (!((info->withoutprompt) && (info->verbosity < 1)))
|
||||
printf("Formatting the device. This may take a "
|
||||
"while (get yourself a coffee).\n");
|
||||
|
||||
@@ -954,12 +953,11 @@ static void do_format_dasd(dasdfmt_info_
|
||||
} else {
|
||||
if (!info->yast_mode)
|
||||
printf("ok\n");
|
||||
- }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
-int main(int argc,char *argv[])
|
||||
+int main(int argc, char *argv[])
|
||||
{
|
||||
dasdfmt_info_t info;
|
||||
volume_label_t vlabel;
|
||||
@@ -980,9 +978,9 @@ int main(int argc,char *argv[])
|
||||
int running=0;
|
||||
|
||||
/* Establish a handler for interrupt signals. */
|
||||
- signal (SIGTERM, program_interrupt_signal);
|
||||
- signal (SIGINT, program_interrupt_signal);
|
||||
- signal (SIGQUIT, program_interrupt_signal);
|
||||
+ signal(SIGTERM, program_interrupt_signal);
|
||||
+ signal(SIGINT, program_interrupt_signal);
|
||||
+ signal(SIGQUIT, program_interrupt_signal);
|
||||
|
||||
/******************* initialization ********************/
|
||||
prog_name = argv[0];
|
||||
@@ -996,102 +994,81 @@ int main(int argc,char *argv[])
|
||||
|
||||
/*************** parse parameters **********************/
|
||||
|
||||
- while (1)
|
||||
- {
|
||||
- rc=getopt_long(argc, argv, dasdfmt_getopt_string,
|
||||
- dasdfmt_getopt_long_options, &index);
|
||||
+ while (1) {
|
||||
+ rc = getopt_long(argc, argv, dasdfmt_getopt_string,
|
||||
+ dasdfmt_getopt_long_options, &index);
|
||||
|
||||
- switch (rc)
|
||||
- {
|
||||
+ switch (rc) {
|
||||
case 'F':
|
||||
- info.force=1;
|
||||
+ info.force = 1;
|
||||
break;
|
||||
-
|
||||
- case 'd' :
|
||||
- if (strncmp(optarg,"cdl",3)==0)
|
||||
- {
|
||||
+ case 'd':
|
||||
+ if (strncmp(optarg, "cdl", 3) == 0) {
|
||||
format_params.intensity |= DASD_FMT_INT_COMPAT;
|
||||
- if (info.writenolabel)
|
||||
- {
|
||||
- printf("WARNING: using the cdl " \
|
||||
- "format without writing a " \
|
||||
- "label doesn't make much " \
|
||||
+ if (info.writenolabel) {
|
||||
+ printf("WARNING: using the cdl "
|
||||
+ "format without writing a "
|
||||
+ "label doesn't make much "
|
||||
"sense!\n");
|
||||
exit(1);
|
||||
}
|
||||
- }
|
||||
- else if (strncmp(optarg,"ldl",3)==0)
|
||||
+ } else if (strncmp(optarg, "ldl", 3) == 0) {
|
||||
format_params.intensity &= ~DASD_FMT_INT_COMPAT;
|
||||
- else
|
||||
- {
|
||||
+ } else {
|
||||
printf("%s is not a valid option!\n", optarg);
|
||||
exit(1);
|
||||
}
|
||||
- break;
|
||||
-
|
||||
+ break;
|
||||
case 'y':
|
||||
- info.withoutprompt=1;
|
||||
+ info.withoutprompt = 1;
|
||||
break;
|
||||
-
|
||||
case 'z':
|
||||
- format_params.intensity |= DASD_FMT_INT_FMT_NOR0;
|
||||
+ format_params.intensity |= DASD_FMT_INT_FMT_NOR0;
|
||||
break;
|
||||
-
|
||||
case 't':
|
||||
- info.testmode=1;
|
||||
+ info.testmode = 1;
|
||||
break;
|
||||
-
|
||||
case 'p':
|
||||
if (!(info.print_hashmarks || info.print_percentage))
|
||||
info.print_progressbar = 1;
|
||||
break;
|
||||
-
|
||||
case 'm':
|
||||
- if (!(info.print_progressbar || info.print_percentage))
|
||||
- {
|
||||
- hashstep_str=optarg;
|
||||
- info.print_hashmarks=1;
|
||||
+ if (!(info.print_progressbar || info.print_percentage)) {
|
||||
+ hashstep_str = optarg;
|
||||
+ info.print_hashmarks = 1;
|
||||
}
|
||||
break;
|
||||
-
|
||||
case 'Q':
|
||||
if (!(info.print_hashmarks || info.print_progressbar))
|
||||
info.print_percentage = 1;
|
||||
break;
|
||||
-
|
||||
case 'v':
|
||||
- info.verbosity=1;
|
||||
+ info.verbosity = 1;
|
||||
break;
|
||||
-
|
||||
case 'h':
|
||||
exit_usage(0);
|
||||
-
|
||||
case 'V':
|
||||
print_version();
|
||||
exit(0);
|
||||
-
|
||||
case 'l':
|
||||
- strncpy(buf, optarg, 6);
|
||||
+ strncpy(buf, optarg, 6);
|
||||
if (check_volser(buf, 0) < 0)
|
||||
break;
|
||||
- vtoc_volume_label_set_volser(&vlabel,buf);
|
||||
- info.labelspec=1;
|
||||
+ vtoc_volume_label_set_volser(&vlabel, buf);
|
||||
+ info.labelspec = 1;
|
||||
break;
|
||||
-
|
||||
case 'L':
|
||||
- if (format_params.intensity & DASD_FMT_INT_COMPAT)
|
||||
- {
|
||||
- printf("WARNING: using the cdl format " \
|
||||
- "without writing a label doesn't " \
|
||||
+ if (format_params.intensity & DASD_FMT_INT_COMPAT) {
|
||||
+ printf("WARNING: using the cdl format "
|
||||
+ "without writing a label doesn't "
|
||||
"make much sense!\n");
|
||||
exit(1);
|
||||
}
|
||||
- info.writenolabel=1;
|
||||
+ info.writenolabel = 1;
|
||||
break;
|
||||
-
|
||||
- case 'b' :
|
||||
- blksize_param_str=optarg;
|
||||
- info.blksize_specified=1;
|
||||
+ case 'b':
|
||||
+ blksize_param_str = optarg;
|
||||
+ info.blksize_specified = 1;
|
||||
break;
|
||||
case 'r':
|
||||
reqsize_param_str = optarg;
|
||||
@@ -1102,7 +1079,7 @@ int main(int argc,char *argv[])
|
||||
ERRMSG_EXIT(EXIT_MISUSE,"%s: too many devices specified.\n",
|
||||
prog_name);
|
||||
dev_filename[dev_count++]=strdup(optarg);
|
||||
- info.node_specified=1;
|
||||
+ info.node_specified = 1;
|
||||
break;
|
||||
case 'Y' : /* YaST mode */
|
||||
info.yast_mode=1;
|
||||
@@ -1110,8 +1087,8 @@ int main(int argc,char *argv[])
|
||||
case 'P' : /* max parallel formatting processes */
|
||||
max_parallel=atoi(optarg);
|
||||
break;
|
||||
- case 'k' :
|
||||
- info.keep_volser=1;
|
||||
+ case 'k':
|
||||
+ info.keep_volser = 1;
|
||||
break;
|
||||
case 'C':
|
||||
info.force_host = 1;
|
||||
@@ -1121,11 +1098,12 @@ int main(int argc,char *argv[])
|
||||
info.device_id = optind;
|
||||
break;
|
||||
default:
|
||||
- ERRMSG_EXIT(EXIT_MISUSE,
|
||||
- "Try '%s --help' for more"
|
||||
- " information.\n",prog_name);
|
||||
+ ERRMSG_EXIT(EXIT_MISUSE, "Try '%s --help' for more"
|
||||
+ " information.\n", prog_name);
|
||||
}
|
||||
- if (rc==-1) break; // exit loop if finished
|
||||
+
|
||||
+ if (rc == -1)
|
||||
+ break; /* exit loop if finished */
|
||||
}
|
||||
|
||||
CHECK_SPEC_MAX_ONCE(info.blksize_specified, "blocksize");
|
||||
@@ -1222,7 +1200,7 @@ int main(int argc,char *argv[])
|
||||
} else
|
||||
reqsize = DEFAULT_REQUESTSIZE;
|
||||
if (info.print_hashmarks)
|
||||
- PARSE_PARAM_INTO(info.hashstep, hashstep_str,10,"hashstep");
|
||||
+ PARSE_PARAM_INTO(info.hashstep, hashstep_str, 10, "hashstep");
|
||||
|
||||
get_device_name(&info, dev_filename[i]);
|
||||
|
||||
@@ -1230,22 +1208,24 @@ int main(int argc,char *argv[])
|
||||
format_params = ask_user_for_blksize(format_params);
|
||||
|
||||
if (info.keep_volser) {
|
||||
- if(format_params.intensity == 0x00) {
|
||||
- printf("WARNING: VOLSER cannot be kept " \
|
||||
+ if (format_params.intensity == 0x00) {
|
||||
+ printf("WARNING: VOLSER cannot be kept "
|
||||
"when using the ldl format!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
- if(dasdfmt_get_volser(info.devname, old_volser) == 0)
|
||||
+ if (dasdfmt_get_volser(info.devname, old_volser) == 0)
|
||||
vtoc_volume_label_set_volser(&vlabel, old_volser);
|
||||
else
|
||||
- ERRMSG_EXIT(EXIT_FAILURE,"%s: VOLSER not found on device %s\n",
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE,
|
||||
+ "%s: VOLSER not found on device %s\n",
|
||||
prog_name, info.devname);
|
||||
|
||||
}
|
||||
|
||||
- if ((filedes = open(info.devname, O_RDWR)) == -1)
|
||||
- ERRMSG_EXIT(EXIT_FAILURE,"%s: Unable to open device %s: %s\n",
|
||||
+ filedes = open(info.devname, O_RDWR);
|
||||
+ if (filedes == -1)
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "%s: Unable to open device %s: %s\n",
|
||||
prog_name, info.devname, strerror(errno));
|
||||
|
||||
check_disk(&info);
|
@ -1,399 +0,0 @@
|
||||
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: Use enhanced DASD information
|
||||
|
||||
Currently dasdfmt uses BIODASDINFO as the IOCTL command to retrieve
|
||||
information about a DASD and stores them in dasd_information_t.
|
||||
However, BIODASDINFO2 offers a few more useful information (which are
|
||||
then stored in dasd_information2_t).
|
||||
|
||||
- Replace dasd_information_t with dasd_information2_t.
|
||||
- Make the corresponding variable part of dasdfmt_info_t, since it is
|
||||
used in several functions anyway and we can save a few parameters and
|
||||
IOCTL calls.
|
||||
- Change the initialization of dasdfmt_info_t. A separate function isn't
|
||||
necessary for that.
|
||||
- Put the BIODASDINFO2 IOCTL call in a separate function which is then
|
||||
called only once.
|
||||
|
||||
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 | 132 ++++++++++++++++++------------------------------------
|
||||
dasdfmt/dasdfmt.h | 21 ++++++--
|
||||
2 files changed, 61 insertions(+), 92 deletions(-)
|
||||
|
||||
--- a/dasdfmt/dasdfmt.c
|
||||
+++ b/dasdfmt/dasdfmt.c
|
||||
@@ -237,30 +237,18 @@ static void get_device_name(dasdfmt_info
|
||||
}
|
||||
|
||||
/*
|
||||
- * initialize the dasdfmt info structure
|
||||
+ * Retrieve DASD information
|
||||
*/
|
||||
-static void init_info(dasdfmt_info_t *info)
|
||||
+static void get_device_info(dasdfmt_info_t *info)
|
||||
{
|
||||
- info->devno = 0x0;
|
||||
- info->usage_count = 0;
|
||||
- info->testmode = 0;
|
||||
- info->verbosity = 0;
|
||||
- info->withoutprompt = 0;
|
||||
- info->print_progressbar = 0;
|
||||
- info->print_hashmarks = 0;
|
||||
- info->print_percentage = 0;
|
||||
- info->hashstep = 0;
|
||||
- info->force = 0;
|
||||
- info->writenolabel = 0;
|
||||
- info->labelspec = 0;
|
||||
- info->cdl_format = 0;
|
||||
- info->blksize_specified = 0;
|
||||
- info->reqsize_specified = 0;
|
||||
- info->node_specified = 0;
|
||||
- info->device_id = 0;
|
||||
- info->keep_volser = 0;
|
||||
- info->force_host = 0;
|
||||
- info->yast_mode = 0;
|
||||
+ dasd_information2_t dasd_info;
|
||||
+
|
||||
+ if (ioctl(filedes, BIODASDINFO2, &dasd_info))
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "%s: the ioctl call to retrieve "
|
||||
+ "device information failed (%s).\n",
|
||||
+ prog_name, strerror(errno));
|
||||
+
|
||||
+ info->dasd_info = dasd_info;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -268,7 +256,6 @@ static void init_info(dasdfmt_info_t *in
|
||||
*/
|
||||
static void check_disk(dasdfmt_info_t *info)
|
||||
{
|
||||
- dasd_information_t dasd_info;
|
||||
int ro, errno_save, i = 0;
|
||||
|
||||
if (ioctl(filedes, BLKROGET, &ro) != 0) {
|
||||
@@ -283,15 +270,6 @@ static void check_disk(dasdfmt_info_t *i
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "Disk is read only!\n");
|
||||
|
||||
retry:
|
||||
- if (ioctl(filedes, BIODASDINFO, &dasd_info) != 0) {
|
||||
- errno_save = errno;
|
||||
- close(filedes);
|
||||
- ERRMSG_EXIT(EXIT_FAILURE,
|
||||
- "%s: the ioctl call to retrieve device "
|
||||
- "information failed (%s)\n",
|
||||
- prog_name, strerror(errno_save));
|
||||
- }
|
||||
-
|
||||
if (!info->force)
|
||||
/*
|
||||
* udev strikes again.
|
||||
@@ -302,7 +280,7 @@ retry:
|
||||
* And confusing the hell out ouf anyone else.
|
||||
* Bah.
|
||||
*/
|
||||
- if (dasd_info.open_count > 1) {
|
||||
+ if (info->dasd_info.open_count > 1) {
|
||||
if (i < 5) {
|
||||
++i;
|
||||
sleep(1);
|
||||
@@ -311,9 +289,7 @@ retry:
|
||||
ERRMSG_EXIT(EXIT_BUSY, "Disk in use!\n");
|
||||
}
|
||||
|
||||
- info->usage_count = dasd_info.open_count;
|
||||
- info->devno = dasd_info.devno;
|
||||
- if (strncmp(dasd_info.type, "ECKD", 4) != 0) {
|
||||
+ if (strncmp(info->dasd_info.type, "ECKD", 4) != 0) {
|
||||
ERRMSG_EXIT(EXIT_FAILURE,
|
||||
"%s: Unsupported disk type\n%s is not an "
|
||||
"ECKD disk!\n", prog_name, info->devname);
|
||||
@@ -442,7 +418,7 @@ static void dasdfmt_print_info(dasdfmt_i
|
||||
|
||||
printf("\nI am going to format the device ");
|
||||
printf("%s in the following way:\n", info->devname);
|
||||
- printf(" Device number of device : 0x%x\n", info->devno);
|
||||
+ printf(" Device number of device : 0x%x\n", info->dasd_info.devno);
|
||||
printf(" Labelling device : %s\n",
|
||||
(info->writenolabel) ? "no" : "yes");
|
||||
|
||||
@@ -465,21 +441,16 @@ static void dasdfmt_print_info(dasdfmt_i
|
||||
/*
|
||||
* get volser
|
||||
*/
|
||||
-static int dasdfmt_get_volser(char *devname, char *volser)
|
||||
+static int dasdfmt_get_volser(dasdfmt_info_t *info, char *volser)
|
||||
{
|
||||
- dasd_information_t dasd_info;
|
||||
int blksize;
|
||||
int f;
|
||||
volume_label_t vlabel;
|
||||
|
||||
- f = open(devname, O_RDONLY);
|
||||
+ f = open(info->devname, O_RDONLY);
|
||||
if (f == -1)
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "%s: Unable to open device %s: %s\n",
|
||||
- prog_name, devname, strerror(errno));
|
||||
-
|
||||
- if (ioctl(f, BIODASDINFO, &dasd_info) != 0)
|
||||
- ERRMSG_EXIT(EXIT_FAILURE, "%s: (label pos) IOCTL BIODASD"
|
||||
- "INFO failed (%s).\n", prog_name, strerror(errno));
|
||||
+ prog_name, info->devname, strerror(errno));
|
||||
|
||||
if (ioctl(f, BLKSSZGET, &blksize) != 0)
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "%s: (label pos) IOCTL BLKSSZGET "
|
||||
@@ -489,10 +460,12 @@ static int dasdfmt_get_volser(char *devn
|
||||
ERRMSG("%s: error during close: %s\ncontinuing...\n",
|
||||
prog_name, strerror(errno));
|
||||
|
||||
- if ((strncmp(dasd_info.type, "ECKD", 4) == 0) &&
|
||||
- (!dasd_info.FBA_layout)) {
|
||||
+ if ((strncmp(info->dasd_info.type, "ECKD", 4) == 0) &&
|
||||
+ (!info->dasd_info.FBA_layout)) {
|
||||
/* OS/390 and zOS compatible disk layout */
|
||||
- vtoc_read_volume_label(devname, dasd_info.label_block * blksize, &vlabel);
|
||||
+ vtoc_read_volume_label(info->devname,
|
||||
+ info->dasd_info.label_block * blksize,
|
||||
+ &vlabel);
|
||||
vtoc_volume_label_get_volser(&vlabel, volser);
|
||||
return 0;
|
||||
} else {
|
||||
@@ -507,7 +480,6 @@ static void dasdfmt_write_labels(dasdfmt
|
||||
unsigned int cylinders, unsigned int heads)
|
||||
{
|
||||
int label_position;
|
||||
- dasd_information_t dasd_info;
|
||||
struct hd_geometry geo;
|
||||
format4_label_t f4;
|
||||
format5_label_t f5;
|
||||
@@ -520,11 +492,6 @@ static void dasdfmt_write_labels(dasdfmt
|
||||
if (info->verbosity > 0)
|
||||
printf("Retrieving dasd information... ");
|
||||
|
||||
- if (ioctl(filedes, BIODASDINFO, &dasd_info) != 0)
|
||||
- ERRMSG_EXIT(EXIT_FAILURE, "%s: (write labels) IOCTL "
|
||||
- "BIODASDINFO failed (%s).\n",
|
||||
- prog_name, strerror(errno));
|
||||
-
|
||||
if (ioctl(filedes, BLKSSZGET, &blksize) != 0)
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "%s: (write labels) IOCTL BLKSSZGET "
|
||||
"failed (%s).\n", prog_name, strerror(errno));
|
||||
@@ -586,14 +553,14 @@ static void dasdfmt_write_labels(dasdfmt
|
||||
|
||||
/* write VTOC */
|
||||
vtoc_init_format4_label(&f4, geo.cylinders, cylinders, heads,
|
||||
- geo.sectors, blksize, dasd_info.dev_type);
|
||||
+ geo.sectors, blksize, info->dasd_info.dev_type);
|
||||
|
||||
vtoc_init_format5_label(&f5);
|
||||
vtoc_init_format7_label(&f7);
|
||||
vtoc_set_freespace(&f4, &f5, &f7, '+', 0, FIRST_USABLE_TRK,
|
||||
(cylinders * heads - 1), cylinders, heads);
|
||||
|
||||
- label_position = dasd_info.label_block * blksize;
|
||||
+ label_position = info->dasd_info.label_block * blksize;
|
||||
|
||||
if (info->verbosity > 0)
|
||||
printf("Writing label...\n");
|
||||
@@ -831,7 +798,6 @@ static void do_format_dasd(dasdfmt_info_
|
||||
volume_label_t *vlabel)
|
||||
{
|
||||
char inp_buffer[5];
|
||||
- dasd_information_t dasd_info;
|
||||
struct dasd_eckd_characteristics *characteristics;
|
||||
unsigned int cylinders, heads;
|
||||
int count;
|
||||
@@ -839,13 +805,9 @@ static void do_format_dasd(dasdfmt_info_
|
||||
if (info->verbosity > 0)
|
||||
printf("Retrieving disk geometry...\n");
|
||||
|
||||
- if (ioctl(filedes, BIODASDINFO, &dasd_info) != 0)
|
||||
- ERRMSG_EXIT(EXIT_FAILURE, "%s: (retrieving disk information) "
|
||||
- "IOCTL BIODASDINFO failed (%s).\n",
|
||||
- prog_name, strerror(errno));
|
||||
-
|
||||
characteristics =
|
||||
- (struct dasd_eckd_characteristics *) &dasd_info.characteristics;
|
||||
+ (struct dasd_eckd_characteristics *)
|
||||
+ &info->dasd_info.characteristics;
|
||||
if (characteristics->no_cyl == LV_COMPAT_CYL &&
|
||||
characteristics->long_no_cyl)
|
||||
cylinders = characteristics->long_no_cyl;
|
||||
@@ -878,8 +840,8 @@ static void do_format_dasd(dasdfmt_info_
|
||||
if (!info->labelspec && !info->keep_volser) {
|
||||
char buf[7];
|
||||
|
||||
- sprintf(buf, "0X%04x", info->devno);
|
||||
- check_volser(buf, info->devno);
|
||||
+ sprintf(buf, "0X%04x", info->dasd_info.devno);
|
||||
+ check_volser(buf, info->dasd_info.devno);
|
||||
vtoc_volume_label_set_volser(vlabel, buf);
|
||||
}
|
||||
|
||||
@@ -959,7 +921,10 @@ static void do_format_dasd(dasdfmt_info_
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
- dasdfmt_info_t info;
|
||||
+ dasdfmt_info_t info = {
|
||||
+ .dasd_info = {0},
|
||||
+ {0}
|
||||
+ };
|
||||
volume_label_t vlabel;
|
||||
char old_volser[7];
|
||||
|
||||
@@ -986,7 +951,6 @@ int main(int argc, char *argv[])
|
||||
prog_name = argv[0];
|
||||
|
||||
/* set default values */
|
||||
- init_info(&info);
|
||||
vtoc_volume_label_init(&vlabel);
|
||||
|
||||
format_params.blksize = DEFAULT_BLOCKSIZE;
|
||||
@@ -1137,30 +1101,24 @@ int main(int argc, char *argv[])
|
||||
|
||||
if(info.yast_mode) {
|
||||
for(i=0;i<dev_count;i++) {
|
||||
- dasd_information_t dasd_info;
|
||||
struct dasd_eckd_characteristics *characteristics;
|
||||
unsigned int cylinders;
|
||||
|
||||
get_device_name(&info, dev_filename[i]);
|
||||
- if ((filedes = open(info.devname, O_RDWR)) == -1) {
|
||||
+
|
||||
+ filedes = open(info.devname, O_RDWR);
|
||||
+ if (filedes == -1) {
|
||||
ERRMSG("%s: Unable to open device %s: %s\n",
|
||||
- prog_name, info.devname, strerror(errno));
|
||||
- free(dev_filename[i]);
|
||||
- dev_filename[i]=(char*)-1; /* ignore device */
|
||||
- continue;
|
||||
- }
|
||||
- if (ioctl(filedes, BIODASDINFO, &dasd_info) != 0) {
|
||||
- ERRMSG_EXIT(EXIT_FAILURE, "%s: (retrieving disk information) "
|
||||
- "IOCTL BIODASDINFO failed (%s).\n",
|
||||
- prog_name, strerror(errno));
|
||||
+ prog_name, info.devname, strerror(errno));
|
||||
free(dev_filename[i]);
|
||||
dev_filename[i]=(char*)-1; /* ignore device */
|
||||
- close(filedes);
|
||||
continue;
|
||||
}
|
||||
|
||||
+ get_device_info(&info);
|
||||
+
|
||||
characteristics =
|
||||
- (struct dasd_eckd_characteristics *) &dasd_info.characteristics;
|
||||
+ (struct dasd_eckd_characteristics *) &info.dasd_info.characteristics;
|
||||
if (characteristics->no_cyl == LV_COMPAT_CYL &&
|
||||
characteristics->long_no_cyl)
|
||||
cylinders = characteristics->long_no_cyl;
|
||||
@@ -1204,6 +1162,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
get_device_name(&info, dev_filename[i]);
|
||||
|
||||
+ filedes = open(info.devname, O_RDWR);
|
||||
+ if (filedes == -1)
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "%s: Unable to open device %s: %s\n",
|
||||
+ prog_name, info.devname, strerror(errno));
|
||||
+
|
||||
+ get_device_info(&info);
|
||||
+
|
||||
if (!info.blksize_specified)
|
||||
format_params = ask_user_for_blksize(format_params);
|
||||
|
||||
@@ -1214,7 +1179,7 @@ int main(int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
- if (dasdfmt_get_volser(info.devname, old_volser) == 0)
|
||||
+ if (dasdfmt_get_volser(&info, old_volser) == 0)
|
||||
vtoc_volume_label_set_volser(&vlabel, old_volser);
|
||||
else
|
||||
ERRMSG_EXIT(EXIT_FAILURE,
|
||||
@@ -1223,11 +1188,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
}
|
||||
|
||||
- filedes = open(info.devname, O_RDWR);
|
||||
- if (filedes == -1)
|
||||
- ERRMSG_EXIT(EXIT_FAILURE, "%s: Unable to open device %s: %s\n",
|
||||
- prog_name, info.devname, strerror(errno));
|
||||
-
|
||||
check_disk(&info);
|
||||
|
||||
if (check_param(str, ERR_LENGTH, &format_params) < 0)
|
||||
--- a/dasdfmt/dasdfmt.h
|
||||
+++ b/dasdfmt/dasdfmt.h
|
||||
@@ -32,11 +32,11 @@
|
||||
#define DASD_IOCTL_LETTER 'D'
|
||||
|
||||
/*
|
||||
- * struct dasd_information_t
|
||||
+ * struct dasd_information2_t
|
||||
* represents any data about the device, which is visible to userspace.
|
||||
* including format and features.
|
||||
*/
|
||||
-typedef struct dasd_information_t {
|
||||
+typedef struct dasd_information2_t {
|
||||
unsigned int devno; /* S/390 devno */
|
||||
unsigned int real_devno; /* for aliases */
|
||||
unsigned int schid; /* S/390 subchannel identifier */
|
||||
@@ -56,7 +56,17 @@ typedef struct dasd_information_t {
|
||||
unsigned int confdata_size;
|
||||
char characteristics[64]; /* from read_device_characteristics */
|
||||
char configuration_data[256]; /* from read_configuration_data */
|
||||
-} dasd_information_t;
|
||||
+ unsigned int format; /* format info like formatted/cdl/ldl/... */
|
||||
+ unsigned int features; /* dasd features like 'ro',... */
|
||||
+ unsigned int reserved0; /* reserved for further use ,... */
|
||||
+ unsigned int reserved1; /* reserved for further use ,... */
|
||||
+ unsigned int reserved2; /* reserved for further use ,... */
|
||||
+ unsigned int reserved3; /* reserved for further use ,... */
|
||||
+ unsigned int reserved4; /* reserved for further use ,... */
|
||||
+ unsigned int reserved5; /* reserved for further use ,... */
|
||||
+ unsigned int reserved6; /* reserved for further use ,... */
|
||||
+ unsigned int reserved7; /* reserved for further use ,... */
|
||||
+} dasd_information2_t;
|
||||
|
||||
|
||||
struct dasd_eckd_characteristics {
|
||||
@@ -165,7 +175,7 @@ typedef struct format_data_t {
|
||||
#define BIODASDENABLE _IO(DASD_IOCTL_LETTER,1)
|
||||
|
||||
/* Get information on a dasd device (enhanced) */
|
||||
-#define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t)
|
||||
+#define BIODASDINFO2 _IOR(DASD_IOCTL_LETTER, 3, dasd_information2_t)
|
||||
|
||||
/* #define BIODASDFORMAT _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */
|
||||
#define BIODASDFMT _IOW(DASD_IOCTL_LETTER,1,format_data_t)
|
||||
@@ -251,9 +261,8 @@ typedef struct bootstrap2 {
|
||||
} __attribute__ ((packed)) bootstrap2_t;
|
||||
|
||||
typedef struct dasdfmt_info {
|
||||
- int devno;
|
||||
+ dasd_information2_t dasd_info;
|
||||
char devname[PATH_MAX];
|
||||
- int usage_count;
|
||||
int verbosity;
|
||||
int testmode;
|
||||
int withoutprompt;
|
@ -1,210 +0,0 @@
|
||||
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: Refactor do_format_dasd
|
||||
|
||||
In order to allow for new features to be integrated properly in the
|
||||
existing code, certain parts of do_format_dasd() must be moved to
|
||||
separate functions. This applies to setting VTOC information and
|
||||
geometrical information.
|
||||
|
||||
Therefore, move the relevant bits to set_geo() and set_label().
|
||||
|
||||
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 | 132 +++++++++++++++++++++++++++++++-----------------------
|
||||
1 file changed, 76 insertions(+), 56 deletions(-)
|
||||
|
||||
--- a/dasdfmt/dasdfmt.c
|
||||
+++ b/dasdfmt/dasdfmt.c
|
||||
@@ -371,6 +371,73 @@ static int check_param(char *s, size_t b
|
||||
}
|
||||
|
||||
/*
|
||||
+ * Retrieve disk information and set cylinders and heads accordingly.
|
||||
+ */
|
||||
+static void set_geo(dasdfmt_info_t *info, unsigned int *cylinders,
|
||||
+ unsigned int *heads)
|
||||
+{
|
||||
+ struct dasd_eckd_characteristics *characteristics;
|
||||
+
|
||||
+ if (info->verbosity > 0)
|
||||
+ printf("Retrieving disk geometry...\n");
|
||||
+
|
||||
+ characteristics = (struct dasd_eckd_characteristics *)
|
||||
+ &info->dasd_info.characteristics;
|
||||
+ if (characteristics->no_cyl == LV_COMPAT_CYL &&
|
||||
+ characteristics->long_no_cyl)
|
||||
+ *cylinders = characteristics->long_no_cyl;
|
||||
+ else
|
||||
+ *cylinders = characteristics->no_cyl;
|
||||
+ *heads = characteristics->trk_per_cyl;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Set VTOC label information
|
||||
+ */
|
||||
+static void set_label(dasdfmt_info_t *info, volume_label_t *vlabel,
|
||||
+ format_data_t *p, unsigned int cylinders)
|
||||
+{
|
||||
+ char inp_buffer[5];
|
||||
+
|
||||
+ if (info->writenolabel) {
|
||||
+ if (cylinders > LV_COMPAT_CYL && !info->withoutprompt) {
|
||||
+ printf("\n--->> ATTENTION! <<---\n");
|
||||
+ printf("You specified to write no labels to a"
|
||||
+ " volume with more then %u cylinders.\n"
|
||||
+ "Cylinders above this limit will not be"
|
||||
+ " accessible as a linux partition!\n"
|
||||
+ "Type \"yes\" to continue, no will leave"
|
||||
+ " the disk untouched: ", LV_COMPAT_CYL);
|
||||
+ if (fgets(inp_buffer, sizeof(inp_buffer), stdin) == NULL)
|
||||
+ return;
|
||||
+ if (strcasecmp(inp_buffer, "yes") &&
|
||||
+ strcasecmp(inp_buffer, "yes\n")) {
|
||||
+ printf("Omitting ioctl call (disk will "
|
||||
+ "NOT be formatted).\n");
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (!info->labelspec && !info->keep_volser) {
|
||||
+ char buf[7];
|
||||
+
|
||||
+ sprintf(buf, "0X%04x", info->dasd_info.devno);
|
||||
+ check_volser(buf, info->dasd_info.devno);
|
||||
+ vtoc_volume_label_set_volser(vlabel, buf);
|
||||
+ }
|
||||
+
|
||||
+ if (p->intensity & DASD_FMT_INT_COMPAT) {
|
||||
+ info->cdl_format = 1;
|
||||
+ vtoc_volume_label_set_label(vlabel, "VOL1");
|
||||
+ vtoc_volume_label_set_key(vlabel, "VOL1");
|
||||
+ vtoc_set_cchhb(&vlabel->vtoc, 0x0000, 0x0001, 0x01);
|
||||
+ } else {
|
||||
+ vtoc_volume_label_set_label(vlabel, "LNX1");
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* ask the user to specify a blocksize
|
||||
*/
|
||||
static format_data_t ask_user_for_blksize(format_data_t params)
|
||||
@@ -452,7 +519,7 @@ static int dasdfmt_get_volser(dasdfmt_in
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "%s: Unable to open device %s: %s\n",
|
||||
prog_name, info->devname, strerror(errno));
|
||||
|
||||
- if (ioctl(f, BLKSSZGET, &blksize) != 0)
|
||||
+ if (ioctl(filedes, BLKSSZGET, &blksize) != 0)
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "%s: (label pos) IOCTL BLKSSZGET "
|
||||
"failed (%s).\n", prog_name, strerror(errno));
|
||||
|
||||
@@ -794,67 +861,16 @@ static void dasdfmt_prepare_and_format(d
|
||||
disk_disabled = 0;
|
||||
}
|
||||
|
||||
-static void do_format_dasd(dasdfmt_info_t *info, format_data_t *p,
|
||||
- volume_label_t *vlabel)
|
||||
+static void do_format_dasd(dasdfmt_info_t *info, volume_label_t *vlabel,
|
||||
+ format_data_t *p, unsigned int cylinders,
|
||||
+ unsigned int heads)
|
||||
{
|
||||
char inp_buffer[5];
|
||||
- struct dasd_eckd_characteristics *characteristics;
|
||||
- unsigned int cylinders, heads;
|
||||
int count;
|
||||
|
||||
- if (info->verbosity > 0)
|
||||
- printf("Retrieving disk geometry...\n");
|
||||
-
|
||||
- characteristics =
|
||||
- (struct dasd_eckd_characteristics *)
|
||||
- &info->dasd_info.characteristics;
|
||||
- if (characteristics->no_cyl == LV_COMPAT_CYL &&
|
||||
- characteristics->long_no_cyl)
|
||||
- cylinders = characteristics->long_no_cyl;
|
||||
- else
|
||||
- cylinders = characteristics->no_cyl;
|
||||
- heads = characteristics->trk_per_cyl;
|
||||
-
|
||||
p->start_unit = 0;
|
||||
p->stop_unit = (cylinders * heads) - 1;
|
||||
|
||||
- if (info->writenolabel) {
|
||||
- if (cylinders > LV_COMPAT_CYL && !info->withoutprompt) {
|
||||
- printf("\n--->> ATTENTION! <<---\n");
|
||||
- printf("You specified to write no labels to a"
|
||||
- " volume with more then %u cylinders.\n"
|
||||
- "Cylinders above this limit will not be"
|
||||
- " accessible as a linux partition!\n"
|
||||
- "Type \"yes\" to continue, no will leave"
|
||||
- " the disk untouched: ", LV_COMPAT_CYL);
|
||||
- if (fgets(inp_buffer, sizeof(inp_buffer), stdin) == NULL)
|
||||
- return;
|
||||
- if (strcasecmp(inp_buffer, "yes") &&
|
||||
- strcasecmp(inp_buffer, "yes\n")) {
|
||||
- printf("Omitting ioctl call (disk will "
|
||||
- "NOT be formatted).\n");
|
||||
- return;
|
||||
- }
|
||||
- }
|
||||
- } else {
|
||||
- if (!info->labelspec && !info->keep_volser) {
|
||||
- char buf[7];
|
||||
-
|
||||
- sprintf(buf, "0X%04x", info->dasd_info.devno);
|
||||
- check_volser(buf, info->dasd_info.devno);
|
||||
- vtoc_volume_label_set_volser(vlabel, buf);
|
||||
- }
|
||||
-
|
||||
- if (p->intensity & DASD_FMT_INT_COMPAT) {
|
||||
- info->cdl_format = 1;
|
||||
- vtoc_volume_label_set_label(vlabel, "VOL1");
|
||||
- vtoc_volume_label_set_key(vlabel, "VOL1");
|
||||
- vtoc_set_cchhb(&vlabel->vtoc, 0x0000, 0x0001, 0x01);
|
||||
- } else {
|
||||
- vtoc_volume_label_set_label(vlabel, "LNX1");
|
||||
- }
|
||||
- }
|
||||
-
|
||||
if ((info->verbosity > 0) || !info->withoutprompt || info->testmode)
|
||||
dasdfmt_print_info(info, vlabel, cylinders, heads, p);
|
||||
|
||||
@@ -938,6 +954,7 @@ int main(int argc, char *argv[])
|
||||
char *hashstep_str = NULL;
|
||||
|
||||
int rc, index, i;
|
||||
+ unsigned int cylinders, heads;
|
||||
|
||||
int max_parallel=1;
|
||||
int running=0;
|
||||
@@ -1193,7 +1210,10 @@ int main(int argc, char *argv[])
|
||||
if (check_param(str, ERR_LENGTH, &format_params) < 0)
|
||||
ERRMSG_EXIT(EXIT_MISUSE, "%s: %s\n", prog_name, str);
|
||||
|
||||
- do_format_dasd(&info, &format_params, &vlabel);
|
||||
+ set_geo(&info, &cylinders, &heads);
|
||||
+ set_label(&info, &vlabel, &format_params, cylinders);
|
||||
+ do_format_dasd(&info, &vlabel, &format_params,
|
||||
+ cylinders, heads);
|
||||
|
||||
if (close(filedes) != 0)
|
||||
ERRMSG("%s: error during close: %s\ncontinuing...\n",
|
@ -1,93 +0,0 @@
|
||||
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: Make the IOCTL BLKSSZGET reusable
|
||||
|
||||
The IOCTL BLKSSZGET is used to get blocksize information of a device.
|
||||
Since it is used several times already and could be used for new
|
||||
features as well, move the call to a separate function and make it
|
||||
reusable.
|
||||
|
||||
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 | 24 ++++++++++++++++--------
|
||||
1 file changed, 16 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/dasdfmt/dasdfmt.c
|
||||
+++ b/dasdfmt/dasdfmt.c
|
||||
@@ -252,6 +252,17 @@ static void get_device_info(dasdfmt_info
|
||||
}
|
||||
|
||||
/*
|
||||
+ * Retrieve blocksize of device
|
||||
+ */
|
||||
+static void get_blocksize(unsigned int *blksize)
|
||||
+{
|
||||
+ if (ioctl(filedes, BLKSSZGET, blksize) != 0)
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "%s: the ioctl to get the blocksize "
|
||||
+ "of the device failed (%s).\n", prog_name,
|
||||
+ strerror(errno));
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* check for disk type and set some variables (e.g. usage count)
|
||||
*/
|
||||
static void check_disk(dasdfmt_info_t *info)
|
||||
@@ -510,7 +521,7 @@ static void dasdfmt_print_info(dasdfmt_i
|
||||
*/
|
||||
static int dasdfmt_get_volser(dasdfmt_info_t *info, char *volser)
|
||||
{
|
||||
- int blksize;
|
||||
+ unsigned int blksize;
|
||||
int f;
|
||||
volume_label_t vlabel;
|
||||
|
||||
@@ -519,9 +530,7 @@ static int dasdfmt_get_volser(dasdfmt_in
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "%s: Unable to open device %s: %s\n",
|
||||
prog_name, info->devname, strerror(errno));
|
||||
|
||||
- if (ioctl(filedes, BLKSSZGET, &blksize) != 0)
|
||||
- ERRMSG_EXIT(EXIT_FAILURE, "%s: (label pos) IOCTL BLKSSZGET "
|
||||
- "failed (%s).\n", prog_name, strerror(errno));
|
||||
+ get_blocksize(&blksize);
|
||||
|
||||
if (close(f) != 0)
|
||||
ERRMSG("%s: error during close: %s\ncontinuing...\n",
|
||||
@@ -551,7 +560,8 @@ static void dasdfmt_write_labels(dasdfmt
|
||||
format4_label_t f4;
|
||||
format5_label_t f5;
|
||||
format7_label_t f7;
|
||||
- int rc, blksize;
|
||||
+ unsigned int blksize;
|
||||
+ int rc;
|
||||
void *ipl1_record, *ipl2_record;
|
||||
int ipl1_record_len, ipl2_record_len;
|
||||
|
||||
@@ -559,9 +569,7 @@ static void dasdfmt_write_labels(dasdfmt
|
||||
if (info->verbosity > 0)
|
||||
printf("Retrieving dasd information... ");
|
||||
|
||||
- if (ioctl(filedes, BLKSSZGET, &blksize) != 0)
|
||||
- ERRMSG_EXIT(EXIT_FAILURE, "%s: (write labels) IOCTL BLKSSZGET "
|
||||
- "failed (%s).\n", prog_name, strerror(errno));
|
||||
+ get_blocksize(&blksize);
|
||||
|
||||
/*
|
||||
* Don't rely on the cylinders returned by HDIO_GETGEO, they might be
|
@ -1,555 +0,0 @@
|
||||
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: Add quick format support
|
||||
|
||||
On occasion, a DASD device might have been formatted earlier and could
|
||||
potentially be re-initialized very easily. For device initalization it
|
||||
is necessary to write disk information (i.e. volume label (CDL or LDL)
|
||||
and VTOC) to the first two tracks. Currently you'd need to format the
|
||||
entire disk, which can take a long time and is totally unnecessary.
|
||||
|
||||
Therefore, add a quick format mode which formats only the first two
|
||||
tracks and fills them with data accordingly.
|
||||
Before any formatting is done, several checks regarding the
|
||||
expected device format are performed.
|
||||
|
||||
The mode can be specified with the new command line switch -M (--mode)
|
||||
<mode>. Where 'mode' can be either 'full' (default) or 'quick'.
|
||||
|
||||
Document the switch -M (--mode) and its options full and quick in the
|
||||
man page.
|
||||
|
||||
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.8 | 15 ++
|
||||
dasdfmt/dasdfmt.c | 290 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||
dasdfmt/dasdfmt.h | 51 +++++++++
|
||||
3 files changed, 344 insertions(+), 12 deletions(-)
|
||||
|
||||
--- a/dasdfmt/dasdfmt.8
|
||||
+++ b/dasdfmt/dasdfmt.8
|
||||
@@ -67,7 +67,7 @@ Print version number and exit.
|
||||
|
||||
.TP
|
||||
\fB-F\fR or \fB--force\fR
|
||||
-Formats the device without checking, if the device is in use.
|
||||
+Formats the device without performing sanity checking.
|
||||
|
||||
.TP
|
||||
\fB-C\fR or \fB--check_host_count\fR
|
||||
@@ -108,6 +108,19 @@ The value will be at least as big as the
|
||||
.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
|
||||
+.IP full
|
||||
+Format the entire disk with the specified blocksize. (default)
|
||||
+.IP quick
|
||||
+Format the first two tracks and write label and partition information. Only use
|
||||
+this option if you are sure that the target DASD already contains a regular
|
||||
+format with the specified blocksize. A blocksize can optionally be specified
|
||||
+using \fB-b\fR (\fB--blocksize\fR).
|
||||
+.RE
|
||||
+
|
||||
+.TP
|
||||
\fB-r\fR \fIcylindercount\fR or \fB--requestsize\fR=\fIcylindercount\fR
|
||||
Number of cylinders to be processed in one formatting step.
|
||||
The value must be an integer in the range 1 - 255.
|
||||
--- a/dasdfmt/dasdfmt.c
|
||||
+++ b/dasdfmt/dasdfmt.c
|
||||
@@ -30,6 +30,7 @@ static const char copyright_notice[] = "
|
||||
static int filedes;
|
||||
static int disk_disabled;
|
||||
static format_data_t format_params;
|
||||
+static format_mode_t mode;
|
||||
char *prog_name;
|
||||
volatile sig_atomic_t program_interrupt_in_progress;
|
||||
int reqsize;
|
||||
@@ -53,6 +54,7 @@ static void exit_usage(int exitcode)
|
||||
" [-b <blocksize> | --blocksize=<blocksize>]\n"
|
||||
" [-d <disk layout> | --disk_layout=<disk layout>]\n"
|
||||
" [-r <cylinder> | --requestsize=<cylinder>]\n"
|
||||
+ " [-M <mode> | --mode=<mode>]\n"
|
||||
" <device>\n\n", prog_name);
|
||||
|
||||
printf(" -t or --test means testmode\n"
|
||||
@@ -65,7 +67,7 @@ static void exit_usage(int exitcode)
|
||||
" -r x or --requestsize=x means use x cylinders in one "
|
||||
"format step\n"
|
||||
" -v means verbose mode\n"
|
||||
- " -F means don't check if the device is in use\n"
|
||||
+ " -F means format without performing sanity checking\n"
|
||||
" -k means keep volume serial\n"
|
||||
" -C or --check_host_count means force dasdfmt to check\n"
|
||||
" the host access open count to ensure the device\n"
|
||||
@@ -79,7 +81,10 @@ static void exit_usage(int exitcode)
|
||||
" <disk layout> is either\n"
|
||||
" 'cdl' for compatible disk layout (default) or\n"
|
||||
" 'ldl' for linux disk layout\n"
|
||||
- " <device> device node of the device to format\n");
|
||||
+ " <device> device node of the device to format\n"
|
||||
+ " <mode> is either\n"
|
||||
+ " 'full' to fully format the device (default)\n"
|
||||
+ " 'quick' to format only the first two tracks\n");
|
||||
exit(exitcode);
|
||||
}
|
||||
|
||||
@@ -102,6 +107,131 @@ static int reread_partition_table(void)
|
||||
}
|
||||
|
||||
/*
|
||||
+ * Helper function for recs_per_track.
|
||||
+ */
|
||||
+static inline unsigned int ceil_quot(unsigned int d1, unsigned int d2)
|
||||
+{
|
||||
+ return (d1 + (d2 - 1)) / d2;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Calculate records per track depending on the device characteristics.
|
||||
+ */
|
||||
+static unsigned int recs_per_track(struct dasd_eckd_characteristics *rdc,
|
||||
+ unsigned int kl, unsigned int dl)
|
||||
+{
|
||||
+ int dn, kn;
|
||||
+
|
||||
+ switch (rdc->dev_type) {
|
||||
+ case 0x3380:
|
||||
+ if (kl)
|
||||
+ return 1499 / (15 + 7 + ceil_quot(kl + 12, 32) +
|
||||
+ ceil_quot(dl + 12, 32));
|
||||
+ else
|
||||
+ return 1499 / (15 + ceil_quot(dl + 12, 32));
|
||||
+ case 0x3390:
|
||||
+ dn = ceil_quot(dl + 6, 232) + 1;
|
||||
+ if (kl) {
|
||||
+ kn = ceil_quot(kl + 6, 232) + 1;
|
||||
+ return 1729 / (10 + 9 + ceil_quot(kl + 6 * kn, 34) +
|
||||
+ 9 + ceil_quot(dl + 6 * dn, 34));
|
||||
+ } else
|
||||
+ return 1729 / (10 + 9 + ceil_quot(dl + 6 * dn, 34));
|
||||
+ case 0x9345:
|
||||
+ dn = ceil_quot(dl + 6, 232) + 1;
|
||||
+ if (kl) {
|
||||
+ kn = ceil_quot(kl + 6, 232) + 1;
|
||||
+ return 1420 / (18 + 7 + ceil_quot(kl + 6 * kn, 34) +
|
||||
+ ceil_quot(dl + 6 * dn, 34));
|
||||
+ } else
|
||||
+ return 1420 / (18 + 7 + ceil_quot(dl + 6 * dn, 34));
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Evaluate errors recognized by format checks and print appropriate error
|
||||
+ * messages depending on the content of cdata.
|
||||
+ */
|
||||
+static void evaluate_format_error(dasdfmt_info_t *info, format_check_t *cdata,
|
||||
+ unsigned int heads)
|
||||
+{
|
||||
+ struct dasd_eckd_characteristics *rdc;
|
||||
+ /* Special blocksize values of the first 3 records of trk 0 of cyl 0 */
|
||||
+ const int blksizes_trk0[] = { 24, 144, 80 };
|
||||
+ /* Special blocksize value of trk 1 cyl 0 */
|
||||
+ const int blksize_trk1 = 96;
|
||||
+ unsigned int cyl;
|
||||
+ unsigned int head;
|
||||
+ unsigned int rpt;
|
||||
+ unsigned int kl = 0;
|
||||
+ int blksize = cdata->expect.blksize;
|
||||
+
|
||||
+ /*
|
||||
+ * Reading record zero will never happen. If the record in error is 0
|
||||
+ * nonetheless, the device is not formatted at all!
|
||||
+ */
|
||||
+ if (cdata->rec == 0) {
|
||||
+ ERRMSG("WARNING: The specified device is not "
|
||||
+ "formatted at all.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ cyl = cdata->unit / heads;
|
||||
+ head = cyl >> 16;
|
||||
+ head <<= 4;
|
||||
+ head |= cdata->unit % heads;
|
||||
+
|
||||
+ /*
|
||||
+ * Set special expected values for the first 3 records of trk 0 of cyl 0
|
||||
+ * and trk 1 of cyl 0 when checking a CDL formatted device.
|
||||
+ */
|
||||
+ if ((cdata->expect.intensity & DASD_FMT_INT_COMPAT) &&
|
||||
+ cyl == 0 && head == 0 && cdata->rec < 4) {
|
||||
+ kl = 4;
|
||||
+ blksize = blksizes_trk0[cdata->rec - 1];
|
||||
+ }
|
||||
+ if ((cdata->expect.intensity & DASD_FMT_INT_COMPAT) &&
|
||||
+ cyl == 0 && head == 1) {
|
||||
+ kl = 44;
|
||||
+ blksize = blksize_trk1;
|
||||
+ }
|
||||
+
|
||||
+ rdc = (struct dasd_eckd_characteristics *)
|
||||
+ &info->dasd_info.characteristics;
|
||||
+
|
||||
+ rpt = recs_per_track(rdc, kl, cdata->expect.blksize);
|
||||
+
|
||||
+ ERRMSG("WARNING: The specified device is not formatted as expected.\n");
|
||||
+ switch (cdata->result) {
|
||||
+ case DASD_FMT_ERR_TOO_FEW_RECORDS:
|
||||
+ ERRMSG("Too few records (found %d, expected %d) "
|
||||
+ "at cyl: %d trk: %d rec: %d.\n",
|
||||
+ cdata->num_records, rpt, cyl, head, cdata->rec);
|
||||
+ break;
|
||||
+ case DASD_FMT_ERR_TOO_MANY_RECORDS:
|
||||
+ ERRMSG("Too many records (found %d, expected %d) "
|
||||
+ "at cyl: %d trk: %d rec: %d.\n",
|
||||
+ cdata->num_records, rpt, cyl, head, cdata->rec);
|
||||
+ break;
|
||||
+ case DASD_FMT_ERR_BLKSIZE:
|
||||
+ ERRMSG("Invalid blocksize (found %d, expected %d) "
|
||||
+ "at cyl: %d trk: %d rec: %d.\n",
|
||||
+ cdata->blksize, blksize, cyl, head, cdata->rec);
|
||||
+ break;
|
||||
+ case DASD_FMT_ERR_RECORD_ID:
|
||||
+ ERRMSG("Invalid record ID at cyl: %d trk: %d rec: %d.\n",
|
||||
+ cyl, head, cdata->rec);
|
||||
+ break;
|
||||
+ case DASD_FMT_ERR_KEY_LENGTH:
|
||||
+ ERRMSG("Invalid key length (found %d, expected %d) "
|
||||
+ "at cyl: %d trk: %d rec: %d.\n",
|
||||
+ cdata->key_length, kl, cyl, head, cdata->rec);
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* signal handler:
|
||||
* enables the disk again in case of SIGTERM, SIGINT and SIGQUIT
|
||||
*/
|
||||
@@ -263,6 +393,25 @@ static void get_blocksize(unsigned int *
|
||||
}
|
||||
|
||||
/*
|
||||
+ * Check whether a specified blocksize matches the blocksize of the device
|
||||
+ */
|
||||
+static void check_blocksize(dasdfmt_info_t *info, unsigned int blksize)
|
||||
+{
|
||||
+ unsigned int dev_blksize;
|
||||
+
|
||||
+ if (!info->blksize_specified ||
|
||||
+ info->dasd_info.format == DASD_FORMAT_NONE)
|
||||
+ return;
|
||||
+
|
||||
+ get_blocksize(&dev_blksize);
|
||||
+ if (dev_blksize != blksize) {
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "WARNING: Device is formatted with a "
|
||||
+ "different blocksize (%d).\nUse --mode=full to "
|
||||
+ "perform a clean format.\n", dev_blksize);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* check for disk type and set some variables (e.g. usage count)
|
||||
*/
|
||||
static void check_disk(dasdfmt_info_t *info)
|
||||
@@ -449,6 +598,35 @@ static void set_label(dasdfmt_info_t *in
|
||||
}
|
||||
|
||||
/*
|
||||
+ * This function checks whether a range of tracks is in regular format
|
||||
+ * with the specified block size.
|
||||
+ */
|
||||
+static format_check_t check_track_format(format_data_t *p)
|
||||
+{
|
||||
+ format_check_t cdata = {
|
||||
+ .expect = {
|
||||
+ .blksize = p->blksize,
|
||||
+ .intensity = p->intensity,
|
||||
+ .start_unit = p->start_unit,
|
||||
+ .stop_unit = p->stop_unit
|
||||
+ }, 0
|
||||
+ };
|
||||
+
|
||||
+ if (ioctl(filedes, BIODASDCHECKFMT, &cdata)) {
|
||||
+ if (errno == ENOTTY) {
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "%s: Missing kernel support "
|
||||
+ "for format checking (--force to "
|
||||
+ "override)\n", prog_name);
|
||||
+ }
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "%s: Could no check format: %s\n",
|
||||
+ prog_name, strerror(errno));
|
||||
+ }
|
||||
+
|
||||
+ return cdata;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*
|
||||
* ask the user to specify a blocksize
|
||||
*/
|
||||
static format_data_t ask_user_for_blksize(format_data_t params)
|
||||
@@ -511,6 +689,8 @@ static void dasdfmt_print_info(dasdfmt_i
|
||||
printf(" Compatible Disk Layout : %s\n",
|
||||
(p->intensity & DASD_FMT_INT_COMPAT) ? "yes" : "no");
|
||||
printf(" Blocksize : %d\n", p->blksize);
|
||||
+ printf(" Mode : %s\n",
|
||||
+ (mode == FULL) ? "Full" : "Quick");
|
||||
|
||||
if (info->testmode)
|
||||
printf("Test mode active, omitting ioctl.\n");
|
||||
@@ -869,6 +1049,62 @@ static void dasdfmt_prepare_and_format(d
|
||||
disk_disabled = 0;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * This function will only format the first two tracks of a DASD.
|
||||
+ * The rest of the DASD is untouched and left as is.
|
||||
+ */
|
||||
+static void dasdfmt_quick_format(dasdfmt_info_t *info, unsigned int cylinders,
|
||||
+ unsigned int heads, format_data_t *p)
|
||||
+{
|
||||
+ format_check_t cdata = { .expect = {0}, 0 };
|
||||
+ format_data_t tmp = *p;
|
||||
+
|
||||
+ if (info->force) {
|
||||
+ printf("Skipping format check due to --force.\n");
|
||||
+ } else {
|
||||
+ check_blocksize(info, p->blksize);
|
||||
+
|
||||
+ printf("Checking the format of selected tracks...\n");
|
||||
+
|
||||
+ /* Check device format on the first and last 3 regular tracks */
|
||||
+ tmp.start_unit = 2;
|
||||
+ tmp.stop_unit = 4;
|
||||
+ cdata = check_track_format(&tmp);
|
||||
+ if (!cdata.result) {
|
||||
+ tmp.start_unit = (cylinders * heads) - 3;
|
||||
+ tmp.stop_unit = (cylinders * heads) - 1;
|
||||
+ cdata = check_track_format(&tmp);
|
||||
+ }
|
||||
+ if (cdata.result) {
|
||||
+ evaluate_format_error(info, &cdata, heads);
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "Use --mode=full to perform "
|
||||
+ "a clean format.\n");
|
||||
+ } else {
|
||||
+ printf("Done. Disk seems fine.\n");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!((info->withoutprompt) && (info->verbosity < 1)))
|
||||
+ printf("Formatting the first two tracks of the device.\n");
|
||||
+
|
||||
+ /* Disable the device before we do anything */
|
||||
+ if (ioctl(filedes, BIODASDDISABLE, p))
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "%s: the ioctl to disable the device "
|
||||
+ "failed. (%s)\n", prog_name, strerror(errno));
|
||||
+ disk_disabled = 1;
|
||||
+
|
||||
+ /* Now do the actual formatting of our first two tracks */
|
||||
+ if (ioctl(filedes, BIODASDFMT, p))
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "%s: the ioctl to format the device "
|
||||
+ "failed. (%s)\n", prog_name, strerror(errno));
|
||||
+
|
||||
+ /* Re-Enable the device so that we can continue working with it */
|
||||
+ if (ioctl(filedes, BIODASDENABLE, p))
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "%s: the ioctl to enable the device "
|
||||
+ "failed. (%s)\n", prog_name, strerror(errno));
|
||||
+ disk_disabled = 0;
|
||||
+}
|
||||
+
|
||||
static void do_format_dasd(dasdfmt_info_t *info, volume_label_t *vlabel,
|
||||
format_data_t *p, unsigned int cylinders,
|
||||
unsigned int heads)
|
||||
@@ -877,7 +1113,15 @@ static void do_format_dasd(dasdfmt_info_
|
||||
int count;
|
||||
|
||||
p->start_unit = 0;
|
||||
- p->stop_unit = (cylinders * heads) - 1;
|
||||
+
|
||||
+ switch (mode) {
|
||||
+ case FULL: /* all tracks */
|
||||
+ p->stop_unit = (cylinders * heads) - 1;
|
||||
+ break;
|
||||
+ case QUICK: /* just the first two */
|
||||
+ p->stop_unit = 1;
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
if ((info->verbosity > 0) || !info->withoutprompt || info->testmode)
|
||||
dasdfmt_print_info(info, vlabel, cylinders, heads, p);
|
||||
@@ -919,11 +1163,17 @@ static void do_format_dasd(dasdfmt_info_
|
||||
}
|
||||
}
|
||||
|
||||
- if (!((info->withoutprompt) && (info->verbosity < 1)))
|
||||
- printf("Formatting the device. This may take a "
|
||||
- "while (get yourself a coffee).\n");
|
||||
-
|
||||
- dasdfmt_prepare_and_format(info, cylinders, heads, p);
|
||||
+ switch (mode) {
|
||||
+ case FULL:
|
||||
+ if (!((info->withoutprompt) && (info->verbosity < 1)))
|
||||
+ printf("Formatting the device. This may take a "
|
||||
+ "while (get yourself a coffee).\n");
|
||||
+ dasdfmt_prepare_and_format(info, cylinders, heads, p);
|
||||
+ break;
|
||||
+ case QUICK:
|
||||
+ dasdfmt_quick_format(info, cylinders, heads, p);
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
if (!info->yast_mode)
|
||||
printf("Finished formatting the device.\n");
|
||||
@@ -981,6 +1231,8 @@ int main(int argc, char *argv[])
|
||||
format_params.blksize = DEFAULT_BLOCKSIZE;
|
||||
format_params.intensity = DASD_FMT_INT_COMPAT;
|
||||
|
||||
+ mode = FULL;
|
||||
+
|
||||
/*************** parse parameters **********************/
|
||||
|
||||
while (1) {
|
||||
@@ -1082,6 +1334,18 @@ int main(int argc, char *argv[])
|
||||
case 'C':
|
||||
info.force_host = 1;
|
||||
break;
|
||||
+ case 'M':
|
||||
+ if (strcasecmp(optarg, "full") == 0)
|
||||
+ mode = FULL;
|
||||
+ else if (strcasecmp(optarg, "quick") == 0)
|
||||
+ mode = QUICK;
|
||||
+ else
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE,
|
||||
+ "%s: The specified mode '%s' is "
|
||||
+ "invalid. Consult the man page for "
|
||||
+ "more information.\n",
|
||||
+ prog_name, optarg);
|
||||
+ break;
|
||||
case -1:
|
||||
/* End of options string - start of devices list */
|
||||
info.device_id = optind;
|
||||
@@ -1194,8 +1458,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
get_device_info(&info);
|
||||
|
||||
- if (!info.blksize_specified)
|
||||
- format_params = ask_user_for_blksize(format_params);
|
||||
+ /* Either let the user specify the blksize or get it from the kernel */
|
||||
+ if (!info.blksize_specified) {
|
||||
+ if (!(mode == FULL ||
|
||||
+ info.dasd_info.format == DASD_FORMAT_NONE))
|
||||
+ get_blocksize(&format_params.blksize);
|
||||
+ else
|
||||
+ format_params = ask_user_for_blksize(format_params);
|
||||
+ }
|
||||
|
||||
if (info.keep_volser) {
|
||||
if (format_params.intensity == 0x00) {
|
||||
--- a/dasdfmt/dasdfmt.h
|
||||
+++ b/dasdfmt/dasdfmt.h
|
||||
@@ -143,6 +143,14 @@ struct dasd_eckd_characteristics {
|
||||
unsigned int long_no_cyl;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
+/*
|
||||
+ * Represents possible format modes that can be specified when formatting
|
||||
+ * a DASD.
|
||||
+ */
|
||||
+typedef enum format_mode_t {
|
||||
+ FULL, /* default mode */
|
||||
+ QUICK, /* format only the first 2 tracks */
|
||||
+} format_mode_t;
|
||||
|
||||
/*
|
||||
* struct format_data_t
|
||||
@@ -168,6 +176,43 @@ typedef struct format_data_t {
|
||||
#define DASD_FMT_INT_COMPAT 8 /* use OS/390 compatible disk layout */
|
||||
#define DASD_FMT_INT_FMT_NOR0 16 /* remove permission to write record zero */
|
||||
|
||||
+/*
|
||||
+ * struct format_check_t
|
||||
+ * represents all data necessary to evaluate the format of
|
||||
+ * different tracks of a dasd
|
||||
+ */
|
||||
+typedef struct format_check_t {
|
||||
+ /* Input */
|
||||
+ struct format_data_t expect;
|
||||
+
|
||||
+ /* Output */
|
||||
+ unsigned int result; /* Error indication (DASD_FMT_ERR_*) */
|
||||
+ unsigned int unit; /* Track that is in error */
|
||||
+ unsigned int rec; /* Record that is in error */
|
||||
+ unsigned int num_records; /* Records in the track in error */
|
||||
+ unsigned int blksize; /* Block-size of first record in error */
|
||||
+ unsigned int key_length; /* Key length of first record in error */
|
||||
+} format_check_t;
|
||||
+
|
||||
+/*
|
||||
+ * values to be used in format_check_t for indicating
|
||||
+ * possible format errors
|
||||
+ */
|
||||
+#define DASD_FMT_ERR_TOO_FEW_RECORDS 1
|
||||
+#define DASD_FMT_ERR_TOO_MANY_RECORDS 2
|
||||
+#define DASD_FMT_ERR_BLKSIZE 3
|
||||
+#define DASD_FMT_ERR_RECORD_ID 4
|
||||
+#define DASD_FMT_ERR_KEY_LENGTH 5
|
||||
+
|
||||
+/*
|
||||
+ * values to be used for dasd_information2_t.format
|
||||
+ * 0x00: NOT formatted
|
||||
+ * 0x01: Linux disc layout
|
||||
+ * 0x02: Common disc layout
|
||||
+ */
|
||||
+#define DASD_FORMAT_NONE 0
|
||||
+#define DASD_FORMAT_LDL 1
|
||||
+#define DASD_FORMAT_CDL 2
|
||||
|
||||
/* Disable the volume (for Linux) */
|
||||
#define BIODASDDISABLE _IO(DASD_IOCTL_LETTER,0)
|
||||
@@ -180,6 +225,9 @@ typedef struct format_data_t {
|
||||
/* #define BIODASDFORMAT _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */
|
||||
#define BIODASDFMT _IOW(DASD_IOCTL_LETTER,1,format_data_t)
|
||||
|
||||
+/* Check device format according to format_data_t */
|
||||
+#define BIODASDCHECKFMT _IOWR(DASD_IOCTL_LETTER, 2, format_check_t)
|
||||
+
|
||||
/****************************************************************************
|
||||
* SECTION: Further IOCTL Definitions (see fs.h and hdreq.h ) *
|
||||
****************************************************************************/
|
||||
@@ -225,7 +273,7 @@ typedef struct format_data_t {
|
||||
if (*endptr) ERRMSG_EXIT(EXIT_MISUSE,"%s: " str " " \
|
||||
"is in invalid format\n",prog_name);}
|
||||
|
||||
-#define dasdfmt_getopt_string "b:n:l:f:d:m:r:hpQLtyvVFkCYP:"
|
||||
+#define dasdfmt_getopt_string "b:n:l:f:d:m:M:r:hpQLtyvVFkCYP:"
|
||||
|
||||
static struct option dasdfmt_getopt_long_options[]=
|
||||
{
|
||||
@@ -247,6 +295,7 @@ static struct option dasdfmt_getopt_long
|
||||
{ "keep_volser", 0, 0, 'k'},
|
||||
{ "norecordzero", 0, 0, 'z'},
|
||||
{ "check_host_count", 0, 0, 'C'},
|
||||
+ { "mode", 1, 0, 'M'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
@ -1,279 +0,0 @@
|
||||
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: Make progress output reusable and add ETR
|
||||
|
||||
The progress indicator (in form of a progressbar, hashmarks or
|
||||
percentages) is created within the formatting loop.
|
||||
|
||||
Put the drawing of the progress into a separate function to make it
|
||||
reusable. Clean up the formatting loop while at it and make it
|
||||
more readable. Also, add the estimated time remaining to the output.
|
||||
|
||||
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 | 198 +++++++++++++++++++++++++++++++++++++-----------------
|
||||
1 file changed, 138 insertions(+), 60 deletions(-)
|
||||
|
||||
--- a/dasdfmt/dasdfmt.c
|
||||
+++ b/dasdfmt/dasdfmt.c
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <sys/utsname.h>
|
||||
#include <linux/version.h>
|
||||
+#include <sys/time.h>
|
||||
|
||||
#include "zt_common.h"
|
||||
#include "dasdfmt.h"
|
||||
@@ -20,6 +21,8 @@
|
||||
#include <sys/wait.h>
|
||||
|
||||
#define BUSIDSIZE 8
|
||||
+#define SEC_PER_DAY (60 * 60 * 24)
|
||||
+#define SEC_PER_HOUR (60 * 60)
|
||||
|
||||
/* Full tool name */
|
||||
static const char tool_name[] = "dasdfmt: zSeries DASD format program";
|
||||
@@ -88,6 +91,120 @@ static void exit_usage(int exitcode)
|
||||
exit(exitcode);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Helper function to calculate the days, hours, minutes, and seconds
|
||||
+ * for a given timestamp in seconds
|
||||
+ */
|
||||
+static void calc_time(time_t time, int *d, int *h, int *m, int *s)
|
||||
+{
|
||||
+ *d = time / SEC_PER_DAY;
|
||||
+ time %= SEC_PER_DAY;
|
||||
+ *h = time / SEC_PER_HOUR;
|
||||
+ time %= SEC_PER_HOUR;
|
||||
+ *m = time / 60;
|
||||
+ *s = time % 60;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * This function calculates and prints the estimated time remaining.
|
||||
+ */
|
||||
+static void print_etr(int p_new, int started)
|
||||
+{
|
||||
+ static struct timeval start;
|
||||
+ struct timeval now;
|
||||
+ time_t time_elapsed;
|
||||
+ time_t time_end;
|
||||
+ int d, h, m, s;
|
||||
+ static int p_init;
|
||||
+ int p;
|
||||
+
|
||||
+ if (!started) {
|
||||
+ gettimeofday(&start, NULL);
|
||||
+ p_init = p_new;
|
||||
+ }
|
||||
+ gettimeofday(&now, NULL);
|
||||
+ time_elapsed = now.tv_sec - start.tv_sec;
|
||||
+
|
||||
+ /*
|
||||
+ * We might start somewhere in the middle with an initial percentage
|
||||
+ * value of i.e. 60%. Therefore we need to calculate the relative
|
||||
+ * percentage of p_new within that remaining range (100 - 60) in order
|
||||
+ * to correctly estimate the remaining time.
|
||||
+ */
|
||||
+ if (p_init == 100)
|
||||
+ p = p_init;
|
||||
+ else
|
||||
+ p = 100 * (p_new - p_init) / (100 - p_init);
|
||||
+
|
||||
+ if (p == 0)
|
||||
+ time_end = time_elapsed;
|
||||
+ else
|
||||
+ time_end = time_elapsed * (100 - p) / p;
|
||||
+
|
||||
+ /* Calculate days, hours, minutes, and seconds */
|
||||
+ calc_time(time_end, &d, &h, &m, &s);
|
||||
+ if (p_new == 100)
|
||||
+ calc_time(time_elapsed, &d, &h, &m, &s);
|
||||
+
|
||||
+ /* Avoid printing leading zeros */
|
||||
+ if (d > 0)
|
||||
+ printf(" [%dd %dh %dm %ds%-4s", d, h, m, s, "]");
|
||||
+ else if (h > 0)
|
||||
+ printf(" [%dh %dm %ds%-7s", h, m, s, "]");
|
||||
+ else if (m > 0)
|
||||
+ printf(" [%dm %ds%-6s", m, s, "]");
|
||||
+ else if (s > 0 || p > 50)
|
||||
+ printf(" [%ds%-5s", s, "]");
|
||||
+ else
|
||||
+ printf(" [--%-1s", "]");
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Draw the progress indicator depending on what command line argument is set.
|
||||
+ * This can either be a progressbar, hashmarks, or percentage.
|
||||
+ */
|
||||
+static void draw_progress(dasdfmt_info_t *info, int cyl, unsigned int cylinders)
|
||||
+{
|
||||
+ static int hashcount;
|
||||
+ static int started;
|
||||
+ static int p_old;
|
||||
+ int p_new = 0;
|
||||
+ int barlength;
|
||||
+ int i;
|
||||
+
|
||||
+ if (info->print_progressbar) {
|
||||
+ printf("cyl %7d of %7d |", cyl, cylinders);
|
||||
+ p_new = cyl * 100 / cylinders;
|
||||
+ if (p_new != p_old || !started) {
|
||||
+ /* percent value has changed */
|
||||
+ p_old = p_new;
|
||||
+ barlength = cyl * 33 / cylinders;
|
||||
+ for (i = 1; i <= barlength; i++)
|
||||
+ printf("#");
|
||||
+ for (i = barlength + 1; i <= 33; i++)
|
||||
+ printf("-");
|
||||
+ printf("|%3d%%", p_new);
|
||||
+ print_etr(p_new, started);
|
||||
+ started = 1;
|
||||
+ }
|
||||
+ printf("\r");
|
||||
+ fflush(stdout);
|
||||
+ }
|
||||
+
|
||||
+ if (info->print_hashmarks &&
|
||||
+ (cyl / info->hashstep - hashcount) != 0) {
|
||||
+ printf("%d|", info->procnum);
|
||||
+ fflush(stdout);
|
||||
+ hashcount++;
|
||||
+ }
|
||||
+
|
||||
+ if (info->print_percentage) {
|
||||
+ printf("cyl %7d of %7d |%3d%%\n", cyl, cylinders,
|
||||
+ cyl * 100 / cylinders);
|
||||
+ fflush(stdout);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int reread_partition_table(void)
|
||||
{
|
||||
int i = 0;
|
||||
@@ -906,9 +1023,10 @@ static void dasdfmt_write_labels(dasdfmt
|
||||
static void dasdfmt_format(dasdfmt_info_t *info, unsigned int cylinders,
|
||||
unsigned int heads, format_data_t *format_params)
|
||||
{
|
||||
- format_data_t format_step;
|
||||
- int j, cyl, tmp, p1, p2, hashcount = 0;
|
||||
- unsigned int k;
|
||||
+ unsigned int step_value;
|
||||
+ unsigned long cur_trk;
|
||||
+ format_data_t step;
|
||||
+ int cyl = 0;
|
||||
|
||||
if (info->print_hashmarks) {
|
||||
if (info->hashstep < reqsize)
|
||||
@@ -923,73 +1041,33 @@ static void dasdfmt_format(dasdfmt_info_
|
||||
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;
|
||||
- p2 = 0;
|
||||
- if (k + heads * reqsize >= format_params->stop_unit)
|
||||
- reqsize = 1;
|
||||
- format_step.start_unit = k;
|
||||
- format_step.stop_unit = k + reqsize * heads - 1;
|
||||
+ step = *format_params;
|
||||
+ cur_trk = format_params->start_unit;
|
||||
|
||||
- if (cyl == 1)
|
||||
- format_step.start_unit += 1;
|
||||
+ while (cur_trk < format_params->stop_unit) {
|
||||
+ step_value = reqsize * heads - (cur_trk % heads);
|
||||
+ step.start_unit = cur_trk;
|
||||
+ if (cur_trk + reqsize * heads >= format_params->stop_unit)
|
||||
+ step.stop_unit = format_params->stop_unit;
|
||||
+ else
|
||||
+ step.stop_unit = cur_trk + step_value - 1;
|
||||
|
||||
- if (ioctl(filedes, BIODASDFMT, &format_step) != 0)
|
||||
+ if (ioctl(filedes, BIODASDFMT, &step) != 0)
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "%s: (format cylinder) IOCTL "
|
||||
"BIODASDFMT failed. (%s)\n",
|
||||
prog_name, strerror(errno));
|
||||
|
||||
- if (info->print_progressbar) {
|
||||
- printf("cyl %7d of %7d |", cyl, cylinders);
|
||||
- p2 = p1;
|
||||
- p1 = cyl * 100 / cylinders;
|
||||
- if (p1 != p2) {
|
||||
- /* percent value has changed */
|
||||
- tmp = cyl * 50 / cylinders;
|
||||
- for (j = 1; j <= tmp; j++)
|
||||
- printf("#");
|
||||
- for (j = tmp + 1; j <= 50; j++)
|
||||
- printf("-");
|
||||
- printf("|%3d%%", p1);
|
||||
- }
|
||||
- printf("\r");
|
||||
- fflush(stdout);
|
||||
- }
|
||||
-
|
||||
- if (info->print_hashmarks)
|
||||
- if ((cyl / info->hashstep - hashcount) != 0) {
|
||||
- printf("%d|",info->procnum);
|
||||
- fflush(stdout);
|
||||
- hashcount++;
|
||||
- }
|
||||
-
|
||||
- if (info->print_percentage) {
|
||||
- printf("cyl %7d of %7d |%3d%%\n", cyl, cylinders,
|
||||
- cyl*100/cylinders);
|
||||
- fflush(stdout);
|
||||
- }
|
||||
+ cyl = cur_trk / heads + 1;
|
||||
+ draw_progress(info, cyl, cylinders);
|
||||
|
||||
- if (k % heads == 0) {
|
||||
- k += reqsize * heads;
|
||||
- cyl += reqsize;
|
||||
- } else {
|
||||
- k += format_params->stop_unit % heads;
|
||||
- }
|
||||
-
|
||||
- if (k > format_params->stop_unit)
|
||||
- break;
|
||||
+ cur_trk += step_value;
|
||||
}
|
||||
+ /* We're done, draw the 100% mark */
|
||||
+ cyl = step.stop_unit / heads + 1;
|
||||
+ draw_progress(info, cyl, cylinders);
|
||||
|
||||
if ((info->print_progressbar || info->print_hashmarks) && !info->yast_mode)
|
||||
- printf("\n\n");
|
||||
+ printf("\n");
|
||||
}
|
||||
|
||||
static void dasdfmt_prepare_and_format(dasdfmt_info_t *info,
|
@ -1,453 +0,0 @@
|
||||
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: Add command line argument --check
|
||||
|
||||
Provide a function to check a DASD volume for correct formatting. This
|
||||
can be useful in cases where only a few tracks of a volume are
|
||||
incorrectly formatted.
|
||||
|
||||
All tracks on the device are checked. In an error case, the check
|
||||
process is stopped and appropriate messages are displayed.
|
||||
|
||||
The --check command line argument can be combined with either -P,
|
||||
-p or -m to display progress on the console.
|
||||
|
||||
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.8 | 5 +
|
||||
dasdfmt/dasdfmt.c | 244 ++++++++++++++++++++++++++++++++++++++++--------------
|
||||
dasdfmt/dasdfmt.h | 4
|
||||
3 files changed, 190 insertions(+), 63 deletions(-)
|
||||
|
||||
--- a/dasdfmt/dasdfmt.8
|
||||
+++ b/dasdfmt/dasdfmt.8
|
||||
@@ -121,6 +121,11 @@ using \fB-b\fR (\fB--blocksize\fR).
|
||||
.RE
|
||||
|
||||
.TP
|
||||
+\fB--check\fR
|
||||
+Perform a complete format check on a DASD volume. A blocksize can be specified
|
||||
+with \fB-b\fR (\fB--blocksize\fR).
|
||||
+
|
||||
+.TP
|
||||
\fB-r\fR \fIcylindercount\fR or \fB--requestsize\fR=\fIcylindercount\fR
|
||||
Number of cylinders to be processed in one formatting step.
|
||||
The value must be an integer in the range 1 - 255.
|
||||
--- a/dasdfmt/dasdfmt.c
|
||||
+++ b/dasdfmt/dasdfmt.c
|
||||
@@ -76,7 +76,8 @@ static void exit_usage(int exitcode)
|
||||
" the host access open count to ensure the device\n"
|
||||
" is not online on another operating system instance\n"
|
||||
" --norecordzero prevent storage server from modifying"
|
||||
- " record 0\n\n"
|
||||
+ " record 0\n"
|
||||
+ " --check perform complete format check on device\n\n"
|
||||
" <volser> is the volume identifier, which is converted\n"
|
||||
" to EBCDIC and written to disk.\n"
|
||||
" (6 characters, e.g. LNX001\n"
|
||||
@@ -163,7 +164,8 @@ static void print_etr(int p_new, int sta
|
||||
* Draw the progress indicator depending on what command line argument is set.
|
||||
* This can either be a progressbar, hashmarks, or percentage.
|
||||
*/
|
||||
-static void draw_progress(dasdfmt_info_t *info, int cyl, unsigned int cylinders)
|
||||
+static void draw_progress(dasdfmt_info_t *info, int cyl, unsigned int cylinders,
|
||||
+ int aborted)
|
||||
{
|
||||
static int hashcount;
|
||||
static int started;
|
||||
@@ -175,7 +177,7 @@ static void draw_progress(dasdfmt_info_t
|
||||
if (info->print_progressbar) {
|
||||
printf("cyl %7d of %7d |", cyl, cylinders);
|
||||
p_new = cyl * 100 / cylinders;
|
||||
- if (p_new != p_old || !started) {
|
||||
+ if (p_new != p_old || !started || aborted) {
|
||||
/* percent value has changed */
|
||||
p_old = p_new;
|
||||
barlength = cyl * 33 / cylinders;
|
||||
@@ -184,6 +186,8 @@ static void draw_progress(dasdfmt_info_t
|
||||
for (i = barlength + 1; i <= 33; i++)
|
||||
printf("-");
|
||||
printf("|%3d%%", p_new);
|
||||
+ if (aborted)
|
||||
+ p_new = 100;
|
||||
print_etr(p_new, started);
|
||||
started = 1;
|
||||
}
|
||||
@@ -284,11 +288,17 @@ static void evaluate_format_error(dasdfm
|
||||
unsigned int kl = 0;
|
||||
int blksize = cdata->expect.blksize;
|
||||
|
||||
+ if (info->print_progressbar || info->print_hashmarks)
|
||||
+ printf("\n");
|
||||
+
|
||||
/*
|
||||
- * Reading record zero will never happen. If the record in error is 0
|
||||
- * nonetheless, the device is not formatted at all!
|
||||
+ * If mode is not QUICK and a device format couldn't be determined, the
|
||||
+ * device is considered not formatted.
|
||||
+ * Also, reading record zero will never happen. If the record in error
|
||||
+ * is 0 nonetheless, the device is not formatted at all as well!
|
||||
*/
|
||||
- if (cdata->rec == 0) {
|
||||
+ if ((info->dasd_info.format == DASD_FORMAT_NONE && mode != QUICK) ||
|
||||
+ cdata->rec == 0) {
|
||||
ERRMSG("WARNING: The specified device is not "
|
||||
"formatted at all.\n");
|
||||
return;
|
||||
@@ -529,6 +539,35 @@ static void check_blocksize(dasdfmt_info
|
||||
}
|
||||
|
||||
/*
|
||||
+ * Check whether a specified layout matches the layout
|
||||
+ * a device is formatted with.
|
||||
+ */
|
||||
+static void check_layout(dasdfmt_info_t *info, unsigned int intensity)
|
||||
+{
|
||||
+ char layout[4];
|
||||
+
|
||||
+ if (!info->layout_specified ||
|
||||
+ info->dasd_info.format == DASD_FORMAT_NONE)
|
||||
+ return;
|
||||
+
|
||||
+ if ((intensity & DASD_FMT_INT_COMPAT) &&
|
||||
+ info->dasd_info.format == DASD_FORMAT_CDL)
|
||||
+ return;
|
||||
+
|
||||
+ if (!(intensity & DASD_FMT_INT_COMPAT) &&
|
||||
+ info->dasd_info.format == DASD_FORMAT_LDL)
|
||||
+ return;
|
||||
+
|
||||
+ if (info->dasd_info.format == DASD_FORMAT_CDL)
|
||||
+ sprintf(layout, "CDL");
|
||||
+ if (info->dasd_info.format == DASD_FORMAT_LDL)
|
||||
+ sprintf(layout, "LDL");
|
||||
+
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "WARNING: Device is formatted with a "
|
||||
+ "different layout (%s).\n", layout);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* check for disk type and set some variables (e.g. usage count)
|
||||
*/
|
||||
static void check_disk(dasdfmt_info_t *info)
|
||||
@@ -715,10 +754,29 @@ static void set_label(dasdfmt_info_t *in
|
||||
}
|
||||
|
||||
/*
|
||||
+ * Check whether hashsteps are within the correct interval.
|
||||
+ */
|
||||
+static void check_hashmarks(dasdfmt_info_t *info)
|
||||
+{
|
||||
+ if (info->print_hashmarks) {
|
||||
+ if (info->hashstep < reqsize)
|
||||
+ info->hashstep = reqsize;
|
||||
+ if ((info->hashstep < 1) || (info->hashstep > 1000)) {
|
||||
+ printf("Hashmark increment is not in range <1,1000>, "
|
||||
+ "using the default.\n");
|
||||
+ info->hashstep = 10;
|
||||
+ }
|
||||
+
|
||||
+ printf("Printing hashmark every %d cylinders.\n",
|
||||
+ info->hashstep);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* This function checks whether a range of tracks is in regular format
|
||||
* with the specified block size.
|
||||
*/
|
||||
-static format_check_t check_track_format(format_data_t *p)
|
||||
+static format_check_t check_track_format(dasdfmt_info_t *info, format_data_t *p)
|
||||
{
|
||||
format_check_t cdata = {
|
||||
.expect = {
|
||||
@@ -731,9 +789,11 @@ static format_check_t check_track_format
|
||||
|
||||
if (ioctl(filedes, BIODASDCHECKFMT, &cdata)) {
|
||||
if (errno == ENOTTY) {
|
||||
- ERRMSG_EXIT(EXIT_FAILURE, "%s: Missing kernel support "
|
||||
- "for format checking (--force to "
|
||||
- "override)\n", prog_name);
|
||||
+ ERRMSG("%s: Missing kernel support for format checking",
|
||||
+ prog_name);
|
||||
+ if (!info->check)
|
||||
+ ERRMSG(" (--force to override)");
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, ".\n");
|
||||
}
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "%s: Could no check format: %s\n",
|
||||
prog_name, strerror(errno));
|
||||
@@ -742,6 +802,97 @@ static format_check_t check_track_format
|
||||
return cdata;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Either do the actual format or check depending on the check-value.
|
||||
+ */
|
||||
+static int process_tracks(dasdfmt_info_t *info, unsigned int cylinders,
|
||||
+ unsigned int heads, format_data_t *format_params)
|
||||
+{
|
||||
+ format_check_t cdata = { .expect = {0}, 0};
|
||||
+ format_data_t step = *format_params;
|
||||
+ unsigned long step_value;
|
||||
+ unsigned long cur_trk;
|
||||
+ int cyl = 0;
|
||||
+
|
||||
+ check_hashmarks(info);
|
||||
+
|
||||
+ cur_trk = format_params->start_unit;
|
||||
+
|
||||
+ while (cur_trk < format_params->stop_unit) {
|
||||
+ step_value = reqsize * heads - (cur_trk % heads);
|
||||
+ step.start_unit = cur_trk;
|
||||
+ if (cur_trk + heads * reqsize >= format_params->stop_unit)
|
||||
+ step.stop_unit = format_params->stop_unit;
|
||||
+ else
|
||||
+ step.stop_unit = cur_trk + step_value - 1;
|
||||
+
|
||||
+ if (info->check) {
|
||||
+ cdata = check_track_format(info, &step);
|
||||
+ if (cdata.result) {
|
||||
+ cyl = cur_trk / heads + 1;
|
||||
+ draw_progress(info, cyl, cylinders, 1);
|
||||
+ evaluate_format_error(info, &cdata, heads);
|
||||
+ break;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (ioctl(filedes, BIODASDFMT, &step) != 0)
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "%s: the ioctl call "
|
||||
+ "to format tracks failed. (%s)\n",
|
||||
+ prog_name, strerror(errno));
|
||||
+ }
|
||||
+
|
||||
+ cyl = cur_trk / heads + 1;
|
||||
+ draw_progress(info, cyl, cylinders, 0);
|
||||
+
|
||||
+ cur_trk += step_value;
|
||||
+ }
|
||||
+ /* We're done, draw the 100% mark */
|
||||
+ if (!cdata.result) {
|
||||
+ cyl = step.stop_unit / heads + 1;
|
||||
+ draw_progress(info, cyl, cylinders, 0);
|
||||
+ printf("\n");
|
||||
+ }
|
||||
+
|
||||
+ return cdata.result;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * This function checks the format of the entire disk.
|
||||
+ */
|
||||
+static void check_disk_format(dasdfmt_info_t *info, unsigned int cylinders,
|
||||
+ unsigned int heads, format_data_t *check_params)
|
||||
+{
|
||||
+ check_params->start_unit = 0;
|
||||
+ check_params->stop_unit = (cylinders * heads) - 1;
|
||||
+
|
||||
+ printf("Checking format of the entire disk...\n");
|
||||
+
|
||||
+ if (info->testmode) {
|
||||
+ printf("Test mode active, omitting ioctl.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ check_blocksize(info, check_params->blksize);
|
||||
+ check_layout(info, check_params->intensity);
|
||||
+
|
||||
+ /*
|
||||
+ * If no layout was specified, set the intensity
|
||||
+ * according to what the layout seems to be.
|
||||
+ */
|
||||
+ if (!info->layout_specified) {
|
||||
+ if (info->dasd_info.format == DASD_FORMAT_CDL)
|
||||
+ check_params->intensity |= DASD_FMT_INT_COMPAT;
|
||||
+ else if (info->dasd_info.format == DASD_FORMAT_LDL)
|
||||
+ check_params->intensity &= ~DASD_FMT_INT_COMPAT;
|
||||
+ }
|
||||
+
|
||||
+ if (process_tracks(info, cylinders, heads, check_params)) {
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "Use --mode=full to perform a "
|
||||
+ "clean format.\n");
|
||||
+ }
|
||||
+
|
||||
+ printf("Done. Disk is fine.\n");
|
||||
+}
|
||||
|
||||
/*
|
||||
* ask the user to specify a blocksize
|
||||
@@ -1023,51 +1174,7 @@ static void dasdfmt_write_labels(dasdfmt
|
||||
static void dasdfmt_format(dasdfmt_info_t *info, unsigned int cylinders,
|
||||
unsigned int heads, format_data_t *format_params)
|
||||
{
|
||||
- unsigned int step_value;
|
||||
- unsigned long cur_trk;
|
||||
- format_data_t step;
|
||||
- int cyl = 0;
|
||||
-
|
||||
- if (info->print_hashmarks) {
|
||||
- if (info->hashstep < reqsize)
|
||||
- info->hashstep = reqsize;
|
||||
- if ((info->hashstep < 1) || (info->hashstep > 1000)) {
|
||||
- printf("Hashmark increment is not in range <1,1000>, "
|
||||
- "using the default.\n");
|
||||
- info->hashstep = 10;
|
||||
- }
|
||||
-
|
||||
- if(!info->yast_mode) printf("Printing hashmark every %d cylinders.\n",
|
||||
- info->hashstep);
|
||||
- }
|
||||
-
|
||||
- step = *format_params;
|
||||
- cur_trk = format_params->start_unit;
|
||||
-
|
||||
- while (cur_trk < format_params->stop_unit) {
|
||||
- step_value = reqsize * heads - (cur_trk % heads);
|
||||
- step.start_unit = cur_trk;
|
||||
- if (cur_trk + reqsize * heads >= format_params->stop_unit)
|
||||
- step.stop_unit = format_params->stop_unit;
|
||||
- else
|
||||
- step.stop_unit = cur_trk + step_value - 1;
|
||||
-
|
||||
- if (ioctl(filedes, BIODASDFMT, &step) != 0)
|
||||
- ERRMSG_EXIT(EXIT_FAILURE, "%s: (format cylinder) IOCTL "
|
||||
- "BIODASDFMT failed. (%s)\n",
|
||||
- prog_name, strerror(errno));
|
||||
-
|
||||
- cyl = cur_trk / heads + 1;
|
||||
- draw_progress(info, cyl, cylinders);
|
||||
-
|
||||
- cur_trk += step_value;
|
||||
- }
|
||||
- /* We're done, draw the 100% mark */
|
||||
- cyl = step.stop_unit / heads + 1;
|
||||
- draw_progress(info, cyl, cylinders);
|
||||
-
|
||||
- if ((info->print_progressbar || info->print_hashmarks) && !info->yast_mode)
|
||||
- printf("\n");
|
||||
+ process_tracks(info, cylinders, heads, format_params);
|
||||
}
|
||||
|
||||
static void dasdfmt_prepare_and_format(dasdfmt_info_t *info,
|
||||
@@ -1082,6 +1189,10 @@ static void dasdfmt_prepare_and_format(d
|
||||
| DASD_FMT_INT_INVAL)
|
||||
};
|
||||
|
||||
+ if (!((info->withoutprompt) && (info->verbosity < 1)))
|
||||
+ printf("Formatting the device. This may take a while "
|
||||
+ "(get yourself a coffee).\n");
|
||||
+
|
||||
if (info->verbosity > 0)
|
||||
printf("Detaching the device...\n");
|
||||
|
||||
@@ -1147,11 +1258,11 @@ static void dasdfmt_quick_format(dasdfmt
|
||||
/* Check device format on the first and last 3 regular tracks */
|
||||
tmp.start_unit = 2;
|
||||
tmp.stop_unit = 4;
|
||||
- cdata = check_track_format(&tmp);
|
||||
+ cdata = check_track_format(info, &tmp);
|
||||
if (!cdata.result) {
|
||||
tmp.start_unit = (cylinders * heads) - 3;
|
||||
tmp.stop_unit = (cylinders * heads) - 1;
|
||||
- cdata = check_track_format(&tmp);
|
||||
+ cdata = check_track_format(info, &tmp);
|
||||
}
|
||||
if (cdata.result) {
|
||||
evaluate_format_error(info, &cdata, heads);
|
||||
@@ -1243,9 +1354,6 @@ static void do_format_dasd(dasdfmt_info_
|
||||
|
||||
switch (mode) {
|
||||
case FULL:
|
||||
- if (!((info->withoutprompt) && (info->verbosity < 1)))
|
||||
- printf("Formatting the device. This may take a "
|
||||
- "while (get yourself a coffee).\n");
|
||||
dasdfmt_prepare_and_format(info, cylinders, heads, p);
|
||||
break;
|
||||
case QUICK:
|
||||
@@ -1337,6 +1445,7 @@ int main(int argc, char *argv[])
|
||||
printf("%s is not a valid option!\n", optarg);
|
||||
exit(1);
|
||||
}
|
||||
+ info.layout_specified = 1;
|
||||
break;
|
||||
case 'y':
|
||||
info.withoutprompt = 1;
|
||||
@@ -1424,6 +1533,9 @@ int main(int argc, char *argv[])
|
||||
"more information.\n",
|
||||
prog_name, optarg);
|
||||
break;
|
||||
+ case OPT_CHECK:
|
||||
+ info.check = 1;
|
||||
+ break;
|
||||
case -1:
|
||||
/* End of options string - start of devices list */
|
||||
info.device_id = optind;
|
||||
@@ -1539,7 +1651,7 @@ int main(int argc, char *argv[])
|
||||
/* Either let the user specify the blksize or get it from the kernel */
|
||||
if (!info.blksize_specified) {
|
||||
if (!(mode == FULL ||
|
||||
- info.dasd_info.format == DASD_FORMAT_NONE))
|
||||
+ info.dasd_info.format == DASD_FORMAT_NONE) || info.check)
|
||||
get_blocksize(&format_params.blksize);
|
||||
else
|
||||
format_params = ask_user_for_blksize(format_params);
|
||||
@@ -1568,8 +1680,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
set_geo(&info, &cylinders, &heads);
|
||||
set_label(&info, &vlabel, &format_params, cylinders);
|
||||
- do_format_dasd(&info, &vlabel, &format_params,
|
||||
- cylinders, heads);
|
||||
+
|
||||
+ if (info.check) {
|
||||
+ check_disk_format(&info, cylinders, heads,
|
||||
+ &format_params);
|
||||
+ } else {
|
||||
+ do_format_dasd(&info, &vlabel, &format_params,
|
||||
+ cylinders, heads);
|
||||
+ }
|
||||
|
||||
if (close(filedes) != 0)
|
||||
ERRMSG("%s: error during close: %s\ncontinuing...\n",
|
||||
--- a/dasdfmt/dasdfmt.h
|
||||
+++ b/dasdfmt/dasdfmt.h
|
||||
@@ -273,6 +273,7 @@ typedef struct format_check_t {
|
||||
if (*endptr) ERRMSG_EXIT(EXIT_MISUSE,"%s: " str " " \
|
||||
"is in invalid format\n",prog_name);}
|
||||
|
||||
+#define OPT_CHECK 128
|
||||
#define dasdfmt_getopt_string "b:n:l:f:d:m:M:r:hpQLtyvVFkCYP:"
|
||||
|
||||
static struct option dasdfmt_getopt_long_options[]=
|
||||
@@ -296,6 +297,7 @@ static struct option dasdfmt_getopt_long
|
||||
{ "norecordzero", 0, 0, 'z'},
|
||||
{ "check_host_count", 0, 0, 'C'},
|
||||
{ "mode", 1, 0, 'M'},
|
||||
+ { "check", 0, 0, OPT_CHECK},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
@@ -328,6 +330,8 @@ typedef struct dasdfmt_info {
|
||||
int device_id;
|
||||
int keep_volser;
|
||||
int force_host;
|
||||
+ int layout_specified;
|
||||
+ int check;
|
||||
int yast_mode;
|
||||
int procnum;
|
||||
} dasdfmt_info_t;
|
@ -1,266 +0,0 @@
|
||||
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: Add expand format mode
|
||||
|
||||
If a DASD was extended, the format of the first part of the disk
|
||||
can be assumed to be correct. Usually, a full format would be necessary
|
||||
to ensure a fully functional disk. However, this would also format
|
||||
the already formatted part resulting in the loss of the data stored in
|
||||
that part.
|
||||
|
||||
Add an expand mode which will search for the start of the unformatted
|
||||
area and begin formatting from there.
|
||||
|
||||
The mode is being specified by --mode=expand (or -M expand for short).
|
||||
|
||||
Furthermore:
|
||||
- Add string array for the individual modes for output purposes
|
||||
- Avoid writing labels when EXPAND mode is active since they can be
|
||||
assumed to be correct
|
||||
- Add man page description
|
||||
|
||||
|
||||
Signed-off-by: Jan Höppner <hoeppner@linux.vnet.ibm.com>
|
||||
---
|
||||
dasdfmt/dasdfmt.8 | 7 +++
|
||||
dasdfmt/dasdfmt.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++++-----
|
||||
dasdfmt/dasdfmt.h | 5 ++
|
||||
3 files changed, 123 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/dasdfmt/dasdfmt.8
|
||||
+++ b/dasdfmt/dasdfmt.8
|
||||
@@ -118,6 +118,13 @@ Format the first two tracks and write la
|
||||
this option if you are sure that the target DASD already contains a regular
|
||||
format with the specified blocksize. A blocksize can optionally be specified
|
||||
using \fB-b\fR (\fB--blocksize\fR).
|
||||
+.IP expand
|
||||
+Format all unformatted tracks at the end of the target DASD. This mode assumes
|
||||
+that tracks at the beginning of the DASD volume have already been correctly
|
||||
+formatted, while a consecutive set of tracks at the end are unformatted. You can
|
||||
+use this mode to make added space available for Linux use after dynamically
|
||||
+increasing the size of a DASD volume. A blocksize can optionally be specified
|
||||
+using \fB-b\fR (\fB--blocksize\fR).
|
||||
.RE
|
||||
|
||||
.TP
|
||||
--- a/dasdfmt/dasdfmt.c
|
||||
+++ b/dasdfmt/dasdfmt.c
|
||||
@@ -88,7 +88,9 @@ static void exit_usage(int exitcode)
|
||||
" <device> device node of the device to format\n"
|
||||
" <mode> is either\n"
|
||||
" 'full' to fully format the device (default)\n"
|
||||
- " 'quick' to format only the first two tracks\n");
|
||||
+ " 'quick' to format only the first two tracks\n"
|
||||
+ " 'expand' to format only the unformatted end"
|
||||
+ " of a device\n");
|
||||
exit(exitcode);
|
||||
}
|
||||
|
||||
@@ -791,8 +793,11 @@ static format_check_t check_track_format
|
||||
if (errno == ENOTTY) {
|
||||
ERRMSG("%s: Missing kernel support for format checking",
|
||||
prog_name);
|
||||
- if (!info->check)
|
||||
+ if (mode == EXPAND) {
|
||||
+ ERRMSG(". Mode 'expand' cannot be used");
|
||||
+ } else if (!info->check) {
|
||||
ERRMSG(" (--force to override)");
|
||||
+ }
|
||||
ERRMSG_EXIT(EXIT_FAILURE, ".\n");
|
||||
}
|
||||
ERRMSG_EXIT(EXIT_FAILURE, "%s: Could no check format: %s\n",
|
||||
@@ -957,8 +962,7 @@ static void dasdfmt_print_info(dasdfmt_i
|
||||
printf(" Compatible Disk Layout : %s\n",
|
||||
(p->intensity & DASD_FMT_INT_COMPAT) ? "yes" : "no");
|
||||
printf(" Blocksize : %d\n", p->blksize);
|
||||
- printf(" Mode : %s\n",
|
||||
- (mode == FULL) ? "Full" : "Quick");
|
||||
+ printf(" Mode : %s\n", mode_str[mode]);
|
||||
|
||||
if (info->testmode)
|
||||
printf("Test mode active, omitting ioctl.\n");
|
||||
@@ -1169,6 +1173,60 @@ static void dasdfmt_write_labels(dasdfmt
|
||||
}
|
||||
|
||||
/*
|
||||
+ * This function will search for the beginning of an unformatted area
|
||||
+ * on the device. It checks selected tracks beforehand and makes sure
|
||||
+ * that the device is formatted to a certain extent. Otherwise the
|
||||
+ * process is terminated.
|
||||
+ */
|
||||
+static void dasdfmt_find_start(dasdfmt_info_t *info, unsigned int cylinders,
|
||||
+ unsigned heads, format_data_t *format_params)
|
||||
+{
|
||||
+ format_check_t cdata;
|
||||
+ unsigned int middle;
|
||||
+ unsigned int left = 2;
|
||||
+ unsigned int right = (cylinders * heads) - 1;
|
||||
+ unsigned int first = left;
|
||||
+
|
||||
+ check_blocksize(info, format_params->blksize);
|
||||
+
|
||||
+ format_params->start_unit = 0;
|
||||
+ format_params->stop_unit = 4;
|
||||
+ cdata = check_track_format(info, format_params);
|
||||
+
|
||||
+ if (cdata.result) {
|
||||
+ evaluate_format_error(info, &cdata, heads);
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "Use --mode=full to perform a "
|
||||
+ "clean format.\n");
|
||||
+ }
|
||||
+
|
||||
+ printf("Expansion mode active. Searching for starting position...\n");
|
||||
+
|
||||
+ while (left <= right) {
|
||||
+ /* new track number to look at */
|
||||
+ middle = left + ((right - left) / 2);
|
||||
+
|
||||
+ format_params->start_unit = middle;
|
||||
+ format_params->stop_unit = middle;
|
||||
+ cdata = check_track_format(info, format_params);
|
||||
+ if (cdata.blksize != format_params->blksize) {
|
||||
+ first = middle;
|
||||
+ right = middle - 1;
|
||||
+ } else {
|
||||
+ left = middle + 1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (first == 2 && cdata.blksize == format_params->blksize)
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE,
|
||||
+ "No unformatted part found, aborting.\n");
|
||||
+
|
||||
+ printf("Done. Unformatted part starts at track %d.\n", first);
|
||||
+
|
||||
+ /* return format_params with start_unit set to the correct value */
|
||||
+ format_params->start_unit = first;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* formats the disk cylinderwise
|
||||
*/
|
||||
static void dasdfmt_format(dasdfmt_info_t *info, unsigned int cylinders,
|
||||
@@ -1239,6 +1297,40 @@ static void dasdfmt_prepare_and_format(d
|
||||
}
|
||||
|
||||
/*
|
||||
+ * This function will start the expand format process.
|
||||
+ */
|
||||
+static void dasdfmt_expand_format(dasdfmt_info_t *info, unsigned int cylinders,
|
||||
+ unsigned int heads, format_data_t *p)
|
||||
+{
|
||||
+ if (!((info->withoutprompt) && (info->verbosity < 1)))
|
||||
+ printf("Formatting the device. This may take a while "
|
||||
+ "(get yourself a coffee).\n");
|
||||
+
|
||||
+ if (info->verbosity > 0)
|
||||
+ printf("Detaching the device...\n");
|
||||
+
|
||||
+ if (ioctl(filedes, BIODASDDISABLE, p) != 0)
|
||||
+ ERRMSG_EXIT(EXIT_FAILURE, "%s: (prepare device) IOCTL "
|
||||
+ "BIODASDDISABLE failed. (%s)\n", prog_name,
|
||||
+ strerror(errno));
|
||||
+ disk_disabled = 1;
|
||||
+
|
||||
+ dasdfmt_format(info, cylinders, heads, p);
|
||||
+
|
||||
+ if (info->verbosity > 0)
|
||||
+ printf("Formatting tracks complete...\n");
|
||||
+
|
||||
+ 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,
|
||||
+ strerror(errno));
|
||||
+ disk_disabled = 0;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* This function will only format the first two tracks of a DASD.
|
||||
* The rest of the DASD is untouched and left as is.
|
||||
*/
|
||||
@@ -1310,6 +1402,10 @@ static void do_format_dasd(dasdfmt_info_
|
||||
case QUICK: /* just the first two */
|
||||
p->stop_unit = 1;
|
||||
break;
|
||||
+ case EXPAND: /* only the end of the disk */
|
||||
+ dasdfmt_find_start(info, cylinders, heads, p);
|
||||
+ p->stop_unit = (cylinders * heads) - 1;
|
||||
+ break;
|
||||
}
|
||||
|
||||
if ((info->verbosity > 0) || !info->withoutprompt || info->testmode)
|
||||
@@ -1338,10 +1434,12 @@ static void do_format_dasd(dasdfmt_info_
|
||||
|
||||
if (!info->testmode) {
|
||||
if (!info->withoutprompt) {
|
||||
- printf("\n--->> ATTENTION! <<---\n");
|
||||
- printf("All data of that device will be lost.\nType "
|
||||
- "\"yes\" to continue, no will leave the disk "
|
||||
- "untouched: ");
|
||||
+ printf("\n");
|
||||
+ if (mode != EXPAND)
|
||||
+ printf("--->> ATTENTION! <<---\nAll data of "
|
||||
+ "that device will be lost.\n");
|
||||
+ printf("Type \"yes\" to continue, no will leave the "
|
||||
+ "disk untouched: ");
|
||||
if (fgets(inp_buffer, sizeof(inp_buffer), stdin) == NULL)
|
||||
return;
|
||||
if (strcasecmp(inp_buffer, "yes") &&
|
||||
@@ -1359,12 +1457,14 @@ static void do_format_dasd(dasdfmt_info_
|
||||
case QUICK:
|
||||
dasdfmt_quick_format(info, cylinders, heads, p);
|
||||
break;
|
||||
+ case EXPAND:
|
||||
+ dasdfmt_expand_format(info, cylinders, heads, p);
|
||||
}
|
||||
|
||||
if (!info->yast_mode)
|
||||
printf("Finished formatting the device.\n");
|
||||
|
||||
- if (!info->writenolabel)
|
||||
+ if (!(info->writenolabel || mode == EXPAND))
|
||||
dasdfmt_write_labels(info, vlabel, cylinders, heads);
|
||||
|
||||
if (!info->yast_mode)
|
||||
@@ -1526,6 +1626,8 @@ int main(int argc, char *argv[])
|
||||
mode = FULL;
|
||||
else if (strcasecmp(optarg, "quick") == 0)
|
||||
mode = QUICK;
|
||||
+ else if (strcasecmp(optarg, "expand") == 0)
|
||||
+ mode = EXPAND;
|
||||
else
|
||||
ERRMSG_EXIT(EXIT_FAILURE,
|
||||
"%s: The specified mode '%s' is "
|
||||
--- a/dasdfmt/dasdfmt.h
|
||||
+++ b/dasdfmt/dasdfmt.h
|
||||
@@ -150,8 +150,13 @@ struct dasd_eckd_characteristics {
|
||||
typedef enum format_mode_t {
|
||||
FULL, /* default mode */
|
||||
QUICK, /* format only the first 2 tracks */
|
||||
+ EXPAND, /* search for unformatted area and format only that part*/
|
||||
} format_mode_t;
|
||||
|
||||
+static const char mode_str[3][10] = {
|
||||
+ "Full", "Quick", "Expand"
|
||||
+};
|
||||
+
|
||||
/*
|
||||
* struct format_data_t
|
||||
* represents all data necessary to format a dasd
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,72 +0,0 @@
|
||||
Subject: [PATCH] [FEAT RTL1601] dbginfo.sh: Make use of sysfs collection helper
|
||||
From: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
|
||||
|
||||
Summary: dbginfo.sh: Make use of sysfs collection helper
|
||||
Description: If available, use dump2tar in dbginfo.sh for sysfs
|
||||
file collection to significantly speed up dbginfo.sh
|
||||
processing. Example speedup on an LPAR with ~190k
|
||||
sysfs files:
|
||||
|
||||
Unpatched:
|
||||
# time ./dbginfo.sh
|
||||
real 1m19.624s
|
||||
user 0m44.985s
|
||||
sys 0m45.173s
|
||||
|
||||
Patched:
|
||||
# time ./dbginfo.sh
|
||||
real 0m5.822s
|
||||
user 0m4.523s
|
||||
sys 0m2.636s
|
||||
Upstream-ID: -
|
||||
Problem-ID: RTL1601
|
||||
|
||||
Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
|
||||
---
|
||||
scripts/dbginfo.sh | 33 +++++++++++++++++++++------------
|
||||
1 file changed, 21 insertions(+), 12 deletions(-)
|
||||
|
||||
--- a/scripts/dbginfo.sh
|
||||
+++ b/scripts/dbginfo.sh
|
||||
@@ -620,20 +620,29 @@ collect_sysfs() {
|
||||
fi
|
||||
fi
|
||||
|
||||
- call_run_command "find /sys -print0 | sort -z | xargs -0 -n 10 ls -ld" "${OUTPUT_FILE_SYSFS}"
|
||||
+ # Collect sysfs files using multiple threads (-J 1) while excluding
|
||||
+ # files known to block on read (-x). Stop reading a file that takes
|
||||
+ # more than 5 seconds (-T 5) such as an active ftrace buffer.
|
||||
+ dump2tar /sys -z -o "${WORKPATH}/sysfs.tgz" -x '*/tracing/trace_pipe*' \
|
||||
+ -x '*/tracing/per_cpu/*' --ignore-failed-read -J 1 -T 5
|
||||
|
||||
- find /sys -noleaf -type d 2>/dev/null | while IFS= read -r dir_name; do
|
||||
- mkdir -p "${WORKPATH}${dir_name}"
|
||||
- done
|
||||
+ if [ $? -ne 0 ] ; then
|
||||
+ echo "${SCRIPTNAME}: Warning: dump2tar failed or is unavailable - falling back to slow path"
|
||||
+ call_run_command "find /sys -print0 | sort -z | xargs -0 -n 10 ls -ld" "${OUTPUT_FILE_SYSFS}"
|
||||
|
||||
- find /sys -noleaf -type f -perm /444\
|
||||
- -a -not -name "*trace_pipe*"\
|
||||
- 2>/dev/null | while IFS= read -r file_name; do
|
||||
- echo " ${file_name}"
|
||||
- if ! dd if="${file_name}" status=noxfer iflag=nonblock of="${WORKPATH}${file_name}" >/dev/null 2>&1; then
|
||||
- echo "${SCRIPTNAME}: Warning: failed to copy \"${file_name}\""
|
||||
- fi
|
||||
- done
|
||||
+ find /sys -noleaf -type d 2>/dev/null | while IFS= read -r dir_name; do
|
||||
+ mkdir -p "${WORKPATH}${dir_name}"
|
||||
+ done
|
||||
+
|
||||
+ find /sys -noleaf -type f -perm /444\
|
||||
+ -a -not -name "*trace_pipe*"\
|
||||
+ 2>/dev/null | while IFS= read -r file_name; do
|
||||
+ echo " ${file_name}"
|
||||
+ if ! dd if="${file_name}" status=noxfer iflag=nonblock of="${WORKPATH}${file_name}" >/dev/null 2>&1; then
|
||||
+ echo "${SCRIPTNAME}: Warning: failed to copy \"${file_name}\""
|
||||
+ fi
|
||||
+ done
|
||||
+ fi
|
||||
|
||||
if test ${debugfs_mounted} -eq 1; then
|
||||
umount "${MOUNT_POINT_DEBUGFS}"
|
@ -1,142 +0,0 @@
|
||||
Subject: [PATCH] [BZ 151594] dbginfo: Collect docker debug output.
|
||||
From: Karsten Graul <kgraul@linux.vnet.ibm.com>
|
||||
|
||||
Description: dbginfo: Collect docker debug output.
|
||||
Symptom: dbginfo.sh output does not contain docker debug output.
|
||||
Problem: dbginfo.sh does not collect docker debug output.
|
||||
Solution: Add invocation of docker debug commands to dbginfo.sh.
|
||||
Reproduction: -
|
||||
Upstream-ID: -
|
||||
Problem-ID: 151594
|
||||
|
||||
Signed-off-by: Karsten Graul <kgraul@linux.vnet.ibm.com>
|
||||
---
|
||||
scripts/dbginfo.sh | 58 +++++++++++++++++++++++++++++++++++++++++++++++++----
|
||||
1 file changed, 54 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/scripts/dbginfo.sh
|
||||
+++ b/scripts/dbginfo.sh
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# dbginfo.sh - Tool to collect runtime, configuration, and trace information
|
||||
#
|
||||
-# Copyright IBM Corp. 2002, 2016
|
||||
+# Copyright IBM Corp. 2002, 2017
|
||||
#
|
||||
|
||||
# Switching to neutral locale
|
||||
@@ -18,7 +18,7 @@ readonly SCRIPTNAME="${0##*/}"
|
||||
print_version() {
|
||||
cat <<EOF
|
||||
${SCRIPTNAME}: Debug information script version %S390_TOOLS_VERSION%
|
||||
-Copyright IBM Corp. 2002, 2016
|
||||
+Copyright IBM Corp. 2002, 2017
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -177,11 +177,14 @@ readonly OUTPUT_FILE_OVS="${WORKPATH}ope
|
||||
# File that includes the KVM domain xml file
|
||||
readonly OUTPUT_FILE_XML="${WORKPATH}domain_xml"
|
||||
|
||||
+# File that includes the docker inspect output
|
||||
+readonly OUTPUT_FILE_DOCKER="${WORKPATH}docker_inspect.out"
|
||||
+
|
||||
# Mount point of the debug file system
|
||||
readonly MOUNT_POINT_DEBUGFS="/sys/kernel/debug"
|
||||
|
||||
# The amount of steps running the whole collections
|
||||
-readonly COLLECTION_COUNT=10
|
||||
+readonly COLLECTION_COUNT=11
|
||||
|
||||
# The kernel version (e.g. '2' from 2.6.32 or '3' from 3.2.1)
|
||||
readonly KERNEL_VERSION=$(uname -r 2>/dev/null | cut -d'.' -f1)
|
||||
@@ -301,6 +304,8 @@ LOGFILES="\
|
||||
/var/log/yum.log\
|
||||
/var/log/openvswitch/ovs-vswitchd.log\
|
||||
/var/log/openvswitch/ovsdb-server.log\
|
||||
+ /var/run/docker/libcontainerd/containerd/events.log\
|
||||
+ /run/containerd/events.log\
|
||||
"
|
||||
|
||||
########################################
|
||||
@@ -351,6 +356,9 @@ CONFIGFILES="\
|
||||
/etc/xinet.d\
|
||||
/etc/*release\
|
||||
$(find /lib/modules -name modules.dep 2>/dev/null)\
|
||||
+ /etc/docker\
|
||||
+ /usr/lib/systemd\
|
||||
+ /etc/apparmor.d\
|
||||
"
|
||||
|
||||
########################################
|
||||
@@ -436,6 +444,16 @@ CMDS="uname -a\
|
||||
:systemctl --all --no-pager show\
|
||||
:systemctl --all --no-pager list-units\
|
||||
:systemctl --all --no-pager list-unit-files\
|
||||
+ :docker info\
|
||||
+ :docker images\
|
||||
+ :docker network ls\
|
||||
+ :docker ps\
|
||||
+ :docker ps -a\
|
||||
+ :docker stats --no-stream\
|
||||
+ :docker version\
|
||||
+ :systemctl status docker.service\
|
||||
+ :df /var/lib/docker\
|
||||
+ :df --inodes /var/lib/docker\
|
||||
"
|
||||
|
||||
########################################
|
||||
@@ -767,13 +785,43 @@ collect_domain_xml() {
|
||||
}
|
||||
|
||||
########################################
|
||||
+collect_docker() {
|
||||
+ local item_list
|
||||
+ local item
|
||||
+
|
||||
+ # call docker inspect for all containers
|
||||
+ item_list=$(docker ps -qa)
|
||||
+ if test -n "${item_list}"; then
|
||||
+ pr_syslog_stdout "10a of ${COLLECTION_COUNT}: Collecting docker container output"
|
||||
+ for item in ${item_list}; do
|
||||
+ call_run_command "docker inspect ${item}" "${OUTPUT_FILE_DOCKER}"
|
||||
+ done
|
||||
+ else
|
||||
+ pr_syslog_stdout "10a of ${COLLECTION_COUNT}: Collecting docker container output skipped"
|
||||
+ fi
|
||||
+
|
||||
+ # call docker inspect for all networks
|
||||
+ item_list=$(docker network ls -q)
|
||||
+ if test -n "${item_list}"; then
|
||||
+ pr_syslog_stdout "10b of ${COLLECTION_COUNT}: Collecting docker network output"
|
||||
+ for item in ${item_list}; do
|
||||
+ call_run_command "docker network inspect ${item}" "${OUTPUT_FILE_DOCKER}"
|
||||
+ done
|
||||
+ else
|
||||
+ pr_syslog_stdout "10b of ${COLLECTION_COUNT}: Collecting docker network output skipped"
|
||||
+ fi
|
||||
+
|
||||
+ pr_log_stdout " "
|
||||
+}
|
||||
+
|
||||
+########################################
|
||||
post_processing() {
|
||||
local file_mtime
|
||||
local file_mtime_epoche
|
||||
local tmp_file
|
||||
local file_name
|
||||
|
||||
- pr_syslog_stdout "10 of ${COLLECTION_COUNT}: Postprocessing"
|
||||
+ pr_syslog_stdout "11 of ${COLLECTION_COUNT}: Postprocessing"
|
||||
|
||||
find "${WORKPATH}etc/libvirt/qemu/" -maxdepth 1 -name "*.xml" 2>/dev/null | while IFS= read -r file_name; do
|
||||
file_mtime_epoche=$(stat --format=%Y "${file_name}")
|
||||
@@ -1056,6 +1104,8 @@ collect_ovs
|
||||
|
||||
collect_domain_xml
|
||||
|
||||
+collect_docker
|
||||
+
|
||||
post_processing
|
||||
|
||||
create_package
|
@ -1,558 +0,0 @@
|
||||
Subject: [PATCH] [FEAT LS1502] lsdasd/tunedasd: Add channel path aware erp
|
||||
From: Stefan Haberland <sth@linux.vnet.ibm.com>
|
||||
|
||||
Summary: lsdasd/tunedasd: Add channel path aware erp
|
||||
Description: Add tools support for channel path aware error recovery.
|
||||
lsdasd shows the newly added IFCC path mask and HPF availability.
|
||||
tunedasd gets an option to reset channel paths for a device.
|
||||
Upstream-ID: -
|
||||
Problem-ID: LS1502
|
||||
|
||||
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
|
||||
---
|
||||
include/dasd_sys.h | 1
|
||||
libdasd/dasd_sys.c | 94 +++++++++++++++++++++++++++++++++++++
|
||||
tunedasd/include/disk.h | 3 -
|
||||
tunedasd/man/tunedasd.8 | 17 ++++++
|
||||
tunedasd/src/Makefile | 2
|
||||
tunedasd/src/disk.c | 35 ++++++++++++++
|
||||
tunedasd/src/tunedasd.c | 120 ++++++++++++++++++++++++++++--------------------
|
||||
zconf/lsdasd | 36 +++++++++++---
|
||||
8 files changed, 251 insertions(+), 57 deletions(-)
|
||||
|
||||
--- a/include/dasd_sys.h
|
||||
+++ b/include/dasd_sys.h
|
||||
@@ -13,5 +13,6 @@
|
||||
#include "u2s.h"
|
||||
|
||||
int dasd_sys_raw_track_access(char *);
|
||||
+int dasd_reset_chpid(char *, char *);
|
||||
|
||||
#endif /* DASD_SYS_H */
|
||||
--- a/libdasd/dasd_sys.c
|
||||
+++ b/libdasd/dasd_sys.c
|
||||
@@ -6,6 +6,9 @@
|
||||
* Copyright IBM Corp. 2016
|
||||
*/
|
||||
|
||||
+#include <stdlib.h>
|
||||
+#include <errno.h>
|
||||
+
|
||||
#include "dasd_sys.h"
|
||||
|
||||
/**
|
||||
@@ -44,3 +47,94 @@ int dasd_sys_raw_track_access(char *devn
|
||||
|
||||
return (rc == 1) ? 1 : 0;
|
||||
}
|
||||
+
|
||||
+
|
||||
+int dasd_get_pm_from_chpid(char *busid, unsigned int chpid, int *mask)
|
||||
+{
|
||||
+ unsigned int val;
|
||||
+ char path[40];
|
||||
+ int count, i;
|
||||
+ FILE *fp;
|
||||
+
|
||||
+ sprintf(path, "/sys/bus/ccw/devices/%s/../chpids", busid);
|
||||
+ *mask = 0;
|
||||
+ fp = fopen(path, "r");
|
||||
+ if (!fp)
|
||||
+ return ENODEV;
|
||||
+
|
||||
+ for (i = 0; i < 8; i++) {
|
||||
+ count = fscanf(fp, " %x", &val);
|
||||
+ if (count != 1) {
|
||||
+ fclose(fp);
|
||||
+ return EIO;
|
||||
+ }
|
||||
+ if (val == chpid)
|
||||
+ *mask = 0x80 >> i;
|
||||
+ }
|
||||
+ fclose(fp);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * reset chpid
|
||||
+ *
|
||||
+ * The "devnode" parameter can be any valid relative or absolute path to
|
||||
+ * a DASD device node, for example:
|
||||
+ *
|
||||
+ * - /dev/dasda
|
||||
+ * - /dev/disk/by-path/ccw-0.0.bf20
|
||||
+ *
|
||||
+ * @param[in] devnode Device node of interest
|
||||
+ * @param[in] chpid The chpid to reset
|
||||
+ * If NULL all chpids will be reset
|
||||
+ *
|
||||
+ * @return 0 on success, otherwise one of the following error codes:
|
||||
+ * - EINVAL No valid chpid specified.
|
||||
+ * - ENODEV Could not open device.
|
||||
+ * - ENOENT Specified chpid not found.
|
||||
+ * - EIO Other I/O error
|
||||
+ *
|
||||
+ */
|
||||
+int dasd_reset_chpid(char *devnode, char *chpid_char)
|
||||
+{
|
||||
+ unsigned int chpid;
|
||||
+ char path[41];
|
||||
+ char busid[9];
|
||||
+ int mask, rc;
|
||||
+ char *endptr;
|
||||
+ FILE *fp;
|
||||
+
|
||||
+ if (u2s_getbusid(devnode, busid))
|
||||
+ return ENODEV;
|
||||
+
|
||||
+ if (!chpid_char) {
|
||||
+ sprintf(path, "/sys/bus/ccw/devices/%s/path_reset", busid);
|
||||
+ fp = fopen(path, "w");
|
||||
+ if (!fp)
|
||||
+ return ENODEV;
|
||||
+ fprintf(fp, "%s", "all\n");
|
||||
+ fclose(fp);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ errno = 0;
|
||||
+ chpid = strtoul(chpid_char, &endptr, 16);
|
||||
+ if (errno || (endptr && (*endptr != '\0')))
|
||||
+ return EINVAL;
|
||||
+
|
||||
+ rc = dasd_get_pm_from_chpid(busid, chpid, &mask);
|
||||
+ if (rc)
|
||||
+ return rc;
|
||||
+ if (!mask)
|
||||
+ return ENOENT;
|
||||
+
|
||||
+ sprintf(path, "/sys/bus/ccw/devices/%s/path_reset", busid);
|
||||
+ fp = fopen(path, "w");
|
||||
+ if (!fp)
|
||||
+ return ENODEV;
|
||||
+ fprintf(fp, "%02x", mask);
|
||||
+ fclose(fp);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
--- a/tunedasd/include/disk.h
|
||||
+++ b/tunedasd/include/disk.h
|
||||
@@ -27,7 +27,8 @@ int disk_release (char* device);
|
||||
int disk_slock (char* device);
|
||||
int disk_query_reserve_status(char* device);
|
||||
int disk_profile (char* device, char* prof_item);
|
||||
-int disk_reset_prof (char* device);
|
||||
+int disk_reset_prof(char *device);
|
||||
+int disk_reset_chpid(char *device, char *chpid);
|
||||
|
||||
#endif /* not DISK_H */
|
||||
|
||||
--- a/tunedasd/man/tunedasd.8
|
||||
+++ b/tunedasd/man/tunedasd.8
|
||||
@@ -149,6 +149,18 @@ Following rows are supported:
|
||||
.TP
|
||||
.BR "\-R" " or " "\-\-reset_prof"
|
||||
Reset profile info of device.
|
||||
+.TP
|
||||
+.BR "\-p" " or " "\-\-path_reset <chpid>"
|
||||
+Reset a channel path <chpid> of a selected device. A channel path
|
||||
+might be suspended due to high IFCC error rates or a High Performance
|
||||
+FICON failure. Use this option to resume considering the channel path
|
||||
+for I/O.
|
||||
+.TP
|
||||
+.BR "\-\-path_reset_all"
|
||||
+Reset all channel paths of the selected device. The channel paths
|
||||
+might be suspended due to high IFCC error rates or a High Performance
|
||||
+FICON failure. Use this option to resume considering all defined
|
||||
+channel paths for I/O.
|
||||
.\"
|
||||
.\".TP
|
||||
.\".BR "\-o" " or " "\-\-online"
|
||||
@@ -166,8 +178,13 @@ Reset profile info of device.
|
||||
.br
|
||||
|
||||
tunedasd -c prestage -n 1 /dev/dasdc
|
||||
+
|
||||
+.br
|
||||
+3. Scenario: Reset failed channel path with CHPID 45
|
||||
.br
|
||||
|
||||
+ tunedasd -p 45 /dev/dasdc
|
||||
+.br
|
||||
.SH "SEE ALSO"
|
||||
.BR dasdview (8),
|
||||
.BR dasdfmt (8),
|
||||
--- a/tunedasd/src/Makefile
|
||||
+++ b/tunedasd/src/Makefile
|
||||
@@ -5,7 +5,7 @@ includes = $(wildcard ../include/*.h)
|
||||
|
||||
all: tunedasd
|
||||
|
||||
-objects = tunedasd.o disk.o
|
||||
+objects = tunedasd.o disk.o ../../libdasd/dasd_sys.o ../../libu2s/u2s.o
|
||||
$(objects): $(includes)
|
||||
|
||||
tunedasd: $(objects)
|
||||
--- a/tunedasd/src/disk.c
|
||||
+++ b/tunedasd/src/disk.c
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "disk.h"
|
||||
#include "tunedasd.h"
|
||||
+#include "dasd_sys.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
@@ -682,3 +683,37 @@ disk_reset_prof (char* device)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+int disk_reset_chpid(char *device, char *chpid)
|
||||
+{
|
||||
+ int rc;
|
||||
+
|
||||
+ if (chpid)
|
||||
+ printf("Resetting chpid %s for device <%s>...\n", chpid,
|
||||
+ device);
|
||||
+ else
|
||||
+ printf("Resetting all chpids for device <%s>...\n", device);
|
||||
+
|
||||
+ rc = dasd_reset_chpid(device, chpid);
|
||||
+ switch (rc) {
|
||||
+ case 0:
|
||||
+ printf("Done.\n");
|
||||
+ return 0;
|
||||
+ case ENODEV:
|
||||
+ error_print("%s: %s", device, strerror(errno));
|
||||
+ break;
|
||||
+ case EINVAL:
|
||||
+ error_print("%s: Could not reset chpid %s: Invalid CHPID",
|
||||
+ device, chpid);
|
||||
+ break;
|
||||
+ case ENOENT:
|
||||
+ error_print("%s: Could not reset chpid %s: CHPID not defined for device",
|
||||
+ device, chpid);
|
||||
+ break;
|
||||
+ default:
|
||||
+ error_print("%s: Could not reset chpid %s",
|
||||
+ device, chpid);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return -1;
|
||||
+}
|
||||
--- a/tunedasd/src/tunedasd.c
|
||||
+++ b/tunedasd/src/tunedasd.c
|
||||
@@ -34,28 +34,30 @@ static const char* usage_text[] = {
|
||||
"(e.g. '/dev/dasda') or a list of devices separated by a space "
|
||||
"character.",
|
||||
"",
|
||||
- "-h, --help Print this help, then exit",
|
||||
- "-v, --version Print version information, then exit",
|
||||
- "-g, --get_cache Get current storage server caching behaviour",
|
||||
- "-c, --cache <behavior> Define caching behavior on storage server",
|
||||
- " (normal/bypass/inhibit/sequential/prestage/"
|
||||
- "record)",
|
||||
- "-n, --no_cyl <n> Number of cylinders to be cached ",
|
||||
- " (only valid together with --cache)",
|
||||
- "-S, --reserve Reserve device",
|
||||
- "-L, --release Release device",
|
||||
- "-O, --slock Unconditional reserve device",
|
||||
- " Note: Use with care, this breaks an existing "
|
||||
- "lock",
|
||||
- "-Q, --query_reserve Print reserve status of device ",
|
||||
- "-P, --profile Print profile info of device",
|
||||
- "-I, --prof_item Print single profile item",
|
||||
- " (reqs/sects/sizes/total/totsect/start/irq/",
|
||||
- " irqsect/end/queue)",
|
||||
- "-R, --reset_prof Reset profile info of device"
|
||||
+ "-h, --help Print this help, then exit",
|
||||
+ "-v, --version Print version information, then exit",
|
||||
+ "-g, --get_cache Get current storage server caching behaviour",
|
||||
+ "-c, --cache <behavior> Define caching behavior on storage server",
|
||||
+ " (normal/bypass/inhibit/sequential/prestage/"
|
||||
+ "record)",
|
||||
+ "-n, --no_cyl <n> Number of cylinders to be cached ",
|
||||
+ " (only valid together with --cache)",
|
||||
+ "-S, --reserve Reserve device",
|
||||
+ "-L, --release Release device",
|
||||
+ "-O, --slock Unconditional reserve device",
|
||||
+ " Note: Use with care, this breaks an existing "
|
||||
+ "lock",
|
||||
+ "-Q, --query_reserve Print reserve status of device ",
|
||||
+ "-P, --profile Print profile info of device",
|
||||
+ "-I, --prof_item Print single profile item",
|
||||
+ " (reqs/sects/sizes/total/totsect/start/irq/",
|
||||
+ " irqsect/end/queue)",
|
||||
+ "-R, --reset_prof Reset profile info of device",
|
||||
+ "-p, --path_reset <chpid> Reset channel path <chpid> of a device",
|
||||
+ " --path_reset_all Reset all channel paths of a device"
|
||||
};
|
||||
|
||||
-#define CMD_KEYWORD_NUM 12
|
||||
+#define CMD_KEYWORD_NUM 14
|
||||
#define DEVICES_NUM 256
|
||||
|
||||
enum cmd_keyword_id {
|
||||
@@ -71,6 +73,8 @@ enum cmd_keyword_id {
|
||||
cmd_keyword_prof_item = 9,
|
||||
cmd_keyword_reset_prof = 10,
|
||||
cmd_keyword_query_reserve = 11,
|
||||
+ cmd_keyword_path = 12,
|
||||
+ cmd_keyword_path_all = 13,
|
||||
};
|
||||
|
||||
|
||||
@@ -79,18 +83,20 @@ static const struct {
|
||||
char* keyword;
|
||||
enum cmd_keyword_id id;
|
||||
} keyword_list[] = {
|
||||
- { "help", cmd_keyword_help },
|
||||
- { "version", cmd_keyword_version },
|
||||
- { "get_cache", cmd_keyword_get_cache },
|
||||
- { "cache", cmd_keyword_cache },
|
||||
- { "no_cyl", cmd_keyword_no_cyl },
|
||||
- { "reserve", cmd_keyword_reserve },
|
||||
- { "release", cmd_keyword_release },
|
||||
- { "slock", cmd_keyword_slock },
|
||||
- { "profile", cmd_keyword_profile },
|
||||
- { "prof_item", cmd_keyword_prof_item },
|
||||
- { "reset_prof", cmd_keyword_reset_prof },
|
||||
- { "query_reserve", cmd_keyword_query_reserve }
|
||||
+ { "help", cmd_keyword_help },
|
||||
+ { "version", cmd_keyword_version },
|
||||
+ { "get_cache", cmd_keyword_get_cache },
|
||||
+ { "cache", cmd_keyword_cache },
|
||||
+ { "no_cyl", cmd_keyword_no_cyl },
|
||||
+ { "reserve", cmd_keyword_reserve },
|
||||
+ { "release", cmd_keyword_release },
|
||||
+ { "slock", cmd_keyword_slock },
|
||||
+ { "profile", cmd_keyword_profile },
|
||||
+ { "prof_item", cmd_keyword_prof_item },
|
||||
+ { "reset_prof", cmd_keyword_reset_prof },
|
||||
+ { "query_reserve", cmd_keyword_query_reserve },
|
||||
+ { "path_reset", cmd_keyword_path },
|
||||
+ { "path_reset_all", cmd_keyword_path_all }
|
||||
};
|
||||
|
||||
|
||||
@@ -103,22 +109,24 @@ enum cmd_key_state {
|
||||
|
||||
/* Determines which combination of keywords are valid */
|
||||
enum cmd_key_state cmd_key_table[CMD_KEYWORD_NUM][CMD_KEYWORD_NUM] = {
|
||||
- /* help vers get_ cach no_c rese rele sloc prof prof rese quer
|
||||
- * ion cach e yl rve ase k ile _ite t_pr y_re
|
||||
+ /* help vers get_ cach no_c rese rele sloc prof prof rese quer path path
|
||||
+ * ion cach e yl rve ase k ile _ite t_pr y_re _all
|
||||
* e m of serv
|
||||
*/
|
||||
- /* help */ { req, opt, opt, opt, opt, opt, opt, opt, opt, opt, opt, inv },
|
||||
- /* version */ { inv, req, inv, inv, inv, inv, inv, inv, inv, inv, inv, inv },
|
||||
- /* get_cache */ { opt, opt, req, inv, inv, inv, inv, inv, inv, inv, inv, inv },
|
||||
- /* cache */ { opt, opt, inv, req, opt, inv, inv, inv, inv, inv, inv, inv },
|
||||
- /* no_cyl */ { opt, opt, inv, req, req, inv, inv, inv, inv, inv, inv, inv },
|
||||
- /* reserve */ { opt, opt, inv, inv, inv, req, inv, inv, inv, inv, inv, inv },
|
||||
- /* release */ { opt, opt, inv, inv, inv, inv, req, inv, inv, inv, inv, inv },
|
||||
- /* slock */ { opt, opt, inv, inv, inv, inv, inv, req, inv, inv, inv, inv },
|
||||
- /* profile */ { opt, opt, inv, inv, inv, inv, inv, inv, req, opt, inv, inv },
|
||||
- /* prof_item */ { opt, opt, inv, inv, inv, inv, inv, inv, req, req, inv, inv },
|
||||
- /* reset_prof */ { opt, opt, inv, inv, inv, inv, inv, inv, inv, inv, req, inv },
|
||||
- /* query_reserve */ { inv, inv, inv, inv, inv, inv, inv, inv, inv, inv, inv, req },
|
||||
+ /* help */ { req, opt, opt, opt, opt, opt, opt, opt, opt, opt, opt, inv, inv, inv },
|
||||
+ /* version */ { inv, req, inv, inv, inv, inv, inv, inv, inv, inv, inv, inv, inv, inv },
|
||||
+ /* get_cache */ { opt, opt, req, inv, inv, inv, inv, inv, inv, inv, inv, inv, inv, inv },
|
||||
+ /* cache */ { opt, opt, inv, req, opt, inv, inv, inv, inv, inv, inv, inv, inv, inv },
|
||||
+ /* no_cyl */ { opt, opt, inv, req, req, inv, inv, inv, inv, inv, inv, inv, inv, inv },
|
||||
+ /* reserve */ { opt, opt, inv, inv, inv, req, inv, inv, inv, inv, inv, inv, inv, inv },
|
||||
+ /* release */ { opt, opt, inv, inv, inv, inv, req, inv, inv, inv, inv, inv, inv, inv },
|
||||
+ /* slock */ { opt, opt, inv, inv, inv, inv, inv, req, inv, inv, inv, inv, inv, inv },
|
||||
+ /* profile */ { opt, opt, inv, inv, inv, inv, inv, inv, req, opt, inv, inv, inv, inv },
|
||||
+ /* prof_item */ { opt, opt, inv, inv, inv, inv, inv, inv, req, req, inv, inv, inv, inv },
|
||||
+ /* reset_prof */ { opt, opt, inv, inv, inv, inv, inv, inv, inv, inv, req, inv, inv, inv },
|
||||
+ /* query_reserve */ { inv, inv, inv, inv, inv, inv, inv, inv, inv, inv, inv, req, inv, inv },
|
||||
+ /* path */ { inv, inv, inv, inv, inv, inv, inv, inv, inv, inv, inv, inv, req, inv },
|
||||
+ /* path_all */ { inv, inv, inv, inv, inv, inv, inv, inv, inv, inv, inv, inv, inv, req },
|
||||
};
|
||||
|
||||
struct parameter {
|
||||
@@ -146,11 +154,13 @@ static struct option options[] = {
|
||||
{ "prof_item", required_argument, NULL, 'I'},
|
||||
{ "reset_prof", no_argument, NULL, 'R'},
|
||||
{ "query_reserve", no_argument, NULL, 'Q'},
|
||||
+ { "path_reset", required_argument, NULL, 'p'},
|
||||
+ { "path_reset_all", no_argument, NULL, 'A'},
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
/* Command line option abbreviations */
|
||||
-static const char option_string[] = "hvgc:n:SLOPI:RQ";
|
||||
+static const char option_string[] = "hvgc:n:SLOPI:RQp:";
|
||||
|
||||
|
||||
/* Error message string */
|
||||
@@ -348,6 +358,14 @@ get_command_line (int argc, char* argv[]
|
||||
optarg);
|
||||
}
|
||||
break;
|
||||
+ case 'p':
|
||||
+ rc = store_option(&cmdline, cmd_keyword_path,
|
||||
+ optarg);
|
||||
+ break;
|
||||
+ case 'A':
|
||||
+ rc = store_option(&cmdline, cmd_keyword_path_all,
|
||||
+ optarg);
|
||||
+ break;
|
||||
case 'S':
|
||||
rc = store_option (&cmdline, cmd_keyword_reserve,
|
||||
optarg);
|
||||
@@ -400,7 +418,6 @@ get_command_line (int argc, char* argv[]
|
||||
return 0;
|
||||
}
|
||||
|
||||
-
|
||||
/*
|
||||
* Execute the command.
|
||||
*/
|
||||
@@ -444,6 +461,13 @@ do_command (char* device, struct command
|
||||
case cmd_keyword_query_reserve:
|
||||
rc = disk_query_reserve_status(device);
|
||||
break;
|
||||
+ case cmd_keyword_path:
|
||||
+ rc = disk_reset_chpid(device,
|
||||
+ cmdline.parm[cmd_keyword_path].data);
|
||||
+ break;
|
||||
+ case cmd_keyword_path_all:
|
||||
+ rc = disk_reset_chpid(device, NULL);
|
||||
+ break;
|
||||
default:
|
||||
error_print ("Unknown command '%s' specified",
|
||||
get_keyword_name (i));
|
||||
--- a/zconf/lsdasd
|
||||
+++ b/zconf/lsdasd
|
||||
@@ -368,13 +368,15 @@ function extended()
|
||||
CABLEPM=0
|
||||
CUIRPM=0
|
||||
HPFPM=0
|
||||
+ IFCCPM=0
|
||||
|
||||
# additional information
|
||||
read DIAG 2> /dev/null < $DEVPATH/use_diag || continue
|
||||
read EER 2> /dev/null < $DEVPATH/eer_enabled || continue
|
||||
read ERP 2> /dev/null < $DEVPATH/erplog || continue
|
||||
+ read HPF 2> /dev/null < $DEVPATH/hpf
|
||||
# in case the path_masks do not exist simply ignore it
|
||||
- read OPM NPPM CABLEPM CUIRPM HPFPM 2> /dev/null < $DEVPATH/path_masks
|
||||
+ read OPM NPPM CABLEPM CUIRPM HPFPM IFCCPM 2> /dev/null < $DEVPATH/path_masks
|
||||
read -a C 2> /dev/null < $DEVPATH/../chpids || continue
|
||||
read PIM PAM POM 2> /dev/null < $DEVPATH/../pimpampom || continue
|
||||
|
||||
@@ -385,6 +387,7 @@ function extended()
|
||||
CABLEPM=0x$CABLEPM
|
||||
CUIRPM=0x$CUIRPM
|
||||
HPFPM=0x$HPFPM
|
||||
+ IFCCPM=0x$IFCCPM
|
||||
|
||||
#-----------------------------------------------------------#
|
||||
# aggregate chpids and path mask to useful information #
|
||||
@@ -397,6 +400,7 @@ function extended()
|
||||
CUIR_PATHS=(" " " " " " " " " " " " " " " ")
|
||||
CABLE_PATHS=(" " " " " " " " " " " " " " " ")
|
||||
HPF_PATHS=(" " " " " " " " " " " " " " " ")
|
||||
+ IFCC_PATHS=(" " " " " " " " " " " " " " " ")
|
||||
|
||||
# installed paths
|
||||
j=0
|
||||
@@ -470,13 +474,25 @@ function extended()
|
||||
(( mask>>=1 ))
|
||||
done
|
||||
|
||||
+ # IFCC unusable paths
|
||||
+ j=0
|
||||
+ mask=0x80
|
||||
+ for (( i=0; i<8; i++ )) ;do
|
||||
+ PM=$(($IFCCPM&$mask))
|
||||
+ if [ $PM -gt 0 ] ;then
|
||||
+ IFCC_PATHS[j]=${C[$i]} ;
|
||||
+ ((j++)) ;
|
||||
+ fi
|
||||
+ (( mask>>=1 ))
|
||||
+ done
|
||||
+
|
||||
#-------------------------------------------#
|
||||
# format data for output #
|
||||
#-------------------------------------------#
|
||||
|
||||
if [[ "$ONLINE" == 0 ]]; then
|
||||
ACTIVE="offline"
|
||||
- printf "%s:%s:%s# status:\t\t\t\t%s# use_diag:\t\t\t\t%s# readonly:\t\t\t\t%s# eer_enabled:\t\t\t\t%s# erplog:\t\t\t\t%s# uid: \t\t\t\t%s# paths_installed: \t\t\t%s %s %s %s %s %s %s %s# paths_in_use: \t\t\t%s %s %s %s %s %s %s %s# paths_non_preferred: \t\t\t%s %s %s %s %s %s %s %s# paths_invalid_cabling: \t\t%s %s %s %s %s %s %s %s# paths_cuir_quiesced: \t\t\t%s %s %s %s %s %s %s %s# paths_invalid_hpf_characteristics: \t%s %s %s %s %s %s %s %s#\n" \
|
||||
+ printf "%s:%s:%s# status:\t\t\t\t%s# use_diag:\t\t\t\t%s# readonly:\t\t\t\t%s# eer_enabled:\t\t\t\t%s# erplog:\t\t\t\t%s# hpf:\t\t\t\t\t%s# uid: \t\t\t\t%s# paths_installed: \t\t\t%s %s %s %s %s %s %s %s# paths_in_use: \t\t\t%s %s %s %s %s %s %s %s# paths_non_preferred: \t\t\t%s %s %s %s %s %s %s %s# paths_invalid_cabling: \t\t%s %s %s %s %s %s %s %s# paths_cuir_quiesced: \t\t\t%s %s %s %s %s %s %s %s# paths_invalid_hpf_characteristics: \t%s %s %s %s %s %s %s %s# paths_error_threshold_exceeded: \t%s %s %s %s %s %s %s %s#\n" \
|
||||
"$SORTKEYLEN" "$SORTKEY" \
|
||||
"$BUSID" \
|
||||
"$ACTIVE" \
|
||||
@@ -484,18 +500,20 @@ function extended()
|
||||
"$READONLY" \
|
||||
"$EER" \
|
||||
"$ERP" \
|
||||
+ "$HPF" \
|
||||
"$DEV_UID" \
|
||||
"${INSTALLED_PATHS[@]}" \
|
||||
"${USED_PATHS[@]}" \
|
||||
"${NP_PATHS[@]}" \
|
||||
"${CABLE_PATHS[@]}" \
|
||||
"${CUIR_PATHS[@]}" \
|
||||
- "${HPF_PATHS[@]}" ;
|
||||
+ "${HPF_PATHS[@]}" \
|
||||
+ "${IFCC_PATHS[@]}" ;
|
||||
continue
|
||||
elif [[ "$ALIAS" == 1 ]]; then
|
||||
if [[ "$BASEONLY" == "false" ]]; then
|
||||
ACTIVE="alias"
|
||||
- printf "%s:%s:%s# status:\t\t\t\t%s# type: \t\t\t\t%s# use_diag:\t\t\t\t%s# readonly:\t\t\t\t%s# eer_enabled:\t\t\t\t%s# erplog:\t\t\t\t%s # uid: \t\t\t\t%s# paths_installed: \t\t\t%s %s %s %s %s %s %s %s# paths_in_use: \t\t\t%s %s %s %s %s %s %s %s# paths_non_preferred: \t\t\t%s %s %s %s %s %s %s %s# paths_invalid_cabling: \t\t%s %s %s %s %s %s %s %s# paths_cuir_quiesced: \t\t\t%s %s %s %s %s %s %s %s# paths_invalid_hpf_characteristics: \t%s %s %s %s %s %s %s %s#\n" \
|
||||
+ printf "%s:%s:%s# status:\t\t\t\t%s# type: \t\t\t\t%s# use_diag:\t\t\t\t%s# readonly:\t\t\t\t%s# eer_enabled:\t\t\t\t%s# erplog:\t\t\t\t%s# hpf:\t\t\t\t\t%s # uid: \t\t\t\t%s# paths_installed: \t\t\t%s %s %s %s %s %s %s %s# paths_in_use: \t\t\t%s %s %s %s %s %s %s %s# paths_non_preferred: \t\t\t%s %s %s %s %s %s %s %s# paths_invalid_cabling: \t\t%s %s %s %s %s %s %s %s# paths_cuir_quiesced: \t\t\t%s %s %s %s %s %s %s %s# paths_invalid_hpf_characteristics: \t%s %s %s %s %s %s %s %s# paths_error_threshold_exceeded: \t%s %s %s %s %s %s %s %s#\n" \
|
||||
"$SORTKEYLEN" "$SORTKEY" \
|
||||
"$BUSID" \
|
||||
"$ACTIVE" \
|
||||
@@ -504,13 +522,15 @@ function extended()
|
||||
"$READONLY" \
|
||||
"$EER" \
|
||||
"$ERP" \
|
||||
+ "$HPF" \
|
||||
"$DEV_UID" \
|
||||
"${INSTALLED_PATHS[@]}" \
|
||||
"${USED_PATHS[@]}" \
|
||||
"${NP_PATHS[@]}" \
|
||||
"${CABLE_PATHS[@]}" \
|
||||
"${CUIR_PATHS[@]}" \
|
||||
- "${HPF_PATHS[@]}" ;
|
||||
+ "${HPF_PATHS[@]}" \
|
||||
+ "${IFCC_PATHS[@]}" ;
|
||||
continue
|
||||
else
|
||||
continue
|
||||
@@ -533,7 +553,7 @@ function extended()
|
||||
COLON=":"
|
||||
fi
|
||||
|
||||
- printf "%s:%s:%s/%s/%s%s%s# status:\t\t\t\t%s# type: \t\t\t\t%s# blksz:\t\t\t\t%s# size: \t\t\t\t%s# blocks:\t\t\t\t%s# use_diag:\t\t\t\t%s# readonly:\t\t\t\t%s# eer_enabled:\t\t\t\t%s# erplog:\t\t\t\t%s# uid: \t\t\t\t%s# paths_installed: \t\t\t%s %s %s %s %s %s %s %s# paths_in_use: \t\t\t%s %s %s %s %s %s %s %s# paths_non_preferred: \t\t\t%s %s %s %s %s %s %s %s# paths_invalid_cabling: \t\t%s %s %s %s %s %s %s %s# paths_cuir_quiesced: \t\t\t%s %s %s %s %s %s %s %s# paths_invalid_hpf_characteristics: \t%s %s %s %s %s %s %s %s#\n" \
|
||||
+ printf "%s:%s:%s/%s/%s%s%s# status:\t\t\t\t%s# type: \t\t\t\t%s# blksz:\t\t\t\t%s# size: \t\t\t\t%s# blocks:\t\t\t\t%s# use_diag:\t\t\t\t%s# readonly:\t\t\t\t%s# eer_enabled:\t\t\t\t%s# erplog:\t\t\t\t%s# hpf:\t\t\t\t\t%s# uid: \t\t\t\t%s# paths_installed: \t\t\t%s %s %s %s %s %s %s %s# paths_in_use: \t\t\t%s %s %s %s %s %s %s %s# paths_non_preferred: \t\t\t%s %s %s %s %s %s %s %s# paths_invalid_cabling: \t\t%s %s %s %s %s %s %s %s# paths_cuir_quiesced: \t\t\t%s %s %s %s %s %s %s %s# paths_invalid_hpf_characteristics: \t%s %s %s %s %s %s %s %s# paths_error_threshold_exceeded: \t%s %s %s %s %s %s %s %s#\n" \
|
||||
"$SORTKEYLEN" "$SORTKEY" \
|
||||
"$BUSID" \
|
||||
"$BLOCKNAME" \
|
||||
@@ -549,13 +569,15 @@ function extended()
|
||||
"$READONLY" \
|
||||
"$EER" \
|
||||
"$ERP" \
|
||||
+ "$HPF" \
|
||||
"$DEV_UID" \
|
||||
"${INSTALLED_PATHS[@]}" \
|
||||
"${USED_PATHS[@]}" \
|
||||
"${NP_PATHS[@]}" \
|
||||
"${CABLE_PATHS[@]}" \
|
||||
"${CUIR_PATHS[@]}" \
|
||||
- "${HPF_PATHS[@]}" ;
|
||||
+ "${HPF_PATHS[@]}" \
|
||||
+ "${IFCC_PATHS[@]}" ;
|
||||
}
|
||||
|
||||
function host()
|
@ -1,65 +0,0 @@
|
||||
Subject: [PATCH] [BZ 151416] mon_fsstatd: fix double free in error path and skip virtual fs
|
||||
From: Gerald Schaefer <gerald.schaefer@de.ibm.com>
|
||||
|
||||
Description: mon_fsstatd: fix double free in error path and skip virtual fs
|
||||
Symptom: The daemon is stopped and the following messages can be found
|
||||
in syslog: "statvfs error on /run/user/0: Permission denied"
|
||||
and "double free or corruption (!prev)".
|
||||
Problem: The error handling code for a failing statvfs() call erroneously
|
||||
does an extra fclose(), conflicting with the later fclose().
|
||||
Also, breaking out of the inner loop at this point doesn't make
|
||||
sense, because there may be other mounted filesystems that would
|
||||
be skipped.
|
||||
The reason for the failing statvfs() (on /run/user/0) is a wrong
|
||||
selinux context (when started via systemctl), and this error will
|
||||
spam the syslog if we only fix the double free. Since /run/user/0
|
||||
is a tmpfs, and mon_fsstatd is supposed to collect only physical
|
||||
filesystem data, it is wrong to even try to access /run/user/0.
|
||||
Solution: Remove the extra fclose(), replace the break with a continue,
|
||||
and add tmpfs (and others) to the list of ignored virtual
|
||||
filesystems.
|
||||
Reproduction: Start mon_fsstatd via service/systemctl.
|
||||
Upstream-ID: -
|
||||
Problem-ID: 151416
|
||||
|
||||
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
|
||||
---
|
||||
mon_tools/mon_fsstatd.c | 19 +++++++++++++++++--
|
||||
1 file changed, 17 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/mon_tools/mon_fsstatd.c
|
||||
+++ b/mon_tools/mon_fsstatd.c
|
||||
@@ -323,16 +323,31 @@ static int fsstatd_do_work(void)
|
||||
strncmp(ent->mnt_type, "none", 4) == 0 ||
|
||||
strncmp(ent->mnt_type, "proc", 4) == 0 ||
|
||||
strncmp(ent->mnt_type, "subfs", 5) == 0 ||
|
||||
+ strncmp(ent->mnt_type, "nfsd", 4) == 0 ||
|
||||
+ strncmp(ent->mnt_type, "tmpfs", 5) == 0 ||
|
||||
+ strncmp(ent->mnt_type, "sysfs", 5) == 0 ||
|
||||
+ strncmp(ent->mnt_type, "pstore", 6) == 0 ||
|
||||
+ strncmp(ent->mnt_type, "cgroup", 6) == 0 ||
|
||||
+ strncmp(ent->mnt_type, "mqueue", 6) == 0 ||
|
||||
+ strncmp(ent->mnt_type, "devpts", 6) == 0 ||
|
||||
+ strncmp(ent->mnt_type, "debugfs", 7) == 0 ||
|
||||
+ strncmp(ent->mnt_type, "devtmpfs", 8) == 0 ||
|
||||
+ strncmp(ent->mnt_type, "configfs", 8) == 0 ||
|
||||
+ strncmp(ent->mnt_type, "selinuxfs", 9) == 0 ||
|
||||
+ strncmp(ent->mnt_type, "hugetlbfs", 9) == 0 ||
|
||||
+ strncmp(ent->mnt_type, "securityfs", 10) == 0 ||
|
||||
+ strncmp(ent->mnt_type, "rpc_pipefs", 10) == 0 ||
|
||||
+ strncmp(ent->mnt_type, "binfmt_misc", 11) == 0 ||
|
||||
strncmp(ent->mnt_type, "ignore", 6) == 0)) {
|
||||
ent = getmntent(mnttab);
|
||||
continue;
|
||||
}
|
||||
result = statvfs(ent->mnt_dir, &buf);
|
||||
if (result != 0) {
|
||||
- fclose(mnttab);
|
||||
syslog(LOG_ERR, "statvfs error on %s: %s\n",
|
||||
ent->mnt_dir, strerror(errno));
|
||||
- break;
|
||||
+ ent = getmntent(mnttab);
|
||||
+ continue;
|
||||
}
|
||||
|
||||
if (buf.f_blocks > 0)
|
@ -1,30 +0,0 @@
|
||||
util_proc: Fix memory allocation error messages
|
||||
|
||||
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
|
||||
---
|
||||
libutil/util_proc.c | 7 +++----
|
||||
1 file changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/libutil/util_proc.c
|
||||
+++ b/libutil/util_proc.c
|
||||
@@ -54,8 +54,7 @@ util_proc_read_special_file(const char *
|
||||
count = 0;
|
||||
data = (char *) malloc(current_size);
|
||||
if (data == NULL) {
|
||||
- printf("Could not allocate %lld bytes of memory",
|
||||
- (unsigned long long) size);
|
||||
+ printf("Could not allocate %zu bytes of memory", current_size);
|
||||
fclose(file);
|
||||
return -1;
|
||||
}
|
||||
@@ -69,8 +68,8 @@ util_proc_read_special_file(const char *
|
||||
if (count >= current_size) {
|
||||
new_data = (char *) malloc(current_size * 2);
|
||||
if (new_data == NULL) {
|
||||
- printf("Could not allocate %lld bytes of memory",
|
||||
- (unsigned long long) size);
|
||||
+ printf("Could not allocate %zu bytes of memory",
|
||||
+ current_size * 2);
|
||||
free(data);
|
||||
fclose(file);
|
||||
return -1;
|
@ -1,144 +0,0 @@
|
||||
Subject: [PATCH] [BZ 149058] ziomon: no blktrace kill which can corrupt kernel blktrace state
|
||||
From: Steffen Maier <maier@linux.vnet.ibm.com>
|
||||
|
||||
Description: ziomon: no blktrace kill which can corrupt kernel blktrace state
|
||||
Symptom: Ziomon terminates with the following error messages:
|
||||
|
||||
$ ziomon -d <duration> -o <logfile> <device>...
|
||||
...
|
||||
ziomon: Failed to stop trace on /dev/sdX
|
||||
...
|
||||
ziomon: Failed to stop trace on /dev/sdY
|
||||
ziomon: blktrace has leftovers, manual cleanup required!
|
||||
|
||||
Subsequent ziomon runs fail likely until the next reboot:
|
||||
|
||||
$ ziomon -d <duration> -o <logfile> <device>...
|
||||
...
|
||||
Collecting data...BLKTRACESETUP(2) /dev/sdX failed: \
|
||||
2/No such file or directory
|
||||
BLKTRACESETUP(2) /dev/sdY failed: 2/No such file or directory
|
||||
...
|
||||
Thread Z failed open /sys/kernel/debug/block/(null)/traceZ: \
|
||||
2/No such file or directory
|
||||
FAILED to start thread on CPU 0: 1/Operation not permitted
|
||||
...
|
||||
Error: blktrace has errors, aborting
|
||||
...
|
||||
ziomon: Failed to stop trace on /dev/sdX
|
||||
...
|
||||
ziomon: Failed to stop trace on /dev/sdY
|
||||
ziomon: blktrace has leftovers, manual cleanup required!
|
||||
Problem: While we call blktrace with stopwatch option '-w $WRP_DURATION'
|
||||
to have itself terminate automatically after the (mandatory)
|
||||
sampling duration, there might be a race
|
||||
with our own timed blktrace checking loop between "Collecting
|
||||
data..." and "done"
|
||||
or any of SIGHUP SIGTERM SIGINT SIGQUIT from the user might
|
||||
prematurely trigger emergency_shutdown(),
|
||||
so blktrace might still be running or not have completed its
|
||||
cleanup when we reach the blktrace leftover checks in shutdown().
|
||||
|
||||
In that case, ziomon uses the meanwhile hidden kill option of
|
||||
blktrace which can corrupt kernel state if blktrace user space
|
||||
has not yet completed its regular cleanup.
|
||||
Solution: The correct way to have the blktrace process terminate and
|
||||
cleanup properly including any dependent kernel state, before
|
||||
blktrace's stopwatch makes it terminate and cleanup
|
||||
automatically, is to only send SIGINT to it.
|
||||
|
||||
http://git.kernel.org/cgit/linux/kernel/git/axboe/blktrace.git
|
||||
86596c7579c6 ("blktrace: remove -k from manpage synopsis")
|
||||
fb7f86674a51 ("blktrace: disable kill option - take 2")
|
||||
Additional explanation for blktrace -k:
|
||||
http://marc.info/?l=linux-btrace&m=131245973528087&w=2i
|
||||
linux-btrace ("Re: Recent changes")
|
||||
The following kernel commits do not change above termination
|
||||
statement:
|
||||
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
|
||||
39cbb602b543 ("Remove double removal of blktrace directory")
|
||||
fd51d251e4cd ("blktrace: remove debugfs entries on bad path")
|
||||
f48fc4d32e24
|
||||
("block: get rid of the manual directory counting in blktrace")
|
||||
|
||||
As of this writing, the (multithreaded) blktrace also wires
|
||||
SIGHUP SIGTERM SIGALRM with the same signal handler
|
||||
handle_sigint(), but to adhere to its documentation move from
|
||||
SIGTERM to SIGINT anyway.
|
||||
|
||||
We must not use the meanwhile hidden kill option of blktrace
|
||||
because this corrupts kernel state if blktrace user space has not
|
||||
yet completed its regular cleanup.
|
||||
|
||||
In order to avoid zombies we wait for all children. After all, we
|
||||
want everything to be completed before ziomon terminates and the
|
||||
user could safely run another instance of ziomon. Also, we get
|
||||
the possibility for users to detect and report issues with
|
||||
children that don't finish timely.
|
||||
|
||||
Since we do not know how to manually cleanup, drop the check for
|
||||
blktrace leftovers in shutdown().
|
||||
Reproduction: Run ziomon with many devices on the command line.
|
||||
Possibly (other) load on the system increases probability.
|
||||
Upstream-ID: -
|
||||
Problem-ID: 149058
|
||||
|
||||
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
|
||||
---
|
||||
ziomon/ziomon | 17 ++++++-----------
|
||||
1 file changed, 6 insertions(+), 11 deletions(-)
|
||||
|
||||
--- a/ziomon/ziomon
|
||||
+++ b/ziomon/ziomon
|
||||
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# Wrapper script to start all processes
|
||||
#
|
||||
-# Copyright IBM Corp. 2008
|
||||
+# Copyright IBM Corp. 2008, 2016
|
||||
#
|
||||
# Author(s): Stefan Raspl <raspl@linux.vnet.ibm.com>
|
||||
#
|
||||
@@ -84,7 +84,7 @@ function check_for_int() {
|
||||
|
||||
function print_version() {
|
||||
echo "$WRP_TOOLNAME: I/O data collection utility, version %S390_TOOLS_VERSION%";
|
||||
- echo "Copyright IBM Corp. 2008";
|
||||
+ echo "Copyright IBM Corp. 2008, 2016";
|
||||
}
|
||||
|
||||
|
||||
@@ -356,8 +356,6 @@ function start_trace() {
|
||||
|
||||
|
||||
function shutdown() {
|
||||
- local failed=0;
|
||||
-
|
||||
echo "Shutting down";
|
||||
# one more second to write final result
|
||||
sleep 2;
|
||||
@@ -365,7 +363,7 @@ function shutdown() {
|
||||
[ -d /proc/$WRP_ZIOMON_UTIL_PID ] && echo "Shutting down utilization process" && kill -s SIGTERM $WRP_ZIOMON_UTIL_PID;
|
||||
fi
|
||||
if [ "$WRP_BLKTRACE_PID" != "" ]; then
|
||||
- [ -d /proc/$WRP_BLKTRACE_PID ] && echo "Shutting down blktrace process" && kill -s SIGTERM $WRP_BLKTRACE_PID;
|
||||
+ [ -d /proc/$WRP_BLKTRACE_PID ] && echo "Shutting down blktrace process" && kill -s SIGINT $WRP_BLKTRACE_PID;
|
||||
fi
|
||||
if [ "$WRP_BLKIOMON_PID" != "" ]; then
|
||||
[ -d /proc/$WRP_BLKIOMON_PID ] && echo "Shutting down blkiomon process" && kill -s SIGTERM $WRP_BLKIOMON_PID;
|
||||
@@ -381,12 +379,9 @@ function shutdown() {
|
||||
kill -s SIGTERM $WRP_ZIOMON_MGR_PID;
|
||||
fi
|
||||
fi
|
||||
- # kill running traces on devices
|
||||
- for dev in ${WRP_DEVICES[@]}; do
|
||||
- [ -d /sys/kernel/debug/block/${dev##*/} ] && debug "Trace on $dev exists, attempt to kill..." && blktrace -k $dev >/dev/null 2>&1;
|
||||
- [ -d /sys/kernel/debug/block/${dev##*/} ] && echo "$WRP_TOOLNAME: Failed to stop trace on $dev" && (( failed++ ));
|
||||
- done
|
||||
- [ $failed -ne 0 ] && echo "$WRP_TOOLNAME: blktrace has leftovers, manual cleanup required!";
|
||||
+ # synchronize with all children to avoid zombies
|
||||
+ # and to prepare for a clean subsequent re-run of ziomon
|
||||
+ wait
|
||||
|
||||
if [ -e $WRP_MSG_Q_PATH ]; then
|
||||
if [ $WRP_DEBUG -gt 1 ]; then
|
@ -1,3 +1,181 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Oct 5 20:47:52 UTC 2017 - mpost@suse.com
|
||||
|
||||
- Modified mkdump perl script to work with the updated version
|
||||
of the IBM tools dasdview, zipl and zgetdump. (bsc#1020336).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 4 19:45:29 UTC 2017 - mpost@suse.com
|
||||
|
||||
- Upgraded to version 2.1.0 (Fate#323291).
|
||||
Changes from 2.0.0 to 2.1.0
|
||||
* Added the following tools:
|
||||
netboot: Scripts for building a PXE-style netboot image for KVM
|
||||
90-cpi.rules/cpictl: New udev rule to update CPI when KVM is used
|
||||
* Modified lsqeth/zdev to add VNIC Characteristics support
|
||||
Bug fixes
|
||||
* chzcrypt: Corrected handling of insufficient permissions
|
||||
* cpacfstats: Add size setting to perf event
|
||||
* fdasd: Skip partition check with the force option
|
||||
* ttyrun: Fix deprecated BindTo usage in ttyrun-getty@.service.in
|
||||
* lszcrypt: Fix core dump caused by stack overwrite
|
||||
* lszcrypt: Fix random domain printout when no config available
|
||||
* zdev: Fix segfault with unknown qeth attribute
|
||||
* zdev: Fix IPv6 NDP proxy description
|
||||
* zdev: Fix zdev dracut module temp file location
|
||||
* zkey: Correctly detect abbreviated commands
|
||||
* zkey: Validate XTS key: ignore domain and card
|
||||
* zkey: Use octal values instead of S_IRWX* constants
|
||||
* zkey: Properly set umask to prohibit permissions to group and others
|
||||
* zkey: Add -ldl to LDLIBS (not LDFLAGS)
|
||||
* znetconf: Re-add missing line in lsznet.raw
|
||||
* Fix several gcc 7 warnings
|
||||
- Modified s390-tools-sles12-fdasd-skip-partition-check-and-BLKRRPART-ioctl.patch
|
||||
to apply cleanly to this version.
|
||||
- Removed the following obsolete patches:
|
||||
* s390-tools-sles15-zgetdump-Fix-gcc-7-warning.patch
|
||||
* s390-tools-sles15-lscss-Get-rid-of-gcc-7-buffer-truncation-warnings.patch
|
||||
* s390-tools-sles15-Get-rid-of-gcc-7-fall-through-warnings.patch
|
||||
* s390-tools-sles15-lszcrypt-Fix-core-dump-caused-by-stack-overwrite.patch
|
||||
* s390-tools-sles15-dasdinfo-Fix-GCC-7-overflow-warning.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 8 21:06:37 UTC 2017 - mpost@suse.com
|
||||
|
||||
- Added the following patches (bsc#1056498)
|
||||
- s390-tools-sles15-zgetdump-Fix-gcc-7-warning.patch
|
||||
- s390-tools-sles15-lscss-Get-rid-of-gcc-7-buffer-truncation-warnings.patch
|
||||
- s390-tools-sles15-Get-rid-of-gcc-7-fall-through-warnings.patch
|
||||
- s390-tools-sles15-lszcrypt-Fix-core-dump-caused-by-stack-overwrite.patch
|
||||
- s390-tools-sles15-dasdinfo-Fix-GCC-7-overflow-warning.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Sep 8 20:01:35 UTC 2017 - mpost@suse.com
|
||||
|
||||
- Upgraded to version 2.0.0 (Fate#323291).
|
||||
- Changes from 1.34.0 to 1.35.0
|
||||
- cpuplugd: Make default config file location more distribution agnostic
|
||||
Add systemd service unit to start/stop the cpuplug daemon
|
||||
Add force-reload action to init script for LSB-compliance
|
||||
- mon_statd: Add force-reload action to init script for LSB-compliance
|
||||
- chiucvallow: corrected verification return code
|
||||
- lczdev/chzdev: Add support for resolving iSCSI block devices
|
||||
Bug fixes
|
||||
- chzdev, lszdev: Fix incorrect zfcp module parameter name
|
||||
- chreipl: Fix chreipl node for virtio devices
|
||||
- libus2s: Fix busid parsing
|
||||
- zipl/boot: Fix failed start subchannel in FBA loader
|
||||
- Changes from 1.35.0 to 1.36.0
|
||||
- chzdev/lszdev: Add device resolution for vlan and bonding devices
|
||||
- dasdfmt: Add quick format support
|
||||
- lsdasd/fdasd/dasdfmt/zdsfs: Add query host access to volume support
|
||||
- zfcpdbf: Make timestamp the first field in record output
|
||||
Exclude Payload hex field from log message record output
|
||||
Add Area field to record output
|
||||
Add missing header fields to area record output
|
||||
Print the Record id field for Area area class records
|
||||
Mark oldest and newest trace area records
|
||||
Mark oldest and newest def_err pseudo area records
|
||||
Mark oldest and newest foreign area records
|
||||
Mark oldest and newest log message records
|
||||
Add a warning about low resolution timestamps
|
||||
Add Trace Area Statistics table to script output
|
||||
Add time zone command line option
|
||||
Add collection of domain xml files
|
||||
Bug fixes
|
||||
- zfcpdbf: Move and fix CPU id field output to print_header function
|
||||
Include microseconds in warning threshold calculation
|
||||
Fix parsing of precise syslog timestamps
|
||||
Fix labels for REC ERP action status and ERP step fields
|
||||
- Changes from 1.36.0 to 1.36.1
|
||||
- zfcpdbf: Support basic HBA record type without warning
|
||||
Restore tracing of handle for port and LUN with HBA records
|
||||
Print full payload for all SAN traces (req, resp, iels)
|
||||
Print payload length everywhere applicable
|
||||
Disambiguate printing of payload record content
|
||||
Bug fixes
|
||||
- fdasd: Prevent buffer overflow
|
||||
- znetconf: Fix detection of chpids as OSX instead of OSM
|
||||
- Changes from 1.36.1 to 1.37.0
|
||||
- Added dump2tar: sysfs collection helper for dbginfo.sh
|
||||
- qethconf: Remove check for OSN-device
|
||||
- znetconf: Remove OSN-support
|
||||
- lsdasd/tunedasd: Add channel path aware erp
|
||||
- zcrypt: Add multi domain support for zcrypt device driver
|
||||
- scm: Reimplement lsscm in C
|
||||
- chp: Reimplement chchp and lschp in C
|
||||
- dbginfo.sh: Make use of sysinfo collection helper
|
||||
Bug fixes
|
||||
- zfcpdbf: Only cap SAN short payload if pl_len exists
|
||||
- chzdev: Fix bug when configuring QETH devices
|
||||
- libu2s: Prevent buffer overflow
|
||||
- ziomon: No blktrace kill which can corrupt kernel blktrace state
|
||||
- Changes from 1.37.0 to 1.37.1
|
||||
- dbginfo.sh: Add Docker debug data
|
||||
Bug fixes
|
||||
- lsdasd: Replace continue with return
|
||||
- lscss: Allow to specify devices from subchannel set 3
|
||||
- mon_fsstatd: Only use physical filesystems
|
||||
Fix double free in error path
|
||||
- mon_procd: Fix segmentation fault
|
||||
- Changes from 1.37.1 to 1.38.0
|
||||
- systemd: Add new units for cpi, dumpconf, mon_fsstatd, and mon_procd
|
||||
- fdasd: Add new command action 'l' to list known partition types
|
||||
- chmem: Try to online memory to zone movable
|
||||
Starting with kernel 4.13 (commit f1dd2cd1), the default zone for
|
||||
hotplug memory is changed from zone movable to zone normal. In order
|
||||
to preserve the previous default behaviour, chmem will now always try
|
||||
to set memory online to the zone movable, before trying to set it
|
||||
online to the default zone.
|
||||
- zfcpdbf: Print high part of "new" 64 bit SCSI LUN
|
||||
Print payload with full FCP_RSP IU in SCSI trace records
|
||||
- util_opt: Add command specific command line parsing
|
||||
- util_rec: Implement util_rec_iterate() function
|
||||
- util_rec: Record field values can be stored and processed in argz format
|
||||
Bug fixes
|
||||
- zipl/zgetdump: Add missing SCSI multipath dump information to man pages
|
||||
- lsqeth: Fix attributes name: ipa -> ipa_takeover and parp -> rxip
|
||||
Fix lsqeth output of ipa/vipa/rxip addresses of interfaces
|
||||
- zfcpdbf: Fix payload length for zfcp_dbf_hba_bit_err
|
||||
- chzdev: Add implicit qeth layer settings handling
|
||||
- qethqoat: Fix OSA 6S detection
|
||||
- Changes from 1.38.0 to 2.0.0 (also known as 1.39.0)
|
||||
- IBM changed the license to MIT.
|
||||
- Added zkey: Generate, re-encipher, and validate secure AES keys
|
||||
- cpumf: Add hardware counters for z13 and z13s
|
||||
- lscss: Reimplement lscss script in C
|
||||
- lsqeth: Reimplement lsqeth script in C
|
||||
Bug fixes
|
||||
- lscpumf: Fix Perl warnings
|
||||
- Removed the following obsolete patches:
|
||||
s390-tools-sles12sp2-chiucvallow-verify.patch
|
||||
s390-tools-sles12sp2-chreipl-virtio.patch
|
||||
s390-tools-sles12sp2-chzdev-disable-root-update.patch
|
||||
s390-tools-sles12sp2-feat-01-dasd-query-host.patch
|
||||
s390-tools-sles12sp2-lscss-allow-to-specify-devices-from-ssid-3.patch
|
||||
s390-tools-sles12sp2-zipl-fix-failed-start-subchannel.patch
|
||||
s390-tools-sles12sp3-chmem-try-to-online-zone-movable.patch
|
||||
s390-tools-sles12sp3-dasdfmt-01-Fix-behaviour-of-t-combined-with-y.patch
|
||||
s390-tools-sles12sp3-dasdfmt-02-Fix-trailing-whitespace.patch
|
||||
s390-tools-sles12sp3-dasdfmt-03-Apply-coding-convention.patch
|
||||
s390-tools-sles12sp3-dasdfmt-04-Use-enhanced-DASD-information.patch
|
||||
s390-tools-sles12sp3-dasdfmt-05-Refactor-do_format_dasd.patch
|
||||
s390-tools-sles12sp3-dasdfmt-06-Make-the-IOCTL-BLKSSZGET-reusable.patch
|
||||
s390-tools-sles12sp3-dasdfmt-07-Add-quick-format-support.patch
|
||||
s390-tools-sles12sp3-dasdfmt-08-Make-progress-output-reusable-and-add-ETR.patch
|
||||
s390-tools-sles12sp3-dasdfmt-09-Add-command-line-argument-check.patch
|
||||
s390-tools-sles12sp3-dasdfmt-10-Add-expand-format-mode.patch
|
||||
s390-tools-sles12sp3-dbginfo-01-libutil-Add-utility-functions.patch
|
||||
s390-tools-sles12sp3-dbginfo-02-dump2tar-Add-sysfs-collection-helper-for-dbginfo.sh-v2.patch
|
||||
s390-tools-sles12sp3-dbginfo-03-dbginfo.sh-Make-use-of-sysinfo-collection-helper.patch
|
||||
s390-tools-sles12sp3-dbginfo-Collect-docker-debug-data.patch
|
||||
s390-tools-sles12sp2-libu2s-Fix-busid-parsing.patch
|
||||
s390-tools-sles12sp3-lsdasd-tunedasd-Add-channel-path-aware-erp.patch
|
||||
s390-tools-sles12sp3-mon_fsstatd-fix-double-free-in-error-path-and-skip-virtual-fs.patch
|
||||
s390-tools-sles12sp3-util_proc-fix-memory-allocation-error-messages.patch
|
||||
s390-tools-sles12sp3-ziomon-no-blktrace-kill-which-can-corrupt-kernel-blk.patch
|
||||
- Added s390-tools-sles15-add--ldl-to-LDLIBS.patch to fix a problem with zkey/Makefile.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 7 19:41:39 UTC 2017 - mpost@suse.com
|
||||
|
||||
|
139
s390-tools.spec
139
s390-tools.spec
@ -17,11 +17,11 @@
|
||||
|
||||
|
||||
Name: s390-tools
|
||||
Version: 1.34.0
|
||||
Version: 2.1.0
|
||||
Release: 0
|
||||
Url: https://www.ibm.com/developerworks/linux/linux390/
|
||||
Url: https://github.com/ibm-s390-tools/s390-tools
|
||||
Summary: S/390 tools like zipl and dasdfmt
|
||||
License: GPL-2.0+ and BSD-2-Clause
|
||||
License: MIT
|
||||
Group: System/Kernel
|
||||
BuildRequires: dracut
|
||||
BuildRequires: fuse-devel
|
||||
@ -46,7 +46,7 @@ Requires: util-linux
|
||||
Provides: s390utils:/sbin/dasdfmt
|
||||
# Don't build with pie to avoid problems with zipl
|
||||
#!BuildIgnore: gcc-PIE
|
||||
Source: s390-tools-%{version}.tar.bz2
|
||||
Source: s390-tools-%{version}.tar.gz
|
||||
Source1: s390-tools-rpmlintrc
|
||||
Source2: zipl.conf
|
||||
Source3: hsnc
|
||||
@ -62,8 +62,6 @@ Source12: mkdump.pl
|
||||
Source13: sysconfig.osasnmpd
|
||||
Source14: zfcp_san_disc
|
||||
Source15: mkdump.8
|
||||
Source16: boot.cpi
|
||||
Source17: sysconfig.cpi
|
||||
Source18: zpxe.rexx
|
||||
Source19: rules.xpram
|
||||
Source20: rules.hw_random
|
||||
@ -106,36 +104,10 @@ Patch1: s390-tools-sles12-zipl_boot_msg.patch
|
||||
Patch2: s390-tools-sles12-sysconfig-compatible-dumpconf.patch
|
||||
Patch3: s390-tools-sles12-create-filesystem-links.patch
|
||||
Patch4: s390-tools-sles12-update-by_id-links-on-change-and-add-action.patch
|
||||
Patch5: s390-tools-sles12sp2-feat-01-dasd-query-host.patch
|
||||
Patch6: s390-tools-sles12-pardasdfmt.patch
|
||||
Patch7: dasdfmt-retry-BIODASDINFO-if-device-is-busy.patch
|
||||
Patch8: 59-dasd.rules-wait_for.patch
|
||||
Patch9: s390-tools-sles12-fdasd-skip-partition-check-and-BLKRRPART-ioctl.patch
|
||||
Patch10: s390-tools-sles12sp2-libu2s-Fix-busid-parsing.patch
|
||||
Patch11: s390-tools-sles12sp2-chiucvallow-verify.patch
|
||||
Patch12: s390-tools-sles12sp2-zipl-fix-failed-start-subchannel.patch
|
||||
Patch13: s390-tools-sles12sp2-chreipl-virtio.patch
|
||||
Patch14: s390-tools-sles12sp2-chzdev-disable-root-update.patch
|
||||
Patch15: s390-tools-sles12sp2-lscss-allow-to-specify-devices-from-ssid-3.patch
|
||||
Patch16: s390-tools-sles12sp3-dbginfo-01-libutil-Add-utility-functions.patch
|
||||
Patch17: s390-tools-sles12sp3-dbginfo-02-dump2tar-Add-sysfs-collection-helper-for-dbginfo.sh-v2.patch
|
||||
Patch18: s390-tools-sles12sp3-dbginfo-03-dbginfo.sh-Make-use-of-sysinfo-collection-helper.patch
|
||||
Patch19: s390-tools-sles12sp3-lsdasd-tunedasd-Add-channel-path-aware-erp.patch
|
||||
Patch20: s390-tools-sles12sp3-dasdfmt-01-Fix-behaviour-of-t-combined-with-y.patch
|
||||
Patch21: s390-tools-sles12sp3-dasdfmt-02-Fix-trailing-whitespace.patch
|
||||
Patch22: s390-tools-sles12sp3-dasdfmt-03-Apply-coding-convention.patch
|
||||
Patch23: s390-tools-sles12sp3-dasdfmt-04-Use-enhanced-DASD-information.patch
|
||||
Patch24: s390-tools-sles12sp3-dasdfmt-05-Refactor-do_format_dasd.patch
|
||||
Patch25: s390-tools-sles12sp3-dasdfmt-06-Make-the-IOCTL-BLKSSZGET-reusable.patch
|
||||
Patch26: s390-tools-sles12sp3-dasdfmt-07-Add-quick-format-support.patch
|
||||
Patch27: s390-tools-sles12sp3-dasdfmt-08-Make-progress-output-reusable-and-add-ETR.patch
|
||||
Patch28: s390-tools-sles12sp3-dasdfmt-09-Add-command-line-argument-check.patch
|
||||
Patch29: s390-tools-sles12sp3-dasdfmt-10-Add-expand-format-mode.patch
|
||||
Patch30: s390-tools-sles12sp3-util_proc-fix-memory-allocation-error-messages.patch
|
||||
Patch31: s390-tools-sles12sp3-mon_fsstatd-fix-double-free-in-error-path-and-skip-virtual-fs.patch
|
||||
Patch32: s390-tools-sles12sp3-dbginfo-Collect-docker-debug-data.patch
|
||||
Patch33: s390-tools-sles12sp3-ziomon-no-blktrace-kill-which-can-corrupt-kernel-blk.patch
|
||||
Patch34: s390-tools-sles12sp3-chmem-try-to-online-zone-movable.patch
|
||||
Patch5: s390-tools-sles12-pardasdfmt.patch
|
||||
Patch6: dasdfmt-retry-BIODASDINFO-if-device-is-busy.patch
|
||||
Patch7: 59-dasd.rules-wait_for.patch
|
||||
Patch8: s390-tools-sles12-fdasd-skip-partition-check-and-BLKRRPART-ioctl.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
ExclusiveArch: s390 s390x
|
||||
@ -196,36 +168,10 @@ to list files and directories.
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
#patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
%patch15 -p1
|
||||
%patch16 -p1
|
||||
%patch17 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
%patch20 -p1
|
||||
%patch21 -p1
|
||||
%patch22 -p1
|
||||
%patch23 -p1
|
||||
%patch24 -p1
|
||||
%patch25 -p1
|
||||
%patch26 -p1
|
||||
%patch27 -p1
|
||||
%patch28 -p1
|
||||
%patch29 -p1
|
||||
%patch30 -p1
|
||||
%patch31 -p1
|
||||
%patch32 -p1
|
||||
%patch33 -p1
|
||||
%patch34 -p1
|
||||
|
||||
cp -vi %{S:22} CAUTION
|
||||
|
||||
@ -253,15 +199,15 @@ install -m644 -t $RPM_BUILD_ROOT/%{_mandir}/man8 %{S:87}
|
||||
export ROOT_BUILD_DIR="$RPM_BUILD_DIR/%{name}-%{version}/zfcpdump/kernel"
|
||||
install -D -m600 /boot/image-*-zfcpdump $RPM_BUILD_ROOT/usr/lib/s390-tools/zfcpdump/zfcpdump_part.image
|
||||
|
||||
install -D -m644 etc/sysconfig/dumpconf $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.dumpconf
|
||||
install -D -m755 etc/init.d/dumpconf $RPM_BUILD_ROOT/etc/init.d/dumpconf
|
||||
install -D -m644 etc/udev/rules.d/40-z90crypt.rules $RPM_BUILD_ROOT/usr/lib/udev/rules.d/40-z90crypt.rules
|
||||
install -D -m644 etc/udev/rules.d/59-dasd.rules $RPM_BUILD_ROOT/usr/lib/udev/rules.d/59-dasd.rules
|
||||
install -D -m644 etc/udev/rules.d/57-osasnmpd.rules $RPM_BUILD_ROOT/usr/lib/udev/rules.d/57-osasnmpd.rules
|
||||
install -D -m644 etc/udev/rules.d/59-dasd.rules $RPM_BUILD_ROOT/usr/lib/udev/rules.d/59-dasd.rules
|
||||
install -D -m644 etc/udev/rules.d/90-cpi.rules $RPM_BUILD_ROOT/usr/lib/udev/rules.d/90-cpi.rules
|
||||
install -D -m644 etc/sysconfig/cpi $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.cpi
|
||||
install -D -m644 etc/sysconfig/dumpconf $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.dumpconf
|
||||
install -D -m644 etc/sysconfig/mon_fsstatd $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.mon_fsstatd
|
||||
install -D -m644 etc/sysconfig/mon_procd $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.mon_procd
|
||||
install -D -m644 etc/sysconfig/mon_statd $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.mon_statd
|
||||
install -D -m755 etc/init.d/mon_statd $RPM_BUILD_ROOT/etc/init.d/mon_statd
|
||||
install -D -m644 etc/sysconfig/cpuplugd $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.cpuplugd
|
||||
install -D -m755 etc/init.d/cpuplugd $RPM_BUILD_ROOT/etc/init.d/cpuplugd
|
||||
mv iucvterm/doc/ts-shell/iucvconn_on_login $RPM_BUILD_ROOT/usr/bin/iucvconn_on_login
|
||||
install -D -m644 %{S:26} $RPM_BUILD_ROOT/%{_unitdir}/cio_ignore.service
|
||||
install -D -m755 %{S:27} $RPM_BUILD_ROOT/usr/lib/systemd/scripts/setup_cio_ignore.sh
|
||||
@ -287,8 +233,6 @@ install -D -m755 %{S:12} sbin/mkdump
|
||||
install -D -m644 %{S:13} var/adm/fillup-templates/sysconfig.osasnmpd
|
||||
install -D -m755 %{S:14} sbin/zfcp_san_disc
|
||||
install -D -m644 %{S:15} $RPM_BUILD_ROOT/%{_mandir}/man8
|
||||
install -D -m755 %{S:16} etc/init.d/boot.cpi
|
||||
install -D -m644 %{S:17} var/adm/fillup-templates/sysconfig.cpi
|
||||
install -D -m644 %{S:19} $RPM_BUILD_ROOT/usr/lib/udev/rules.d/52-xpram.rules
|
||||
install -D -m644 %{S:20} $RPM_BUILD_ROOT/usr/lib/udev/rules.d/52-hw_random.rules
|
||||
install -D -m644 %{S:21} $RPM_BUILD_ROOT/usr/lib/udev/rules.d/59-graf.rules
|
||||
@ -304,14 +248,16 @@ if [ ! -d %{_sbindir} ]; then
|
||||
mkdir -p %{_sbindir}
|
||||
fi
|
||||
(cd usr/sbin; ln -s ../../etc/init.d/appldata rcappldata)
|
||||
(cd usr/sbin; ln -s ../../etc/init.d/cpuplugd rccpuplugd)
|
||||
(cd usr/sbin; ln -s ../../etc/init.d/dumpconf rcdumpconf)
|
||||
(cd usr/sbin; ln -s ../../etc/init.d/hsnc rchsnc)
|
||||
(cd usr/sbin; ln -s ../../etc/init.d/mon_statd rcmon_statd)
|
||||
(cd usr/sbin; ln -s ../../etc/init.d/vmlogrdr rcvmlogrdr)
|
||||
(cd usr/sbin; ln -s ../../etc/init.d/xpram rcxpram)
|
||||
(cd usr/sbin; ln -s service rccio_ignore)
|
||||
(cd usr/sbin; ln -s service rccpacfstatsd)
|
||||
(cd usr/sbin; ln -s service rccpi)
|
||||
(cd usr/sbin; ln -s service rccpuplugd)
|
||||
(cd usr/sbin; ln -s service rcdumpconf)
|
||||
(cd usr/sbin; ln -s service rcmon_fsstatd)
|
||||
(cd usr/sbin; ln -s service rcmon_procd)
|
||||
(cd usr/sbin; ln -s service rcvirtsetup)
|
||||
|
||||
if [ ! -d %{_bindir} ]; then
|
||||
@ -364,6 +310,13 @@ chmod 755 osasnmpd
|
||||
getent group ts-shell >/dev/null 2>&1 || groupadd -r ts-shell
|
||||
%service_add_pre cio_ignore.service
|
||||
%service_add_pre cpacfstatsd.service
|
||||
%service_add_pre cpi.service
|
||||
%service_add_pre cpuplugd.service
|
||||
%service_add_pre dumpconf.service
|
||||
%service_add_pre iucvtty-login@.service
|
||||
%service_add_pre mon_fsstatd.service
|
||||
%service_add_pre mon_procd.service
|
||||
%service_add_pre ttyrun-getty@.service
|
||||
%service_add_pre virtsetup.service
|
||||
|
||||
%post
|
||||
@ -378,17 +331,25 @@ fi
|
||||
# Create symbolic links to the scripts from setup and boot directories
|
||||
%service_add_post cio_ignore.service
|
||||
%service_add_post cpacfstatsd.service
|
||||
%service_add_post cpi.service
|
||||
%service_add_post cpuplugd.service
|
||||
%service_add_post dumpconf.service
|
||||
%service_add_post iucvtty-login@.service
|
||||
%service_add_post mon_fsstatd.service
|
||||
%service_add_post mon_procd.service
|
||||
%service_add_post ttyrun-getty@.service
|
||||
%service_add_post virtsetup.service
|
||||
|
||||
# -i: skip insserv parts - has to be configured before use:
|
||||
%{fillup_and_insserv -i -n appldata}
|
||||
%{fillup_and_insserv -i -n cpuplugd}
|
||||
%{fillup_and_insserv -i -n cpi}
|
||||
%{fillup_and_insserv -i -n dumpconf}
|
||||
%{fillup_and_insserv -i -n hsnc}
|
||||
%{fillup_and_insserv -i -n mon_fsstatd}
|
||||
%{fillup_and_insserv -i -n mon_procd}
|
||||
%{fillup_and_insserv -i -n mon_statd}
|
||||
%{fillup_and_insserv -i -n vmlogrdr}
|
||||
%{fillup_and_insserv -i -n virtsetup}
|
||||
%{fillup_and_insserv -i -n xpram}
|
||||
%{fillup_and_insserv -y -n cpi boot.cpi}
|
||||
|
||||
%triggerin -- kernel-default
|
||||
grep -q '^/usr/bin/ts-shell$' /etc/shells \
|
||||
@ -399,28 +360,35 @@ grep -q '^/usr/bin/ts-shell$' /etc/shells \
|
||||
|
||||
%preun
|
||||
%{stop_on_removal appldata}
|
||||
%{stop_on_removal cpuplugd}
|
||||
%{stop_on_removal dumpconf}
|
||||
%{stop_on_removal hsnc}
|
||||
%{stop_on_removal mon_statd}
|
||||
%{stop_on_removal vmlogrdr}
|
||||
%{stop_on_removal xpram}
|
||||
%service_del_preun cio_ignore.service
|
||||
%service_del_preun cpacfstatsd.service
|
||||
%service_del_preun cpi.service
|
||||
%service_del_preun cpuplugd.service
|
||||
%service_del_preun dumpconf.service
|
||||
%service_del_preun iucvtty-login@.service
|
||||
%service_del_preun mon_fsstatd.service
|
||||
%service_del_preun mon_procd.service
|
||||
%service_del_preun virtsetup.service
|
||||
|
||||
%postun
|
||||
%{restart_on_update boot.cpi}
|
||||
%{restart_on_update appldata}
|
||||
%{restart_on_update cpuplugd}
|
||||
%{restart_on_update dumpconf}
|
||||
%{restart_on_update hsnc}
|
||||
%{restart_on_update mon_statd}
|
||||
%{restart_on_update vmlogrdr}
|
||||
%{restart_on_update xpram}
|
||||
%service_del_postun cio_ignore.service
|
||||
%service_del_postun cpacfstatsd.service
|
||||
%service_del_postun cpi.service
|
||||
%service_del_postun cpuplugd.service
|
||||
%service_del_postun dumpconf.service
|
||||
%service_del_postun iucvtty-login@.service
|
||||
%service_del_postun mon_fsstatd.service
|
||||
%service_del_postun mon_procd.service
|
||||
%service_del_postun ttyrun-getty@.service
|
||||
%service_del_postun virtsetup.service
|
||||
|
||||
read INITPGM < /proc/1/comm
|
||||
if [ "${INITPGM}" == "systemd" ]; then
|
||||
echo "Running systemctl daemon-reload."
|
||||
@ -447,7 +415,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files -f %{_builddir}/%{name}.list
|
||||
%defattr(-,root,root)
|
||||
%doc README
|
||||
%doc README.md
|
||||
%doc README.SUSE
|
||||
|
||||
%doc iucvterm/doc/ts-shell
|
||||
@ -470,6 +438,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%dir %{_unitdir}
|
||||
%dir /usr/share/s390-tools
|
||||
%dir /usr/share/s390-tools/cpumf
|
||||
%dir /usr/share/s390-tools/netboot
|
||||
%dir /boot/zipl
|
||||
%dir /lib/s390-tools/
|
||||
%exclude /usr/lib/udev/rules.d/57-osasnmpd.rules
|
||||
|
@ -1,22 +0,0 @@
|
||||
## Path: Kernel/CPI
|
||||
## Description: set Control Program Indentification data
|
||||
## Type: list(yes,no)
|
||||
## Default: no
|
||||
#
|
||||
# Set Control Program Identification data
|
||||
#
|
||||
CPI_SET="yes"
|
||||
|
||||
## Type: string
|
||||
## Default: ""
|
||||
#
|
||||
# CPI system name
|
||||
#
|
||||
CPI_SYSTEM_NAME=""
|
||||
|
||||
## Type: string
|
||||
## Default: ""
|
||||
#
|
||||
# CPI sysplex name
|
||||
#
|
||||
CPI_SYSPLEX_NAME=""
|
Loading…
Reference in New Issue
Block a user