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.
Showing the changes to include/linux (1 of 3 files). Show all
Unified · Split
| @@ -41,6 +41,14 @@ struct can_proto { · 40 unmodified lines | ||
| 41 | 41 | struct proto *prot; |
| 42 | 42 | }; |
| 43 | 43 | |
| 44 | +/* required_size | |
| 45 | + * macro to find the minimum size of a struct | |
| 46 | + * that includes a requested member | |
| 47 | + */ | |
| 48 | +#define CAN_REQUIRED_SIZE(struct_type, member) \ | |
| 49 | + (offsetof(typeof(struct_type), member) + \ | |
| 50 | + sizeof(((typeof(struct_type) *)(NULL))->member)) | |
| 51 | + | |
| 44 | 52 | /* function prototypes for the CAN networklayer core (af_can.c) */ |
| 45 | 53 | |
| 46 | 54 | extern int can_proto_register(const struct can_proto *cp); |