* Re: 2.6.2: "-" or "_", thats the question
[not found] ` <1prnS-4x8-1@gated-at.bofh.it>
@ 2004-02-15 15:02 ` Ryan Reich
2004-02-16 7:21 ` Harald Dunkel
0 siblings, 1 reply; 21+ messages in thread
From: Ryan Reich @ 2004-02-15 15:02 UTC (permalink / raw)
To: Harald Dunkel, linux-kernel
Harald Dunkel wrote:
> Coywolf Qi Hunt wrote:
>
>> Harald Dunkel wrote:
>>
>>>
>>> What would be the correct way to get the filename of a
>>> loaded module? The basename would be sufficient.
>>>
>>>
>> The symbole names used in source code, like function names tend to use
>> "_", while the file names use "-" IMHO.
>>
>
> Naturally the symbols in the code use '_', cause for C '-'
> is not allowed within symbol names.
>
> I am interested in the module file names. 'cat /proc/modules'
> should return the correct module names, but for some modules
> (like uhci_hcd vs uhci-hcd.ko) '_' and '-' are messed up.
According to the modprobe man page, the two symbols are interchangeable.
--
Ryan Reich
ryanr@uchicago.edu
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: 2.6.2: "-" or "_", thats the question
2004-02-15 15:02 ` 2.6.2: "-" or "_", thats the question Ryan Reich
@ 2004-02-16 7:21 ` Harald Dunkel
2004-02-16 8:48 ` Måns Rullgård
` (2 more replies)
0 siblings, 3 replies; 21+ messages in thread
From: Harald Dunkel @ 2004-02-16 7:21 UTC (permalink / raw)
To: Ryan Reich; +Cc: linux-kernel
Ryan Reich wrote:
> Harald Dunkel wrote:
>
>>
>> I am interested in the module file names. 'cat /proc/modules'
>> should return the correct module names, but for some modules
>> (like uhci_hcd vs uhci-hcd.ko) '_' and '-' are messed up.
>
>
> According to the modprobe man page, the two symbols are interchangeable.
>
I know. But this requires some very ugly workarounds outside
of module-init-tools. For example, if you want to check
whether a module $module_name has already been loaded, you
cannot use
grep -q "^${module_name} " /proc/modules
Instead you have to use a workaround like
x="`echo $module_name | sed -e 's/-/_/g'`"
cat /proc/modules | sed -e 's/-/_/g' | grep -q "^${x} "
This is inefficient and error-prone.
Maybe somebody has another idea for the workaround,
but I like the first version.
Regards
Harri
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: 2.6.2: "-" or "_", thats the question
2004-02-16 7:21 ` Harald Dunkel
@ 2004-02-16 8:48 ` Måns Rullgård
2004-02-16 11:11 ` Harald Dunkel
2004-02-16 14:13 ` Ryan Reich
2004-02-18 21:58 ` Tony Breeds
2 siblings, 1 reply; 21+ messages in thread
From: Måns Rullgård @ 2004-02-16 8:48 UTC (permalink / raw)
To: linux-kernel
Harald Dunkel <harald.dunkel@t-online.de> writes:
> Ryan Reich wrote:
>> Harald Dunkel wrote:
>>
>>>
>>> I am interested in the module file names. 'cat /proc/modules'
>>> should return the correct module names, but for some modules
>>> (like uhci_hcd vs uhci-hcd.ko) '_' and '-' are messed up.
>> According to the modprobe man page, the two symbols are
>> interchangeable.
>>
> I know. But this requires some very ugly workarounds outside
> of module-init-tools. For example, if you want to check
> whether a module $module_name has already been loaded, you
> cannot use
>
> grep -q "^${module_name} " /proc/modules
>
> Instead you have to use a workaround like
>
> x="`echo $module_name | sed -e 's/-/_/g'`"
> cat /proc/modules | sed -e 's/-/_/g' | grep -q "^${x} "
>
> This is inefficient and error-prone.
>
> Maybe somebody has another idea for the workaround,
> but I like the first version.
/proc/modules uses only _ so you could use ${module_name/-/_}.
--
Måns Rullgård
mru@kth.se
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: 2.6.2: "-" or "_", thats the question
2004-02-16 8:48 ` Måns Rullgård
@ 2004-02-16 11:11 ` Harald Dunkel
0 siblings, 0 replies; 21+ messages in thread
From: Harald Dunkel @ 2004-02-16 11:11 UTC (permalink / raw)
To: Måns Rullgård; +Cc: linux-kernel
Måns Rullgård wrote:
> Harald Dunkel <harald.dunkel@t-online.de> writes:
>
>
> /proc/modules uses only _ so you could use ${module_name/-/_}.
>
Please check the archive: My original complaint was about the
inconsistency between /proc/modules listing all modules with '_',
and the module filenames using both '-' and '_'. For me it is
not important which version is better. As a developer I have to
assume that '_' and '-' are ambiguous in this context. This
ambiguity is pretty strange for Unix, isn't it?
Regards
Harri
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: 2.6.2: "-" or "_", thats the question
2004-02-16 7:21 ` Harald Dunkel
2004-02-16 8:48 ` Måns Rullgård
@ 2004-02-16 14:13 ` Ryan Reich
2004-02-16 14:22 ` Ryan Reich
2004-02-18 21:58 ` Tony Breeds
2 siblings, 1 reply; 21+ messages in thread
From: Ryan Reich @ 2004-02-16 14:13 UTC (permalink / raw)
To: Harald Dunkel; +Cc: linux-kernel
On Mon, 16 Feb 2004, Harald Dunkel wrote:
> Ryan Reich wrote:
> > Harald Dunkel wrote:
> >
> >>
> >> I am interested in the module file names. 'cat /proc/modules'
> >> should return the correct module names, but for some modules
> >> (like uhci_hcd vs uhci-hcd.ko) '_' and '-' are messed up.
> >
> >
> > According to the modprobe man page, the two symbols are interchangeable.
> >
> I know. But this requires some very ugly workarounds outside
> of module-init-tools. For example, if you want to check
> whether a module $module_name has already been loaded, you
> cannot use
>
> grep -q "^${module_name} " /proc/modules
>
> Instead you have to use a workaround like
>
> x="`echo $module_name | sed -e 's/-/_/g'`"
> cat /proc/modules | sed -e 's/-/_/g' | grep -q "^${x} "
>
> This is inefficient and error-prone.
>
> Maybe somebody has another idea for the workaround,
> but I like the first version.
Well, you can shorten it by using 'tr':
cat /proc/modules | tr _ - | grep -q "^${module_name} "
/proc/modules uses the '_' and I suppose your problem is that your module name
list uses the '-', so this solves both at once.
--
Ryan Reich
ryanr@uchicago.edu
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: 2.6.2: "-" or "_", thats the question
2004-02-16 14:13 ` Ryan Reich
@ 2004-02-16 14:22 ` Ryan Reich
2004-02-16 19:01 ` Harald Dunkel
0 siblings, 1 reply; 21+ messages in thread
From: Ryan Reich @ 2004-02-16 14:22 UTC (permalink / raw)
To: Harald Dunkel; +Cc: linux-kernel
On Mon, 16 Feb 2004, Ryan Reich wrote:
> On Mon, 16 Feb 2004, Harald Dunkel wrote:
>
> > Ryan Reich wrote:
> > > Harald Dunkel wrote:
> > >
> > >>
> > >> I am interested in the module file names. 'cat /proc/modules'
> > >> should return the correct module names, but for some modules
> > >> (like uhci_hcd vs uhci-hcd.ko) '_' and '-' are messed up.
> > >
> > >
> > > According to the modprobe man page, the two symbols are interchangeable.
> > >
> > I know. But this requires some very ugly workarounds outside
> > of module-init-tools. For example, if you want to check
> > whether a module $module_name has already been loaded, you
> > cannot use
> >
> > grep -q "^${module_name} " /proc/modules
> >
> > Instead you have to use a workaround like
> >
> > x="`echo $module_name | sed -e 's/-/_/g'`"
> > cat /proc/modules | sed -e 's/-/_/g' | grep -q "^${x} "
> >
> > This is inefficient and error-prone.
> >
> > Maybe somebody has another idea for the workaround,
> > but I like the first version.
>
> Well, you can shorten it by using 'tr':
>
> cat /proc/modules | tr _ - | grep -q "^${module_name} "
>
> /proc/modules uses the '_' and I suppose your problem is that your module name
> list uses the '-', so this solves both at once.
Sorry, I didn't realize that your problem was also the inconsistency in module
names. Someone else suggested using a shell expansion; you could try
cat /proc/modules | tr _ - | grep -q "^${module_name/_/-}"
which is both short and works.
--
Ryan Reich
ryanr@uchicago.edu
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: 2.6.2: "-" or "_", thats the question
2004-02-16 14:22 ` Ryan Reich
@ 2004-02-16 19:01 ` Harald Dunkel
0 siblings, 0 replies; 21+ messages in thread
From: Harald Dunkel @ 2004-02-16 19:01 UTC (permalink / raw)
To: Ryan Reich; +Cc: linux-kernel
Ryan Reich wrote:
> On Mon, 16 Feb 2004, Ryan Reich wrote:
>
>
>
> Sorry, I didn't realize that your problem was also the inconsistency in module
> names. Someone else suggested using a shell expansion; you could try
>
> cat /proc/modules | tr _ - | grep -q "^${module_name/_/-}"
>
> which is both short and works.
>
tr is usually in /usr/bin, which might not be available
at boot time. And probably you mean 'grep -q "^${module_name//_/-}"'
Did I mention that the inconsistency requires ugly and error-
prone workarounds? QED
Regards
Harri
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: 2.6.2: "-" or "_", thats the question
2004-02-16 7:21 ` Harald Dunkel
2004-02-16 8:48 ` Måns Rullgård
2004-02-16 14:13 ` Ryan Reich
@ 2004-02-18 21:58 ` Tony Breeds
2 siblings, 0 replies; 21+ messages in thread
From: Tony Breeds @ 2004-02-18 21:58 UTC (permalink / raw)
To: Linux Kernel ML
On Mon, Feb 16, 2004 at 08:21:09AM +0100, Harald Dunkel wrote:
> I know. But this requires some very ugly workarounds outside
> of module-init-tools. For example, if you want to check
> whether a module $module_name has already been loaded, you
> cannot use
>
> grep -q "^${module_name} " /proc/modules
>
> Instead you have to use a workaround like
>
> x="`echo $module_name | sed -e 's/-/_/g'`"
> cat /proc/modules | sed -e 's/-/_/g' | grep -q "^${x} "
>
> This is inefficient and error-prone.
>
> Maybe somebody has another idea for the workaround,
> but I like the first version.
just run modprobe? Then you don't have to care.
IN_KERNEL=$(/sbin/modprobe -vn "${module_name}")
if [ -z "${IN_KERNEL}" ; then
/bin/echo "Module: ${module_name} is in the kernel"
else
/bin/echo "Module: ${module_name} would need to be loaded"
/bin/echo "${IN_KERNEL}"
fi
Or similar. Yeah it's a little ugly but only as prone to failure as
module-init-tools
Yours Tony
linux.conf.au http://lca2005.linux.org.au/
Apr 18-23 2005 The Australian Linux Technical Conference!
^ permalink raw reply [flat|nested] 21+ messages in thread
[parent not found: <1pw4i-hM-27@gated-at.bofh.it>]
* 2.6.2: "-" or "_", thats the question
@ 2004-02-11 19:54 Harald Dunkel
2004-02-15 2:38 ` Coywolf Qi Hunt
0 siblings, 1 reply; 21+ messages in thread
From: Harald Dunkel @ 2004-02-11 19:54 UTC (permalink / raw)
To: linux-kernel
Hi folks,
'cat /proc/modules' returns most (all?) of the module names with
"_", e.g.
:
ipt_conntrack
ip_conntrack
iptable_filter
ip_tables
uhci_hcd
ohci_hcd
ehci_hcd
:
Very consistent. But the filenames of some kernel modules are
still written with "-", e.g.
/lib/modules/2.6.2/kernel/drivers/usb/host/ehci-hcd.ko
/lib/modules/2.6.2/kernel/drivers/usb/host/ohci-hcd.ko
/lib/modules/2.6.2/kernel/drivers/usb/host/uhci-hcd.ko
What would be the correct way to get the filename of a
loaded module? The basename would be sufficient.
Regards
Harri
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: 2.6.2: "-" or "_", thats the question
2004-02-11 19:54 Harald Dunkel
@ 2004-02-15 2:38 ` Coywolf Qi Hunt
2004-02-15 9:58 ` Harald Dunkel
0 siblings, 1 reply; 21+ messages in thread
From: Coywolf Qi Hunt @ 2004-02-15 2:38 UTC (permalink / raw)
To: Harald Dunkel; +Cc: linux-kernel
Harald Dunkel wrote:
> Hi folks,
>
> 'cat /proc/modules' returns most (all?) of the module names with
> "_", e.g.
>
> :
> ipt_conntrack
> ip_conntrack
> iptable_filter
> ip_tables
> uhci_hcd
> ohci_hcd
> ehci_hcd
> :
>
> Very consistent. But the filenames of some kernel modules are
> still written with "-", e.g.
>
> /lib/modules/2.6.2/kernel/drivers/usb/host/ehci-hcd.ko
> /lib/modules/2.6.2/kernel/drivers/usb/host/ohci-hcd.ko
> /lib/modules/2.6.2/kernel/drivers/usb/host/uhci-hcd.ko
>
> What would be the correct way to get the filename of a
> loaded module? The basename would be sufficient.
>
>
> Regards
>
> Harri
> -
> 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/
>
>
The symbole names used in source code, like function names tend to use
"_", while the file names use "-" IMHO.
Coywolf Qi Hunt
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: 2.6.2: "-" or "_", thats the question
2004-02-15 2:38 ` Coywolf Qi Hunt
@ 2004-02-15 9:58 ` Harald Dunkel
2004-02-17 7:41 ` Rusty Russell
0 siblings, 1 reply; 21+ messages in thread
From: Harald Dunkel @ 2004-02-15 9:58 UTC (permalink / raw)
To: Coywolf Qi Hunt; +Cc: linux-kernel
Coywolf Qi Hunt wrote:
> Harald Dunkel wrote:
>
>>
>> What would be the correct way to get the filename of a
>> loaded module? The basename would be sufficient.
>>
>>
> The symbole names used in source code, like function names tend to use
> "_", while the file names use "-" IMHO.
>
Naturally the symbols in the code use '_', cause for C '-'
is not allowed within symbol names.
I am interested in the module file names. 'cat /proc/modules'
should return the correct module names, but for some modules
(like uhci_hcd vs uhci-hcd.ko) '_' and '-' are messed up.
Regards
Harri
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: 2.6.2: "-" or "_", thats the question
2004-02-15 9:58 ` Harald Dunkel
@ 2004-02-17 7:41 ` Rusty Russell
2004-02-18 1:28 ` Wakko Warner
0 siblings, 1 reply; 21+ messages in thread
From: Rusty Russell @ 2004-02-17 7:41 UTC (permalink / raw)
To: Harald Dunkel; +Cc: coywolf, linux-kernel
On Sun, 15 Feb 2004 10:58:54 +0100
Harald Dunkel <harald.dunkel@t-online.de> wrote:
> Coywolf Qi Hunt wrote:
> > Harald Dunkel wrote:
> >
> >>
> >> What would be the correct way to get the filename of a
> >> loaded module? The basename would be sufficient.
> >>
> >>
> > The symbole names used in source code, like function names tend to use
> > "_", while the file names use "-" IMHO.
> >
>
> Naturally the symbols in the code use '_', cause for C '-'
> is not allowed within symbol names.
>
> I am interested in the module file names. 'cat /proc/modules'
> should return the correct module names, but for some modules
> (like uhci_hcd vs uhci-hcd.ko) '_' and '-' are messed up.
We canonicalize them at every point: you can use both.
Most users don't want to remember that it's ip_conntrack but uhci-hcd.
Hope that clarifies,
Rusty.
--
there are those who do and those who hang on and you don't see too
many doers quoting their contemporaries. -- Larry McVoy
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: 2.6.2: "-" or "_", thats the question
2004-02-17 7:41 ` Rusty Russell
@ 2004-02-18 1:28 ` Wakko Warner
2004-02-18 8:46 ` Harald Dunkel
0 siblings, 1 reply; 21+ messages in thread
From: Wakko Warner @ 2004-02-18 1:28 UTC (permalink / raw)
To: linux-kernel
Rusty Russell wrote:
> Most users don't want to remember that it's ip_conntrack but uhci-hcd.
I'd like to chime in about this.
I'd prefer it be - all the way around (I know I can use either). Since I
can ask for module uhci_hcd or uhci-hcd and get uhci-hcd.ko loaded, I've
been using -. It's a bit easier to type since I don't have to hit shift for
each _
--
Lab tests show that use of micro$oft causes cancer in lab animals
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: 2.6.2: "-" or "_", thats the question
2004-02-18 1:28 ` Wakko Warner
@ 2004-02-18 8:46 ` Harald Dunkel
2004-02-18 17:25 ` Wakko Warner
0 siblings, 1 reply; 21+ messages in thread
From: Harald Dunkel @ 2004-02-18 8:46 UTC (permalink / raw)
To: Wakko Warner, rusty; +Cc: linux-kernel
Wakko Warner wrote:
> Rusty Russell wrote:
>
>>Most users don't want to remember that it's ip_conntrack but uhci-hcd.
>
>
> I'd like to chime in about this.
>
> I'd prefer it be - all the way around (I know I can use either). Since I
> can ask for module uhci_hcd or uhci-hcd and get uhci-hcd.ko loaded, I've
> been using -. It's a bit easier to type since I don't have to hit shift for
> each _
>
It is really not important here whether anybody prefers '_'
or '-'. IMHO everybody should be free to use both, even
within one symbol filename.
What I do not like is that /proc/modules lies about the
names of the loaded modules. I can understand that you
are not affected by this problem, because all you see is
module-init-tools, but others _are_ affected.
Regards
Harri
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: 2.6.2: "-" or "_", thats the question
2004-02-18 8:46 ` Harald Dunkel
@ 2004-02-18 17:25 ` Wakko Warner
2004-02-19 1:52 ` Randy.Dunlap
0 siblings, 1 reply; 21+ messages in thread
From: Wakko Warner @ 2004-02-18 17:25 UTC (permalink / raw)
To: Harald Dunkel; +Cc: linux-kernel
> >>Most users don't want to remember that it's ip_conntrack but uhci-hcd.
> >
> > I'd like to chime in about this.
> >
> > I'd prefer it be - all the way around (I know I can use either). Since I
> > can ask for module uhci_hcd or uhci-hcd and get uhci-hcd.ko loaded, I've
> > been using -. It's a bit easier to type since I don't have to hit shift for
> > each _
> >
>
> It is really not important here whether anybody prefers '_'
> or '-'. IMHO everybody should be free to use both, even
> within one symbol filename.
That's good. This is pretty much all I want =)
> What I do not like is that /proc/modules lies about the
> names of the loaded modules. I can understand that you
> are not affected by this problem, because all you see is
> module-init-tools, but others _are_ affected.
I did not realize that /proc/modules lied. From a user standpoint, it may
not be /proc/modules lying, it may be module-init-tools lying to the kernel
about the module it just loaded. I don't know, I have not looked at the
code for module-init-tools. I checked one of my 2.6 machines and indeed all
modules are with an _ instead of a -
When I first noticed that [eou]hci_hcd was loaded I figured all modules were
using _ now. When I was playing with alsa it never clicked in about the -
and _. I see now that it's _ in /proc/modules.
[OT] why is the usb drivers named with -hcd at the end anyway?
--
Lab tests show that use of micro$oft causes cancer in lab animals
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: 2.6.2: "-" or "_", thats the question
2004-02-18 17:25 ` Wakko Warner
@ 2004-02-19 1:52 ` Randy.Dunlap
0 siblings, 0 replies; 21+ messages in thread
From: Randy.Dunlap @ 2004-02-19 1:52 UTC (permalink / raw)
To: Wakko Warner; +Cc: harald.dunkel, linux-kernel
On Wed, 18 Feb 2004 12:25:23 -0500 Wakko Warner <wakko@animx.eu.org> wrote:
| When I first noticed that [eou]hci_hcd was loaded I figured all modules were
| using _ now. When I was playing with alsa it never clicked in about the -
| and _. I see now that it's _ in /proc/modules.
|
| [OT] why is the usb drivers named with -hcd at the end anyway?
Because some USB drivers are for USB devices (no -hcd at end)
and some of them are USB host controller drivers (HCDs), not for
USB devices per se. It's just a simple differeniation.
--
~Randy
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2004-02-19 2:01 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1o903-5d8-7@gated-at.bofh.it>
[not found] ` <1pkw6-3BU-3@gated-at.bofh.it>
[not found] ` <1prnS-4x8-1@gated-at.bofh.it>
2004-02-15 15:02 ` 2.6.2: "-" or "_", thats the question Ryan Reich
2004-02-16 7:21 ` Harald Dunkel
2004-02-16 8:48 ` Måns Rullgård
2004-02-16 11:11 ` Harald Dunkel
2004-02-16 14:13 ` Ryan Reich
2004-02-16 14:22 ` Ryan Reich
2004-02-16 19:01 ` Harald Dunkel
2004-02-18 21:58 ` Tony Breeds
[not found] <1pw4i-hM-27@gated-at.bofh.it>
[not found] ` <1pw4i-hM-29@gated-at.bofh.it>
[not found] ` <1pw4i-hM-31@gated-at.bofh.it>
[not found] ` <1pw4i-hM-25@gated-at.bofh.it>
[not found] ` <1pLmG-4E7-5@gated-at.bofh.it>
[not found] ` <1pRLz-21o-33@gated-at.bofh.it>
[not found] ` <1pRVi-2am-27@gated-at.bofh.it>
[not found] ` <1pWi8-65a-11@gated-at.bofh.it>
2004-02-16 23:28 ` Ryan Reich
2004-02-17 6:09 ` Harald Dunkel
2004-02-17 16:02 ` Sam Ravnborg
2004-02-17 16:01 ` Arjan van de Ven
2004-02-17 19:49 ` Harald Dunkel
2004-02-11 19:54 Harald Dunkel
2004-02-15 2:38 ` Coywolf Qi Hunt
2004-02-15 9:58 ` Harald Dunkel
2004-02-17 7:41 ` Rusty Russell
2004-02-18 1:28 ` Wakko Warner
2004-02-18 8:46 ` Harald Dunkel
2004-02-18 17:25 ` Wakko Warner
2004-02-19 1:52 ` Randy.Dunlap
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox