[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241115114926.GH38972@noisy.programming.kicks-ass.net>
Date: Fri, 15 Nov 2024 12:49:26 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Christoph Hellwig <hch@...radead.org>
Cc: mcgrof@...nel.org, x86@...nel.org, hpa@...or.com, petr.pavlu@...e.com,
samitolvanen@...gle.com, da.gomez@...sung.com, masahiroy@...nel.org,
nathan@...nel.org, nicolas@...sle.eu, linux-kernel@...r.kernel.org,
linux-modules@...r.kernel.org, linux-kbuild@...r.kernel.org,
gregkh@...uxfoundation.org
Subject: Re: [RFC][PATCH 1/8] module: Prepare for script
On Mon, Nov 11, 2024 at 01:55:29PM +0100, Peter Zijlstra wrote:
> On Mon, Nov 11, 2024 at 03:36:25AM -0800, Christoph Hellwig wrote:
> > On Mon, Nov 11, 2024 at 11:54:31AM +0100, Peter Zijlstra wrote:
> > > Since sed doesn't like multi-line make sure all EXPORT_SYMBOL_NS
> > > things are a single line.
> >
> > Eww. Just use coccinelle or another tool not so simplistic.
>
> Feel free to do so. I've never managed to get coccinelle to do anything.
So I put a little more effort in and got you this (awk needs to be
gawk>=4.1)
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
I'm sure that wasn't worth the time I spend on it though :/
Powered by blists - more mailing lists