All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Wolfgang Grandegger <wg@domain.hid>
Cc: socketcan-core@domain.hid, Oliver Hartkopp <socketcan@domain.hid>,
	xenomai-core <xenomai@xenomai.org>
Subject: [Xenomai-core] Re: Magics of [CAN] message filtering
Date: Sun, 18 Feb 2007 19:24:02 +0100	[thread overview]
Message-ID: <45D899C2.8080000@domain.hid> (raw)
In-Reply-To: <45D74FE2.7030001@domain.hid>

[-- Attachment #1: Type: text/plain, Size: 1304 bytes --]

Jan Kiszka wrote:
> Wolfgang Grandegger wrote:
>> 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.
> 
> On all target archs? With all supported compilers? Better make it explicit.

gcc -Os is such an example, toasting the assumed can_frame layout by
moving that 3-byte hole *after* data.

So this was an urging ABI bug, and I applied the alignment to both
stable and trunk Xenomai SVNs. Thanks to Oliver for insisting on this!

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]

  reply	other threads:[~2007-02-18 18:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <45D425B8.7070401@domain.hid>
     [not found] ` <45D60C78.5090106@domain.hid>
2007-02-16 21:04   ` [Xenomai-core] Re: Magics of [CAN] message filtering Jan Kiszka
     [not found]     ` <45D709E4.80409@domain.hid>
2007-02-17 17:44       ` Jan Kiszka
2007-02-17 18:12         ` Wolfgang Grandegger
2007-02-17 18:56           ` Jan Kiszka
2007-02-18 18:24             ` Jan Kiszka [this message]
2007-02-18 20:41               ` Wolfgang Grandegger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45D899C2.8080000@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=socketcan-core@domain.hid \
    --cc=socketcan@domain.hid \
    --cc=wg@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.