From owner-freebsd-current Thu Jan 2 23:35:34 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id XAA05248 for current-outgoing; Thu, 2 Jan 1997 23:35:34 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id XAA05243 for ; Thu, 2 Jan 1997 23:35:29 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.3/8.6.9) id SAA23958; Fri, 3 Jan 1997 18:34:31 +1100 Date: Fri, 3 Jan 1997 18:34:31 +1100 From: Bruce Evans Message-Id: <199701030734.SAA23958@godzilla.zeta.org.au> To: bde@zeta.org.au, jb@cimlogic.com.au Subject: Re: MOD_DECL in lkm.h Cc: current@freebsd.org Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >> >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