diff --git a/zipl/include/disk.h b/zipl/include/disk.h index c131b071..cce69f73 100644 --- a/zipl/include/disk.h +++ b/zipl/include/disk.h @@ -59,6 +59,7 @@ typedef enum { struct disk_ext_type { disk_type_t type; bool is_nvme; + bool is_tape; }; /* targetbase definition */ @@ -106,9 +107,8 @@ struct job_target_data; int device_get_info(const char *device, struct job_target_data *target, struct device_info **info); -int disk_get_ext_type(const char *device, struct disk_ext_type *ext_type, - int disk_id); -int disk_is_tape(const char *device); +int dump_disk_get_ext_type(const char *device, struct disk_ext_type *ext_type); +int disk_type_is_tape(struct disk_ext_type *ext_type); int disk_type_is_scsi(struct disk_ext_type *ext_type); int disk_type_is_eckd_ldl(struct disk_ext_type *ext_type); int disk_type_is_nvme(struct disk_ext_type *ext_type); diff --git a/zipl/src/disk.c b/zipl/src/disk.c index 44970a1d..3e45d0c7 100644 --- a/zipl/src/disk.c +++ b/zipl/src/disk.c @@ -721,8 +721,7 @@ error: return -1; } -int -disk_is_tape(const char* device) +static int disk_is_tape(const char *device) { int fd, rc = 0; @@ -744,16 +743,19 @@ disk_is_tape(const char* device) * partition, etc). In case of success the resulted disk type is * stored in EXT_TYPE. */ -int disk_get_ext_type(const char *device, struct disk_ext_type *ext_type, - int disk_idx) +int dump_disk_get_ext_type(const char *device, struct disk_ext_type *ext_type) { struct job_target_data tmp = {.source = source_unknown}; struct device_info *dev_info; struct disk_info *info; + if (disk_is_tape(device)) { + ext_type->is_tape = 1; + return 0; + } if (device_get_info(device, &tmp, &dev_info)) return -1; - info = &dev_info->base[disk_idx]; + info = &dev_info->base[0]; ext_type->type = info->type; ext_type->is_nvme = info->is_nvme; @@ -762,6 +764,11 @@ int disk_get_ext_type(const char *device, struct disk_ext_type *ext_type, return 0; } +int disk_type_is_tape(struct disk_ext_type *ext_type) +{ + return ext_type->is_tape; +} + int disk_type_is_scsi(struct disk_ext_type *ext_type) { return ext_type->type == disk_type_scsi; diff --git a/zipl/src/zipl.c b/zipl/src/zipl.c index d8e71470..4992d937 100644 --- a/zipl/src/zipl.c +++ b/zipl/src/zipl.c @@ -174,13 +174,12 @@ main(int argc, char* argv[]) /* Do it */ switch (job->id) { case job_dump_partition: - rc = disk_get_ext_type(job->data.dump.device, &ext_type, - 0 /* disk index */); + rc = dump_disk_get_ext_type(job->data.dump.device, &ext_type); if (rc) break; job_dump_check_set_ngdump(job, &ext_type); if (!job_dump_is_ngdump(job) && - (disk_is_tape(job->data.dump.device) || + (disk_type_is_tape(&ext_type) || !disk_type_is_scsi(&ext_type))) { rc = install_dump(job->data.dump.device, &job->target, job->data.dump.mem, job->data.dump.no_compress);