Re: strings and command line args

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

 



begin Christine Ames <clgisotti@yahoo.com> 
> --- Peter Jay Salzman <p@dirac.org> wrote:
> > i'm trying to understand (in linux/module.h):
> > 
> >    /* Indirect stringification.  */
> > #define __MODULE_STRING_1(x)  #x
> > #define __MODULE_STRING(x) __MODULE_STRING_1(x)
> > 
> > which is used alot in MODULE_PARM (in linux/module.h):
> > 
> >    MODULE_PARM(mac, "1-" __MODULE_STRING(NS_MAX_CARDS) "s");
> > 
> > 
> > what is __MODULE_STRING() used for?  in what sense does it perform
> > "stringification"?
> > 
> 
> Sorry I can't help you here.  Prehaps someone with more experience
> will chip in.  Looks to my simple eyes that it does nothing.  Prehaps
> it's holding place for a real macro/function later...?
 
john got this for me.  :)
 
> > also, i'm not understanding the 2nd argument of MODULE_PARM.  i'd
> > be
> > happier with:
> > 
> >    MODULE_PARM(mac, "s");
> > 
> > there are two other items: "1-" and __MODULE_STRING(NS_MAX_CARDS). 
> > they
> > belong to the 2nd argument, which identifies the type of the
> > command
> > line argument.  i would've thought that would simply be "s" for a
> > string.  what do the two other items do?
> > 
> 
> See http://www.xml.com/ldd/chapter/book/ch02.html#t6 for a nice
> discussion.
 
arg, right ... right.  defining an array that takes commandline args.

i didn't understand it before, because i had no idea what
stringification was.  he's defining an array of size NS_MAX_CARDS.
the grammar confused me, but i got it now.

thanks.

pete

-- 
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
--
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