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

View File

@@ -96,6 +96,30 @@ static exit_code_t devnode_cb(struct subtype *st, const char *id,
return rc;
}
/* Find device which was used for IPL. Note that id_ptr will point to a newly
* allocated string on success. */
bool subtypes_find_ipldev(struct subtype **st_ptr, char **id_ptr)
{
int i, j;
struct devtype *dt;
struct subtype *st;
char *id;
for (i = 0; (dt = devtypes[i]); i++) {
for (j = 0; (st = dt->subtypes[j]); j++) {
id = subtype_get_ipldev_id(st);
if (id) {
*st_ptr = st;
*id_ptr = id;
return true;
}
}
}
return false;
}
/* Find a device which provides the specified devnode. Note that id_ptr will
* point to a newly allocated string on success. */
bool subtypes_find_by_devnode(struct devnode *devnode, struct subtype **st_ptr,
@@ -520,6 +544,16 @@ void subtype_add_definable_ids(struct subtype *st, struct util_list *ids)
super->add_definable_ids(st, ids);
}
char *subtype_get_ipldev_id(struct subtype *st)
{
struct subtype *super = super_get(st, get_ipldev_id, 0);
if (super)
return super->get_ipldev_id(st);
return NULL;
}
/*
* Subtype helpers. These functions combine some of the subtype methods
* to implement more complex functions.