zipl: Add --no-compress option to zipl command

Add --no-compress option to explicitly omit compression for single-volume
DASD dumper. Used primarily for test purposes.

Since only the lowest byte of mvdump_force field (struct
stage2dump_parm_tail) has been used, split it in two byte fields and use
one for the new no_compress attribute.

Update zipl help and zipl man page with the new parameter info.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Mikhail Zaslonko
2023-05-31 09:33:38 +02:00
committed by Jan Höppner
parent c08794bdfb
commit c61783546b
9 changed files with 31 additions and 8 deletions

View File

@@ -40,7 +40,8 @@ enum df_s390_arch {
*/
struct stage2dump_parm_tail {
char reserved[6];
uint16_t mvdump_force;
uint8_t no_compress;
uint8_t mvdump_force;
uint64_t mem_upper_limit;
} __packed;

View File

@@ -225,7 +225,12 @@ static void df_s390_dump_init(void)
dh->tod = get_tod_clock();
dh->volnr = 0;
dh->zlib_version_s390 = 0;
if (test_facility(DFLTCC_FACILITY)) {
/*
* Ignore compression if --no-compress attribute has been specified
* or DFLTCC facility not available.
*/
if (test_facility(DFLTCC_FACILITY) &&
parm_tail.no_compress == 0) {
dh->zlib_version_s390 = 1; /* Indicate interlnal Zlib version */
dh->zlib_entry_size = DUMP_SEGM_ZLIB_ENTSIZE;
}
@@ -458,6 +463,8 @@ void __noreturn start(void)
df_s390_dump_init();
printf("zIPL v%s dump tool (64 bit)", RELEASE_STRING);
printf("Dumping 64 bit OS");
if (parm_tail.no_compress)
printf("Dump compression prevented by the --no-compress attribute");
mem_and_cpu_init();
store_status();
dt_dump_mem();

View File

@@ -120,8 +120,8 @@ int install_tapeloader(const char* device, const char* image,
const char* parmline, const char* ramdisk,
address_t image_addr, address_t parm_addr,
address_t initrd_addr);
int install_dump(const char* device, struct job_target_data* target,
uint64_t mem);
int install_dump(const char *device, struct job_target_data *target,
uint64_t mem, bool no_compress);
int install_mvdump(char* const device[], struct job_target_data* target,
int device_count, uint64_t mem, uint8_t force);

View File

@@ -72,6 +72,7 @@ struct job_dump_data {
struct job_common_ipl_data common;
char* device;
uint64_t mem;
bool no_compress;
};
struct job_mvdump_data {
@@ -87,7 +88,6 @@ struct job_ipl_tape_data {
char* device;
};
union job_menu_entry_data {
struct job_ipl_data ipl;
struct job_dump_data dump;

View File

@@ -290,6 +290,12 @@ This option has been removed, use --dumpto instead.
.BR "\-\-ldipl-dump"
Install a List-directed dump record instead of a CCW-type dump.
.TP
.BR "\-\-no-compress"
Do not use zlib compression for a CCW-type dump.
Zlib compression is used by default for CCW-type single-volume DASD standalone
dump when the DFLTCC facility is available on the system.
.TP
.BR "\-M <DUMPLIST[,SIZE]>" " or " "--mvdump=<DUMPLIST[,SIZE]>"
Install a multi-volume dump record on each device associated with one of the

View File

@@ -535,7 +535,7 @@ boot_get_eckd_dump_stage2(void **data, size_t *size,
if (buffer == NULL)
return -1;
memcpy(buffer, DATA_ADDR(eckd2dump_sv), DATA_SIZE(eckd2dump_sv));
/* Write mem size to end of dump record */
/* Write mem size and no-compression indicator to end of dump record */
offset = DATA_SIZE(eckd2dump_sv) - sizeof(struct stage2dump_parm_tail);
memcpy(VOID_ADD(buffer, offset), stage2dump_parms,
sizeof(struct stage2dump_parm_tail));

View File

@@ -1040,7 +1040,8 @@ install_dump_tape(int fd, const struct stage2dump_parm_tail *stage2dump_parms)
int
install_dump(const char* device, struct job_target_data* target, uint64_t mem)
install_dump(const char *device, struct job_target_data *target, uint64_t mem,
bool no_compress)
{
struct stage2dump_parm_tail stage2dump_parms = {0};
struct disk_info* info;
@@ -1050,6 +1051,7 @@ install_dump(const char* device, struct job_target_data* target, uint64_t mem)
int rc;
stage2dump_parms.mem_upper_limit = mem;
stage2dump_parms.no_compress = no_compress;
fd = misc_open_exclusive(device);
if (fd == -1) {
error_text("Could not open dump device '%s'", device);

View File

@@ -50,6 +50,7 @@ static struct option options[] = {
{ "parmfile", required_argument, NULL, 'p'},
{ "parameters", required_argument, NULL, 'P'},
{ "dumpto", required_argument, NULL, 'd'},
{ "no-compress", no_argument, NULL, 0xb1},
{ "dumptofs", required_argument, NULL, 'D'},
{ "mvdump", required_argument, NULL, 'M'},
{ "segment", required_argument, NULL, 's'},
@@ -93,6 +94,7 @@ struct command_line {
int add_files;
int dry_run;
int force;
int no_compress;
int is_secure;
int is_ldipl_dump;
enum scan_section_type type;
@@ -289,6 +291,9 @@ get_command_line(int argc, char* argv[], struct command_line* line)
case 0xb0:
cmdline.is_ldipl_dump = 1;
break;
case 0xb1:
cmdline.no_compress = 1;
break;
case 1:
/* Non-option is interpreted as section name */
if (cmdline.section != NULL) {
@@ -1984,6 +1989,7 @@ job_get(int argc, char* argv[], struct job_data** data)
job->noninteractive = cmdline.noninteractive;
job->verbose = cmdline.verbose;
job->add_files = cmdline.add_files;
job->data.dump.no_compress = cmdline.no_compress;
job->data.mvdump.force = cmdline.force;
job->dry_run = cmdline.dry_run;
job->is_secure = SECURE_BOOT_UNDEFINED;

View File

@@ -73,6 +73,7 @@ static const char* usage_text[] = {
"-d, --dumpto DUMPDEV[,SIZE] Install a system dump record on tape device",
" or disk partition DUMPDEV",
" --ldipl-dump Install a List-directed dump",
" --no-compress Do not use zlib compression for DASD dump",
"-M, --mvdump DEVLIST[,SIZE] Install a multi-volume dump record on each",
" disk partition listed in file DEVLIST",
"-f, --force Disable sanity check while producing a",
@@ -176,7 +177,7 @@ main(int argc, char* argv[])
(disk_is_tape(job->data.dump.device) ||
!disk_is_scsi(job->data.dump.device, &job->target))) {
rc = install_dump(job->data.dump.device, &job->target,
job->data.dump.mem);
job->data.dump.mem, job->data.dump.no_compress);
break;
}
/* Dump to a raw SCSI partition */