mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zipl: Implement helper function disk_is_nvme()
The new function disk_is_nvme() is a convenience function that indicates whether the given path to a device file represents a NVMe disk. Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com> Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com> Acked-by: Stefan Haberland <sth@linux.ibm.com> Acked-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
844058bf4d
commit
5094354c39
@@ -102,6 +102,7 @@ int disk_get_info(const char* device, struct job_target_data* target,
|
||||
struct disk_info** info);
|
||||
int disk_is_tape(const char* device);
|
||||
int disk_is_scsi(const char* device, struct job_target_data* target);
|
||||
int disk_is_nvme(const char* device, struct job_target_data* target);
|
||||
int disk_get_info_from_file(const char* filename,
|
||||
struct job_target_data* target,
|
||||
struct disk_info** info);
|
||||
|
||||
@@ -508,6 +508,20 @@ disk_is_scsi(const char* device, struct job_target_data* target)
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
disk_is_nvme(const char* device, struct job_target_data* target)
|
||||
{
|
||||
struct disk_info* info;
|
||||
int rc = 0;
|
||||
|
||||
if (disk_get_info(device, target, &info) == -1)
|
||||
return 0;
|
||||
if (info->type == disk_type_scsi && info->is_nvme)
|
||||
rc = 1;
|
||||
disk_free_info(info);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
disk_get_info_from_file(const char* filename, struct job_target_data* target,
|
||||
struct disk_info** info)
|
||||
|
||||
Reference in New Issue
Block a user