freebsd-nq/lkm/ipfw/ipfw_lkm.c
Bruce Evans b3e24f9ce9 Changed the first (name) arg of MOD_DEV(), MOD_EXEC() and MOD_MISC()
from a string to an identifier so that it can be used to generate
declarations and strings.  It's much easier to stringize an identifier
than to identifize a string.  A uniform naming scheme must be used
for the automatically generated things to apply.  This is a feature.

Used the module identifer to generate prototypes for the module load,
unload and stat functions.  Removed the few prototypes for these that
already existed.

Used the module identifier to generate a unique struct tag in MOD_DEV().
This should probably be done for all the MOD_*() macros.

Moved the trailing semicolon from the MOD_*() macro definitions to the
macro invocations that didn't already (bogusly) have it.

Staticized the module load and unload functions.

Added function return types for the module load, unload and stat functions.

lkm/ibcs2/ibcs2.c:
Included <sys/sysproto.h> to get everything prototyped.
Cleaned up #includes.

lkm/ibcs2/ipfw.c:
Cleaned up #includes.

lkm/linux/linux.c:
The module name had to change from "linux_emulator" to "linux_mod" to
be automatically generated.
Cleaned up #includes.

lkm/syscons/*/*_saver.c:
Completed delcarations of function pointers.

sys/i386/isa/atapi.c:
The module name had to change from "atapi" to "atapi_mod" to be
automatically generated.

sys/i386/isa/wcd.c:
Used the fixed MOD_DEV().  This module has two devices and expanded the
macro in the source instead of fixing it.
The module names had to change from "wcd" and "rwcd" to "wcd_mod" and
"rwcd_mod" to be automatically generated.

sys/pccard/pcic.c:
The module name had to change from "pcic" to "pcic_mod" to be
automatically generated.
1995-11-14 07:35:57 +00:00

92 lines
1.9 KiB
C

/*
* Copyright (c) 1994 Ugen J.S.Antsilevich
*
* Redistribution and use in source forms, with and without modification,
* are permitted provided that this entire comment appears intact.
*
* Redistribution in binary form may occur without any restrictions.
* Obviously, it would be nice if you gave credit where credit is due
* but requiring it would be too onerous.
*
* This software is provided ``AS IS'' without any warranties of any kind.
*/
/*
* LKM init functions and stuff.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/domain.h>
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/kernel.h>
#include <sys/conf.h>
#include <sys/exec.h>
#include <sys/sysent.h>
#include <sys/lkm.h>
#include <net/if.h>
#include <net/route.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/ip_fw.h>
MOD_MISC(ipfw);
static int
ipfw_load(struct lkm_table *lkmtp, int cmd)
{
int s=splnet();
#ifdef IPFIREWALL
if (ip_fw_chk_ptr!=NULL || ip_fw_ctl_ptr!=NULL) {
uprintf("IpFw/IpAcct already loaded.\n");
return 1;
}
#endif
#ifdef IPACCT
if (ip_acct_cnt_ptr!=NULL || ip_acct_ctl_ptr!=NULL) {
uprintf("IpFw/IpAcct already loaded.\n");
return 1;
}
#endif
#ifdef IPFIREWALL
ip_fw_chk_ptr=&ip_fw_chk;
ip_fw_ctl_ptr=&ip_fw_ctl;
#endif
#ifdef IPACCT
ip_acct_cnt_ptr=&ip_acct_cnt;
ip_acct_ctl_ptr=&ip_acct_ctl;
#endif
uprintf("IpFw/IpAcct 1994(c) Ugen J.S.Antsilevich\n");
splx(s);
return 0;
}
static int
ipfw_unload(struct lkm_table *lkmtp, int cmd)
{
int s=splnet();
#ifdef IPFIREWALL
ip_fw_ctl_ptr=NULL;
ip_fw_chk_ptr=NULL;
#endif
#ifdef IPACCT
ip_acct_ctl_ptr=NULL;
ip_acct_cnt_ptr=NULL;
#endif
uprintf("IpFw/IpAcct removed.\n");
splx(s);
return 0;
}
int
ipfw_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, ipfw_load, ipfw_unload, lkm_nullcmd);
}