Re: module parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jan Hudec (bulb@ucw.cz) wrote:
> On Thu, Jun 10, 2004 at 20:11:31 +0530, aksingh@hss.hns.com wrote:
> > 
> > Hi,
> > 
> >   How are module parameters used in modules, i.e if I do an "insmod
> > my_module.o debug_level=4", then would the variable debug_level be
> 
> The variable will always be available, because you will declare it. If
> you pass debug_level=4, then it will have value 4 in spite of static
> initialization saying something else...
> 
> > available to me inside the module ?, can i do this inside the module if
> > (debug_level>2) printk(); ??
> 
> You can. But of course, #ifdefs are faster, runtimewise (which usualy
> does not matter for applications, but interrupt handlers might care).
> 
> > i have to access this debug level with argc, argv etc, or this would be
> > directly available as the same name ??
> 
> There is nothing like argv.

As Jan says, there are no argc, argv but some macro to define parameters
like :
MODULE_PARM(debug_level, "i"); where debug_level is an integer.

Please read :
http://www.xml.com/ldd/chapter/book/ch02.html#t6
for more information.

HTH
-- 
Amicalement

Christophe 

* GNU/Linux & UNIX developer and network administrator
* Membre RotomaLUG (http://www.rotomalug.org)
* Registered User #271267
* Email: c.lucas@ifrance.com
* Web Site: http://odie.mcom.fr/~clucas/

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux