Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Jan 1997 18:34:31 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, jb@cimlogic.com.au
Cc:        current@freebsd.org
Subject:   Re: MOD_DECL in lkm.h
Message-ID:  <199701030734.SAA23958@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> >Shouldn't the MOD_DECL macro in lkm.h also have:
>> >
>> >static int name ## _stat __P((struct lkm_table *lkmtp, int cmd)); \
>> 
>> No, because it causes annoying warnings for modules that don't have a

>Hmmm. So, when you *do* have a function, it doesn't get checked and
>you get a warning. And when you don't, you don't get a warning that
>you don't. I think that's the wrong way around. Functional code
>should be checked. After all, the kernel is going to call it.

At least its parameters get checked and converted if it is prototyped
and used normally (in the DISPATCH() macro) and h.  Most modules have
no need for a stat function.  In fact, none of the modules in -current
needs one:

gnufpu, fpu, atapi, ipfw, ip_mroute, pcic, vfs's, various modules
using PSEUDEU_SET() (ppp, slip, ...):
All these use lkm_nullcmd() for the stat function.

joy:
Wastefully supplies its own null stat function joy_stat().
Neglects to declare it.  Gives it the wrong linkage (it should be
static).

qcam:
Wastefully supplies its own null stat function qcam_stat().
Neglects to declare it, but this is OK since it has a new-style
function header and is static so sufficient type information is
guaranteed to be in scope.

pcic:
This has weird (identical) load and unload functions.  This can work
because the lkm interface has too many ways of doing things - the
command type gets passed to the common load/unload function which
does its own handling.  There is no need for this - apparently the
author just didn't know the usual method.

pccard/skel.c:
This seems to be unused.  It no longer compiles, because it gives
a string arg to MOD_MISC() and uses nosys() for the stat function.
nosys() has the wrong type for a stat function.

Bruce



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