linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH 1/1] headers_install.sh: Support __aligned(x) for uAPI headers
@ 2019-02-21 13:28 Sakari Ailus
  2019-02-22  4:36 ` Masahiro Yamada
  0 siblings, 1 reply; 5+ messages in thread
From: Sakari Ailus @ 2019-02-21 13:28 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Michael Forney, linux-kernel

The headers-install.sh already supports __packed conversion to
__attribute__((packed)) for uAPI headers but it does not support similar
__aligned(x) conversion.

Add support for __aligned(x).

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 scripts/headers_install.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
index 593f8879c641..9ed490f33a3a 100755
--- a/scripts/headers_install.sh
+++ b/scripts/headers_install.sh
@@ -36,6 +36,7 @@ do
 		-e 's/__attribute_const__([[:space:]]|$)/\1/g' \
 		-e 's@^#include <linux/compiler(|_types).h>@@' \
 		-e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \
+		-e 's/(^|[^a-zA-Z0-9])__aligned(\([0-9 ]*\))([^a-zA-Z0-9_]|$)/\1__attribute__((aligned\2))\3/g' \
 		-e 's/(^|[[:space:](])(inline|asm|volatile)([[:space:](]|$)/\1__\2__\3/g' \
 		-e 's@#(ifndef|define|endif[[:space:]]*/[*])[[:space:]]*_UAPI@#\1 @' \
 		"$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH 1/1] headers_install.sh: Support __aligned(x) for uAPI headers
  2019-02-21 13:28 [RESEND PATCH 1/1] headers_install.sh: Support __aligned(x) for uAPI headers Sakari Ailus
@ 2019-02-22  4:36 ` Masahiro Yamada
  2019-02-22 11:35   ` Sakari Ailus
  0 siblings, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2019-02-22  4:36 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: Michael Forney, Linux Kernel Mailing List

On Thu, Feb 21, 2019 at 10:29 PM Sakari Ailus
<sakari.ailus@linux.intel.com> wrote:
>
> The headers-install.sh already supports __packed conversion to
> __attribute__((packed)) for uAPI headers but it does not support similar
> __aligned(x) conversion.
>
> Add support for __aligned(x).


I am not a big fan of sed scripting in headers_install.sh

Is it a problem to write __attribute__((aligned(x)) in UAPI headers?



> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
>  scripts/headers_install.sh | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
> index 593f8879c641..9ed490f33a3a 100755
> --- a/scripts/headers_install.sh
> +++ b/scripts/headers_install.sh
> @@ -36,6 +36,7 @@ do
>                 -e 's/__attribute_const__([[:space:]]|$)/\1/g' \
>                 -e 's@^#include <linux/compiler(|_types).h>@@' \
>                 -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \
> +               -e 's/(^|[^a-zA-Z0-9])__aligned(\([0-9 ]*\))([^a-zA-Z0-9_]|$)/\1__attribute__((aligned\2))\3/g' \
>                 -e 's/(^|[[:space:](])(inline|asm|volatile)([[:space:](]|$)/\1__\2__\3/g' \
>                 -e 's@#(ifndef|define|endif[[:space:]]*/[*])[[:space:]]*_UAPI@#\1 @' \
>                 "$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1
> --
> 2.11.0
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH 1/1] headers_install.sh: Support __aligned(x) for uAPI headers
  2019-02-22  4:36 ` Masahiro Yamada
@ 2019-02-22 11:35   ` Sakari Ailus
  2019-02-27 13:14     ` Masahiro Yamada
  0 siblings, 1 reply; 5+ messages in thread
From: Sakari Ailus @ 2019-02-22 11:35 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Michael Forney, Linux Kernel Mailing List, Jonathan Corbet

Hi Yamada-san,

On Fri, Feb 22, 2019 at 01:36:03PM +0900, Masahiro Yamada wrote:
> On Thu, Feb 21, 2019 at 10:29 PM Sakari Ailus
> <sakari.ailus@linux.intel.com> wrote:
> >
> > The headers-install.sh already supports __packed conversion to
> > __attribute__((packed)) for uAPI headers but it does not support similar
> > __aligned(x) conversion.
> >
> > Add support for __aligned(x).
> 
> 
> I am not a big fan of sed scripting in headers_install.sh
> 
> Is it a problem to write __attribute__((aligned(x)) in UAPI headers?

Not really as such. __packed is supported in uAPI headers so I thought
__aligned should probably be as well. One factor here would seem to be that
__packed is way more common than __aligned is.

FWIW, a corresponding change has been done to scripts/kernel-doc; see
commit 3d9bfb19bd705f503ac7afc2776d5d56dab88858 so kerneldoc does correctly
handle that now.

Cc Jonathan.

> 
> 
> 
> > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > ---
> >  scripts/headers_install.sh | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
> > index 593f8879c641..9ed490f33a3a 100755
> > --- a/scripts/headers_install.sh
> > +++ b/scripts/headers_install.sh
> > @@ -36,6 +36,7 @@ do
> >                 -e 's/__attribute_const__([[:space:]]|$)/\1/g' \
> >                 -e 's@^#include <linux/compiler(|_types).h>@@' \
> >                 -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \
> > +               -e 's/(^|[^a-zA-Z0-9])__aligned(\([0-9 ]*\))([^a-zA-Z0-9_]|$)/\1__attribute__((aligned\2))\3/g' \
> >                 -e 's/(^|[[:space:](])(inline|asm|volatile)([[:space:](]|$)/\1__\2__\3/g' \
> >                 -e 's@#(ifndef|define|endif[[:space:]]*/[*])[[:space:]]*_UAPI@#\1 @' \
> >                 "$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1
> > --
> > 2.11.0
> >
> 
> 
> -- 
> Best Regards
> Masahiro Yamada

-- 
Sakari Ailus
sakari.ailus@linux.intel.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH 1/1] headers_install.sh: Support __aligned(x) for uAPI headers
  2019-02-22 11:35   ` Sakari Ailus
@ 2019-02-27 13:14     ` Masahiro Yamada
  2019-03-06 12:56       ` Sakari Ailus
  0 siblings, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2019-02-27 13:14 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: Michael Forney, Linux Kernel Mailing List, Jonathan Corbet

On Fri, Feb 22, 2019 at 8:37 PM Sakari Ailus
<sakari.ailus@linux.intel.com> wrote:
>
> Hi Yamada-san,
>
> On Fri, Feb 22, 2019 at 01:36:03PM +0900, Masahiro Yamada wrote:
> > On Thu, Feb 21, 2019 at 10:29 PM Sakari Ailus
> > <sakari.ailus@linux.intel.com> wrote:
> > >
> > > The headers-install.sh already supports __packed conversion to
> > > __attribute__((packed)) for uAPI headers but it does not support similar
> > > __aligned(x) conversion.
> > >
> > > Add support for __aligned(x).
> >
> >
> > I am not a big fan of sed scripting in headers_install.sh
> >
> > Is it a problem to write __attribute__((aligned(x)) in UAPI headers?
>
> Not really as such. __packed is supported in uAPI headers so I thought
> __aligned should probably be as well. One factor here would seem to be that
> __packed is way more common than __aligned is.
>
> FWIW, a corresponding change has been done to scripts/kernel-doc; see
> commit 3d9bfb19bd705f503ac7afc2776d5d56dab88858 so kerneldoc does correctly
> handle that now.

I am fine with using __aligned(x) shorthand for kernel-space code.

For UAPI headers, we get it back to __attribute__(aligned(x)) anyway,
and I'd like to minimize the complex text processing.


Since __aligned(x) takes an argument,
this is not feasible to process it by sed.


For example, please see
include/uapi/linux/netfilter_bridge/ebtables.h



If

__attribute__ ((aligned (__alignof__(struct ebt_replace))));

is converted into

__aligned(__alignof__(struct ebt_replace))


it would be difficult to revert it by sed









> Cc Jonathan.
>
> >
> >
> >
> > > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > > ---
> > >  scripts/headers_install.sh | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
> > > index 593f8879c641..9ed490f33a3a 100755
> > > --- a/scripts/headers_install.sh
> > > +++ b/scripts/headers_install.sh
> > > @@ -36,6 +36,7 @@ do
> > >                 -e 's/__attribute_const__([[:space:]]|$)/\1/g' \
> > >                 -e 's@^#include <linux/compiler(|_types).h>@@' \
> > >                 -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \
> > > +               -e 's/(^|[^a-zA-Z0-9])__aligned(\([0-9 ]*\))([^a-zA-Z0-9_]|$)/\1__attribute__((aligned\2))\3/g' \
> > >                 -e 's/(^|[[:space:](])(inline|asm|volatile)([[:space:](]|$)/\1__\2__\3/g' \
> > >                 -e 's@#(ifndef|define|endif[[:space:]]*/[*])[[:space:]]*_UAPI@#\1 @' \
> > >                 "$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1
> > > --
> > > 2.11.0
> > >
> >
> >
> > --
> > Best Regards
> > Masahiro Yamada
>
> --
> Sakari Ailus
> sakari.ailus@linux.intel.com



--
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH 1/1] headers_install.sh: Support __aligned(x) for uAPI headers
  2019-02-27 13:14     ` Masahiro Yamada
@ 2019-03-06 12:56       ` Sakari Ailus
  0 siblings, 0 replies; 5+ messages in thread
From: Sakari Ailus @ 2019-03-06 12:56 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Michael Forney, Linux Kernel Mailing List, Jonathan Corbet

On Wed, Feb 27, 2019 at 10:14:56PM +0900, Masahiro Yamada wrote:
> On Fri, Feb 22, 2019 at 8:37 PM Sakari Ailus
> <sakari.ailus@linux.intel.com> wrote:
> >
> > Hi Yamada-san,
> >
> > On Fri, Feb 22, 2019 at 01:36:03PM +0900, Masahiro Yamada wrote:
> > > On Thu, Feb 21, 2019 at 10:29 PM Sakari Ailus
> > > <sakari.ailus@linux.intel.com> wrote:
> > > >
> > > > The headers-install.sh already supports __packed conversion to
> > > > __attribute__((packed)) for uAPI headers but it does not support similar
> > > > __aligned(x) conversion.
> > > >
> > > > Add support for __aligned(x).
> > >
> > >
> > > I am not a big fan of sed scripting in headers_install.sh
> > >
> > > Is it a problem to write __attribute__((aligned(x)) in UAPI headers?
> >
> > Not really as such. __packed is supported in uAPI headers so I thought
> > __aligned should probably be as well. One factor here would seem to be that
> > __packed is way more common than __aligned is.
> >
> > FWIW, a corresponding change has been done to scripts/kernel-doc; see
> > commit 3d9bfb19bd705f503ac7afc2776d5d56dab88858 so kerneldoc does correctly
> > handle that now.
> 
> I am fine with using __aligned(x) shorthand for kernel-space code.
> 
> For UAPI headers, we get it back to __attribute__(aligned(x)) anyway,
> and I'd like to minimize the complex text processing.
> 
> 
> Since __aligned(x) takes an argument,
> this is not feasible to process it by sed.
> 
> 
> For example, please see
> include/uapi/linux/netfilter_bridge/ebtables.h
> 
> 
> 
> If
> 
> __attribute__ ((aligned (__alignof__(struct ebt_replace))));
> 
> is converted into
> 
> __aligned(__alignof__(struct ebt_replace))
> 
> 
> it would be difficult to revert it by sed

Fair enough. Sed doesn't really bend for that too well indeed. I can submit
a patch to remove the similar conversion from the kernel-doc as well based
on this discussion.

-- 
Sakari Ailus
sakari.ailus@linux.intel.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-06 12:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-21 13:28 [RESEND PATCH 1/1] headers_install.sh: Support __aligned(x) for uAPI headers Sakari Ailus
2019-02-22  4:36 ` Masahiro Yamada
2019-02-22 11:35   ` Sakari Ailus
2019-02-27 13:14     ` Masahiro Yamada
2019-03-06 12:56       ` Sakari Ailus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).