Jan Kiszka wrote:
Oliver Hartkopp wrote:
When you're touching anything inside your API, have you ever thought to add

__attribute__ ((aligned(8)))

to the data[8] element of the struct can_frame?

This would enable you to make 64 bit compares directly in the data
section of the can_frame ...

typedef __u32 canid_t;

struct can_frame {
    canid_t can_id;  /* 32 bit CAN_ID + EFF/RTR/ERR flags */
    __u8    can_dlc; /* data length code: 0 .. 8 */
    __u8    data[8] __attribute__ ((aligned(8)));
};

[Swallowing down my well-known opinion on typeof(can_dlc) :)]

Yes, this should be done, already for the more urging sake of
unambiguous layout of the structure across the kernel/user space border.

Is this not already the case? At least the size of struct can_frame is 16 bytes.

Wolfgang.


_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to