From bd5f03d1c4d23b1e21762118636ed6ae51cccc4e Mon Sep 17 00:00:00 2001 From: Eduard Shishkin Date: Mon, 7 Oct 2024 17:53:15 +0200 Subject: [PATCH] zipl/src: implement --dry-run option for device-based DASD dumps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tested-by: Mikhail Zaslonko Reviewed-by: Mikhail Zaslonko Signed-off-by: Eduard Shishkin Signed-off-by: Jan Höppner --- zipl/src/install.c | 6 ++++-- zipl/src/zipl.c | 5 ----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/zipl/src/install.c b/zipl/src/install.c index 5e1c615d..ff05369d 100644 --- a/zipl/src/install.c +++ b/zipl/src/install.c @@ -552,6 +552,9 @@ ask_for_confirmation(const char* fmt, ...) /* Always assume positive answer in non-interactive mode */ if (!interactive) return 0; + if (dry_run) + /* nothing to confirm */ + return 0; /* Print question */ va_start(args, fmt); vprintf(fmt, args); @@ -1169,8 +1172,7 @@ install_dump(const char *device, struct job_target_data *target, uint64_t mem, disk_free_info(info); return -1; } - mfd.fd = open(tempdev, O_RDWR); - if (mfd.fd == -1) { + if (misc_open_device(tempdev, &mfd, dry_run) == -1) { error_text("Could not open temporary device node '%s'", tempdev); misc_free_temp_dev(tempdev); diff --git a/zipl/src/zipl.c b/zipl/src/zipl.c index 0f2345cd..2e0f1678 100644 --- a/zipl/src/zipl.c +++ b/zipl/src/zipl.c @@ -181,11 +181,6 @@ main(int argc, char* argv[]) if (!job_dump_is_ngdump(job) && (disk_is_tape(job->data.dump.device) || !disk_type_is_scsi(&ext_type))) { - if (dry_run) { - error_text("Option '--dry-run' is not implemented for this type of dump"); - rc = -1; - break; - } rc = install_dump(job->data.dump.device, &job->target, job->data.dump.mem, job->data.dump.no_compress); break;