2010-11-22 12:00:19

by Mel Gorman

[permalink] [raw]
Subject: [PATCH] scripts: Fix gfp-translate for recent changes to gfp.h

The recent changes to gfp.h to satisfy sparse broke
scripts/gfp-translate. This patch fixes it up to work with old and new
versions of gfp.h .

Signed-off-by: Mel Gorman <[email protected]>
---
scripts/gfp-translate | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/scripts/gfp-translate b/scripts/gfp-translate
index d81b968..128937e 100644
--- a/scripts/gfp-translate
+++ b/scripts/gfp-translate
@@ -63,7 +63,12 @@ fi

# Extract GFP flags from the kernel source
TMPFILE=`mktemp -t gfptranslate-XXXXXX` || exit 1
-grep "^#define __GFP" $SOURCE/include/linux/gfp.h | sed -e 's/(__force gfp_t)//' | sed -e 's/u)/)/' | grep -v GFP_BITS | sed -e 's/)\//) \//' > $TMPFILE
+grep ___GFP $SOURCE/include/linux/gfp.h > /dev/null
+if [ $? -eq 0 ]; then
+ grep "^#define ___GFP" $SOURCE/include/linux/gfp.h | sed -e 's/u$//' | grep -v GFP_BITS > $TMPFILE
+else
+ grep "^#define __GFP" $SOURCE/include/linux/gfp.h | sed -e 's/(__force gfp_t)//' | sed -e 's/u)/)/' | grep -v GFP_BITS | sed -e 's/)\//) \//' > $TMPFILE
+fi

# Parse the flags
IFS="


2010-11-23 02:54:46

by Namhyung Kim

[permalink] [raw]
Subject: Re: [PATCH] scripts: Fix gfp-translate for recent changes to gfp.h

2010-11-22 (월), 12:00 +0000, Mel Gorman:
> The recent changes to gfp.h to satisfy sparse broke
> scripts/gfp-translate. This patch fixes it up to work with old and new
> versions of gfp.h .

Oh, I didn't even know the script exists. Sorry.

--
Regards,
Namhyung Kim

2010-11-23 04:32:29

by Cong Wang

[permalink] [raw]
Subject: Re: [PATCH] scripts: Fix gfp-translate for recent changes to gfp.h

On Mon, Nov 22, 2010 at 12:00:02PM +0000, Mel Gorman wrote:
>The recent changes to gfp.h to satisfy sparse broke
>scripts/gfp-translate. This patch fixes it up to work with old and new
>versions of gfp.h .
>
>Signed-off-by: Mel Gorman <[email protected]>
>---
> scripts/gfp-translate | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
>diff --git a/scripts/gfp-translate b/scripts/gfp-translate
>index d81b968..128937e 100644
>--- a/scripts/gfp-translate
>+++ b/scripts/gfp-translate
>@@ -63,7 +63,12 @@ fi
>
> # Extract GFP flags from the kernel source
> TMPFILE=`mktemp -t gfptranslate-XXXXXX` || exit 1
>-grep "^#define __GFP" $SOURCE/include/linux/gfp.h | sed -e 's/(__force gfp_t)//' | sed -e 's/u)/)/' | grep -v GFP_BITS | sed -e 's/)\//) \//' > $TMPFILE
>+grep ___GFP $SOURCE/include/linux/gfp.h > /dev/null

You might want 'grep -q'. :)


>+if [ $? -eq 0 ]; then
>+ grep "^#define ___GFP" $SOURCE/include/linux/gfp.h | sed -e 's/u$//' | grep -v GFP_BITS > $TMPFILE
>+else
>+ grep "^#define __GFP" $SOURCE/include/linux/gfp.h | sed -e 's/(__force gfp_t)//' | sed -e 's/u)/)/' | grep -v GFP_BITS | sed -e 's/)\//) \//' > $TMPFILE
>+fi
>
> # Parse the flags
> IFS="

Other than that, this patch looks fine for me.

Reviewed-by: WANG Cong <[email protected]>

Thanks.

2010-11-23 08:22:31

by Mel Gorman

[permalink] [raw]
Subject: Re: [PATCH] scripts: Fix gfp-translate for recent changes to gfp.h

On Tue, Nov 23, 2010 at 12:37:10PM +0800, Am?rico Wang wrote:
> On Mon, Nov 22, 2010 at 12:00:02PM +0000, Mel Gorman wrote:
> >The recent changes to gfp.h to satisfy sparse broke
> >scripts/gfp-translate. This patch fixes it up to work with old and new
> >versions of gfp.h .
> >
> >Signed-off-by: Mel Gorman <[email protected]>
> >---
> > scripts/gfp-translate | 7 ++++++-
> > 1 files changed, 6 insertions(+), 1 deletions(-)
> >
> >diff --git a/scripts/gfp-translate b/scripts/gfp-translate
> >index d81b968..128937e 100644
> >--- a/scripts/gfp-translate
> >+++ b/scripts/gfp-translate
> >@@ -63,7 +63,12 @@ fi
> >
> > # Extract GFP flags from the kernel source
> > TMPFILE=`mktemp -t gfptranslate-XXXXXX` || exit 1
> >-grep "^#define __GFP" $SOURCE/include/linux/gfp.h | sed -e 's/(__force gfp_t)//' | sed -e 's/u)/)/' | grep -v GFP_BITS | sed -e 's/)\//) \//' > $TMPFILE
> >+grep ___GFP $SOURCE/include/linux/gfp.h > /dev/null
>
> You might want 'grep -q'. :)
>

I *do* want grep -q :) . Andrew has already applied a relevant fix, thanks
Andrew.

>
> >+if [ $? -eq 0 ]; then
> >+ grep "^#define ___GFP" $SOURCE/include/linux/gfp.h | sed -e 's/u$//' | grep -v GFP_BITS > $TMPFILE
> >+else
> >+ grep "^#define __GFP" $SOURCE/include/linux/gfp.h | sed -e 's/(__force gfp_t)//' | sed -e 's/u)/)/' | grep -v GFP_BITS | sed -e 's/)\//) \//' > $TMPFILE
> >+fi
> >
> > # Parse the flags
> > IFS="
>
> Other than that, this patch looks fine for me.
>
> Reviewed-by: WANG Cong <[email protected]>
>

Cheers.

--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab