All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@meshcoding.com>
To: James Hogan <james.hogan@imgtec.com>
Cc: mareklindner@neomailbox.ch, netdev <netdev@vger.kernel.org>,
	b.a.t.m.a.n@lists.open-mesh.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-metag@vger.kernel.org, David Miller <davem@davemloft.net>,
	Chen Gang <gang.chen.5i5j@gmail.com>
Subject: Re: [B.A.T.M.A.N.] [PATCH linux-next] net: batman-adv: use "__packed __aligned(2)" for each structure instead of "__packed(2)" region
Date: Sun, 19 Jan 2014 10:30:33 +0100	[thread overview]
Message-ID: <52DB9B39.9090502@meshcoding.com> (raw)
In-Reply-To: <4915262.qEFumRrH4p@radagast>

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

On 19/01/14 02:10, James Hogan wrote:
> 
> It appears that the following gcc patch adds support for #pragma pack:
> http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01115.html
> 
> I gave it a quick spin on metag gcc (which is unfortunately stuck on an old 
> version) and it seems to fix my simple test case so that #pragma pack(2) 
> becomes equivalent to __packed __aligned(2) (for sizeof and __alignof__).
> 

Then I personally think that it is better to fix metag gcc instead of
changing the kernel.

Actually there are many different spots where "#pragma pack" is used.
batman-adv is just the only one having compile time checks for structure
sizes.

> 
> However, the __packed and __aligned are linux specific macros to abstract 
> compiler details, whereas #pragma pack appears to be a compiler-specific WIN32 
> style equivalent to GCC's __attribute__((packed)) and 
> __attribute__((aligned(2))) (these are what __packed and __aligned use in 
> compiler-gcc.h).
> 
> Therefore I believe using the Linux abstractions is still more correct here.

If you really think so, I'd suggest to grep in the kernel and catch all
the other occurrences of "#pragma pack" and change them all (assuming
that using __attribute__((aligned(2))) is the way to go).

Cheers,


-- 
Antonio Quartulli


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

WARNING: multiple messages have this Message-ID (diff)
From: Antonio Quartulli <antonio-x4xJYDvStAgysxA8WJXlww@public.gmane.org>
To: James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
Cc: mareklindner-rVWd3aGhH2z5bpWLKbzFeg@public.gmane.org,
	netdev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-metag-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	Chen Gang
	<gang.chen.5i5j-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH linux-next] net: batman-adv: use "__packed __aligned(2)" for each structure instead of "__packed(2)" region
Date: Sun, 19 Jan 2014 10:30:33 +0100	[thread overview]
Message-ID: <52DB9B39.9090502@meshcoding.com> (raw)
In-Reply-To: <4915262.qEFumRrH4p@radagast>

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

On 19/01/14 02:10, James Hogan wrote:
> 
> It appears that the following gcc patch adds support for #pragma pack:
> http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01115.html
> 
> I gave it a quick spin on metag gcc (which is unfortunately stuck on an old 
> version) and it seems to fix my simple test case so that #pragma pack(2) 
> becomes equivalent to __packed __aligned(2) (for sizeof and __alignof__).
> 

Then I personally think that it is better to fix metag gcc instead of
changing the kernel.

Actually there are many different spots where "#pragma pack" is used.
batman-adv is just the only one having compile time checks for structure
sizes.

> 
> However, the __packed and __aligned are linux specific macros to abstract 
> compiler details, whereas #pragma pack appears to be a compiler-specific WIN32 
> style equivalent to GCC's __attribute__((packed)) and 
> __attribute__((aligned(2))) (these are what __packed and __aligned use in 
> compiler-gcc.h).
> 
> Therefore I believe using the Linux abstractions is still more correct here.

If you really think so, I'd suggest to grep in the kernel and catch all
the other occurrences of "#pragma pack" and change them all (assuming
that using __attribute__((aligned(2))) is the way to go).

Cheers,


-- 
Antonio Quartulli


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

WARNING: multiple messages have this Message-ID (diff)
From: Antonio Quartulli <antonio@meshcoding.com>
To: James Hogan <james.hogan@imgtec.com>
Cc: Chen Gang <gang.chen.5i5j@gmail.com>,
	David Miller <davem@davemloft.net>,
	mareklindner@neomailbox.ch, sw@simonwunderlich.de,
	b.a.t.m.a.n@lists.open-mesh.org, netdev <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-metag@vger.kernel.org
Subject: Re: [PATCH linux-next] net: batman-adv: use "__packed __aligned(2)" for each structure instead of "__packed(2)" region
Date: Sun, 19 Jan 2014 10:30:33 +0100	[thread overview]
Message-ID: <52DB9B39.9090502@meshcoding.com> (raw)
In-Reply-To: <4915262.qEFumRrH4p@radagast>

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

On 19/01/14 02:10, James Hogan wrote:
> 
> It appears that the following gcc patch adds support for #pragma pack:
> http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01115.html
> 
> I gave it a quick spin on metag gcc (which is unfortunately stuck on an old 
> version) and it seems to fix my simple test case so that #pragma pack(2) 
> becomes equivalent to __packed __aligned(2) (for sizeof and __alignof__).
> 

Then I personally think that it is better to fix metag gcc instead of
changing the kernel.

Actually there are many different spots where "#pragma pack" is used.
batman-adv is just the only one having compile time checks for structure
sizes.

> 
> However, the __packed and __aligned are linux specific macros to abstract 
> compiler details, whereas #pragma pack appears to be a compiler-specific WIN32 
> style equivalent to GCC's __attribute__((packed)) and 
> __attribute__((aligned(2))) (these are what __packed and __aligned use in 
> compiler-gcc.h).
> 
> Therefore I believe using the Linux abstractions is still more correct here.

If you really think so, I'd suggest to grep in the kernel and catch all
the other occurrences of "#pragma pack" and change them all (assuming
that using __attribute__((aligned(2))) is the way to go).

Cheers,


-- 
Antonio Quartulli


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

  reply	other threads:[~2014-01-19  9:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-18 11:31 [B.A.T.M.A.N.] [PATCH linux-next] net: batman-adv: use "__packed __aligned(2)" for each structure instead of "__packed(2)" region Chen Gang
2014-01-18 11:31 ` Chen Gang
2014-01-18 11:31 ` Chen Gang
2014-01-18 13:03 ` [B.A.T.M.A.N.] " Antonio Quartulli
2014-01-18 13:03   ` Antonio Quartulli
2014-01-18 13:03   ` Antonio Quartulli
2014-01-19  1:10   ` [B.A.T.M.A.N.] " James Hogan
2014-01-19  1:10     ` James Hogan
2014-01-19  9:30     ` Antonio Quartulli [this message]
2014-01-19  9:30       ` Antonio Quartulli
2014-01-19  9:30       ` Antonio Quartulli
2014-01-19  9:51       ` [B.A.T.M.A.N.] " Chen Gang
2014-01-19  9:51         ` Chen Gang
2014-01-20 11:28       ` [B.A.T.M.A.N.] " James Hogan
2014-01-20 11:28         ` James Hogan
2014-01-20 11:28         ` James Hogan

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=52DB9B39.9090502@meshcoding.com \
    --to=antonio@meshcoding.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=gang.chen.5i5j@gmail.com \
    --cc=james.hogan@imgtec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-metag@vger.kernel.org \
    --cc=mareklindner@neomailbox.ch \
    --cc=netdev@vger.kernel.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.