On Mon, Dec 02, 2024 at 03:59:47PM +0100, Peter Zijlstra wrote:
> Clean up the existing export namespace code along the same lines of
> 33def8498fdd ("treewide: Convert macro and uses of __section(foo) to
> __section("foo")") and for the same reason, it is not desired for the
> namespace argument to be a macro expansion itself.
> 
> git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
> do
>   awk -i inplace '
>     /^#define EXPORT_SYMBOL_NS/ {
>       gsub(/__stringify\(ns\)/, "ns");
>       print;
>       next;
>     }
>     /^#define MODULE_IMPORT_NS/ {
>       gsub(/__stringify\(ns\)/, "ns");
>       print;
>       next;
>     }
>     /MODULE_IMPORT_NS/ {
>       $0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", 
> "g");
>     }
>     /EXPORT_SYMBOL_NS/ {
>       if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
>       if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
>           $0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
>           $0 !~ /^my/) {
>         getline line;
>         gsub(/[[:space:]]*\\$/, "");
>         gsub(/[[:space:]]/, "", line);
>         $0 = $0 " " line;
>       }
> 
>       $0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
>                   "\\1(\\2, \"\\3\")", "g");
>       }
>     }
>     { print }' $file;
> done

Perhaps we can ask Linus to run this now, before -next fills up again ?

> Requested-by: Masahiro Yamada <masahi...@kernel.org>
> Signed-off-by: Peter Zijlstra (Intel) <pet...@infradead.org>

Reply via email to