Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jul 2003 23:40:14 +0200
From:      "Poul-Henning Kamp" <phk@phk.freebsd.dk>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/dev/lnc if_lnc.c 
Message-ID:  <15673.1058910014@critter.freebsd.dk>
In-Reply-To: Your message of "Tue, 22 Jul 2003 15:18:28 MDT." <20030722.151828.83724752.imp@bsdimp.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20030722.151828.83724752.imp@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@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15673.1058910014>