diff options
author | Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be> | 2018-10-08 11:48:33 +0200 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2019-09-04 13:29:15 +0200 |
commit | 9868b5d44f3df9dd75247acd23dddff0a42f79be (patch) | |
tree | c12df929a819d45fab12295ea93c3c5d4d00aa10 /include/linux/can | |
parent | 4f746fb4951834ba71d590d430f27dee54f9d9a0 (diff) | |
download | linux-9868b5d44f3df9dd75247acd23dddff0a42f79be.tar.gz linux-9868b5d44f3df9dd75247acd23dddff0a42f79be.tar.bz2 linux-9868b5d44f3df9dd75247acd23dddff0a42f79be.zip |
can: introduce CAN_REQUIRED_SIZE macro
The size of this structure will be increased with J1939 support. To stay
binary compatible, the CAN_REQUIRED_SIZE macro is introduced for
existing CAN protocols.
Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'include/linux/can')
-rw-r--r-- | include/linux/can/core.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/can/core.h b/include/linux/can/core.h index 708c10d3417a..8339071ab08b 100644 --- a/include/linux/can/core.h +++ b/include/linux/can/core.h @@ -41,6 +41,14 @@ struct can_proto { struct proto *prot; }; +/* required_size + * macro to find the minimum size of a struct + * that includes a requested member + */ +#define CAN_REQUIRED_SIZE(struct_type, member) \ + (offsetof(typeof(struct_type), member) + \ + sizeof(((typeof(struct_type) *)(NULL))->member)) + /* function prototypes for the CAN networklayer core (af_can.c) */ extern int can_proto_register(const struct can_proto *cp); |