2007-11-16 02:35:24

by Ken'ichi Ohmichi

[permalink] [raw]
Subject: [PATCH 2/5] Use the existing offsetof() for VMCOREINFO_OFFSET()


It is better that the existing offsetof() is used for VMCOREINFO_OFFSET().

This discussion is the following:
http://www.ussg.iu.edu/hypermail/linux/kernel/0709.3/0584.html

Signed-off-by: Ken'ichi Ohmichi <[email protected]>
---
diff -rpuN a/include/linux/kexec.h b/include/linux/kexec.h
--- a/include/linux/kexec.h 2007-11-12 11:03:31.000000000 +0900
+++ b/include/linux/kexec.h 2007-11-12 11:03:43.000000000 +0900
@@ -137,7 +137,7 @@ unsigned long paddr_vmcoreinfo_note(void
(unsigned long)sizeof(struct name))
#define VMCOREINFO_OFFSET(name, field) \
vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \
- (unsigned long)&(((struct name *)0)->field))
+ (unsigned long)offsetof(struct name, field))
#define VMCOREINFO_LENGTH(name, value) \
vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value)
#define VMCOREINFO_NUMBER(name) \
_


2007-11-16 18:54:35

by Simon Horman

[permalink] [raw]
Subject: Re: [PATCH 2/5] Use the existing offsetof() for VMCOREINFO_OFFSET()

On Fri, Nov 16, 2007 at 11:33:07AM +0900, Ken'ichi Ohmichi wrote:
>
> It is better that the existing offsetof() is used for VMCOREINFO_OFFSET().
>
> This discussion is the following:
> http://www.ussg.iu.edu/hypermail/linux/kernel/0709.3/0584.html
>
> Signed-off-by: Ken'ichi Ohmichi <[email protected]>

Acked-by: Simon Horman <[email protected]>