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

M. Warner Losh imp at bsdimp.com
Tue Jul 22 15:40:02 PDT 2003


In message: <15673.1058910014 at critter.freebsd.dk>
            "Poul-Henning Kamp" <phk at phk.freebsd.dk> writes:
: 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.

There's no convenient way to do that, to be honest.  Easy to say, hard
to do.  And you need it for pci, eisa, isa and other things.  And it
doesn't let you then load pccard after boot.  I don't think it is a
viable solution.

Warner


More information about the cvs-src mailing list