public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [BUG] module-init-tools 0.9.3, rmmod modules with '-'
@ 2002-12-16 11:06 Vamsi Krishna S .
  2002-12-16 21:36 ` Rusty Russell
  0 siblings, 1 reply; 10+ messages in thread
From: Vamsi Krishna S . @ 2002-12-16 11:06 UTC (permalink / raw)
  To: rusty; +Cc: lkml

Hi Rusty,

It seems we cannot unload modules if they have a '-' in their name. 
filename2modname() in rmmod.c converts a '-' in the filename
to '_'. Why? Are dashes not allowed as part of module names?

For eg: (kernel 2.5.52/module-init-tools 0.9.3)

[root@llm10 test-modules]# ./insmod probe-test.o
[root@llm10 test-modules]# ./lsmod
Module                  Size  Used by
probe-test               943  0
[root@llm10 test-modules]# cat /proc/modules
probe-test 943 0
[root@llm10 test-modules]# ./rmmod -V
module-init-tools version 0.9.3
[root@llm10 test-modules]# ./rmmod probe-test
ERROR: Module probe_test does not exist in /proc/modules
                   ^note this

Editing filename2modname() to remove this special test for
'-' seems to fix it. But, this is done explicitly, so
I wonder if there is a deeper meaning to this. Can you
please take a look and explain?

Thanks,
Vamsi.
-- 
Vamsi Krishna S.
Linux Technology Center,
IBM Software Lab, Bangalore.
Ph: +91 80 5044959
Internet: vamsi@in.ibm.com
--
--- rmmod-old.c	2002-12-13 21:11:57.000000000 +0530
+++ rmmod.c	2002-12-13 21:10:44.000000000 +0530
@@ -157,9 +157,12 @@
 	else
 		afterslash++;
 
-	/* stop at first . */
+	/* Convert to underscores, stop at first . */
 	for (i = 0; afterslash[i] && afterslash[i] != '.'; i++) {
-		modname[i] = afterslash[i];
+		if (afterslash[i] == '-')
+			modname[i] = '_';
+		else
+			modname[i] = afterslash[i];
 	}
 	modname[i] = '\0';
 }

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] module-init-tools 0.9.3, rmmod modules with '-'
  2002-12-16 11:06 [BUG] module-init-tools 0.9.3, rmmod modules with '-' Vamsi Krishna S .
@ 2002-12-16 21:36 ` Rusty Russell
  2002-12-16 23:39   ` Zwane Mwaikambo
  0 siblings, 1 reply; 10+ messages in thread
From: Rusty Russell @ 2002-12-16 21:36 UTC (permalink / raw)
  To: vamsi; +Cc: lkml

In message <20021216163634.A29099@in.ibm.com> you write:
> Hi Rusty,
> 
> It seems we cannot unload modules if they have a '-' in their name. 
> filename2modname() in rmmod.c converts a '-' in the filename
> to '_'. Why? Are dashes not allowed as part of module names?

How did you get a module which has - in its name?  The build system
*should* turn them into _'s.

Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] module-init-tools 0.9.3, rmmod modules with '-'
  2002-12-16 21:36 ` Rusty Russell
@ 2002-12-16 23:39   ` Zwane Mwaikambo
  2002-12-17  0:17     ` Rusty Russell
  0 siblings, 1 reply; 10+ messages in thread
From: Zwane Mwaikambo @ 2002-12-16 23:39 UTC (permalink / raw)
  To: Rusty Russell; +Cc: vamsi, lkml

On Tue, 17 Dec 2002, Rusty Russell wrote:

> How did you get a module which has - in its name?  The build system
> *should* turn them into _'s.

ALSA modules?

-rw-r--r--    1 root     root       170125 Dec 15 00:10 snd-mixer-oss.ko
-rw-r--r--    1 root     root       143685 Dec 15 00:10 snd-mpu401-uart.ko
-rw-r--r--    1 root     root       312564 Dec 15 00:10 snd-opl3-lib.ko
-rw-r--r--    1 root     root       194307 Dec 15 00:10 snd-opl3sa2.ko
-rw-r--r--    1 root     root       612512 Dec 15 00:10 snd-opl3-synth.ko
-rw-r--r--    1 root     root      1160272 Dec 15 00:10 snd-pcm.ko

But they do get converted when we load ie snd-pcm turns into snd_pcm

-- 
function.linuxpower.ca

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] module-init-tools 0.9.3, rmmod modules with '-'
  2002-12-16 23:39   ` Zwane Mwaikambo
@ 2002-12-17  0:17     ` Rusty Russell
  2002-12-17  6:18       ` Vamsi Krishna S .
  0 siblings, 1 reply; 10+ messages in thread
From: Rusty Russell @ 2002-12-17  0:17 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: vamsi, lkml

In message <Pine.LNX.4.50.0212161831340.1804-100000@montezuma.mastecende.com> y
ou write:
> On Tue, 17 Dec 2002, Rusty Russell wrote:
> 
> > How did you get a module which has - in its name?  The build system
> > *should* turn them into _'s.
> 
> ALSA modules?
> 
> -rw-r--r--    1 root     root       170125 Dec 15 00:10 snd-mixer-oss.ko
> -rw-r--r--    1 root     root       143685 Dec 15 00:10 snd-mpu401-uart.ko
> -rw-r--r--    1 root     root       312564 Dec 15 00:10 snd-opl3-lib.ko
> -rw-r--r--    1 root     root       194307 Dec 15 00:10 snd-opl3sa2.ko
> -rw-r--r--    1 root     root       612512 Dec 15 00:10 snd-opl3-synth.ko
> -rw-r--r--    1 root     root      1160272 Dec 15 00:10 snd-pcm.ko
> 
> But they do get converted when we load ie snd-pcm turns into snd_pcm

Yes, the filenames are unchanged.  But if you modprobe snd-mixer-oss,
you'll see snd_mixer_oss in /proc/modules.  But rmmod "snd-mixer-oss"
works as expected.  Basically, the kernel and tools see them as
equivalent: anything else is a bug, please report.

BTW, this was done for (1) simplicity, (2) so KBUILD_MODNAME can be
used to construct identifiers, and (3) so parameters when the module
is built-in have a consistent name.

Hope that clarifies!
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] module-init-tools 0.9.3, rmmod modules with '-'
  2002-12-17  0:17     ` Rusty Russell
@ 2002-12-17  6:18       ` Vamsi Krishna S .
  2002-12-18  0:23         ` Rusty Russell
  0 siblings, 1 reply; 10+ messages in thread
From: Vamsi Krishna S . @ 2002-12-17  6:18 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Zwane Mwaikambo, lkml

On Tue, Dec 17, 2002 at 11:17:05AM +1100, Rusty Russell wrote:
> 
> BTW, this was done for (1) simplicity, (2) so KBUILD_MODNAME can be
> used to construct identifiers, and (3) so parameters when the module
> is built-in have a consistent name.
> 
Ok, I see it now, this magic happens in scripts/Makefile.lib. 
My module has been built outside the kernel build system, that's
why I saw this problem.

I guess avoiding '-' should do it, but is there a simple way to 
correctly build (simple, test) modules outside the kernel tree now?

Thanks,
Vamsi.
-- 
Vamsi Krishna S.
Linux Technology Center,
IBM Software Lab, Bangalore.
Ph: +91 80 5044959
Internet: vamsi@in.ibm.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [BUG] module-init-tools 0.9.3, rmmod modules with '-'
@ 2002-12-17  6:55 Osamu Tomita
  0 siblings, 0 replies; 10+ messages in thread
From: Osamu Tomita @ 2002-12-17  6:55 UTC (permalink / raw)
  To: 'Rusty Russell '; +Cc: 'lkml '

-----Original Message-----
From: Rusty Russell
To: Zwane Mwaikambo
Cc: vamsi@in.ibm.com; lkml
Sent: 2002/12/17 9:17
Subject: Re: [BUG] module-init-tools 0.9.3, rmmod modules with '-' 

> Yes, the filenames are unchanged.  But if you modprobe snd-mixer-oss,
> you'll see snd_mixer_oss in /proc/modules.  But rmmod "snd-mixer-oss"
> works as expected.  Basically, the kernel and tools see them as
> equivalent: anything else is a bug, please report.

I have another problem related this one.
"options snd-cs4232 port=0xf44 ..." in modprobe.conf is ignored.
This is created by modprobe.conf2modprobe.conf in module-init-
tools 0.9.3.
When I rewite it to "options snd_cs4232 port=0xf44 ..." by hand,
it works fine.

Regards,
Osamu

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] module-init-tools 0.9.3, rmmod modules with '-'
  2002-12-17  6:18       ` Vamsi Krishna S .
@ 2002-12-18  0:23         ` Rusty Russell
  2002-12-18 17:47           ` Kai Germaschewski
  0 siblings, 1 reply; 10+ messages in thread
From: Rusty Russell @ 2002-12-18  0:23 UTC (permalink / raw)
  To: vamsi; +Cc: Zwane Mwaikambo, lkml

In message <20021217114846.A30837@in.ibm.com> you write:
> On Tue, Dec 17, 2002 at 11:17:05AM +1100, Rusty Russell wrote:
> > 
> > BTW, this was done for (1) simplicity, (2) so KBUILD_MODNAME can be
> > used to construct identifiers, and (3) so parameters when the module
> > is built-in have a consistent name.
> > 
> Ok, I see it now, this magic happens in scripts/Makefile.lib. 
> My module has been built outside the kernel build system, that's
> why I saw this problem.
> 
> I guess avoiding '-' should do it, but is there a simple way to 
> correctly build (simple, test) modules outside the kernel tree now?

Has there ever been a simple way?  You can either use _ in the name,
or use tr on the -DKBUILD_MODNAME line, I guess.

Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] module-init-tools 0.9.3, rmmod modules with '-'
  2002-12-18  0:23         ` Rusty Russell
@ 2002-12-18 17:47           ` Kai Germaschewski
  2002-12-19  0:39             ` Rusty Russell
  2002-12-19  7:11             ` Vamsi Krishna S .
  0 siblings, 2 replies; 10+ messages in thread
From: Kai Germaschewski @ 2002-12-18 17:47 UTC (permalink / raw)
  To: Rusty Russell; +Cc: vamsi, Zwane Mwaikambo, lkml

On Wed, 18 Dec 2002, Rusty Russell wrote:

> In message <20021217114846.A30837@in.ibm.com> you write:
> > On Tue, Dec 17, 2002 at 11:17:05AM +1100, Rusty Russell wrote:
> > > 
> > > BTW, this was done for (1) simplicity, (2) so KBUILD_MODNAME can be
> > > used to construct identifiers, and (3) so parameters when the module
> > > is built-in have a consistent name.
> > > 
> > Ok, I see it now, this magic happens in scripts/Makefile.lib. 
> > My module has been built outside the kernel build system, that's
> > why I saw this problem.
> > 
> > I guess avoiding '-' should do it, but is there a simple way to 
> > correctly build (simple, test) modules outside the kernel tree now?
> 
> Has there ever been a simple way?

Well, you can do

cd my_module
echo "obj-m := my_module.o" > Makefile
vi my_module.c
make -C <path/to/kernel/src> SUBDIRS=$PWD modules

That's not too bad (and basically works for 2.4 as well)

--Kai



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] module-init-tools 0.9.3, rmmod modules with '-'
  2002-12-18 17:47           ` Kai Germaschewski
@ 2002-12-19  0:39             ` Rusty Russell
  2002-12-19  7:11             ` Vamsi Krishna S .
  1 sibling, 0 replies; 10+ messages in thread
From: Rusty Russell @ 2002-12-19  0:39 UTC (permalink / raw)
  To: Kai Germaschewski; +Cc: vamsi, Zwane Mwaikambo, lkml

In message <Pine.LNX.4.44.0212181144120.21707-100000@chaos.physics.uiowa.edu> y
ou write:
> On Wed, 18 Dec 2002, Rusty Russell wrote:
> > Has there ever been a simple way?
> 
> Well, you can do
> 
> cd my_module
> echo "obj-m := my_module.o" > Makefile
> vi my_module.c
> make -C <path/to/kernel/src> SUBDIRS=$PWD modules
> 
> That's not too bad (and basically works for 2.4 as well)

And then you're independent of changes in the build system, too.  I
like it.

Thanks for the tip!
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [BUG] module-init-tools 0.9.3, rmmod modules with '-'
  2002-12-18 17:47           ` Kai Germaschewski
  2002-12-19  0:39             ` Rusty Russell
@ 2002-12-19  7:11             ` Vamsi Krishna S .
  1 sibling, 0 replies; 10+ messages in thread
From: Vamsi Krishna S . @ 2002-12-19  7:11 UTC (permalink / raw)
  To: Kai Germaschewski; +Cc: Rusty Russell, Zwane Mwaikambo, lkml

On Wed, Dec 18, 2002 at 11:47:26AM -0600, Kai Germaschewski wrote:
> On Wed, 18 Dec 2002, Rusty Russell wrote:
> 
> > In message <20021217114846.A30837@in.ibm.com> you write:
> > > On Tue, Dec 17, 2002 at 11:17:05AM +1100, Rusty Russell wrote:
> > > > 
> > > > BTW, this was done for (1) simplicity, (2) so KBUILD_MODNAME can be
> > > > used to construct identifiers, and (3) so parameters when the module
> > > > is built-in have a consistent name.
> > > > 
> > > Ok, I see it now, this magic happens in scripts/Makefile.lib. 
> > > My module has been built outside the kernel build system, that's
> > > why I saw this problem.
> > > 
> > > I guess avoiding '-' should do it, but is there a simple way to 
> > > correctly build (simple, test) modules outside the kernel tree now?
> > 
> > Has there ever been a simple way?
> 
> Well, you can do
> 
> cd my_module
> echo "obj-m := my_module.o" > Makefile
> vi my_module.c
> make -C <path/to/kernel/src> SUBDIRS=$PWD modules
> 
> That's not too bad (and basically works for 2.4 as well)
> 
That's way cool! Thank you.

-- 
Vamsi Krishna S.
Linux Technology Center,
IBM Software Lab, Bangalore.
Ph: +91 80 5044959
Internet: vamsi@in.ibm.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-12-19  6:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-16 11:06 [BUG] module-init-tools 0.9.3, rmmod modules with '-' Vamsi Krishna S .
2002-12-16 21:36 ` Rusty Russell
2002-12-16 23:39   ` Zwane Mwaikambo
2002-12-17  0:17     ` Rusty Russell
2002-12-17  6:18       ` Vamsi Krishna S .
2002-12-18  0:23         ` Rusty Russell
2002-12-18 17:47           ` Kai Germaschewski
2002-12-19  0:39             ` Rusty Russell
2002-12-19  7:11             ` Vamsi Krishna S .
  -- strict thread matches above, loose matches on Subject: below --
2002-12-17  6:55 Osamu Tomita

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox