mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
Compare commits
196 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
094905af87 | ||
|
|
dcce14923c | ||
|
|
1fd78d9f5e | ||
|
|
9d1baaa594 | ||
|
|
efcfbce386 | ||
|
|
3d74c534bf | ||
|
|
ca2ffe9e18 | ||
|
|
52192908eb | ||
|
|
d4cee7e65a | ||
|
|
bfbf456b83 | ||
|
|
235e997a77 | ||
|
|
c079e48d7d | ||
|
|
4762e65acb | ||
|
|
cb614ed1ee | ||
|
|
8face3e63e | ||
|
|
ea14f5471c | ||
|
|
b2ae5a91ac | ||
|
|
edfb6a03d8 | ||
|
|
5eace91ee7 | ||
|
|
86856f98db | ||
|
|
154734efc7 | ||
|
|
c7fcb457b0 | ||
|
|
244bf4e550 | ||
|
|
0f7ed7d4fc | ||
|
|
121d5d8013 | ||
|
|
abe0ba7412 | ||
|
|
2227bb8330 | ||
|
|
aa09b29248 | ||
|
|
2790d4faaa | ||
|
|
bbc46edaf5 | ||
|
|
e5c0fb249b | ||
|
|
b6d8e5833c | ||
|
|
d71628326d | ||
|
|
8bfe18e674 | ||
|
|
275105fe3d | ||
|
|
19259aeb65 | ||
|
|
125df52887 | ||
|
|
852fb9dfb8 | ||
|
|
b0fe75b92f | ||
|
|
bc987c8d18 | ||
|
|
a86e41a518 | ||
|
|
0d9e42264d | ||
|
|
7fede7021e | ||
|
|
e7d79d5c5c | ||
|
|
7d4b1e18b6 | ||
|
|
b0cc0e4737 | ||
|
|
b7bb90c552 | ||
|
|
560b672bfa | ||
|
|
0fab6bdf2a | ||
|
|
b56c74fe7b | ||
|
|
663d362ff3 | ||
|
|
d4027e6506 | ||
|
|
ddde3f354f | ||
|
|
298fab68fe | ||
|
|
b47007b8ac | ||
|
|
91c35543ca | ||
|
|
9de85f4295 | ||
|
|
e15e8a1bfa | ||
|
|
4fc0c3cfef | ||
|
|
a0ed6709cf | ||
|
|
552a915465 | ||
|
|
1091b0bf65 | ||
|
|
016a0a56fc | ||
|
|
0b4cbf0041 | ||
|
|
d854aed4b8 | ||
|
|
7f8e31e861 | ||
|
|
a5b58038a0 | ||
|
|
c2244a5795 | ||
|
|
ea7cc9ea60 | ||
|
|
b32c031474 | ||
|
|
bfc3dd018c | ||
|
|
625b81130a | ||
|
|
bf8872e94a | ||
|
|
a84d1c5d58 | ||
|
|
696e8458f0 | ||
|
|
95c7258ea7 | ||
|
|
21de913a5e | ||
|
|
7a2a96e8a3 | ||
|
|
7a569c7e33 | ||
|
|
dc2ac0c916 | ||
|
|
367598b187 | ||
|
|
c01bcfa73a | ||
|
|
fe457e2082 | ||
|
|
1d25112589 | ||
|
|
27a8c4434c | ||
|
|
e6a3b18104 | ||
|
|
36292cb166 | ||
|
|
49da03e2e7 | ||
|
|
139dff3525 | ||
|
|
94227b44d5 | ||
|
|
a9f4ae2db3 | ||
|
|
15b7f9d83f | ||
|
|
214580a704 | ||
|
|
96f13ead2b | ||
|
|
8023a72b11 | ||
|
|
abc1875300 | ||
|
|
7d4c8c2781 | ||
|
|
f0afc6c89a | ||
|
|
8565e591bd | ||
|
|
80443ab629 | ||
|
|
8b3cc6e4c1 | ||
|
|
5693c16894 | ||
|
|
8bf5f8d0e2 | ||
|
|
99ab2db6ad | ||
|
|
784ac7d190 | ||
|
|
53f166673d | ||
|
|
d4ea321a97 | ||
|
|
1a63894487 | ||
|
|
e3fc9478bf | ||
|
|
f110a77b68 | ||
|
|
712433d7f9 | ||
|
|
2c4c210ca8 | ||
|
|
58e2135d87 | ||
|
|
5dbe73403f | ||
|
|
819513ab38 | ||
|
|
7e6d782699 | ||
|
|
cc82be3135 | ||
|
|
1b318fe114 | ||
|
|
87f47f60e4 | ||
|
|
0f55dab2de | ||
|
|
b58adc26f4 | ||
|
|
91509973fe | ||
|
|
39520546c5 | ||
|
|
8d1a7fecd0 | ||
|
|
a6507b330d | ||
|
|
d37dc68693 | ||
|
|
b0007fea98 | ||
|
|
1e248abd53 | ||
|
|
61baa23e48 | ||
|
|
261763f133 | ||
|
|
f4b2da6c9d | ||
|
|
1f607fed3d | ||
|
|
bf9fd47918 | ||
|
|
5aec1dc2a1 | ||
|
|
cf730a9632 | ||
|
|
73bab8e1a1 | ||
|
|
f97d048643 | ||
|
|
d8c630e5f4 | ||
|
|
45132ce1ee | ||
|
|
57a797350c | ||
|
|
75e3afb6a0 | ||
|
|
7915c9257b | ||
|
|
6014d07cb1 | ||
|
|
5d2ebe5301 | ||
|
|
ab510cff39 | ||
|
|
8c06dea4e5 | ||
|
|
0efacac5b8 | ||
|
|
6ea645b345 | ||
|
|
331b54d573 | ||
|
|
7e7a77675d | ||
|
|
dc2e439550 | ||
|
|
75d4317f20 | ||
|
|
58a7462f65 | ||
|
|
7c7e10ed8f | ||
|
|
0c1a63ce5e | ||
|
|
6825645a21 | ||
|
|
e764f460c4 | ||
|
|
63089835b0 | ||
|
|
e4cd42900f | ||
|
|
7f033938b8 | ||
|
|
f2dee9f542 | ||
|
|
c7a255fcd9 | ||
|
|
be7b854969 | ||
|
|
05a0f8e0eb | ||
|
|
43fcb694bf | ||
|
|
8be43a1f16 | ||
|
|
7b4a05e5a3 | ||
|
|
9911a95144 | ||
|
|
9c56255a70 | ||
|
|
a20cabccc4 | ||
|
|
f67758160e | ||
|
|
e84287e76e | ||
|
|
0c78add815 | ||
|
|
94b7a8f68d | ||
|
|
4036e80b26 | ||
|
|
a236180ad8 | ||
|
|
a9684b9154 | ||
|
|
6d31760872 | ||
|
|
b0dcc61ed5 | ||
|
|
a3e37953fe | ||
|
|
abf18cb711 | ||
|
|
22a4d45e3b | ||
|
|
e693173eef | ||
|
|
11bfa1d3c8 | ||
|
|
3ed8ab4e2a | ||
|
|
5a0c93443c | ||
|
|
b0c7965234 | ||
|
|
cdb23f8d22 | ||
|
|
60bda7ed0d | ||
|
|
4ff6519961 | ||
|
|
90dc65659f | ||
|
|
ec9c67189e | ||
|
|
951bd1ae54 | ||
|
|
ed6e3b7270 | ||
|
|
79ce120553 | ||
|
|
b45b564681 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -69,6 +69,7 @@ zconf/scm/lsscm
|
|||||||
zconf/zcrypt/chzcrypt
|
zconf/zcrypt/chzcrypt
|
||||||
zconf/zcrypt/lszcrypt
|
zconf/zcrypt/lszcrypt
|
||||||
zconf/zcrypt/zcryptctl
|
zconf/zcrypt/zcryptctl
|
||||||
|
zconf/zcrypt/zcryptstats
|
||||||
zdev/src/chzdev
|
zdev/src/chzdev
|
||||||
zdev/src/chzdev_usage.c
|
zdev/src/chzdev_usage.c
|
||||||
zdev/src/lszdev
|
zdev/src/lszdev
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ List of all individuals having contributed content to s390-tools
|
|||||||
- Kittipon Meesompop
|
- Kittipon Meesompop
|
||||||
- Klaus-Dieter Wacker
|
- Klaus-Dieter Wacker
|
||||||
- Lakhvich Dmitriy
|
- Lakhvich Dmitriy
|
||||||
|
- Marc Hartmayer
|
||||||
- Mark Dettinger
|
- Mark Dettinger
|
||||||
- Martin Kammerer
|
- Martin Kammerer
|
||||||
- Martin Peschke
|
- Martin Peschke
|
||||||
@@ -97,6 +98,7 @@ List of all individuals having contributed content to s390-tools
|
|||||||
- Thomas Richter
|
- Thomas Richter
|
||||||
- Thomas Spatzier
|
- Thomas Spatzier
|
||||||
- Thomas Weber
|
- Thomas Weber
|
||||||
|
- Tuan Hoang
|
||||||
- Ursula Braun
|
- Ursula Braun
|
||||||
- Utz Bacher
|
- Utz Bacher
|
||||||
- Vasily Gorbik
|
- Vasily Gorbik
|
||||||
|
|||||||
95
CHANGELOG.md
95
CHANGELOG.md
@@ -1,5 +1,100 @@
|
|||||||
Release history for s390-tools (MIT version)
|
Release history for s390-tools (MIT version)
|
||||||
--------------------------------------------
|
--------------------------------------------
|
||||||
|
* __v2.12.0 (2019-12-17)__
|
||||||
|
|
||||||
|
For Linux kernel version: 5.4
|
||||||
|
|
||||||
|
Changes of existing tools:
|
||||||
|
- dbginfo: Gather qdisc related data (using 'tc')
|
||||||
|
- dbginfo: Gather extended network statistics (using 'ip link')
|
||||||
|
- dbginfo: Collect all files under /usr/lib/systemd/system/
|
||||||
|
- cpumf/cpumf_helper: Add IBM z15 machine name
|
||||||
|
- zkey: Display MKVP when validating a secure key
|
||||||
|
- zkey: Cross check APQNs when generating, validating, or importing secure keys,
|
||||||
|
and when changing APQN associations
|
||||||
|
- zkey: Check crypto card level during APQN cross checking
|
||||||
|
- zkey: Add support for generating, validating, and re-enciphering AES CIPHER keys
|
||||||
|
- zkey-cryptsetup: Add --to-new and --from-old options
|
||||||
|
- zkey-cryptsetup: Allow setkey to set different key types
|
||||||
|
- lszcrypt/chzcrypt: CEX7S exploitation support
|
||||||
|
- zcryptstats: Add support for CEX7 crypto card
|
||||||
|
- zipl: Ship a minimal zipl.conf
|
||||||
|
- zipl: Add value of target= as search path for BLS case
|
||||||
|
|
||||||
|
Bug Fixes:
|
||||||
|
- dasdview: Fix exit status in error cases
|
||||||
|
- zipl: Fix various compile warnings
|
||||||
|
- zipl: Fix dependency generation in zipl/boot
|
||||||
|
- zipl: Fix entry point for stand-alone kdump
|
||||||
|
- zipl: Add missing options to help output
|
||||||
|
|
||||||
|
* __v2.11.0 (2019-09-06)__
|
||||||
|
|
||||||
|
For Linux kernel version: 5.3
|
||||||
|
|
||||||
|
Changes of existing tools:
|
||||||
|
- dasdfmt: Add support for thin-provisioned volumes
|
||||||
|
- lsdasd: Add support for thin-provisioned volumes
|
||||||
|
- libdasd: Provide function to utilise release space ioctl
|
||||||
|
- libdasd: Provide function to read ese sysfs attribute
|
||||||
|
- dbginfo: Add lspci (PCI devices) and smc_dbg (SMC sockets)
|
||||||
|
- dbginfo: Gather ethtool related data
|
||||||
|
|
||||||
|
Bug Fixes:
|
||||||
|
- zipl: Fix freeing of uninitialized pointer
|
||||||
|
- zipl: Set correct secure IPL default value
|
||||||
|
|
||||||
|
* __v2.10.0 (2019-07-31)__
|
||||||
|
|
||||||
|
For Linux kernel version: 5.2
|
||||||
|
|
||||||
|
Changes of existing tools:
|
||||||
|
- zdev: Add zfcp dix parameter handling
|
||||||
|
- cpumf: Add support for CPU-Measurement Facility counters SVN 6
|
||||||
|
|
||||||
|
Bug Fixes:
|
||||||
|
- libutil: Add functions to test path is read/write-only
|
||||||
|
- zdev: Fix reporting of read-only sysfs attributes
|
||||||
|
- zdev: Improve handling of invalid udev rules
|
||||||
|
- zipl: Fix stfle zero padding
|
||||||
|
- zipl: Fix build issues
|
||||||
|
- zipl: Remove trailing spaces from the fields defined in BLS files
|
||||||
|
- zipl: Do not overwrite BOOT_IMAGE entry
|
||||||
|
- zkey: Fix auto-detection of clear key bitsize for XTS keys
|
||||||
|
|
||||||
|
* __v2.9.0 (2019-05-21)__
|
||||||
|
|
||||||
|
For Linux kernel version: 5.0 / 5.1
|
||||||
|
|
||||||
|
Add new tool:
|
||||||
|
- zcryptstats: Add zcryptstats to display usage statistics of
|
||||||
|
IBM Crypto Express adapters
|
||||||
|
|
||||||
|
Changes of existing tools:
|
||||||
|
- lszfcp: New command line option to show module parameters
|
||||||
|
- lszfcp: Sdev attributes for scsi_disk, block, integrity, queue, iosched
|
||||||
|
- lszfcp: Add new output marker for non-good SCSI devices (luns)
|
||||||
|
- lszfcp: Add new output marker for non-good fc_rports
|
||||||
|
- lszfcp: Clean up whitespace (mixed indentation, trailing)
|
||||||
|
- lschp: Add support for specifying a CHPID
|
||||||
|
- zipl: Add secure boot capabilities
|
||||||
|
- zkey: Add common passphrase options for cryptsetup and crypttab
|
||||||
|
- zkey: Add batch-mode option to cryptsetup and zkey-cryptsetup
|
||||||
|
- libu2s: Remove the entire library and provide more robust functionality
|
||||||
|
in libdasd and libutil instead
|
||||||
|
|
||||||
|
Bug Fixes:
|
||||||
|
- lszfcp: Allow to show zfcp_units without associated SCSI device
|
||||||
|
- lszfcp: Attribute details for: css, zfcp_port, zfcp_unit
|
||||||
|
- lszfcp: Allow to also enumerate FCP device that have never been online
|
||||||
|
- lszfcp: Fix error message if no zfcp-attached SCSI device found
|
||||||
|
- lszfcp: Fix to show defunct FCP devices again
|
||||||
|
- lszfcp: Fix to show non-good target ports again
|
||||||
|
- lszfcp: Fix missing block & sg device output without CONFIG_SYSFS_DEPRECATED
|
||||||
|
- lszfcp: New command line option for extended output format
|
||||||
|
- zfcpdbf: Warn about ambiguous payload records with dup reqid & payarea
|
||||||
|
- zpcictl: Check for regular directory to prevent possible buffer overflow
|
||||||
|
|
||||||
* __v2.8.0 (2019-02-15)__
|
* __v2.8.0 (2019-02-15)__
|
||||||
|
|
||||||
For Linux kernel version: 4.20
|
For Linux kernel version: 4.20
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -3,7 +3,7 @@ ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/ar
|
|||||||
# Include common definitions
|
# Include common definitions
|
||||||
include common.mak
|
include common.mak
|
||||||
|
|
||||||
LIB_DIRS = libvtoc libu2s libutil libzds libdasd libvmdump libccw libvmcp
|
LIB_DIRS = libvtoc libutil libzds libdasd libvmdump libccw libvmcp
|
||||||
TOOL_DIRS = zipl zdump fdasd dasdfmt dasdview tunedasd \
|
TOOL_DIRS = zipl zdump fdasd dasdfmt dasdview tunedasd \
|
||||||
tape390 osasnmpd qetharp ip_watcher qethconf scripts zconf \
|
tape390 osasnmpd qetharp ip_watcher qethconf scripts zconf \
|
||||||
vmconvert vmcp man mon_tools dasdinfo vmur cpuplugd ipl_tools \
|
vmconvert vmcp man mon_tools dasdinfo vmur cpuplugd ipl_tools \
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ Package contents
|
|||||||
or show encryption state of attached LUNs.
|
or show encryption state of attached LUNs.
|
||||||
- lszcrypt: Show Information about zcrypt devices and configuration.
|
- lszcrypt: Show Information about zcrypt devices and configuration.
|
||||||
- chzcrypt: Modify the zcrypt configuration.
|
- chzcrypt: Modify the zcrypt configuration.
|
||||||
|
- zcryptstats: Display usage statistics of IBM Crypto Express adapters.
|
||||||
- znetconf: List and configure network devices for s390 network adapters.
|
- znetconf: List and configure network devices for s390 network adapters.
|
||||||
- cio_ignore: Query and modify the contents of the CIO device driver
|
- cio_ignore: Query and modify the contents of the CIO device driver
|
||||||
blacklist.
|
blacklist.
|
||||||
@@ -284,6 +285,9 @@ Build and runtime requirements for specific tools
|
|||||||
In the following more details on the build an runtime requirements of
|
In the following more details on the build an runtime requirements of
|
||||||
the different tools are provided:
|
the different tools are provided:
|
||||||
|
|
||||||
|
* dbginfo.sh:
|
||||||
|
The tar package is required to archive collected data.
|
||||||
|
|
||||||
* osasnmpd:
|
* osasnmpd:
|
||||||
You need at least the NET-SNMP 5.1.x package (net-snmp-devel.rpm)
|
You need at least the NET-SNMP 5.1.x package (net-snmp-devel.rpm)
|
||||||
installed, before building the osasnmpd subagent.
|
installed, before building the osasnmpd subagent.
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ COMMON_INCLUDED = true
|
|||||||
# The variable "DISTRELEASE" should be overwritten in rpm spec files with:
|
# The variable "DISTRELEASE" should be overwritten in rpm spec files with:
|
||||||
# "make DISTRELEASE=%{release}" and "make install DISTRELEASE=%{release}"
|
# "make DISTRELEASE=%{release}" and "make install DISTRELEASE=%{release}"
|
||||||
VERSION = 2
|
VERSION = 2
|
||||||
RELEASE = 8
|
RELEASE = 12
|
||||||
PATCHLEVEL = 0
|
PATCHLEVEL = 0
|
||||||
DISTRELEASE = build-$(shell date +%Y%m%d)
|
DISTRELEASE = build-$(shell date +%Y%m%d)
|
||||||
S390_TOOLS_RELEASE = $(VERSION).$(RELEASE).$(PATCHLEVEL)-$(DISTRELEASE)
|
S390_TOOLS_RELEASE = $(VERSION).$(RELEASE).$(PATCHLEVEL)-$(DISTRELEASE)
|
||||||
@@ -331,10 +331,6 @@ $(rootdir)/libzds/libzds.a: $(rootdir)/libzds
|
|||||||
$(MAKE) -C $(rootdir)/libzds/ libzds.a
|
$(MAKE) -C $(rootdir)/libzds/ libzds.a
|
||||||
.PHONY: $(rootdir)/libzds
|
.PHONY: $(rootdir)/libzds
|
||||||
|
|
||||||
$(rootdir)/libu2s/libu2s.a: $(rootdir)/libu2s
|
|
||||||
$(MAKE) -C $(rootdir)/libu2s/ libu2s.a
|
|
||||||
.PHONY: $(rootdir)/libu2s
|
|
||||||
|
|
||||||
$(rootdir)/libvmdump/libvmdump.a: $(rootdir)/libvmdump
|
$(rootdir)/libvmdump/libvmdump.a: $(rootdir)/libvmdump
|
||||||
$(MAKE) -C $(rootdir)/libvmdump/ libvmdump.a
|
$(MAKE) -C $(rootdir)/libvmdump/ libvmdump.a
|
||||||
.PHONY: $(rootdir)/libvmdump
|
.PHONY: $(rootdir)/libvmdump
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ include ../common.mak
|
|||||||
CPUMF_DATADIR = $(TOOLS_DATADIR)/cpumf
|
CPUMF_DATADIR = $(TOOLS_DATADIR)/cpumf
|
||||||
DATA_FILES = cpum-cf-hw-counter.map \
|
DATA_FILES = cpum-cf-hw-counter.map \
|
||||||
cpum-cf-cfvn-1.ctr cpum-cf-cfvn-3.ctr \
|
cpum-cf-cfvn-1.ctr cpum-cf-cfvn-3.ctr \
|
||||||
cpum-cf-csvn-generic.ctr \
|
cpum-cf-csvn-12345.ctr cpum-cf-csvn-6.ctr \
|
||||||
cpum-cf-extended-z10.ctr cpum-cf-extended-z196.ctr \
|
cpum-cf-extended-z10.ctr cpum-cf-extended-z196.ctr \
|
||||||
cpum-cf-extended-zEC12.ctr cpum-sf-modes.ctr \
|
cpum-cf-extended-zEC12.ctr cpum-sf-modes.ctr \
|
||||||
cpum-cf-extended-z13.ctr cpum-cf-extended-z14.ctr
|
cpum-cf-extended-z13.ctr cpum-cf-extended-z14.ctr
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ my $system_z_hwtype_map = {
|
|||||||
2965 => 'IBM z13s',
|
2965 => 'IBM z13s',
|
||||||
3906 => 'IBM z14',
|
3906 => 'IBM z14',
|
||||||
3907 => 'IBM z14 ZR1',
|
3907 => 'IBM z14 ZR1',
|
||||||
|
8561 => 'IBM z15',
|
||||||
};
|
};
|
||||||
|
|
||||||
sub get_hardware_type()
|
sub get_hardware_type()
|
||||||
@@ -267,7 +268,12 @@ sub cpumf_load_ctrdef($;$)
|
|||||||
# List of "generic" counter sets
|
# List of "generic" counter sets
|
||||||
my @def = ();
|
my @def = ();
|
||||||
push @def, "cfvn-" . $version->{cfvn};
|
push @def, "cfvn-" . $version->{cfvn};
|
||||||
push @def, "csvn-generic";
|
if ($version->{csvn} >= 1 && $version->{csvn} <= 6) {
|
||||||
|
push @def, "csvn-12345";
|
||||||
|
}
|
||||||
|
if ($version->{csvn} == 6) {
|
||||||
|
push @def, "csvn-6";
|
||||||
|
}
|
||||||
|
|
||||||
my $h = {};
|
my $h = {};
|
||||||
# Load counter set definition
|
# Load counter set definition
|
||||||
|
|||||||
33
cpumf/data/cpum-cf-csvn-6.ctr
Normal file
33
cpumf/data/cpum-cf-csvn-6.ctr
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
Counter: 80 Name:ECC_FUNCTION_COUNT
|
||||||
|
Short-Description:ECC Function Count
|
||||||
|
Description:
|
||||||
|
This counter counts the
|
||||||
|
total number of the elliptic-curve cryptography (ECC)
|
||||||
|
functions issued by the CPU.
|
||||||
|
.
|
||||||
|
Counter: 81 Name:ECC_CYCLES_COUNT
|
||||||
|
Short-Description:ECC Cycles Count
|
||||||
|
Description:
|
||||||
|
This counter counts the total
|
||||||
|
number of CPU cycles when the ECC coprocessor is
|
||||||
|
busy performing the elliptic-curve cryptography
|
||||||
|
(ECC) functions issued by the CPU.
|
||||||
|
.
|
||||||
|
Counter: 82 Name:ECC_BLOCKED_FUNCTION_COUNT
|
||||||
|
Short-Description:Ecc Blocked Function Count
|
||||||
|
Description:
|
||||||
|
This counter
|
||||||
|
counts the total number of the elliptic-curve
|
||||||
|
cryptography (ECC) functions that are issued by the CPU
|
||||||
|
and are blocked because the ECC coprocessor is
|
||||||
|
busy performing a function issued by another CPU.
|
||||||
|
.
|
||||||
|
Counter: 83 Name:ECC_BLOCKED_CYCLES_COUNT
|
||||||
|
Short-Description:ECC Blocked Cycles Count
|
||||||
|
Description:
|
||||||
|
This counter counts
|
||||||
|
the total number of CPU cycles blocked for the elliptic-curve
|
||||||
|
cryptography (ECC) functions issued by the
|
||||||
|
CPU because the ECC coprocessor is busy perform-
|
||||||
|
ing a function issued by another CPU.
|
||||||
|
.
|
||||||
@@ -14,7 +14,8 @@
|
|||||||
'cfvn-3' => 'cpum-cf-cfvn-3.ctr',
|
'cfvn-3' => 'cpum-cf-cfvn-3.ctr',
|
||||||
|
|
||||||
# CSVN
|
# CSVN
|
||||||
'csvn-generic' => 'cpum-cf-csvn-generic.ctr',
|
'csvn-12345' => 'cpum-cf-csvn-12345.ctr',
|
||||||
|
'csvn-6' => 'cpum-cf-csvn-6.ctr',
|
||||||
|
|
||||||
# Extended counters
|
# Extended counters
|
||||||
2097 => 'cpum-cf-extended-z10.ctr',
|
2097 => 'cpum-cf-extended-z10.ctr',
|
||||||
@@ -27,4 +28,7 @@
|
|||||||
2965 => 'cpum-cf-extended-z13.ctr',
|
2965 => 'cpum-cf-extended-z13.ctr',
|
||||||
3906 => 'cpum-cf-extended-z14.ctr',
|
3906 => 'cpum-cf-extended-z14.ctr',
|
||||||
3907 => 'cpum-cf-extended-z14.ctr',
|
3907 => 'cpum-cf-extended-z14.ctr',
|
||||||
|
# Identical with z14
|
||||||
|
8561 => 'cpum-cf-extended-z14.ctr',
|
||||||
|
8562 => 'cpum-cf-extended-z14.ctr',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -161,8 +161,8 @@ int is_online(int cpuid)
|
|||||||
retval = 1;
|
retval = 1;
|
||||||
if (state == 0)
|
if (state == 0)
|
||||||
retval = 0;
|
retval = 0;
|
||||||
fclose(filp);
|
|
||||||
}
|
}
|
||||||
|
fclose(filp);
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@@ -220,8 +220,8 @@ int cpu_is_configured(int cpuid)
|
|||||||
retval = 1;
|
retval = 1;
|
||||||
if (state == 0)
|
if (state == 0)
|
||||||
retval = 0;
|
retval = 0;
|
||||||
fclose(filp);
|
|
||||||
}
|
}
|
||||||
|
fclose(filp);
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ all: dasdfmt
|
|||||||
|
|
||||||
libs = $(rootdir)/libdasd/libdasd.a \
|
libs = $(rootdir)/libdasd/libdasd.a \
|
||||||
$(rootdir)/libvtoc/libvtoc.a \
|
$(rootdir)/libvtoc/libvtoc.a \
|
||||||
$(rootdir)/libu2s/libu2s.a \
|
|
||||||
$(rootdir)/libutil/libutil.a
|
$(rootdir)/libutil/libutil.a
|
||||||
|
|
||||||
dasdfmt: dasdfmt.o $(libs)
|
dasdfmt: dasdfmt.o $(libs)
|
||||||
|
|||||||
@@ -122,6 +122,8 @@ 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
|
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
|
format with the specified blocksize. A blocksize can optionally be specified
|
||||||
using \fB-b\fR (\fB--blocksize\fR).
|
using \fB-b\fR (\fB--blocksize\fR).
|
||||||
|
.br
|
||||||
|
For thin-provisioned DASD ESE volumes this is the default mode.
|
||||||
.IP expand
|
.IP expand
|
||||||
Format all unformatted tracks at the end of the target DASD. This mode assumes
|
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
|
that tracks at the beginning of the DASD volume have already been correctly
|
||||||
@@ -136,6 +138,10 @@ using \fB-b\fR (\fB--blocksize\fR).
|
|||||||
Perform a complete format check on a DASD volume. A blocksize can be specified
|
Perform a complete format check on a DASD volume. A blocksize can be specified
|
||||||
with \fB-b\fR (\fB--blocksize\fR).
|
with \fB-b\fR (\fB--blocksize\fR).
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fB--no-discard\fR
|
||||||
|
Omit a full space release when formatting a thin-provisioned DASD ESE volume.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB-r\fR \fIcylindercount\fR or \fB--requestsize\fR=\fIcylindercount\fR
|
\fB-r\fR \fIcylindercount\fR or \fB--requestsize\fR=\fIcylindercount\fR
|
||||||
Number of cylinders to be processed in one formatting step.
|
Number of cylinders to be processed in one formatting step.
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ static const struct util_prg prg = {
|
|||||||
/* Defines for options with no short command */
|
/* Defines for options with no short command */
|
||||||
#define OPT_CHECK 128
|
#define OPT_CHECK 128
|
||||||
#define OPT_NOZERO 129
|
#define OPT_NOZERO 129
|
||||||
|
#define OPT_NODISCARD 130
|
||||||
|
|
||||||
static struct util_opt opt_vec[] = {
|
static struct util_opt opt_vec[] = {
|
||||||
UTIL_OPT_SECTION("FORMAT ACTIONS"),
|
UTIL_OPT_SECTION("FORMAT ACTIONS"),
|
||||||
@@ -105,6 +106,11 @@ static struct util_opt opt_vec[] = {
|
|||||||
.desc = "Prevent storage server from modifying record 0",
|
.desc = "Prevent storage server from modifying record 0",
|
||||||
.flags = UTIL_OPT_FLAG_NOSHORT,
|
.flags = UTIL_OPT_FLAG_NOSHORT,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.option = { "no-discard", no_argument, NULL, OPT_NODISCARD },
|
||||||
|
.desc = "Do not discard space before formatting",
|
||||||
|
.flags = UTIL_OPT_FLAG_NOSHORT,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.option = { NULL, no_argument, NULL, 'y' },
|
.option = { NULL, no_argument, NULL, 'y' },
|
||||||
.desc = "Start formatting without further user-confirmation",
|
.desc = "Start formatting without further user-confirmation",
|
||||||
@@ -921,6 +927,8 @@ static void dasdfmt_print_info(dasdfmt_info_t *info, char *devname,
|
|||||||
printf("Drive Geometry: %d Cylinders * %d Heads = %d Tracks\n",
|
printf("Drive Geometry: %d Cylinders * %d Heads = %d Tracks\n",
|
||||||
cylinders, heads, (cylinders * heads));
|
cylinders, heads, (cylinders * heads));
|
||||||
|
|
||||||
|
printf("Device Type: %s Provisioned\n",
|
||||||
|
info->ese ? "Thinly" : "Fully");
|
||||||
printf("\nI am going to format the device ");
|
printf("\nI am going to format the device ");
|
||||||
printf("%s in the following way:\n", devname);
|
printf("%s in the following way:\n", devname);
|
||||||
printf(" Device number of device : 0x%x\n", info->dasd_info.devno);
|
printf(" Device number of device : 0x%x\n", info->dasd_info.devno);
|
||||||
@@ -939,7 +947,10 @@ static void dasdfmt_print_info(dasdfmt_info_t *info, char *devname,
|
|||||||
(p->intensity & DASD_FMT_INT_COMPAT) ? "yes" : "no");
|
(p->intensity & DASD_FMT_INT_COMPAT) ? "yes" : "no");
|
||||||
printf(" Blocksize : %d\n", p->blksize);
|
printf(" Blocksize : %d\n", p->blksize);
|
||||||
printf(" Mode : %s\n", mode_str[mode]);
|
printf(" Mode : %s\n", mode_str[mode]);
|
||||||
|
if (info->ese) {
|
||||||
|
printf(" Full Space Release : %s\n",
|
||||||
|
(info->no_discard || mode == FULL) ? "no" : "yes");
|
||||||
|
}
|
||||||
if (info->testmode)
|
if (info->testmode)
|
||||||
printf("Test mode active, omitting ioctl.\n");
|
printf("Test mode active, omitting ioctl.\n");
|
||||||
}
|
}
|
||||||
@@ -1234,6 +1245,26 @@ static void dasdfmt_format(dasdfmt_info_t *info, unsigned int cylinders,
|
|||||||
process_tracks(info, cylinders, heads, format_params);
|
process_tracks(info, cylinders, heads, format_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void dasdfmt_release_space(dasdfmt_info_t *info)
|
||||||
|
{
|
||||||
|
format_data_t r = {
|
||||||
|
.start_unit = 0,
|
||||||
|
.stop_unit = 0,
|
||||||
|
.intensity = DASD_FMT_INT_ESE_FULL,
|
||||||
|
};
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
|
if (!info->ese || info->no_discard)
|
||||||
|
return;
|
||||||
|
|
||||||
|
printf("Releasing space for the entire device...\n");
|
||||||
|
err = dasd_release_space(dev_filename, &r);
|
||||||
|
if (err) {
|
||||||
|
ERRMSG_EXIT(EXIT_FAILURE, "%s: Could not release space (%s)\n",
|
||||||
|
prog_name, strerror(err));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void dasdfmt_prepare_and_format(dasdfmt_info_t *info,
|
static void dasdfmt_prepare_and_format(dasdfmt_info_t *info,
|
||||||
unsigned int cylinders,
|
unsigned int cylinders,
|
||||||
unsigned int heads, format_data_t *p)
|
unsigned int heads, format_data_t *p)
|
||||||
@@ -1329,6 +1360,8 @@ static void dasdfmt_quick_format(dasdfmt_info_t *info, unsigned int cylinders,
|
|||||||
|
|
||||||
if (info->force) {
|
if (info->force) {
|
||||||
printf("Skipping format check due to --force.\n");
|
printf("Skipping format check due to --force.\n");
|
||||||
|
} else if (info->ese) {
|
||||||
|
printf("Skipping format check due to thin-provisioned device.\n");
|
||||||
} else {
|
} else {
|
||||||
check_blocksize(info, p->blksize);
|
check_blocksize(info, p->blksize);
|
||||||
|
|
||||||
@@ -1394,7 +1427,7 @@ static void do_format_dasd(dasdfmt_info_t *info, char *devname,
|
|||||||
if ((info->verbosity > 0) || !info->withoutprompt || info->testmode)
|
if ((info->verbosity > 0) || !info->withoutprompt || info->testmode)
|
||||||
dasdfmt_print_info(info, devname, vlabel, cylinders, heads, p);
|
dasdfmt_print_info(info, devname, vlabel, cylinders, heads, p);
|
||||||
|
|
||||||
count = u2s_get_host_access_count(devname);
|
count = dasd_get_host_access_count(devname);
|
||||||
if (info->force_host) {
|
if (info->force_host) {
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
ERRMSG_EXIT(EXIT_FAILURE,
|
ERRMSG_EXIT(EXIT_FAILURE,
|
||||||
@@ -1438,6 +1471,7 @@ static void do_format_dasd(dasdfmt_info_t *info, char *devname,
|
|||||||
dasdfmt_prepare_and_format(info, cylinders, heads, p);
|
dasdfmt_prepare_and_format(info, cylinders, heads, p);
|
||||||
break;
|
break;
|
||||||
case QUICK:
|
case QUICK:
|
||||||
|
dasdfmt_release_space(info);
|
||||||
dasdfmt_quick_format(info, cylinders, heads, p);
|
dasdfmt_quick_format(info, cylinders, heads, p);
|
||||||
break;
|
break;
|
||||||
case EXPAND:
|
case EXPAND:
|
||||||
@@ -1461,6 +1495,19 @@ static void do_format_dasd(dasdfmt_info_t *info, char *devname,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void eval_format_mode(dasdfmt_info_t *info)
|
||||||
|
{
|
||||||
|
if (!info->force && info->mode_specified && info->ese && mode == EXPAND) {
|
||||||
|
ERRMSG_EXIT(EXIT_FAILURE,
|
||||||
|
"WARNING: The specified device is thin-provisioned\n"
|
||||||
|
"Format mode 'expand' is not feasible.\n"
|
||||||
|
"Use --mode=full or --mode=quick to perform a clean format\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!info->mode_specified)
|
||||||
|
mode = info->ese ? QUICK : FULL;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
dasdfmt_info_t info = {
|
dasdfmt_info_t info = {
|
||||||
@@ -1496,8 +1543,6 @@ int main(int argc, char *argv[])
|
|||||||
format_params.blksize = DEFAULT_BLOCKSIZE;
|
format_params.blksize = DEFAULT_BLOCKSIZE;
|
||||||
format_params.intensity = DASD_FMT_INT_COMPAT;
|
format_params.intensity = DASD_FMT_INT_COMPAT;
|
||||||
|
|
||||||
mode = FULL;
|
|
||||||
|
|
||||||
/*************** parse parameters **********************/
|
/*************** parse parameters **********************/
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@@ -1601,6 +1646,10 @@ int main(int argc, char *argv[])
|
|||||||
"invalid. Consult the man page for "
|
"invalid. Consult the man page for "
|
||||||
"more information.\n",
|
"more information.\n",
|
||||||
prog_name, optarg);
|
prog_name, optarg);
|
||||||
|
info.mode_specified = 1;
|
||||||
|
break;
|
||||||
|
case OPT_NODISCARD:
|
||||||
|
info.no_discard = 1;
|
||||||
break;
|
break;
|
||||||
case OPT_CHECK:
|
case OPT_CHECK:
|
||||||
info.check = 1;
|
info.check = 1;
|
||||||
@@ -1645,6 +1694,9 @@ int main(int argc, char *argv[])
|
|||||||
"device information failed (%s).\n",
|
"device information failed (%s).\n",
|
||||||
prog_name, strerror(rc));
|
prog_name, strerror(rc));
|
||||||
|
|
||||||
|
info.ese = dasd_sys_ese(dev_filename);
|
||||||
|
eval_format_mode(&info);
|
||||||
|
|
||||||
/* Either let the user specify the blksize or get it from the kernel */
|
/* Either let the user specify the blksize or get it from the kernel */
|
||||||
if (!info.blksize_specified) {
|
if (!info.blksize_specified) {
|
||||||
if (!(mode == FULL ||
|
if (!(mode == FULL ||
|
||||||
|
|||||||
@@ -27,10 +27,6 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* SECTION: Definition needed for DASD-API (see dasd.h) *
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Represents possible format modes that can be specified when formatting
|
* Represents possible format modes that can be specified when formatting
|
||||||
* a DASD.
|
* a DASD.
|
||||||
@@ -45,57 +41,16 @@ static const char mode_str[3][10] = {
|
|||||||
"Full", "Quick", "Expand"
|
"Full", "Quick", "Expand"
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* values to be used for format_data_t.intensity
|
|
||||||
* 0/8: normal format
|
|
||||||
* 1/9: also write record zero
|
|
||||||
* 3/11: also write home address
|
|
||||||
* 4/12: invalidate track
|
|
||||||
*/
|
|
||||||
#define DASD_FMT_INT_FMT_R0 1 /* write record zero */
|
|
||||||
#define DASD_FMT_INT_FMT_HA 2 /* write home address, also set FMT_R0 ! */
|
|
||||||
#define DASD_FMT_INT_INVAL 4 /* invalidate tracks */
|
|
||||||
#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 */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* SECTION: DASDFMT internal types *
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#define DASD_PARTN_BITS 2
|
#define DASD_PARTN_BITS 2
|
||||||
#define PARTN_MASK ((1 << DASD_PARTN_BITS) - 1)
|
#define PARTN_MASK ((1 << DASD_PARTN_BITS) - 1)
|
||||||
|
|
||||||
#define EXIT_MISUSE 1
|
#define EXIT_MISUSE 1
|
||||||
#define EXIT_BUSY 2
|
#define EXIT_BUSY 2
|
||||||
#define LABEL_LENGTH 14
|
|
||||||
#define VLABEL_CHARS 84
|
|
||||||
#define LINE_LENGTH 80
|
|
||||||
#define ERR_LENGTH 90
|
#define ERR_LENGTH 90
|
||||||
|
|
||||||
#define DEFAULT_BLOCKSIZE 4096
|
#define DEFAULT_BLOCKSIZE 4096
|
||||||
/* requestsize - number of cylinders in one format step */
|
/* requestsize - number of cylinders in one format step */
|
||||||
#define DEFAULT_REQUESTSIZE 10
|
#define DEFAULT_REQUESTSIZE 10
|
||||||
#define USABLE_PARTITIONS ((1 << DASD_PARTN_BITS) - 1)
|
|
||||||
|
|
||||||
#define ERRMSG(x...) {fflush(stdout);fprintf(stderr,x);}
|
#define ERRMSG(x...) {fflush(stdout);fprintf(stderr,x);}
|
||||||
#define ERRMSG_EXIT(ec,x...) {fflush(stdout);fprintf(stderr,x);exit(ec);}
|
#define ERRMSG_EXIT(ec,x...) {fflush(stdout);fprintf(stderr,x);exit(ec);}
|
||||||
@@ -137,6 +92,9 @@ typedef struct dasdfmt_info {
|
|||||||
int force_host;
|
int force_host;
|
||||||
int layout_specified;
|
int layout_specified;
|
||||||
int check;
|
int check;
|
||||||
|
int mode_specified;
|
||||||
|
int ese;
|
||||||
|
int no_discard;
|
||||||
} dasdfmt_info_t;
|
} dasdfmt_info_t;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
include ../common.mak
|
include ../common.mak
|
||||||
|
|
||||||
libs = $(rootdir)/libu2s/libu2s.a \
|
libs = $(rootdir)/libutil/libutil.a \
|
||||||
$(rootdir)/libutil/libutil.a \
|
|
||||||
$(rootdir)/libdasd/libdasd.a
|
$(rootdir)/libdasd/libdasd.a
|
||||||
|
|
||||||
all: dasdinfo
|
all: dasdinfo
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ all: dasdview
|
|||||||
libs = $(rootdir)/libdasd/libdasd.a \
|
libs = $(rootdir)/libdasd/libdasd.a \
|
||||||
$(rootdir)/libzds/libzds.a \
|
$(rootdir)/libzds/libzds.a \
|
||||||
$(rootdir)/libvtoc/libvtoc.a \
|
$(rootdir)/libvtoc/libvtoc.a \
|
||||||
$(rootdir)/libu2s/libu2s.a \
|
|
||||||
$(rootdir)/libutil/libutil.a
|
$(rootdir)/libutil/libutil.a
|
||||||
|
|
||||||
dasdview: dasdview.o $(libs)
|
dasdview: dasdview.o $(libs)
|
||||||
|
|||||||
@@ -28,10 +28,10 @@
|
|||||||
#include "lib/dasd_base.h"
|
#include "lib/dasd_base.h"
|
||||||
#include "lib/dasd_sys.h"
|
#include "lib/dasd_sys.h"
|
||||||
#include "lib/libzds.h"
|
#include "lib/libzds.h"
|
||||||
#include "lib/u2s.h"
|
|
||||||
#include "lib/util_base.h"
|
#include "lib/util_base.h"
|
||||||
#include "lib/util_opt.h"
|
#include "lib/util_opt.h"
|
||||||
#include "lib/util_prg.h"
|
#include "lib/util_prg.h"
|
||||||
|
#include "lib/util_sys.h"
|
||||||
#include "lib/vtoc.h"
|
#include "lib/vtoc.h"
|
||||||
#include "lib/zt_common.h"
|
#include "lib/zt_common.h"
|
||||||
|
|
||||||
@@ -160,19 +160,19 @@ dasdview_get_info(dasdview_info_t *info)
|
|||||||
if (err != EBADF)
|
if (err != EBADF)
|
||||||
zt_error_print("dasdview: "
|
zt_error_print("dasdview: "
|
||||||
"Could not retrieve geo information!\n");
|
"Could not retrieve geo information!\n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dasd_get_blocksize(info->device, &info->blksize) != 0) {
|
if (dasd_get_blocksize(info->device, &info->blksize) != 0) {
|
||||||
zt_error_print("dasdview: "
|
zt_error_print("dasdview: "
|
||||||
"Could not retrieve blocksize information!\n");
|
"Could not retrieve blocksize information!\n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dasd_get_info(info->device, &info->dasd_info) != 0) {
|
if (dasd_get_info(info->device, &info->dasd_info) != 0) {
|
||||||
zt_error_print("dasdview: "
|
zt_error_print("dasdview: "
|
||||||
"Could not retrieve disk information!\n");
|
"Could not retrieve disk information!\n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
characteristics = (struct dasd_eckd_characteristics *)
|
characteristics = (struct dasd_eckd_characteristics *)
|
||||||
@@ -183,7 +183,7 @@ dasdview_get_info(dasdview_info_t *info)
|
|||||||
else
|
else
|
||||||
info->hw_cylinders = characteristics->no_cyl;
|
info->hw_cylinders = characteristics->no_cyl;
|
||||||
|
|
||||||
if (u2s_getbusid(info->device, info->busid) == -1)
|
if (util_sys_get_dev_addr(info->device, info->busid) != 0)
|
||||||
info->busid_valid = 0;
|
info->busid_valid = 0;
|
||||||
else
|
else
|
||||||
info->busid_valid = 1;
|
info->busid_valid = 1;
|
||||||
@@ -261,7 +261,7 @@ dasdview_parse_input(unsigned long long *p, dasdview_info_t *info, char *s)
|
|||||||
error:
|
error:
|
||||||
zt_error_print("dasdview: usage error\n"
|
zt_error_print("dasdview: usage error\n"
|
||||||
"%s is not a valid begin/size value!", s);
|
"%s is not a valid begin/size value!", s);
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -454,7 +454,7 @@ dasdview_print_vlabel(dasdview_info_t *info)
|
|||||||
if (rc) {
|
if (rc) {
|
||||||
zt_error_print("error when reading label from device:"
|
zt_error_print("error when reading label from device:"
|
||||||
" rc=%d\n", rc);
|
" rc=%d\n", rc);
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
lzds_dasd_get_vlabel(info->dasd, &tmpvlabel);
|
lzds_dasd_get_vlabel(info->dasd, &tmpvlabel);
|
||||||
memcpy(&vlabel, tmpvlabel, sizeof(vlabel));
|
memcpy(&vlabel, tmpvlabel, sizeof(vlabel));
|
||||||
@@ -600,7 +600,7 @@ dasdview_print_volser(dasdview_info_t *info)
|
|||||||
if (rc) {
|
if (rc) {
|
||||||
zt_error_print("error when reading label from device:"
|
zt_error_print("error when reading label from device:"
|
||||||
" rc=%d\n", rc);
|
" rc=%d\n", rc);
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
lzds_dasd_get_vlabel(info->dasd, &tmpvlabel);
|
lzds_dasd_get_vlabel(info->dasd, &tmpvlabel);
|
||||||
memcpy(&vlabel, tmpvlabel, sizeof(vlabel));
|
memcpy(&vlabel, tmpvlabel, sizeof(vlabel));
|
||||||
@@ -644,7 +644,7 @@ dasdview_read_vtoc(dasdview_info_t *info)
|
|||||||
zt_error_print("dasdview: disk layout error\n"
|
zt_error_print("dasdview: disk layout error\n"
|
||||||
"%s is not formatted with the z/OS "
|
"%s is not formatted with the z/OS "
|
||||||
"compatible disk layout!\n", info->device);
|
"compatible disk layout!\n", info->device);
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
vtocblk = (u_int64_t)vtoc_get_cyl_from_cchhb(&vlabel.vtoc) *
|
vtocblk = (u_int64_t)vtoc_get_cyl_from_cchhb(&vlabel.vtoc) *
|
||||||
@@ -664,7 +664,7 @@ dasdview_read_vtoc(dasdview_info_t *info)
|
|||||||
if ((vtocblk <= 0) || (vtocblk > maxblk)) {
|
if ((vtocblk <= 0) || (vtocblk > maxblk)) {
|
||||||
zt_error_print("dasdview: VTOC error\n"
|
zt_error_print("dasdview: VTOC error\n"
|
||||||
"Volume label VTOC pointer is not valid!\n");
|
"Volume label VTOC pointer is not valid!\n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
vtoc_read_label(info->device, (vtocblk - 1) * info->blksize,
|
vtoc_read_label(info->device, (vtocblk - 1) * info->blksize,
|
||||||
@@ -676,7 +676,7 @@ dasdview_read_vtoc(dasdview_info_t *info)
|
|||||||
/* format4 DSCB is invalid */
|
/* format4 DSCB is invalid */
|
||||||
zt_error_print("dasdview: VTOC error\n"
|
zt_error_print("dasdview: VTOC error\n"
|
||||||
"Format 4 DSCB is invalid!\n");
|
"Format 4 DSCB is invalid!\n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
info->f4c++;
|
info->f4c++;
|
||||||
@@ -724,19 +724,19 @@ dasdview_read_vtoc(dasdview_info_t *info)
|
|||||||
if (info->f4c > 1) {
|
if (info->f4c > 1) {
|
||||||
zt_error_print("dasdview: VTOC error\n"
|
zt_error_print("dasdview: VTOC error\n"
|
||||||
"More than one FMT4 DSCB!\n");
|
"More than one FMT4 DSCB!\n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->f5c > 1) {
|
if (info->f5c > 1) {
|
||||||
zt_error_print("dasdview: VTOC error\n"
|
zt_error_print("dasdview: VTOC error\n"
|
||||||
"More than one FMT5 DSCB!\n");
|
"More than one FMT5 DSCB!\n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->f7c > 1) {
|
if (info->f7c > 1) {
|
||||||
zt_error_print("dasdview: VTOC error\n"
|
zt_error_print("dasdview: VTOC error\n"
|
||||||
"More than one FMT7 DSCB!\n");
|
"More than one FMT7 DSCB!\n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -975,7 +975,7 @@ static void dasdview_print_format1_8_short_info_raw(format1_label_t *f1,
|
|||||||
}
|
}
|
||||||
if (rc) {
|
if (rc) {
|
||||||
zt_error_print("dasdview: Broken format 3 DSCB chain \n");
|
zt_error_print("dasdview: Broken format 3 DSCB chain \n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
f3 = (dscb && dscb->fmtid == 0xf3) ? (format3_label_t *)dscb : NULL;
|
f3 = (dscb && dscb->fmtid == 0xf3) ? (format3_label_t *)dscb : NULL;
|
||||||
|
|
||||||
@@ -990,7 +990,7 @@ static void dasdview_print_format1_8_short_info_raw(format1_label_t *f1,
|
|||||||
if (f3->DS3FMTID != 0xf3) {
|
if (f3->DS3FMTID != 0xf3) {
|
||||||
zt_error_print("dasdview: Broken format 3 DSCB"
|
zt_error_print("dasdview: Broken format 3 DSCB"
|
||||||
" chain \n");
|
" chain \n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
for (j = 0; j < 4; ++j)
|
for (j = 0; j < 4; ++j)
|
||||||
dasdview_print_short_info_extent_raw(&f3->DS3EXTNT[j]);
|
dasdview_print_short_info_extent_raw(&f3->DS3EXTNT[j]);
|
||||||
@@ -1002,7 +1002,7 @@ static void dasdview_print_format1_8_short_info_raw(format1_label_t *f1,
|
|||||||
if (rc) {
|
if (rc) {
|
||||||
zt_error_print("dasdview: Broken format 3 DSCB"
|
zt_error_print("dasdview: Broken format 3 DSCB"
|
||||||
" chain \n");
|
" chain \n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@@ -1025,7 +1025,7 @@ static void dasdview_print_vtoc_info_raw(dasdview_info_t *info)
|
|||||||
rc = lzds_raw_vtoc_alloc_dscbiterator(info->rawvtoc, &it);
|
rc = lzds_raw_vtoc_alloc_dscbiterator(info->rawvtoc, &it);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
zt_error_print("dasdview: could not allocate DSCB iterator \n");
|
zt_error_print("dasdview: could not allocate DSCB iterator \n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
while (!lzds_dscbiterator_get_next_dscb(it, &dscb)) {
|
while (!lzds_dscbiterator_get_next_dscb(it, &dscb)) {
|
||||||
if (dscb->fmtid == 0xf1)
|
if (dscb->fmtid == 0xf1)
|
||||||
@@ -1058,7 +1058,7 @@ static void dasdview_print_vtoc_info_raw(dasdview_info_t *info)
|
|||||||
rc = lzds_raw_vtoc_alloc_dscbiterator(info->rawvtoc, &it);
|
rc = lzds_raw_vtoc_alloc_dscbiterator(info->rawvtoc, &it);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
zt_error_print("dasdview: could not allocate DSCB iterator \n");
|
zt_error_print("dasdview: could not allocate DSCB iterator \n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
while (!lzds_dscbiterator_get_next_dscb(it, &dscb)) {
|
while (!lzds_dscbiterator_get_next_dscb(it, &dscb)) {
|
||||||
if (dscb->fmtid == 0xf1 || dscb->fmtid == 0xf8)
|
if (dscb->fmtid == 0xf1 || dscb->fmtid == 0xf8)
|
||||||
@@ -1739,23 +1739,23 @@ static void dasdview_print_vtoc_raw(dasdview_info_t *info)
|
|||||||
if (rc) {
|
if (rc) {
|
||||||
zt_error_print("error when reading label from device:"
|
zt_error_print("error when reading label from device:"
|
||||||
" rc=%d\n", rc);
|
" rc=%d\n", rc);
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
rc = lzds_dasd_alloc_rawvtoc(info->dasd);
|
rc = lzds_dasd_alloc_rawvtoc(info->dasd);
|
||||||
if (rc == EINVAL) {
|
if (rc == EINVAL) {
|
||||||
zt_error_print("dasdview: Cannot read VTOC because disk does"
|
zt_error_print("dasdview: Cannot read VTOC because disk does"
|
||||||
" not contain valid VOL1 label.\n",
|
" not contain valid VOL1 label.\n",
|
||||||
info->device);
|
info->device);
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
} else if (rc) {
|
} else if (rc) {
|
||||||
zt_error_print("error when reading vtoc from device:"
|
zt_error_print("error when reading vtoc from device:"
|
||||||
" rc=%d\n", rc);
|
" rc=%d\n", rc);
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
rc = lzds_dasd_get_rawvtoc(info->dasd, &info->rawvtoc);
|
rc = lzds_dasd_get_rawvtoc(info->dasd, &info->rawvtoc);
|
||||||
if (rc || !info->rawvtoc) {
|
if (rc || !info->rawvtoc) {
|
||||||
zt_error_print("dasdview: libvtoc could not read vtoc\n");
|
zt_error_print("dasdview: libvtoc could not read vtoc\n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->vtoc_info || info->vtoc_all)
|
if (info->vtoc_info || info->vtoc_all)
|
||||||
@@ -1764,7 +1764,7 @@ static void dasdview_print_vtoc_raw(dasdview_info_t *info)
|
|||||||
rc = lzds_raw_vtoc_alloc_dscbiterator(info->rawvtoc, &it);
|
rc = lzds_raw_vtoc_alloc_dscbiterator(info->rawvtoc, &it);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
zt_error_print("dasdview: could not allocate DSCB iterator\n");
|
zt_error_print("dasdview: could not allocate DSCB iterator\n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
while (!lzds_dscbiterator_get_next_dscb(it, &record))
|
while (!lzds_dscbiterator_get_next_dscb(it, &record))
|
||||||
dasdview_print_vtoc_dscb(info, record);
|
dasdview_print_vtoc_dscb(info, record);
|
||||||
@@ -1858,7 +1858,7 @@ static void dasdview_view_standard(dasdview_info_t *info)
|
|||||||
zt_error_print("dasdview: open error\n"
|
zt_error_print("dasdview: open error\n"
|
||||||
"Unable to open device %s in read-only mode!\n",
|
"Unable to open device %s in read-only mode!\n",
|
||||||
info->device);
|
info->device);
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = (info->begin / SEEK_STEP);
|
j = (info->begin / SEEK_STEP);
|
||||||
@@ -1877,7 +1877,7 @@ static void dasdview_view_standard(dasdview_info_t *info)
|
|||||||
zt_error_print("dasdview: seek error\n"
|
zt_error_print("dasdview: seek error\n"
|
||||||
"Unable to seek in device %s!\n",
|
"Unable to seek in device %s!\n",
|
||||||
info->device);
|
info->device);
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
b++;
|
b++;
|
||||||
a += SEEK_STEP;
|
a += SEEK_STEP;
|
||||||
@@ -1890,7 +1890,7 @@ static void dasdview_view_standard(dasdview_info_t *info)
|
|||||||
zt_error_print("dasdview: seek error\n"
|
zt_error_print("dasdview: seek error\n"
|
||||||
"Unable to seek in device %s!\n",
|
"Unable to seek in device %s!\n",
|
||||||
info->device);
|
info->device);
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1926,7 +1926,7 @@ static void dasdview_view_standard(dasdview_info_t *info)
|
|||||||
zt_error_print("dasdview: read error\n"
|
zt_error_print("dasdview: read error\n"
|
||||||
"Unable to read from device %s!\n",
|
"Unable to read from device %s!\n",
|
||||||
info->device);
|
info->device);
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->format1)
|
if (info->format1)
|
||||||
@@ -1945,7 +1945,7 @@ static void dasdview_view_standard(dasdview_info_t *info)
|
|||||||
zt_error_print("dasdview: read error\n"
|
zt_error_print("dasdview: read error\n"
|
||||||
"Unable to read from device %s!\n",
|
"Unable to read from device %s!\n",
|
||||||
info->device);
|
info->device);
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->format1)
|
if (info->format1)
|
||||||
@@ -2112,18 +2112,18 @@ static void dasdview_view_raw(dasdview_info_t *info)
|
|||||||
trackdata = memalign(4096, trckbuffsize * RAWTRACKSIZE);
|
trackdata = memalign(4096, trckbuffsize * RAWTRACKSIZE);
|
||||||
if (!trackdata) {
|
if (!trackdata) {
|
||||||
zt_error_print("failed to allocate memory\n");
|
zt_error_print("failed to allocate memory\n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
rc = lzds_dasd_alloc_dasdhandle(info->dasd, &dasdh);
|
rc = lzds_dasd_alloc_dasdhandle(info->dasd, &dasdh);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
zt_error_print("failed to allocate memory\n");
|
zt_error_print("failed to allocate memory\n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
rc = lzds_dasdhandle_open(dasdh);
|
rc = lzds_dasdhandle_open(dasdh);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
lzds_dasdhandle_free(dasdh);
|
lzds_dasdhandle_free(dasdh);
|
||||||
zt_error_print("failed to open device\n");
|
zt_error_print("failed to open device\n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
/* residual is the number of tracks we still have to read */
|
/* residual is the number of tracks we still have to read */
|
||||||
residual = tracks_to_read;
|
residual = tracks_to_read;
|
||||||
@@ -2135,7 +2135,7 @@ static void dasdview_view_raw(dasdview_info_t *info)
|
|||||||
trckend, trackdata);
|
trckend, trackdata);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
perror("Error on read");
|
perror("Error on read");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
data = trackdata;
|
data = trackdata;
|
||||||
for (i = 0; i < trckcount; ++i) {
|
for (i = 0; i < trckcount; ++i) {
|
||||||
@@ -2153,7 +2153,7 @@ static void dasdview_view_raw(dasdview_info_t *info)
|
|||||||
lzds_dasdhandle_free(dasdh);
|
lzds_dasdhandle_free(dasdh);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
perror("Error on closing file");
|
perror("Error on closing file");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2253,7 +2253,7 @@ int main(int argc, char *argv[])
|
|||||||
zt_error_print("dasdview: usage error\n"
|
zt_error_print("dasdview: usage error\n"
|
||||||
"%s is no valid argument for"
|
"%s is no valid argument for"
|
||||||
" option -t/--vtoc\n", optarg);
|
" option -t/--vtoc\n", optarg);
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
info.vtoc = 1;
|
info.vtoc = 1;
|
||||||
info.action_specified = 1;
|
info.action_specified = 1;
|
||||||
@@ -2301,13 +2301,13 @@ int main(int argc, char *argv[])
|
|||||||
rc = lzds_zdsroot_alloc(&info.zdsroot);
|
rc = lzds_zdsroot_alloc(&info.zdsroot);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
zt_error_print("Could not allocate index\n");
|
zt_error_print("Could not allocate index\n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
rc = lzds_zdsroot_add_device(info.zdsroot, info.device,
|
rc = lzds_zdsroot_add_device(info.zdsroot, info.device,
|
||||||
&info.dasd);
|
&info.dasd);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
zt_error_print("Could not add device to index\n");
|
zt_error_print("Could not add device to index\n");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2328,7 +2328,7 @@ int main(int argc, char *argv[])
|
|||||||
if (info.begin > max) {
|
if (info.begin > max) {
|
||||||
zt_error_print("dasdview: usage error\n"
|
zt_error_print("dasdview: usage error\n"
|
||||||
"'begin' value is not within disk range!");
|
"'begin' value is not within disk range!");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.size_specified)
|
if (info.size_specified)
|
||||||
@@ -2343,7 +2343,7 @@ int main(int argc, char *argv[])
|
|||||||
zt_error_print("dasdview: usage error\n"
|
zt_error_print("dasdview: usage error\n"
|
||||||
"'begin' + 'size' is not within "
|
"'begin' + 'size' is not within "
|
||||||
"disk range!");
|
"disk range!");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((info.begin_specified || info.size_specified) &&
|
if ((info.begin_specified || info.size_specified) &&
|
||||||
@@ -2355,7 +2355,7 @@ int main(int argc, char *argv[])
|
|||||||
zt_error_print("dasdview: usage error\n"
|
zt_error_print("dasdview: usage error\n"
|
||||||
"Options -1 or -2 make only sense with "
|
"Options -1 or -2 make only sense with "
|
||||||
"options -b or -s!");
|
"options -b or -s!");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* do the output */
|
/* do the output */
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
#define DASDVIEW_H
|
#define DASDVIEW_H
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include "lib/u2s.h"
|
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* SECTION: Definitions needed for DASD-API (see dasd.h)
|
* SECTION: Definitions needed for DASD-API (see dasd.h)
|
||||||
@@ -109,7 +108,7 @@ typedef struct dasdview_info
|
|||||||
int f8c;
|
int f8c;
|
||||||
int f9c;
|
int f9c;
|
||||||
|
|
||||||
char busid[U2S_BUS_ID_SIZE];
|
char busid[DASD_BUS_ID_SIZE];
|
||||||
int busid_valid;
|
int busid_valid;
|
||||||
int raw_track_access;
|
int raw_track_access;
|
||||||
struct zdsroot *zdsroot;
|
struct zdsroot *zdsroot;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ include ../common.mak
|
|||||||
libs = $(rootdir)/libvtoc/libvtoc.a \
|
libs = $(rootdir)/libvtoc/libvtoc.a \
|
||||||
$(rootdir)/libzds/libzds.a \
|
$(rootdir)/libzds/libzds.a \
|
||||||
$(rootdir)/libdasd/libdasd.a \
|
$(rootdir)/libdasd/libdasd.a \
|
||||||
$(rootdir)/libu2s/libu2s.a \
|
|
||||||
$(rootdir)/libutil/libutil.a
|
$(rootdir)/libutil/libutil.a
|
||||||
|
|
||||||
all: fdasd
|
all: fdasd
|
||||||
|
|||||||
@@ -397,7 +397,7 @@ static void fdasd_error(fdasd_anchor_t *anc, enum fdasd_failure why, char *str)
|
|||||||
fputc('\n', stderr);
|
fputc('\n', stderr);
|
||||||
fputs(err_str, stderr);
|
fputs(err_str, stderr);
|
||||||
|
|
||||||
fdasd_exit(anc, -1);
|
fdasd_exit(anc, EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -935,7 +935,7 @@ static void fdasd_verify_device(fdasd_anchor_t *anc, char *name)
|
|||||||
fdasd_error(anc, device_verification_failed, err_str);
|
fdasd_error(anc, device_verification_failed, err_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
count = u2s_get_host_access_count(name);
|
count = dasd_get_host_access_count(name);
|
||||||
if (anc->force_host) {
|
if (anc->force_host) {
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
snprintf(err_str, ERROR_STRING_SIZE,
|
snprintf(err_str, ERROR_STRING_SIZE,
|
||||||
@@ -3040,5 +3040,5 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,9 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
|
/* A bus id of a DASD is 8 characters long. E.g. 0.0.4711 */
|
||||||
|
#define DASD_BUS_ID_SIZE 9
|
||||||
|
|
||||||
typedef struct dasd_information2_t {
|
typedef struct dasd_information2_t {
|
||||||
unsigned int devno; /* S/390 devno */
|
unsigned int devno; /* S/390 devno */
|
||||||
unsigned int real_devno; /* for aliases */
|
unsigned int real_devno; /* for aliases */
|
||||||
@@ -51,6 +54,16 @@ typedef struct dasd_information2_t {
|
|||||||
unsigned int reserved7; /* reserved for further use ,... */
|
unsigned int reserved7; /* reserved for further use ,... */
|
||||||
} dasd_information2_t;
|
} dasd_information2_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
|
||||||
struct dasd_eckd_characteristics {
|
struct dasd_eckd_characteristics {
|
||||||
unsigned short cu_type;
|
unsigned short cu_type;
|
||||||
struct {
|
struct {
|
||||||
@@ -136,6 +149,16 @@ typedef struct format_data_t {
|
|||||||
unsigned int intensity;
|
unsigned int intensity;
|
||||||
} format_data_t;
|
} format_data_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* values to be used for format_data_t.intensity
|
||||||
|
*/
|
||||||
|
#define DASD_FMT_INT_FMT_R0 1 /* write record zero */
|
||||||
|
#define DASD_FMT_INT_FMT_HA 2 /* write home address, also set FMT_R0 ! */
|
||||||
|
#define DASD_FMT_INT_INVAL 4 /* invalidate tracks */
|
||||||
|
#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 */
|
||||||
|
#define DASD_FMT_INT_ESE_FULL 32 /* release space for entire volume */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* struct format_check_t
|
* struct format_check_t
|
||||||
* represents all data necessary to evaluate the format of
|
* represents all data necessary to evaluate the format of
|
||||||
@@ -154,6 +177,16 @@ typedef struct format_check_t {
|
|||||||
unsigned int key_length; /* Key length of first record in error */
|
unsigned int key_length; /* Key length of first record in error */
|
||||||
} format_check_t;
|
} 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
|
||||||
|
|
||||||
#ifndef __linux__
|
#ifndef __linux__
|
||||||
/* definition from hdreg.h */
|
/* definition from hdreg.h */
|
||||||
struct hd_geometry {
|
struct hd_geometry {
|
||||||
@@ -178,6 +211,8 @@ struct hd_geometry {
|
|||||||
#define BIODASDINFO2 _IOR(DASD_IOCTL_LETTER, 3, dasd_information2_t)
|
#define BIODASDINFO2 _IOR(DASD_IOCTL_LETTER, 3, dasd_information2_t)
|
||||||
/* #define BIODASDFORMAT _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */
|
/* #define BIODASDFORMAT _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */
|
||||||
#define BIODASDFMT _IOW(DASD_IOCTL_LETTER, 1, format_data_t)
|
#define BIODASDFMT _IOW(DASD_IOCTL_LETTER, 1, format_data_t)
|
||||||
|
/* Release Allocated Space */
|
||||||
|
#define BIODASDRAS _IOW(DASD_IOCTL_LETTER, 3, format_data_t)
|
||||||
/* Check device format according to format_data_t */
|
/* Check device format according to format_data_t */
|
||||||
#define BIODASDCHECKFMT _IOWR(DASD_IOCTL_LETTER, 2, format_check_t)
|
#define BIODASDCHECKFMT _IOWR(DASD_IOCTL_LETTER, 2, format_check_t)
|
||||||
|
|
||||||
@@ -201,6 +236,7 @@ int dasd_check_format(const char *device, format_check_t *p);
|
|||||||
int dasd_format_disk(int fd, format_data_t *p);
|
int dasd_format_disk(int fd, format_data_t *p);
|
||||||
int dasd_disk_disable(const char *device, int *fd);
|
int dasd_disk_disable(const char *device, int *fd);
|
||||||
int dasd_disk_enable(int fd);
|
int dasd_disk_enable(int fd);
|
||||||
|
int dasd_release_space(const char *device, format_data_t *r);
|
||||||
int dasd_get_blocksize(const char *device, unsigned int *blksize);
|
int dasd_get_blocksize(const char *device, unsigned int *blksize);
|
||||||
int dasd_get_blocksize_in_bytes(const char *device, unsigned long long *blksize);
|
int dasd_get_blocksize_in_bytes(const char *device, unsigned long long *blksize);
|
||||||
int dasd_get_geo(const char *device, struct hd_geometry *geo);
|
int dasd_get_geo(const char *device, struct hd_geometry *geo);
|
||||||
|
|||||||
@@ -13,9 +13,10 @@
|
|||||||
#define LIB_DASD_SYS_H
|
#define LIB_DASD_SYS_H
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "u2s.h"
|
|
||||||
|
|
||||||
int dasd_sys_raw_track_access(char *);
|
int dasd_sys_raw_track_access(char *);
|
||||||
|
int dasd_sys_ese(char *);
|
||||||
int dasd_reset_chpid(char *, char *);
|
int dasd_reset_chpid(char *, char *);
|
||||||
|
int dasd_get_host_access_count(char *device);
|
||||||
|
|
||||||
#endif /* LIB_DASD_SYS_H */
|
#endif /* LIB_DASD_SYS_H */
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright IBM Corp. 2004, 2017
|
|
||||||
*
|
|
||||||
* s390-tools is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the MIT license. See LICENSE for details.
|
|
||||||
*
|
|
||||||
* History of changes (starts July 2004)
|
|
||||||
* 2004-07-02 initial
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef LIB_U2S_H
|
|
||||||
#define LIB_U2S_H
|
|
||||||
|
|
||||||
#define U2S_BUS_ID_SIZE 32
|
|
||||||
|
|
||||||
int u2s_getbusid(char *, char *);
|
|
||||||
int u2s_read_attribute(char *, char *, char *, size_t);
|
|
||||||
int u2s_get_host_access_count(char *);
|
|
||||||
|
|
||||||
#endif /* LIB_U2S_H */
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
* @{
|
* @{
|
||||||
* @brief Work with paths
|
* @brief Work with paths
|
||||||
*
|
*
|
||||||
* Copyright IBM Corp. 2016, 2017
|
* Copyright IBM Corp. 2016, 2019
|
||||||
*
|
*
|
||||||
* s390-tools is free software; you can redistribute it and/or modify
|
* s390-tools is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
@@ -21,5 +21,7 @@ bool util_path_is_writable(const char *fmt, ...);
|
|||||||
bool util_path_is_dir(const char *fmt, ...);
|
bool util_path_is_dir(const char *fmt, ...);
|
||||||
bool util_path_is_reg_file(const char *fmt, ...);
|
bool util_path_is_reg_file(const char *fmt, ...);
|
||||||
bool util_path_exists(const char *fmt, ...);
|
bool util_path_exists(const char *fmt, ...);
|
||||||
|
bool util_path_is_readonly_file(const char *fmt, ...);
|
||||||
|
bool util_path_is_writeonly_file(const char *fmt, ...);
|
||||||
|
|
||||||
#endif /** LIB_UTIL_PATH_H @} */
|
#endif /** LIB_UTIL_PATH_H @} */
|
||||||
|
|||||||
17
include/lib/util_sys.h
Normal file
17
include/lib/util_sys.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* @defgroup util_sys_h util_sys: SysFS interface
|
||||||
|
* @{
|
||||||
|
* @brief Work with SysFS
|
||||||
|
*
|
||||||
|
* Copyright IBM Corp. 2019
|
||||||
|
*
|
||||||
|
* s390-tools is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LIB_UTIL_SYS_H
|
||||||
|
#define LIB_UTIL_SYS_H
|
||||||
|
|
||||||
|
int util_sys_get_dev_addr(const char *dev, char *addr);
|
||||||
|
|
||||||
|
#endif /** LIB_UTIL_SYS_H @} */
|
||||||
@@ -31,6 +31,8 @@
|
|||||||
#define __packed __attribute__((packed))
|
#define __packed __attribute__((packed))
|
||||||
#define __aligned(x) __attribute__((aligned(x)))
|
#define __aligned(x) __attribute__((aligned(x)))
|
||||||
#define __may_alias __attribute__((may_alias))
|
#define __may_alias __attribute__((may_alias))
|
||||||
|
#define __section(x) __attribute__((__section__(#x)))
|
||||||
|
#define __noinline __attribute__((__noinline__))
|
||||||
|
|
||||||
typedef unsigned long long u64;
|
typedef unsigned long long u64;
|
||||||
typedef signed long long s64;
|
typedef signed long long s64;
|
||||||
|
|||||||
@@ -146,9 +146,10 @@ int dasd_is_ro(const char *device, bool *ro)
|
|||||||
{
|
{
|
||||||
int fd, val;
|
int fd, val;
|
||||||
|
|
||||||
fd = dasd_open_device(device, O_RDWR);
|
fd = dasd_open_device(device, O_RDONLY);
|
||||||
RUN_IOCTL(fd, BLKROGET, &val);
|
RUN_IOCTL(fd, BLKROGET, &val);
|
||||||
*ro = (val != 0) ? true : false;
|
*ro = (val != 0) ? true : false;
|
||||||
|
dasd_close_device(fd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -228,6 +229,26 @@ int dasd_check_format(const char *device, format_check_t *p)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Release Allocated Space
|
||||||
|
*
|
||||||
|
* @param[in] fd device node's file descriptor
|
||||||
|
* @param[in] r format options
|
||||||
|
*
|
||||||
|
* @retval 0 in case of success
|
||||||
|
* @retval errno in case of failure
|
||||||
|
*/
|
||||||
|
int dasd_release_space(const char *device, format_data_t *r)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
fd = dasd_open_device(device, O_RDONLY);
|
||||||
|
RUN_IOCTL(fd, BIODASDRAS, r);
|
||||||
|
dasd_close_device(fd);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reread partition table
|
* Reread partition table
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -12,7 +12,11 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "lib/dasd_base.h"
|
||||||
#include "lib/dasd_sys.h"
|
#include "lib/dasd_sys.h"
|
||||||
|
#include "lib/util_file.h"
|
||||||
|
#include "lib/util_path.h"
|
||||||
|
#include "lib/util_sys.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get raw-track access mode status
|
* Get raw-track access mode status
|
||||||
@@ -31,19 +35,59 @@
|
|||||||
*/
|
*/
|
||||||
int dasd_sys_raw_track_access(char *devnode)
|
int dasd_sys_raw_track_access(char *devnode)
|
||||||
{
|
{
|
||||||
char busid[9];
|
char busid[DASD_BUS_ID_SIZE];
|
||||||
char path[47];
|
char *path;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (u2s_getbusid(devnode, busid))
|
if (util_sys_get_dev_addr(devnode, busid) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
sprintf(path, "/sys/bus/ccw/devices/%s/raw_track_access", busid);
|
path = util_path_sysfs("bus/ccw/devices/%s/raw_track_access", busid);
|
||||||
|
|
||||||
fp = fopen(path, "r");
|
fp = fopen(path, "r");
|
||||||
if (!fp)
|
if (!fp) {
|
||||||
|
free(path);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = fgetc(fp) - '0';
|
||||||
|
fclose(fp);
|
||||||
|
free(path);
|
||||||
|
|
||||||
|
return (rc == 1) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is volume extent space efficient a.k.a. thin-provisioned
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* @retval 1 Volume is extent space efficient
|
||||||
|
* @retval 0 Volume is not extent space efficient or
|
||||||
|
* cannot be determined
|
||||||
|
*/
|
||||||
|
int dasd_sys_ese(char *devnode)
|
||||||
|
{
|
||||||
|
char busid[DASD_BUS_ID_SIZE];
|
||||||
|
char *path;
|
||||||
|
FILE *fp;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if (util_sys_get_dev_addr(devnode, busid) != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
path = util_path_sysfs("bus/ccw/devices/%s/ese", busid);
|
||||||
|
fp = fopen(path, "r");
|
||||||
|
if (!fp) {
|
||||||
|
free(path);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
rc = fgetc(fp) - '0';
|
rc = fgetc(fp) - '0';
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@@ -51,19 +95,20 @@ int dasd_sys_raw_track_access(char *devnode)
|
|||||||
return (rc == 1) ? 1 : 0;
|
return (rc == 1) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int dasd_get_pm_from_chpid(char *busid, unsigned int chpid, int *mask)
|
int dasd_get_pm_from_chpid(char *busid, unsigned int chpid, int *mask)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
char path[40];
|
|
||||||
int count, i;
|
int count, i;
|
||||||
|
char *path;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
sprintf(path, "/sys/bus/ccw/devices/%s/../chpids", busid);
|
path = util_path_sysfs("bus/ccw/devices/%s/../chpids", busid);
|
||||||
*mask = 0;
|
*mask = 0;
|
||||||
fp = fopen(path, "r");
|
fp = fopen(path, "r");
|
||||||
if (!fp)
|
if (!fp) {
|
||||||
|
free(path);
|
||||||
return ENODEV;
|
return ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
count = fscanf(fp, " %x", &val);
|
count = fscanf(fp, " %x", &val);
|
||||||
@@ -75,6 +120,7 @@ int dasd_get_pm_from_chpid(char *busid, unsigned int chpid, int *mask)
|
|||||||
*mask = 0x80 >> i;
|
*mask = 0x80 >> i;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
free(path);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -102,22 +148,25 @@ int dasd_get_pm_from_chpid(char *busid, unsigned int chpid, int *mask)
|
|||||||
int dasd_reset_chpid(char *devnode, char *chpid_char)
|
int dasd_reset_chpid(char *devnode, char *chpid_char)
|
||||||
{
|
{
|
||||||
unsigned int chpid;
|
unsigned int chpid;
|
||||||
char path[41];
|
char busid[DASD_BUS_ID_SIZE];
|
||||||
char busid[9];
|
|
||||||
int mask, rc;
|
int mask, rc;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
|
char *path;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
if (u2s_getbusid(devnode, busid))
|
if (util_sys_get_dev_addr(devnode, busid) != 0)
|
||||||
return ENODEV;
|
return ENODEV;
|
||||||
|
|
||||||
if (!chpid_char) {
|
if (!chpid_char) {
|
||||||
sprintf(path, "/sys/bus/ccw/devices/%s/path_reset", busid);
|
path = util_path_sysfs("bus/ccw/devices/%s/path_reset", busid);
|
||||||
fp = fopen(path, "w");
|
fp = fopen(path, "w");
|
||||||
if (!fp)
|
if (!fp) {
|
||||||
|
free(path);
|
||||||
return ENODEV;
|
return ENODEV;
|
||||||
|
}
|
||||||
fprintf(fp, "%s", "all\n");
|
fprintf(fp, "%s", "all\n");
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
free(path);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,12 +181,45 @@ int dasd_reset_chpid(char *devnode, char *chpid_char)
|
|||||||
if (!mask)
|
if (!mask)
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
|
|
||||||
sprintf(path, "/sys/bus/ccw/devices/%s/path_reset", busid);
|
path = util_path_sysfs("bus/ccw/devices/%s/path_reset", busid);
|
||||||
fp = fopen(path, "w");
|
fp = fopen(path, "w");
|
||||||
if (!fp)
|
if (!fp) {
|
||||||
|
free(path);
|
||||||
return ENODEV;
|
return ENODEV;
|
||||||
|
}
|
||||||
fprintf(fp, "%02x", mask);
|
fprintf(fp, "%02x", mask);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
free(path);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read amount of host with access to \p device
|
||||||
|
*
|
||||||
|
* The \p device 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] device Device node of interest
|
||||||
|
*
|
||||||
|
* @retval n Number of hosts with access to \p device
|
||||||
|
* @retval 0 Value could not be determined
|
||||||
|
*/
|
||||||
|
int dasd_get_host_access_count(char *device)
|
||||||
|
{
|
||||||
|
char busid[DASD_BUS_ID_SIZE];
|
||||||
|
char *path;
|
||||||
|
long value;
|
||||||
|
|
||||||
|
if (!util_sys_get_dev_addr(device, busid))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
path = util_path_sysfs("bus/ccw/devices/%s/host_access_count", busid);
|
||||||
|
util_file_read_l(&value, 10, path);
|
||||||
|
free(path);
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
include ../common.mak
|
|
||||||
|
|
||||||
lib = libu2s.a
|
|
||||||
|
|
||||||
all: $(lib)
|
|
||||||
|
|
||||||
objects = u2s.o
|
|
||||||
|
|
||||||
$(lib): $(objects)
|
|
||||||
|
|
||||||
install: all
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.o $(lib)
|
|
||||||
334
libu2s/u2s.c
334
libu2s/u2s.c
@@ -1,334 +0,0 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright IBM Corp. 2004, 2017
|
|
||||||
*
|
|
||||||
* s390-tools is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the MIT license. See LICENSE for details.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/sysmacros.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <wait.h>
|
|
||||||
|
|
||||||
#include "lib/u2s.h"
|
|
||||||
#include "lib/util_libc.h"
|
|
||||||
|
|
||||||
#define DEV_BUFFER_LENGTH 20
|
|
||||||
#define PATH_BUFFER_LENGTH 256
|
|
||||||
#define BUSIDSIZE 9
|
|
||||||
|
|
||||||
#define BLOCKPATH "/sys/block/"
|
|
||||||
#define DEVICE_LINK "device"
|
|
||||||
#define DEV_ATTRIBUTE "dev"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Helper function that expects a file name and returns 1 if this
|
|
||||||
* is a directory or 0 otherwise.
|
|
||||||
*/
|
|
||||||
static int isdir(char *name) {
|
|
||||||
|
|
||||||
struct stat statbuf;
|
|
||||||
|
|
||||||
if (stat(name, &statbuf) < 0)
|
|
||||||
return 0;
|
|
||||||
return S_ISDIR(statbuf.st_mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Helper function that expects a directory name in sysfs of the form
|
|
||||||
* /sys/block/<devname>/ or /sys/block/<devname>/<partname>/.
|
|
||||||
* It will try to read the file "dev" in this directory and compare
|
|
||||||
* it's contents with the given dev string of the form <major>:<minor>.
|
|
||||||
* Trailing white space (newline) is ignored.
|
|
||||||
* The buffer name is expected to be long enough to hold the additional "dev".
|
|
||||||
* Returns 1 if the directory matches dev, 0 otherwise.
|
|
||||||
*/
|
|
||||||
static int check_directory(char *name, char *dev) {
|
|
||||||
|
|
||||||
char buffer[DEV_BUFFER_LENGTH];
|
|
||||||
char *end;
|
|
||||||
int fd;
|
|
||||||
ssize_t count;
|
|
||||||
int dev_attr_len, dev_parm_len;
|
|
||||||
unsigned int namelen;
|
|
||||||
|
|
||||||
namelen = strlen(name);
|
|
||||||
if ((PATH_BUFFER_LENGTH - namelen) < sizeof(DEV_ATTRIBUTE))
|
|
||||||
return 0;
|
|
||||||
end = name + namelen;
|
|
||||||
strcpy(end, DEV_ATTRIBUTE);
|
|
||||||
fd = open(name, O_RDONLY);
|
|
||||||
*end = 0;
|
|
||||||
if (fd < 0)
|
|
||||||
return 0;
|
|
||||||
count = read(fd, buffer, DEV_BUFFER_LENGTH);
|
|
||||||
close(fd);
|
|
||||||
if (count < 0)
|
|
||||||
return 0;
|
|
||||||
dev_attr_len = strspn(buffer, "1234567890:");
|
|
||||||
dev_parm_len = strlen(dev);
|
|
||||||
if (dev_attr_len != dev_parm_len )
|
|
||||||
return 0;
|
|
||||||
return (strncmp(dev, buffer, dev_parm_len) == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Helper function that expects a directory name in sysfs of the form
|
|
||||||
* /sys/block/<devname>/. It will try to read a link "device"
|
|
||||||
* in this directory and extract the busid, which is the last part
|
|
||||||
* of that link. The buffer name is expected to be long enough
|
|
||||||
* to hold the additional "device".
|
|
||||||
* name: block device path in sysfs.
|
|
||||||
* busid: buffer in which the busid string will be returned
|
|
||||||
* returns 0 for successful operation and -1 in case of an error.
|
|
||||||
*/
|
|
||||||
static int extract_busid(char *name, char *busid) {
|
|
||||||
|
|
||||||
int count;
|
|
||||||
unsigned int namelen;
|
|
||||||
char linkbuffer[PATH_BUFFER_LENGTH];
|
|
||||||
char *start, *end;
|
|
||||||
size_t len;
|
|
||||||
|
|
||||||
namelen = strlen(name);
|
|
||||||
if ((PATH_BUFFER_LENGTH - namelen) < sizeof(DEVICE_LINK))
|
|
||||||
return 0;
|
|
||||||
end = name + namelen;
|
|
||||||
strcpy(end, DEVICE_LINK);
|
|
||||||
count = readlink(name, linkbuffer, PATH_BUFFER_LENGTH - 1);
|
|
||||||
if (count < 0)
|
|
||||||
return -1;
|
|
||||||
linkbuffer[count] = 0;
|
|
||||||
start = strrchr(linkbuffer, '/');
|
|
||||||
if (!start)
|
|
||||||
return -1;
|
|
||||||
start++;
|
|
||||||
len = util_strlcpy(busid, start, BUSIDSIZE);
|
|
||||||
if (len >= BUSIDSIZE)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Helper function that makes some basic checks on a directory entry.
|
|
||||||
* The function checks if there is still enough space left in the buffer
|
|
||||||
* for the new string, excludes '.' and '..', and verifies that the entry
|
|
||||||
* is actually a directory.
|
|
||||||
* buffer: the beginning of the name buffer
|
|
||||||
* oldend: the current end of the string in the name buffer
|
|
||||||
* dir: the dirent in question
|
|
||||||
* returns: a pointer to the new end of the string in buffer or NULL if
|
|
||||||
* one of the checks failed
|
|
||||||
*/
|
|
||||||
|
|
||||||
static char *append_if_directory(char *buffer, char *oldend, struct dirent *dir) {
|
|
||||||
|
|
||||||
char *newend;
|
|
||||||
int oldlength, dirlength;
|
|
||||||
|
|
||||||
if (strcmp(dir->d_name, ".") == 0 ||
|
|
||||||
strcmp(dir->d_name, "..") == 0)
|
|
||||||
return NULL;
|
|
||||||
oldlength = strlen(buffer);
|
|
||||||
dirlength = strlen(dir->d_name);
|
|
||||||
if (PATH_BUFFER_LENGTH < oldlength + dirlength + 2)
|
|
||||||
return NULL;
|
|
||||||
strcpy(oldend, dir->d_name);
|
|
||||||
if (!isdir(buffer)) {
|
|
||||||
*oldend = 0;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
newend = oldend + dirlength;
|
|
||||||
strcpy(newend, "/");
|
|
||||||
newend++;
|
|
||||||
|
|
||||||
return newend;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* helper function that searches for a specific block device and returns
|
|
||||||
* it's busid
|
|
||||||
* dev: <major>:<minor> of the device
|
|
||||||
* busid: buffer in which the busid string will be returned
|
|
||||||
* returns 0 for successful operation and -1 in case of an error.
|
|
||||||
*/
|
|
||||||
static int find_busid_in_sysfs(char *dev, char *busid) {
|
|
||||||
|
|
||||||
DIR *blockdir, *diskdir;
|
|
||||||
struct dirent *blockde, *diskde;
|
|
||||||
int found = 0;
|
|
||||||
char namebuffer[PATH_BUFFER_LENGTH];
|
|
||||||
char *blockend, *diskend = NULL, *partend;
|
|
||||||
|
|
||||||
/* everything, including the other helper functions, works on the
|
|
||||||
* same buffer area 'namebuffer'. The pointers blockend, diskend
|
|
||||||
* and partend point to the end of the various names.
|
|
||||||
* Example:
|
|
||||||
* "/sys/block/dasda/dasda1/"
|
|
||||||
* ^ blockend
|
|
||||||
* ^ diskend
|
|
||||||
* ^ partend
|
|
||||||
*/
|
|
||||||
|
|
||||||
strcpy(namebuffer,BLOCKPATH);
|
|
||||||
blockdir = opendir(namebuffer);
|
|
||||||
if (!blockdir)
|
|
||||||
return -1;
|
|
||||||
blockend = namebuffer + strlen(namebuffer);
|
|
||||||
/* check each entry in /sys/block */
|
|
||||||
while ((blockde = readdir(blockdir))) {
|
|
||||||
diskend = append_if_directory(namebuffer, blockend, blockde);
|
|
||||||
if (!diskend)
|
|
||||||
continue;
|
|
||||||
found = check_directory(namebuffer, dev);
|
|
||||||
if (found)
|
|
||||||
break;
|
|
||||||
diskdir = opendir(namebuffer);
|
|
||||||
if (!diskdir)
|
|
||||||
continue;
|
|
||||||
/* check each entry in /sys/block/<disk name> */
|
|
||||||
while ((diskde = readdir(diskdir))) {
|
|
||||||
partend = append_if_directory(
|
|
||||||
namebuffer, diskend, diskde);
|
|
||||||
if (!partend)
|
|
||||||
continue;
|
|
||||||
found = check_directory(namebuffer, dev);
|
|
||||||
if (found)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
closedir(diskdir);
|
|
||||||
if (found)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
closedir(blockdir);
|
|
||||||
if (found) {
|
|
||||||
*diskend = 0; /* remove partition directory from name */
|
|
||||||
return extract_busid(namebuffer, busid);
|
|
||||||
} else
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* helper function that searches for a specific block device in
|
|
||||||
* /proc/dasd/devices and returns it's bus-ID
|
|
||||||
* maja, mina: <major>, <minor> of the device
|
|
||||||
* busid: buffer in which the bus-ID string will be returned
|
|
||||||
* returns 0 for successful operation and -1 in case of an error
|
|
||||||
* e.g. /proc/dasd/devices does not exist.
|
|
||||||
*
|
|
||||||
* An entry looks like:
|
|
||||||
* 0.0.XXXX(DISCIPLINE) at ( MAJ: MIN) is dasdX :
|
|
||||||
* active at blocksize: BLOCKSIZE, BLOCKS blocks, SIZE MB
|
|
||||||
*/
|
|
||||||
static int find_busid_in_proc(int maja, int mina, char *busid)
|
|
||||||
{
|
|
||||||
FILE *filp;
|
|
||||||
char bus[BUSIDSIZE];
|
|
||||||
int majb, minb, rc;
|
|
||||||
size_t len;
|
|
||||||
|
|
||||||
rc = -1;
|
|
||||||
|
|
||||||
filp = fopen("/proc/dasd/devices", "r");
|
|
||||||
if (!filp)
|
|
||||||
return rc;
|
|
||||||
while (fscanf(filp, "%[^(] %*[^)] ) at ( %d : %d %*[^\n]\n",
|
|
||||||
bus, &majb, &minb) != EOF) {
|
|
||||||
if ((maja == majb) && (mina == minb)) {
|
|
||||||
len = util_strlcpy(busid, bus, BUSIDSIZE);
|
|
||||||
if (len < BUSIDSIZE)
|
|
||||||
rc = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(filp);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return the busid of a given device node.
|
|
||||||
* Works only for block devices.
|
|
||||||
* devicenode: path to the device node
|
|
||||||
* busid: buffer in which the busid string will be returned
|
|
||||||
* returns 0 for successful operation and -1 in case of an error.
|
|
||||||
*/
|
|
||||||
int u2s_getbusid(char *devicenode, char *busid)
|
|
||||||
{
|
|
||||||
int maj, min, rc;
|
|
||||||
struct stat stat_buf;
|
|
||||||
char dev_string[DEV_BUFFER_LENGTH];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get major and minor information of the device special file
|
|
||||||
* and combine them to a <maj>:<min> string, as returned by
|
|
||||||
* the dev attributes in sysfs
|
|
||||||
*/
|
|
||||||
if (stat(devicenode, &stat_buf))
|
|
||||||
return -1;
|
|
||||||
if (!S_ISBLK(stat_buf.st_mode))
|
|
||||||
return -1;
|
|
||||||
maj = major(stat_buf.st_rdev);
|
|
||||||
min = minor(stat_buf.st_rdev);
|
|
||||||
|
|
||||||
rc = find_busid_in_proc(maj, min, busid);
|
|
||||||
if (rc) {
|
|
||||||
snprintf(dev_string, DEV_BUFFER_LENGTH, "%u:%u", maj, min);
|
|
||||||
rc = find_busid_in_sysfs(dev_string, busid);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
@@ -27,7 +27,8 @@ objects = util_base.o \
|
|||||||
util_part.o \
|
util_part.o \
|
||||||
util_prg.o \
|
util_prg.o \
|
||||||
util_proc.o \
|
util_proc.o \
|
||||||
util_rec.o
|
util_rec.o \
|
||||||
|
util_sys.o
|
||||||
|
|
||||||
util_base_example: util_base_example.o $(lib)
|
util_base_example: util_base_example.o $(lib)
|
||||||
util_panic_example: util_panic_example.o $(lib)
|
util_panic_example: util_panic_example.o $(lib)
|
||||||
|
|||||||
@@ -112,6 +112,12 @@ int main(int argc, char *argv[])
|
|||||||
case OPT_NOSHORT:
|
case OPT_NOSHORT:
|
||||||
printf("Specified: --noshort\n");
|
printf("Specified: --noshort\n");
|
||||||
break;
|
break;
|
||||||
|
case 'l':
|
||||||
|
printf("Specified: -l\n");
|
||||||
|
break;
|
||||||
|
case 'm':
|
||||||
|
printf("Specified: --manual\n");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
util_opt_print_parse_error(c, argv);
|
util_opt_print_parse_error(c, argv);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|||||||
@@ -15,10 +15,10 @@
|
|||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#include "lib/zt_common.h"
|
||||||
#include "lib/util_panic.h"
|
#include "lib/util_panic.h"
|
||||||
|
|
||||||
/* Make functions noinline to have a nice backtrace */
|
/* Make functions noinline to have a nice backtrace */
|
||||||
#define __noinline __attribute__((noinline))
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test util_panic()
|
* Test util_panic()
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Work with paths
|
* Work with paths
|
||||||
*
|
*
|
||||||
* Copyright IBM Corp. 2016, 2017
|
* Copyright IBM Corp. 2016, 2019
|
||||||
*
|
*
|
||||||
* s390-tools is free software; you can redistribute it and/or modify
|
* s390-tools is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
@@ -107,7 +107,7 @@ bool util_path_is_readable(const char *fmt, ...)
|
|||||||
bool rc;
|
bool rc;
|
||||||
|
|
||||||
UTIL_VASPRINTF(&path, fmt, ap);
|
UTIL_VASPRINTF(&path, fmt, ap);
|
||||||
rc = access(path, R_OK) == 0 ? true : false;
|
rc = access(path, R_OK) == 0;
|
||||||
free(path);
|
free(path);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@@ -131,7 +131,7 @@ bool util_path_is_writable(const char *fmt, ...)
|
|||||||
bool rc;
|
bool rc;
|
||||||
|
|
||||||
UTIL_VASPRINTF(&path, fmt, ap);
|
UTIL_VASPRINTF(&path, fmt, ap);
|
||||||
rc = access(path, W_OK) == 0 ? true : false;
|
rc = access(path, W_OK) == 0;
|
||||||
free(path);
|
free(path);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@@ -150,18 +150,14 @@ bool util_path_is_writable(const char *fmt, ...)
|
|||||||
*/
|
*/
|
||||||
bool util_path_is_reg_file(const char *fmt, ...)
|
bool util_path_is_reg_file(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
bool rc = false;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char *path;
|
char *path;
|
||||||
bool rc;
|
|
||||||
|
|
||||||
UTIL_VASPRINTF(&path, fmt, ap);
|
UTIL_VASPRINTF(&path, fmt, ap);
|
||||||
if (stat(path, &sb)) {
|
if (stat(path, &sb) == 0)
|
||||||
rc = false;
|
rc = S_ISREG(sb.st_mode);
|
||||||
goto free_str;
|
|
||||||
}
|
|
||||||
rc = (sb.st_mode & S_IFREG) ? true : false;
|
|
||||||
free_str:
|
|
||||||
free(path);
|
free(path);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@@ -179,18 +175,14 @@ free_str:
|
|||||||
*/
|
*/
|
||||||
bool util_path_is_dir(const char *fmt, ...)
|
bool util_path_is_dir(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
bool rc = false;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char *path;
|
char *path;
|
||||||
bool rc;
|
|
||||||
|
|
||||||
UTIL_VASPRINTF(&path, fmt, ap);
|
UTIL_VASPRINTF(&path, fmt, ap);
|
||||||
if (stat(path, &sb)) {
|
if (stat(path, &sb) == 0)
|
||||||
rc = false;
|
rc = S_ISDIR(sb.st_mode);
|
||||||
goto free_str;
|
|
||||||
}
|
|
||||||
rc = (sb.st_mode & S_IFDIR) ? true : false;
|
|
||||||
free_str:
|
|
||||||
free(path);
|
free(path);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@@ -213,7 +205,62 @@ bool util_path_exists(const char *fmt, ...)
|
|||||||
bool rc;
|
bool rc;
|
||||||
|
|
||||||
UTIL_VASPRINTF(&path, fmt, ap);
|
UTIL_VASPRINTF(&path, fmt, ap);
|
||||||
rc = access(path, F_OK) == 0 ? true : false;
|
rc = access(path, F_OK) == 0;
|
||||||
free(path);
|
free(path);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if path exists, is a regular file, and permission is read-only
|
||||||
|
*
|
||||||
|
* @param[in] fmt Format string for path to test
|
||||||
|
* @param[in] ... Variable arguments for format string
|
||||||
|
*
|
||||||
|
* @returns true Path exists, is a regular file, and permission does
|
||||||
|
* not allow any write but allows read
|
||||||
|
* false Otherwise
|
||||||
|
*/
|
||||||
|
bool util_path_is_readonly_file(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
bool rc = false;
|
||||||
|
struct stat sb;
|
||||||
|
va_list ap;
|
||||||
|
char *path;
|
||||||
|
|
||||||
|
UTIL_VASPRINTF(&path, fmt, ap);
|
||||||
|
if (stat(path, &sb) == 0) {
|
||||||
|
rc = S_ISREG(sb.st_mode) &&
|
||||||
|
(sb.st_mode & 0222) == 0 &&
|
||||||
|
(sb.st_mode & 0444) != 0;
|
||||||
|
}
|
||||||
|
free(path);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if path exists, is a regular file, and permission is write-only
|
||||||
|
*
|
||||||
|
* @param[in] fmt Format string for path to test
|
||||||
|
* @param[in] ... Variable arguments for format string
|
||||||
|
*
|
||||||
|
* @returns true Path exists, is a regular file, and permission does
|
||||||
|
* not allow any read but allows write
|
||||||
|
* false Otherwise
|
||||||
|
*/
|
||||||
|
bool util_path_is_writeonly_file(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
bool rc = false;
|
||||||
|
struct stat sb;
|
||||||
|
va_list ap;
|
||||||
|
char *path;
|
||||||
|
|
||||||
|
UTIL_VASPRINTF(&path, fmt, ap);
|
||||||
|
if (stat(path, &sb) == 0) {
|
||||||
|
rc = S_ISREG(sb.st_mode) &&
|
||||||
|
(sb.st_mode & 0222) != 0 &&
|
||||||
|
(sb.st_mode & 0444) == 0;
|
||||||
|
}
|
||||||
|
free(path);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* util_path_example - Example program for util_path
|
* util_path_example - Example program for util_path
|
||||||
*
|
*
|
||||||
* Copyright IBM Corp. 2016, 2017
|
* Copyright IBM Corp. 2016, 2019
|
||||||
*
|
*
|
||||||
* s390-tools is free software; you can redistribute it and/or modify
|
* s390-tools is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include "lib/util_path.h"
|
#include "lib/util_path.h"
|
||||||
#include "lib/util_prg.h"
|
#include "lib/util_prg.h"
|
||||||
@@ -26,7 +27,7 @@ const struct util_prg prg = {
|
|||||||
{
|
{
|
||||||
.owner = "IBM Corp.",
|
.owner = "IBM Corp.",
|
||||||
.pub_first = 2001,
|
.pub_first = 2001,
|
||||||
.pub_last = 2017,
|
.pub_last = 2019,
|
||||||
},
|
},
|
||||||
UTIL_PRG_COPYRIGHT_END
|
UTIL_PRG_COPYRIGHT_END
|
||||||
}
|
}
|
||||||
@@ -72,9 +73,17 @@ static void test_path(const char *path)
|
|||||||
else
|
else
|
||||||
printf("reg_file=no ");
|
printf("reg_file=no ");
|
||||||
if (util_path_is_dir(path))
|
if (util_path_is_dir(path))
|
||||||
printf("dir=yes");
|
printf("dir=yes ");
|
||||||
else
|
else
|
||||||
printf("dir=no ");
|
printf("dir=no ");
|
||||||
|
if (util_path_is_readonly_file(path))
|
||||||
|
printf("read-only_file=yes ");
|
||||||
|
else
|
||||||
|
printf("read-only_file=no ");
|
||||||
|
if (util_path_is_writeonly_file(path))
|
||||||
|
printf("write-only_file=yes");
|
||||||
|
else
|
||||||
|
printf("write-only_file=no ");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
77
libutil/util_sys.c
Normal file
77
libutil/util_sys.c
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
* util - Utility function library
|
||||||
|
*
|
||||||
|
* SysFS helper functions
|
||||||
|
*
|
||||||
|
* Copyright IBM Corp. 2019
|
||||||
|
*
|
||||||
|
* s390-tools is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <err.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/sysmacros.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "lib/util_path.h"
|
||||||
|
#include "lib/util_sys.h"
|
||||||
|
|
||||||
|
/* lstat() doesn't work for sysfs files, a fixed size is therefore inevitable */
|
||||||
|
#define READLINK_SIZE 256
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identify device address
|
||||||
|
*
|
||||||
|
* Identifying the device address with this function works for almost any
|
||||||
|
* character and block device (e.g. NVMe, SCSI, DASD, etc).
|
||||||
|
* The user must provide a buffer that is large enough for the desired device
|
||||||
|
* address to be read into \p addr.
|
||||||
|
*
|
||||||
|
* @param[in] dev Device node of interest
|
||||||
|
* @param[out] addr Identified device address
|
||||||
|
*
|
||||||
|
* @retval 0 Success
|
||||||
|
* @retval -1 Error while reading device information or
|
||||||
|
* constructed path
|
||||||
|
*/
|
||||||
|
int util_sys_get_dev_addr(const char *dev, char *addr)
|
||||||
|
{
|
||||||
|
char device[READLINK_SIZE], *result;
|
||||||
|
unsigned int maj, min;
|
||||||
|
struct stat s;
|
||||||
|
ssize_t len;
|
||||||
|
char *path;
|
||||||
|
|
||||||
|
if (stat(dev, &s) != 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
maj = major(s.st_rdev);
|
||||||
|
min = minor(s.st_rdev);
|
||||||
|
|
||||||
|
if (S_ISBLK(s.st_mode))
|
||||||
|
path = util_path_sysfs("dev/block/%u:%u/device", maj, min);
|
||||||
|
else if (S_ISCHR(s.st_mode))
|
||||||
|
path = util_path_sysfs("dev/char/%u:%u/device", maj, min);
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
len = readlink(path, device, READLINK_SIZE - 1);
|
||||||
|
free(path);
|
||||||
|
if (len != -1)
|
||||||
|
device[len] = '\0';
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
result = strrchr(device, '/');
|
||||||
|
if (result)
|
||||||
|
result++;
|
||||||
|
else
|
||||||
|
result = device;
|
||||||
|
strcpy(addr, result);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -20,8 +20,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "lib/dasd_base.h"
|
#include "lib/dasd_base.h"
|
||||||
|
#include "lib/dasd_sys.h"
|
||||||
#include "lib/libzds.h"
|
#include "lib/libzds.h"
|
||||||
#include "lib/u2s.h"
|
|
||||||
#include "lib/vtoc.h"
|
#include "lib/vtoc.h"
|
||||||
|
|
||||||
/** @cond PRIVATE */
|
/** @cond PRIVATE */
|
||||||
@@ -3701,7 +3701,7 @@ int lzds_analyse_open_count(struct zdsroot *root, int warn)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
util_list_iterate(root->dasdlist, dasd) {
|
util_list_iterate(root->dasdlist, dasd) {
|
||||||
value = u2s_get_host_access_count(dasd->device);
|
value = dasd_get_host_access_count(dasd->device);
|
||||||
|
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ pxelinux.initramfs: $(BBINSTALL)
|
|||||||
$(BUSYBOX)/_install:
|
$(BUSYBOX)/_install:
|
||||||
wget https://busybox.net/downloads/$(BUSYBOX).tar.bz2
|
wget https://busybox.net/downloads/$(BUSYBOX).tar.bz2
|
||||||
tar xjf $(BUSYBOX).tar.bz2
|
tar xjf $(BUSYBOX).tar.bz2
|
||||||
make -C $(BUSYBOX) defconfig
|
$(MAKE) -C $(BUSYBOX) defconfig
|
||||||
make -C $(BUSYBOX) install
|
$(MAKE) -C $(BUSYBOX) install
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
|
||||||
|
|||||||
@@ -173,6 +173,12 @@ readonly OUTPUT_FILE_LSOF="${WORKPATH}open_files.out"
|
|||||||
# File that includes content of OSA OAT
|
# File that includes content of OSA OAT
|
||||||
readonly OUTPUT_FILE_OSAOAT="${WORKPATH}osa_oat"
|
readonly OUTPUT_FILE_OSAOAT="${WORKPATH}osa_oat"
|
||||||
|
|
||||||
|
# File that includes content of Ethtool commands
|
||||||
|
readonly OUTPUT_FILE_ETHTOOL="${WORKPATH}ethtool.out"
|
||||||
|
|
||||||
|
# File that includes content of tc commands
|
||||||
|
readonly OUTPUT_FILE_TC="${WORKPATH}tc.out"
|
||||||
|
|
||||||
# File that includes the output of journalctl
|
# File that includes the output of journalctl
|
||||||
readonly OUTPUT_FILE_JOURNALCTL="${WORKPATH}journalctl.out"
|
readonly OUTPUT_FILE_JOURNALCTL="${WORKPATH}journalctl.out"
|
||||||
|
|
||||||
@@ -192,7 +198,7 @@ readonly OUTPUT_FILE_NVME="${WORKPATH}nvme.out"
|
|||||||
readonly MOUNT_POINT_DEBUGFS="/sys/kernel/debug"
|
readonly MOUNT_POINT_DEBUGFS="/sys/kernel/debug"
|
||||||
|
|
||||||
# The amount of steps running the whole collections
|
# The amount of steps running the whole collections
|
||||||
readonly COLLECTION_COUNT=12
|
readonly COLLECTION_COUNT=14
|
||||||
|
|
||||||
# The kernel version (e.g. '2' from 2.6.32 or '3' from 3.2.1)
|
# 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)
|
readonly KERNEL_VERSION=$(uname -r 2>/dev/null | cut -d'.' -f1)
|
||||||
@@ -371,7 +377,7 @@ CONFIGFILES="\
|
|||||||
$(find /lib/modules -name modules.dep 2>/dev/null)\
|
$(find /lib/modules -name modules.dep 2>/dev/null)\
|
||||||
/etc/docker\
|
/etc/docker\
|
||||||
/lib/systemd/system/docker.service\
|
/lib/systemd/system/docker.service\
|
||||||
/usr/lib/systemd/system/docker.service\
|
/usr/lib/systemd/system\
|
||||||
/etc/apparmor.d\
|
/etc/apparmor.d\
|
||||||
"
|
"
|
||||||
|
|
||||||
@@ -398,6 +404,7 @@ CMDS="uname -a\
|
|||||||
:ip link show\
|
:ip link show\
|
||||||
:ip ntable\
|
:ip ntable\
|
||||||
:ip a sh\
|
:ip a sh\
|
||||||
|
:ip -s -s link\
|
||||||
:firewall-cmd --list-all\
|
:firewall-cmd --list-all\
|
||||||
:ipcs -a\
|
:ipcs -a\
|
||||||
:netstat -pantu\
|
:netstat -pantu\
|
||||||
@@ -456,7 +463,7 @@ CMDS="uname -a\
|
|||||||
:java -version\
|
:java -version\
|
||||||
:cat /root/.bash_history\
|
:cat /root/.bash_history\
|
||||||
:env\
|
:env\
|
||||||
:journalctl --all --no-pager --since=$(date -d '5 day ago' +%Y-%m-%d) --until=now --lines=50000 \
|
:journalctl --all --no-pager --lines=100000 --output=short-precise\
|
||||||
> '${OUTPUT_FILE_JOURNALCTL}'\
|
> '${OUTPUT_FILE_JOURNALCTL}'\
|
||||||
:openssl engine\
|
:openssl engine\
|
||||||
:systemd-delta\
|
:systemd-delta\
|
||||||
@@ -470,6 +477,10 @@ CMDS="uname -a\
|
|||||||
:docker version\
|
:docker version\
|
||||||
:docker stats --no-stream\
|
:docker stats --no-stream\
|
||||||
:systemctl status docker.service\
|
:systemctl status docker.service\
|
||||||
|
:blockdev --report\
|
||||||
|
:lvdisplay\
|
||||||
|
:lspci -vv\
|
||||||
|
:smc_dbg\
|
||||||
"
|
"
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
@@ -554,6 +565,11 @@ collect_cmdsout() {
|
|||||||
done
|
done
|
||||||
IFS="${ifs_orig}"
|
IFS="${ifs_orig}"
|
||||||
|
|
||||||
|
if echo "${RUNTIME_ENVIRONMENT}" | grep -qi "z/VM" >/dev/null 2>&1; then
|
||||||
|
call_run_command "hyptop -b -d 1 -n 5 -f \#,c,m,C:s,M:s,o -S c" "${OUTPUT_FILE_CMD}"
|
||||||
|
else call_run_command "hyptop -b -d 1 -n 5 -f \#,T,c,e,m,C:s,E:s,M:s,o -S c" "${OUTPUT_FILE_CMD}"
|
||||||
|
fi
|
||||||
|
|
||||||
pr_log_stdout " "
|
pr_log_stdout " "
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -748,6 +764,59 @@ collect_osaoat() {
|
|||||||
pr_log_stdout " "
|
pr_log_stdout " "
|
||||||
}
|
}
|
||||||
|
|
||||||
|
########################################
|
||||||
|
collect_ethtool() {
|
||||||
|
local network_devices
|
||||||
|
local network_device
|
||||||
|
|
||||||
|
network_devices=$(ls /sys/class/net 2>/dev/null)
|
||||||
|
if which ethtool >/dev/null 2>&1; then
|
||||||
|
if test -n "${network_devices}"; then
|
||||||
|
pr_syslog_stdout "8 of ${COLLECTION_COUNT}: Collecting ethtool output"
|
||||||
|
for network_device in ${network_devices}; do
|
||||||
|
call_run_command "ethtool ${network_device}" "${OUTPUT_FILE_ETHTOOL}"
|
||||||
|
call_run_command "ethtool -k ${network_device}" "${OUTPUT_FILE_ETHTOOL}"
|
||||||
|
call_run_command "ethtool -a ${network_device}" "${OUTPUT_FILE_ETHTOOL}"
|
||||||
|
call_run_command "ethtool -c ${network_device}" "${OUTPUT_FILE_ETHTOOL}"
|
||||||
|
call_run_command "ethtool -g ${network_device}" "${OUTPUT_FILE_ETHTOOL}"
|
||||||
|
call_run_command "ethtool -i ${network_device}" "${OUTPUT_FILE_ETHTOOL}"
|
||||||
|
call_run_command "ethtool -l ${network_device}" "${OUTPUT_FILE_ETHTOOL}"
|
||||||
|
call_run_command "ethtool -P ${network_device}" "${OUTPUT_FILE_ETHTOOL}"
|
||||||
|
call_run_command "ethtool -S ${network_device}" "${OUTPUT_FILE_ETHTOOL}"
|
||||||
|
call_run_command "ethtool -T ${network_device}" "${OUTPUT_FILE_ETHTOOL}"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
pr_syslog_stdout "8 of ${COLLECTION_COUNT}: Collecting ethtool output skipped - no devices"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
pr_syslog_stdout "8 of ${COLLECTION_COUNT}: Collecting ethtool output skipped - not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
pr_log_stdout " "
|
||||||
|
}
|
||||||
|
|
||||||
|
########################################
|
||||||
|
collect_tc() {
|
||||||
|
local network_devices
|
||||||
|
local network_device
|
||||||
|
|
||||||
|
network_devices=$(ls /sys/class/net 2>/dev/null)
|
||||||
|
if which tc >/dev/null 2>&1; then
|
||||||
|
if test -n "${network_devices}"; then
|
||||||
|
pr_syslog_stdout "9 of ${COLLECTION_COUNT}: Collecting tc output"
|
||||||
|
for network_device in ${network_devices}; do
|
||||||
|
call_run_command "tc -s qdisc show dev ${network_device}" "${OUTPUT_FILE_TC}"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
pr_syslog_stdout "9 of ${COLLECTION_COUNT}: Collecting tc output skipped - no devices"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
pr_syslog_stdout "9 of ${COLLECTION_COUNT}: Collecting tc output skipped - not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
pr_log_stdout " "
|
||||||
|
}
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
# OpenVSwitch
|
# OpenVSwitch
|
||||||
collect_ovs() {
|
collect_ovs() {
|
||||||
@@ -764,7 +833,7 @@ collect_ovs() {
|
|||||||
:ovsdb-client dump\
|
:ovsdb-client dump\
|
||||||
"
|
"
|
||||||
if test -n "${br_list}"; then
|
if test -n "${br_list}"; then
|
||||||
pr_syslog_stdout "8 of ${COLLECTION_COUNT}: Collecting OpenVSwitch output"
|
pr_syslog_stdout "10 of ${COLLECTION_COUNT}: Collecting OpenVSwitch output"
|
||||||
IFS=:
|
IFS=:
|
||||||
for ovscmd in ${ovscmds}; do
|
for ovscmd in ${ovscmds}; do
|
||||||
IFS=${ifs_orig} call_run_command "${ovscmd}" "${OUTPUT_FILE_OVS}.out"
|
IFS=${ifs_orig} call_run_command "${ovscmd}" "${OUTPUT_FILE_OVS}.out"
|
||||||
@@ -783,7 +852,7 @@ collect_ovs() {
|
|||||||
IFS="${ifs_orig}"
|
IFS="${ifs_orig}"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
pr_syslog_stdout "8 of ${COLLECTION_COUNT}: Collecting OpenVSwitch output skipped"
|
pr_syslog_stdout "10 of ${COLLECTION_COUNT}: Collecting OpenVSwitch output skipped"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pr_log_stdout " "
|
pr_log_stdout " "
|
||||||
@@ -796,12 +865,12 @@ collect_domain_xml() {
|
|||||||
|
|
||||||
domain_list=$(virsh list --all --name)
|
domain_list=$(virsh list --all --name)
|
||||||
if test -n "${domain_list}"; then
|
if test -n "${domain_list}"; then
|
||||||
pr_syslog_stdout "9 of ${COLLECTION_COUNT}: Collecting domain xml files"
|
pr_syslog_stdout "11 of ${COLLECTION_COUNT}: Collecting domain xml files"
|
||||||
for domain in ${domain_list}; do
|
for domain in ${domain_list}; do
|
||||||
call_run_command "virsh dumpxml ${domain}" "${OUTPUT_FILE_XML}_${domain}.xml"
|
call_run_command "virsh dumpxml ${domain}" "${OUTPUT_FILE_XML}_${domain}.xml"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
pr_syslog_stdout "9 of ${COLLECTION_COUNT}: Collecting domain xml files skipped"
|
pr_syslog_stdout "11 of ${COLLECTION_COUNT}: Collecting domain xml files skipped"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pr_log_stdout " "
|
pr_log_stdout " "
|
||||||
@@ -815,23 +884,23 @@ collect_docker() {
|
|||||||
# call docker inspect for all containers
|
# call docker inspect for all containers
|
||||||
item_list=$(docker ps -qa)
|
item_list=$(docker ps -qa)
|
||||||
if test -n "${item_list}"; then
|
if test -n "${item_list}"; then
|
||||||
pr_syslog_stdout "10a of ${COLLECTION_COUNT}: Collecting docker container output"
|
pr_syslog_stdout "12a of ${COLLECTION_COUNT}: Collecting docker container output"
|
||||||
for item in ${item_list}; do
|
for item in ${item_list}; do
|
||||||
call_run_command "docker inspect ${item}" "${OUTPUT_FILE_DOCKER}"
|
call_run_command "docker inspect ${item}" "${OUTPUT_FILE_DOCKER}"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
pr_syslog_stdout "10a of ${COLLECTION_COUNT}: Collecting docker container output skipped"
|
pr_syslog_stdout "12a of ${COLLECTION_COUNT}: Collecting docker container output skipped"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# call docker inspect for all networks
|
# call docker inspect for all networks
|
||||||
item_list=$(docker network ls -q)
|
item_list=$(docker network ls -q)
|
||||||
if test -n "${item_list}"; then
|
if test -n "${item_list}"; then
|
||||||
pr_syslog_stdout "10b of ${COLLECTION_COUNT}: Collecting docker network output"
|
pr_syslog_stdout "12b of ${COLLECTION_COUNT}: Collecting docker network output"
|
||||||
for item in ${item_list}; do
|
for item in ${item_list}; do
|
||||||
call_run_command "docker network inspect ${item}" "${OUTPUT_FILE_DOCKER}"
|
call_run_command "docker network inspect ${item}" "${OUTPUT_FILE_DOCKER}"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
pr_syslog_stdout "10b of ${COLLECTION_COUNT}: Collecting docker network output skipped"
|
pr_syslog_stdout "12b of ${COLLECTION_COUNT}: Collecting docker network output skipped"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pr_log_stdout " "
|
pr_log_stdout " "
|
||||||
@@ -841,7 +910,7 @@ collect_docker() {
|
|||||||
collect_nvme() {
|
collect_nvme() {
|
||||||
local NVME
|
local NVME
|
||||||
|
|
||||||
pr_syslog_stdout "11 of ${COLLECTION_COUNT}: Collecting nvme output"
|
pr_syslog_stdout "13 of ${COLLECTION_COUNT}: Collecting nvme output"
|
||||||
call_run_command "nvme list" "${OUTPUT_FILE_NVME}"
|
call_run_command "nvme list" "${OUTPUT_FILE_NVME}"
|
||||||
|
|
||||||
for NVME in /dev/nvme[0-9]*; do
|
for NVME in /dev/nvme[0-9]*; do
|
||||||
@@ -1148,6 +1217,10 @@ collect_configfiles
|
|||||||
|
|
||||||
collect_osaoat
|
collect_osaoat
|
||||||
|
|
||||||
|
collect_ethtool
|
||||||
|
|
||||||
|
collect_tc
|
||||||
|
|
||||||
collect_ovs
|
collect_ovs
|
||||||
|
|
||||||
collect_domain_xml
|
collect_domain_xml
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ Sample invocation:
|
|||||||
.br
|
.br
|
||||||
dbginfo.sh: Debug information script version %S390_TOOLS_VERSION%
|
dbginfo.sh: Debug information script version %S390_TOOLS_VERSION%
|
||||||
.br
|
.br
|
||||||
Copyright IBM Corp. 2002, 2017
|
Copyright IBM Corp. 2002, 2019
|
||||||
.PP
|
.PP
|
||||||
Hardware platform = s390x
|
Hardware platform = s390x
|
||||||
.br
|
.br
|
||||||
@@ -60,34 +60,42 @@ Kernel version = <kernel\-version>
|
|||||||
.br
|
.br
|
||||||
Runtime environment = z/VM
|
Runtime environment = z/VM
|
||||||
.PP
|
.PP
|
||||||
1 of 11: Collecting command output
|
1 of 14: Collecting command output
|
||||||
.PP
|
.PP
|
||||||
2 of 11: Collecting z/VM command output
|
2 of 14: Collecting z/VM command output
|
||||||
.PP
|
.PP
|
||||||
3 of 11: Collecting procfs
|
3 of 14: Collecting procfs
|
||||||
.PP
|
.PP
|
||||||
4 of 11: Collecting sysfs
|
4 of 14: Collecting sysfs
|
||||||
.PP
|
.PP
|
||||||
5 of 11: Collecting log files
|
5 of 14: Collecting log files
|
||||||
.PP
|
.PP
|
||||||
6 of 11: Collecting config files
|
6 of 14: Collecting config files
|
||||||
.PP
|
.PP
|
||||||
7 of 11: Collecting osa oat output skipped \- not available
|
7 of 14: Collecting osa oat output skipped \- not available
|
||||||
.PP
|
.PP
|
||||||
8 of 11: Collecting OpenVSwitch output
|
8 of 14: Collecting ethtool output
|
||||||
.PP
|
.PP
|
||||||
9 of 11: Collecting domain xml files
|
9 of 14: Collecting tc output
|
||||||
|
.pp
|
||||||
|
10 of 14: Collecting OpenVSwitch output
|
||||||
.PP
|
.PP
|
||||||
10a of 11: Collecting docker container output
|
11 of 14: Collecting domain xml files
|
||||||
10b of 11: Collecting docker network output
|
|
||||||
.PP
|
.PP
|
||||||
11 of 11: Postprocessing
|
12a of 14: Collecting docker container output
|
||||||
|
12b of 14: Collecting docker network output
|
||||||
|
.PP
|
||||||
|
13 of 14: Collecting nvme output
|
||||||
|
.PP
|
||||||
|
14 of 14: Postprocessing
|
||||||
.PP
|
.PP
|
||||||
Finalizing: Creating archive with collected data
|
Finalizing: Creating archive with collected data
|
||||||
.PP
|
.PP
|
||||||
Collected data was saved to:
|
Collected data was saved to:
|
||||||
.br
|
.br
|
||||||
>> /data\-collection/DBGINFO\-2015\-02\-26\-21\-39\-16\-host\-012345.tgz <<
|
>> /data\-collection/DBGINFO\-2019\-08\-19\-21\-39\-16\-host\-012345.tgz <<
|
||||||
|
.br
|
||||||
|
Review the collected data before sending to your service organization.
|
||||||
.SH HINTS
|
.SH HINTS
|
||||||
Run the script with root authority.
|
Run the script with root authority.
|
||||||
.br
|
.br
|
||||||
|
|||||||
@@ -291,6 +291,13 @@ sub get_payload_records
|
|||||||
my $area = str_from_hex(substr($record[2], 2, 14));
|
my $area = str_from_hex(substr($record[2], 2, 14));
|
||||||
my $counter = hex(substr($record[2], 0, 2));
|
my $counter = hex(substr($record[2], 0, 2));
|
||||||
my $fsf_req_id = substr($record[2], 16, 16);
|
my $fsf_req_id = substr($record[2], 16, 16);
|
||||||
|
# ($counter == 0) is just a simple heuristic which can fail if
|
||||||
|
# there are missing payload record junks due to PAY area wrap!
|
||||||
|
if ($counter == 0 &&
|
||||||
|
defined($PAYLOAD_RECORDS{$fsf_req_id}{$area})) {
|
||||||
|
print "Warning: Ambiguous PAYload records. reqid:" .
|
||||||
|
$fsf_req_id . " area:" . $area . "\n";
|
||||||
|
}
|
||||||
$PAYLOAD_RECORDS{$fsf_req_id}{$area}[$counter] = [@record];
|
$PAYLOAD_RECORDS{$fsf_req_id}{$area}[$counter] = [@record];
|
||||||
if ($def_error && ($area =~ /def_err/)) {
|
if ($def_error && ($area =~ /def_err/)) {
|
||||||
$def_error{$fsf_req_id}[$counter] = [@record];
|
$def_error{$fsf_req_id}[$counter] = [@record];
|
||||||
@@ -515,11 +522,16 @@ sub print_payload
|
|||||||
my $field_name = shift();
|
my $field_name = shift();
|
||||||
my $tmp_str;
|
my $tmp_str;
|
||||||
|
|
||||||
|
if ($payload) {
|
||||||
|
# workaround to let user determine ambiguous PAYload records
|
||||||
|
printf "%-14s : %s\n", "Payload time", $payload->[0]->[0];
|
||||||
|
}
|
||||||
printf "%-14s : ", $field_name;
|
printf "%-14s : ", $field_name;
|
||||||
if (!$payload) {
|
if (!$payload) {
|
||||||
print "record not available anymore.\n";
|
print "record not available anymore.\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
# TODO: iterate with $counter loop and notify user about missing junks
|
||||||
foreach my $cc (@$payload) {
|
foreach my $cc (@$payload) {
|
||||||
$tmp_str .= substr($cc->[2], 32);
|
$tmp_str .= substr($cc->[2], 32);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ include ../../common.mak
|
|||||||
ALL_CPPFLAGS += -I../include -I../boot
|
ALL_CPPFLAGS += -I../include -I../boot
|
||||||
|
|
||||||
libs = $(rootdir)/libdasd/libdasd.a \
|
libs = $(rootdir)/libdasd/libdasd.a \
|
||||||
$(rootdir)/libu2s/libu2s.a \
|
|
||||||
$(rootdir)/libutil/libutil.a
|
$(rootdir)/libutil/libutil.a
|
||||||
|
|
||||||
all: tunedasd
|
all: tunedasd
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Provide main function and command line parsing.
|
* Provide main function and command line parsing.
|
||||||
*
|
*
|
||||||
* Copyright IBM Corp. 2016, 2017
|
* Copyright IBM Corp. 2016, 2019
|
||||||
*
|
*
|
||||||
* s390-tools is free software; you can redistribute it and/or modify
|
* s390-tools is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
@@ -57,7 +57,7 @@ const struct util_prg prg = {
|
|||||||
{
|
{
|
||||||
.owner = "IBM Corp.",
|
.owner = "IBM Corp.",
|
||||||
.pub_first = 2016,
|
.pub_first = 2016,
|
||||||
.pub_last = 2017,
|
.pub_last = 2019,
|
||||||
},
|
},
|
||||||
UTIL_PRG_COPYRIGHT_END
|
UTIL_PRG_COPYRIGHT_END
|
||||||
}
|
}
|
||||||
@@ -236,7 +236,7 @@ static char *get_chp_dir(int css, int id)
|
|||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
path = util_path_sysfs("devices/css%x/chp%x.%x", css, css, id);
|
path = util_path_sysfs("devices/css%x/chp%x.%x", css, css, id);
|
||||||
if ((stat(path, &sb) == 0) && (sb.st_mode == S_IFDIR))
|
if ((stat(path, &sb) == 0) && S_ISDIR(sb.st_mode))
|
||||||
return path;
|
return path;
|
||||||
free(path);
|
free(path);
|
||||||
return util_path_sysfs("devices/css%x/chp%x.%02x", css, css, id);
|
return util_path_sysfs("devices/css%x/chp%x.%02x", css, css, id);
|
||||||
@@ -296,7 +296,7 @@ static void perform_command(int css, int id)
|
|||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
path = get_chp_dir(css, id);
|
path = get_chp_dir(css, id);
|
||||||
if ((stat(path, &sb) != 0) || ((sb.st_mode & S_IFMT) != S_IFDIR)) {
|
if ((stat(path, &sb) != 0) || !S_ISDIR(sb.st_mode)) {
|
||||||
printf("Skipping unknown channel-path %x.%02x\n", css, id);
|
printf("Skipping unknown channel-path %x.%02x\n", css, id);
|
||||||
goto out_free_path;
|
goto out_free_path;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,24 @@ lschp \- list information about available channel\-paths.
|
|||||||
.B lschp
|
.B lschp
|
||||||
.RB [ \-h|\-\-help ]
|
.RB [ \-h|\-\-help ]
|
||||||
.RB [ \-v|\-\-version ]
|
.RB [ \-v|\-\-version ]
|
||||||
|
.RB [
|
||||||
|
.I CHPID
|
||||||
|
]
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
The lschp command lists status and type information about available
|
The lschp command lists status and type information about available
|
||||||
channel\-paths.
|
channel\-paths. A
|
||||||
|
.I CHPID
|
||||||
|
argument can be specified to return the information for the respective
|
||||||
|
channel-path identifier only.
|
||||||
|
Channel\-path identifiers are specified in hexadecimal notation either simply
|
||||||
|
as the CHPID\-number (e.g. e0) or in the form
|
||||||
|
|
||||||
|
.RS
|
||||||
|
<cssid>.<id>
|
||||||
|
.RE
|
||||||
|
|
||||||
|
where <cssid> is the channel\-subsystem identifier and <id> is the CHPID\-number (e.g. 0.7e).
|
||||||
|
|
||||||
.B Column description:
|
.B Column description:
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Provide main function and command line parsing.
|
* Provide main function and command line parsing.
|
||||||
*
|
*
|
||||||
* Copyright IBM Corp. 2016, 2017
|
* Copyright IBM Corp. 2016, 2019
|
||||||
*
|
*
|
||||||
* s390-tools is free software; you can redistribute it and/or modify
|
* s390-tools is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "lib/util_base.h"
|
#include "lib/util_base.h"
|
||||||
#include "lib/util_file.h"
|
#include "lib/util_file.h"
|
||||||
@@ -31,7 +32,7 @@ static const struct util_prg prg = {
|
|||||||
{
|
{
|
||||||
.owner = "IBM Corp.",
|
.owner = "IBM Corp.",
|
||||||
.pub_first = 2016,
|
.pub_first = 2016,
|
||||||
.pub_last = 2017,
|
.pub_last = 2019,
|
||||||
},
|
},
|
||||||
UTIL_PRG_COPYRIGHT_END
|
UTIL_PRG_COPYRIGHT_END
|
||||||
}
|
}
|
||||||
@@ -55,9 +56,10 @@ static struct util_opt opt_vec[] = {
|
|||||||
* @param[in] dir Path of the desired directory
|
* @param[in] dir Path of the desired directory
|
||||||
* @param[in] css_id ID for device identification
|
* @param[in] css_id ID for device identification
|
||||||
* @param[in] rec The buffer structure, where results are written to
|
* @param[in] rec The buffer structure, where results are written to
|
||||||
|
* @param[in] chp If set: CHPID to filter by
|
||||||
*/
|
*/
|
||||||
static void print_chpid(const char *chp_dir, unsigned int css_id,
|
static void print_chpid(const char *chp_dir, unsigned int css_id,
|
||||||
struct util_rec *rec)
|
struct util_rec *rec, char *chp)
|
||||||
{
|
{
|
||||||
unsigned int css_id_tmp, chp_id;
|
unsigned int css_id_tmp, chp_id;
|
||||||
bool chid_external;
|
bool chid_external;
|
||||||
@@ -123,7 +125,8 @@ static void print_chpid(const char *chp_dir, unsigned int css_id,
|
|||||||
} else {
|
} else {
|
||||||
util_rec_set(rec, "pchid", "%s", "-");
|
util_rec_set(rec, "pchid", "%s", "-");
|
||||||
}
|
}
|
||||||
util_rec_print(rec);
|
if (!strlen(chp) || strcmp(util_rec_get(rec, "chpid"), chp) == 0)
|
||||||
|
util_rec_print(rec);
|
||||||
free(path);
|
free(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,8 +156,9 @@ static int chpsort(const struct dirent **de1, const struct dirent **de2)
|
|||||||
*
|
*
|
||||||
* @param[in] css_dir The desired directory
|
* @param[in] css_dir The desired directory
|
||||||
* @param[in] rec The buffer structure, where results are written to
|
* @param[in] rec The buffer structure, where results are written to
|
||||||
|
* @param[in] chp If set: CHPID to filter by
|
||||||
*/
|
*/
|
||||||
static void print_css(const char *css_dir, struct util_rec *rec)
|
static void print_css(const char *css_dir, struct util_rec *rec, char *chp)
|
||||||
{
|
{
|
||||||
struct dirent **de_vec;
|
struct dirent **de_vec;
|
||||||
unsigned int css_id;
|
unsigned int css_id;
|
||||||
@@ -167,15 +171,17 @@ static void print_css(const char *css_dir, struct util_rec *rec)
|
|||||||
path = util_path_sysfs("devices/css%d", css_id);
|
path = util_path_sysfs("devices/css%d", css_id);
|
||||||
count = util_scandir(&de_vec, chpsort, path, "chp%x.*", css_id);
|
count = util_scandir(&de_vec, chpsort, path, "chp%x.*", css_id);
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
print_chpid(de_vec[i]->d_name, css_id, rec);
|
print_chpid(de_vec[i]->d_name, css_id, rec, chp);
|
||||||
util_scandir_free(de_vec, count);
|
util_scandir_free(de_vec, count);
|
||||||
free(path);
|
free(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Print chpid table
|
* Print chpid table
|
||||||
|
*
|
||||||
|
* @param[in] chp If set: CHPID to filter by
|
||||||
*/
|
*/
|
||||||
static void cmd_lschp(void)
|
static void cmd_lschp(char *chp)
|
||||||
{
|
{
|
||||||
struct dirent **de_vec;
|
struct dirent **de_vec;
|
||||||
struct util_rec *rec;
|
struct util_rec *rec;
|
||||||
@@ -198,17 +204,19 @@ static void cmd_lschp(void)
|
|||||||
path = util_path_sysfs("devices");
|
path = util_path_sysfs("devices");
|
||||||
count = util_scandir(&de_vec, alphasort, path, "^css[[:xdigit:]]{1,2}$");
|
count = util_scandir(&de_vec, alphasort, path, "^css[[:xdigit:]]{1,2}$");
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
print_css(de_vec[i]->d_name, rec);
|
print_css(de_vec[i]->d_name, rec, chp);
|
||||||
util_ptr_vec_free((void **) de_vec, count);
|
util_ptr_vec_free((void **) de_vec, count);
|
||||||
free(path);
|
free(path);
|
||||||
util_rec_free(rec);
|
util_rec_free(rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CHP_LEN 4
|
||||||
/*
|
/*
|
||||||
* Parse options and execute the command
|
* Parse options and execute the command
|
||||||
*/
|
*/
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
char chp[CHP_LEN + 1] = "";
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
util_prg_init(&prg);
|
util_prg_init(&prg);
|
||||||
@@ -231,10 +239,30 @@ int main(int argc, char *argv[])
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (argc > optind) {
|
if (argc > optind + 1)
|
||||||
util_prg_print_arg_error(argv[optind]);
|
errx(EXIT_FAILURE, "Too many arguments specified");
|
||||||
return EXIT_FAILURE;
|
if (argc == optind + 1) {
|
||||||
|
/* we take a single argument only */
|
||||||
|
switch (strlen(argv[optind])) {
|
||||||
|
case 1:
|
||||||
|
sprintf(chp, "0.0%s", argv[optind]);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
sprintf(chp, "0.%s", argv[optind]);
|
||||||
|
break;
|
||||||
|
case CHP_LEN:
|
||||||
|
strcpy(chp, argv[optind]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
errx(EXIT_FAILURE, "%s is not a valid channel-path ID",
|
||||||
|
argv[optind]);
|
||||||
|
}
|
||||||
|
if (!isdigit(chp[0]) || chp[1] != '.' || !isxdigit(chp[2]) ||
|
||||||
|
!isxdigit(chp[3]))
|
||||||
|
errx(EXIT_FAILURE, "%s is not a valid channel-path ID",
|
||||||
|
chp);
|
||||||
}
|
}
|
||||||
cmd_lschp();
|
cmd_lschp(chp);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
30
zconf/lsdasd
30
zconf/lsdasd
@@ -164,6 +164,7 @@ function gatherDeviceData() {
|
|||||||
read DEV_UID 2> /dev/null < $DEVPATH/uid || continue
|
read DEV_UID 2> /dev/null < $DEVPATH/uid || continue
|
||||||
read READONLY 2> /dev/null < $DEVPATH/readonly || continue
|
read READONLY 2> /dev/null < $DEVPATH/readonly || continue
|
||||||
read DISCIPLINE 2> /dev/null < $DEVPATH/discipline || continue
|
read DISCIPLINE 2> /dev/null < $DEVPATH/discipline || continue
|
||||||
|
read ESE 2> /dev/null < $DEVPATH/ese
|
||||||
|
|
||||||
# Block device specific information is only available for
|
# Block device specific information is only available for
|
||||||
# devices that are online and not a PAV alias
|
# devices that are online and not a PAV alias
|
||||||
@@ -244,7 +245,7 @@ function newoutput()
|
|||||||
#-------------------------------------------#
|
#-------------------------------------------#
|
||||||
|
|
||||||
if [[ "$ONLINE" == 0 ]]; then
|
if [[ "$ONLINE" == 0 ]]; then
|
||||||
printf "%s:%s:%-8s offline\n" \
|
printf "%s:%s:%-8s offline\n" \
|
||||||
"$SORTKEYLEN" "$SORTKEY" \
|
"$SORTKEYLEN" "$SORTKEY" \
|
||||||
"$BUSID" ;
|
"$BUSID" ;
|
||||||
return
|
return
|
||||||
@@ -252,7 +253,7 @@ function newoutput()
|
|||||||
|
|
||||||
if [[ "$ALIAS" == 1 ]]; then
|
if [[ "$ALIAS" == 1 ]]; then
|
||||||
if [[ "$BASEONLY" == "false" ]]; then
|
if [[ "$BASEONLY" == "false" ]]; then
|
||||||
printf "%s:%s:%-8s alias %28s\n" \
|
printf "%s:%s:%-8s alias %26s\n" \
|
||||||
"$SORTKEYLEN" "$SORTKEY" \
|
"$SORTKEYLEN" "$SORTKEY" \
|
||||||
"$BUSID" \
|
"$BUSID" \
|
||||||
"$DISCIPLINE"
|
"$DISCIPLINE"
|
||||||
@@ -286,7 +287,11 @@ function newoutput()
|
|||||||
ACTIVE="active"
|
ACTIVE="active"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "%s:%s:%-8s %-6s%-4s %-8s %-2s:%-2s %-4s %-4s %-8s %s\n" \
|
if [[ "$ESE" == 1 ]]; then
|
||||||
|
DISCIPLINE="${DISCIPLINE} (ESE)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "%s:%s:%-8s %-6s%-2s %-8s %-2s:%-2s %-11s %-4s %-8s %s\n" \
|
||||||
"$SORTKEYLEN" "$SORTKEY" \
|
"$SORTKEYLEN" "$SORTKEY" \
|
||||||
"$BUSID" \
|
"$BUSID" \
|
||||||
"$ACTIVE" \
|
"$ACTIVE" \
|
||||||
@@ -378,6 +383,10 @@ function extended()
|
|||||||
read OPM NPPM CABLEPM CUIRPM HPFPM IFCCPM 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
|
read -a C 2> /dev/null < $DEVPATH/../chpids
|
||||||
read PIM PAM POM 2> /dev/null < $DEVPATH/../pimpampom
|
read PIM PAM POM 2> /dev/null < $DEVPATH/../pimpampom
|
||||||
|
read ESE 2> /dev/null < $DEVPATH/ese
|
||||||
|
read EXTSZ 2> /dev/null < $DEVPATH/extent_pool/extent_size
|
||||||
|
read CAPACITY 2> /dev/null < $DEVPATH/capacity/logical_capacity
|
||||||
|
read ALLOCATED 2> /dev/null < $DEVPATH/capacity/space_allocated
|
||||||
|
|
||||||
# convert to hexadecimal values
|
# convert to hexadecimal values
|
||||||
PIM=0x$PIM
|
PIM=0x$PIM
|
||||||
@@ -550,7 +559,11 @@ function extended()
|
|||||||
COLON=":"
|
COLON=":"
|
||||||
fi
|
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# 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" \
|
if [[ "$ESE" == 1 ]]; then
|
||||||
|
DISCIPLINE="${DISCIPLINE} (ESE)"
|
||||||
|
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# extent_size:\t\t\t\t%s# logical_capacity:\t\t\t%s# space_allocated:\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" \
|
"$SORTKEYLEN" "$SORTKEY" \
|
||||||
"$BUSID" \
|
"$BUSID" \
|
||||||
"$BLOCKNAME" \
|
"$BLOCKNAME" \
|
||||||
@@ -562,6 +575,9 @@ function extended()
|
|||||||
"$SSIZE" \
|
"$SSIZE" \
|
||||||
"$MBSIZE" \
|
"$MBSIZE" \
|
||||||
"$BLOCKCOUNT" \
|
"$BLOCKCOUNT" \
|
||||||
|
"$EXTSZ" \
|
||||||
|
"$CAPACITY" \
|
||||||
|
"$ALLOCATED" \
|
||||||
"$DIAG" \
|
"$DIAG" \
|
||||||
"$READONLY" \
|
"$READONLY" \
|
||||||
"$EER" \
|
"$EER" \
|
||||||
@@ -787,10 +803,10 @@ fi
|
|||||||
|
|
||||||
if [[ "$PRINTUID" == "true" ]] && [[ "$OUTPUT" != "old" ]]; then
|
if [[ "$PRINTUID" == "true" ]] && [[ "$OUTPUT" != "old" ]]; then
|
||||||
printf "Bus-ID Name UID\n"
|
printf "Bus-ID Name UID\n"
|
||||||
printf "==============================================================================\n"
|
printf "================================================================================\n"
|
||||||
elif [[ "$OUTPUT" == "new" ]]; then
|
elif [[ "$OUTPUT" == "new" ]]; then
|
||||||
printf "Bus-ID Status Name Device Type BlkSz Size Blocks\n"
|
printf "Bus-ID Status Name Device Type BlkSz Size Blocks\n"
|
||||||
printf "==============================================================================\n"
|
printf "================================================================================\n"
|
||||||
elif [[ "$OUTPUT" == "extended" ]]; then
|
elif [[ "$OUTPUT" == "extended" ]]; then
|
||||||
PROCESSING=" $PROCESSING | sed 's/#/\n/g' "
|
PROCESSING=" $PROCESSING | sed 's/#/\n/g' "
|
||||||
fi
|
fi
|
||||||
|
|||||||
307
zconf/lszfcp
307
zconf/lszfcp
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# lszfcp - Tool to display information about zfcp devices (adapters/ports/units)
|
# lszfcp - Tool to display information about zfcp devices (adapters/ports/units)
|
||||||
#
|
#
|
||||||
# Copyright IBM Corp. 2006, 2017
|
# Copyright IBM Corp. 2006, 2019
|
||||||
#
|
#
|
||||||
# s390-tools is free software; you can redistribute it and/or modify
|
# s390-tools is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the MIT license. See LICENSE for details.
|
# it under the terms of the MIT license. See LICENSE for details.
|
||||||
@@ -14,10 +14,13 @@ FC_CLASS=false
|
|||||||
|
|
||||||
# Command line parameters
|
# Command line parameters
|
||||||
VERBOSITY=0
|
VERBOSITY=0
|
||||||
|
SHOW_MODPARMS=0
|
||||||
SHOW_HOSTS=0
|
SHOW_HOSTS=0
|
||||||
SHOW_PORTS=0
|
SHOW_PORTS=0
|
||||||
SHOW_DEVICES=0
|
SHOW_DEVICES=0
|
||||||
SHOW_ATTRIBUTES=false
|
SHOW_ATTRIBUTES=false
|
||||||
|
SHOW_MORE_ATTRS=0
|
||||||
|
SHOW_EXTENDED=false
|
||||||
unset PAR_BUSID PAR_WWPN PAR_LUN
|
unset PAR_BUSID PAR_WWPN PAR_LUN
|
||||||
|
|
||||||
|
|
||||||
@@ -26,8 +29,8 @@ unset PAR_BUSID PAR_WWPN PAR_LUN
|
|||||||
check_sysfs()
|
check_sysfs()
|
||||||
{
|
{
|
||||||
if [ -z $SYSFS -o ! -d $SYSFS -o ! -r $SYSFS ]; then
|
if [ -z $SYSFS -o ! -d $SYSFS -o ! -r $SYSFS ]; then
|
||||||
echo "Error: sysfs not available."
|
echo "Error: sysfs not available."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,13 +46,36 @@ check_zfcp_support()
|
|||||||
|
|
||||||
check_fcp_devs()
|
check_fcp_devs()
|
||||||
{
|
{
|
||||||
|
local found=0
|
||||||
|
|
||||||
if $FC_CLASS; then
|
if $FC_CLASS; then
|
||||||
|
# theoretically this includes "defunct" (and thus online) devs
|
||||||
ignore=`ls $SYSFS/class/fc_host/host* 2>&1`
|
ignore=`ls $SYSFS/class/fc_host/host* 2>&1`
|
||||||
else
|
else
|
||||||
ignore=`ls $SYSFS/devices/css0/[0-9]*/[0-9]*/host[0-9]* 2>&1`
|
ignore=`ls $SYSFS/devices/css0/[0-9]*/[0-9]*/host[0-9]* 2>&1`
|
||||||
fi
|
fi
|
||||||
|
[ $? -eq 0 ] && found=1
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $found -eq 0 ] && $SHOW_EXTENDED; then
|
||||||
|
# nothing found yet so search for "defunct" FCP devices
|
||||||
|
ignore=$(ls -dX $SYSFS/devices/css[0-9]*/defunct/[0-9]*/host[0-9]* 2>&1)
|
||||||
|
[ $? -eq 0 ] && found=1
|
||||||
|
fi
|
||||||
|
if [ $found -eq 0 ] && $SHOW_EXTENDED; then
|
||||||
|
local mypath mylist=""
|
||||||
|
# nothing found yet so search for FCP devices never been online
|
||||||
|
for mypath in $SYSFS/bus/ccw/drivers/zfcp/*.*.*; do
|
||||||
|
if [ "$mypath" = "$SYSFS/bus/ccw/drivers/zfcp/*.*.*" ];
|
||||||
|
then
|
||||||
|
break # glob did not match anything
|
||||||
|
fi
|
||||||
|
[ -d $mypath/host[0-9]* ] && continue # is/was online
|
||||||
|
mylist="$mylist $(readlink -e $mypath)/-"
|
||||||
|
done
|
||||||
|
[ -n "$mylist" ] && found=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $found -eq 0 ]; then
|
||||||
echo "Error: No fcp devices found."
|
echo "Error: No fcp devices found."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -66,7 +92,7 @@ print_version()
|
|||||||
{
|
{
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
$SCRIPTNAME: version %S390_TOOLS_VERSION%
|
$SCRIPTNAME: version %S390_TOOLS_VERSION%
|
||||||
Copyright IBM Corp. 2006, 2017
|
Copyright IBM Corp. 2006, 2019
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,12 +110,18 @@ OPTIONS:
|
|||||||
-H, --hosts show host information (default)
|
-H, --hosts show host information (default)
|
||||||
-P, --ports show remote port information
|
-P, --ports show remote port information
|
||||||
-D, --devices show SCSI device information
|
-D, --devices show SCSI device information
|
||||||
|
-Z, --modparms show zfcp (module) parameters
|
||||||
-b, --busid=BUSID select specific busid
|
-b, --busid=BUSID select specific busid
|
||||||
-p, --wwpn=WWPN select specific port name
|
-p, --wwpn=WWPN select specific port name
|
||||||
-l, --lun=LUN select specific LUN
|
-l, --lun=LUN select specific LUN
|
||||||
-a, --attributes show all attributes
|
-a, --attributes show attributes
|
||||||
|
-m, --moreattrs show more attributes
|
||||||
|
(host: css; port: zfcp_port; SCSI device: zfcp_unit)
|
||||||
|
specify twice to show more attributes for SCSI devices
|
||||||
|
(scsi_disk,block,integrity,queue,iosched)
|
||||||
-V, --verbose show sysfs paths of associated class
|
-V, --verbose show sysfs paths of associated class
|
||||||
and bus devices
|
and bus devices
|
||||||
|
-e, --extended extended output format
|
||||||
-s, --sysfs=PATH use path as sysfs (for dbginfo archives)
|
-s, --sysfs=PATH use path as sysfs (for dbginfo archives)
|
||||||
-h, --help print this help
|
-h, --help print this help
|
||||||
-v, --version print version information
|
-v, --version print version information
|
||||||
@@ -129,9 +161,38 @@ show_attributes()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
show_modparms()
|
||||||
|
{
|
||||||
|
local modparmdir=$SYSFS/module/zfcp/parameters
|
||||||
|
|
||||||
|
[ -d "$modparmdir" ] || return
|
||||||
|
|
||||||
|
if [ $VERBOSITY -ne 0 ]; then
|
||||||
|
echo "$modparmdir"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo 'Module = "zfcp"'
|
||||||
|
show_attributes "$modparmdir"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
show_hosts()
|
show_hosts()
|
||||||
{
|
{
|
||||||
HOST_LIST=`ls -dX $SYSFS/devices/css0/[0-9]*/[0-9]*/host[0-9]*`
|
HOST_LIST=`ls -dX $SYSFS/devices/css0/[0-9]*/[0-9]*/host[0-9]* \
|
||||||
|
2> /dev/null`
|
||||||
|
|
||||||
|
if $SHOW_EXTENDED; then
|
||||||
|
# add all "defunct" FCP devices
|
||||||
|
HOST_LIST="$HOST_LIST
|
||||||
|
$(ls -dX $SYSFS/devices/css[0-9]*/defunct/[0-9]*/host[0-9]* 2>/dev/null)"
|
||||||
|
# add all FCP devices that have never been online
|
||||||
|
for HOST_PATH in $SYSFS/bus/ccw/drivers/zfcp/*.*.*; do
|
||||||
|
[ -d $HOST_PATH/host[0-9]* ] && continue # is/was online
|
||||||
|
HOST_LIST="$HOST_LIST
|
||||||
|
$(readlink -e $HOST_PATH)/-"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
for HOST_PATH in $HOST_LIST; do
|
for HOST_PATH in $HOST_LIST; do
|
||||||
SCSI_HOST=`basename $HOST_PATH`
|
SCSI_HOST=`basename $HOST_PATH`
|
||||||
@@ -140,18 +201,55 @@ show_hosts()
|
|||||||
|
|
||||||
[ $ADAPTER != ${PAR_BUSID:-$ADAPTER} ] && continue
|
[ $ADAPTER != ${PAR_BUSID:-$ADAPTER} ] && continue
|
||||||
|
|
||||||
|
read ONLINE < $ADAPTER_PATH/online
|
||||||
|
read AVAILABILITY < $ADAPTER_PATH/availability
|
||||||
|
[ -r $ADAPTER_PATH/failed ] && read FAILED < $ADAPTER_PATH/failed
|
||||||
|
DEFUNCT=${ADAPTER_PATH%/*} # strip devbusid
|
||||||
|
DEFUNCT=${DEFUNCT##*/} # basename
|
||||||
|
HOSTMARKER=""
|
||||||
|
if $SHOW_EXTENDED; then
|
||||||
|
if [ "$DEFUNCT" = "defunct" ]; then
|
||||||
|
HOSTMARKER=" defunct"
|
||||||
|
elif [ "$ONLINE" = "0" ]; then
|
||||||
|
HOSTMARKER=" offline"
|
||||||
|
elif [ "$FAILED" = "1" ]; then
|
||||||
|
HOSTMARKER=" failed"
|
||||||
|
elif [ "$AVAILABILITY" != "good" ]; then
|
||||||
|
HOSTMARKER=" NotAvailable"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
if [ $VERBOSITY -eq 0 ]; then
|
if [ $VERBOSITY -eq 0 ]; then
|
||||||
echo $ADAPTER $SCSI_HOST
|
echo $ADAPTER $SCSI_HOST$HOSTMARKER
|
||||||
else
|
else
|
||||||
echo $ADAPTER_PATH
|
echo $ADAPTER_PATH$HOSTMARKER
|
||||||
$FC_CLASS && echo "$SYSFS/class/fc_host/$SCSI_HOST"
|
if [ "$SCSI_HOST" != "-" ]; then
|
||||||
echo "$SYSFS/class/scsi_host/$SCSI_HOST"
|
$FC_CLASS && echo "$SYSFS/class/fc_host/$SCSI_HOST"
|
||||||
|
echo "$SYSFS/class/scsi_host/$SCSI_HOST"
|
||||||
|
else
|
||||||
|
echo "-"
|
||||||
|
echo "-"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if $SHOW_ATTRIBUTES; then
|
if $SHOW_ATTRIBUTES; then
|
||||||
|
if [ $SHOW_MORE_ATTRS -ge 1 ]; then
|
||||||
|
echo 'Bus = "css"'
|
||||||
|
if [ "$DEFUNCT" = "defunct" ]; then
|
||||||
|
printf " %-19s\n" "defunct"
|
||||||
|
else
|
||||||
|
show_attributes ${ADAPTER_PATH%/*}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo 'Bus = "ccw"'
|
echo 'Bus = "ccw"'
|
||||||
show_attributes $ADAPTER_PATH
|
show_attributes $ADAPTER_PATH
|
||||||
|
|
||||||
|
if [ "$SCSI_HOST" = "-" ]; then
|
||||||
|
# skip output of non-existent fc_host & scsi_host
|
||||||
|
echo
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
if $FC_CLASS; then
|
if $FC_CLASS; then
|
||||||
echo 'Class = "fc_host"'
|
echo 'Class = "fc_host"'
|
||||||
show_attributes \
|
show_attributes \
|
||||||
@@ -196,30 +294,60 @@ show_ports()
|
|||||||
for FC_PORT_PATH in $PORT_LIST; do
|
for FC_PORT_PATH in $PORT_LIST; do
|
||||||
PORT=`basename $FC_PORT_PATH`
|
PORT=`basename $FC_PORT_PATH`
|
||||||
read PORT_STATE < $FC_PORT_PATH/port_state
|
read PORT_STATE < $FC_PORT_PATH/port_state
|
||||||
if [ "$PORT_STATE" == "Online" ];
|
if [ "$PORT_STATE" == "Online" ] || $SHOW_EXTENDED; then
|
||||||
then
|
|
||||||
read WWPN < $FC_PORT_PATH/port_name
|
read WWPN < $FC_PORT_PATH/port_name
|
||||||
else
|
else
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
PORTSTATEMARKER=""
|
||||||
|
$SHOW_EXTENDED && [ "$PORT_STATE" != "Online" ] \
|
||||||
|
&& PORTSTATEMARKER=" NotOnline"
|
||||||
|
|
||||||
[ $WWPN != ${PAR_WWPN:-$WWPN} ] && continue
|
[ $WWPN != ${PAR_WWPN:-$WWPN} ] && continue
|
||||||
|
|
||||||
ADAPTER_PORT_PATH=`ls -d \
|
local sysreal=$(readlink -e "$FC_PORT_PATH")
|
||||||
$SYSFS/devices/css0/*/*/$WWPN/../host[0-9]*/$PORT |\
|
local ADAPTER=""
|
||||||
awk -F "/../host" '{ print $1 }'`
|
while [ -n "$sysreal" ]; do
|
||||||
ADAPTER=`basename \`dirname $ADAPTER_PORT_PATH\``
|
# ascend to parent: strip last path part
|
||||||
|
sysreal=${sysreal%/*}
|
||||||
|
[ -h $sysreal/subsystem ] || continue
|
||||||
|
local subsystem=$(readlink -e $sysreal/subsystem)
|
||||||
|
if [ "${subsystem##*/}" = "ccw" ]; then
|
||||||
|
ADAPTER=${sysreal##*/}
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
[ -z "$ADAPTER" ] && continue # skip not zfcp-attached ones
|
||||||
|
if [ -d $SYSFS/devices/css[0-9]*/[0-9d]*/[0-9]*/$WWPN/../host[0-9]*/$PORT ];
|
||||||
|
then
|
||||||
|
ADAPTER_PORT_PATH=$SYSFS/devices/css[0-9]*/[0-9d]*/$ADAPTER/$WWPN
|
||||||
|
else
|
||||||
|
ADAPTER_PORT_PATH="-"
|
||||||
|
fi
|
||||||
|
|
||||||
[ $ADAPTER != ${PAR_BUSID:-$ADAPTER} ] && continue
|
[ $ADAPTER != ${PAR_BUSID:-$ADAPTER} ] && continue
|
||||||
|
|
||||||
if [ $VERBOSITY -eq 0 ]; then
|
if [ $VERBOSITY -eq 0 ]; then
|
||||||
echo "$ADAPTER/$WWPN $PORT"
|
echo "$ADAPTER/$WWPN $PORT$PORTSTATEMARKER"
|
||||||
else
|
else
|
||||||
echo $ADAPTER_PORT_PATH
|
if [ "$ADAPTER_PORT_PATH" != "-" ]; then
|
||||||
echo $FC_PORT_PATH
|
echo $ADAPTER_PORT_PATH
|
||||||
|
else
|
||||||
|
echo "- (NoMoreZfcpPort:$ADAPTER/$WWPN)"
|
||||||
|
fi
|
||||||
|
echo $FC_PORT_PATH$PORTSTATEMARKER
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if $SHOW_ATTRIBUTES; then
|
if $SHOW_ATTRIBUTES; then
|
||||||
|
if [ $SHOW_MORE_ATTRS -ge 1 ] \
|
||||||
|
&& [ "$ADAPTER_PORT_PATH" != "-" ] \
|
||||||
|
&& [ -d $ADAPTER_PORT_PATH ];
|
||||||
|
then
|
||||||
|
# fc_rport can exist without zfcp_port
|
||||||
|
# (e.g. after port_remove)
|
||||||
|
echo 'Class = "zfcp_port"'
|
||||||
|
show_attributes "$ADAPTER_PORT_PATH"
|
||||||
|
fi
|
||||||
echo 'Class = "fc_remote_ports"'
|
echo 'Class = "fc_remote_ports"'
|
||||||
show_attributes "$FC_PORT_PATH"
|
show_attributes "$FC_PORT_PATH"
|
||||||
echo
|
echo
|
||||||
@@ -234,13 +362,25 @@ show_devices()
|
|||||||
if $FC_CLASS; then
|
if $FC_CLASS; then
|
||||||
SCSI_DEVICE_LIST=`ls -d \
|
SCSI_DEVICE_LIST=`ls -d \
|
||||||
$SYSFS/bus/ccw/drivers/zfcp/*/host*/rport*/target*/*/ \
|
$SYSFS/bus/ccw/drivers/zfcp/*/host*/rport*/target*/*/ \
|
||||||
2>/dev/null |grep -P '\d+:\d+:\d+:\d+'`
|
2>/dev/null |grep -P '\d+:\d+:\d+:\d+'`
|
||||||
else
|
else
|
||||||
SCSI_DEVICE_LIST=`ls -d $SYSFS/devices/css0/*/*/host[0-9]*/*/`
|
SCSI_DEVICE_LIST=`ls -d $SYSFS/devices/css0/*/*/host[0-9]*/*/`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$SCSI_DEVICE_LIST" ]; then
|
if $SHOW_EXTENDED; then
|
||||||
echo "Error: No fcp devices found."
|
ZFCP_UNIT_LIST=$(ls -d \
|
||||||
|
$SYSFS/devices/css[0-9]*/[0-9d]*/[0-9]*/0x*/0x* \
|
||||||
|
2> /dev/null)
|
||||||
|
else
|
||||||
|
ZFCP_UNIT_LIST=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$SCSI_DEVICE_LIST" ] && [ -z "$ZFCP_UNIT_LIST" ]; then
|
||||||
|
if $SHOW_EXTENDED; then
|
||||||
|
echo "Error: No zfcp-attached SCSI devices found."
|
||||||
|
else
|
||||||
|
echo "Error: No fcp devices found."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for SCSI_DEVICE_PATH in $SCSI_DEVICE_LIST; do
|
for SCSI_DEVICE_PATH in $SCSI_DEVICE_LIST; do
|
||||||
@@ -248,15 +388,39 @@ show_devices()
|
|||||||
read WWPN < $SCSI_DEVICE_PATH/wwpn
|
read WWPN < $SCSI_DEVICE_PATH/wwpn
|
||||||
read LUN < $SCSI_DEVICE_PATH/fcp_lun
|
read LUN < $SCSI_DEVICE_PATH/fcp_lun
|
||||||
|
|
||||||
|
# remove from ZFCP_UNIT_LIST if SCSI device exists
|
||||||
|
REDUCED_LIST=""
|
||||||
|
for UNIT_PATH in $ZFCP_UNIT_LIST; do
|
||||||
|
STRIPPED_PATH=$UNIT_PATH
|
||||||
|
L=${UNIT_PATH##*/}
|
||||||
|
STRIPPED_PATH=${STRIPPED_PATH%/*}
|
||||||
|
W=${STRIPPED_PATH##*/}
|
||||||
|
STRIPPED_PATH=${STRIPPED_PATH%/*}
|
||||||
|
A=${STRIPPED_PATH##*/}
|
||||||
|
[ "$A/$W/$L" = "$ADAPTER/$WWPN/$LUN" ] && continue
|
||||||
|
REDUCED_LIST="$REDUCED_LIST $UNIT_PATH"
|
||||||
|
done
|
||||||
|
ZFCP_UNIT_LIST="$REDUCED_LIST"
|
||||||
|
|
||||||
[ $LUN != ${PAR_LUN:-$LUN} ] && continue
|
[ $LUN != ${PAR_LUN:-$LUN} ] && continue
|
||||||
[ $WWPN != ${PAR_WWPN:-$WWPN} ] && continue
|
[ $WWPN != ${PAR_WWPN:-$WWPN} ] && continue
|
||||||
[ $ADAPTER != ${PAR_BUSID:-$ADAPTER} ] && continue
|
[ $ADAPTER != ${PAR_BUSID:-$ADAPTER} ] && continue
|
||||||
|
|
||||||
|
ZFCP_UNIT_PATH=$SYSFS/devices/css[0-9]*/[0-9d]*/$ADAPTER/$WWPN/$LUN
|
||||||
|
SDEVMARKER=""
|
||||||
|
if $SHOW_EXTENDED; then
|
||||||
|
[ -d $ZFCP_UNIT_PATH ] || SDEVMARKER="$SDEVMARKER auto"
|
||||||
|
[ -r $SCSI_DEVICE_PATH/state ] \
|
||||||
|
&& read SDEVSTATE < $SCSI_DEVICE_PATH/state
|
||||||
|
[ "$SDEVSTATE" != "running" ] \
|
||||||
|
&& SDEVMARKER="$SDEVMARKER NotRunning"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $VERBOSITY -eq 0 ]; then
|
if [ $VERBOSITY -eq 0 ]; then
|
||||||
echo "$ADAPTER/$WWPN/$LUN `basename $SCSI_DEVICE_PATH`"
|
echo "$ADAPTER/$WWPN/$LUN `basename $SCSI_DEVICE_PATH`$SDEVMARKER"
|
||||||
else
|
else
|
||||||
echo "`ls -d $SYSFS/devices/css0/*/$ADAPTER`/$WWPN/$LUN"
|
echo "`ls -d $SYSFS/devices/css0/[0-9d]*/$ADAPTER`/$WWPN/$LUN"
|
||||||
echo ${SCSI_DEVICE_PATH%*/} # without trailing slash
|
echo ${SCSI_DEVICE_PATH%*/}$SDEVMARKER # without trailing slash
|
||||||
|
|
||||||
# On live systems, there are links to the block and
|
# On live systems, there are links to the block and
|
||||||
# generic devices. In a dbginfo archive, these links
|
# generic devices. In a dbginfo archive, these links
|
||||||
@@ -266,22 +430,98 @@ show_devices()
|
|||||||
then
|
then
|
||||||
BLOCK_DEV=`ls $SCSI_DEVICE_PATH | grep block:`
|
BLOCK_DEV=`ls $SCSI_DEVICE_PATH | grep block:`
|
||||||
GEN_DEV=`ls $SCSI_DEVICE_PATH |\
|
GEN_DEV=`ls $SCSI_DEVICE_PATH |\
|
||||||
grep scsi_generic:`
|
grep scsi_generic:`
|
||||||
echo -n "$SYSFS/block/${BLOCK_DEV#*:} "
|
echo -n "$SYSFS/block/${BLOCK_DEV#*:} "
|
||||||
echo "$SYSFS/class/scsi_generic/${GEN_DEV#*:}"
|
echo "$SYSFS/class/scsi_generic/${GEN_DEV#*:}"
|
||||||
|
|
||||||
|
elif [ -d $SCSI_DEVICE_PATH/block ] && $SHOW_EXTENDED
|
||||||
|
then
|
||||||
|
# case without CONFIG_SYSFS_DEPRECATED
|
||||||
|
BLOCK_DEV=$(echo $SCSI_DEVICE_PATH/block/*)
|
||||||
|
BLOCK_DEV=${BLOCK_DEV##*/}
|
||||||
|
echo -n "$SYSFS/block/$BLOCK_DEV "
|
||||||
|
local SGPATH=$SCSI_DEVICE_PATH/scsi_generic
|
||||||
|
if [ -d $SGPATH ]; then
|
||||||
|
GEN_DEV=$(echo $SGPATH/*)
|
||||||
|
GEN_DEV=${GEN_DEV##*/}
|
||||||
|
echo "$SYSFS/class/scsi_generic/$GEN_DEV"
|
||||||
|
else
|
||||||
|
echo "-"
|
||||||
|
fi
|
||||||
|
|
||||||
# FIXME Find a way to assign the generic devices.
|
# FIXME Find a way to assign the generic devices.
|
||||||
elif [ -r $SYSFS/../runtime.out ]; then
|
elif [ -r $SYSFS/../runtime.out ]; then
|
||||||
SCSI_DEV=`basename $SCSI_DEVICE_PATH`
|
SCSI_DEV=`basename $SCSI_DEVICE_PATH`
|
||||||
echo "$SYSFS/block/"`grep -r "\[$SCSI_DEV\]"\
|
echo "$SYSFS/block/"`grep -r "\[$SCSI_DEV\]"\
|
||||||
$SYSFS/../runtime.out |\
|
$SYSFS/../runtime.out |\
|
||||||
awk -F "/dev/" '{print $2}'`
|
awk -F "/dev/" '{print $2}'`
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if $SHOW_ATTRIBUTES && [ $SHOW_MORE_ATTRS -ge 1 ]; then
|
||||||
|
# auto scan LUNs not necessarily have a zfcp_unit
|
||||||
|
if [ -d $ZFCP_UNIT_PATH ]; then
|
||||||
|
echo 'Class = "zfcp_unit"'
|
||||||
|
show_attributes "$ZFCP_UNIT_PATH"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
if $SHOW_ATTRIBUTES; then
|
if $SHOW_ATTRIBUTES; then
|
||||||
echo 'Class = "scsi_device"'
|
echo 'Class = "scsi_device"'
|
||||||
show_attributes "$SCSI_DEVICE_PATH"
|
show_attributes "$SCSI_DEVICE_PATH"
|
||||||
|
fi
|
||||||
|
if $SHOW_ATTRIBUTES && [ $SHOW_MORE_ATTRS -ge 2 ]; then
|
||||||
|
if [ -d $SCSI_DEVICE_PATH/scsi_disk ]; then
|
||||||
|
echo 'Class = "scsi_disk"'
|
||||||
|
show_attributes "$SCSI_DEVICE_PATH/scsi_disk/$(basename $SCSI_DEVICE_PATH)"
|
||||||
|
fi
|
||||||
|
if [ -d $SCSI_DEVICE_PATH/block ]; then
|
||||||
|
echo 'Class = "block"'
|
||||||
|
show_attributes "$SCSI_DEVICE_PATH/block/*/"
|
||||||
|
fi
|
||||||
|
if [ -d $SCSI_DEVICE_PATH/block/*/integrity ]; then
|
||||||
|
echo 'Class = "block_integrity"'
|
||||||
|
show_attributes "$SCSI_DEVICE_PATH/block/*/integrity"
|
||||||
|
fi
|
||||||
|
if [ -d $SCSI_DEVICE_PATH/block/*/queue ]; then
|
||||||
|
echo 'Class = "block_queue"'
|
||||||
|
show_attributes "$SCSI_DEVICE_PATH/block/*/queue"
|
||||||
|
fi
|
||||||
|
if [ -d $SCSI_DEVICE_PATH/block/*/queue/iosched ]; then
|
||||||
|
echo 'Class = "block_queue_iosched"'
|
||||||
|
show_attributes "$SCSI_DEVICE_PATH/block/*/queue/iosched"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if $SHOW_ATTRIBUTES; then
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# what's left in ZFCP_UNIT_LIST are now units without SCSI device
|
||||||
|
for UNIT_PATH in $ZFCP_UNIT_LIST; do
|
||||||
|
STRIPPED_PATH=$UNIT_PATH
|
||||||
|
LUN=${UNIT_PATH##*/}
|
||||||
|
STRIPPED_PATH=${STRIPPED_PATH%/*}
|
||||||
|
WWPN=${STRIPPED_PATH##*/}
|
||||||
|
STRIPPED_PATH=${STRIPPED_PATH%/*}
|
||||||
|
ADAPTER=${STRIPPED_PATH##*/}
|
||||||
|
|
||||||
|
[ $LUN != ${PAR_LUN:-$LUN} ] && continue
|
||||||
|
[ $WWPN != ${PAR_WWPN:-$WWPN} ] && continue
|
||||||
|
[ $ADAPTER != ${PAR_BUSID:-$ADAPTER} ] && continue
|
||||||
|
|
||||||
|
if [ $VERBOSITY -eq 0 ]; then
|
||||||
|
echo "$ADAPTER/$WWPN/$LUN - failed"
|
||||||
|
else
|
||||||
|
echo "$UNIT_PATH failed"
|
||||||
|
echo "-"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if $SHOW_ATTRIBUTES && [ $SHOW_MORE_ATTRS -ge 1 ]; then
|
||||||
|
echo 'Class = "zfcp_unit"'
|
||||||
|
show_attributes "$UNIT_PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if $SHOW_ATTRIBUTES; then
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -290,8 +530,8 @@ show_devices()
|
|||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
ARGS=`getopt --options ahvHPDVb:p:l:s: --longoptions \
|
ARGS=`getopt --options ahvHPDVb:p:l:s:emZ --longoptions \
|
||||||
attributes,help,version,hosts,ports,devices,verbose,busid:,wwpn:,lun:,sysfs: \
|
attributes,help,version,hosts,ports,devices,verbose,busid:,wwpn:,lun:,sysfs:,extended,moreattrs,modparms \
|
||||||
-n "$SCRIPTNAME" -- "$@"`
|
-n "$SCRIPTNAME" -- "$@"`
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
@@ -305,6 +545,8 @@ eval set -- "$ARGS"
|
|||||||
for ARG; do
|
for ARG; do
|
||||||
case "$ARG" in
|
case "$ARG" in
|
||||||
-a|--attributes) SHOW_ATTRIBUTES=true; shift 1;;
|
-a|--attributes) SHOW_ATTRIBUTES=true; shift 1;;
|
||||||
|
-m|--moreattrs) ((SHOW_MORE_ATTRS++)); shift 1;;
|
||||||
|
-e|--extended) SHOW_EXTENDED=true; shift 1;;
|
||||||
-b|--busid) PAR_BUSID=$2; shift 2;;
|
-b|--busid) PAR_BUSID=$2; shift 2;;
|
||||||
-h|--help) print_help; exit 0;;
|
-h|--help) print_help; exit 0;;
|
||||||
-l|--lun) PAR_LUN=$2; shift 2;;
|
-l|--lun) PAR_LUN=$2; shift 2;;
|
||||||
@@ -314,6 +556,7 @@ for ARG; do
|
|||||||
-D|--devices) SHOW_DEVICES=1; shift 1;;
|
-D|--devices) SHOW_DEVICES=1; shift 1;;
|
||||||
-P|--ports) SHOW_PORTS=1; shift 1;;
|
-P|--ports) SHOW_PORTS=1; shift 1;;
|
||||||
-V|--verbose) VERBOSITY=1; shift 1;;
|
-V|--verbose) VERBOSITY=1; shift 1;;
|
||||||
|
-Z|--modparms) SHOW_MODPARMS=1; shift 1;;
|
||||||
-s|--sysfs) SYSFS=$2; shift 2;;
|
-s|--sysfs) SYSFS=$2; shift 2;;
|
||||||
--) shift; break;;
|
--) shift; break;;
|
||||||
esac
|
esac
|
||||||
@@ -325,6 +568,10 @@ check_fc_class
|
|||||||
check_fcp_devs
|
check_fcp_devs
|
||||||
|
|
||||||
default=1
|
default=1
|
||||||
|
if [ $SHOW_MODPARMS -eq 1 ]; then
|
||||||
|
default=0; show_modparms
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $SHOW_HOSTS -eq 1 ]; then
|
if [ $SHOW_HOSTS -eq 1 ]; then
|
||||||
default=0; show_hosts
|
default=0; show_hosts
|
||||||
elif [ $SHOW_PORTS -eq 0 -a $SHOW_DEVICES -eq 0 -a -n "$PAR_BUSID" ]; then
|
elif [ $SHOW_PORTS -eq 0 -a $SHOW_DEVICES -eq 0 -a -n "$PAR_BUSID" ]; then
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
.\" Copyright IBM Corp. 2006, 2017
|
.\" Copyright IBM Corp. 2006, 2019
|
||||||
.\" s390-tools is free software; you can redistribute it and/or modify
|
.\" s390-tools is free software; you can redistribute it and/or modify
|
||||||
.\" it under the terms of the MIT license. See LICENSE for details.
|
.\" it under the terms of the MIT license. See LICENSE for details.
|
||||||
.\"
|
.\"
|
||||||
.TH LSZFCP 8 "Mar 2008" "s390-tools"
|
.TH LSZFCP 8 "Feb 2019" "s390-tools"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
lszfcp \- list information about zfcp adapters, ports, and units
|
lszfcp \- list information about zfcp adapters, ports, and units
|
||||||
|
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B lszfcp
|
.B lszfcp
|
||||||
.RB [ \-hvVaHDP ]
|
.RB [ \-hvVaZHDPem ]
|
||||||
.RB [ \-b
|
.RB [ \-b
|
||||||
.IR busid ]
|
.IR busid ]
|
||||||
.RB [ \-l
|
.RB [ \-l
|
||||||
@@ -28,8 +28,10 @@ scsi_devices.
|
|||||||
The default is to list busids of all zfcp adapters and their corresponding
|
The default is to list busids of all zfcp adapters and their corresponding
|
||||||
SCSI host names.
|
SCSI host names.
|
||||||
|
|
||||||
There are three output variants. Default (without options "-a" or
|
There are four output variants. Default (without options "-a" or
|
||||||
"-V") is one line for each object. For adapters the busid and their
|
"-V" or "-Z") is one line for each object.
|
||||||
|
For the zfcp device driver (module), its parameters are listed.
|
||||||
|
For adapters the busid and their
|
||||||
corresponding SCSI host names are listed. For ports the pair
|
corresponding SCSI host names are listed. For ports the pair
|
||||||
"busid"/"wwpn" and their corresponding FC-remote-port names are listed.
|
"busid"/"wwpn" and their corresponding FC-remote-port names are listed.
|
||||||
For units the triple "busid"/"wwpn"/"lun" and their corresponding SCSI
|
For units the triple "busid"/"wwpn"/"lun" and their corresponding SCSI
|
||||||
@@ -37,20 +39,53 @@ device names are listed.
|
|||||||
|
|
||||||
Option "-V" additionally shows the sysfs paths of interest for the
|
Option "-V" additionally shows the sysfs paths of interest for the
|
||||||
listed object.
|
listed object.
|
||||||
|
If a SCSI device has an associated block device (disk)
|
||||||
|
and SCSI generic (sg) device, show their sysfs paths in a 3rd line.
|
||||||
|
|
||||||
Option "-a" additionally shows all attributes of interest found in
|
Option "-a" additionally shows attributes of interest found in
|
||||||
sysfs for the listed object.
|
sysfs for the listed object.
|
||||||
|
|
||||||
|
Option "-m" together with option "-a" shows sysfs attributes if available for:
|
||||||
|
host: css (subchannel); port: zfcp_port; lun: zfcp_unit.
|
||||||
|
Specifying option "-m" twice together with option "-a"
|
||||||
|
additionally shows SCSI device sysfs attributes
|
||||||
|
if available for:
|
||||||
|
scsi_disk, block, block_integrity, block_queue, block_queue_iosched.
|
||||||
|
|
||||||
|
Option "-e" enables an extended output format.
|
||||||
|
It enumerates all hosts/ports/luns independent of their state.
|
||||||
|
It also produces some improved error messages.
|
||||||
|
The extended output format can help determining problems.
|
||||||
|
Since a long time, without option "-e", lszfcp has
|
||||||
|
.I
|
||||||
|
not
|
||||||
|
enumerated:
|
||||||
|
hosts that have never been online (since last bind to zfcp device driver),
|
||||||
|
hosts that are defunct (CHPID configured off, or z/VM detach),
|
||||||
|
ports with fc_rport port_state unequal to "Online" (such as fibres pulled),
|
||||||
|
zfcp units without associated SCSI device (unit_add of non-existent LUN).
|
||||||
|
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
.B -a, --attributes
|
.B -a, --attributes
|
||||||
Show all attributes of the specified objects.
|
Show the most interesting attributes of the specified objects.
|
||||||
|
.TP
|
||||||
|
.B -m, --moreattrs
|
||||||
|
Show more attributes of the specified objects.
|
||||||
|
Host: css (subchannel). Port: zfcp_port. Lun: zfcp_unit.
|
||||||
|
If specified twice,
|
||||||
|
show additional attributes of the specified SCSI device objects:
|
||||||
|
scsi_disk, block, block_integrity, block_queue, block_queue_iosched.
|
||||||
|
.TP
|
||||||
|
.B -Z, --modparms
|
||||||
|
List zfcp (module) parameters with a scope of the device driver.
|
||||||
.TP
|
.TP
|
||||||
.B -D, --devices
|
.B -D, --devices
|
||||||
List zfcp units and SCSI devices.
|
List zfcp units and SCSI devices.
|
||||||
.TP
|
.TP
|
||||||
.B -H, --hosts
|
.B -H, --hosts
|
||||||
List zfcp adapters and fc-hosts (default). Information is given only
|
List zfcp adapters, fc-hosts, and scsi-hosts (default).
|
||||||
|
Without option "-e", information is given only
|
||||||
for adapters that are online (registered at the SCSI stack).
|
for adapters that are online (registered at the SCSI stack).
|
||||||
.TP
|
.TP
|
||||||
.B -P, --ports
|
.B -P, --ports
|
||||||
@@ -69,9 +104,14 @@ List zfcp port(s) and FC remote port(s) selected by wwpn. (Information
|
|||||||
for several ports might be shown if a remote port is configured for
|
for several ports might be shown if a remote port is configured for
|
||||||
different adapters.)
|
different adapters.)
|
||||||
.TP
|
.TP
|
||||||
|
.B -e, --extended
|
||||||
|
Generate extended output.
|
||||||
|
.TP
|
||||||
.B -V, --verbose
|
.B -V, --verbose
|
||||||
Generate verbose output. Display sysfs path names of class and bus
|
Generate verbose output. Display sysfs path names of class and bus
|
||||||
devices that are of interest for this object.
|
devices that are of interest for this object.
|
||||||
|
If a SCSI device has an associated block device (disk)
|
||||||
|
and SCSI generic (sg) device, show their sysfs paths in a 3rd line.
|
||||||
.TP
|
.TP
|
||||||
.B -s, --sysfs /path/to/sys
|
.B -s, --sysfs /path/to/sys
|
||||||
Use path as sysfs (for dbginfo archives).
|
Use path as sysfs (for dbginfo archives).
|
||||||
@@ -86,7 +126,7 @@ Display version info and exit.
|
|||||||
.PP
|
.PP
|
||||||
Options "-b", "-p" or "-l" are of restricting nature. They limit the output
|
Options "-b", "-p" or "-l" are of restricting nature. They limit the output
|
||||||
to those adapters, ports or units that match the specified busid, wwpn and lun.
|
to those adapters, ports or units that match the specified busid, wwpn and lun.
|
||||||
If none of the options "-H", "-P" and "-D" are specified, "-b" implies "-H",
|
If none of the options "-Z", "-H", "-P" and "-D" are specified, "-b" implies "-H",
|
||||||
"-p" implies "-P" and "-l" implies "-D".
|
"-p" implies "-P" and "-l" implies "-D".
|
||||||
|
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
@@ -105,6 +145,8 @@ Show all adapters that match the given busid, all ports that match the given
|
|||||||
busid and wwpnn and show all units that match the given busid, wwpn and lun.
|
busid and wwpnn and show all units that match the given busid, wwpn and lun.
|
||||||
.IP "lszfcp -b 0.0.0815 -p 0x5005123456789000 -l 0x0000000000000000 -H -P -D"
|
.IP "lszfcp -b 0.0.0815 -p 0x5005123456789000 -l 0x0000000000000000 -H -P -D"
|
||||||
Generates same output as previous example.
|
Generates same output as previous example.
|
||||||
|
.IP "lszfcp -ZHPDVeamm"
|
||||||
|
Generates the fullest output in the extended format.
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR lscss (8)
|
.BR lscss (8)
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,27 @@
|
|||||||
include ../../common.mak
|
include ../../common.mak
|
||||||
|
|
||||||
all: chzcrypt lszcrypt zcryptctl
|
all: chzcrypt lszcrypt zcryptctl zcryptstats
|
||||||
|
|
||||||
libs = $(rootdir)/libutil/libutil.a
|
libs = $(rootdir)/libutil/libutil.a
|
||||||
|
|
||||||
chzcrypt: chzcrypt.o misc.o $(libs)
|
chzcrypt: chzcrypt.o misc.o $(libs)
|
||||||
lszcrypt: lszcrypt.o misc.o $(libs)
|
lszcrypt: lszcrypt.o misc.o $(libs)
|
||||||
zcryptctl: zcryptctl.o misc.o $(libs)
|
zcryptctl: zcryptctl.o misc.o $(libs)
|
||||||
|
zcryptstats: zcryptstats.o $(libs)
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)
|
$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)
|
||||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 chzcrypt $(DESTDIR)$(BINDIR)
|
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 chzcrypt $(DESTDIR)$(BINDIR)
|
||||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 lszcrypt $(DESTDIR)$(BINDIR)
|
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 lszcrypt $(DESTDIR)$(BINDIR)
|
||||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 zcryptctl $(DESTDIR)$(BINDIR)
|
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 zcryptctl $(DESTDIR)$(BINDIR)
|
||||||
|
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 zcryptstats $(DESTDIR)$(BINDIR)
|
||||||
$(INSTALL) -d -m 755 $(DESTDIR)$(MANDIR)/man8
|
$(INSTALL) -d -m 755 $(DESTDIR)$(MANDIR)/man8
|
||||||
$(INSTALL) -m 644 -c chzcrypt.8 $(DESTDIR)$(MANDIR)/man8
|
$(INSTALL) -m 644 -c chzcrypt.8 $(DESTDIR)$(MANDIR)/man8
|
||||||
$(INSTALL) -m 644 -c lszcrypt.8 $(DESTDIR)$(MANDIR)/man8
|
$(INSTALL) -m 644 -c lszcrypt.8 $(DESTDIR)$(MANDIR)/man8
|
||||||
$(INSTALL) -m 644 -c zcryptctl.8 $(DESTDIR)$(MANDIR)/man8
|
$(INSTALL) -m 644 -c zcryptctl.8 $(DESTDIR)$(MANDIR)/man8
|
||||||
|
$(INSTALL) -m 644 -c zcryptstats.8 $(DESTDIR)$(MANDIR)/man8
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o chzcrypt lszcrypt zcryptctl
|
rm -f *.o chzcrypt lszcrypt zcryptctl zcryptstats
|
||||||
|
|
||||||
.PHONY: all install clean
|
.PHONY: all install clean
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
.\" Copyright 2017 IBM Corp.
|
.\" Copyright 2019 IBM Corp.
|
||||||
.\" s390-tools is free software; you can redistribute it and/or modify
|
.\" s390-tools is free software; you can redistribute it and/or modify
|
||||||
.\" it under the terms of the MIT license. See LICENSE for details.
|
.\" it under the terms of the MIT license. See LICENSE for details.
|
||||||
.\"
|
.\"
|
||||||
.TH CHZCRYPT 8 "OCT 2017" "s390-tools"
|
.TH CHZCRYPT 8 "AUG 2019" "s390-tools"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
chzcrypt \- modify zcrypt configuration
|
chzcrypt \- modify zcrypt configuration
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* chzcrypt - Tool to modify zcrypt configuration
|
* chzcrypt - Tool to modify zcrypt configuration
|
||||||
*
|
*
|
||||||
* Copyright IBM Corp. 2008, 2017
|
* Copyright IBM Corp. 2008, 2019
|
||||||
*
|
*
|
||||||
* s390-tools is free software; you can redistribute it and/or modify
|
* s390-tools is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
@@ -47,7 +47,7 @@ const struct util_prg prg = {
|
|||||||
{
|
{
|
||||||
.owner = "IBM Corp.",
|
.owner = "IBM Corp.",
|
||||||
.pub_first = 2008,
|
.pub_first = 2008,
|
||||||
.pub_last = 2017,
|
.pub_last = 2019,
|
||||||
},
|
},
|
||||||
UTIL_PRG_COPYRIGHT_END
|
UTIL_PRG_COPYRIGHT_END
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
.\" lszcrypt.8
|
.\" lszcrypt.8
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright 2017 IBM Corp.
|
.\" Copyright 2019 IBM Corp.
|
||||||
.\" s390-tools is free software; you can redistribute it and/or modify
|
.\" s390-tools is free software; you can redistribute it and/or modify
|
||||||
.\" it under the terms of the MIT license. See LICENSE for details.
|
.\" it under the terms of the MIT license. See LICENSE for details.
|
||||||
.\"
|
.\"
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
.\" nroff -man lszcrypt.8
|
.\" nroff -man lszcrypt.8
|
||||||
.\" to process this source
|
.\" to process this source
|
||||||
.\"
|
.\"
|
||||||
.TH LSZCRYPT 8 "JAN 2019" "s390-tools"
|
.TH LSZCRYPT 8 "AUG 2019" "s390-tools"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
lszcrypt \- display zcrypt device and configuration information
|
lszcrypt \- display zcrypt device and configuration information
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@@ -118,7 +118,7 @@ explanation:
|
|||||||
.B TYPE and HWTYPE
|
.B TYPE and HWTYPE
|
||||||
The HWTYPE is a numeric value showing which type of hardware the zcrypt
|
The HWTYPE is a numeric value showing which type of hardware the zcrypt
|
||||||
device driver presumes that this crypto card is. The currently known values
|
device driver presumes that this crypto card is. The currently known values
|
||||||
are 7=CEX3C, 8=CEX3A, 10=CEX4, 11=CEX5 and 12=CEX6.
|
are 7=CEX3C, 8=CEX3A, 10=CEX4, 11=CEX5, 12=CEX6 and 13=CEX7.
|
||||||
.br
|
.br
|
||||||
The TYPE is a human readable value showing the hardware type and the basic
|
The TYPE is a human readable value showing the hardware type and the basic
|
||||||
function type (A=Accelerator, C=CCA Coprocessor, P=EP11 Coprocessor). So
|
function type (A=Accelerator, C=CCA Coprocessor, P=EP11 Coprocessor). So
|
||||||
@@ -167,7 +167,7 @@ operations within the guests.
|
|||||||
.B DRIVER
|
.B DRIVER
|
||||||
.br
|
.br
|
||||||
Shows which card or queue device driver currently handles this crypto
|
Shows which card or queue device driver currently handles this crypto
|
||||||
resource. Currently known drivers are cex4card/cex4queue (CEX4-CEX6
|
resource. Currently known drivers are cex4card/cex4queue (CEX4-CEX7
|
||||||
hardware), cex2card/cex2cqueue (CEX2C and CEX3C hardware),
|
hardware), cex2card/cex2cqueue (CEX2C and CEX3C hardware),
|
||||||
cex2acard/cex2aqueue (CEX2A and CEX3A hardware) and vfio_ap (queue reserved
|
cex2acard/cex2aqueue (CEX2A and CEX3A hardware) and vfio_ap (queue reserved
|
||||||
for use by kvm hypervisor for kvm guests and not accessible to host
|
for use by kvm hypervisor for kvm guests and not accessible to host
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* lszcrypt - Display zcrypt devices and configuration settings
|
* lszcrypt - Display zcrypt devices and configuration settings
|
||||||
*
|
*
|
||||||
* Copyright IBM Corp. 2008, 2018
|
* Copyright IBM Corp. 2008, 2019
|
||||||
*
|
*
|
||||||
* s390-tools is free software; you can redistribute it and/or modify
|
* s390-tools is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
@@ -86,7 +86,7 @@ const struct util_prg prg = {
|
|||||||
{
|
{
|
||||||
.owner = "IBM Corp.",
|
.owner = "IBM Corp.",
|
||||||
.pub_first = 2008,
|
.pub_first = 2008,
|
||||||
.pub_last = 2018,
|
.pub_last = 2019,
|
||||||
},
|
},
|
||||||
UTIL_PRG_COPYRIGHT_END
|
UTIL_PRG_COPYRIGHT_END
|
||||||
}
|
}
|
||||||
@@ -302,9 +302,10 @@ static void show_capability(const char *id_str)
|
|||||||
printf("%s\n", CAP_CCA);
|
printf("%s\n", CAP_CCA);
|
||||||
printf("%s", CAP_RNG);
|
printf("%s", CAP_RNG);
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10: /* CEX4S */
|
||||||
case 11:
|
case 11: /* CEX5S */
|
||||||
case 12:
|
case 12: /* CEX6S */
|
||||||
|
case 13: /* CEX7S */
|
||||||
if (func_val & MASK_ACCEL) {
|
if (func_val & MASK_ACCEL) {
|
||||||
if (func_val & MASK_RSA4K)
|
if (func_val & MASK_RSA4K)
|
||||||
printf("%s", CAP_RSA4K);
|
printf("%s", CAP_RSA4K);
|
||||||
|
|||||||
252
zconf/zcrypt/zcryptstats.8
Normal file
252
zconf/zcrypt/zcryptstats.8
Normal file
@@ -0,0 +1,252 @@
|
|||||||
|
.\" Copyright IBM Corp. 2019
|
||||||
|
.\" s390-tools is free software; you can redistribute it and/or modify
|
||||||
|
.\" it under the terms of the MIT license. See LICENSE for details.
|
||||||
|
.\"
|
||||||
|
.TH ZCRYPTSTATS 1 "January 2019" "s390-tools"
|
||||||
|
.SH NAME
|
||||||
|
zcryptstats \- Display usage statistics of IBM Crypto Express adapters
|
||||||
|
.
|
||||||
|
.
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B zcryptstats
|
||||||
|
.RI [ OPTIONS ]
|
||||||
|
.RI [ DEVICE_ID
|
||||||
|
[...] ]
|
||||||
|
.
|
||||||
|
.PP
|
||||||
|
.B zcryptstats
|
||||||
|
.BR \-\-help | \-h
|
||||||
|
.br
|
||||||
|
.B zcryptstats
|
||||||
|
.BR \-\-version | \-v
|
||||||
|
.
|
||||||
|
.
|
||||||
|
.
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.
|
||||||
|
Use \fBzcryptstats\fP to display usage statistics of IBM Crypto Express
|
||||||
|
adapters.
|
||||||
|
.PP
|
||||||
|
\fBzcryptstats\fP obtains cryptographic performance measurement data
|
||||||
|
periodically and displays the data for each cryptographic device for each
|
||||||
|
interval.
|
||||||
|
A cryptographic device can be either a card device or a queue device (APQN).
|
||||||
|
\fBzcryptstats\fP runs forever unless you limit the number of intervals with
|
||||||
|
the \fB\-\-count\fP option. The default interval time is 10 seconds.
|
||||||
|
Use the \fB\-\-interval\fP option to specify a different interval time.
|
||||||
|
.PP
|
||||||
|
By default, all available cryptographic devices are monitored.
|
||||||
|
You can optionally specify the device IDs of the devices to be monitored.
|
||||||
|
The card device representation and the queue device are both in hexadecimal
|
||||||
|
notation.
|
||||||
|
.PP
|
||||||
|
Use the \fB\-\-no-apqn\fP option to omit the performance measurement data of
|
||||||
|
the queues. If the system does not support obtaining cryptographic
|
||||||
|
performance measurement data on the queue devices, only the card devices
|
||||||
|
are monitored.
|
||||||
|
.PP
|
||||||
|
For each device, a set of counters is displayed. The amount and meaning of the
|
||||||
|
counters are dependent on the device type and mode, see the COUNTERS section.
|
||||||
|
For each counter and interval, the following values are displayed:
|
||||||
|
.RS 2
|
||||||
|
.IP "\(bu" 2
|
||||||
|
Number of measured operations.
|
||||||
|
.IP "\(bu" 2
|
||||||
|
Rate of the measured operation in operations per second.
|
||||||
|
.IP "\(bu" 2
|
||||||
|
Utilization of the device in percent.
|
||||||
|
.IP "\(bu" 2
|
||||||
|
Average duration of the operations.
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
The sum of all operations is displayed in a separate \fBtotals\fP line.
|
||||||
|
Use the \fB\-\-only-totals\fP option to omit the individual counters and
|
||||||
|
display the totals only. Use the \fB\-\-no\-totals\fP option to omit the
|
||||||
|
totals.
|
||||||
|
.PP
|
||||||
|
|
||||||
|
.B Note:
|
||||||
|
The utilization value of a counter can exceed 100%. This value is caused by
|
||||||
|
the parallel execution of cryptographic operations.
|
||||||
|
.PP
|
||||||
|
Cryptographic performance measurement data might not be available when Linux
|
||||||
|
is running as guest under z/VM or under KVM. \fBzcryptstats\fP then displays an
|
||||||
|
error message and exits.
|
||||||
|
.PP
|
||||||
|
.B Note:
|
||||||
|
\fBzcryptstats\fP utilizes the device node \fB/dev/chsc\fP. When this device
|
||||||
|
node is not available, you might have to load kernel module \fBchsc_sch\fP using
|
||||||
|
\fBmodprobe chsc_sch\fP to make it available.
|
||||||
|
.
|
||||||
|
.
|
||||||
|
.
|
||||||
|
.SH OPTIONS
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
.BR DEVICE_ID
|
||||||
|
Specifies a cryptographic device for which statistics are displayed.
|
||||||
|
A device ID can either be a card device ID
|
||||||
|
(\fI<card-id>\fP) or a queue device (APQN) ID (\fI<card-id>.<domain-id>\fP).
|
||||||
|
To filter all devices by domain, provide \fI.<domain-id>\fP.
|
||||||
|
If no IDs are given, statistics are displayed for all available devices.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
.BR \-i ", " \-\-interval\~\fIINTERVAL\fP
|
||||||
|
Specifies the interval time in seconds. If this option is omitted, then the
|
||||||
|
default interval time of 10 seconds is used.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
.BR \-c ", " \-\-count\~\fICOUNT\fP
|
||||||
|
Specifies the number of reports that are generated at \fIINTERVAL\fP seconds
|
||||||
|
apart. If this option is omitted, the \fBzcryptstats\fP command generates
|
||||||
|
reports continuously, until it is stopped with control-C.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
.BR \-o ", " \-\-output\~\fIJSON\fP|\fITABLE\fP|\fICSV\fP
|
||||||
|
Displays the statistics in the specified format. If this option is omitted, a
|
||||||
|
comprehensive report is displayed. Supported output formats are:
|
||||||
|
.RS 8
|
||||||
|
.IP "\(bu" 2
|
||||||
|
\fBJSON:\fP Displays the statistics in Javascript Object Notation (JSON) format.
|
||||||
|
JSON output field order is undefined, and new fields might be added in the
|
||||||
|
future.
|
||||||
|
.IP "\(bu" 2
|
||||||
|
\fBTABLE:\fP Displays the statistics in a human readable simple table format.
|
||||||
|
The individual counters are omitted, and only the totals are displayed.
|
||||||
|
This output format implies option \fB\-\-only-totals\fP.
|
||||||
|
.IP "\(bu" 2
|
||||||
|
\fBCSV:\fP Displays the statistics in comma-separated values format. The values
|
||||||
|
are separated with a semicolon. The individual counters are omitted, and only
|
||||||
|
the totals are displayed. This output format implies option
|
||||||
|
\fB\-\-only-totals\fP.
|
||||||
|
.RE
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
.BR \-t ", " \-\-no\-totals
|
||||||
|
Excludes the totals of all counters of a card device or queue device
|
||||||
|
(APQN). This option cannot be specified together with option
|
||||||
|
\fB\-\-only\-totals\fP or option \fB\-\-output\fP \fITABLE\fP|\fICSV\fP.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
.BR \-T ", " \-\-only\-totals
|
||||||
|
Displays only the totals of all counters of a card device or a queue device
|
||||||
|
(APQN), but not the individual counters. This option is implied with
|
||||||
|
option \fB\-\-output\fP \fITABLE\fP|\fICSV\fP.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
.BR \-a ", " \-\-no\-apqn
|
||||||
|
Displays only the counters of the card device, but omits the counters of the
|
||||||
|
queue device (APQN). If the system does not support obtaining cryptographic
|
||||||
|
performance measurement data on the queue devices, this option is implied.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
.BR \-M ", " \-\-map\-type\~\fIMAPPING\fP
|
||||||
|
Maps unknown cryptographic device types and modes to known types and modes.
|
||||||
|
This option should only be used when new, so far unknown cryptographic devices
|
||||||
|
are found. You can then map them to known devices and modes, provided that the
|
||||||
|
new cryptographic devices report the same counters as the known cryptographic
|
||||||
|
device to which it is mapped.
|
||||||
|
The mapping specification consists of a comma-separated list of
|
||||||
|
\fIFROM\-TYPE\fP:\fIFROM\-MODE\fP=\fITO\-TYPE\fP:\fITO\-MODE\fP specifications.
|
||||||
|
The type and mode values must be specified in decimal notation.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
.BR \-A ", " \-\-all
|
||||||
|
Displays all cards devices and queue devices (APQNs), not only those that are
|
||||||
|
available to the Linux instance. Using this option additional cryptographic
|
||||||
|
devices that are available in the CEC, but not available to the Linux system
|
||||||
|
are also monitored.
|
||||||
|
This option cannot be specified together with option \fB\-\-only-online\fP.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
.BR \-O ", " \-\-only\-online
|
||||||
|
Displays only online cards devices and queue devices (APQNs). This option
|
||||||
|
cannot be specified together with option \fB\-\-all\fP.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
.BR \-V ", " \-\-verbose
|
||||||
|
Displays additional information messages during processing.
|
||||||
|
.TP
|
||||||
|
.BR \-h ", " \-\-help
|
||||||
|
Displays help text and exits.
|
||||||
|
.TP
|
||||||
|
.BR \-v ", " \-\-version
|
||||||
|
Displays version information and exits.
|
||||||
|
.
|
||||||
|
.
|
||||||
|
.
|
||||||
|
.SH COUNTERS
|
||||||
|
.
|
||||||
|
.PP
|
||||||
|
.B IBM Crypto Express adapter in accelerator mode:
|
||||||
|
.RS 4
|
||||||
|
.TP
|
||||||
|
.B All
|
||||||
|
All operations on the adapter
|
||||||
|
.TP
|
||||||
|
.B RSA Key-gen
|
||||||
|
RSA-key-generation operations (also included in \fBAll\fP).
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
.B IBM Crypto Express adapter in CCA co-processor mode:
|
||||||
|
.RS 4
|
||||||
|
.TP
|
||||||
|
.B RSA 1024 ME
|
||||||
|
1024-bit ME-format RSA operations.
|
||||||
|
.TP
|
||||||
|
.B RSA 2048 ME
|
||||||
|
2048-bit ME-format RSA operations.
|
||||||
|
.TP
|
||||||
|
.B RSA 1024 CRT
|
||||||
|
1024-bit CRT-format RSA operations.
|
||||||
|
.TP
|
||||||
|
.B RSA 2048 CRT
|
||||||
|
2048-bit CRT-format RSA operations.
|
||||||
|
.TP
|
||||||
|
.B RSA 4096 ME
|
||||||
|
4096-bit ME-format RSA operations.
|
||||||
|
.TP
|
||||||
|
.B RSA 4096 CTR
|
||||||
|
4096-bit CRT-format RSA operations.
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
.B IBM Crypto Express adapter in EP11 co-processor mode:
|
||||||
|
.RS 4
|
||||||
|
.TP
|
||||||
|
.B Asym. Slow
|
||||||
|
Slow asymmetric-key functions.
|
||||||
|
.TP
|
||||||
|
.B Asym. Fast
|
||||||
|
Fast asymmetric-key functions.
|
||||||
|
.TP
|
||||||
|
.B Symm. Partial
|
||||||
|
Symmetric-key functions that return partial or incremental results.
|
||||||
|
.TP
|
||||||
|
.B Symm. Complete
|
||||||
|
Symmetric-key functions that return a complete or final result.
|
||||||
|
.TP
|
||||||
|
.B Asym. Key-gen
|
||||||
|
asymmetric-key generation function.
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
.
|
||||||
|
.
|
||||||
|
.
|
||||||
|
.SH EXAMPLES
|
||||||
|
.TP
|
||||||
|
.B zcryptstats 02
|
||||||
|
Display statistics for all cryptographic devices with card ID \fB02\fP.
|
||||||
|
.TP
|
||||||
|
.B zcryptstats 02.0005 --interval 5
|
||||||
|
Display statistics for cryptographic devices with card ID \fB02\fP and domain
|
||||||
|
ID \fB0005\fP in a 5 second interval.
|
||||||
|
.TP
|
||||||
|
.B zcryptstats .0005 --count 10
|
||||||
|
Display statistics for cryptographic devices with domain ID \fB0005\fP with the
|
||||||
|
default interval time of 10 seconds, for 10 intervals.
|
||||||
|
.TP
|
||||||
|
.B zcryptstats 02 --output JSON
|
||||||
|
Display statistics for all cryptographic devices with card ID \fB02\fP in
|
||||||
|
\fBJSON\fP output format.
|
||||||
|
.TP
|
||||||
|
|
||||||
2425
zconf/zcrypt/zcryptstats.c
Normal file
2425
zconf/zcrypt/zcryptstats.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1128,12 +1128,6 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check existence of ccwgroup devices
|
|
||||||
if ! [ -d $CCWGROUPBUS_DIR ]; then
|
|
||||||
print_error "There are no ccwgroup devices"
|
|
||||||
exit $RC_NO_CCWGROUP
|
|
||||||
fi
|
|
||||||
|
|
||||||
# determine environment
|
# determine environment
|
||||||
check_vm_env
|
check_vm_env
|
||||||
|
|
||||||
@@ -1298,6 +1292,12 @@ then
|
|||||||
exit $RC_TOO_MUCH_ARGUMENTS
|
exit $RC_TOO_MUCH_ARGUMENTS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# check existence of ccwgroup devices
|
||||||
|
if ! [ -d $CCWGROUPBUS_DIR ]; then
|
||||||
|
print_error "There are no ccwgroup devices"
|
||||||
|
exit $RC_NO_CCWGROUP
|
||||||
|
fi
|
||||||
|
|
||||||
# react to parsed options
|
# react to parsed options
|
||||||
if [ $DO_ADD -eq 1 ]
|
if [ $DO_ADD -eq 1 ]
|
||||||
then
|
then
|
||||||
|
|||||||
@@ -136,6 +136,12 @@ void _warn(const char *, ...);
|
|||||||
fprintf(stderr, "%s:%d: ", __FILE__, __LINE__); \
|
fprintf(stderr, "%s:%d: ", __FILE__, __LINE__); \
|
||||||
_warn(__VA_ARGS__); \
|
_warn(__VA_ARGS__); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
void _warn_once(const char *, ...);
|
||||||
|
#define warn_once(...) do { \
|
||||||
|
if (debug_enabled) \
|
||||||
|
fprintf(stderr, "%s:%d: ", __FILE__, __LINE__); \
|
||||||
|
_warn_once(__VA_ARGS__); \
|
||||||
|
} while (0)
|
||||||
#define info(...) do { if (!quiet) fprintf(stdout_data ? stderr : stdout, \
|
#define info(...) do { if (!quiet) fprintf(stdout_data ? stderr : stdout, \
|
||||||
__VA_ARGS__); } while (0)
|
__VA_ARGS__); } while (0)
|
||||||
#define verb(...) do { if (verbose) fprintf(stdout_data ? stderr : stdout, \
|
#define verb(...) do { if (verbose) fprintf(stdout_data ? stderr : stdout, \
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ struct udev_file {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exit_code_t udev_read_file(const char *, struct udev_file **);
|
exit_code_t udev_read_file(const char *, struct udev_file **);
|
||||||
|
bool udev_file_is_empty(struct udev_file *file);
|
||||||
void udev_free_file(struct udev_file *);
|
void udev_free_file(struct udev_file *);
|
||||||
void udev_file_print(struct udev_file *);
|
void udev_file_print(struct udev_file *);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* zdev - Modify and display the persistent configuration of devices
|
* zdev - Modify and display the persistent configuration of devices
|
||||||
*
|
*
|
||||||
* Copyright IBM Corp. 2016, 2017
|
* Copyright IBM Corp. 2016, 2019
|
||||||
*
|
*
|
||||||
* s390-tools is free software; you can redistribute it and/or modify
|
* s390-tools is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
@@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "ccw.h"
|
#include "ccw.h"
|
||||||
|
#include "exit_code.h"
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
#define ZFCP_LUN_NAME "zfcp-lun"
|
#define ZFCP_LUN_NAME "zfcp-lun"
|
||||||
#define SCSI_ATTR_PREFIX "scsi_dev"
|
#define SCSI_ATTR_PREFIX "scsi_dev"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* chzdev: Configure z Systems specific devices
|
* chzdev: Configure z Systems specific devices
|
||||||
*
|
*
|
||||||
* Copyright IBM Corp. 2016, 2017
|
* Copyright IBM Corp. 2016, 2019
|
||||||
*
|
*
|
||||||
* s390-tools is free software; you can redistribute it and/or modify
|
* s390-tools is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
@@ -2573,7 +2573,7 @@ static exit_code_t do_export(struct options *opts)
|
|||||||
info("Exporting data to standard output\n");
|
info("Exporting data to standard output\n");
|
||||||
} else {
|
} else {
|
||||||
info("Exporting data to %s\n", opts->export);
|
info("Exporting data to %s\n", opts->export);
|
||||||
if (!util_path_exists(opts->export)) {
|
if (!util_path_exists("%s", opts->export)) {
|
||||||
rc = path_create(opts->export);
|
rc = path_create(opts->export);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* zdev - Modify and display the persistent configuration of devices
|
* zdev - Modify and display the persistent configuration of devices
|
||||||
*
|
*
|
||||||
* Copyright IBM Corp. 2016, 2017
|
* Copyright IBM Corp. 2016, 2019
|
||||||
*
|
*
|
||||||
* s390-tools is free software; you can redistribute it and/or modify
|
* s390-tools is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include "lib/util_path.h"
|
#include "lib/util_path.h"
|
||||||
|
|
||||||
@@ -521,7 +522,7 @@ void device_read_active_settings(struct device *dev, read_scope_t scope)
|
|||||||
s = setting_list_apply_actual(dev->active.settings, a, name,
|
s = setting_list_apply_actual(dev->active.settings, a, name,
|
||||||
value);
|
value);
|
||||||
if (link || (scope == scope_all &&
|
if (link || (scope == scope_all &&
|
||||||
!util_path_is_writable(path)))
|
util_path_is_readonly_file("%s", path)))
|
||||||
s->readonly = 1;
|
s->readonly = 1;
|
||||||
if (link)
|
if (link)
|
||||||
free(link);
|
free(link);
|
||||||
|
|||||||
@@ -78,6 +78,10 @@ static bool is_exportable(struct setting *s, config_t config)
|
|||||||
/* Skip values that cannot be determined. */
|
/* Skip values that cannot be determined. */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!attrib_check_value(a, s->value)) {
|
||||||
|
/* Skip values that are not acceptable input values. */
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!attrib_match_default(s->attrib, s->value)) {
|
if (!attrib_match_default(s->attrib, s->value)) {
|
||||||
/* All non-default values should be exported. */
|
/* All non-default values should be exported. */
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ unsigned long longrun_total;
|
|||||||
unsigned long longrun_current;
|
unsigned long longrun_current;
|
||||||
|
|
||||||
static struct util_list *delayed_messages;
|
static struct util_list *delayed_messages;
|
||||||
|
static struct util_list *warn_once_messages;
|
||||||
static FILE *dryrun_file;
|
static FILE *dryrun_file;
|
||||||
|
|
||||||
static FILE *dryrun_get_file(void)
|
static FILE *dryrun_get_file(void)
|
||||||
@@ -245,6 +246,7 @@ static void dryrun_print(void)
|
|||||||
void misc_exit(void)
|
void misc_exit(void)
|
||||||
{
|
{
|
||||||
strlist_free(delayed_messages);
|
strlist_free(delayed_messages);
|
||||||
|
strlist_free(warn_once_messages);
|
||||||
if (dryrun_file) {
|
if (dryrun_file) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
dryrun_print();
|
dryrun_print();
|
||||||
@@ -362,6 +364,29 @@ void _warn(const char *format, ...)
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Report a warning: print an error message to standard error. Only print each
|
||||||
|
* warning once. */
|
||||||
|
void _warn_once(const char *format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
char *str;
|
||||||
|
|
||||||
|
va_start(args, format);
|
||||||
|
if (vasprintf(&str, format, args) == -1)
|
||||||
|
oom();
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
/* Check if message was printed before. */
|
||||||
|
if (!warn_once_messages)
|
||||||
|
warn_once_messages = strlist_new();
|
||||||
|
if (!strlist_find(warn_once_messages, str)) {
|
||||||
|
fprintf(stderr, "%s", str);
|
||||||
|
strlist_add(warn_once_messages, "%s", str);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(str);
|
||||||
|
}
|
||||||
|
|
||||||
/* Print an error message indicating an out-of-memory situation and exit. */
|
/* Print an error message indicating an out-of-memory situation and exit. */
|
||||||
void oom(void)
|
void oom(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include "lib/util_path.h"
|
#include "lib/util_path.h"
|
||||||
@@ -259,7 +260,7 @@ bool module_set_params(const char *mod, struct setting_list *settings)
|
|||||||
struct setting *s;
|
struct setting *s;
|
||||||
char *path;
|
char *path;
|
||||||
const char *value;
|
const char *value;
|
||||||
bool result;
|
bool readonly;
|
||||||
exit_code_t rc;
|
exit_code_t rc;
|
||||||
|
|
||||||
/* First check if all modified settings can be applied this way. */
|
/* First check if all modified settings can be applied this way. */
|
||||||
@@ -277,9 +278,9 @@ bool module_set_params(const char *mod, struct setting_list *settings)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
path = path_get_sys_module_param(mod, s->name);
|
path = path_get_sys_module_param(mod, s->name);
|
||||||
result = util_path_is_writable(path);
|
readonly = util_path_is_readonly_file("%s", path);
|
||||||
free(path);
|
free(path);
|
||||||
if (!result) {
|
if (readonly) {
|
||||||
/* Sysfs file is not writable. */
|
/* Sysfs file is not writable. */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -346,6 +346,21 @@ exit_code_t udev_read_file(const char *path, struct udev_file **file_ptr)
|
|||||||
return EXIT_OK;
|
return EXIT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if a udev file does not contain any statements. */
|
||||||
|
bool udev_file_is_empty(struct udev_file *file)
|
||||||
|
{
|
||||||
|
struct udev_line_node *l;
|
||||||
|
|
||||||
|
if (!file)
|
||||||
|
return true;
|
||||||
|
util_list_iterate(&file->lines, l) {
|
||||||
|
if (l->line[0])
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static bool get_ids_cb(const char *filename, void *data)
|
static bool get_ids_cb(const char *filename, void *data)
|
||||||
{
|
{
|
||||||
char *prefix = data;
|
char *prefix = data;
|
||||||
|
|||||||
@@ -108,8 +108,13 @@ exit_code_t udev_ccw_read_device(struct device *dev, bool autoconf)
|
|||||||
rc = udev_read_file(path, &file);
|
rc = udev_read_file(path, &file);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto out;
|
goto out;
|
||||||
udev_file_get_settings(file, st->dev_attribs, state->settings);
|
if (udev_file_is_empty(file)) {
|
||||||
state->exists = 1;
|
warn_once("Warning: Invalid udev rule: %s\n", path);
|
||||||
|
state->exists = 0;
|
||||||
|
} else {
|
||||||
|
udev_file_get_settings(file, st->dev_attribs, state->settings);
|
||||||
|
state->exists = 1;
|
||||||
|
}
|
||||||
udev_free_file(file);
|
udev_free_file(file);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|||||||
@@ -163,9 +163,14 @@ exit_code_t udev_ccwgroup_read_device(struct device *dev, bool autoconf)
|
|||||||
rc = udev_read_file(path, &file);
|
rc = udev_read_file(path, &file);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto out;
|
goto out;
|
||||||
udev_file_get_settings(file, st->dev_attribs, state->settings);
|
if (udev_file_is_empty(file)) {
|
||||||
expand_id(dev, file);
|
warn_once("Warning: Invalid udev rule: %s\n", path);
|
||||||
state->exists = 1;
|
state->exists = 0;
|
||||||
|
} else {
|
||||||
|
udev_file_get_settings(file, st->dev_attribs, state->settings);
|
||||||
|
expand_id(dev, file);
|
||||||
|
state->exists = 1;
|
||||||
|
}
|
||||||
udev_free_file(file);
|
udev_free_file(file);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
@@ -344,6 +349,9 @@ static char *read_full_id(const char *path)
|
|||||||
out:
|
out:
|
||||||
free(text);
|
free(text);
|
||||||
|
|
||||||
|
if (!id)
|
||||||
|
warn_once("Warning: Invalid udev rule: %s\n", path);
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -345,6 +345,7 @@ static exit_code_t udev_read_zfcp_lun_rule(const char *filename,
|
|||||||
in_fc,
|
in_fc,
|
||||||
in_scsi,
|
in_scsi,
|
||||||
} state = none;
|
} state = none;
|
||||||
|
bool empty_rule = true;
|
||||||
|
|
||||||
rc = udev_read_file(filename, &file);
|
rc = udev_read_file(filename, &file);
|
||||||
if (rc)
|
if (rc)
|
||||||
@@ -374,16 +375,22 @@ static exit_code_t udev_read_zfcp_lun_rule(const char *filename,
|
|||||||
state = in_scsi;
|
state = in_scsi;
|
||||||
node = zfcp_lun_node_from_entry(entry, node,
|
node = zfcp_lun_node_from_entry(entry, node,
|
||||||
list);
|
list);
|
||||||
|
if (node)
|
||||||
|
empty_rule = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case in_fc:
|
case in_fc:
|
||||||
node = zfcp_lun_node_from_entry(entry, node, list);
|
node = zfcp_lun_node_from_entry(entry, node, list);
|
||||||
if (node)
|
if (node) {
|
||||||
add_fc_setting_from_entry(entry, node);
|
add_fc_setting_from_entry(entry, node);
|
||||||
|
empty_rule = false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case in_scsi:
|
case in_scsi:
|
||||||
if (node)
|
if (node) {
|
||||||
add_scsi_setting_from_entry(entry, node);
|
add_scsi_setting_from_entry(entry, node);
|
||||||
|
empty_rule = false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -393,6 +400,9 @@ static exit_code_t udev_read_zfcp_lun_rule(const char *filename,
|
|||||||
out:
|
out:
|
||||||
udev_free_file(file);
|
udev_free_file(file);
|
||||||
|
|
||||||
|
if (empty_rule)
|
||||||
|
warn_once("Warning: Invalid udev rule: %s\n", filename);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,11 +485,17 @@ static void zfcp_lun_node_to_state(struct zfcp_lun_node *node,
|
|||||||
struct attrib *a;
|
struct attrib *a;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
state->exists = 1;
|
|
||||||
state->modified = 0;
|
state->modified = 0;
|
||||||
state->deconfigured = 0;
|
state->deconfigured = 0;
|
||||||
state->definable = 0;
|
state->definable = 0;
|
||||||
|
|
||||||
|
if (!node) {
|
||||||
|
state->exists = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
state->exists = 1;
|
||||||
|
|
||||||
util_list_iterate(&node->fc_settings->list, s) {
|
util_list_iterate(&node->fc_settings->list, s) {
|
||||||
a = attrib_find(attribs, s->name);
|
a = attrib_find(attribs, s->name);
|
||||||
setting_list_add(state->settings,
|
setting_list_add(state->settings,
|
||||||
@@ -519,10 +535,7 @@ exit_code_t udev_zfcp_lun_read_device(struct device *dev, bool autoconf)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
node = zfcp_lun_node_find(luns, dev->devid);
|
node = zfcp_lun_node_find(luns, dev->devid);
|
||||||
if (node)
|
zfcp_lun_node_to_state(node, st->dev_attribs, state);
|
||||||
zfcp_lun_node_to_state(node, st->dev_attribs, state);
|
|
||||||
else
|
|
||||||
rc = EXIT_DEVICE_NOT_FOUND;
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
zfcp_lun_node_list_free(luns);
|
zfcp_lun_node_list_free(luns);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* zdev - Modify and display the persistent configuration of devices
|
* zdev - Modify and display the persistent configuration of devices
|
||||||
*
|
*
|
||||||
* Copyright IBM Corp. 2016, 2017
|
* Copyright IBM Corp. 2016, 2019
|
||||||
*
|
*
|
||||||
* s390-tools is free software; you can redistribute it and/or modify
|
* s390-tools is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
@@ -67,7 +67,7 @@ static struct attrib zfcp_tattr_allow_lun_scan = {
|
|||||||
"Control the use of the automatic LUN scanning feature for FCP\n"
|
"Control the use of the automatic LUN scanning feature for FCP\n"
|
||||||
"devices that are configured in N_PORT ID Virtualization mode.\n"
|
"devices that are configured in N_PORT ID Virtualization mode.\n"
|
||||||
" 0: Automatic LUN scanning is disabled\n"
|
" 0: Automatic LUN scanning is disabled\n"
|
||||||
" 1: Automatic LUN scanning is enabled\n\n",
|
" 1: Automatic LUN scanning is enabled\n",
|
||||||
.nounload = 1,
|
.nounload = 1,
|
||||||
.defval = "1",
|
.defval = "1",
|
||||||
.accept = ACCEPT_ARRAY(ACCEPT_RANGE(0, 1)),
|
.accept = ACCEPT_ARRAY(ACCEPT_RANGE(0, 1)),
|
||||||
@@ -75,16 +75,28 @@ static struct attrib zfcp_tattr_allow_lun_scan = {
|
|||||||
|
|
||||||
static struct attrib zfcp_tattr_dif = {
|
static struct attrib zfcp_tattr_dif = {
|
||||||
.name = "dif",
|
.name = "dif",
|
||||||
.title = "Enable DIF/DIX data consistency checking",
|
.title = "Enable DIF data consistency checking",
|
||||||
.desc =
|
.desc =
|
||||||
"Control the use of the end-to-end data consistency checking\n"
|
"Control the use of the DIF data consistency checking\n"
|
||||||
"mechanism (DIF/DIX):\n"
|
"mechanism:\n"
|
||||||
" 0: DIF is disabled\n"
|
" 0: DIF is disabled\n"
|
||||||
" 1: DIF is enabled when supported by the FCP device hardware\n",
|
" 1: DIF is enabled when supported by the FCP device hardware\n",
|
||||||
.defval = "0",
|
.defval = "0",
|
||||||
.accept = ACCEPT_ARRAY(ACCEPT_RANGE(0, 1)),
|
.accept = ACCEPT_ARRAY(ACCEPT_RANGE(0, 1)),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct attrib zfcp_tattr_dix = {
|
||||||
|
.name = "dix",
|
||||||
|
.title = "Enable DIF&DIX data consistency checking",
|
||||||
|
.desc =
|
||||||
|
"Control the use of the end-to-end data consistency checking\n"
|
||||||
|
"mechanism (DIF&DIX):\n"
|
||||||
|
" 0: DIF&DIX is disabled\n"
|
||||||
|
" 1: DIF&DIX is enabled when supported by the FCP device hardware\n",
|
||||||
|
.defval = "0",
|
||||||
|
.accept = ACCEPT_ARRAY(ACCEPT_RANGE(0, 1)),
|
||||||
|
};
|
||||||
|
|
||||||
static struct attrib zfcp_tattr_datarouter = {
|
static struct attrib zfcp_tattr_datarouter = {
|
||||||
.name = "datarouter",
|
.name = "datarouter",
|
||||||
.title = "Enable hardware data routing",
|
.title = "Enable hardware data routing",
|
||||||
@@ -160,6 +172,7 @@ static void all_bools_to_num(struct setting_list *list)
|
|||||||
util_list_iterate(&list->list, s) {
|
util_list_iterate(&list->list, s) {
|
||||||
if (s->attrib == &zfcp_tattr_allow_lun_scan ||
|
if (s->attrib == &zfcp_tattr_allow_lun_scan ||
|
||||||
s->attrib == &zfcp_tattr_dif ||
|
s->attrib == &zfcp_tattr_dif ||
|
||||||
|
s->attrib == &zfcp_tattr_dix ||
|
||||||
s->attrib == &zfcp_tattr_datarouter ||
|
s->attrib == &zfcp_tattr_datarouter ||
|
||||||
s->attrib == &zfcp_tattr_no_auto_port_rescan) {
|
s->attrib == &zfcp_tattr_no_auto_port_rescan) {
|
||||||
/* Convert Y to 1 and N to 0. */
|
/* Convert Y to 1 and N to 0. */
|
||||||
@@ -295,6 +308,7 @@ struct devtype zfcp_devtype = {
|
|||||||
&zfcp_tattr_queue_depth,
|
&zfcp_tattr_queue_depth,
|
||||||
&zfcp_tattr_allow_lun_scan,
|
&zfcp_tattr_allow_lun_scan,
|
||||||
&zfcp_tattr_dif,
|
&zfcp_tattr_dif,
|
||||||
|
&zfcp_tattr_dix,
|
||||||
&zfcp_tattr_datarouter,
|
&zfcp_tattr_datarouter,
|
||||||
&zfcp_tattr_no_auto_port_rescan,
|
&zfcp_tattr_no_auto_port_rescan,
|
||||||
&zfcp_tattr_port_scan_ratelimit,
|
&zfcp_tattr_port_scan_ratelimit,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* zdev - Modify and display the persistent configuration of devices
|
* zdev - Modify and display the persistent configuration of devices
|
||||||
*
|
*
|
||||||
* Copyright IBM Corp. 2016, 2017
|
* Copyright IBM Corp. 2016, 2019
|
||||||
*
|
*
|
||||||
* s390-tools is free software; you can redistribute it and/or modify
|
* s390-tools is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
@@ -64,7 +64,7 @@ static struct attrib zfcp_host_attr_port_rescan = {
|
|||||||
.title = "Trigger a port rescan for the FCP device",
|
.title = "Trigger a port rescan for the FCP device",
|
||||||
.desc =
|
.desc =
|
||||||
"Rescan FCP device for available remote ports by writing the value 1\n"
|
"Rescan FCP device for available remote ports by writing the value 1\n"
|
||||||
"to this attribute\n",
|
"to this attribute.\n",
|
||||||
.activeonly = 1,
|
.activeonly = 1,
|
||||||
.writeonly = 1,
|
.writeonly = 1,
|
||||||
.accept = ACCEPT_ARRAY(ACCEPT_NUM(1)),
|
.accept = ACCEPT_ARRAY(ACCEPT_NUM(1)),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* zdev - Modify and display the persistent configuration of devices
|
* zdev - Modify and display the persistent configuration of devices
|
||||||
*
|
*
|
||||||
* Copyright IBM Corp. 2016, 2017
|
* Copyright IBM Corp. 2016, 2019
|
||||||
*
|
*
|
||||||
* s390-tools is free software; you can redistribute it and/or modify
|
* s390-tools is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
@@ -246,6 +246,7 @@ static unsigned long zfcp_lun_num_ids_in_range(const char *range)
|
|||||||
|
|
||||||
static bool zfcp_lun_is_id_in_range(const char *id, const char *range)
|
static bool zfcp_lun_is_id_in_range(const char *id, const char *range)
|
||||||
{
|
{
|
||||||
|
/* No ranges are supported on zfcp lun IDs. */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,6 +318,7 @@ struct namespace zfcp_lun_namespace = {
|
|||||||
/*
|
/*
|
||||||
* zfcp lun device attributes.
|
* zfcp lun device attributes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static struct attrib zfcp_lun_attr_failed = {
|
static struct attrib zfcp_lun_attr_failed = {
|
||||||
.name = "failed",
|
.name = "failed",
|
||||||
.title = "Check and restart FCP SCSI device recovery",
|
.title = "Check and restart FCP SCSI device recovery",
|
||||||
@@ -1080,6 +1082,7 @@ static exit_code_t zfcp_lun_st_detect_definable(struct subtype *st,
|
|||||||
/*
|
/*
|
||||||
* zfcp lun subtype.
|
* zfcp lun subtype.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct subtype zfcp_lun_subtype = {
|
struct subtype zfcp_lun_subtype = {
|
||||||
.super = &subtype_base,
|
.super = &subtype_base,
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,8 @@ include ../common.mak
|
|||||||
|
|
||||||
libs = $(rootdir)/libzds/libzds.a \
|
libs = $(rootdir)/libzds/libzds.a \
|
||||||
$(rootdir)/libvtoc/libvtoc.a \
|
$(rootdir)/libvtoc/libvtoc.a \
|
||||||
$(rootdir)/libu2s/libu2s.a \
|
$(rootdir)/libdasd/libdasd.a \
|
||||||
$(rootdir)/libutil/libutil.a \
|
$(rootdir)/libutil/libutil.a
|
||||||
$(rootdir)/libdasd/libdasd.a
|
|
||||||
|
|
||||||
ifeq (${HAVE_FUSE},0)
|
ifeq (${HAVE_FUSE},0)
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
#include <elf.h>
|
#include <elf.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
|
||||||
|
#include "lib/zt_common.h"
|
||||||
|
|
||||||
#include "dfo.h"
|
#include "dfo.h"
|
||||||
#include "zg.h"
|
#include "zg.h"
|
||||||
|
|
||||||
@@ -80,7 +82,7 @@ struct nt_prstatus_64 {
|
|||||||
u64 orig_gpr2;
|
u64 orig_gpr2;
|
||||||
u32 pr_fpvalid;
|
u32 pr_fpvalid;
|
||||||
u8 pad3[4];
|
u8 pad3[4];
|
||||||
} __attribute__ ((packed));
|
} __packed;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* fpregset ELF Note
|
* fpregset ELF Note
|
||||||
@@ -89,7 +91,7 @@ struct nt_fpregset_64 {
|
|||||||
u32 fpc;
|
u32 fpc;
|
||||||
u32 pad;
|
u32 pad;
|
||||||
u64 fprs[16];
|
u64 fprs[16];
|
||||||
} __attribute__ ((packed));
|
} __packed;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* prpsinfo ELF Note
|
* prpsinfo ELF Note
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
#ifndef DF_LKCD_H
|
#ifndef DF_LKCD_H
|
||||||
#define DF_LKCD_H
|
#define DF_LKCD_H
|
||||||
|
|
||||||
|
#include "lib/zt_common.h"
|
||||||
|
|
||||||
#define DF_LKCD_MAGIC 0xa8190173618f23edULL
|
#define DF_LKCD_MAGIC 0xa8190173618f23edULL
|
||||||
#define DF_LKCD_MAGIC_ASM 0x733339302d64756dULL
|
#define DF_LKCD_MAGIC_ASM 0x733339302d64756dULL
|
||||||
#define DF_LKCD_VERSION 0x8 /* dump version number */
|
#define DF_LKCD_VERSION 0x8 /* dump version number */
|
||||||
@@ -53,7 +55,7 @@ struct df_lkcd_hdr {
|
|||||||
u32 dump_compress;
|
u32 dump_compress;
|
||||||
u32 dump_flags;
|
u32 dump_flags;
|
||||||
u32 dump_device;
|
u32 dump_device;
|
||||||
} __attribute__((packed));
|
} __packed;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* s390 LKCD asm header
|
* s390 LKCD asm header
|
||||||
@@ -65,7 +67,7 @@ struct df_lkcd_hdr_asm {
|
|||||||
u16 cpu_cnt;
|
u16 cpu_cnt;
|
||||||
u16 real_cpu_cnt;
|
u16 real_cpu_cnt;
|
||||||
u32 lc_vec[512];
|
u32 lc_vec[512];
|
||||||
} __attribute__((packed));
|
} __packed;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Page header
|
* Page header
|
||||||
@@ -74,6 +76,6 @@ struct df_lkcd_pg_hdr {
|
|||||||
u64 addr; /* Address of dump page */
|
u64 addr; /* Address of dump page */
|
||||||
u32 size; /* Size of dump page */
|
u32 size; /* Size of dump page */
|
||||||
u32 flags; /* flags (DF_LKCD_COMPRESSED, DF_LKCD_RAW,...) */
|
u32 flags; /* flags (DF_LKCD_COMPRESSED, DF_LKCD_RAW,...) */
|
||||||
} __attribute__((packed));
|
} __packed;
|
||||||
|
|
||||||
#endif /* DF_LKCD_H */
|
#endif /* DF_LKCD_H */
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
#ifndef DF_S390_H
|
#ifndef DF_S390_H
|
||||||
#define DF_S390_H
|
#define DF_S390_H
|
||||||
|
|
||||||
|
#include "lib/zt_common.h"
|
||||||
|
|
||||||
#include "dt.h"
|
#include "dt.h"
|
||||||
#include "zg.h"
|
#include "zg.h"
|
||||||
|
|
||||||
@@ -59,7 +61,7 @@ struct df_s390_hdr {
|
|||||||
u64 mvdump_zipl_time; /* 0x208 */
|
u64 mvdump_zipl_time; /* 0x208 */
|
||||||
u8 end_pad2[0x800-0x210]; /* 0x210 */
|
u8 end_pad2[0x800-0x210]; /* 0x210 */
|
||||||
u32 lc_vec[DF_S390_CPU_MAX]; /* 0x800 */
|
u32 lc_vec[DF_S390_CPU_MAX]; /* 0x800 */
|
||||||
} __attribute__((packed));
|
} __packed;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* End marker: Should be at the end of every valid s390 crash dump.
|
* End marker: Should be at the end of every valid s390 crash dump.
|
||||||
@@ -67,7 +69,7 @@ struct df_s390_hdr {
|
|||||||
struct df_s390_em {
|
struct df_s390_em {
|
||||||
char str[8];
|
char str[8];
|
||||||
u64 tod;
|
u64 tod;
|
||||||
} __attribute__((packed));
|
} __packed;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Segment header for s390 extended dump format
|
* Segment header for s390 extended dump format
|
||||||
@@ -77,7 +79,7 @@ struct df_s390_dump_segm_hdr {
|
|||||||
u64 len;
|
u64 len;
|
||||||
u64 stop_marker;
|
u64 stop_marker;
|
||||||
u8 reserved[0x1000 - 24];
|
u8 reserved[0x1000 - 24];
|
||||||
} __attribute__((packed));
|
} __packed;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert DFI arch to s390 arch
|
* Convert DFI arch to s390 arch
|
||||||
@@ -118,7 +120,7 @@ struct df_s390_dumper {
|
|||||||
u32 size;
|
u32 size;
|
||||||
u8 force;
|
u8 force;
|
||||||
u64 mem;
|
u64 mem;
|
||||||
} __attribute__ ((packed));
|
} __packed;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* s390 dump helpers
|
* s390 dump helpers
|
||||||
|
|||||||
@@ -13,7 +13,10 @@
|
|||||||
#define DFI_H
|
#define DFI_H
|
||||||
|
|
||||||
#include <linux/utsname.h>
|
#include <linux/utsname.h>
|
||||||
|
|
||||||
|
#include "lib/zt_common.h"
|
||||||
#include "lib/util_list.h"
|
#include "lib/util_list.h"
|
||||||
|
|
||||||
#include "zg.h"
|
#include "zg.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -68,7 +71,7 @@ struct dfi_lowcore_64 {
|
|||||||
u32 access_regs_save_area[16]; /* 0x1340 */
|
u32 access_regs_save_area[16]; /* 0x1340 */
|
||||||
u64 cregs_save_area[16]; /* 0x1380 */
|
u64 cregs_save_area[16]; /* 0x1380 */
|
||||||
u8 pad_0x1400[0x2000-0x1400]; /* 0x1400 */
|
u8 pad_0x1400[0x2000-0x1400]; /* 0x1400 */
|
||||||
} __attribute__((packed));
|
} __packed;
|
||||||
|
|
||||||
static inline u64 dfi_lc_size(enum dfi_arch arch)
|
static inline u64 dfi_lc_size(enum dfi_arch arch)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,14 +26,14 @@ struct vol_parm {
|
|||||||
u8 blk_size;
|
u8 blk_size;
|
||||||
u8 end_sec;
|
u8 end_sec;
|
||||||
u8 num_heads;
|
u8 num_heads;
|
||||||
} __attribute__ ((packed));
|
} __packed;
|
||||||
|
|
||||||
struct vol_parm_table {
|
struct vol_parm_table {
|
||||||
u64 timestamp;
|
u64 timestamp;
|
||||||
u16 vol_cnt;
|
u16 vol_cnt;
|
||||||
struct vol_parm vol_parm[MAX_VOLUMES];
|
struct vol_parm vol_parm[MAX_VOLUMES];
|
||||||
u8 ssid[MAX_VOLUMES];
|
u8 ssid[MAX_VOLUMES];
|
||||||
} __attribute__ ((packed));
|
} __packed;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Device signature
|
* Device signature
|
||||||
|
|||||||
@@ -10,6 +10,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <elf.h>
|
#include <elf.h>
|
||||||
|
|
||||||
|
#include "lib/zt_common.h"
|
||||||
|
|
||||||
#include "zgetdump.h"
|
#include "zgetdump.h"
|
||||||
|
|
||||||
#ifdef __s390x__
|
#ifdef __s390x__
|
||||||
@@ -38,7 +41,7 @@ struct os_info {
|
|||||||
u64 init_fn_size;
|
u64 init_fn_size;
|
||||||
u32 init_fn_csum;
|
u32 init_fn_csum;
|
||||||
u8 reserved[4004];
|
u8 reserved[4004];
|
||||||
} __attribute__ ((packed));
|
} __packed;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* File local static data
|
* File local static data
|
||||||
|
|||||||
@@ -12,7 +12,9 @@
|
|||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "lib/zt_common.h"
|
||||||
#include "lib/util_part.h"
|
#include "lib/util_part.h"
|
||||||
|
|
||||||
#include "zgetdump.h"
|
#include "zgetdump.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -28,7 +30,7 @@ struct scsi_dump_sb {
|
|||||||
uint64_t csum_off;
|
uint64_t csum_off;
|
||||||
uint64_t csum_size;
|
uint64_t csum_size;
|
||||||
uint64_t csum;
|
uint64_t csum;
|
||||||
} __attribute((packed));
|
} __packed;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* File local static data
|
* File local static data
|
||||||
@@ -46,7 +48,7 @@ struct scsi_blockptr {
|
|||||||
uint16_t size;
|
uint16_t size;
|
||||||
uint16_t blockct;
|
uint16_t blockct;
|
||||||
uint8_t reserved[4];
|
uint8_t reserved[4];
|
||||||
} __attribute__((__packed__));
|
} __packed;
|
||||||
|
|
||||||
enum component_entry_type {
|
enum component_entry_type {
|
||||||
component_execute = 0x01,
|
component_execute = 0x01,
|
||||||
@@ -61,7 +63,7 @@ struct component_entry {
|
|||||||
uint64_t load_address;
|
uint64_t load_address;
|
||||||
uint64_t load_psw;
|
uint64_t load_psw;
|
||||||
} address;
|
} address;
|
||||||
} __attribute__((__packed__));
|
} __packed;
|
||||||
|
|
||||||
enum component_header_type {
|
enum component_header_type {
|
||||||
component_header_ipl = 0x00,
|
component_header_ipl = 0x00,
|
||||||
@@ -72,7 +74,7 @@ struct component_header {
|
|||||||
uint8_t magic[4];
|
uint8_t magic[4];
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
uint8_t reserved[27];
|
uint8_t reserved[27];
|
||||||
} __attribute__((__packed__));
|
} __packed;
|
||||||
|
|
||||||
struct boot_info {
|
struct boot_info {
|
||||||
char magic[4];
|
char magic[4];
|
||||||
@@ -81,7 +83,7 @@ struct boot_info {
|
|||||||
uint8_t dev_type;
|
uint8_t dev_type;
|
||||||
uint8_t flags;
|
uint8_t flags;
|
||||||
uint64_t sb_off;
|
uint64_t sb_off;
|
||||||
} __attribute__ ((packed));
|
} __packed;
|
||||||
|
|
||||||
struct scsi_mbr {
|
struct scsi_mbr {
|
||||||
char magic[4];
|
char magic[4];
|
||||||
@@ -90,7 +92,7 @@ struct scsi_mbr {
|
|||||||
struct scsi_blockptr blockptr;
|
struct scsi_blockptr blockptr;
|
||||||
uint8_t reserved2[0x50];
|
uint8_t reserved2[0x50];
|
||||||
struct boot_info boot_info;
|
struct boot_info boot_info;
|
||||||
} __attribute__((__packed__));
|
} __packed;
|
||||||
|
|
||||||
#define BOOT_INFO_VERSION 1
|
#define BOOT_INFO_VERSION 1
|
||||||
#define BOOT_INFO_MAGIC "zIPL"
|
#define BOOT_INFO_MAGIC "zIPL"
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ struct scsi_dump_sb {
|
|||||||
uint64_t csum_off;
|
uint64_t csum_off;
|
||||||
uint64_t csum_size;
|
uint64_t csum_size;
|
||||||
uint64_t csum;
|
uint64_t csum;
|
||||||
} __attribute((packed));
|
} __packed;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Layout of SCSI disk block pointer
|
* Layout of SCSI disk block pointer
|
||||||
@@ -72,7 +72,7 @@ struct linear_blockptr {
|
|||||||
uint16_t size;
|
uint16_t size;
|
||||||
uint16_t blockct;
|
uint16_t blockct;
|
||||||
uint8_t reserved[4];
|
uint8_t reserved[4];
|
||||||
} __attribute((packed));
|
} __packed;
|
||||||
|
|
||||||
/* From boot.h in zipl */
|
/* From boot.h in zipl */
|
||||||
struct boot_info {
|
struct boot_info {
|
||||||
@@ -82,7 +82,7 @@ struct boot_info {
|
|||||||
uint8_t dev_type;
|
uint8_t dev_type;
|
||||||
uint8_t flags;
|
uint8_t flags;
|
||||||
uint64_t sb_off;
|
uint64_t sb_off;
|
||||||
} __attribute__ ((packed));
|
} __packed;
|
||||||
|
|
||||||
/* From install.c in zipl */
|
/* From install.c in zipl */
|
||||||
struct scsi_mbr {
|
struct scsi_mbr {
|
||||||
@@ -92,7 +92,7 @@ struct scsi_mbr {
|
|||||||
struct linear_blockptr lin;
|
struct linear_blockptr lin;
|
||||||
uint8_t reserverd[0x50];
|
uint8_t reserverd[0x50];
|
||||||
struct boot_info boot_info;
|
struct boot_info boot_info;
|
||||||
} __attribute__ ((packed));
|
} __packed;
|
||||||
|
|
||||||
/* From boot.h in zipl */
|
/* From boot.h in zipl */
|
||||||
#define BOOT_INFO_VERSION 1
|
#define BOOT_INFO_VERSION 1
|
||||||
|
|||||||
@@ -514,7 +514,7 @@ function check_for_multipath_devices() {
|
|||||||
(( i+=2 ));
|
(( i+=2 ));
|
||||||
while [[ `echo "${mp_arr[$i]:0:1}" | grep -ve "[0-9a-zA-Z]"` ]] && [ $i -lt ${#mp_arr[@]} ]; do
|
while [[ `echo "${mp_arr[$i]:0:1}" | grep -ve "[0-9a-zA-Z]"` ]] && [ $i -lt ${#mp_arr[@]} ]; do
|
||||||
if [ `echo ${mp_arr[$i]} | grep -e "[0-9]\{1,\}:[0-9]\{1,\}:[0-9]\{1,\}:[0-9]\{1,\}" | wc -l` -ne 0 ]; then
|
if [ `echo ${mp_arr[$i]} | grep -e "[0-9]\{1,\}:[0-9]\{1,\}:[0-9]\{1,\}:[0-9]\{1,\}" | wc -l` -ne 0 ]; then
|
||||||
line="`echo ${mp_arr[$i]} | sed 's/.*\([0-9]\{1,\}:[0-9]\{1,\}:[0-9]\{1,\}:[0-9]\{1,\}\)/\1/'`";
|
line="`echo ${mp_arr[$i]} | sed 's/[^0-9]*\([0-9]\{1,\}:[0-9]\{1,\}:[0-9]\{1,\}:[0-9]\{1,\}\)/\1/'`";
|
||||||
checked_devs[${#checked_devs[@]}]=`echo $line | awk '{print "/dev/"$2}'`;
|
checked_devs[${#checked_devs[@]}]=`echo $line | awk '{print "/dev/"$2}'`;
|
||||||
ddebug " adding ${checked_devs[${#checked_devs[@]}-1]}";
|
ddebug " adding ${checked_devs[${#checked_devs[@]}-1]}";
|
||||||
WRP_HOST_ADAPTERS[${#WRP_HOST_ADAPTERS[@]}]="host${line%%:*}";
|
WRP_HOST_ADAPTERS[${#WRP_HOST_ADAPTERS[@]}]="host${line%%:*}";
|
||||||
@@ -745,10 +745,11 @@ function check_size_requirements() {
|
|||||||
|
|
||||||
trap emergency_shutdown SIGHUP SIGTERM SIGINT SIGQUIT;
|
trap emergency_shutdown SIGHUP SIGTERM SIGINT SIGQUIT;
|
||||||
|
|
||||||
check_blktrace;
|
|
||||||
|
|
||||||
parse_params $@;
|
parse_params $@;
|
||||||
|
|
||||||
|
check_blktrace;
|
||||||
|
|
||||||
determine_host_adapters;
|
determine_host_adapters;
|
||||||
|
|
||||||
check_cpuplugd;
|
check_cpuplugd;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ all:
|
|||||||
install: all
|
install: all
|
||||||
$(MAKE) -C src install
|
$(MAKE) -C src install
|
||||||
$(MAKE) -C man install
|
$(MAKE) -C man install
|
||||||
|
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 644 doc/zipl.conf.minimal $(DESTDIR)$(TOOLS_LIBDIR)/zipl.conf
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(MAKE) -C src clean
|
$(MAKE) -C src clean
|
||||||
|
|||||||
@@ -1,31 +1,30 @@
|
|||||||
# Common definitions
|
# Common definitions
|
||||||
include ../../common.mak
|
include ../../common.mak
|
||||||
|
|
||||||
CFLAGS_BOOT = $(NO_PIE_CFLAGS) -Os -g -I../include -D__ASSEMBLY__ \
|
ALL_CFLAGS = $(NO_PIE_CFLAGS) -Os -g -I $(rootdir)/zipl/include \
|
||||||
-DS390_TOOLS_RELEASE=$(S390_TOOLS_RELEASE) \
|
-I $(rootdir)/include -DS390_TOOLS_RELEASE=$(S390_TOOLS_RELEASE) \
|
||||||
-fno-builtin -ffreestanding -fno-asynchronous-unwind-tables \
|
-fno-builtin -ffreestanding -fno-asynchronous-unwind-tables \
|
||||||
-fno-delete-null-pointer-checks \
|
-fno-delete-null-pointer-checks \
|
||||||
-fexec-charset=IBM1047 -m64 -mpacked-stack \
|
-fexec-charset=IBM1047 -m64 -mpacked-stack \
|
||||||
-mstack-size=8192 -mstack-guard=128 -msoft-float \
|
-mstack-size=4096 -mstack-guard=128 -msoft-float \
|
||||||
-W -Wall -Wformat-security
|
-W -Wall -Wformat-security
|
||||||
|
|
||||||
FILES = fba0.bin fba1b.bin fba2.bin \
|
FILES = fba0.bin fba1b.bin fba2.bin \
|
||||||
eckd0_ldl.bin eckd0_cdl.bin \
|
eckd0_ldl.bin eckd0_cdl.bin \
|
||||||
eckd1.bin eckd1b.bin eckd2.bin \
|
eckd1.bin eckd1b.bin eckd2.bin \
|
||||||
tape0.bin \
|
tape0.bin \
|
||||||
eckd2dump_sv.bin tape2dump.bin fba2dump.bin eckd2dump_mv.bin \
|
eckd2dump_sv.bin tape2dump.bin fba2dump.bin eckd2dump_mv.bin
|
||||||
stage3.bin
|
|
||||||
|
|
||||||
all: data.o data.h tape0.bin
|
all: data.o data.h tape0.bin stage3.bin
|
||||||
|
|
||||||
# Prevent make from using some default rules...
|
# Prevent make from using some default rules...
|
||||||
%: %.S
|
%: %.S
|
||||||
|
|
||||||
%.o: %.S
|
%.o: %.S
|
||||||
$(CC) $(CFLAGS_BOOT) -c -o $@ $<
|
$(CC) $(ALL_CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(CFLAGS_BOOT) -c -o $@ $<
|
$(CC) $(ALL_CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
eckd2dump_sv.exec: \
|
eckd2dump_sv.exec: \
|
||||||
head.o stage2dump.o cio.o eckd2dump.o eckd2dump_sv.o \
|
head.o stage2dump.o cio.o eckd2dump.o eckd2dump_sv.o \
|
||||||
@@ -44,10 +43,10 @@ eckd2.exec: head.o stage2.o cio.o eckd2.o libc.o menu.o sclp.o \
|
|||||||
fba2.exec: head.o stage2.o cio.o fba2.o libc.o menu.o sclp.o \
|
fba2.exec: head.o stage2.o cio.o fba2.o libc.o menu.o sclp.o \
|
||||||
kdump2.o kdump.o entry.o
|
kdump2.o kdump.o entry.o
|
||||||
stage3.exec: head.o stage3.o kdump3.o libc.o sclp.o sclp_stage3.o \
|
stage3.exec: head.o stage3.o kdump3.o libc.o sclp.o sclp_stage3.o \
|
||||||
kdump.o entry.o
|
kdump.o entry.o stage3.lds
|
||||||
|
|
||||||
%.exec: %.o
|
%.exec: %.o
|
||||||
@STAGE=$$( \
|
STAGE=$$( \
|
||||||
echo $@ | awk ' \
|
echo $@ | awk ' \
|
||||||
match($$0,/[0-9]+b*/){ \
|
match($$0,/[0-9]+b*/){ \
|
||||||
print substr($$0,RSTART,RLENGTH) \
|
print substr($$0,RSTART,RLENGTH) \
|
||||||
@@ -60,7 +59,7 @@ stage3.exec: head.o stage3.o kdump3.o libc.o sclp.o sclp_stage3.o \
|
|||||||
2) SFLAGS="$(NO_PIE_LINKFLAGS) -nostdlib -Wl,-T,stage2.lds";; \
|
2) SFLAGS="$(NO_PIE_LINKFLAGS) -nostdlib -Wl,-T,stage2.lds";; \
|
||||||
3) SFLAGS="$(NO_PIE_LINKFLAGS) -nostdlib -Wl,-T,stage3.lds";; \
|
3) SFLAGS="$(NO_PIE_LINKFLAGS) -nostdlib -Wl,-T,stage3.lds";; \
|
||||||
esac; \
|
esac; \
|
||||||
$(LINK) $$SFLAGS -m64 $^ -o $@
|
$(LINK) $$SFLAGS -m64 $(filter %.o, $^) -o $@
|
||||||
|
|
||||||
%.bin: %.exec
|
%.bin: %.exec
|
||||||
$(OBJCOPY) -O binary \
|
$(OBJCOPY) -O binary \
|
||||||
@@ -71,12 +70,30 @@ stage3.exec: head.o stage3.o kdump3.o libc.o sclp.o sclp_stage3.o \
|
|||||||
--only-section=.ex_table \
|
--only-section=.ex_table \
|
||||||
--only-section=.data \
|
--only-section=.data \
|
||||||
--only-section=.rodata.str1.2 \
|
--only-section=.rodata.str1.2 \
|
||||||
|
--only-section=.rodata.cst8 \
|
||||||
--only-section=.rodata \
|
--only-section=.rodata \
|
||||||
--only-section=.stage2dump.tail \
|
--only-section=.stage2dump.tail \
|
||||||
--only-section=.eckd2dump_mv.tail \
|
--only-section=.eckd2dump_mv.tail \
|
||||||
--only-section=.fixup \
|
--only-section=.fixup \
|
||||||
$< $@
|
$< $@
|
||||||
|
|
||||||
|
stage3.bin: stage3.exec
|
||||||
|
$(OBJCOPY) -O binary \
|
||||||
|
--only-section=.stage2.head \
|
||||||
|
--only-section=.text.dummy \
|
||||||
|
--only-section=.text.start \
|
||||||
|
--only-section=.text \
|
||||||
|
--only-section=.ex_table \
|
||||||
|
--only-section=.data \
|
||||||
|
--only-section=.rodata.str1.2 \
|
||||||
|
--only-section=.rodata.cst8 \
|
||||||
|
--only-section=.rodata \
|
||||||
|
--only-section=.stage2dump.tail \
|
||||||
|
--only-section=.eckd2dump_mv.tail \
|
||||||
|
--only-section=.fixup \
|
||||||
|
--pad-to=0xe000 \
|
||||||
|
$< $@
|
||||||
|
|
||||||
data.o: $(FILES)
|
data.o: $(FILES)
|
||||||
$(LD) $(NO_PIE_LDFLAGS) -r -b binary -o data.o $(FILES)
|
$(LD) $(NO_PIE_LDFLAGS) -r -b binary -o data.o $(FILES)
|
||||||
|
|
||||||
@@ -86,6 +103,7 @@ data.h: data.o
|
|||||||
echo "extern char $$SYMBOL;" >>data.h; done
|
echo "extern char $$SYMBOL;" >>data.h; done
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o *.exec *.bin $(FILES) data.o data.h tape0.bin *.xxx *.yyy
|
rm -f *.o *.exec *.bin $(FILES) data.o data.h tape0.bin *.xxx *.yyy \
|
||||||
|
stage3.bin
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "lib/zt_common.h"
|
||||||
|
|
||||||
#include "eckd2dump.h"
|
#include "eckd2dump.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "stage2dump.h"
|
#include "stage2dump.h"
|
||||||
@@ -19,8 +21,7 @@
|
|||||||
/*
|
/*
|
||||||
* Magic number at start of dump record
|
* Magic number at start of dump record
|
||||||
*/
|
*/
|
||||||
uint64_t magic __attribute__((section(".stage2.head")))
|
uint64_t __section(.stage2.head) magic = 0x584d554c54363401ULL; /* XMULT64, version 1 */
|
||||||
= 0x584d554c54363401ULL; /* XMULT64, version 1 */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parameter format for ECKD MV dumper (13 bytes):
|
* Parameter format for ECKD MV dumper (13 bytes):
|
||||||
@@ -59,8 +60,7 @@ struct mvdump_parm_table {
|
|||||||
(MAX_DUMP_VOLUMES * (sizeof(struct mvdump_param) + 1))];
|
(MAX_DUMP_VOLUMES * (sizeof(struct mvdump_param) + 1))];
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
static struct mvdump_parm_table mvdump_table
|
static struct mvdump_parm_table __section(.eckd2dump_mv.tail) mvdump_table;
|
||||||
__attribute__((section(".eckd2dump_mv.tail")));
|
|
||||||
|
|
||||||
static int volnr_current;
|
static int volnr_current;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "lib/zt_common.h"
|
||||||
|
|
||||||
#include "eckd2dump.h"
|
#include "eckd2dump.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "stage2dump.h"
|
#include "stage2dump.h"
|
||||||
@@ -16,8 +18,7 @@
|
|||||||
/*
|
/*
|
||||||
* Magic number at start of dump record
|
* Magic number at start of dump record
|
||||||
*/
|
*/
|
||||||
uint64_t magic __attribute__((section(".stage2.head"))) =
|
uint64_t __section(.stage2.head) magic = 0x5845434b44363401ULL; /* "XECKD64", version 1 */
|
||||||
0x5845434b44363401ULL; /* "XECKD64", version 1 */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ECKD parameter block passed by zipl
|
* ECKD parameter block passed by zipl
|
||||||
|
|||||||
@@ -31,6 +31,9 @@
|
|||||||
/* Internal error */
|
/* Internal error */
|
||||||
#define EINTERNAL 0x00004511
|
#define EINTERNAL 0x00004511
|
||||||
|
|
||||||
|
/* Secure IPL error */
|
||||||
|
#define ESECUREBOOT 0x00004512
|
||||||
|
|
||||||
/* kdump: No operating system information was found */
|
/* kdump: No operating system information was found */
|
||||||
#define EOS_INFO_MISSING 0x00004520
|
#define EOS_INFO_MISSING 0x00004520
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "lib/zt_common.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "fba.h"
|
#include "fba.h"
|
||||||
#include "stage2dump.h"
|
#include "stage2dump.h"
|
||||||
@@ -20,8 +21,7 @@
|
|||||||
/*
|
/*
|
||||||
* Magic number at start of dump record
|
* Magic number at start of dump record
|
||||||
*/
|
*/
|
||||||
uint64_t magic __attribute__((section(".stage2.head")))
|
uint64_t __section(.stage2.head) magic = 0x5844464241363401ULL; /* XDFBA64, version 1 */
|
||||||
= 0x5844464241363401ULL; /* XDFBA64, version 1 */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FBA dump device partition specification
|
* FBA dump device partition specification
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#include "lib/zt_common.h"
|
||||||
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "libc.h"
|
#include "libc.h"
|
||||||
#include "sclp.h"
|
#include "sclp.h"
|
||||||
@@ -58,6 +60,26 @@ void *memcpy(void *dest, const void *src, unsigned long n)
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Move @n bytes of memory from @src to @dest. The memory regions may overlap.
|
||||||
|
*/
|
||||||
|
void *memmove(void *dest, const void *src, unsigned long n)
|
||||||
|
{
|
||||||
|
const char *s = src;
|
||||||
|
char *d = dest;
|
||||||
|
|
||||||
|
if (s < d) {
|
||||||
|
d += n;
|
||||||
|
s += n;
|
||||||
|
while (n--)
|
||||||
|
*--d = *--s;
|
||||||
|
} else {
|
||||||
|
while (n--)
|
||||||
|
*d++ = *s++;
|
||||||
|
}
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy string
|
* Copy string
|
||||||
*/
|
*/
|
||||||
@@ -323,7 +345,7 @@ void pgm_check_handler_fn(void)
|
|||||||
libc_stop(psw_old->addr);
|
libc_stop(psw_old->addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__ ((noinline)) void load_wait_psw(uint64_t psw_mask, struct psw_t *psw)
|
void __noinline load_wait_psw(uint64_t psw_mask, struct psw_t *psw)
|
||||||
{
|
{
|
||||||
struct psw_t wait_psw = { .mask = psw_mask, .addr = 0 };
|
struct psw_t wait_psw = { .mask = psw_mask, .addr = 0 };
|
||||||
struct psw_t old_psw, *wait_psw_ptr = &wait_psw;
|
struct psw_t old_psw, *wait_psw_ptr = &wait_psw;
|
||||||
@@ -363,7 +385,7 @@ void initialize(void)
|
|||||||
/*
|
/*
|
||||||
* Load disabled wait PSW with reason code in address field
|
* Load disabled wait PSW with reason code in address field
|
||||||
*/
|
*/
|
||||||
void libc_stop(unsigned long reason)
|
void __noreturn libc_stop(unsigned long reason)
|
||||||
{
|
{
|
||||||
struct psw_t psw;
|
struct psw_t psw;
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
#ifndef LIBC_H
|
#ifndef LIBC_H
|
||||||
#define LIBC_H
|
#define LIBC_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#define NULL ((void *) 0)
|
#define NULL ((void *) 0)
|
||||||
|
|
||||||
#define EPERM 1 /* Operation not permitted */
|
#define EPERM 1 /* Operation not permitted */
|
||||||
@@ -41,14 +43,10 @@
|
|||||||
|
|
||||||
#define MIB (1024ULL * 1024)
|
#define MIB (1024ULL * 1024)
|
||||||
|
|
||||||
typedef unsigned long long uint64_t;
|
|
||||||
typedef unsigned int uint32_t;
|
|
||||||
typedef unsigned short uint16_t;
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
|
|
||||||
void printf(const char *, ...);
|
void printf(const char *, ...);
|
||||||
void sprintf(char *, const char *, ...);
|
void sprintf(char *, const char *, ...);
|
||||||
void *memcpy(void *, const void *, unsigned long);
|
void *memcpy(void *, const void *, unsigned long);
|
||||||
|
void *memmove(void *, const void *, unsigned long);
|
||||||
void *memset(void *, int c, unsigned long);
|
void *memset(void *, int c, unsigned long);
|
||||||
char *strcat(char *, const char *);
|
char *strcat(char *, const char *);
|
||||||
int strncmp(const char *, const char *, unsigned long);
|
int strncmp(const char *, const char *, unsigned long);
|
||||||
@@ -59,7 +57,7 @@ char *strcpy(char *, const char *);
|
|||||||
unsigned long get_zeroed_page(void);
|
unsigned long get_zeroed_page(void);
|
||||||
void free_page(unsigned long);
|
void free_page(unsigned long);
|
||||||
void initialize(void);
|
void initialize(void);
|
||||||
void libc_stop(unsigned long) __attribute__((noreturn));
|
void libc_stop(unsigned long);
|
||||||
void start(void);
|
void start(void);
|
||||||
void pgm_check_handler(void);
|
void pgm_check_handler(void);
|
||||||
void pgm_check_handler_fn(void);
|
void pgm_check_handler_fn(void);
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ static void menu_prompt(int timeout)
|
|||||||
static int menu_read(void)
|
static int menu_read(void)
|
||||||
{
|
{
|
||||||
char *temp_area = (char *)get_zeroed_page();
|
char *temp_area = (char *)get_zeroed_page();
|
||||||
uint16_t *configs = __stage2_params.config;
|
|
||||||
int timeout, rc, i, count = 0;
|
int timeout, rc, i, count = 0;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
int value;
|
int value;
|
||||||
@@ -60,7 +59,7 @@ static int menu_read(void)
|
|||||||
value = ebcstrtoul((char *)temp_area, &endptr, 10);
|
value = ebcstrtoul((char *)temp_area, &endptr, 10);
|
||||||
|
|
||||||
if ((endptr != temp_area) && (value < BOOT_MENU_ENTRIES - 1) &&
|
if ((endptr != temp_area) && (value < BOOT_MENU_ENTRIES - 1) &&
|
||||||
(configs[value] != 0)) {
|
(__stage2_params.config[value] != 0)) {
|
||||||
/* valid config found - finish */
|
/* valid config found - finish */
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
@@ -80,14 +79,13 @@ out_free_page:
|
|||||||
|
|
||||||
static int menu_list(void)
|
static int menu_list(void)
|
||||||
{
|
{
|
||||||
uint16_t *configs = __stage2_params.config;
|
|
||||||
char *name;
|
char *name;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < BOOT_MENU_ENTRIES; i++) {
|
for (i = 0; i < BOOT_MENU_ENTRIES; i++) {
|
||||||
if (configs[i] == 0)
|
if (__stage2_params.config[i] == 0)
|
||||||
continue;
|
continue;
|
||||||
name = configs[i] + ((void *)&__stage2_params);
|
name = __stage2_params.config[i] + ((void *)&__stage2_params);
|
||||||
printf("%s\n", name);
|
printf("%s\n", name);
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@@ -136,7 +134,6 @@ static int menu_param(unsigned long *value)
|
|||||||
|
|
||||||
int menu(void)
|
int menu(void)
|
||||||
{
|
{
|
||||||
uint16_t *configs = __stage2_params.config;
|
|
||||||
unsigned long value = 0;
|
unsigned long value = 0;
|
||||||
char *cmd_line_extra;
|
char *cmd_line_extra;
|
||||||
char endstring[15];
|
char endstring[15];
|
||||||
@@ -178,11 +175,11 @@ int menu(void)
|
|||||||
|
|
||||||
boot:
|
boot:
|
||||||
/* sanity - config entry not valid */
|
/* sanity - config entry not valid */
|
||||||
if (configs[value] == 0)
|
if (__stage2_params.config[value] == 0)
|
||||||
panic(EINTERNAL, "%s", msg_econfig);
|
panic(EINTERNAL, "%s", msg_econfig);
|
||||||
|
|
||||||
printf("Booting %s\n",
|
printf("Booting %s\n",
|
||||||
(char *)(configs[value] +
|
(char *)(__stage2_params.config[value] +
|
||||||
(void *)&__stage2_params + TEXT_OFFSET));
|
(void *)&__stage2_params + TEXT_OFFSET));
|
||||||
|
|
||||||
/* append 'BOOT_IMAGE=<num>' to parmline */
|
/* append 'BOOT_IMAGE=<num>' to parmline */
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "stage2.h"
|
#include "stage2.h"
|
||||||
|
|
||||||
/* address of extra command line */
|
/* address of extra command line */
|
||||||
#define COMMAND_LINE_EXTRA (0xA000-0x400)
|
#define COMMAND_LINE_EXTRA 0xE000
|
||||||
|
|
||||||
/* max command line length */
|
/* max command line length */
|
||||||
#define COMMAND_LINE_SIZE 896
|
#define COMMAND_LINE_SIZE 896
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#ifndef S390_H
|
#ifndef S390_H
|
||||||
#define S390_H
|
#define S390_H
|
||||||
|
|
||||||
#include "../../include/lib/zt_common.h"
|
#include "lib/zt_common.h"
|
||||||
#include "libc.h"
|
#include "libc.h"
|
||||||
|
|
||||||
#define __pa32(x) ((uint32_t)(unsigned long)(x))
|
#define __pa32(x) ((uint32_t)(unsigned long)(x))
|
||||||
@@ -35,6 +35,11 @@ struct psw_t {
|
|||||||
uint64_t addr;
|
uint64_t addr;
|
||||||
} __aligned(8);
|
} __aligned(8);
|
||||||
|
|
||||||
|
struct psw32_t {
|
||||||
|
uint32_t mask;
|
||||||
|
uint32_t addr;
|
||||||
|
} __aligned(8);
|
||||||
|
|
||||||
void load_wait_psw(uint64_t, struct psw_t *);
|
void load_wait_psw(uint64_t, struct psw_t *);
|
||||||
|
|
||||||
struct _lowcore {
|
struct _lowcore {
|
||||||
@@ -447,12 +452,24 @@ static inline int test_facility(unsigned long nr)
|
|||||||
return __test_facility(nr, &S390_lowcore.stfle_fac_list);
|
return __test_facility(nr, &S390_lowcore.stfle_fac_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline unsigned long __stfle_asm(uint64_t *stfle_fac_list, int size)
|
||||||
|
{
|
||||||
|
register unsigned long reg0 asm("0") = size - 1;
|
||||||
|
|
||||||
|
asm volatile(
|
||||||
|
".insn s,0xb2b00000,0(%1)" /* stfle */
|
||||||
|
: "+d" (reg0)
|
||||||
|
: "a" (stfle_fac_list)
|
||||||
|
: "memory", "cc");
|
||||||
|
return reg0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stfle - Store facility list extended
|
* stfle - Store facility list extended
|
||||||
* @stfle_fac_list: array where facility list can be stored
|
* @stfle_fac_list: array where facility list can be stored
|
||||||
* @size: size of passed in array in double words
|
* @size: size of passed in array in double words
|
||||||
*/
|
*/
|
||||||
static inline void stfle(u64 *stfle_fac_list, int size)
|
static inline void stfle(uint64_t *stfle_fac_list, int size)
|
||||||
{
|
{
|
||||||
unsigned long nr;
|
unsigned long nr;
|
||||||
|
|
||||||
@@ -465,13 +482,8 @@ static inline void stfle(u64 *stfle_fac_list, int size)
|
|||||||
memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4);
|
memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4);
|
||||||
if (S390_lowcore.stfl_fac_list & 0x01000000) {
|
if (S390_lowcore.stfl_fac_list & 0x01000000) {
|
||||||
/* More facility bits available with stfle */
|
/* More facility bits available with stfle */
|
||||||
register unsigned long reg0 asm("0") = size - 1;
|
nr = __stfle_asm(stfle_fac_list, size);
|
||||||
|
nr = MIN((nr + 1) * 8, size * 8UL);
|
||||||
asm volatile(".insn s,0xb2b00000,0(%1)" /* stfle */
|
|
||||||
: "+d" (reg0)
|
|
||||||
: "a" (stfle_fac_list)
|
|
||||||
: "memory", "cc");
|
|
||||||
nr = (reg0 + 1) * 8; /* # bytes stored by stfle */
|
|
||||||
}
|
}
|
||||||
memset((char *) stfle_fac_list + nr, 0, size * 8 - nr);
|
memset((char *) stfle_fac_list + nr, 0, size * 8 - nr);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,19 +53,21 @@ struct gds_subvector {
|
|||||||
uint8_t key;
|
uint8_t key;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
|
/* Structure must not have any padding */
|
||||||
struct sccb_header {
|
struct sccb_header {
|
||||||
uint16_t length;
|
uint16_t length;
|
||||||
uint8_t function_code;
|
uint8_t function_code;
|
||||||
uint8_t control_mask[3];
|
uint8_t control_mask[3];
|
||||||
uint16_t response_code;
|
uint16_t response_code;
|
||||||
} __packed;
|
};
|
||||||
|
|
||||||
|
/* Structure must not have any padding */
|
||||||
struct evbuf_header {
|
struct evbuf_header {
|
||||||
uint16_t length;
|
uint16_t length;
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
uint8_t flags;
|
uint8_t flags;
|
||||||
uint16_t _reserved;
|
uint16_t _reserved;
|
||||||
} __packed;
|
};
|
||||||
|
|
||||||
struct mto {
|
struct mto {
|
||||||
uint16_t length;
|
uint16_t length;
|
||||||
|
|||||||
@@ -104,7 +104,6 @@ int sclp_hsa_get_size(unsigned long *hsa_size)
|
|||||||
sccb = (void *)get_zeroed_page();
|
sccb = (void *)get_zeroed_page();
|
||||||
sccb->header.length = sizeof(*sccb);
|
sccb->header.length = sizeof(*sccb);
|
||||||
|
|
||||||
sccb->header.length = sizeof(*sccb);
|
|
||||||
sccb->evbuf.header.length = sizeof(struct sdias_evbuf);
|
sccb->evbuf.header.length = sizeof(struct sdias_evbuf);
|
||||||
sccb->evbuf.header.type = EVTYP_SDIAS;
|
sccb->evbuf.header.type = EVTYP_SDIAS;
|
||||||
sccb->evbuf.event_qual = EQ_SIZE;
|
sccb->evbuf.event_qual = EQ_SIZE;
|
||||||
|
|||||||
@@ -17,9 +17,6 @@
|
|||||||
#define SDIAS_EVSTATE_ALL_STORED 0x00
|
#define SDIAS_EVSTATE_ALL_STORED 0x00
|
||||||
#define SDIAS_EVSTATE_PART_STORED 0x10
|
#define SDIAS_EVSTATE_PART_STORED 0x10
|
||||||
|
|
||||||
#define SDIAS_EVSTATE_ALL_STORED 0x00
|
|
||||||
#define SDIAS_EVSTATE_PART_STORED 0x10
|
|
||||||
|
|
||||||
struct sdias_evbuf {
|
struct sdias_evbuf {
|
||||||
struct evbuf_header header;
|
struct evbuf_header header;
|
||||||
uint8_t event_qual;
|
uint8_t event_qual;
|
||||||
@@ -40,10 +37,11 @@ struct sdias_evbuf {
|
|||||||
uint16_t dbs;
|
uint16_t dbs;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
|
/* Structure must not have any padding */
|
||||||
struct sdias_sccb {
|
struct sdias_sccb {
|
||||||
struct sccb_header header;
|
struct sccb_header header;
|
||||||
struct sdias_evbuf evbuf;
|
struct sdias_evbuf evbuf;
|
||||||
} __packed;
|
};
|
||||||
|
|
||||||
|
|
||||||
int sclp_hsa_copy(void *, unsigned long, unsigned long);
|
int sclp_hsa_copy(void *, unsigned long, unsigned long);
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "lib/zt_common.h"
|
||||||
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "libc.h"
|
#include "libc.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
@@ -115,8 +117,13 @@ void start(void)
|
|||||||
/* skip header */
|
/* skip header */
|
||||||
entry = (struct component_entry *)
|
entry = (struct component_entry *)
|
||||||
(load_address + sizeof(struct component_header));
|
(load_address + sizeof(struct component_header));
|
||||||
|
while (entry->type == COMPONENT_LOAD ||
|
||||||
while (entry->type == COMPONENT_LOAD) {
|
entry->type == COMPONENT_SIGNATURE) {
|
||||||
|
if (entry->type == COMPONENT_SIGNATURE) {
|
||||||
|
/* Skip unhandled signature components */
|
||||||
|
entry++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
load_address = (void *)(unsigned long)
|
load_address = (void *)(unsigned long)
|
||||||
entry->address.load_address[1];
|
entry->address.load_address[1];
|
||||||
load_blocklist(entry, subchannel_id, load_address);
|
load_blocklist(entry, subchannel_id, load_address);
|
||||||
@@ -136,4 +143,4 @@ void panic_notify(unsigned long UNUSED(reason))
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t stage2_head __attribute__((section(".stage2.head")));
|
uint64_t __section(.stage2.head) stage2_head;
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ struct component_entry {
|
|||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
COMPONENT_EXECUTE = 0x01,
|
COMPONENT_EXECUTE = 0x01,
|
||||||
COMPONENT_LOAD = 0x02
|
COMPONENT_LOAD = 0x02,
|
||||||
|
COMPONENT_SIGNATURE = 0x03
|
||||||
} component_type;
|
} component_type;
|
||||||
|
|
||||||
struct stage2_descr {
|
struct stage2_descr {
|
||||||
|
|||||||
@@ -9,9 +9,11 @@
|
|||||||
* 0x2000-0x4fff Sections (load): head, text, data, rodata, rodata.str
|
* 0x2000-0x4fff Sections (load): head, text, data, rodata, rodata.str
|
||||||
* 0x5000-0x51ff eckd2dump_mv parameter block (426 bytes)
|
* 0x5000-0x51ff eckd2dump_mv parameter block (426 bytes)
|
||||||
* 0x5200-0x5fff Sections: bss
|
* 0x5200-0x5fff Sections: bss
|
||||||
* 0x6000-0x9fff Memory allocation (heap)
|
* 0x6000-0x8fff Memory allocation (heap)
|
||||||
|
* 0x9000-0x9fff Memory to load stage3 parameter to
|
||||||
* 0xa000-0xdfff Memory to load stage3 to
|
* 0xa000-0xdfff Memory to load stage3 to
|
||||||
* 0xe000-0xffff Stack
|
* 0xe000-0xe3ff command line extra
|
||||||
|
* 0xe400-0xffff Stack
|
||||||
*
|
*
|
||||||
* Special memory locations
|
* Special memory locations
|
||||||
* ------------------------
|
* ------------------------
|
||||||
@@ -52,7 +54,7 @@ SECTIONS
|
|||||||
|
|
||||||
. = 0x6000;
|
. = 0x6000;
|
||||||
__heap_start = .;
|
__heap_start = .;
|
||||||
. = 0xa000;
|
. = 0x9000;
|
||||||
__heap_stop = .;
|
__heap_stop = .;
|
||||||
|
|
||||||
. = 0xf000;
|
. = 0xf000;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user