mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b098990abe | ||
|
|
6802b86414 | ||
|
|
aa8c2945cc | ||
|
|
fa7a4dafa3 | ||
|
|
7eb04cdc54 | ||
|
|
d55b787d05 | ||
|
|
da4fdeeb82 | ||
|
|
9fe491df27 | ||
|
|
732b3dddab | ||
|
|
cb76e39cef | ||
|
|
09be935c54 | ||
|
|
65e18bff67 | ||
|
|
07ab32fa8b | ||
|
|
353403824b | ||
|
|
8a58389e2f | ||
|
|
f2cc871b02 | ||
|
|
4dbdc8dfab | ||
|
|
60900de5e9 | ||
|
|
2bba362e9a | ||
|
|
76044be98d | ||
|
|
885ff0a03f |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -37,6 +37,8 @@ iucvterm/test/test_afiucv
|
||||
libekmfweb/check-dep-libekmfweb
|
||||
libekmfweb/detect-openssl-version.dep
|
||||
libekmfweb/libekmfweb.so
|
||||
libekmfweb/libekmfweb.so.1
|
||||
libekmfweb/libekmfweb.so.1.0
|
||||
libutil/util_base_example
|
||||
libutil/util_file_example
|
||||
libutil/util_libc_example
|
||||
@@ -97,6 +99,7 @@ zipl/src/zipl_helper.device-mapper
|
||||
zkey/check-dep-zkey
|
||||
zkey/check-dep-zkey-cryptsetup
|
||||
zkey/detect-libcryptsetup.dep
|
||||
zkey/ekmfweb/libekmfweb.dep
|
||||
zkey/ekmfweb/zkey-ekmfweb.so
|
||||
zkey/zkey
|
||||
zkey/zkey-cryptsetup
|
||||
|
||||
18
CHANGELOG.md
18
CHANGELOG.md
@@ -1,5 +1,23 @@
|
||||
Release history for s390-tools (MIT version)
|
||||
--------------------------------------------
|
||||
* __v2.15.1 (2020-10-28)__
|
||||
|
||||
For Linux kernel version: 5.9
|
||||
|
||||
Changes of existing tools:
|
||||
- lsstp: Improve wording and fix typos in man page
|
||||
- zkey: Ensure zkey and friends are skipped with HAVE_OPENSSL=0
|
||||
- zkey: Add library versioning for libekmfweb and zkey-ekmfweb
|
||||
- libutil: Add function to determine base device of a partition block device
|
||||
|
||||
Bug Fixes:
|
||||
- dasdfmt: Fix bad file descriptor error when running on symlinks
|
||||
- libdasd: Fix dasd_get_host_access_count()
|
||||
- zipl: Fix multivolume dump
|
||||
- zgetdump: Fix device node determination via sysfs to work with multivolume again
|
||||
- genprotimg/boot: Fix build by disabling SSP
|
||||
- zipl/boot: Fix build by disabling SSP
|
||||
|
||||
* __v2.15.0 (2020-10-15)__
|
||||
|
||||
For Linux kernel version: 5.9
|
||||
|
||||
@@ -6,7 +6,7 @@ COMMON_INCLUDED = true
|
||||
# "make DISTRELEASE=%{release}" and "make install DISTRELEASE=%{release}"
|
||||
VERSION = 2
|
||||
RELEASE = 15
|
||||
PATCHLEVEL = 0
|
||||
PATCHLEVEL = 1
|
||||
DISTRELEASE = build-$(shell date +%Y%m%d)
|
||||
S390_TOOLS_RELEASE = $(VERSION).$(RELEASE).$(PATCHLEVEL)-$(DISTRELEASE)
|
||||
export S390_TOOLS_RELEASE
|
||||
@@ -163,7 +163,7 @@ USRSBINDIR = $(INSTALLDIR)/usr/sbin
|
||||
USRBINDIR = $(INSTALLDIR)/usr/bin
|
||||
BINDIR = $(INSTALLDIR)/sbin
|
||||
LIBDIR = $(INSTALLDIR)/lib
|
||||
LIB64DIR = $(INSTALLDIR)/lib64
|
||||
USRLIB64DIR = $(INSTALLDIR)/usr/lib64
|
||||
SYSCONFDIR = $(INSTALLDIR)/etc
|
||||
MANDIR = $(INSTALLDIR)/usr/share/man
|
||||
VARDIR = $(INSTALLDIR)/var
|
||||
@@ -179,10 +179,10 @@ INSTDIRS = $(USRSBINDIR) $(USRBINDIR) $(BINDIR) $(LIBDIR) $(MANDIR) \
|
||||
$(SYSCONFDIR) $(SYSCONFDIR)/sysconfig \
|
||||
$(TOOLS_LIBDIR) $(TOOLS_DATADIR) \
|
||||
$(ZFCPDUMP_DIR) $(SYSTEMDSYSTEMUNITDIR) \
|
||||
$(LIB64DIR) $(USRINCLUDEDIR)
|
||||
$(USRLIB64DIR) $(USRINCLUDEDIR)
|
||||
OWNER = $(shell id -un)
|
||||
GROUP = $(shell id -gn)
|
||||
export INSTALLDIR BINDIR LIBDIR LIB64DIR MANDIR OWNER GROUP
|
||||
export INSTALLDIR BINDIR LIBDIR USRLIB64DIR MANDIR OWNER GROUP
|
||||
|
||||
# Special defines for zfcpdump
|
||||
ZFCPDUMP_IMAGE = zfcpdump-image
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -65,47 +65,24 @@ static const char mode_str[3][10] = {
|
||||
"is in invalid format\n",prog_name);}
|
||||
|
||||
typedef struct bootstrap1 {
|
||||
u_int32_t key;
|
||||
u_int32_t data[6];
|
||||
u_int32_t key;
|
||||
u_int32_t data[6];
|
||||
} __attribute__ ((packed)) bootstrap1_t;
|
||||
|
||||
typedef struct bootstrap2 {
|
||||
u_int32_t key;
|
||||
u_int32_t data[36];
|
||||
u_int32_t key;
|
||||
u_int32_t data[36];
|
||||
} __attribute__ ((packed)) bootstrap2_t;
|
||||
|
||||
typedef struct dasdfmt_info {
|
||||
dasd_information2_t dasd_info;
|
||||
int verbosity;
|
||||
int testmode;
|
||||
int withoutprompt;
|
||||
int print_progressbar;
|
||||
int print_hashmarks, hashstep;
|
||||
int print_percentage;
|
||||
int force;
|
||||
int writenolabel;
|
||||
int labelspec;
|
||||
int cdl_format;
|
||||
int blksize_specified;
|
||||
int reqsize_specified;
|
||||
int keep_volser;
|
||||
int force_host;
|
||||
int layout_specified;
|
||||
int check;
|
||||
int mode_specified;
|
||||
int ese;
|
||||
int no_discard;
|
||||
} dasdfmt_info_t;
|
||||
|
||||
|
||||
/*
|
||||
C9D7D3F1 000A0000 0000000F 03000000 00000001 00000000 00000000
|
||||
*/
|
||||
static bootstrap1_t ipl1 = {
|
||||
0xC9D7D3F1, {
|
||||
0x000A0000, 0x0000000F, 0x03000000,
|
||||
0x00000001, 0x00000000, 0x00000000
|
||||
}
|
||||
0xC9D7D3F1, {
|
||||
0x000A0000, 0x0000000F, 0x03000000,
|
||||
0x00000001, 0x00000000, 0x00000000
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -116,21 +93,20 @@ C9D7D3F2 07003AB8 40000006 31003ABE 40000005 08003AA0 00000000 06000000
|
||||
00000000 00000000 00000000 00000000 00000000
|
||||
*/
|
||||
static bootstrap2_t ipl2 = {
|
||||
0xC9D7D3F2, {
|
||||
0x07003AB8, 0x40000006, 0x31003ABE,
|
||||
0x40000005, 0x08003AA0, 0x00000000,
|
||||
0x06000000, 0x20000000, 0x00000000,
|
||||
0x00000000, 0x00000400, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000
|
||||
}
|
||||
0xC9D7D3F2, {
|
||||
0x07003AB8, 0x40000006, 0x31003ABE,
|
||||
0x40000005, 0x08003AA0, 0x00000000,
|
||||
0x06000000, 0x20000000, 0x00000000,
|
||||
0x00000000, 0x00000400, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* DASDFMT_H */
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ ALL_CFLAGS := $(NO_PIE_CFLAGS) -Os -g \
|
||||
-DENABLE_SCLP_ASCII=1 \
|
||||
-DS390_TOOLS_RELEASE=$(S390_TOOLS_RELEASE) \
|
||||
-fno-builtin -ffreestanding -fno-asynchronous-unwind-tables \
|
||||
-fno-delete-null-pointer-checks \
|
||||
-fno-delete-null-pointer-checks -fno-stack-protector \
|
||||
-fexec-charset=IBM1047 -m64 -mpacked-stack \
|
||||
-mstack-size=4096 -mstack-guard=128 -msoft-float \
|
||||
-Wall -Wformat-security -Wextra -Werror
|
||||
|
||||
@@ -12,6 +12,11 @@
|
||||
#ifndef LIB_UTIL_SYS_H
|
||||
#define LIB_UTIL_SYS_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
int util_sys_get_dev_addr(const char *dev, char *addr);
|
||||
bool util_sys_dev_is_partition(dev_t dev);
|
||||
int util_sys_get_partnum(dev_t dev);
|
||||
int util_sys_get_base_dev(dev_t dev, dev_t *base_dev);
|
||||
|
||||
#endif /** LIB_UTIL_SYS_H @} */
|
||||
|
||||
@@ -214,7 +214,7 @@ int dasd_get_host_access_count(char *device)
|
||||
char *path;
|
||||
long value;
|
||||
|
||||
if (!util_sys_get_dev_addr(device, busid))
|
||||
if (util_sys_get_dev_addr(device, busid) != 0)
|
||||
return 0;
|
||||
|
||||
path = util_path_sysfs("bus/ccw/devices/%s/host_access_count", busid);
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
include ../common.mak
|
||||
|
||||
VERSION = 1.0
|
||||
VERM = $(shell echo $(VERSION) | cut -d '.' -f 1)
|
||||
|
||||
ifneq (${HAVE_OPENSSL},0)
|
||||
ifneq (${HAVE_JSONC},0)
|
||||
ifneq (${HAVE_LIBCURL},0)
|
||||
BUILD_TARGETS += libekmfweb.so
|
||||
INSTALL_TARGETS += install-libekmfweb.so
|
||||
BUILD_TARGETS += libekmfweb.so.$(VERSION)
|
||||
INSTALL_TARGETS += install-libekmfweb.so.$(VERSION)
|
||||
else
|
||||
BUILD_TARGETS += skip-libekmfweb-curl
|
||||
INSTALL_TARGETS += skip-libekmfweb-curl
|
||||
@@ -64,22 +67,26 @@ ekmfweb.o: check-dep-libekmfweb ekmfweb.c utilities.h cca.h $(rootdir)include/ek
|
||||
utilities.o: check-dep-libekmfweb utilities.c utilities.h $(rootdir)include/ekmfweb/ekmfweb.h
|
||||
cca.o: check-dep-libekmfweb cca.c cca.h utilities.h $(rootdir)include/ekmfweb/ekmfweb.h
|
||||
|
||||
libekmfweb.so: ALL_CFLAGS += -fPIC
|
||||
libekmfweb.so: LDLIBS = -ljson-c -lcrypto -lssl -lcurl -ldl -shared
|
||||
libekmfweb.so: LDFLAGS = -shared -Wl,--version-script=libekmfweb.map \
|
||||
-Wl,-z,defs,-Bsymbolic
|
||||
libekmfweb.so: ekmfweb.o utilities.o cca.o
|
||||
libekmfweb.so.$(VERSION): ALL_CFLAGS += -fPIC
|
||||
libekmfweb.so.$(VERSION): LDLIBS = -ljson-c -lcrypto -lssl -lcurl -ldl
|
||||
libekmfweb.so.$(VERSION): ALL_LDFLAGS += -shared -Wl,--version-script=libekmfweb.map \
|
||||
-Wl,-z,defs,-Bsymbolic -Wl,-soname,libekmfweb.so.$(VERM)
|
||||
libekmfweb.so.$(VERSION): ekmfweb.o utilities.o cca.o
|
||||
$(LINK) $(ALL_LDFLAGS) $^ $(LDLIBS) -o $@
|
||||
ln -srf libekmfweb.so.$(VERSION) libekmfweb.so.$(VERM)
|
||||
ln -srf libekmfweb.so.$(VERSION) libekmfweb.so
|
||||
|
||||
install-libekmfweb.so: libekmfweb.so
|
||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 -T libekmfweb.so $(DESTDIR)$(LIB64DIR)/libekmfweb.so
|
||||
install-libekmfweb.so.$(VERSION): libekmfweb.so.$(VERSION)
|
||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 -T libekmfweb.so.$(VERSION) $(DESTDIR)$(USRLIB64DIR)/libekmfweb.so.$(VERSION)
|
||||
ln -srf $(DESTDIR)$(USRLIB64DIR)/libekmfweb.so.$(VERSION) $(DESTDIR)$(USRLIB64DIR)/libekmfweb.so.$(VERM)
|
||||
ln -srf $(DESTDIR)$(USRLIB64DIR)/libekmfweb.so.$(VERSION) $(DESTDIR)$(USRLIB64DIR)/libekmfweb.so
|
||||
$(INSTALL) -d -m 770 $(DESTDIR)$(USRINCLUDEDIR)/ekmfweb
|
||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 $(rootdir)include/ekmfweb/ekmfweb.h $(DESTDIR)$(USRINCLUDEDIR)/ekmfweb
|
||||
|
||||
install: all $(INSTALL_TARGETS)
|
||||
|
||||
clean:
|
||||
rm -f *.o libekmfweb.so check-dep-libekmfweb detect-openssl-version.dep
|
||||
rm -f *.o libekmfweb.so* check-dep-libekmfweb detect-openssl-version.dep
|
||||
|
||||
.PHONY: all install clean skip-libekmfweb-openssl skip-libekmfweb-jsonc \
|
||||
skip-libekmfweb-curl install-libekmfweb.so
|
||||
skip-libekmfweb-curl install-libekmfweb.so.$(VERSION)
|
||||
|
||||
@@ -11,17 +11,114 @@
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <linux/fs.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "lib/util_file.h"
|
||||
#include "lib/util_libc.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
|
||||
#define PAGE_SIZE 4096
|
||||
|
||||
/**
|
||||
* Return the partition number of a given partition.
|
||||
*
|
||||
* @param[in] dev Device node of interest
|
||||
*
|
||||
* @retval int Partition number of the device
|
||||
* @retval -1 Error when trying to read the partition number.
|
||||
*/
|
||||
int util_sys_get_partnum(dev_t dev)
|
||||
{
|
||||
int partnum = -1;
|
||||
char *path;
|
||||
|
||||
path = util_path_sysfs("dev/block/%u:%u/partition",
|
||||
major(dev), minor(dev));
|
||||
if (util_file_read_i(&partnum, 10, path)) {
|
||||
warnx("Could not read from path '%s'", path);
|
||||
goto out;
|
||||
}
|
||||
if (partnum <= 0) {
|
||||
warnx("Bad partition number in '%s'", path);
|
||||
partnum = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
free(path);
|
||||
return partnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given device is a partition.
|
||||
*
|
||||
* @param[in] dev Device node of interest
|
||||
*
|
||||
* @retval true Device is partition
|
||||
* @retval false Device is not a partition
|
||||
*/
|
||||
bool util_sys_dev_is_partition(dev_t dev)
|
||||
{
|
||||
bool is_part;
|
||||
char *path;
|
||||
|
||||
path = util_path_sysfs("dev/block/%u:%u/partition",
|
||||
major(dev), minor(dev));
|
||||
is_part = util_path_exists(path);
|
||||
free(path);
|
||||
|
||||
return is_part;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine base device
|
||||
*
|
||||
* This function determines the base device \p base_dev of a given
|
||||
* device \p dev. If \p dev is a base device, \p base_dev becomes \p dev.
|
||||
*
|
||||
* @param[in] dev Device node of interest
|
||||
* @param[out] base_dev Identified base device
|
||||
*
|
||||
* @retval 0 Success
|
||||
* @retval -1 Error while reading device information or
|
||||
* constructed path
|
||||
*/
|
||||
int util_sys_get_base_dev(dev_t dev, dev_t *base_dev)
|
||||
{
|
||||
int base_major, base_minor;
|
||||
char buf[PAGE_SIZE];
|
||||
char *path;
|
||||
|
||||
/* check if the device already is a base device */
|
||||
if (!util_sys_dev_is_partition(dev)) {
|
||||
*base_dev = makedev(major(dev), minor(dev));
|
||||
return 0;
|
||||
}
|
||||
path = util_path_sysfs("dev/block/%d:%d/../dev",
|
||||
major(dev), minor(dev));
|
||||
if (util_file_read_line(buf, sizeof(buf), path)) {
|
||||
warnx("Could not read from path '%s'", path);
|
||||
free(path);
|
||||
return -1;
|
||||
}
|
||||
free(path);
|
||||
if (sscanf(buf, "%i:%i", &base_major, &base_minor) != 2) {
|
||||
warn("Could not parse major:minor from string '%s'", buf);
|
||||
return -1;
|
||||
}
|
||||
*base_dev = makedev(base_major, base_minor);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify device address
|
||||
@@ -44,13 +141,17 @@ int util_sys_get_dev_addr(const char *dev, char *addr)
|
||||
unsigned int maj, min;
|
||||
struct stat s;
|
||||
ssize_t len;
|
||||
dev_t base;
|
||||
char *path;
|
||||
|
||||
if (stat(dev, &s) != 0)
|
||||
return -1;
|
||||
|
||||
maj = major(s.st_rdev);
|
||||
min = minor(s.st_rdev);
|
||||
if (util_sys_get_base_dev(s.st_rdev, &base))
|
||||
return -1;
|
||||
|
||||
maj = major(base);
|
||||
min = minor(base);
|
||||
|
||||
if (S_ISBLK(s.st_mode))
|
||||
path = util_path_sysfs("dev/block/%u:%u/device", maj, min);
|
||||
|
||||
@@ -5,21 +5,21 @@
|
||||
.TH LSSTP 8 "Jul 2020" "s390-tools" "Linux Administrator's Manual"
|
||||
.SH NAME
|
||||
.B "lsstp "
|
||||
\- tool to show STP system information
|
||||
\- Show STP configuration information
|
||||
.SH SYNOPSIS
|
||||
.BI "lsstp "
|
||||
|
||||
.SH DESCRIPTION
|
||||
.B lsstp
|
||||
displays information about the currenta Server Time Protocol (STP) configuration
|
||||
like Coordianted Timing Network (CTN) ID, Timing state and Leap seconds.
|
||||
displays information about the current Server Time Protocol (STP) configuration
|
||||
like coordinated time network (CTN) ID, timing state and leap seconds.
|
||||
.SH OUTPUT
|
||||
.TP
|
||||
.B STP online
|
||||
Whether the STP subsystem is online
|
||||
Indication of the online state
|
||||
.TP
|
||||
.B CTN ID
|
||||
The ID of the Coordinated Time Network. If it can be decoded as EBCDIC it will be shown as EBCDIC String, otherwise a hexadecimal representation is shown.
|
||||
The ID of the coordinated time network. If it can be decoded as EBCDIC it is shown as an EBCDIC string, otherwise a hexadecimal representation is shown.
|
||||
.TP
|
||||
.B CTN Type
|
||||
The type of timing network.
|
||||
@@ -31,15 +31,15 @@ STP is not configured for attachment to a CTN.
|
||||
STP is configured and attached to a CTN with only STP nodes.
|
||||
.IP
|
||||
.B Mixed
|
||||
STP is configured and attached to a CTN which contains both STP and External Time Reference (ETR) nodes.
|
||||
STP is configured and attached to a CTN with both STP and external time reference (ETR) nodes.
|
||||
.TP
|
||||
.B Stratum
|
||||
The Stratum level of the STP clock. This indicates the number of servers in the timing path between the local STP clock and the selected primary time server.
|
||||
The number of servers in the timing path between the local STP clock and the selected primary time server.
|
||||
.TP
|
||||
.B Timing mode
|
||||
.IP
|
||||
.B Local
|
||||
The Time-of-day (TOD) clock is stepped to the local hardware oscillator and is not steered by the STP facility.
|
||||
The Time-of-day (TOD) clock is stepped by the local hardware oscillator and is not steered by the STP facility.
|
||||
.IP
|
||||
.B ETR
|
||||
The TOD clock is synchronized with an attached 9037 Sysplex Timer.
|
||||
@@ -51,10 +51,10 @@ The TOD clock is steered by the STP facility to maintain synchronization with a
|
||||
The TOD clock is not initialized. The STP facility is allowed to perform a step adjustment to the TOD clock for synchronization.
|
||||
.TP
|
||||
.B Timing state
|
||||
The synchronization state of the STP facilty. Can be unsynchronzied, synchronized and stopped.
|
||||
The synchronization state of the STP facility. Can be unsynchronized, synchronized or stopped.
|
||||
.TP
|
||||
.B DST offset
|
||||
The Daylight savings time offset relative to UTC in minutes.
|
||||
The daylight savings time offset relative to UTC in minutes.
|
||||
.TP
|
||||
.B Timezone offset
|
||||
The offset of the local time relative to UTC in minutes.
|
||||
@@ -62,11 +62,11 @@ The offset of the local time relative to UTC in minutes.
|
||||
.B Time offset
|
||||
The total time offset at the server. This field is only valid in mixed CTN configurations.
|
||||
.TP
|
||||
.B Active Leap seconds
|
||||
The number of Leap seconds that are currently in effect at the STP facility.
|
||||
.B Active leap seconds
|
||||
The number of leap seconds that are currently in effect at the STP facility.
|
||||
.TP
|
||||
.B Leap second <insertion|delation> at
|
||||
If a Leap second insertion or deletetion is scheduled in the STP facility, this field will show the Day and Time of the scheduled change.
|
||||
.B Leap second <insertion|deletion> at
|
||||
If a leap second insertion or deletion is scheduled in the STP facility, this field shows the day and time of the scheduled change.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BI "-v|--version"
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "lib/util_file.h"
|
||||
#include "lib/util_path.h"
|
||||
|
||||
#include "zgetdump.h"
|
||||
@@ -98,6 +99,24 @@ static void em_init(struct vol *vol)
|
||||
l.dump_incomplete = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether a device with a given busid is online
|
||||
*/
|
||||
static unsigned int dev_is_online(const char *busid)
|
||||
{
|
||||
unsigned int online;
|
||||
char *path;
|
||||
|
||||
path = util_path_sysfs("%s/%s/online", SYSFS_BUSDIR, busid);
|
||||
if (util_file_read_ui(&online, 10, path) != 0) {
|
||||
warnx("Could not open \"%s\" (%s)", path, strerror(errno));
|
||||
free(path);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
free(path);
|
||||
|
||||
return online;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check sysfs, whether a device specified by its bus ID is defined and online.
|
||||
@@ -106,67 +125,40 @@ static void em_init(struct vol *vol)
|
||||
static enum dev_status dev_from_busid(char *bus_id, dev_t *dev)
|
||||
{
|
||||
struct dirent *direntp;
|
||||
int fh, minor, major;
|
||||
int minor, major;
|
||||
char buf[10];
|
||||
DIR *fh_dir;
|
||||
char *sysfs;
|
||||
|
||||
sysfs = util_path_sysfs("%s/%s", SYSFS_BUSDIR, bus_id);
|
||||
fh_dir = opendir(sysfs);
|
||||
free(sysfs);
|
||||
if (!fh_dir)
|
||||
if (!util_path_is_dir(sysfs)) {
|
||||
free(sysfs);
|
||||
return DEV_UNDEFINED;
|
||||
|
||||
sysfs = util_path_sysfs("%s/%s/online", SYSFS_BUSDIR, bus_id);
|
||||
fh = open(sysfs, O_RDONLY);
|
||||
if (fh == -1) {
|
||||
warnx("Could not open \"%s\" (%s)", sysfs, strerror(errno));
|
||||
goto err;
|
||||
}
|
||||
free(sysfs);
|
||||
if (read(fh, buf, 1) == -1)
|
||||
ERR_EXIT_ERRNO("Could not read online attribute");
|
||||
close(fh);
|
||||
|
||||
if (buf[0] != '1')
|
||||
if (!dev_is_online(bus_id))
|
||||
return DEV_OFFLINE;
|
||||
|
||||
while ((direntp = readdir(fh_dir)))
|
||||
if (strncmp(direntp->d_name, "block:", 6) == 0)
|
||||
break;
|
||||
closedir(fh_dir);
|
||||
|
||||
if (direntp == NULL) {
|
||||
sysfs = util_path_sysfs("%s/%s/block", SYSFS_BUSDIR, bus_id);
|
||||
fh_dir = opendir(sysfs);
|
||||
if (!fh_dir) {
|
||||
warnx("Could not open \"%s\" (%s) ",
|
||||
sysfs, strerror(errno));
|
||||
goto err;
|
||||
}
|
||||
while ((direntp = readdir(fh_dir)))
|
||||
if (strncmp(direntp->d_name, "dasd", 4) == 0)
|
||||
break;
|
||||
closedir(fh_dir);
|
||||
if (direntp == NULL) {
|
||||
warnx("Problem with contents of \"%s\"", sysfs);
|
||||
goto err;
|
||||
}
|
||||
free(sysfs);
|
||||
}
|
||||
|
||||
sysfs = util_path_sysfs("%s/%s/%s/dev",
|
||||
SYSFS_BUSDIR, bus_id, direntp->d_name);
|
||||
fh = open(sysfs, O_RDONLY);
|
||||
if (fh == -1) {
|
||||
warnx("Could not open \"%s\" (%s)", sysfs, strerror(errno));
|
||||
sysfs = util_path_sysfs("%s/%s/block", SYSFS_BUSDIR, bus_id);
|
||||
fh_dir = opendir(sysfs);
|
||||
if (!fh_dir) {
|
||||
warnx("Could not open \"%s\" (%s) ", sysfs, strerror(errno));
|
||||
goto err;
|
||||
}
|
||||
if (read(fh, buf, sizeof(buf)) == -1) {
|
||||
while ((direntp = readdir(fh_dir)))
|
||||
if (strncmp(direntp->d_name, "dasd", 4) == 0)
|
||||
break;
|
||||
if (direntp == NULL) {
|
||||
warnx("Problem with contents of \"%s\"", sysfs);
|
||||
goto err;
|
||||
}
|
||||
if (util_file_read_line(buf, sizeof(buf), "%s/%s/dev", sysfs, direntp->d_name)) {
|
||||
warnx("Could not read dev file (%s)", strerror(errno));
|
||||
goto err;
|
||||
}
|
||||
close(fh);
|
||||
closedir(fh_dir);
|
||||
|
||||
if (sscanf(buf, "%i:%i", &major, &minor) != 2) {
|
||||
warnx("Malformed content of \"%s\": %s", sysfs, buf);
|
||||
goto err;
|
||||
@@ -178,6 +170,8 @@ static enum dev_status dev_from_busid(char *bus_id, dev_t *dev)
|
||||
return DEV_ONLINE;
|
||||
|
||||
err:
|
||||
if (fh_dir)
|
||||
closedir(fh_dir);
|
||||
free(sysfs);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ configuration.
|
||||
* Issue "make bzImage" to build the zfcpdump kernel image.
|
||||
|
||||
In a Linux distribution the zfcpdump enabled kernel image must be copied to
|
||||
/lib/s390-tools/zfcpdump/zfcpdump_part.image, where the s390 zipl tool is
|
||||
/lib/s390-tools/zfcpdump/zfcpdump-image, where the s390 zipl tool is
|
||||
looking for the dump kernel when preparing a SCSI dump disk.
|
||||
|
||||
Create and install initrd
|
||||
|
||||
@@ -7,7 +7,7 @@ INCLUDE_PARMS := $(addprefix -I,$(INCLUDE_PATHS))
|
||||
ALL_CFLAGS = $(NO_PIE_CFLAGS) -Os -g $(INCLUDE_PARMS) \
|
||||
-DS390_TOOLS_RELEASE=$(S390_TOOLS_RELEASE) \
|
||||
-fno-builtin -ffreestanding -fno-asynchronous-unwind-tables \
|
||||
-fno-delete-null-pointer-checks \
|
||||
-fno-delete-null-pointer-checks -fno-stack-protector \
|
||||
-fexec-charset=IBM1047 -m64 -mpacked-stack \
|
||||
-mstack-size=4096 -mstack-guard=128 -msoft-float \
|
||||
-W -Wall -Wformat-security
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <linux/fiemap.h>
|
||||
|
||||
#include "lib/util_proc.h"
|
||||
#include "lib/util_sys.h"
|
||||
|
||||
#include "disk.h"
|
||||
#include "error.h"
|
||||
@@ -89,88 +90,6 @@ disk_determine_dasd_type(struct disk_info *data,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int blkext_get_partnum(dev_t dev)
|
||||
{
|
||||
char path[PATH_MAX], *buf;
|
||||
int dev_major, dev_minor, partnum = -1;
|
||||
|
||||
dev_major = major(dev);
|
||||
dev_minor = minor(dev);
|
||||
snprintf(path, PATH_MAX, "/sys/dev/block/%d:%d/partition",
|
||||
dev_major, dev_minor);
|
||||
|
||||
if (misc_read_special_file(path, &buf, NULL, 1)) {
|
||||
error_text("Could not read from path '%s'", path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
partnum = atoi(buf);
|
||||
free(buf);
|
||||
if (partnum < 0) {
|
||||
error_text("Bad partition number in '%s'", path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return partnum;
|
||||
}
|
||||
|
||||
static int blkext_is_base_device(dev_t dev)
|
||||
{
|
||||
int dev_major, dev_minor;
|
||||
char path[PATH_MAX];
|
||||
struct stat stats;
|
||||
|
||||
dev_major = major(dev);
|
||||
dev_minor = minor(dev);
|
||||
|
||||
snprintf(path, PATH_MAX, "/sys/dev/block/%d:%d/partition",
|
||||
dev_major, dev_minor);
|
||||
return (stat(path, &stats));
|
||||
}
|
||||
|
||||
static int blkext_get_base_dev(dev_t dev, dev_t *base_dev)
|
||||
{
|
||||
int base_major, base_minor;
|
||||
char dev_path[PATH_MAX], base_path[PATH_MAX];
|
||||
char *temp_path, *buf;
|
||||
|
||||
misc_asprintf(&temp_path, "/sys/dev/block/%d:%d", major(dev), minor(dev));
|
||||
if (!realpath(temp_path, dev_path)) {
|
||||
error_reason(strerror(errno));
|
||||
error_text("Could not resolve link %s", temp_path);
|
||||
free(temp_path);
|
||||
return -1;
|
||||
}
|
||||
free(temp_path);
|
||||
|
||||
misc_asprintf(&temp_path, "%s/..", dev_path);
|
||||
if (!realpath(temp_path, base_path)) {
|
||||
error_reason(strerror(errno));
|
||||
error_text("Could not resolve path %s", temp_path);
|
||||
free(temp_path);
|
||||
return -1;
|
||||
}
|
||||
free(temp_path);
|
||||
|
||||
misc_asprintf(&temp_path, "%s/dev", base_path);
|
||||
if (misc_read_special_file(temp_path, &buf, NULL, 1)) {
|
||||
error_text("Could not read from path '%s'", temp_path);
|
||||
free(temp_path);
|
||||
return -1;
|
||||
}
|
||||
free(temp_path);
|
||||
|
||||
if (sscanf(buf, "%i:%i", &base_major, &base_minor) != 2) {
|
||||
error_text("Could not parse major:minor from string '%s'", buf);
|
||||
free(buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
free(buf);
|
||||
*base_dev = makedev(base_major, base_minor);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Return non-zero for ECKD type. */
|
||||
int
|
||||
disk_is_eckd(disk_type_t type)
|
||||
@@ -492,15 +411,15 @@ disk_get_info(const char* device, struct job_target_data* target,
|
||||
data->devno = -1;
|
||||
data->type = disk_type_scsi;
|
||||
|
||||
if (blkext_is_base_device(stats.st_rdev)) {
|
||||
data->device = stats.st_rdev;
|
||||
data->partnum = 0;
|
||||
} else {
|
||||
if (blkext_get_base_dev(stats.st_rdev, &data->device))
|
||||
if (util_sys_dev_is_partition(stats.st_rdev)) {
|
||||
if (util_sys_get_base_dev(stats.st_rdev, &data->device))
|
||||
goto out_close;
|
||||
data->partnum = blkext_get_partnum(stats.st_rdev);
|
||||
data->partnum = util_sys_get_partnum(stats.st_rdev);
|
||||
if (data->partnum == -1)
|
||||
goto out_close;
|
||||
} else {
|
||||
data->device = stats.st_rdev;
|
||||
data->partnum = 0;
|
||||
}
|
||||
} else {
|
||||
/* Driver name is unknown */
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
include ../common.mak
|
||||
|
||||
SUB_DIRS = ekmfweb
|
||||
|
||||
ifneq (${HAVE_OPENSSL},0)
|
||||
BUILD_TARGETS += zkey
|
||||
INSTALL_TARGETS += install-zkey
|
||||
ifneq (${HAVE_JSONC},0)
|
||||
ifneq (${HAVE_LIBCURL},0)
|
||||
SUB_DIRS += ekmfweb
|
||||
endif
|
||||
endif
|
||||
else
|
||||
BUILD_TARGETS += zkey-skip
|
||||
INSTALL_TARGETS += zkey-skip
|
||||
@@ -12,9 +15,14 @@ endif
|
||||
|
||||
ifneq (${HAVE_CRYPTSETUP2},0)
|
||||
ifneq (${HAVE_JSONC},0)
|
||||
BUILD_TARGETS += zkey-cryptsetup
|
||||
INSTALL_TARGETS += install-zkey-cryptsetup
|
||||
CPPFLAGS += -DHAVE_LUKS2_SUPPORT
|
||||
ifneq (${HAVE_OPENSSL},0)
|
||||
BUILD_TARGETS += zkey-cryptsetup
|
||||
INSTALL_TARGETS += install-zkey-cryptsetup
|
||||
CPPFLAGS += -DHAVE_LUKS2_SUPPORT
|
||||
else
|
||||
BUILD_TARGETS += zkey-cryptsetup-skip-openssl
|
||||
INSTALL_TARGETS += zkey-cryptsetup-skip-openssl
|
||||
endif
|
||||
else
|
||||
BUILD_TARGETS += zkey-cryptsetup-skip-jsonc
|
||||
INSTALL_TARGETS += zkey-cryptsetup-skip-jsonc
|
||||
@@ -64,6 +72,9 @@ zkey-cryptsetup-skip-cryptsetup2:
|
||||
zkey-cryptsetup-skip-jsonc:
|
||||
echo " SKIP zkey-cryptsetup due to HAVE_JSONC=0"
|
||||
|
||||
zkey-cryptsetup-skip-openssl:
|
||||
echo " SKIP zkey-cryptsetup due to HAVE_OPENSSL=0"
|
||||
|
||||
all: $(BUILD_TARGETS) $(SUB_DIRS)
|
||||
|
||||
zkey.o: zkey.c pkey.h cca.h ep11.h misc.h
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
include ../../common.mak
|
||||
|
||||
VERSION = 1.0
|
||||
VERM = $(shell echo $(VERSION) | cut -d '.' -f 1)
|
||||
|
||||
all: zkey-ekmfweb.so
|
||||
|
||||
libs = $(rootdir)/libutil/libutil.a
|
||||
@@ -8,7 +11,7 @@ export LIBRARY_PATH = $(rootdir)/libekmfweb:$LIBRARY_PATH
|
||||
|
||||
zkey-ekmfweb.o: zkey-ekmfweb.c zkey-ekmfweb.h ../kms-plugin.h \
|
||||
../cca.h ../utils.h ../pkey.h ../properties.h \
|
||||
$(rootdir)include/ekmfweb/ekmfweb.h $(rootdir)/libekmfweb/libekmfweb.so
|
||||
$(rootdir)include/ekmfweb/ekmfweb.h libekmfweb.dep
|
||||
|
||||
properties.o: ../properties.c ../properties.h
|
||||
$(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -fPIC -c $< -o $@
|
||||
@@ -26,9 +29,9 @@ utils.o: ../utils.c ../utils.h ../pkey.h ../cca.h ../ep11.h
|
||||
$(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -fPIC -c $< -o $@
|
||||
|
||||
zkey-ekmfweb.so: ALL_CFLAGS += -fPIC
|
||||
zkey-ekmfweb.so: LDLIBS = -lekmfweb -ldl -lcrypto -shared
|
||||
zkey-ekmfweb.so: LDFLAGS = -shared -Wl,--version-script=zkey-ekmfweb.map \
|
||||
-Wl,-z,defs,-Bsymbolic
|
||||
zkey-ekmfweb.so: LDLIBS = -lekmfweb -ldl -lcrypto
|
||||
zkey-ekmfweb.so: ALL_LDFLAGS += -shared -Wl,--version-script=zkey-ekmfweb.map \
|
||||
-Wl,-z,defs,-Bsymbolic -Wl,-soname,zkey-ekmfweb.so.$(VERM)
|
||||
zkey-ekmfweb.so: zkey-ekmfweb.o properties.o pkey.o cca.o ep11.o utils.o $(libs)
|
||||
$(LINK) $(ALL_LDFLAGS) $^ $(LDLIBS) -o $@
|
||||
|
||||
@@ -36,13 +39,18 @@ install-libekmfweb.dep:
|
||||
$(MAKE) -C $(rootdir)/libekmfweb/ TOPDIR=$(TOPDIR) ARCH=$(ARCH) install
|
||||
touch install-libekmfweb.dep
|
||||
|
||||
libekmfweb.dep:
|
||||
$(MAKE) -C $(rootdir)/libekmfweb/ TOPDIR=$(TOPDIR) ARCH=$(ARCH) all
|
||||
touch libekmfweb.dep
|
||||
|
||||
install: all install-libekmfweb.dep zkey-ekmfweb.so
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)$(MANDIR)/man1
|
||||
$(INSTALL) -m 644 -c zkey-ekmfweb.1 $(DESTDIR)$(MANDIR)/man1
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)$(LIB64DIR)
|
||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 -T zkey-ekmfweb.so $(DESTDIR)$(LIB64DIR)/zkey-ekmfweb.so
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)$(USRLIB64DIR)
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)$(USRLIB64DIR)/zkey
|
||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 -T zkey-ekmfweb.so $(DESTDIR)$(USRLIB64DIR)/zkey/zkey-ekmfweb.so
|
||||
|
||||
clean:
|
||||
rm -f *.o zkey-ekmfweb.so install-libekmfweb.dep
|
||||
rm -f *.o zkey-ekmfweb.so install-libekmfweb.dep libekmfweb.dep
|
||||
|
||||
.PHONY: all install clean
|
||||
33
zkey/kms.c
33
zkey/kms.c
@@ -40,6 +40,7 @@
|
||||
|
||||
#define ENVVAR_ZKEY_KMS_PLUGINS "ZKEY_KMS_PLUGINS"
|
||||
#define DEFAULT_KMS_PLUGINS "/etc/zkey/kms-plugins.conf"
|
||||
#define KMS_PLUGIN_LOCATION "/usr/lib64/zkey"
|
||||
|
||||
#define KMS_CONFIG_FILE "kms.conf"
|
||||
#define KMS_CONFIG_PROP_KMS "kms"
|
||||
@@ -209,6 +210,7 @@ static int load_kms_plugin(const char *plugin,
|
||||
void **plugin_lib, char **plugin_name, bool verbose)
|
||||
{
|
||||
kms_get_functions_t _kms_get_functions;
|
||||
char load_so_name[PATH_MAX];
|
||||
char *so_name = NULL;
|
||||
FILE *fp = NULL;
|
||||
char line[4096];
|
||||
@@ -258,15 +260,26 @@ static int load_kms_plugin(const char *plugin,
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Try to load via LD_LIBRARY_PATH first */
|
||||
snprintf(load_so_name, sizeof(load_so_name), "%s", so_name);
|
||||
pr_verbose(verbose, "Loading KMS plugin '%s': '%s'", *plugin_name,
|
||||
so_name);
|
||||
*plugin_lib = dlopen(so_name, RTLD_GLOBAL | RTLD_NOW);
|
||||
load_so_name);
|
||||
*plugin_lib = dlopen(load_so_name, RTLD_GLOBAL | RTLD_NOW);
|
||||
if (*plugin_lib == NULL) {
|
||||
pr_verbose(verbose, "%s", dlerror());
|
||||
warnx("Failed to load KMS plugin '%s': '%s'", *plugin_name,
|
||||
so_name);
|
||||
rc = -ELIBACC;
|
||||
goto out;
|
||||
/* Try to load from default plugin location */
|
||||
snprintf(load_so_name, sizeof(load_so_name), "%s/%s",
|
||||
KMS_PLUGIN_LOCATION, so_name);
|
||||
pr_verbose(verbose, "Loading KMS plugin '%s': '%s'",
|
||||
*plugin_name, load_so_name);
|
||||
|
||||
*plugin_lib = dlopen(load_so_name, RTLD_GLOBAL | RTLD_NOW);
|
||||
if (*plugin_lib == NULL) {
|
||||
pr_verbose(verbose, "%s", dlerror());
|
||||
warnx("Failed to load KMS plugin '%s': '%s'",
|
||||
*plugin_name, load_so_name);
|
||||
rc = -ELIBACC;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
_kms_get_functions = (kms_get_functions_t)dlsym(*plugin_lib,
|
||||
@@ -274,7 +287,7 @@ static int load_kms_plugin(const char *plugin,
|
||||
if (_kms_get_functions == NULL) {
|
||||
pr_verbose(verbose, "%s", dlerror());
|
||||
warnx("Failed to load KMS plugin '%s': '%s'", *plugin_name,
|
||||
so_name);
|
||||
load_so_name);
|
||||
rc = -ELIBACC;
|
||||
goto out;
|
||||
}
|
||||
@@ -283,13 +296,13 @@ static int load_kms_plugin(const char *plugin,
|
||||
if (*kms_functions == NULL) {
|
||||
pr_verbose(verbose, "kms_get_functions() reutned NULL");
|
||||
warnx("Failed to load KMS plugin '%s': '%s'", *plugin_name,
|
||||
so_name);
|
||||
load_so_name);
|
||||
rc = -ELIBACC;
|
||||
goto out;
|
||||
}
|
||||
|
||||
pr_verbose(verbose, "Successfully loaded KMS plugin '%s': '%s' (API "
|
||||
"version: %u)", *plugin_name, so_name,
|
||||
"version: %u)", *plugin_name, load_so_name,
|
||||
(*kms_functions)->api_version);
|
||||
|
||||
out:
|
||||
|
||||
Reference in New Issue
Block a user