cvs commit: src/sys/dev/lnc if_lnc.c

Poul-Henning Kamp phk at phk.freebsd.dk
Tue Jul 22 14:40:18 PDT 2003


In message <20030722.151828.83724752.imp at bsdimp.com>, "M. Warner Losh" writes:

>There's one other place that we use inlining.  We use it to make sure
>that modules do not contain references to certain symbols.  For
>example:
>
>/*
> * make this inline so that we don't have to worry about dangling references
> * to it in the modules or the code.
> */
>static __inline const struct pccard_product *
>pccard_product_lookup(device_t dev, const struct pccard_product *tab,
>    size_t ent_size, pccard_product_match_fn matchfn)
>{
>	return CARD_DO_PRODUCT_LOOKUP(device_get_parent(dev), dev,
>	    tab, ent_size, matchfn);
>}
>
>We do this to get the type safty of the function call and not have to
>make that a macro.  We do *NOT* want references to
>pccard_product_lookup, but the CARD_DO_.. kobj call allows the
>indirection that makes it possible to use the same module in kernels
>with and without pccard support.

I would argue that this should be solved by giving non-pccard kernels
a stub function which returns whatever error is logical (NULL in this
case ?) rather than abusing either of macros or inlines.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the cvs-src mailing list