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: [email protected]
--
--- 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';
}
In message <[email protected]> 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.
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
In message <[email protected]> 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.
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: [email protected]
-----Original Message-----
From: Rusty Russell
To: Zwane Mwaikambo
Cc: [email protected]; 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
In message <[email protected]> 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.
On Wed, 18 Dec 2002, Rusty Russell wrote:
> In message <[email protected]> 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
In message <[email protected]> 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.
On Wed, Dec 18, 2002 at 11:47:26AM -0600, Kai Germaschewski wrote:
> On Wed, 18 Dec 2002, Rusty Russell wrote:
>
> > In message <[email protected]> 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: [email protected]