Skip to contentSkip to conversation

scripts: Fix gfp-translate for recent changes to gfp.h

PATCH In review Mel Gorman 3 participants 4 messages Nov 22, 2010 – Nov 23, 2010 Memory management

lore
Share & tools
lore

Mel Gorman

author
#0 lore raw

PATCH 1/1 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 .

---
 scripts/gfp-translate |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
scripts/gfp-translate +6 -1
index d81b968..128937e 100644
@@ -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="

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw

2010-11-22 (월), 12:00 +0000, Mel Gorman:

Quoted 3 lines

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.

Signature · 2 lines
Regards,
Namhyung Kim
Reviewed-by on v1 1/1
#2 lore raw
In reply to Mel Gorman
Quoted 17 lines · 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 .

---
scripts/gfp-translate | 7 ++++++-

1 files changed, 6 insertions(+), 1 deletions(-)
scripts/gfp-translate +0 -0
index d81b968..128937e 100644
@@ -63,7 +63,12 @@ fi
 
 # Extract GFP flags from the kernel source

TMPFILE=mktemp -t gfptranslate-XXXXXX || exit 1

scripts/gfp-translate fi · line 66

Quoted 2 lines
scripts/gfp-translate +1 -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'. :)

Quoted 8 lines
scripts/gfp-translate +5 -0
+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.

Thanks.

author
#3 lore raw
Quoted 16 lines · Am?rico Wang
Quoted 15 lines · 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 .

---
scripts/gfp-translate | 7 ++++++-

1 files changed, 6 insertions(+), 1 deletions(-)
scripts/gfp-translate +0 -0
index d81b968..128937e 100644
@@ -63,7 +63,12 @@ fi
 
Quoted 7 lines

scripts/gfp-translate fi · line 66

Quoted 4 lines
scripts/gfp-translate +0 -0
 # Extract GFP flags from the kernel source

TMPFILE=mktemp -t gfptranslate-XXXXXX || exit 1

scripts/gfp-translate +1 -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.

Quoted 7 lines
Quoted 7 lines
scripts/gfp-translate +5 -0
+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
Quoted 7 lines
Quoted 2 lines

# Parse the flags
IFS="

Other than that, this patch looks fine for me.

Cheers.

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