mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-27 22:53:55 +08:00
s390/dump_stack: remove whitespace from arch description
The arch description provided for the "Hardware name:" contains lots of extra whitespace due to the way the SYSIB contents are defined (strings aren't zero terminated). This looks a bit odd and therefore remove the extra whitespace characters. This also gives the opportunity to add more information, if required, without hitting the magic 80 characters per line limit. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
59808fc819
commit
d2f0397425
@ -231,9 +231,28 @@ static noinline __init void detect_machine_type(void)
|
|||||||
S390_lowcore.machine_flags |= MACHINE_FLAG_VM;
|
S390_lowcore.machine_flags |= MACHINE_FLAG_VM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Remove leading, trailing and double whitespace. */
|
||||||
|
static inline void strim_all(char *str)
|
||||||
|
{
|
||||||
|
char *s;
|
||||||
|
|
||||||
|
s = strim(str);
|
||||||
|
if (s != str)
|
||||||
|
memmove(str, s, strlen(s));
|
||||||
|
while (*str) {
|
||||||
|
if (!isspace(*str++))
|
||||||
|
continue;
|
||||||
|
if (isspace(*str)) {
|
||||||
|
s = skip_spaces(str);
|
||||||
|
memmove(str, s, strlen(s) + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static noinline __init void setup_arch_string(void)
|
static noinline __init void setup_arch_string(void)
|
||||||
{
|
{
|
||||||
struct sysinfo_1_1_1 *mach = (struct sysinfo_1_1_1 *)&sysinfo_page;
|
struct sysinfo_1_1_1 *mach = (struct sysinfo_1_1_1 *)&sysinfo_page;
|
||||||
|
char mstr[80];
|
||||||
|
|
||||||
if (stsi(mach, 1, 1, 1))
|
if (stsi(mach, 1, 1, 1))
|
||||||
return;
|
return;
|
||||||
@ -241,11 +260,11 @@ static noinline __init void setup_arch_string(void)
|
|||||||
EBCASC(mach->type, sizeof(mach->type));
|
EBCASC(mach->type, sizeof(mach->type));
|
||||||
EBCASC(mach->model, sizeof(mach->model));
|
EBCASC(mach->model, sizeof(mach->model));
|
||||||
EBCASC(mach->model_capacity, sizeof(mach->model_capacity));
|
EBCASC(mach->model_capacity, sizeof(mach->model_capacity));
|
||||||
dump_stack_set_arch_desc("%-16.16s %-4.4s %-16.16s %-16.16s (%s)",
|
sprintf(mstr, "%-16.16s %-4.4s %-16.16s %-16.16s",
|
||||||
mach->manufacturer,
|
mach->manufacturer, mach->type,
|
||||||
mach->type,
|
mach->model, mach->model_capacity);
|
||||||
mach->model,
|
strim_all(mstr);
|
||||||
mach->model_capacity,
|
dump_stack_set_arch_desc("%s (%s)", mstr,
|
||||||
MACHINE_IS_LPAR ? "LPAR" :
|
MACHINE_IS_LPAR ? "LPAR" :
|
||||||
MACHINE_IS_VM ? "z/VM" :
|
MACHINE_IS_VM ? "z/VM" :
|
||||||
MACHINE_IS_KVM ? "KVM" : "unknown");
|
MACHINE_IS_KVM ? "KVM" : "unknown");
|
||||||
|
Loading…
Reference in New Issue
Block a user