All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Shawn Landden <shawn@churchofgit.com>, linux-can@vger.kernel.org
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Subject: Re: [PATCH] can.h: make padding given by gcc explicit
Date: Tue, 05 May 2015 21:02:07 +0200	[thread overview]
Message-ID: <554913AF.6080003@hartkopp.net> (raw)
In-Reply-To: <1430842036-21509-1-git-send-email-shawn@churchofgit.com>

On 05/05/2015 06:07 PM, Shawn Landden wrote:
> The current definition of struct can_frame has a 16-byte size, with 8-byte
> alignment, but the 3 bytes of padding are not explicit like the similar 2 bytes
> of padding of struct canfd_frame. Make it explicit so it is easier to read.
> 
> v2: match analogous padding fields in canfd_frame
>     update Documentation
> 
> Signed-off-by: Shawn Landden <shawn@churchofgit.com>

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>

Thanks Shawn!

> ---
>  Documentation/networking/can.txt | 3 +++
>  include/uapi/linux/can.h         | 6 ++++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/Documentation/networking/can.txt b/Documentation/networking/can.txt
> index 5abad1e..b48d4a1 100644
> --- a/Documentation/networking/can.txt
> +++ b/Documentation/networking/can.txt
> @@ -268,6 +268,9 @@ solution for a couple of reasons:
>      struct can_frame {
>              canid_t can_id;  /* 32 bit CAN_ID + EFF/RTR/ERR flags */
>              __u8    can_dlc; /* frame payload length in byte (0 .. 8) */
> +            __u8    __pad;   /* padding */
> +            __u8    __res0;  /* reserved / padding */
> +            __u8    __res1;  /* reserved / padding */
>              __u8    data[8] __attribute__((aligned(8)));
>      };
>  
> diff --git a/include/uapi/linux/can.h b/include/uapi/linux/can.h
> index 41892f7..9692cda 100644
> --- a/include/uapi/linux/can.h
> +++ b/include/uapi/linux/can.h
> @@ -95,11 +95,17 @@ typedef __u32 can_err_mask_t;
>   * @can_dlc: frame payload length in byte (0 .. 8) aka data length code
>   *           N.B. the DLC field from ISO 11898-1 Chapter 8.4.2.3 has a 1:1
>   *           mapping of the 'data length code' to the real payload length
> + * @__pad:   padding
> + * @__res0:  reserved / padding
> + * @__res1:  reserved / padding
>   * @data:    CAN frame payload (up to 8 byte)
>   */
>  struct can_frame {
>  	canid_t can_id;  /* 32 bit CAN_ID + EFF/RTR/ERR flags */
>  	__u8    can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */
> +	__u8    __pad;   /* padding */
> +	__u8    __res0;  /* reserved / padding */
> +	__u8    __res1;  /* reserved / padding */
>  	__u8    data[CAN_MAX_DLEN] __attribute__((aligned(8)));
>  };
>  
> 

  reply	other threads:[~2015-05-05 19:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-01 19:54 [PATCH] can.h: make padding given by gcc explicit Shawn Landden
2015-05-01 20:23 ` Marc Kleine-Budde
2015-05-04 16:00 ` Oliver Hartkopp
2015-05-05  7:03   ` Shawn Landden
2015-05-05  7:06     ` Marc Kleine-Budde
2015-05-05 16:07   ` Shawn Landden
2015-05-05 19:02     ` Oliver Hartkopp [this message]
2015-05-05 19:25     ` Marc Kleine-Budde

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=554913AF.6080003@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=shawn@churchofgit.com \
    /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.