Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
commit 1aab3d25814a3b0b434e17c25aa617d34d2c3f74 Author: Sven Eckelmann sven@narfation.org Date: Wed Dec 11 09:52:17 2019 +0100
batman-adv: Replace FIELD_SIZEOF with sizeof_field
The prefered way of getting the size of a member of a struct is the common macro sizeof_field from stddef.h and not the FIELD_SIZEOF (with multiple definitions).
Signed-off-by: Sven Eckelmann sven@narfation.org
1aab3d25814a3b0b434e17c25aa617d34d2c3f74 compat-include/linux/{types.h => stddef.h} | 14 ++++++-------- net/batman-adv/main.c | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/compat-include/linux/types.h b/compat-include/linux/stddef.h similarity index 58% copy from compat-include/linux/types.h copy to compat-include/linux/stddef.h index 22ba449e..dd18840e 100644 --- a/compat-include/linux/types.h +++ b/compat-include/linux/stddef.h @@ -7,20 +7,18 @@ * of the Linux kernel. */
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_TYPES_H_ -#define _NET_BATMAN_ADV_COMPAT_LINUX_TYPES_H_ +#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_STDDEF_H_ +#define _NET_BATMAN_ADV_COMPAT_LINUX_STDDEF_H_
#include <linux/version.h> -#include_next <linux/types.h> +#include_next <linux/stddef.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
-#ifdef __CHECK_POLL -typedef unsigned __bitwise __poll_t; -#else -typedef unsigned __poll_t; +#ifndef sizeof_field +#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER)) #endif
#endif /* < KERNEL_VERSION(4, 16, 0) */
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_TYPES_H_ */ +#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_STDDEF_H_ */ diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index 4a89177d..4811ec65 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c @@ -548,7 +548,7 @@ static void batadv_recv_handler_init(void) BUILD_BUG_ON(sizeof(struct batadv_tvlv_tt_change) != 12); BUILD_BUG_ON(sizeof(struct batadv_tvlv_roam_adv) != 8);
- i = FIELD_SIZEOF(struct sk_buff, cb); + i = sizeof_field(struct sk_buff, cb); BUILD_BUG_ON(sizeof(struct batadv_skb_cb) > i);
/* broadcast packet */