mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
Compare commits
53 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 |
@@ -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
|
||||||
|
|||||||
@@ -1,5 +1,39 @@
|
|||||||
Release history for s390-tools (MIT version)
|
Release history for s390-tools (MIT version)
|
||||||
--------------------------------------------
|
--------------------------------------------
|
||||||
|
* __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)__
|
* __v2.9.0 (2019-05-21)__
|
||||||
|
|
||||||
For Linux kernel version: 5.0 / 5.1
|
For Linux kernel version: 5.0 / 5.1
|
||||||
|
|||||||
+1
-1
@@ -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 = 9
|
RELEASE = 11
|
||||||
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)
|
||||||
|
|||||||
+1
-1
@@ -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
|
||||||
|
|||||||
@@ -267,7 +267,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
|
||||||
|
|||||||
@@ -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',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
+55
-3
@@ -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);
|
||||||
|
|
||||||
@@ -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 ||
|
||||||
|
|||||||
+3
-45
@@ -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;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3040,5 +3040,5 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,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 {
|
||||||
@@ -139,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
|
||||||
@@ -157,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 {
|
||||||
@@ -181,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)
|
||||||
|
|
||||||
@@ -204,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);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.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);
|
int dasd_get_host_access_count(char *device);
|
||||||
|
|
||||||
|
|||||||
@@ -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 @} */
|
||||||
|
|||||||
@@ -228,6 +228,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
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -57,6 +57,43 @@ int dasd_sys_raw_track_access(char *devnode)
|
|||||||
return (rc == 1) ? 1 : 0;
|
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';
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
+65
-18
@@ -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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+48
-10
@@ -173,6 +173,9 @@ 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 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 +195,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=13
|
||||||
|
|
||||||
# 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)
|
||||||
@@ -472,6 +475,8 @@ CMDS="uname -a\
|
|||||||
:systemctl status docker.service\
|
:systemctl status docker.service\
|
||||||
:blockdev --report\
|
:blockdev --report\
|
||||||
:lvdisplay\
|
:lvdisplay\
|
||||||
|
:lspci -vv\
|
||||||
|
:smc_dbg\
|
||||||
"
|
"
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
@@ -750,6 +755,37 @@ 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 " "
|
||||||
|
}
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
# OpenVSwitch
|
# OpenVSwitch
|
||||||
collect_ovs() {
|
collect_ovs() {
|
||||||
@@ -766,7 +802,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 "9 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"
|
||||||
@@ -785,7 +821,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 "9 of ${COLLECTION_COUNT}: Collecting OpenVSwitch output skipped"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pr_log_stdout " "
|
pr_log_stdout " "
|
||||||
@@ -798,12 +834,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 "10 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 "10 of ${COLLECTION_COUNT}: Collecting domain xml files skipped"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pr_log_stdout " "
|
pr_log_stdout " "
|
||||||
@@ -817,23 +853,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 "11a 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 "11a 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 "11b 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 "11b of ${COLLECTION_COUNT}: Collecting docker network output skipped"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pr_log_stdout " "
|
pr_log_stdout " "
|
||||||
@@ -843,7 +879,7 @@ collect_docker() {
|
|||||||
collect_nvme() {
|
collect_nvme() {
|
||||||
local NVME
|
local NVME
|
||||||
|
|
||||||
pr_syslog_stdout "11 of ${COLLECTION_COUNT}: Collecting nvme output"
|
pr_syslog_stdout "12 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
|
||||||
@@ -1150,6 +1186,8 @@ collect_configfiles
|
|||||||
|
|
||||||
collect_osaoat
|
collect_osaoat
|
||||||
|
|
||||||
|
collect_ethtool
|
||||||
|
|
||||||
collect_ovs
|
collect_ovs
|
||||||
|
|
||||||
collect_domain_xml
|
collect_domain_xml
|
||||||
|
|||||||
+20
-14
@@ -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,40 @@ Kernel version = <kernel\-version>
|
|||||||
.br
|
.br
|
||||||
Runtime environment = z/VM
|
Runtime environment = z/VM
|
||||||
.PP
|
.PP
|
||||||
1 of 11: Collecting command output
|
1 of 13: Collecting command output
|
||||||
.PP
|
.PP
|
||||||
2 of 11: Collecting z/VM command output
|
2 of 13: Collecting z/VM command output
|
||||||
.PP
|
.PP
|
||||||
3 of 11: Collecting procfs
|
3 of 13: Collecting procfs
|
||||||
.PP
|
.PP
|
||||||
4 of 11: Collecting sysfs
|
4 of 13: Collecting sysfs
|
||||||
.PP
|
.PP
|
||||||
5 of 11: Collecting log files
|
5 of 13: Collecting log files
|
||||||
.PP
|
.PP
|
||||||
6 of 11: Collecting config files
|
6 of 13: Collecting config files
|
||||||
.PP
|
.PP
|
||||||
7 of 11: Collecting osa oat output skipped \- not available
|
7 of 13: Collecting osa oat output skipped \- not available
|
||||||
.PP
|
.PP
|
||||||
8 of 11: Collecting OpenVSwitch output
|
8 of 13: Collecting ethtool output
|
||||||
.PP
|
.PP
|
||||||
9 of 11: Collecting domain xml files
|
9 of 13: Collecting OpenVSwitch output
|
||||||
.PP
|
.PP
|
||||||
10a of 11: Collecting docker container output
|
10 of 13: Collecting domain xml files
|
||||||
10b of 11: Collecting docker network output
|
|
||||||
.PP
|
.PP
|
||||||
11 of 11: Postprocessing
|
11a of 13: Collecting docker container output
|
||||||
|
11b of 13: Collecting docker network output
|
||||||
|
.PP
|
||||||
|
12 of 13: Collecting nvme output
|
||||||
|
.PP
|
||||||
|
13 of 13: 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
|
||||||
|
|||||||
+4
-4
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-7
@@ -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
|
||||||
|
|||||||
@@ -72,6 +72,11 @@ the parallel execution of cryptographic operations.
|
|||||||
Cryptographic performance measurement data might not be available when Linux
|
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
|
is running as guest under z/VM or under KVM. \fBzcryptstats\fP then displays an
|
||||||
error message and exits.
|
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.
|
||||||
.
|
.
|
||||||
.
|
.
|
||||||
.
|
.
|
||||||
|
|||||||
@@ -2393,7 +2393,11 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
g.chsc_fd = open(CHSC_DEVICE, O_RDWR);
|
g.chsc_fd = open(CHSC_DEVICE, O_RDWR);
|
||||||
if (g.chsc_fd < 0) {
|
if (g.chsc_fd < 0) {
|
||||||
|
rc = errno;
|
||||||
warnx("File '%s:' %s", CHSC_DEVICE, strerror(errno));
|
warnx("File '%s:' %s", CHSC_DEVICE, strerror(errno));
|
||||||
|
if (rc == ENOENT)
|
||||||
|
warnx("You might have to load kernel module 'chsc_sch' "
|
||||||
|
"using 'modprobe chsc_sch'");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
pr_verbose("Device '%s' has been opened successfully", CHSC_DEVICE);
|
pr_verbose("Device '%s' has been opened successfully", CHSC_DEVICE);
|
||||||
|
|||||||
+6
-6
@@ -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"
|
||||||
|
|||||||
+2
-2
@@ -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;
|
||||||
|
|||||||
+3
-2
@@ -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);
|
||||||
|
|||||||
@@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-3
@@ -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;
|
||||||
|
|||||||
+7
-2
@@ -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);
|
||||||
|
|||||||
+19
-5
@@ -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)),
|
||||||
|
|||||||
+4
-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,
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -6,7 +6,7 @@ CFLAGS_BOOT = $(NO_PIE_CFLAGS) -Os -g -I../include -D__ASSEMBLY__ \
|
|||||||
-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 \
|
||||||
@@ -46,7 +46,7 @@ stage3.exec: head.o stage3.o kdump3.o libc.o sclp.o sclp_stage3.o \
|
|||||||
kdump.o entry.o stage3.lds
|
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) \
|
||||||
@@ -59,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 \
|
||||||
@@ -91,7 +91,7 @@ stage3.bin: stage3.exec
|
|||||||
--only-section=.stage2dump.tail \
|
--only-section=.stage2dump.tail \
|
||||||
--only-section=.eckd2dump_mv.tail \
|
--only-section=.eckd2dump_mv.tail \
|
||||||
--only-section=.fixup \
|
--only-section=.fixup \
|
||||||
--pad-to=0xf000 \
|
--pad-to=0xe000 \
|
||||||
$< $@
|
$< $@
|
||||||
|
|
||||||
data.o: $(FILES)
|
data.o: $(FILES)
|
||||||
|
|||||||
+1
-1
@@ -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
|
||||||
|
|||||||
+14
-7
@@ -452,6 +452,18 @@ 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(u64 *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
|
||||||
@@ -470,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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
* 0x6000-0x8fff Memory allocation (heap)
|
* 0x6000-0x8fff Memory allocation (heap)
|
||||||
* 0x9000-0x9fff Memory to load stage3 parameter to
|
* 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
|
||||||
* ------------------------
|
* ------------------------
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
#define OLDMEM_SIZE 0x10420
|
#define OLDMEM_SIZE 0x10420
|
||||||
#define COMMAND_LINE 0x10480
|
#define COMMAND_LINE 0x10480
|
||||||
#define COMMAND_LINE_SIZE 896
|
#define COMMAND_LINE_SIZE 896
|
||||||
#define COMMAND_LINE_EXTRA (0xA000-0x400)
|
#define COMMAND_LINE_EXTRA 0xE000
|
||||||
|
|
||||||
#define STAGE3_FLAG_SCSI 0x0001000000000000ULL
|
#define STAGE3_FLAG_SCSI 0x0001000000000000ULL
|
||||||
#define STAGE3_FLAG_KDUMP 0x0002000000000000ULL
|
#define STAGE3_FLAG_KDUMP 0x0002000000000000ULL
|
||||||
|
|||||||
+1
-1
@@ -47,7 +47,7 @@
|
|||||||
#define DEFAULTBOOT_SECTION "defaultboot"
|
#define DEFAULTBOOT_SECTION "defaultboot"
|
||||||
|
|
||||||
#define ZIPL_CONF_VAR "ZIPLCONF"
|
#define ZIPL_CONF_VAR "ZIPLCONF"
|
||||||
#define ZIPL_DEFAULT_CONF "/etc/zipl.conf"
|
#define ZIPL_DEFAULT_CONF TOOLS_SYSCONFDIR "/zipl.conf"
|
||||||
#define ZIPL_DEFAULT_BLSDIR "/boot/loader/entries"
|
#define ZIPL_DEFAULT_BLSDIR "/boot/loader/entries"
|
||||||
#define ZIPL_STAGE3_PATH TOOLS_LIBDIR "/stage3.bin"
|
#define ZIPL_STAGE3_PATH TOOLS_LIBDIR "/stage3.bin"
|
||||||
#define ZIPL_SIPL_PATH "/sys/firmware/ipl/has_secure"
|
#define ZIPL_SIPL_PATH "/sys/firmware/ipl/has_secure"
|
||||||
|
|||||||
+3
-3
@@ -360,11 +360,11 @@ Control the zIPL secure boot support.
|
|||||||
auto (default)
|
auto (default)
|
||||||
Write signatures if available and supported by the system.
|
Write signatures if available and supported by the system.
|
||||||
1
|
1
|
||||||
Signatures are written independent of support indicated by the local
|
Write signatures regardless of support indicated by the local
|
||||||
system. Also missing signatures for stage 3 and kernel IPL files
|
system. Missing signatures for stage 3 and kernel IPL files
|
||||||
will result in an error.
|
will result in an error.
|
||||||
0
|
0
|
||||||
No signatures will be written.
|
Do not write signatures.
|
||||||
|
|
||||||
|
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
|
|||||||
@@ -527,17 +527,17 @@ non-default memory location.
|
|||||||
.B Configuration section:
|
.B Configuration section:
|
||||||
.br
|
.br
|
||||||
Control the zIPL secure boot support.
|
Control the zIPL secure boot support.
|
||||||
Set this option to one of the following:
|
Set this option to one of the following values:
|
||||||
.IP " - " 12
|
.IP " - " 12
|
||||||
.BR auto:
|
.BR auto:
|
||||||
Write signatures if available and supported by the system.
|
Write signatures if available and supported by the system.
|
||||||
.IP " - " 12
|
.IP " - " 12
|
||||||
.BR 1:
|
.BR 1:
|
||||||
Signatures are written independent of support indicated by the local system.
|
Write signatures regardless of support indicated by the local system.
|
||||||
Also missing signatures for stage 3 and kernel IPL files will result in an error.
|
Missing signatures for stage 3 and kernel IPL files will result in an error.
|
||||||
.IP " - " 12
|
.IP " - " 12
|
||||||
.BR 0:
|
.BR 0:
|
||||||
No signatures will be written.
|
Do not write signatures.
|
||||||
|
|
||||||
The default value for
|
The default value for
|
||||||
.B 'secure'
|
.B 'secure'
|
||||||
|
|||||||
+4
-2
@@ -198,8 +198,8 @@ disk_get_info(const char* device, struct job_target_data* target,
|
|||||||
long devsize;
|
long devsize;
|
||||||
FILE *fh;
|
FILE *fh;
|
||||||
char *script_pre = TOOLS_LIBDIR "/zipl_helper.";
|
char *script_pre = TOOLS_LIBDIR "/zipl_helper.";
|
||||||
char *script_file;
|
char *script_file = NULL;
|
||||||
char *ppn_cmd;
|
char *ppn_cmd = NULL;
|
||||||
char buffer[80];
|
char buffer[80];
|
||||||
char value[40];
|
char value[40];
|
||||||
int majnum, minnum;
|
int majnum, minnum;
|
||||||
@@ -443,10 +443,12 @@ type_determined:
|
|||||||
data->fs_block_size = -1;
|
data->fs_block_size = -1;
|
||||||
close(fd);
|
close(fd);
|
||||||
*info = data;
|
*info = data;
|
||||||
|
free(script_file);
|
||||||
return 0;
|
return 0;
|
||||||
out_close:
|
out_close:
|
||||||
close(fd);
|
close(fd);
|
||||||
free(ppn_cmd);
|
free(ppn_cmd);
|
||||||
|
free(script_file);
|
||||||
free(data);
|
free(data);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -114,7 +114,7 @@ get_command_line(int argc, char* argv[], struct command_line* line)
|
|||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
error_reason("dumptofs has been deprecated, use "
|
error_reason("dumptofs has been deprecated, use "
|
||||||
"--dump instead");
|
"--dumpto instead");
|
||||||
rc = -1;
|
rc = -1;
|
||||||
break;
|
break;
|
||||||
case 'M':
|
case 'M':
|
||||||
@@ -559,7 +559,7 @@ get_dump_components(struct job_dump_data *dump,
|
|||||||
/* Fill in component data */
|
/* Fill in component data */
|
||||||
num = 0;
|
num = 0;
|
||||||
rc = set_cl_element(&cl[num++], "kernel image", dump->image,
|
rc = set_cl_element(&cl[num++], "kernel image", dump->image,
|
||||||
&dump->image_addr, 0, 0x10000,
|
&dump->image_addr, 0, 0x0,
|
||||||
MAXIMUM_PHYSICAL_BLOCKSIZE);
|
MAXIMUM_PHYSICAL_BLOCKSIZE);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto error;
|
goto error;
|
||||||
@@ -1880,6 +1880,7 @@ job_get(int argc, char* argv[], struct job_data** data)
|
|||||||
job->add_files = cmdline.add_files;
|
job->add_files = cmdline.add_files;
|
||||||
job->data.mvdump.force = cmdline.force;
|
job->data.mvdump.force = cmdline.force;
|
||||||
job->dry_run = cmdline.dry_run;
|
job->dry_run = cmdline.dry_run;
|
||||||
|
job->is_secure = SECURE_BOOT_AUTO;
|
||||||
/* Get job data from user input */
|
/* Get job data from user input */
|
||||||
if (cmdline.help) {
|
if (cmdline.help) {
|
||||||
job->command_line = 1;
|
job->command_line = 1;
|
||||||
|
|||||||
@@ -699,6 +699,10 @@ scan_bls_field(struct misc_file_buffer *file, struct scan_token* scan,
|
|||||||
}
|
}
|
||||||
|
|
||||||
val_end = file->pos;
|
val_end = file->pos;
|
||||||
|
|
||||||
|
while (val_end > val_start && isblank(file->buffer[val_end - 1]))
|
||||||
|
val_end--;
|
||||||
|
|
||||||
file->buffer[key_end] = '\0';
|
file->buffer[key_end] = '\0';
|
||||||
file->buffer[val_end] = '\0';
|
file->buffer[val_end] = '\0';
|
||||||
|
|
||||||
@@ -780,6 +784,7 @@ scan_bls(const char* blsdir, struct scan_token** token, int scan_size)
|
|||||||
case EOF:
|
case EOF:
|
||||||
break;
|
break;
|
||||||
case '\t':
|
case '\t':
|
||||||
|
case '\n':
|
||||||
case '\0':
|
case '\0':
|
||||||
case ' ':
|
case ' ':
|
||||||
file.pos++;
|
file.pos++;
|
||||||
|
|||||||
+17
-27
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Keystore handling functions
|
* Keystore handling functions
|
||||||
*
|
*
|
||||||
* Copyright IBM Corp. 2018
|
* Copyright IBM Corp. 2018, 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.
|
||||||
@@ -133,14 +133,7 @@ static int _keystore_get_key_filenames(struct keystore *keystore,
|
|||||||
*/
|
*/
|
||||||
static int _keystore_reencipher_key_exists(struct key_filenames *file_names)
|
static int _keystore_reencipher_key_exists(struct key_filenames *file_names)
|
||||||
{
|
{
|
||||||
struct stat sb;
|
return util_path_is_reg_file("%s", file_names->renc_filename);
|
||||||
int rc;
|
|
||||||
|
|
||||||
rc = stat(file_names->renc_filename, &sb);
|
|
||||||
if (rc == 0 && !S_ISREG(sb.st_mode))
|
|
||||||
rc = 1;
|
|
||||||
|
|
||||||
return !rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -153,20 +146,14 @@ static int _keystore_reencipher_key_exists(struct key_filenames *file_names)
|
|||||||
*/
|
*/
|
||||||
static int _keystore_exists_keyfiles(struct key_filenames *file_names)
|
static int _keystore_exists_keyfiles(struct key_filenames *file_names)
|
||||||
{
|
{
|
||||||
struct stat sb_skey, sb_info;
|
bool rc_skey, rc_info;
|
||||||
int rc_skey, rc_info;
|
|
||||||
|
|
||||||
rc_skey = stat(file_names->skey_filename, &sb_skey);
|
rc_skey = util_path_is_reg_file("%s", file_names->skey_filename);
|
||||||
if (rc_skey == 0 && !S_ISREG(sb_skey.st_mode))
|
rc_info = util_path_is_reg_file("%s", file_names->info_filename);
|
||||||
rc_skey = 1;
|
|
||||||
|
|
||||||
rc_info = stat(file_names->info_filename, &sb_info);
|
if (rc_skey && rc_info)
|
||||||
if (rc_info == 0 && !S_ISREG(sb_info.st_mode))
|
|
||||||
rc_info = 1;
|
|
||||||
|
|
||||||
if (rc_skey == 0 && rc_info == 0)
|
|
||||||
return 1;
|
return 1;
|
||||||
if (rc_skey != 0 && rc_info != 0 &&
|
if (!rc_skey && !rc_info &&
|
||||||
_keystore_reencipher_key_exists(file_names) == 0)
|
_keystore_reencipher_key_exists(file_names) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1378,7 +1365,7 @@ struct keystore *keystore_new(const char *directory, bool verbose)
|
|||||||
warnx("Can not access '%s': %s", directory, strerror(errno));
|
warnx("Can not access '%s': %s", directory, strerror(errno));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!(sb.st_mode & S_IFDIR)) {
|
if (!S_ISDIR(sb.st_mode)) {
|
||||||
warnx("'%s' is not a directory", directory);
|
warnx("'%s' is not a directory", directory);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -1630,7 +1617,8 @@ static int _keystore_create_info_file(struct keystore *keystore,
|
|||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
rc = properties_set(key_props, PROP_NAME_VOLUME_TYPE, volume_type);
|
rc = properties_set2(key_props, PROP_NAME_VOLUME_TYPE, volume_type,
|
||||||
|
true);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
warnx("Invalid characters in volume-type");
|
warnx("Invalid characters in volume-type");
|
||||||
goto out;
|
goto out;
|
||||||
@@ -2002,8 +1990,8 @@ int keystore_change_key(struct keystore *keystore, const char *name,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = properties_set(key_props, PROP_NAME_VOLUME_TYPE,
|
rc = properties_set2(key_props, PROP_NAME_VOLUME_TYPE,
|
||||||
volume_type);
|
volume_type, true);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
warnx("Invalid characters in volume-type");
|
warnx("Invalid characters in volume-type");
|
||||||
goto out;
|
goto out;
|
||||||
@@ -3063,7 +3051,7 @@ out:
|
|||||||
* @returnd 0 if the user confirmed the deletion, a negative errno value
|
* @returnd 0 if the user confirmed the deletion, a negative errno value
|
||||||
* otherwise
|
* otherwise
|
||||||
*/
|
*/
|
||||||
static int _keystore_propmp_for_remove(struct keystore *keystore,
|
static int _keystore_prompt_for_remove(struct keystore *keystore,
|
||||||
const char *name,
|
const char *name,
|
||||||
struct key_filenames *file_names)
|
struct key_filenames *file_names)
|
||||||
{
|
{
|
||||||
@@ -3084,7 +3072,8 @@ static int _keystore_propmp_for_remove(struct keystore *keystore,
|
|||||||
_keystore_msg_for_volumes(msg, key_prop, VOLUME_TYPE_PLAIN);
|
_keystore_msg_for_volumes(msg, key_prop, VOLUME_TYPE_PLAIN);
|
||||||
free(msg);
|
free(msg);
|
||||||
|
|
||||||
printf("%s: Remove key '%s'? ", program_invocation_short_name, name);
|
printf("%s: Remove key '%s' [y/N]? ", program_invocation_short_name,
|
||||||
|
name);
|
||||||
if (fgets(str, sizeof(str), stdin) == NULL) {
|
if (fgets(str, sizeof(str), stdin) == NULL) {
|
||||||
rc = -EIO;
|
rc = -EIO;
|
||||||
goto out;
|
goto out;
|
||||||
@@ -3093,6 +3082,7 @@ static int _keystore_propmp_for_remove(struct keystore *keystore,
|
|||||||
str[strlen(str) - 1] = '\0';
|
str[strlen(str) - 1] = '\0';
|
||||||
pr_verbose(keystore, "Prompt reply: '%s'", str);
|
pr_verbose(keystore, "Prompt reply: '%s'", str);
|
||||||
if (strcasecmp(str, "y") != 0 && strcasecmp(str, "yes") != 0) {
|
if (strcasecmp(str, "y") != 0 && strcasecmp(str, "yes") != 0) {
|
||||||
|
warnx("Operation aborted");
|
||||||
rc = -ECANCELED;
|
rc = -ECANCELED;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -3129,7 +3119,7 @@ int keystore_remove_key(struct keystore *keystore, const char *name,
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
if (_keystore_propmp_for_remove(keystore, name,
|
if (_keystore_prompt_for_remove(keystore, name,
|
||||||
&file_names) != 0)
|
&file_names) != 0)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -267,7 +267,7 @@ static u8 *read_clear_key(const char *keyfile, size_t keybits, bool xts,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
keybits = DOUBLE_KEYSIZE_FOR_XTS(size * 8, xts);
|
keybits = HALF_KEYSIZE_FOR_XTS(size * 8, xts);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (keybits) {
|
switch (keybits) {
|
||||||
|
|||||||
+26
-2
@@ -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 <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -183,14 +184,16 @@ static struct property *properties_find(struct properties *properties,
|
|||||||
* @param[in] properties the properties object
|
* @param[in] properties the properties object
|
||||||
* @param[in] name the name of the property
|
* @param[in] name the name of the property
|
||||||
* @param[in] value the value of the property
|
* @param[in] value the value of the property
|
||||||
|
* @param[in] uppercase if true the value is set all uppercase
|
||||||
*
|
*
|
||||||
* @returns 0 on success,
|
* @returns 0 on success,
|
||||||
* -EINVAL if the name or value contains invalid characters
|
* -EINVAL if the name or value contains invalid characters
|
||||||
*/
|
*/
|
||||||
int properties_set(struct properties *properties,
|
int properties_set2(struct properties *properties,
|
||||||
const char *name, const char *value)
|
const char *name, const char *value, bool uppercase)
|
||||||
{
|
{
|
||||||
struct property *property;
|
struct property *property;
|
||||||
|
int i;
|
||||||
|
|
||||||
util_assert(properties != NULL, "Internal error: properties is NULL");
|
util_assert(properties != NULL, "Internal error: properties is NULL");
|
||||||
util_assert(name != NULL, "Internal error: name is NULL");
|
util_assert(name != NULL, "Internal error: name is NULL");
|
||||||
@@ -211,9 +214,30 @@ int properties_set(struct properties *properties,
|
|||||||
property->value = util_strdup(value);
|
property->value = util_strdup(value);
|
||||||
util_list_add_tail(&properties->list, property);
|
util_list_add_tail(&properties->list, property);
|
||||||
}
|
}
|
||||||
|
if (uppercase) {
|
||||||
|
for (i = 0; property->value[i] != '\0'; i++)
|
||||||
|
property->value[i] = toupper(property->value[i]);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds or updates a property
|
||||||
|
*
|
||||||
|
* @param[in] properties the properties object
|
||||||
|
* @param[in] name the name of the property
|
||||||
|
* @param[in] value the value of the property
|
||||||
|
*
|
||||||
|
* @returns 0 on success,
|
||||||
|
* -EINVAL if the name or value contains invalid characters
|
||||||
|
*/
|
||||||
|
int properties_set(struct properties *properties,
|
||||||
|
const char *name, const char *value)
|
||||||
|
{
|
||||||
|
return properties_set2(properties, name, value, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a property
|
* Gets a property
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ void properties_free(struct properties *properties);
|
|||||||
int properties_set(struct properties *properties,
|
int properties_set(struct properties *properties,
|
||||||
const char *name, const char *value);
|
const char *name, const char *value);
|
||||||
|
|
||||||
|
int properties_set2(struct properties *properties,
|
||||||
|
const char *name, const char *value, bool uppercase);
|
||||||
|
|
||||||
char *properties_get(struct properties *properties, const char *name);
|
char *properties_get(struct properties *properties, const char *name);
|
||||||
|
|
||||||
int properties_remove(struct properties *properties, const char *name);
|
int properties_remove(struct properties *properties, const char *name);
|
||||||
|
|||||||
@@ -1275,7 +1275,7 @@ static int activate_unbound_keyslot(int token, int keyslot, const char *key,
|
|||||||
util_print_indented(complete_msg, 0);
|
util_print_indented(complete_msg, 0);
|
||||||
util_print_indented("All key slots containing the old volume key are "
|
util_print_indented("All key slots containing the old volume key are "
|
||||||
"now in unbound state. Do you want to remove "
|
"now in unbound state. Do you want to remove "
|
||||||
"these key slots?", 0);
|
"these key slots [y/N]?", 0);
|
||||||
|
|
||||||
if (!prompt_for_yes())
|
if (!prompt_for_yes())
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1524,7 +1524,7 @@ static int reencipher_prepare(int token)
|
|||||||
util_asprintf(&msg, "Staged volume key re-enciphering is "
|
util_asprintf(&msg, "Staged volume key re-enciphering is "
|
||||||
"already initiated for device '%s'. Do you want to "
|
"already initiated for device '%s'. Do you want to "
|
||||||
"cancel the pending re-enciphering and start a "
|
"cancel the pending re-enciphering and start a "
|
||||||
"new re-enciphering process?", g.pos_arg);
|
"new re-enciphering process [y/N]?", g.pos_arg);
|
||||||
util_print_indented(msg, 0);
|
util_print_indented(msg, 0);
|
||||||
free(msg);
|
free(msg);
|
||||||
|
|
||||||
@@ -1690,7 +1690,7 @@ static int reencipher_complete(int token)
|
|||||||
"was completed.\n"
|
"was completed.\n"
|
||||||
"Do you want to re-encipher the secure key with "
|
"Do you want to re-encipher the secure key with "
|
||||||
"the CCA master key in the CURRENT master key "
|
"the CCA master key in the CURRENT master key "
|
||||||
"register?", g.pos_arg);
|
"register [y/N]?", g.pos_arg);
|
||||||
util_print_indented(msg, 0);
|
util_print_indented(msg, 0);
|
||||||
free(msg);
|
free(msg);
|
||||||
|
|
||||||
@@ -2014,12 +2014,13 @@ static int command_setkey(void)
|
|||||||
util_asprintf(&msg, "The secure key in file '%s' is "
|
util_asprintf(&msg, "The secure key in file '%s' is "
|
||||||
"enciphered with the CCA master key in the OLD "
|
"enciphered with the CCA master key in the OLD "
|
||||||
"master key register. Do you want to set this "
|
"master key register. Do you want to set this "
|
||||||
"key as the new volume key anyway?",
|
"key as the new volume key anyway [y/N]?",
|
||||||
g.master_key_file);
|
g.master_key_file);
|
||||||
util_print_indented(msg, 0);
|
util_print_indented(msg, 0);
|
||||||
free(msg);
|
free(msg);
|
||||||
|
|
||||||
if (!prompt_for_yes()) {
|
if (!prompt_for_yes()) {
|
||||||
|
warnx("Device '%s' is left unchanged", g.pos_arg);
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -2078,12 +2079,13 @@ static int command_setkey(void)
|
|||||||
"be correct. You will lose all data on the "
|
"be correct. You will lose all data on the "
|
||||||
"volume if you set the wrong volume key!\n"
|
"volume if you set the wrong volume key!\n"
|
||||||
"Are you sure that the key in file '%s' is the "
|
"Are you sure that the key in file '%s' is the "
|
||||||
"correct volume key for volume '%s'?",
|
"correct volume key for volume '%s' [y/N]?",
|
||||||
g.master_key_file, g.pos_arg);
|
g.master_key_file, g.pos_arg);
|
||||||
util_print_indented(msg, 0);
|
util_print_indented(msg, 0);
|
||||||
free(msg);
|
free(msg);
|
||||||
|
|
||||||
if (!prompt_for_yes()) {
|
if (!prompt_for_yes()) {
|
||||||
|
warnx("Device '%s' is left unchanged", g.pos_arg);
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-13
@@ -832,7 +832,7 @@ static struct zkey_command zkey_commands[] = {
|
|||||||
.need_pkey_device = 1,
|
.need_pkey_device = 1,
|
||||||
.short_desc = "Validate an existing secure AES key",
|
.short_desc = "Validate an existing secure AES key",
|
||||||
.long_desc = "Validate an existing secure AES key that is "
|
.long_desc = "Validate an existing secure AES key that is "
|
||||||
"either contained in SECURE-KEY-FILE or is stored"
|
"either contained in SECURE-KEY-FILE or is stored "
|
||||||
"in the repository and print information about "
|
"in the repository and print information about "
|
||||||
"the key",
|
"the key",
|
||||||
.has_options = 1,
|
.has_options = 1,
|
||||||
@@ -1067,7 +1067,7 @@ static int command_generate(void)
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
if (g.apqns == NULL && g.noapqncheck) {
|
if (g.apqns == NULL && g.noapqncheck) {
|
||||||
warnx("Option '--noapqncheck' is only valid together with "
|
warnx("Option '--no-apqn-check' is only valid together with "
|
||||||
"the '--apqns|-a' option");
|
"the '--apqns|-a' option");
|
||||||
util_prg_print_parse_error();
|
util_prg_print_parse_error();
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
@@ -1088,7 +1088,7 @@ static int command_generate(void)
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
if (g.noapqncheck) {
|
if (g.noapqncheck) {
|
||||||
warnx("Option '--noapqncheck' is not valid for "
|
warnx("Option '--no-apqn-check' is not valid for "
|
||||||
"generating a key outside of the repository");
|
"generating a key outside of the repository");
|
||||||
util_prg_print_parse_error();
|
util_prg_print_parse_error();
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
@@ -1317,7 +1317,7 @@ static int command_validate_file(void)
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
if (g.noapqncheck) {
|
if (g.noapqncheck) {
|
||||||
warnx("Option '--noapqncheck' is not valid for "
|
warnx("Option '--no-apqn-check' is not valid for "
|
||||||
"validating a key outside of the repository");
|
"validating a key outside of the repository");
|
||||||
util_prg_print_parse_error();
|
util_prg_print_parse_error();
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
@@ -1375,13 +1375,6 @@ static int command_validate_repository(void)
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (g.apqns == NULL && g.noapqncheck) {
|
|
||||||
warnx("Option '--noapqncheck' is only valid together with "
|
|
||||||
"the '--apqns|-a' option");
|
|
||||||
util_prg_print_parse_error();
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = keystore_validate_key(g.keystore, g.name, g.apqns, g.noapqncheck,
|
rc = keystore_validate_key(g.keystore, g.name, g.apqns, g.noapqncheck,
|
||||||
g.pkey_fd);
|
g.pkey_fd);
|
||||||
|
|
||||||
@@ -1421,7 +1414,7 @@ static int command_import(void)
|
|||||||
g.sector_size = 0;
|
g.sector_size = 0;
|
||||||
|
|
||||||
if (g.apqns == NULL && g.noapqncheck) {
|
if (g.apqns == NULL && g.noapqncheck) {
|
||||||
warnx("Option '--noapqncheck' is only valid together with "
|
warnx("Option '--no-apqn-check' is only valid together with "
|
||||||
"the '--apqns|-a' option");
|
"the '--apqns|-a' option");
|
||||||
util_prg_print_parse_error();
|
util_prg_print_parse_error();
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
@@ -1501,7 +1494,7 @@ static int command_change(void)
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
if (g.apqns == NULL && g.noapqncheck) {
|
if (g.apqns == NULL && g.noapqncheck) {
|
||||||
warnx("Option '--noapqncheck' is only valid together with "
|
warnx("Option '--no-apqn-check' is only valid together with "
|
||||||
"the '--apqns|-a' option");
|
"the '--apqns|-a' option");
|
||||||
util_prg_print_parse_error();
|
util_prg_print_parse_error();
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|||||||
Reference in New Issue
Block a user