mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-06 13:23:18 +00:00
s390/dasd: Simplify uid string generation
There are two variants of the device uid string. One containing the virtual device unit information table (vduit) identifying the device as a virtual device located on a real device in a z/VM environment. The other variant does not contain those additional information. Simplify the string generation with a shorter check of an existing vduit embedded in the snprintf() calls. Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com> Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Link: https://lore.kernel.org/r/20240208164248.540985-2-sth@linux.ibm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
052618c71c
commit
e5de34db1e
@ -1412,15 +1412,9 @@ dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
break;
|
||||
}
|
||||
|
||||
if (strlen(uid.vduit) > 0)
|
||||
snprintf(uid_string, sizeof(uid_string),
|
||||
"%s.%s.%04x.%s.%s",
|
||||
uid.vendor, uid.serial, uid.ssid, ua_string,
|
||||
uid.vduit);
|
||||
else
|
||||
snprintf(uid_string, sizeof(uid_string),
|
||||
"%s.%s.%04x.%s",
|
||||
uid.vendor, uid.serial, uid.ssid, ua_string);
|
||||
snprintf(uid_string, sizeof(uid_string), "%s.%s.%04x.%s%s%s",
|
||||
uid.vendor, uid.serial, uid.ssid, ua_string,
|
||||
uid.vduit[0] ? "." : "", uid.vduit);
|
||||
}
|
||||
dasd_put_device(device);
|
||||
|
||||
|
@ -1072,22 +1072,14 @@ static void dasd_eckd_read_fc_security(struct dasd_device *device)
|
||||
}
|
||||
}
|
||||
|
||||
static void dasd_eckd_get_uid_string(struct dasd_conf *conf,
|
||||
char *print_uid)
|
||||
static void dasd_eckd_get_uid_string(struct dasd_conf *conf, char *print_uid)
|
||||
{
|
||||
struct dasd_uid uid;
|
||||
|
||||
create_uid(conf, &uid);
|
||||
if (strlen(uid.vduit) > 0)
|
||||
snprintf(print_uid, DASD_UID_STRLEN,
|
||||
"%s.%s.%04x.%02x.%s",
|
||||
uid.vendor, uid.serial, uid.ssid,
|
||||
uid.real_unit_addr, uid.vduit);
|
||||
else
|
||||
snprintf(print_uid, DASD_UID_STRLEN,
|
||||
"%s.%s.%04x.%02x",
|
||||
uid.vendor, uid.serial, uid.ssid,
|
||||
uid.real_unit_addr);
|
||||
snprintf(print_uid, DASD_UID_STRLEN, "%s.%s.%04x.%02x%s%s",
|
||||
uid.vendor, uid.serial, uid.ssid, uid.real_unit_addr,
|
||||
uid.vduit[0] ? "." : "", uid.vduit);
|
||||
}
|
||||
|
||||
static int dasd_eckd_check_cabling(struct dasd_device *device,
|
||||
|
Loading…
Reference in New Issue
Block a user