From 761a185938bf98a62d4ea79f5e6bcd6fed2b33a6 Mon Sep 17 00:00:00 2001 From: Vineeth Vijayan Date: Sun, 18 Jul 2021 15:43:44 +0200 Subject: [PATCH] zconf/lscss: show device number from pmcw MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lscss shows device number as 'None' if the corresponding device in the subchannel is non-operational or not connected. Instead, show the device-no derived from the new dev_busid attribute which provides the value of device_id irrespective of the device availability. i.e the current lscss shows Device Subchan. DevType CU Type Use PIM PAM POM CHPIDs ---------------------------------------------------------------------- 0.0.0000 0.0.0000 3390/0c 3990/e9 f0 a0 ff 32333435 00000000 none 0.0.00c7 f0 a0 5f 32333435 00000000 none 0.0.00c8 f0 a0 5f 32333435 00000000 here the subchannels 0.0.00c7 and 0.0.00c8 do not have an operational device on them. Hence the device is shown as none. With this patch, Device Subchan. DevType CU Type Use PIM PAM POM CHPIDs ---------------------------------------------------------------------- 0.0.0000 0.0.0000 3390/0c 3990/e9 f0 a0 ff 32333435 00000000 0.0.74c8 0.0.00c7 f0 a0 5f 32333435 00000000 0.0.74c9 0.0.00c8 f0 a0 5f 32333435 00000000 The device-no is shown as 0.0.74c8; Where the DevType field still indicates that the device is not present. Signed-off-by: Vineeth Vijayan Reviewed-by: Peter Oberparleiter Signed-off-by: Jan Höppner --- zconf/css/lscss.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/zconf/css/lscss.c b/zconf/css/lscss.c index c51c6123..fd58bb3a 100644 --- a/zconf/css/lscss.c +++ b/zconf/css/lscss.c @@ -463,7 +463,15 @@ static int fill_io_devid(struct util_rec *rec, char *path) util_scandir_free(de_vec, count); return 1; } - strncpy(buf, "none", sizeof(buf)); + if (util_file_read_line(buf, sizeof(buf), "%s/dev_busid", + path) == 0) { + if (cmd.opt_short) { + if (strncmp(buf, "0.0.", PREFIX_ID_LENGTH) != 0) + return 1; + memmove(buf, buf + PREFIX_ID_LENGTH, + (sizeof(buf) - PREFIX_ID_LENGTH)); + } + } fill_device_info(rec, NULL, NULL); } if (cmd.opt_uppercase)