module-init-tools 0.9.3, rmmod modules with '-'

module-init-tools 0.9.3, rmmod modules with '-'

Post by Vamsi Krishna S » Tue, 17 Dec 2002 13:00:13



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)



Module                  Size  Used by
probe-test               943  0

probe-test 943 0

module-init-tools version 0.9.3

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

--
--- rmmod-old.c 2002-12-13 21:11:57.000000000 +0530

        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';
 }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

module-init-tools 0.9.3, rmmod modules with '-'

Post by Rusty Russel » Tue, 17 Dec 2002 23:50:07



Quote:> 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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

module-init-tools 0.9.3, rmmod modules with '-'

Post by Zwane Mwaikamb » Wed, 18 Dec 2002 01:40:13



> 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

module-init-tools 0.9.3, rmmod modules with '-'

Post by Rusty Russel » Wed, 18 Dec 2002 02:30:16



ou write:


> > 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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

module-init-tools 0.9.3, rmmod modules with '-'

Post by Vamsi Krishna S » Wed, 18 Dec 2002 08:10:09



> 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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

module-init-tools 0.9.3, rmmod modules with '-'

Post by Osamu Tomit » Wed, 18 Dec 2002 09:00:16


-----Original Message-----
From: Rusty Russell
To: Zwane Mwaikambo

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

module-init-tools 0.9.3, rmmod modules with '-'

Post by Rusty Russel » Thu, 19 Dec 2002 04:40:06




> > 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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

module-init-tools 0.9.3, rmmod modules with '-'

Post by Kai Germaschewsk » Thu, 19 Dec 2002 19:50:11





> > > 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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

module-init-tools 0.9.3, rmmod modules with '-'

Post by Rusty Russel » Fri, 20 Dec 2002 02:50:10



ou write:


> > 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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

module-init-tools 0.9.3, rmmod modules with '-'

Post by Vamsi Krishna S » Fri, 20 Dec 2002 09:00:10






> > > > 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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/