OSDN Git Service

crash: add VMCOREINFO macro to define offset in a struct declared by typedef
authorJohn Ogness <john.ogness@linutronix.de>
Thu, 9 Jul 2020 13:23:41 +0000 (15:29 +0206)
committerPetr Mladek <pmladek@suse.com>
Fri, 10 Jul 2020 06:47:40 +0000 (08:47 +0200)
The existing macro VMCOREINFO_OFFSET() can't be used for structures
declared via typedef because "struct" is not part of type definition.

Create another macro for this purpose.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Acked-by: Baoquan He <bhe@redhat.com>
Acked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20200709132344.760-2-john.ogness@linutronix.de
include/linux/crash_core.h

index 525510a..43b51c9 100644 (file)
@@ -53,6 +53,9 @@ phys_addr_t paddr_vmcoreinfo_note(void);
 #define VMCOREINFO_OFFSET(name, field) \
        vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \
                              (unsigned long)offsetof(struct name, field))
+#define VMCOREINFO_TYPE_OFFSET(name, field) \
+       vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \
+                             (unsigned long)offsetof(name, field))
 #define VMCOREINFO_LENGTH(name, value) \
        vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value)
 #define VMCOREINFO_NUMBER(name) \