[RFC patch 5/7] crash: Add VMCOREINFO_FIELD_AND_OFFSET()
From: Thomas Gleixner
Date: Wed Nov 15 2017 - 13:29:24 EST
Changing the time stamp storage in the printk ringbuffer entries would
break existing tools which rely on the availability of the 'ts_nsec' field
in vmcore info.
Provide a new macro which allows to store the offset of a member of struct
printk_log with a different name. This allows to change the underlying
storage and without breaking tools.
Suggested-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
include/linux/crash_core.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/include/linux/crash_core.h
+++ b/include/linux/crash_core.h
@@ -48,9 +48,11 @@ phys_addr_t paddr_vmcoreinfo_note(void);
#define VMCOREINFO_STRUCT_SIZE(name) \
vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
(unsigned long)sizeof(struct name))
-#define VMCOREINFO_OFFSET(name, field) \
- vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \
+#define VMCOREINFO_FIELD_AND_OFFSET(name, fieldname, field) \
+ vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #fieldname, \
(unsigned long)offsetof(struct name, field))
+#define VMCOREINFO_OFFSET(name, field) \
+ VMCOREINFO_FIELD_AND_OFFSET(name, field, field)
#define VMCOREINFO_LENGTH(name, value) \
vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value)
#define VMCOREINFO_NUMBER(name) \