History

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.

Kurt Van Dijck committed 8 years ago

Commit 9868b5d1 parent 4f746fb3 files · +12 −4Browse files

Showing the changes to include/linux (1 of 3 files). Show all

Unified · Split

include/linux/can/core.h+8−0
@@ -41,6 +41,14 @@ struct can_proto { · 40 unmodified lines
4141 struct proto *prot;
4242 };
4343
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+
4452 /* function prototypes for the CAN networklayer core (af_can.c) */
4553
4654 extern int can_proto_register(const struct can_proto *cp);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t