File lcrash-fix-compat-dumps of Package lcrash
---
lib/libklib/kl_dump_4_1.c | 34 ++++++++++++++++++++++++++++++----
1 file changed, 30 insertions(+), 4 deletions(-)
Index: lkcdutils-svn-r1339/lib/libklib/kl_dump_4_1.c
===================================================================
--- lkcdutils-svn-r1339.orig/lib/libklib/kl_dump_4_1.c
+++ lkcdutils-svn-r1339/lib/libklib/kl_dump_4_1.c
@@ -200,10 +200,10 @@ void __convert_tod_to_time(uint64_t todv
todval = (sec * 1000000) << 12;
*tv_usec = ((todval * 1000) >> 12);
}
-
+
int __convert_4_1_s390sa_dump_header_to_new(kl_dump_header_s390sa_t* old, kl_dump_header_t* new)
{
- uint32_t arch_id, arch_id_swap;
+ uint32_t arch_id, arch_id_swap;
arch_id = old->arch_id;
arch_id_swap = kl_get_swap_uint32(&arch_id);
@@ -219,7 +219,7 @@ int __convert_4_1_s390sa_dump_header_to_
new->num_dump_pages = old->num_pages;
strcpy(new->panic_string,"S/390 standalone dump facility");
__convert_tod_to_time(old->tod, &new->time.tv_sec, &new->time.tv_usec);
- sprintf(new->utsname_sysname,"CPU %lx", (unsigned long)old->cpu_id);
+ sprintf(new->utsname_sysname,"CPU %lx", old->cpu_id);
if (arch_id == KL_DH_ARCH_ID_S390) {
strcpy(new->utsname_machine, KL_ARCH_STR_S390);
} else if (arch_id == KL_DH_ARCH_ID_S390X) {
@@ -229,7 +229,7 @@ int __convert_4_1_s390sa_dump_header_to_
} else if (arch_id_swap == KL_DH_ARCH_ID_S390X) {
strcpy(new->utsname_machine, KL_ARCH_STR_S390X);
}
- new->current_task = 0;
+ new->current_task = NULL;
return(0);
}
@@ -308,6 +308,32 @@ kl_dump_arch_4_1(void *dh)
fprintf(KL_ERRORFP, "Warning: Unknown dump architecture\n");
#endif
}
+ if (dumparch == KL_ARCH_UNKNOWN) {
+#if defined(DUMP_ARCH_S390) || defined(DUMP_ARCH_S390X)
+ /*
+ * get the arch_id from the kl_dump_header_s390_t struct
+ */
+ kl_dump_header_s390sa_t *dha;
+ uint32_t arch_id, arch_id_swap;
+
+ dha = (kl_dump_header_s390sa_t *)dh;
+ arch_id = dha->arch_id;
+ arch_id_swap = kl_get_swap_uint32(&arch_id);
+ if((arch_id == KL_DH_ARCH_ID_S390) ||
+ (arch_id_swap == KL_DH_ARCH_ID_S390) ||
+ (arch_id == KL_DH_ARCH_ID_S390X) ||
+ (arch_id_swap == KL_DH_ARCH_ID_S390X)) {
+ dumparch = KL_ARCH_S390SA;
+ } else {
+ /* wrong arch_id, set error code */
+ fprintf(KL_ERRORFP, "Warning: "
+ "Unknown arch_id for s390 dump: %x\n",
+ arch_id);
+ }
+#else
+ fprintf(KL_ERRORFP, "Warning: Unknown dump architecture\n");
+#endif
+ }
return (dumparch);
}