1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

Replaced nosys() by lkm_nullcmd(). Always call lkm load/unload/stat

functions instead of skipping the call if the function is nosys().
nosys() returned the wrong value as well as having the wrong type.
This commit is contained in:
Bruce Evans 1995-11-13 07:19:10 +00:00
parent 6a79936e89
commit 0ea3482342
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=12250
24 changed files with 69 additions and 54 deletions

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: coff.c,v 1.2 1995/05/30 06:06:00 rgrimes Exp $
* $Id: coff.c,v 1.3 1995/10/28 12:34:58 peter Exp $
*/
#include <sys/param.h>
@ -54,5 +54,6 @@ ibcs2_coff_unload(struct lkm_table *lkmtp, int cmd)
ibcs2_coff_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, ibcs2_coff_load, ibcs2_coff_unload, nosys);
DISPATCH(lkmtp, cmd, ver, ibcs2_coff_load, ibcs2_coff_unload,
lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: ibcs2.c,v 1.4 1995/10/10 08:20:28 swallace Exp $
* $Id: ibcs2.c,v 1.5 1995/10/28 12:35:03 peter Exp $
*/
#include <sys/param.h>
@ -59,5 +59,5 @@ ibcs2_unload(struct lkm_table *lkmtp, int cmd)
int
ibcs2_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, ibcs2_load, ibcs2_unload, nosys);
DISPATCH(lkmtp, cmd, ver, ibcs2_load, ibcs2_unload, lkm_nullcmd);
}

View File

@ -86,6 +86,5 @@ int s=splnet();
ipfw_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, ipfw_load, ipfw_unload, nosys);
DISPATCH(lkmtp, cmd, ver, ipfw_load, ipfw_unload, lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux.c,v 1.1 1995/06/25 17:29:48 sos Exp $
* $Id: linux.c,v 1.2 1995/10/28 12:35:07 peter Exp $
*/
#include <sys/param.h>
@ -54,5 +54,5 @@ linux_unload(struct lkm_table *lkmtp, int cmd)
linux_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, linux_load, linux_unload, nosys);
DISPATCH(lkmtp, cmd, ver, linux_load, linux_unload, lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: blank_saver.c,v 1.2 1995/05/30 06:06:13 rgrimes Exp $
* $Id: blank_saver.c,v 1.3 1995/10/28 12:35:09 peter Exp $
*/
#include <sys/param.h>
@ -77,5 +77,6 @@ blank_saver_unload(struct lkm_table *lkmtp, int cmd)
blank_saver_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, blank_saver_load, blank_saver_unload, nosys);
DISPATCH(lkmtp, cmd, ver, blank_saver_load, blank_saver_unload,
lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: fade_saver.c,v 1.2 1995/05/30 06:06:15 rgrimes Exp $
* $Id: fade_saver.c,v 1.3 1995/10/28 12:35:10 peter Exp $
*/
#include <sys/param.h>
@ -92,5 +92,6 @@ fade_saver_unload(struct lkm_table *lkmtp, int cmd)
fade_saver_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, fade_saver_load, fade_saver_unload, nosys);
DISPATCH(lkmtp, cmd, ver, fade_saver_load, fade_saver_unload,
lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: green_saver.c,v 1.2 1995/05/30 06:06:17 rgrimes Exp $
* $Id: green_saver.c,v 1.3 1995/10/28 12:35:11 peter Exp $
*/
#include <sys/param.h>
@ -81,5 +81,6 @@ green_saver_unload(struct lkm_table *lkmtp, int cmd)
green_saver_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, green_saver_load, green_saver_unload, nosys);
DISPATCH(lkmtp, cmd, ver, green_saver_load, green_saver_unload,
lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: snake_saver.c,v 1.5 1995/09/04 03:02:08 peter Exp $
* $Id: snake_saver.c,v 1.6 1995/10/28 12:35:12 peter Exp $
*/
#include <sys/param.h>
@ -118,5 +118,6 @@ snake_saver_unload(struct lkm_table *lkmtp, int cmd)
snake_saver_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, snake_saver_load, snake_saver_unload, nosys);
DISPATCH(lkmtp, cmd, ver, snake_saver_load, snake_saver_unload,
lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: star_saver.c,v 1.3 1995/05/30 06:06:20 rgrimes Exp $
* $Id: star_saver.c,v 1.4 1995/10/28 12:35:14 peter Exp $
*/
#include <sys/param.h>
@ -108,5 +108,6 @@ star_saver_unload(struct lkm_table *lkmtp, int cmd)
star_saver_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, star_saver_load, star_saver_unload, nosys);
DISPATCH(lkmtp, cmd, ver, star_saver_load, star_saver_unload,
lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: blank_saver.c,v 1.2 1995/05/30 06:06:13 rgrimes Exp $
* $Id: blank_saver.c,v 1.3 1995/10/28 12:35:09 peter Exp $
*/
#include <sys/param.h>
@ -77,5 +77,6 @@ blank_saver_unload(struct lkm_table *lkmtp, int cmd)
blank_saver_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, blank_saver_load, blank_saver_unload, nosys);
DISPATCH(lkmtp, cmd, ver, blank_saver_load, blank_saver_unload,
lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: fade_saver.c,v 1.2 1995/05/30 06:06:15 rgrimes Exp $
* $Id: fade_saver.c,v 1.3 1995/10/28 12:35:10 peter Exp $
*/
#include <sys/param.h>
@ -92,5 +92,6 @@ fade_saver_unload(struct lkm_table *lkmtp, int cmd)
fade_saver_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, fade_saver_load, fade_saver_unload, nosys);
DISPATCH(lkmtp, cmd, ver, fade_saver_load, fade_saver_unload,
lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: green_saver.c,v 1.2 1995/05/30 06:06:17 rgrimes Exp $
* $Id: green_saver.c,v 1.3 1995/10/28 12:35:11 peter Exp $
*/
#include <sys/param.h>
@ -81,5 +81,6 @@ green_saver_unload(struct lkm_table *lkmtp, int cmd)
green_saver_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, green_saver_load, green_saver_unload, nosys);
DISPATCH(lkmtp, cmd, ver, green_saver_load, green_saver_unload,
lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: snake_saver.c,v 1.5 1995/09/04 03:02:08 peter Exp $
* $Id: snake_saver.c,v 1.6 1995/10/28 12:35:12 peter Exp $
*/
#include <sys/param.h>
@ -118,5 +118,6 @@ snake_saver_unload(struct lkm_table *lkmtp, int cmd)
snake_saver_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, snake_saver_load, snake_saver_unload, nosys);
DISPATCH(lkmtp, cmd, ver, snake_saver_load, snake_saver_unload,
lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: star_saver.c,v 1.3 1995/05/30 06:06:20 rgrimes Exp $
* $Id: star_saver.c,v 1.4 1995/10/28 12:35:14 peter Exp $
*/
#include <sys/param.h>
@ -108,5 +108,6 @@ star_saver_unload(struct lkm_table *lkmtp, int cmd)
star_saver_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, star_saver_load, star_saver_unload, nosys);
DISPATCH(lkmtp, cmd, ver, star_saver_load, star_saver_unload,
lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: coff.c,v 1.2 1995/05/30 06:06:00 rgrimes Exp $
* $Id: coff.c,v 1.3 1995/10/28 12:34:58 peter Exp $
*/
#include <sys/param.h>
@ -54,5 +54,6 @@ ibcs2_coff_unload(struct lkm_table *lkmtp, int cmd)
ibcs2_coff_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, ibcs2_coff_load, ibcs2_coff_unload, nosys);
DISPATCH(lkmtp, cmd, ver, ibcs2_coff_load, ibcs2_coff_unload,
lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: ibcs2.c,v 1.4 1995/10/10 08:20:28 swallace Exp $
* $Id: ibcs2.c,v 1.5 1995/10/28 12:35:03 peter Exp $
*/
#include <sys/param.h>
@ -59,5 +59,5 @@ ibcs2_unload(struct lkm_table *lkmtp, int cmd)
int
ibcs2_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, ibcs2_load, ibcs2_unload, nosys);
DISPATCH(lkmtp, cmd, ver, ibcs2_load, ibcs2_unload, lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux.c,v 1.1 1995/06/25 17:29:48 sos Exp $
* $Id: linux.c,v 1.2 1995/10/28 12:35:07 peter Exp $
*/
#include <sys/param.h>
@ -54,5 +54,5 @@ linux_unload(struct lkm_table *lkmtp, int cmd)
linux_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, linux_load, linux_unload, nosys);
DISPATCH(lkmtp, cmd, ver, linux_load, linux_unload, lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: blank_saver.c,v 1.2 1995/05/30 06:06:13 rgrimes Exp $
* $Id: blank_saver.c,v 1.3 1995/10/28 12:35:09 peter Exp $
*/
#include <sys/param.h>
@ -77,5 +77,6 @@ blank_saver_unload(struct lkm_table *lkmtp, int cmd)
blank_saver_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, blank_saver_load, blank_saver_unload, nosys);
DISPATCH(lkmtp, cmd, ver, blank_saver_load, blank_saver_unload,
lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: fade_saver.c,v 1.2 1995/05/30 06:06:15 rgrimes Exp $
* $Id: fade_saver.c,v 1.3 1995/10/28 12:35:10 peter Exp $
*/
#include <sys/param.h>
@ -92,5 +92,6 @@ fade_saver_unload(struct lkm_table *lkmtp, int cmd)
fade_saver_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, fade_saver_load, fade_saver_unload, nosys);
DISPATCH(lkmtp, cmd, ver, fade_saver_load, fade_saver_unload,
lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: green_saver.c,v 1.2 1995/05/30 06:06:17 rgrimes Exp $
* $Id: green_saver.c,v 1.3 1995/10/28 12:35:11 peter Exp $
*/
#include <sys/param.h>
@ -81,5 +81,6 @@ green_saver_unload(struct lkm_table *lkmtp, int cmd)
green_saver_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, green_saver_load, green_saver_unload, nosys);
DISPATCH(lkmtp, cmd, ver, green_saver_load, green_saver_unload,
lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: snake_saver.c,v 1.5 1995/09/04 03:02:08 peter Exp $
* $Id: snake_saver.c,v 1.6 1995/10/28 12:35:12 peter Exp $
*/
#include <sys/param.h>
@ -118,5 +118,6 @@ snake_saver_unload(struct lkm_table *lkmtp, int cmd)
snake_saver_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, snake_saver_load, snake_saver_unload, nosys);
DISPATCH(lkmtp, cmd, ver, snake_saver_load, snake_saver_unload,
lkm_nullcmd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: star_saver.c,v 1.3 1995/05/30 06:06:20 rgrimes Exp $
* $Id: star_saver.c,v 1.4 1995/10/28 12:35:14 peter Exp $
*/
#include <sys/param.h>
@ -108,5 +108,6 @@ star_saver_unload(struct lkm_table *lkmtp, int cmd)
star_saver_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, star_saver_load, star_saver_unload, nosys);
DISPATCH(lkmtp, cmd, ver, star_saver_load, star_saver_unload,
lkm_nullcmd);
}

View File

@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* @(#)kernel.h 8.3 (Berkeley) 1/21/94
* $Id: kernel.h,v 1.12 1995/09/03 05:43:50 julian Exp $
* $Id: kernel.h,v 1.13 1995/09/09 18:10:29 davidg Exp $
*/
#ifndef _SYS_KERNEL_H_
@ -244,7 +244,7 @@ extern void kproc_start __P((void *udata));
int \
name ## _mod(struct lkm_table *lkmtp, int cmd, int ver) { \
DISPATCH(lkmtp, cmd, ver, name ## _load, name ## _unload, \
nosys); }
lkm_nullcmd); }
#else /* PSEUDO_LKM */
/*

View File

@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
* $Id: lkm.h,v 1.7 1995/08/05 07:39:02 davidg Exp $
*/
#ifndef _SYS_LKM_H_
@ -254,16 +254,14 @@ struct lkm_table {
};
extern int nosys();
/*
* DISPATCH -- body function for use in module entry point function;
* generally, the function body will consist entirely of a single
* DISPATCH line.
*
* If load/unload/stat are not "nosys", then they are called on each
* corresponding entry instance. "cmd" is passed to each function so
* that a single function can be used if desired.
* Call load/unload/stat on each corresponding entry instance. "cmd" is
* passed to each function so that a single function can be used if desired.
*/
#define DISPATCH(lkmtp,cmd,ver,load,unload,stat) \
if (ver != LKM_VERSION) \
@ -274,15 +272,15 @@ extern int nosys();
lkmtp->private.lkm_any = (struct lkm_any *)&_module; \
if (lkmexists(lkmtp)) /* !!! */ \
return EEXIST; \
if (load != nosys && (error = load(lkmtp, cmd))) \
if ((error = load(lkmtp, cmd))) \
return error; \
break; \
case LKM_E_UNLOAD: \
if (unload != nosys && (error = unload(lkmtp, cmd))) \
if ((error = unload(lkmtp, cmd))) \
return error; \
break; \
case LKM_E_STAT: \
if (stat != nosys && (error = stat(lkmtp, cmd))) \
if ((error = stat(lkmtp, cmd))) \
return error; \
break; \
} \
@ -290,6 +288,7 @@ extern int nosys();
int lkmdispatch __P((struct lkm_table *lkmtp, int cmd));
int lkmexists __P((struct lkm_table *lkmtp));
int lkm_nullcmd __P((struct lkm_table *lkmtp, int cmd));
#endif /* KERNEL */