[PATCH 2/2] backports: add gplizer for EXPORT_SYMBOL_GPL() help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Luis R. Rodriguez" <mcgrof@xxxxxxxxxxxxxxxx>

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 <mcgrof@xxxxxxxxxxxxxxxx>
---
 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 0000000..209bb95
--- /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))
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe backports" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux