lkml.org 
[lkml]   [2004]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: 2.6.2: "-" or "_", thats the question
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!

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

\
 
 \ /
  Last update: 2005-03-22 14:01    [W:1.298 / U:1.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site