Re: 2.6.2: "-" or "_", thats the question

Måns Rullgård
2004-02-16T08:48:12Z

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