From 3d6b779dbe7a369287adb0d98b29cdc8098a9d1c Mon Sep 17 00:00:00 2001 From: "Luis R. Rodriguez" Date: Fri, 12 Jul 2013 15:59:07 -0700 Subject: [PATCH] backports: add gplizer for EXPORT_SYMBOL_GPL() help If we forget to use EXPORT_SYMBOL_GPL() we can run this. We may later use this for other things. Signed-off-by: Luis R. Rodriguez --- devel/gplizer | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 devel/gplizer diff --git a/devel/gplizer b/devel/gplizer new file mode 100755 index 000000000000..209bb95ef9dc --- /dev/null +++ b/devel/gplizer @@ -0,0 +1,28 @@ +#!/usr/bin/env python +""" + gplizer +========= + +This modifies C files with EXPORT_SYMBOL() to EXPORT_SYMBOL_GPL(). +We use this as Python code here as we may use it later for broader +substitutions. We keep it in backports as typically we forget to +use EXPORT_SYMBOL_GPL() when backporting kernel symbols. + +In short this does this but in Python: + +for i in $(find ./ -type f -name \*.c); do + perl -pi -e'$_ =~ s|EXPORT_SYMBOL\(|EXPORT_SYMBOL_GPL\(|gs;' $i +done +""" + +import os, fileinput + +def gplize(f): + for line in fileinput.input(f, inplace=1): + print line.replace('EXPORT_SYMBOL(','EXPORT_SYMBOL_GPL('), + +if __name__ == '__main__': + for root, dirs, files in os.walk(os.getcwd()): + for f in files: + if f.endswith('.c'): + gplize(os.path.join(root, f)) -- 2.30.2