* [PATCH] markup_oops: Use modinfo to avoid confusion with underscored module names
@ 2009-08-06 12:21 Ozan Çağlayan
2009-08-06 14:11 ` Arjan van de Ven
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Ozan Çağlayan @ 2009-08-06 12:21 UTC (permalink / raw)
To: linux-kernel; +Cc: arjan
When EIP is at a module having an underscore in its name, the current
code fails to find it because the module filenames has '-' instead of
'_'.
Use modinfo to correctly get the full path to the module.
Signed-off-by: Ozan Çağlayan <ozan@pardus.org.tr>
---
This is just a trivial patch to pinpoint the problem. Usage of modinfo is faster than
searching through the filesystem but may not be desirable as it brings a dependency
to module-init-tools. Replacing underscore occurences by '-' can be another solution.
scripts/markup_oops.pl | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl
index 8977401..bc14f4c 100644
--- a/scripts/markup_oops.pl
+++ b/scripts/markup_oops.pl
@@ -184,10 +184,7 @@ if ($target eq "0") {
# if it's a module, we need to find the .ko file and calculate a load offset
if ($module ne "") {
- my $dir = dirname($filename);
- $dir = $dir . "/";
- my $mod = $module . ".ko";
- my $modulefile = `find $dir -name $mod | head -1`;
+ my $modulefile = `modinfo $module | grep 'filename' | gawk '{ print \$2 }'`;
chomp($modulefile);
$filename = $modulefile;
if ($filename eq "") {
--
1.6.3.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] markup_oops: Use modinfo to avoid confusion with underscored module names
2009-08-06 12:21 [PATCH] markup_oops: Use modinfo to avoid confusion with underscored module names Ozan Çağlayan
@ 2009-08-06 14:11 ` Arjan van de Ven
2009-08-06 15:32 ` Ozan Çağlayan
2009-08-07 1:42 ` Amerigo Wang
2009-08-10 9:13 ` [PATCH v2] " Ozan Çağlayan
2 siblings, 1 reply; 6+ messages in thread
From: Arjan van de Ven @ 2009-08-06 14:11 UTC (permalink / raw)
To: Ozan Çağlayan; +Cc: linux-kernel, akpm
On Thu, 6 Aug 2009 15:21:55 +0300
Ozan Çağlayan <ozan@pardus.org.tr> wrote:
> When EIP is at a module having an underscore in its name, the current
> code fails to find it because the module filenames has '-' instead of
> '_'.
>
> Use modinfo to correctly get the full path to the module.
>
> Signed-off-by: Ozan Çağlayan <ozan@pardus.org.tr>
I like it, it's simple.
I don't mind about the module-init-tools dependency, everyone will have
that already.
Acked-by: Arjan van de Ven <arjan@linux.intel.com>
Andrew: can you hover this one up and send to Linus when its time is
due?
> ---
> This is just a trivial patch to pinpoint the problem. Usage of
> modinfo is faster than searching through the filesystem but may not
> be desirable as it brings a dependency to module-init-tools.
> Replacing underscore occurences by '-' can be another solution.
>
> scripts/markup_oops.pl | 5 +----
> 1 files changed, 1 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl
> index 8977401..bc14f4c 100644
> --- a/scripts/markup_oops.pl
> +++ b/scripts/markup_oops.pl
> @@ -184,10 +184,7 @@ if ($target eq "0") {
>
> # if it's a module, we need to find the .ko file and calculate a
> load offset if ($module ne "") {
> - my $dir = dirname($filename);
> - $dir = $dir . "/";
> - my $mod = $module . ".ko";
> - my $modulefile = `find $dir -name $mod | head -1`;
> + my $modulefile = `modinfo $module | grep 'filename' | gawk
> '{ print \$2 }'`; chomp($modulefile);
> $filename = $modulefile;
> if ($filename eq "") {
--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] markup_oops: Use modinfo to avoid confusion with underscored module names
2009-08-06 14:11 ` Arjan van de Ven
@ 2009-08-06 15:32 ` Ozan Çağlayan
0 siblings, 0 replies; 6+ messages in thread
From: Ozan Çağlayan @ 2009-08-06 15:32 UTC (permalink / raw)
To: Arjan van de Ven; +Cc: linux-kernel, akpm
Arjan van de Ven wrote:
> On Thu, 6 Aug 2009 15:21:55 +0300
> Ozan Çağlayan <ozan@pardus.org.tr> wrote:
>
>
>> When EIP is at a module having an underscore in its name, the current
>> code fails to find it because the module filenames has '-' instead of
>> '_'.
>>
>> Use modinfo to correctly get the full path to the module.
>>
>> Signed-off-by: Ozan Çağlayan <ozan@pardus.org.tr>
>>
>
> I like it, it's simple.
> I don't mind about the module-init-tools dependency, everyone will have
> that already.
>
BTW, note that the old code was searching for *.ko files in
dirname($vmlinux_name). Replacing it by modprobe will eventually always
search for the modules in /lib/modules/KVER/.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] markup_oops: Use modinfo to avoid confusion with underscored module names
2009-08-06 12:21 [PATCH] markup_oops: Use modinfo to avoid confusion with underscored module names Ozan Çağlayan
2009-08-06 14:11 ` Arjan van de Ven
@ 2009-08-07 1:42 ` Amerigo Wang
2009-08-10 9:13 ` [PATCH v2] " Ozan Çağlayan
2 siblings, 0 replies; 6+ messages in thread
From: Amerigo Wang @ 2009-08-07 1:42 UTC (permalink / raw)
To: Ozan Çağlayan; +Cc: linux-kernel, arjan
On Thu, Aug 06, 2009 at 03:21:55PM +0300, Ozan Çağlayan wrote:
>When EIP is at a module having an underscore in its name, the current
>code fails to find it because the module filenames has '-' instead of
>'_'.
>
>Use modinfo to correctly get the full path to the module.
>
>Signed-off-by: Ozan Çağlayan <ozan@pardus.org.tr>
>---
>This is just a trivial patch to pinpoint the problem. Usage of modinfo is faster than
>searching through the filesystem but may not be desirable as it brings a dependency
>to module-init-tools. Replacing underscore occurences by '-' can be another solution.
>
> scripts/markup_oops.pl | 5 +----
> 1 files changed, 1 insertions(+), 4 deletions(-)
>
>diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl
>index 8977401..bc14f4c 100644
>--- a/scripts/markup_oops.pl
>+++ b/scripts/markup_oops.pl
>@@ -184,10 +184,7 @@ if ($target eq "0") {
>
> # if it's a module, we need to find the .ko file and calculate a load offset
> if ($module ne "") {
>- my $dir = dirname($filename);
>- $dir = $dir . "/";
>- my $mod = $module . ".ko";
>- my $modulefile = `find $dir -name $mod | head -1`;
>+ my $modulefile = `modinfo $module | grep 'filename' | gawk '{ print \$2 }'`;
I know this works, but how about grep '^filename:' ? This is more strict.
Also, although on most Linux awk is just a symbol link to gawk,
but it is still better to use awk instead of gawk for portability reason.
> chomp($modulefile);
> $filename = $modulefile;
> if ($filename eq "") {
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] markup_oops: Use modinfo to avoid confusion with underscored module names
2009-08-06 12:21 [PATCH] markup_oops: Use modinfo to avoid confusion with underscored module names Ozan Çağlayan
2009-08-06 14:11 ` Arjan van de Ven
2009-08-07 1:42 ` Amerigo Wang
@ 2009-08-10 9:13 ` Ozan Çağlayan
2009-08-10 14:37 ` Américo Wang
2 siblings, 1 reply; 6+ messages in thread
From: Ozan Çağlayan @ 2009-08-10 9:13 UTC (permalink / raw)
To: linux-kernel; +Cc: arjan
When EIP is at a module having an underscore in its name, the current
code fails to find it because the module filenames has '-' instead of
'_'. Use modinfo for a better path finding.
Signed-off-by: Ozan Çağlayan <ozan@pardus.org.tr>
---
scripts/markup_oops.pl | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl
index 8977401..5f0fcb7 100644
--- a/scripts/markup_oops.pl
+++ b/scripts/markup_oops.pl
@@ -184,10 +184,7 @@ if ($target eq "0") {
# if it's a module, we need to find the .ko file and calculate a load offset
if ($module ne "") {
- my $dir = dirname($filename);
- $dir = $dir . "/";
- my $mod = $module . ".ko";
- my $modulefile = `find $dir -name $mod | head -1`;
+ my $modulefile = `modinfo $module | grep '^filename:' | awk '{ print \$2 }'`;
chomp($modulefile);
$filename = $modulefile;
if ($filename eq "") {
--
1.6.3.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] markup_oops: Use modinfo to avoid confusion with underscored module names
2009-08-10 9:13 ` [PATCH v2] " Ozan Çağlayan
@ 2009-08-10 14:37 ` Américo Wang
0 siblings, 0 replies; 6+ messages in thread
From: Américo Wang @ 2009-08-10 14:37 UTC (permalink / raw)
To: Ozan Çağlayan; +Cc: linux-kernel, arjan
On Mon, Aug 10, 2009 at 12:13:13PM +0300, Ozan Çağlayan wrote:
>When EIP is at a module having an underscore in its name, the current
>code fails to find it because the module filenames has '-' instead of
>'_'. Use modinfo for a better path finding.
>
>Signed-off-by: Ozan Çağlayan <ozan@pardus.org.tr>
Acked-by: WANG Cong <xiyou.wangcong@gmail.com>
Thanks!
>---
> scripts/markup_oops.pl | 5 +----
> 1 files changed, 1 insertions(+), 4 deletions(-)
>
>diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl
>index 8977401..5f0fcb7 100644
>--- a/scripts/markup_oops.pl
>+++ b/scripts/markup_oops.pl
>@@ -184,10 +184,7 @@ if ($target eq "0") {
>
> # if it's a module, we need to find the .ko file and calculate a load offset
> if ($module ne "") {
>- my $dir = dirname($filename);
>- $dir = $dir . "/";
>- my $mod = $module . ".ko";
>- my $modulefile = `find $dir -name $mod | head -1`;
>+ my $modulefile = `modinfo $module | grep '^filename:' | awk '{ print \$2 }'`;
> chomp($modulefile);
> $filename = $modulefile;
> if ($filename eq "") {
>--
>1.6.3.4
>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at http://www.tux.org/lkml/
--
Live like a child, think like the god.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-08-10 14:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-06 12:21 [PATCH] markup_oops: Use modinfo to avoid confusion with underscored module names Ozan Çağlayan
2009-08-06 14:11 ` Arjan van de Ven
2009-08-06 15:32 ` Ozan Çağlayan
2009-08-07 1:42 ` Amerigo Wang
2009-08-10 9:13 ` [PATCH v2] " Ozan Çağlayan
2009-08-10 14:37 ` Américo Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox