zdev: Add option to select IPL device

Add new command-line option --ipldev. When specified and IPL was done
from a supported device type, the IPL device is selected for the
requested tool operation.

Example to list IPL device information:

$ lszdev --ipldev

Example to create a persistent configuration for the IPL device:

$ chzdev --enable --persistent --ipldev

Reviewed-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Peter Oberparleiter
2024-07-04 16:10:17 +02:00
committed by Jan Höppner
parent cad4e9e15b
commit d9a9bd8dcf
14 changed files with 158 additions and 5 deletions
+23
View File
@@ -1827,6 +1827,27 @@ static char *ccw_st_get_active_attrib_path(struct subtype *st,
return path;
}
/* Return a newly allocated character string containing the IPL device ID in
* case of CCW IPL. */
static char *ccw_st_get_ipldev_id(struct subtype *st)
{
char *type, *id = NULL;
type = path_read_text_file(1, err_ignore, PATH_IPL "/ipl_type");
if (strcmp(type, "ccw") != 0)
goto out;
id = path_read_text_file(1, err_ignore, PATH_IPL "/device");
if (!ccw_st_exists_active(st, id)) {
free(id);
id = NULL;
}
out:
free(type);
return id;
}
/* The methods of this subtype assume that @data points to a
* struct ccw_subtype_data. */
struct subtype ccw_subtype = {
@@ -1864,4 +1885,6 @@ struct subtype ccw_subtype = {
.add_devnodes = &ccw_st_add_devnodes,
.resolve_devnode = &ccw_st_resolve_devnode,
.get_active_attrib_path = &ccw_st_get_active_attrib_path,
.get_ipldev_id = &ccw_st_get_ipldev_id,
};