M: Matti Aarnio
E: mea@utu.fi
-D: Dynamicized network socket allocations, LILO for AHA1542
+D: LILO for AHA1542, modularized several of drivers/net/,
+D: dynamic SLIP devices, dynamic /proc/net/, true size /proc/ksyms,
+D: and other hacks..
+D: Documenting various parts of network subsystem (kernel side)
N: Werner Almesberger
E: almesber@bernina.ethz.ch
VERSION = 1
PATCHLEVEL = 3
-SUBLEVEL = 16
+SUBLEVEL = 17
ARCH = i386
}; \
\
if [ -f NET_MODULES ]; then inst_mod NET_MODULES net; fi; \
+ if [ -f IPV4_MODULES ]; then inst_mod IPV4_MODULES ipv4; fi; \
if [ -f SCSI_MODULES ]; then inst_mod SCSI_MODULES scsi; fi; \
if [ -f FS_MODULES ]; then inst_mod FS_MODULES fs; fi; \
\
OBJS := $(OBJS) floppy.o
SRCS := $(SRCS) floppy.c
else
-BLOCK_MODULE_OBJS := $(MODULES) floppy.o
+BLOCK_MODULE_OBJS := $(BLOCK_MODULE_OBJS) floppy.o
endif
ifdef CONFIG_AZTCD
$(AR) rcs block.a $(OBJS)
sync
+ifdef BLOCK_MODULE_OBJS
dep:
$(CPP) -M $(SRCS) > .depend
-ifdef BLOCK_MODULE_OBJS
$(CPP) -M -DMODULE $(BLOCK_MODULE_OBJS:.o=.c) >> .depend
+else
+dep:
+ $(CPP) -M $(SRCS) > .depend
endif
modules: $(BLOCK_MODULE_OBJS)
endif
+ifdef MODULES
dep: uni_hash_tbl.h
$(CPP) -M $(SRCS) > .depend
-ifdef MODULES
$(CPP) -M -DMODULE $(MODULES:.o=.c) >> .depend
+else
+dep: uni_hash_tbl.h
+ $(CPP) -M $(SRCS) > .depend
endif
conmakehash: conmakehash.c
static const char *version =
"3c503.c:v1.10 9/23/93 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
+
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/errno.h>
outb_p(ei_status.interface_num == 0 ? ECNTRL_THIN : ECNTRL_AUI, E33G_CNTRL);
return 0;
}
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+static struct device el2_drv =
+{"3c503", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, el2_probe };
+
+static struct device el2pio_drv =
+{"3c503pio", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, el2_pio_probe };
+
+int io = 0;
+int irq = 0;
+
+static int no_pio = 1;
+int init_module(void)
+{
+ int rc1, rc2;
+ el2_drv.base_addr = io;
+ el2_drv.irq = irq;
+ el2pio_drv.base_addr = io;
+ el2pio_drv.irq = irq;
+
+ rc2 = 0;
+ no_pio = 1;
+ rc1 = register_netdev(&el2_drv);
+ if (rc1 != 0) {
+ rc2 = register_netdev(&el2pio_drv);
+ no_pio = 0;
+ }
+
+ if (rc1 != 0 && rc2 != 0)
+ return -EIO;
+ return 0;
+}
+
+void
+cleanup_module(void)
+{
+ if (MOD_IN_USE)
+ printk("3c503: device busy, remove delayed\n");
+ else {
+ if (no_pio) {
+ unregister_netdev(&el2_drv);
+ } else {
+ unregister_netdev(&el2pio_drv);
+ }
+ }
+}
+#endif /* MODULE */
\f
/*
* Local variables:
*
*/
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/string.h>
if (elp_debug >= 3)
printk("%s: start receive command sent\n", dev->name);
+#ifdef MODULE
+ MOD_INC_USE_COUNT;
+#endif
+
return 0; /* Always succeed */
}
*/
irq2dev_map[dev->irq] = 0;
+#ifdef MODULE
+ MOD_DEC_USE_COUNT;
+#endif
+
return 0;
}
elp_init(dev);
return 0;
}
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+static struct device dev_3c505 = {
+ " " /*"3c505"*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, elplus_probe };
+
+int io = 0;
+int irq = 0;
+
+int init_module(void)
+{
+ dev_3c505.base_addr = io;
+ dev_3c505.irq = irq;
+ if (register_netdev(&dev_3c505) != 0) {
+ printk("3c505: register_netdev() returned non-zero.\n");
+ return -EIO;
+ }
+ return 0;
+}
+
+void
+cleanup_module(void)
+{
+ if (MOD_IN_USE)
+ printk("3c505: device busy, remove delayed\n");
+ else
+ {
+ unregister_netdev(&dev_3c505);
+ }
+}
+#endif /* MODULE */
static const char *version =
"3c507.c:v1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
+
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
#include <linux/config.h>
/*
dev->tbusy = 0;
dev->interrupt = 0;
dev->start = 1;
+
+#ifdef MODULE
+ MOD_INC_USE_COUNT;
+#endif
+
return 0;
}
/* Update the statistics here. */
+#ifdef MODULE
+ MOD_DEC_USE_COUNT;
+#endif
+
return 0;
}
lp->rx_head = rx_head;
lp->rx_tail = rx_tail;
}
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+static struct device dev_3c507 = {
+ " " /*"3c507"*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, el16_probe };
+
+int io = 0;
+int irq = 0;
+
+int init_module(void)
+{
+ dev_3c507.base_addr = io;
+ dev_3c507.irq = irq;
+ if (register_netdev(&dev_3c507) != 0) {
+ printk("3c507: register_netdev() returned non-zero.\n");
+ return -EIO;
+ }
+ return 0;
+}
+
+void
+cleanup_module(void)
+{
+ if (MOD_IN_USE)
+ printk("3c507: device busy, remove delayed\n");
+ else
+ {
+ unregister_netdev(&dev_3c507);
+ }
+}
+#endif /* MODULE */
\f
/*
* Local variables:
#ifdef EI_DEBUG
int ei_debug = EI_DEBUG;
#else
-int ei_debug = 1;
+int ei_debug = 0;
+#endif
+#ifdef EI_NOPINGPONG
+static int ei_pingpong = 0;
+#else
+static int ei_pingpong = 1;
#endif
/* Max number of packets received at one Intr.
dev->priv = kmalloc(sizeof(struct ei_device), GFP_KERNEL);
memset(dev->priv, 0, sizeof(struct ei_device));
ei_local = (struct ei_device *)dev->priv;
-#ifndef NO_PINGPONG
- ei_local->pingpong = 1;
-#endif
+ ei_local->pingpong = ei_pingpong;
}
/* The open call may be overridden by the card-specific code. */
# used. Usually pointless under Linux.
# show_all_SAPROM Show the entire address PROM, not just the
# ethernet address, during boot.
-# rw_bugfix Patch an obscure bug with a version of the 8390.
+# CONFIG_NE_RW_BUGFIX Patch an obscure bug with a version of the 8390.
+# CONFIG_NE_SANITY ??
# CONFIG_HPLAN The HP-LAN driver (for 8390-based boards only).
# rw_bugfix Fix the same obscure bug.
# CONFIG_EL2 The 3c503 EtherLink II driver
ifdef CONFIG_IBMTR
NETDRV_OBJS := $(NETDRV_OBJS) ibmtr.o
+else
+MODULES := $(MODULES) ibmtr.o
endif
ifdef CONFIG_SK_G16
ifdef CONFIG_NET_IPIP
NETDRV_OBJS := $(NETDRV_OBJS) tunnel.o
+else
+MODULES := $(MODULES) tunnel.o
endif
ifdef CONFIG_HP100
ifdef CONFIG_WD80x3
NETDRV_OBJS := $(NETDRV_OBJS) wd.o
CONFIG_8390 = CONFIG_8390
+else
+MODULES := $(MODULES) wd.o
endif
wd.o: wd.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(WD_OPTS) -c $<
ifdef CONFIG_EL2
NETDRV_OBJS := $(NETDRV_OBJS) 3c503.o
CONFIG_8390 = CONFIG_8390
+else
+MODULES := $(MODULES) 3c503.o
endif
3c503.o: 3c503.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(EL2_OPTS) -c $<
ifdef CONFIG_NE2000
NETDRV_OBJS := $(NETDRV_OBJS) ne.o
CONFIG_8390 = CONFIG_8390
+else
+MODULES := $(MODULES) ne.o
endif
ne.o: ne.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(NE_OPTS) -c $<
ifdef CONFIG_HPLAN
NETDRV_OBJS := $(NETDRV_OBJS) hp.o
CONFIG_8390 = CONFIG_8390
+else
+MODULES := $(MODULES) hp.o
endif
hp.o: hp.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(HP_OPTS) -c $<
ifdef CONFIG_HPLAN_PLUS
NETDRV_OBJS := $(NETDRV_OBJS) hp-plus.o
CONFIG_8390 = CONFIG_8390
+else
+MODULES := $(MODULES) hp-plus.o
endif
ifdef CONFIG_ULTRA
NETDRV_OBJS := $(NETDRV_OBJS) smc-ultra.o
CONFIG_8390 = CONFIG_8390
+else
+MODULES := $(MODULES) smc-ultra.o
endif
ifdef CONFIG_E2100
NETDRV_OBJS := $(NETDRV_OBJS) e2100.o
CONFIG_8390 = CONFIG_8390
+else
+MODULES := $(MODULES) e2100.o
endif
ifdef CONFIG_PLIP
$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
ifdef CONFIG_DE650
-NETDRV_OBJS := $(NETDRV_OBJS) de650.o
+ETDRV_OBJS := $(NETDRV_OBJS) de650.o
CONFIG_8390 = CONFIG_8390
endif
ifdef CONFIG_AT1700
NETDRV_OBJS := $(NETDRV_OBJS) at1700.o
+else
+MODULES := $(MODULES) at1700.o
endif
ifdef CONFIG_EL1
ifdef CONFIG_EL16
NETDRV_OBJS := $(NETDRV_OBJS) 3c507.o
+else
+MODULES ;= $(MODULES 3c507.o
endif
ifdef CONFIG_EL3
ifdef CONFIG_ELPLUS
NETDRV_OBJS := $(NETDRV_OBJS) 3c505.o
+else
+MODULES := $(MODULES) 3c505.o
endif
3c505.o: 3c505.c CONFIG
$(CC) $(CPPFLAGS) $(CFLAGS) $(ELP_OPTS) -c $<
ifdef CONFIG_AC3200
NETDRV_OBJS := $(NETDRV_OBJS) ac3200.o
CONFIG_8390 = CONFIG_8390
+else
+MODULES := $(MODULES) ac3200.o
endif
ifdef CONFIG_APRICOT
ifdef CONFIG_DEC_ELCP
NETDRV_OBJS := $(NETDRV_OBJS) tulip.o
+else
+MODULES := $(MODULES) tulip.o
endif
ifdef CONFIG_ARCNET
else
MODULES := 8390.o $(MODULES)
endif
+8390.o: 8390.c 8390.h CONFIG
ifdef CONFIG_EQUALIZER
NETDRV_OBJS := $(NETDRV_OBJS) eql.o
+else
+MODULES := $(MODULES) eql.o
endif
net.a: $(NETDRV_OBJS)
clean:
rm -f core *.o *.a *.s
+ifdef MODULES
dep:
$(CPP) -M $(NETDRV_OBJS:.o=.c) > .depend
-ifdef MODULES
$(CPP) -M -DMODULE $(MODULES:.o=.c) >> .depend
+else
+dep:
+ $(CPP) -M $(NETDRV_OBJS:.o=.c) > .depend
endif
tar:
--- /dev/null
+Wed 2-Aug-95 <matti.aarnio@utu.fi>
+
+ Linux network driver modules
+
+ This is a potpourri of INSMOD-time(*) configuration
+ options (if exist) and their default values of various
+ modules on Linux network drivers collection.
+
+ Do NOT mistake this to "README.modules" at the top-level
+ directory!
+
+ --------------------------
+ (*) "INSMOD-time" means when you load module with
+ /sbin/insmod you can feed it optional parameters.
+ See "man insmod".
+ --------------------------
+
+
+3c501.c:
+ io = 0x280 IO base address
+ irq = 5 IRQ
+ (Probes ports: 0x280, 0x300)
+
+3c503.c:
+ io = 0
+ irq = 0
+ (Probes ports: 0x300, 0x310, 0x330, 0x350, 0x250, 0x280, 0x2A0, 0x2E0)
+
+3c505.c:
+ io = 0
+ irq = 0
+ (Probes ports: 0x300, 0x280, 0x310)
+
+3c507.c:
+ io = 0
+ irq = 0
+ (Probes ports: 0x300, 0x320, 0x340, 0x280)
+
+3c509.c:
+ No parameters (autoprobes)
+ (EISA, and MCA probes in addition to ISA-probes;
+ ISA probing via PCMCIA AutoConfig (or similar)
+ via port 0x100.)
+
+8390.c:
+ ei_debug = 0
+ ei_pingpong = 1 (If no Rx/Tx PINGPONG is desired, set to zero)
+
+ac3200.c:
+ io = 0
+ irq = 0
+ (EISA probing..)
+
+apricot.c:
+ io = 0x300 (Can't be altered!)
+ irq = 10
+
+arcnet.c:
+ io = 0
+ irqnum = 0
+ shmem = 0
+ num = 0
+ (When probing, looks at the following possible addresses:
+ Suggested ones:
+ 0x300, 0x2E0, 0x2F0, 0x2D0
+ Other ones:
+ 0x200, 0x210, 0x220, 0x230, 0x240, 0x250, 0x260, 0x270,
+ 0x280, 0x290, 0x2A0, 0x2B0, 0x2C0,
+ 0x310, 0x320, 0x330, 0x340, 0x350, 0x360, 0x370,
+ 0x380, 0x390, 0x3A0, 0x3E0, 0x3F0 )
+
+at1700.c:
+ io = 0
+ irq = 0
+ (Probes ports: 0x260, 0x280, 0x2A0, 0x240, 0x340, 0x320, 0x380, 0x300)
+
+atp.c: *Not modularized*
+ (Probes ports: 0x378, 0x278, 0x3BC;
+ fixed IRQs: 5 and 7 )
+
+
+auto_irq.c: *Static kernel component*
+
+
+de4x5.c:
+ io = 0x000b
+ irq = 10
+ is_not_dec = 0 -- For SMC card using DEC 21140 set this to 1
+ (EISA, and PCI probing)
+
+de600.c:
+ de600_debug = 0
+ (On port 0x378, irq 7 -- lpt1; compile time configurable)
+
+de620.c:
+ bnc = 0, utp = 0 <-- Force media by setting either.
+ io = 0x378 (also compile-time configurable)
+ irq = 7
+
+depca.c:
+ io = 0x200
+ irq = 7
+ (Probes ports: ISA: 0x300, 0x200;
+ EISA: 0x0c00 )
+
+dummy.c:
+ No options
+
+e2100.c:
+ io = 0
+ irq = 0
+ (Probes ports: 0x300, 0x280, 0x380, 0x220)
+
+eepro.c:
+ io = 0
+ irq = 0
+ (Probes ports: 0x200, 0x240, 0x280, 0x2C0, 0x300, 0x320, 0x340, 0x360)
+
+eexpress.c:
+ io = 0
+ irq = 0
+ (Probes ports: 0x300, 0x270, 0x320, 0x340)
+
+eql.c:
+ (No parameters)
+
+ewrk3.c:
+ io = 0x300
+ irq = 5
+ (With module no autoprobing!
+ On EISA-bus does EISA probing.
+ Static linkage probes ports on ISA bus:
+ 0x100, 0x120, 0x140, 0x160, 0x180, 0x1A0, 0x1C0,
+ 0x200, 0x220, 0x240, 0x260, 0x280, 0x2A0, 0x2C0, 0x2E0,
+ 0x300, 0x340, 0x360, 0x380, 0x3A0, 0x3C0)
+
+hp-plus.c:
+ io = 0
+ irq = 0
+ (Probes ports: 0x200, 0x240, 0x280, 0x2C0, 0x300, 0x320, 0x340)
+
+hp.c:
+ io = 0
+ irq = 0
+ ne8390_rw_bugfix = 0
+ (Probes ports: 0x300, 0x320, 0x340, 0x280, 0x2C0, 0x200, 0x240)
+
+hp100.c:
+ hp100_port = 0 (IO-base address)
+ (Does EISA-probing, if on EISA-slot;
+ On ISA-bus probes all ports from 0x100 thru to 0x3E0
+ in increments of 0x020)
+
+ibmtr.c:
+ io = 0
+ (Probes ports: 0xA20, 0xA24 -- Ok, 0x220, 0x224, but IBM style..)
+
+lance.c: *Not modularized*
+ (PCI, and ISA probing; "CONFIG_PCI" needed for PCI support)
+ (Probes ISA ports: 0x300, 0x320, 0x340, 0x360)
+
+loopback.c: *Static kernel component*
+
+ne.c:
+ io = 0
+ irq = 0
+ config_ne_sanity = 0
+ ne8390_rw_bugfix = 0;
+ (Probes ports: 0x300, 0x280, 0x320, 0x340, 0x360)
+
+net_init.c: *Static kernel component*
+
+ni52.c: *Not modularized*
+ (Probes ports: 0x300, 0x280, 0x360, 0x320, 0x340
+ mems: 0xD0000, 0xD2000, 0xC8000, 0xCA000,
+ 0xD4000, 0xD6000, 0xD8000 )
+
+ni65.c: *Not modularized* **16MB MEMORY BARRIER BUG**
+ (Probes ports: 0x300, 0x320, 0x340, 0x360)
+
+pi2.c: *Not modularized* (well, NON-STANDARD modularization!)
+ Only one card supported at this time.
+ (Probes ports: 0x380, 0x300, 0x320, 0x340, 0x360, 0x3A0)
+
+plip.c:
+ No options; goes to IO=0x278, IRQ=2
+
+ppp.c:
+ No options (ppp-2.2+ has some, this is based on non-dynamic
+ version from ppp-2.1.2d)
+
+seeq8005.c: *Not modularized*
+ (Probes ports: 0x300, 0x320, 0x340, 0x360)
+
+sk_g16.c: *Not modularized*
+ (Probes ports: 0x100, 0x180, 0x208, 0x220m 0x288, 0x320, 0x328, 0x390)
+
+skeleton.c: *Skeleton*
+
+slhc.c:
+ No configuration parameters
+
+slip.c:
+ slip_maxdev = 256 (default value from SL_NRUNIT on slip.h)
+
+
+smc-ultra.c:
+ io = 0
+ irq = 0
+ (Probes ports: 0x200, 0x220, 0x240, 0x280, 0x300, 0x340, 0x380)
+
+tulip.c: *Partial modularization*
+ (init-time memory allocation makes problems..)
+
+tunnel.c:
+ No insmod parameters
+
+wavelan.c:
+ io = 0x390 (Settable, but change not recommended)
+ irq = 0 (Not honoured, if changed..)
+
+wd.c:
+ io = 0
+ irq = 0
+ mem = 0 (Force shared-memory on address 0xC8000, or whatever..)
+ (Probes ports: 0x300, 0x280, 0x380, 0x240,
+ uses AUTOIRQ)
+
+znet.c: *Not modularized*
+ (Only one device on Zenith Z-Note (notebook?) systems,
+ configuration information from (EE)PROM)
static const char *version =
"ac3200.c:v1.01 7/1/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/errno.h>
static int ac_open(struct device *dev)
{
+ int rc;
#ifdef notyet
/* Someday we may enable the IRQ and shared memory here. */
int ioaddr = dev->base_addr;
return -EAGAIN;
#endif
- return ei_open(dev);
+ rc = ei_open(dev);
+ if (rc != 0) return rc;
+
+#ifdef MODULE
+ MOD_INC_USE_COUNT;
+#endif
+
+ return 0;
}
static void ac_reset_8390(struct device *dev)
NS8390_init(dev, 0);
+#ifdef MODULE
+ MOD_DEC_USE_COUNT;
+#endif
+
return 0;
}
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+static struct device dev_ac3200 = {
+ " " /*"ac3200"*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, ac3200_probe };
+
+int io = 0;
+int irq = 0;
+
+int init_module(void)
+{
+ dev_ac3200.base_addr = io;
+ dev_ac3200.irq = irq;
+ if (register_netdev(&dev_ac3200) != 0) {
+ printk("ac3200: register_netdev() returned non-zero.\n");
+ return -EIO;
+ }
+ return 0;
+}
+
+void
+cleanup_module(void)
+{
+ if (MOD_IN_USE)
+ printk("ac3200: device busy, remove delayed\n");
+ else
+ {
+ unregister_netdev(&dev_ac3200);
+ }
+}
+#endif /* MODULE */
\f
/*
* Local variables:
0x300, 10,
0, 0, 0, NULL, apricot_probe };
+int io = 0x300;
+int irq = 10;
+
int
init_module(void)
{
+ dev_apricot.base_addr = io;
+ dev_apricot.irq = irq;
if (register_netdev(&dev_apricot) != 0)
return -EIO;
return 0;
static const char *version =
"at1700.c:v1.12 1/18/95 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
#include <linux/config.h>
#include <linux/kernel.h>
dev->interrupt = 0;
dev->start = 1;
+#ifdef MODULE
+ MOD_INC_USE_COUNT;
+#endif
+
return 0;
}
/* Power-down the chip. Green, green, green! */
outb(0x00, ioaddr + CONFIG_1);
+#ifdef MODULE
+ MOD_DEC_USE_COUNT;
+#endif
+
return 0;
}
} else
outb(2, ioaddr + RX_MODE); /* Disable promiscuous, use normal mode */
}
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+static struct device dev_at1700 = {
+ " " /*"at1700"*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, at1700_probe };
+
+int io = 0;
+int irq = 0;
+
+int init_module(void)
+{
+ dev_at1700.base_addr = io;
+ dev_at1700.irq = irq;
+ if (register_netdev(&dev_at1700) != 0) {
+ printk("at1700: register_netdev() returned non-zero.\n");
+ return -EIO;
+ }
+ return 0;
+}
+
+void
+cleanup_module(void)
+{
+ if (MOD_IN_USE)
+ printk("at1700: device busy, remove delayed\n");
+ else
+ {
+ unregister_netdev(&dev_at1700);
+ }
+}
+#endif /* MODULE */
\f
/*
* Local variables:
release_region(DE600_IO, 3);
}
#endif /* MODULE */
+/*
+ * Local variables:
+ * kernel-compile-command: "gcc -D__KERNEL__ -Ilinux/include -I../../net/inet -Wall -Wstrict-prototypes -O2 -m486 -c de600.c"
+ * module-compile-command: "gcc -D__KERNEL__ -DMODULE -Ilinux/include -I../../net/inet -Wall -Wstrict-prototypes -O2 -m486 -c de600.c"
+ * compile-command: "gcc -D__KERNEL__ -DMODULE -Ilinux/include -I../../net/inet -Wall -Wstrict-prototypes -O2 -m486 -c de600.c"
+ * End:
+ */
#define COUNT_LOOPS
*/
#endif
-static int bnc, utp;
+static int bnc = 0, utp = 0;
/*
* Force media with insmod:
* insmod de620.o bnc=1
#define DE620_IRQ 7
#endif
-#define DATA_PORT (DE620_IO)
-#define STATUS_PORT (DE620_IO + 1)
-#define COMMAND_PORT (DE620_IO + 2)
+#define DATA_PORT (dev->base_addr)
+#define STATUS_PORT (dev->base_addr + 1)
+#define COMMAND_PORT (dev->base_addr + 2)
#define RUNT 60 /* Too small Ethernet packet */
#define GIANT 1514 /* largest legal size packet, no fcs */
/* Initialization */
static int adapter_init(struct device *);
int de620_probe(struct device *);
-static int read_eeprom(void);
+static int read_eeprom(struct device *);
/*
* Convenience macros/functions for D-Link DE-620 adapter *
* *
**********************************************************/
-#define de620_tx_buffs() (inb(STATUS_PORT) & (TXBF0 | TXBF1))
-#define de620_flip_ds() NIC_Cmd ^= DS0 | DS1; outb(NIC_Cmd, COMMAND_PORT);
+#define de620_tx_buffs(dd) (inb(STATUS_PORT) & (TXBF0 | TXBF1))
+#define de620_flip_ds(dd) NIC_Cmd ^= DS0 | DS1; outb(NIC_Cmd, COMMAND_PORT);
/* Check for ready-status, and return a nibble (high 4 bits) for data input */
#ifdef COUNT_LOOPS
static int tot_cnt;
#endif
static inline byte
-de620_ready(void)
+de620_ready(struct device *dev)
{
byte value;
register short int cnt = 0;
}
static inline void
-de620_send_command(byte cmd)
+de620_send_command(struct device *dev, byte cmd)
{
- de620_ready();
+ de620_ready(dev);
if (cmd == W_DUMMY)
outb(NIC_Cmd, COMMAND_PORT);
outb(cmd, DATA_PORT);
outb(NIC_Cmd ^ CS0, COMMAND_PORT);
- de620_ready();
+ de620_ready(dev);
outb(NIC_Cmd, COMMAND_PORT);
}
static inline void
-de620_put_byte(byte value)
+de620_put_byte(struct device *dev, byte value)
{
/* The de620_ready() makes 7 loops, on the average, on a DX2/66 */
- de620_ready();
+ de620_ready(dev);
outb(value, DATA_PORT);
- de620_flip_ds();
+ de620_flip_ds(dev);
}
static inline byte
-de620_read_byte(void)
+de620_read_byte(struct device *dev)
{
byte value;
/* The de620_ready() makes 7 loops, on the average, on a DX2/66 */
- value = de620_ready(); /* High nibble */
- de620_flip_ds();
- value |= de620_ready() >> 4; /* Low nibble */
+ value = de620_ready(dev); /* High nibble */
+ de620_flip_ds(dev);
+ value |= de620_ready(dev) >> 4; /* Low nibble */
return value;
}
static inline void
-de620_write_block(byte *buffer, int count)
+de620_write_block(struct device *dev, byte *buffer, int count)
{
#ifndef LOWSPEED
byte uflip = NIC_Cmd ^ (DS0 | DS1);
#endif /* COUNT_LOOPS */
/* No further optimization useful, the limit is in the adapter. */
for ( ; count > 0; --count, ++buffer) {
- de620_put_byte(*buffer);
+ de620_put_byte(dev,*buffer);
}
- de620_send_command(W_DUMMY);
+ de620_send_command(dev,W_DUMMY);
#ifdef COUNT_LOOPS
/* trial debug output: loops per byte in de620_ready() */
printk("WRITE(%d)\n", tot_cnt/((bytes?bytes:1)));
outb(*buffer++, DATA_PORT);
outb(dflip, COMMAND_PORT);
}
- de620_send_command(W_DUMMY);
+ de620_send_command(dev,W_DUMMY);
#endif /* LOWSPEED */
}
static inline void
-de620_read_block(byte *data, int count)
+de620_read_block(struct device *dev, byte *data, int count)
{
#ifndef LOWSPEED
byte value;
#ifdef LOWSPEED
/* No further optimization useful, the limit is in the adapter. */
while (count-- > 0) {
- *data++ = de620_read_byte();
- de620_flip_ds();
+ *data++ = de620_read_byte(dev);
+ de620_flip_ds(dev);
}
#ifdef COUNT_LOOPS
/* trial debug output: loops per byte in de620_ready() */
}
static inline void
-de620_set_delay(void)
+de620_set_delay(struct device *dev)
{
- de620_ready();
+ de620_ready(dev);
outb(W_DFR, DATA_PORT);
outb(NIC_Cmd ^ CS0, COMMAND_PORT);
- de620_ready();
+ de620_ready(dev);
#ifdef LOWSPEED
outb(WRITE_DELAY, DATA_PORT);
#else
outb(0, DATA_PORT);
#endif
- de620_flip_ds();
+ de620_flip_ds(dev);
- de620_ready();
+ de620_ready(dev);
#ifdef LOWSPEED
outb(READ_DELAY, DATA_PORT);
#else
outb(0, DATA_PORT);
#endif
- de620_flip_ds();
+ de620_flip_ds(dev);
}
static inline void
-de620_set_register(byte reg, byte value)
+de620_set_register(struct device *dev, byte reg, byte value)
{
- de620_ready();
+ de620_ready(dev);
outb(reg, DATA_PORT);
outb(NIC_Cmd ^ CS0, COMMAND_PORT);
- de620_put_byte(value);
+ de620_put_byte(dev, value);
}
static inline byte
-de620_get_register(byte reg)
+de620_get_register(struct device *dev, byte reg)
{
byte value;
- de620_send_command(reg);
- value = de620_read_byte();
- de620_send_command(W_DUMMY);
+ de620_send_command(dev,reg);
+ value = de620_read_byte(dev);
+ de620_send_command(dev,W_DUMMY);
return value;
}
de620_close(struct device *dev)
{
/* disable recv */
- de620_set_register(W_TCR, RXOFF);
+ de620_set_register(dev, W_TCR, RXOFF);
free_irq(DE620_IRQ);
irq2dev_map[DE620_IRQ] = NULL;
de620_set_multicast_list(struct device *dev, int num_addrs, void *addrs)
{
if (num_addrs) { /* Enable promiscuous mode */
- de620_set_register(W_TCR, (TCR_DEF & ~RXPBM) | RXALL);
+ de620_set_register(dev, W_TCR, (TCR_DEF & ~RXPBM) | RXALL);
}
else { /* Disable promiscuous mode, use normal mode */
- de620_set_register(W_TCR, TCR_DEF);
+ de620_set_register(dev, W_TCR, TCR_DEF);
}
}
return 0;
}
- using_txbuf = de620_tx_buffs(); /* Peek at the adapter */
+ using_txbuf = de620_tx_buffs(dev); /* Peek at the adapter */
dev->tbusy = (using_txbuf == (TXBF0 | TXBF1)); /* Boolean! */
if (dev->tbusy) { /* Do timeouts, to avoid hangs. */
switch (using_txbuf) {
default: /* both are free: use TXBF0 */
case TXBF1: /* use TXBF0 */
- de620_send_command(W_CR | RW0);
+ de620_send_command(dev,W_CR | RW0);
using_txbuf |= TXBF0;
break;
case TXBF0: /* use TXBF1 */
- de620_send_command(W_CR | RW1);
+ de620_send_command(dev,W_CR | RW1);
using_txbuf |= TXBF1;
break;
return 1;
break;
}
- de620_write_block(buffer, len);
+ de620_write_block(dev, buffer, len);
dev->trans_start = jiffies;
dev->tbusy = (using_txbuf == (TXBF0 | TXBF1)); /* Boolean! */
dev->interrupt = 1;
/* Read the status register (_not_ the status port) */
- irq_status = de620_get_register(R_STS);
+ irq_status = de620_get_register(dev, R_STS);
PRINTK(("de620_interrupt (%2.2X)\n", irq_status));
while (again && (++bogus_count < 100));
}
- dev->tbusy = (de620_tx_buffs() == (TXBF0 | TXBF1)); /* Boolean! */
+ dev->tbusy = (de620_tx_buffs(dev) == (TXBF0 | TXBF1)); /* Boolean! */
dev->interrupt = 0;
sti();
PRINTK(("de620_rx_intr: next_rx_page = %d\n", next_rx_page));
/* Tell the adapter that we are going to read data, and from where */
- de620_send_command(W_CR | RRN);
- de620_set_register(W_RSA1, next_rx_page);
- de620_set_register(W_RSA0, 0);
+ de620_send_command(dev, W_CR | RRN);
+ de620_set_register(dev, W_RSA1, next_rx_page);
+ de620_set_register(dev, W_RSA0, 0);
/* Deep breath, and away we goooooo */
- de620_read_block((byte *)&header_buf, sizeof(struct header_buf));
+ de620_read_block(dev, (byte *)&header_buf, sizeof(struct header_buf));
PRINTK(("page status=0x%02x, nextpage=%d, packetsize=%d\n",
header_buf.status, header_buf.Rx_NextPage, header_buf.Rx_ByteCount));
/* Naah, we'll skip this packet. Probably bogus data as well */
printk("%s: Page link out of sync! Restoring...\n", dev->name);
next_rx_page = header_buf.Rx_NextPage; /* at least a try... */
- de620_send_command(W_DUMMY);
- de620_set_register(W_NPRF, next_rx_page);
+ de620_send_command(dev, W_DUMMY);
+ de620_set_register(dev, W_NPRF, next_rx_page);
((struct netstats *)(dev->priv))->rx_over_errors++;
return 0;
}
/* skb->data points to the start of sk_buff data area */
buffer = skb_put(skb,size);
/* copy the packet into the buffer */
- de620_read_block(buffer, size);
+ de620_read_block(dev, buffer, size);
PRINTK(("Read %d bytes\n", size));
skb->protocol=eth_type_trans(skb,dev);
netif_rx(skb); /* deliver it "upstairs" */
/* Let's peek ahead to see if we have read the last current packet */
/* NOTE! We're _not_ checking the 'EMPTY'-flag! This seems better... */
- curr_page = de620_get_register(R_CPR);
- de620_set_register(W_NPRF, next_rx_page);
+ curr_page = de620_get_register(dev, R_CPR);
+ de620_set_register(dev, W_NPRF, next_rx_page);
PRINTK(("next_rx_page=%d CPR=%d\n", next_rx_page, curr_page));
return (next_rx_page != curr_page); /* That was slightly tricky... */
if (bnc)
EIPRegister = NCTL0;
- de620_send_command(W_CR | RNOP | CLEAR);
- de620_send_command(W_CR | RNOP);
+ de620_send_command(dev, W_CR | RNOP | CLEAR);
+ de620_send_command(dev, W_CR | RNOP);
- de620_set_register(W_SCR, SCR_DEF);
+ de620_set_register(dev, W_SCR, SCR_DEF);
/* disable recv to wait init */
- de620_set_register(W_TCR, RXOFF);
+ de620_set_register(dev, W_TCR, RXOFF);
/* Set the node ID in the adapter */
for (i = 0; i < 6; ++i) { /* W_PARn = 0xaa + n */
- de620_set_register(W_PAR0 + i, dev->dev_addr[i]);
+ de620_set_register(dev, W_PAR0 + i, dev->dev_addr[i]);
}
- de620_set_register(W_EIP, EIPRegister);
+ de620_set_register(dev, W_EIP, EIPRegister);
next_rx_page = first_rx_page = DE620_RX_START_PAGE;
if (nic_data.RAM_Size)
else /* 64k RAM */
last_rx_page = 255;
- de620_set_register(W_SPR, first_rx_page); /* Start Page Register */
- de620_set_register(W_EPR, last_rx_page); /* End Page Register */
- de620_set_register(W_CPR, first_rx_page); /* Current Page Register */
- de620_send_command(W_NPR | first_rx_page); /* Next Page Register */
- de620_send_command(W_DUMMY);
- de620_set_delay();
+ de620_set_register(dev, W_SPR, first_rx_page); /* Start Page Register*/
+ de620_set_register(dev, W_EPR, last_rx_page); /* End Page Register */
+ de620_set_register(dev, W_CPR, first_rx_page);/*Current Page Register*/
+ de620_send_command(dev, W_NPR | first_rx_page); /* Next Page Register*/
+ de620_send_command(dev, W_DUMMY);
+ de620_set_delay(dev);
/* Final sanity check: Anybody out there? */
/* Let's hope some bits from the statusregister make a good check */
/* success: X 0 0 X 0 0 X X */
/* ignore: EEDI RXGOOD COLS LNKS*/
- if (((i = de620_get_register(R_STS)) & CHECK_MASK) != CHECK_OK) {
+ if (((i = de620_get_register(dev, R_STS)) & CHECK_MASK) != CHECK_OK) {
printk("Something has happened to the DE-620! Please check it"
#ifdef SHUTDOWN_WHEN_LOST
" and do a new ifconfig"
}
/* All OK, go ahead... */
- de620_set_register(W_TCR, TCR_DEF);
+ de620_set_register(dev, W_TCR, TCR_DEF);
return 0; /* all ok */
}
/* Initially, configure basic nibble mode, so we can read the EEPROM */
NIC_Cmd = DEF_NIC_CMD;
- de620_set_register(W_EIP, EIPRegister);
+ de620_set_register(dev, W_EIP, EIPRegister);
/* Anybody out there? */
- de620_set_register(W_CPR, checkbyte);
- checkbyte = de620_get_register(R_CPR);
+ de620_set_register(dev, W_CPR, checkbyte);
+ checkbyte = de620_get_register(dev, R_CPR);
- if ((checkbyte != 0xa5) || (read_eeprom() != 0)) {
+ if ((checkbyte != 0xa5) || (read_eeprom(dev) != 0)) {
printk(" not identified in the printer port\n");
return ENODEV;
}
*
* Note: Bitwise serial I/O to/from the EEPROM vi the status _register_!
*/
-#define sendit(data) de620_set_register(W_EIP, data | EIPRegister);
+#define sendit(dev,data) de620_set_register(dev, W_EIP, data | EIPRegister);
static unsigned short
-ReadAWord(int from)
+ReadAWord(struct device *dev, int from)
{
unsigned short data;
int nbits;
/* cs [__~~] SET SEND STATE */
/* di [____] */
/* sck [_~~_] */
- sendit(0); sendit(1); sendit(5); sendit(4);
+ sendit(dev, 0); sendit(dev, 1); sendit(dev, 5); sendit(dev, 4);
/* Send the 9-bit address from where we want to read the 16-bit word */
for (nbits = 9; nbits > 0; --nbits, from <<= 1) {
/* cs [~~~~] SEND 1 */
/* di [~~~~] */
/* sck [_~~_] */
- sendit(6); sendit(7); sendit(7); sendit(6);
+ sendit(dev, 6); sendit(dev, 7); sendit(dev, 7); sendit(dev, 6);
}
else {
/* cs [~~~~] SEND 0 */
/* di [____] */
/* sck [_~~_] */
- sendit(4); sendit(5); sendit(5); sendit(4);
+ sendit(dev, 4); sendit(dev, 5); sendit(dev, 5); sendit(dev, 4);
}
}
/* cs [~~~~] SEND 0 */
/* di [____] */
/* sck [_~~_] */
- sendit(4); sendit(5); sendit(5); sendit(4);
- data = (data << 1) | ((de620_get_register(R_STS) & EEDI) >> 7);
+ sendit(dev, 4); sendit(dev, 5); sendit(dev, 5); sendit(dev, 4);
+ data = (data << 1) | ((de620_get_register(dev, R_STS) & EEDI) >> 7);
}
/* cs [____] RESET SEND STATE */
/* di [____] */
/* sck [_~~_] */
- sendit(0); sendit(1); sendit(1); sendit(0);
+ sendit(dev, 0); sendit(dev, 1); sendit(dev, 1); sendit(dev, 0);
return data;
}
static int
-read_eeprom(void)
+read_eeprom(struct device *dev)
{
unsigned short wrd;
/* D-Link Ethernet addresses are in the series 00:80:c8:7X:XX:XX:XX */
- wrd = ReadAWord(0x1aa); /* bytes 0 + 1 of NodeID */
+ wrd = ReadAWord(dev, 0x1aa); /* bytes 0 + 1 of NodeID */
if (wrd != htons(0x0080)) /* Valid D-Link ether sequence? */
return -1; /* Nope, not a DE-620 */
nic_data.NodeID[0] = wrd & 0xff;
nic_data.NodeID[1] = wrd >> 8;
- wrd = ReadAWord(0x1ab); /* bytes 2 + 3 of NodeID */
+ wrd = ReadAWord(dev, 0x1ab); /* bytes 2 + 3 of NodeID */
if ((wrd & 0xff) != 0xc8) /* Valid D-Link ether sequence? */
return -1; /* Nope, not a DE-620 */
nic_data.NodeID[2] = wrd & 0xff;
nic_data.NodeID[3] = wrd >> 8;
- wrd = ReadAWord(0x1ac); /* bytes 4 + 5 of NodeID */
+ wrd = ReadAWord(dev, 0x1ac); /* bytes 4 + 5 of NodeID */
nic_data.NodeID[4] = wrd & 0xff;
nic_data.NodeID[5] = wrd >> 8;
- wrd = ReadAWord(0x1ad); /* RAM size in pages (256 bytes). 0 = 64k */
+ wrd = ReadAWord(dev, 0x1ad); /* RAM size in pages (256 bytes). 0 = 64k */
nic_data.RAM_Size = (wrd >> 8);
- wrd = ReadAWord(0x1ae); /* hardware model (CT = 3) */
+ wrd = ReadAWord(dev, 0x1ae); /* hardware model (CT = 3) */
nic_data.Model = (wrd & 0xff);
- wrd = ReadAWord(0x1af); /* media (indicates BNC/UTP) */
+ wrd = ReadAWord(dev, 0x1af); /* media (indicates BNC/UTP) */
nic_data.Media = (wrd & 0xff);
- wrd = ReadAWord(0x1a8); /* System Configuration Register */
+ wrd = ReadAWord(dev, 0x1a8); /* System Configuration Register */
nic_data.SCR = (wrd >> 8);
return 0; /* no errors */
*/
#ifdef MODULE
char kernel_version[] = UTS_RELEASE;
-static char nullname[8];
+static char nullname[8] = "";
static struct device de620_dev = {
nullname, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, de620_probe };
+int de620_io = DE620_IO;
+int de620_irq = DE620_IRQ;
+
int
init_module(void)
{
+ de620_dev.base_addr = de620_io;
+ de620_dev.irq = de620_irq;
if (register_netdev(&de620_dev) != 0)
return -EIO;
return 0;
cleanup_module(void)
{
unregister_netdev(&de620_dev);
- release_region(DE620_IO, 3);
+ release_region(de620_dev.base_addr, 3);
}
#endif /* MODULE */
\f
* gcc -D__KERNEL__ -Wall -Wstrict-prototypes -O2 \
* -fomit-frame-pointer -m486 \
* -I/usr/src/linux/include -I../../net/inet -c de620.c
+*/
+/*
+ * Local variables:
+ * kernel-compile-command: "gcc -D__KERNEL__ -Ilinux/include -I../../net/inet -Wall -Wstrict-prototypes -O2 -m486 -c de620.c"
+ * module-compile-command: "gcc -D__KERNEL__ -DMODULE -Ilinux/include -I../../net/inet -Wall -Wstrict-prototypes -O2 -m486 -c de620.c"
+ * compile-command: "gcc -D__KERNEL__ -DMODULE -Ilinux/include -I../../net/inet -Wall -Wstrict-prototypes -O2 -m486 -c de620.c"
+ * End:
*/
static const char *version =
"e2100.c:v1.01 7/21/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/errno.h>
e21_open(struct device *dev)
{
short ioaddr = dev->base_addr;
+ int rc;
if (request_irq(dev->irq, ei_interrupt, 0, "e2100")) {
return EBUSY;
inb(ioaddr + E21_MEM_BASE);
outb(0, ioaddr + E21_ASIC + ((dev->mem_start >> 17) & 7));
- return ei_open(dev);
+ rc = ei_open(dev);
+ if (rc != 0) return rc;
+#ifdef MODULE
+ MOD_INC_USE_COUNT;
+#endif
+ return 0;
}
static void
really bad things happen if it isn't. */
mem_off(ioaddr);
+#ifdef MODULE
+ MOD_DEC_USE_COUNT;
+#endif
+
return 0;
}
{"e21", e21_probe1, E21_IO_EXTENT, e21_probe_list};
#endif
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+static struct device dev_e2100 = {
+ " " /*"e2100"*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, e2100_probe };
+
+int io = 0;
+int irq = 0;
+
+int init_module(void)
+{
+ dev_e2100.base_addr = io;
+ dev_e2100.irq = irq;
+ if (register_netdev(&dev_e2100) != 0) {
+ printk("e2100: register_netdev() returned non-zero.\n");
+ return -EIO;
+ }
+ return 0;
+}
+
+void
+cleanup_module(void)
+{
+ if (MOD_IN_USE)
+ printk("e2100: device busy, remove delayed\n");
+ else
+ {
+ unregister_netdev(&dev_e2100);
+ }
+}
+#endif /* MODULE */
\f
/*
* Local variables:
static struct device dev_eepro = {
" " /*"eepro"*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, eepro_probe };
+int io = 0;
+int irq = 0;
+
int
init_module(void)
{
+ dev_eepro.base_addr = io;
+ dev_eepro.irq = irq;
+
if (register_netdev(&dev_eepro) != 0)
return -EIO;
return 0;
static const char *version =
"Equalizer: $Revision: 3.12 $ $Date: 1995/01/19 $ Simon Janes (simon@ncm.com)\n";
-#include <linux/config.h>
-
/*
* Sources:
* skeleton.c by Donald Becker.
*
*/
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
+#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/types.h>
eql->timer_on = 1;
add_timer (&eql->timer);
+#ifdef MODULE
+ MOD_INC_USE_COUNT;
+#endif
return 0;
}
return 1;
eql_delete_slave_queue (eql->queue);
+#ifdef MODULE
+ MOD_DEC_USE_COUNT;
+#endif
+
return 0;
}
\f
}
}
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+static struct device dev_eql = {
+ "eql", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, eql_init };
+
+int init_module(void)
+{
+ if (register_netdev(&dev_eql) != 0) {
+ printk("eql: register_netdev() returned non-zero.\n");
+ return -EIO;
+ }
+ return 0;
+}
+
+void
+cleanup_module(void)
+{
+ if (MOD_IN_USE)
+ printk("eql: device busy, remove delayed\n");
+ else
+ {
+ unregister_netdev(&dev_eql);
+ }
+}
+#endif /* MODULE */
+
/*
* Local Variables:
* compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/net/inet -Wall -Wstrict-prototypes -O6 -m486 -c eql.c"
static const char *version =
"hp-plus.c:v1.10 9/24/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
#include <linux/string.h> /* Important -- this inlines word moves. */
#include <linux/kernel.h>
#include <linux/sched.h>
EnableIRQ = 4, FakeIntr = 8, BootROMEnb = 0x10, IOEnb = 0x20,
MemEnable = 0x40, ZeroWait = 0x80, MemDisable = 0x1000, };
-int hpplus_probe(struct device *dev);
+int hp_plus_probe(struct device *dev);
int hpp_probe1(struct device *dev, int ioaddr);
static void hpp_reset_8390(struct device *dev);
return;
}
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+static struct device dev_hp = {
+ " " /*"hp"*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, hp_plus_probe };
+
+int io = 0;
+int irq = 0;
+
+int init_module(void)
+{
+ dev_hp.base_addr = io;
+ dev_hp.irq = irq;
+ if (register_netdev(&dev_hp) != 0) {
+ printk("hp: register_netdev() returned non-zero.\n");
+ return -EIO;
+ }
+ return 0;
+}
+
+void
+cleanup_module(void)
+{
+ if (MOD_IN_USE)
+ printk("hp: device busy, remove delayed\n");
+ else
+ {
+ unregister_netdev(&dev_hp);
+ }
+}
+#endif /* MODULE */
\f
/*
* Local variables:
static const char *version =
"hp.c:v1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
+
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/errno.h>
/* My default is IRQ5 0 1 2 3 4 5 6 7 8 9 10 11 */
static char irqmap[16] = { 0, 0, 4, 6, 8,10, 0,14, 0, 4, 2,12,0,0,0,0};
+/* NE2000, et.al. bug-fix code */
+static int ne8390_rw_bugfix = 0;
+
\f
/* Probe for an HP LAN adaptor.
Also initialize the card and fill in STATION_ADDR with the station
/* We should already be in page 0, but to be safe... */
outb_p(E8390_PAGE0+E8390_START+E8390_NODMA, nic_base);
-#ifdef ei8390_bug
- /* Handle the read-before-write bug the same way as the
- Crynwr packet driver -- the NatSemi method doesn't work. */
- outb_p(0x42, nic_base + EN0_RCNTLO);
- outb_p(0, nic_base + EN0_RCNTHI);
- outb_p(0xff, nic_base + EN0_RSARLO);
- outb_p(0x00, nic_base + EN0_RSARHI);
- outb_p(E8390_RREAD+E8390_START, EN_CMD);
- /* Make certain that the dummy read has occurred. */
- inb_p(0x61);
- inb_p(0x61);
-#endif
+ if (ne8390_rw_bugfix) {
+ /* Handle the read-before-write bug the same way as the
+ Crynwr packet driver -- the NatSemi method doesn't work. */
+ outb_p(0x42, nic_base + EN0_RCNTLO);
+ outb_p(0, nic_base + EN0_RCNTHI);
+ outb_p(0xff, nic_base + EN0_RSARLO);
+ outb_p(0x00, nic_base + EN0_RSARHI);
+#define NE_CMD 0x00
+ outb_p(E8390_RREAD+E8390_START, nic_base + NE_CMD);
+ /* Make certain that the dummy read has occurred. */
+ inb_p(0x61);
+ inb_p(0x61);
+ }
outb_p(count & 0xff, nic_base + EN0_RCNTLO);
outb_p(count >> 8, nic_base + EN0_RCNTHI);
return;
}
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+static struct device dev_hp = {
+ " " /*"hp"*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, hp_probe };
+
+int io = 0;
+int irq = 0;
+
+int init_module(void)
+{
+ dev_hp.base_addr = io;
+ dev_hp.irq = irq;
+ if (register_netdev(&dev_hp) != 0) {
+ printk("hp: register_netdev() returned non-zero.\n");
+ return -EIO;
+ }
+ return 0;
+}
+
+void
+cleanup_module(void)
+{
+ if (MOD_IN_USE)
+ printk("hp: device busy, remove delayed\n");
+ else
+ {
+ unregister_netdev(&dev_hp);
+ }
+}
+#endif /* MODULE */
\f
/*
* Local variables:
active adapter is identified.
*/
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
#define NO_AUTODETECT 1
#undef NO_AUTODETECT
#undef ENABLE_PAGING
dev->start=1;
/* NEED to see smem size *AND* reset high 512 bytes if
needed */
+
+#ifdef MODULE
+ MOD_INC_USE_COUNT;
+#endif
+
return 0;
}
else
if(close_adapter->ret_code)
DPRINTK("close adapter failed: %02X\n",close_adapter->ret_code);
+
+#ifdef MODULE
+ MOD_DEC_USE_COUNT;
+#endif
return 0;
}
toki=(struct tok_info *) dev->priv;
return (struct enet_statistics *) &toki->tr_stats;
}
+
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+static struct device dev_ibmtr = {
+ " " /*"ibmtr"*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, tok_probe };
+
+int io = 0;
+
+int init_module(void)
+{
+ dev_ibmtr.base_addr = io;
+ dev_ibmtr.irq = 0;
+ if (register_netdev(&dev_ibmtr) != 0) {
+ printk("ibmtr: register_netdev() returned non-zero.\n");
+ return -EIO;
+ }
+ return 0;
+}
+
+void
+cleanup_module(void)
+{
+ if (MOD_IN_USE)
+ printk("ibmtr: device busy, remove delayed\n");
+ else
+ {
+ unregister_netdev(&dev_ibmtr);
+ }
+}
+#endif /* MODULE */
static const char *version =
"ne.c:v1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
+
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/errno.h>
/* Do we perform extra sanity checks on stuff ? */
/* #define CONFIG_NE_SANITY */
+#ifdef CONFIG_NE_SANITY
+static int config_ne_sanity = 1;
+#else
+static int config_ne_sanity = 0;
+#endif
/* Do we implement the read before write bugfix ? */
/* #define CONFIG_NE_RW_BUGFIX */
+#ifdef CONFIG_NE_RW_BUGFIX
+static int ne8390_rw_bugfix = 1;
+#else
+static int ne8390_rw_bugfix = 0;
+#endif
/* ---- No user-serviceable parts below ---- */
static int
ne_block_input(struct device *dev, int count, char *buf, int ring_offset)
{
-#ifdef CONFIG_NE_SANITY
- int xfer_count = count;
-#endif
int nic_base = dev->base_addr;
+ /* CONFIG_NE_SANITY */
+ int xfer_count = count;
/* This *shouldn't* happen. If it does, it's the last thing you'll see */
if (ei_status.dmaing) {
insw(NE_BASE + NE_DATAPORT,buf,count>>1);
if (count & 0x01) {
buf[count-1] = inb(NE_BASE + NE_DATAPORT);
-#ifdef CONFIG_NE_SANITY
+ /* CONFIG_NE_SANITY */
xfer_count++;
-#endif
}
} else {
insb(NE_BASE + NE_DATAPORT, buf, count);
been encountering problems so it is still here. If you see
this message you either 1) have a slightly incompatible clone
or 2) have noise/speed problems with your bus. */
-#ifdef CONFIG_NE_SANITY
- if (ei_debug > 1) { /* DMA termination address check... */
+ if (config_ne_sanity &&
+ ei_debug > 1) { /* DMA termination address check... */
int addr, tries = 20;
do {
/* DON'T check for 'inb_p(EN0_ISR) & ENISR_RDC' here
"%#4.4x (expected) vs. %#4.4x (actual).\n",
dev->name, ring_offset + xfer_count, addr);
}
-#endif
outb_p(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */
ei_status.dmaing &= ~0x01;
return ring_offset + count;
ne_block_output(struct device *dev, int count,
const unsigned char *buf, const int start_page)
{
-#ifdef CONFIG_NE_SANITY
- int retries = 0;
-#endif
int nic_base = NE_BASE;
unsigned long dma_start;
+ /* CONFIG_NE_SANITY */
+ int retries = 0;
/* Round the count up for word writes. Do we need to do this?
What effect will an odd byte count have on the 8390?
/* We should already be in page 0, but to be safe... */
outb_p(E8390_PAGE0+E8390_START+E8390_NODMA, nic_base + NE_CMD);
-#ifdef CONFIG_NE_SANITY
retry:
-#endif
-#ifdef CONFIG_NE_RW_BUGFIX
- /* Handle the read-before-write bug the same way as the
- Crynwr packet driver -- the NatSemi method doesn't work.
- Actually this doesn't always work either, but if you have
- problems with your NEx000 this is better than nothing! */
- outb_p(0x42, nic_base + EN0_RCNTLO);
- outb_p(0x00, nic_base + EN0_RCNTHI);
- outb_p(0x42, nic_base + EN0_RSARLO);
- outb_p(0x00, nic_base + EN0_RSARHI);
- outb_p(E8390_RREAD+E8390_START, nic_base + NE_CMD);
- /* Make certain that the dummy read has occurred. */
- SLOW_DOWN_IO;
- SLOW_DOWN_IO;
- SLOW_DOWN_IO;
-#endif /* rw_bugfix */
+ if (ne8390_rw_bugfix) {
+ /* Handle the read-before-write bug the same way as the
+ Crynwr packet driver -- the NatSemi method doesn't work.
+ Actually this doesn't always work either, but if you have
+ problems with your NEx000 this is better than nothing! */
+ outb_p(0x42, nic_base + EN0_RCNTLO);
+ outb_p(0x00, nic_base + EN0_RCNTHI);
+ outb_p(0x42, nic_base + EN0_RSARLO);
+ outb_p(0x00, nic_base + EN0_RSARHI);
+ outb_p(E8390_RREAD+E8390_START, nic_base + NE_CMD);
+ /* Make certain that the dummy read has occurred. */
+ SLOW_DOWN_IO;
+ SLOW_DOWN_IO;
+ SLOW_DOWN_IO;
+ }
outb_p(ENISR_RDC, nic_base + EN0_ISR);
dma_start = jiffies;
-#ifdef CONFIG_NE_SANITY
/* This was for the ALPHA version only, but enough people have
been encountering problems so it is still here. */
- if (ei_debug > 1) { /* DMA termination address check... */
+ if (config_ne_sanity &&
+ ei_debug > 1) { /* DMA termination address check... */
int addr, tries = 20;
do {
int high = inb_p(nic_base + EN0_RSARHI);
goto retry;
}
}
-#endif
while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0)
if (jiffies - dma_start > 2*HZ/100) { /* 20ms */
return;
}
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+static struct device dev_ne2000 = {
+ " " /*"ne2000"*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, ne_probe };
+
+int io = 0;
+int irq = 0;
+
+int init_module(void)
+{
+ dev_ne2000.base_addr = io;
+ dev_ne2000.irq = irq;
+ if (register_netdev(&dev_ne2000) != 0)
+ return -EIO;
+ return 0;
+}
+
+void
+cleanup_module(void)
+{
+ if (MOD_IN_USE)
+ printk("ne2000: device busy, remove delayed\n");
+ else
+ {
+ unregister_netdev(&dev_ne2000);
+ }
+}
+#endif /* MODULE */
\f
/*
* Local variables:
return OK;
case PLIP_NB_2:
+ break;
}
+ return TIMEOUT; /* XX: ?? */
}
/* PLIP_RECEIVE_PACKET --- receive a packet */
*ns_p = PLIP_NB_BEGIN;
return OK;
}
+ return TIMEOUT;
}
/* PLIP_SEND_PACKET --- send a packet */
/* Initialize SLIP control device -- register SLIP line discipline */
#ifdef MODULE
-static int slip_init_ctrl_dev()
+static int slip_init_ctrl_dev(void)
#else /* !MODULE */
int
slip_init_ctrl_dev(struct device *dummy)
static const char *version =
"smc-ultra.c:v1.12 1/18/95 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
+
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/errno.h>
if (dev == NULL)
dev = init_etherdev(0, sizeof(struct ei_device), 0);
+ if (dev == NULL) /* Still.. */
+ return ENOMEM; /* Out of memory ?? */
model_name = (idreg & 0xF0) == 0x20 ? "SMC Ultra" : "SMC EtherEZ";
/* OK, we are certain this is going to work. Setup the device. */
- request_region(ioaddr, 32, model_name);
+ request_region(ioaddr, ULTRA_IO_EXTENT, model_name);
/* The 8390 isn't at the base address, so fake the offset */
dev->base_addr = ioaddr+ULTRA_NIC_OFFSET;
ultra_open(struct device *dev)
{
int ioaddr = dev->base_addr - ULTRA_NIC_OFFSET; /* ASIC addr */
+ int rc;
if (request_irq(dev->irq, ei_interrupt, 0, ei_status.name))
return -EAGAIN;
outb(ULTRA_MEMENB, ioaddr); /* Enable memory, 16 bit mode. */
outb(0x80, ioaddr + 5);
outb(0x01, ioaddr + 6); /* Enable interrupts and memory. */
- return ei_open(dev);
+ rc = ei_open(dev);
+ if (rc != 0) return rc;
+#ifdef MODULE
+ MOD_INC_USE_COUNT;
+#endif
+ return 0;
}
static void
/* We should someday disable shared memory and change to 8-bit mode
"just in case"... */
+#ifdef MODULE
+ MOD_DEC_USE_COUNT;
+#endif
+
return 0;
}
+
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+static struct device dev_ultra = {
+ " " /*"smc-ultra"*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, ultra_probe };
+
+int io = 0;
+int irq = 0;
+
+int init_module(void)
+{
+ dev_ultra.base_addr = io;
+ dev_ultra.irq = irq;
+ if (register_netdev(&dev_ultra) != 0) {
+ printk("smc-ultra: register_netdev() returned non-zero.\n");
+ return -EIO;
+ }
+ return 0;
+}
+
+void
+cleanup_module(void)
+{
+ if (MOD_IN_USE)
+ printk("smc-ultra: device busy, remove delayed\n");
+ else
+ {
+ unregister_netdev(&dev_ultra);
+ }
+}
+#endif /* MODULE */
\f
/*
static char *version = "tulip.c:v0.05 1/20/95 becker@cesdis.gsfc.nasa.gov\n";
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/sched.h>
\f
+#ifndef MODULE
/* This 21040 probe is unlike most other board probes. We can use memory
efficiently by allocating a large contiguous region and dividing it
ourselves. This is done by having the initialization occur before
return mem_start;
}
+#endif
+#ifdef MODULE
+static int tulip_probe(struct device *dev)
+{
+ printk("tulip: This driver does not yet install properly from module!\n");
+ return -1;
+}
+#endif
unsigned long tulip_probe1(unsigned long mem_start, int ioaddr, int irq)
{
printk("%s: Done tulip_open(), CSR0 %8.8x, CSR13 %8.8x.\n",
dev->name, inl(ioaddr + CSR0), inl(ioaddr + CSR13));
}
+#ifdef MODULE
+ MOD_INC_USE_COUNT;
+#endif
return 0;
}
free_irq(dev->irq);
irq2dev_map[dev->irq] = 0;
+#ifdef MODULE
+ MOD_DEC_USE_COUNT;
+#endif
return 0;
}
return 0;
}
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+static struct device dev_tulip = {
+ " " /*"tulip"*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, tulip_probe };
+
+int io = 0;
+int irq = 0;
+
+int init_module(void)
+{
+ dev_tulip.base_addr = io;
+ dev_tulip.irq = irq;
+ if (register_netdev(&dev_tulip) != 0) {
+ printk("tulip: register_netdev() returned non-zero.\n");
+ return -EIO;
+ }
+ return 0;
+}
+
+void
+cleanup_module(void)
+{
+ if (MOD_IN_USE)
+ printk("tulip: device busy, remove delayed\n");
+ else
+ {
+ unregister_netdev(&dev_tulip);
+ }
+}
+#endif /* MODULE */
\f
/*
* Local variables:
#include <linux/skbuff.h>
#include <linux/malloc.h>
#include <linux/timer.h>
+#include <linux/proc_fs.h>
#define STRUCT_CHECK 1
#include "i82586.h"
#include "wavelan.h"
static int wavelan_close(device *);
static en_stats *wavelan_get_stats(device *);
static void wavelan_set_multicast_list(device *, int, void *);
+static int wavelan_get_info(char*, char**, off_t, int, int);
/*
* Other forward declarations.
{
if (wavelan_debug > 0)
printk("%s: <-wavelan_probe(): 0\n", dev->name);
+ proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_WAVELAN, wavelan_get_info,
+ 7, "wavelan" });
+
return 0;
}
}
);
}
-int
-wavelan_get_info(char *buffer, char **start, off_t offset, int length)
+static int
+wavelan_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
int len;
off_t begin;
0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, wavelan_probe
};
+int io = 0x390; /* Default from above.. */
+int irq = 0;
+
int
init_module(void)
{
+ dev_wavelan.base_addr = io;
+ dev_wavelan.irq = irq;
if (register_netdev(&dev_wavelan) != 0)
return -EIO;
+
return 0;
}
printk("wavelan: device busy, remove delayed\n");
else
{
+ proc_net_unregister(PROC_NET_WAVELAN);
unregister_netdev(&dev_wavelan);
kfree_s(dev_wavelan.priv, sizeof(struct net_local));
dev_wavelan.priv = NULL;
static const char *version =
"wd.c:v1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/errno.h>
wd_open(struct device *dev)
{
int ioaddr = dev->base_addr - WD_NIC_OFFSET; /* WD_CMDREG */
+ int rc;
/* Map in the shared memory. Always set register 0 last to remain
compatible with very old boards. */
outb(ei_status.reg5, ioaddr+WD_CMDREG5);
outb(ei_status.reg0, ioaddr); /* WD_CMDREG */
- return ei_open(dev);
+ rc = ei_open(dev);
+ if (rc != 0) return rc;
+#ifdef MODULE
+ MOD_INC_USE_COUNT;
+#endif
+ return 0;
}
static void
/* And disable the shared memory. */
outb(ei_status.reg0 & ~WD_MEMENB, wd_cmdreg);
+#ifdef MODULE
+ MOD_DEC_USE_COUNT;
+#endif
+
+ return 0;
+}
+
+
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+static struct device dev_wd80x3 = {
+ " " /*"wd80x3"*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, wd_probe };
+
+int io = 0;
+int irq = 0;
+int mem = 0;
+
+int init_module(void)
+{
+ dev_wd80x3.base_addr = io;
+ dev_wd80x3.irq = irq;
+ dev_wd80x3.mem_start = mem;
+ if (register_netdev(&dev_wd80x3) != 0)
+ return -EIO;
return 0;
}
+
+void
+cleanup_module(void)
+{
+ if (MOD_IN_USE)
+ printk("wd80x3: device busy, remove delayed\n");
+ else
+ {
+ unregister_netdev(&dev_wd80x3);
+ }
+}
+#endif /* MODULE */
\f
/*
DEVICE( INTEL, INTEL_7116, "SAA7116"),
DEVICE( INTEL, INTEL_82865, "82865"),
DEVICE( SMC, SMC_37C665, "FDC 37C665"),
+ DEVICE( SMC, SMC_37C922, "FDC 37C922"),
DEVICE( ATI, ATI_M32, "Mach 32"),
DEVICE( ATI, ATI_M64, "Mach 64"),
DEVICE( WEITEK, WEITEK_P9000, "P9000"),
DEVICE( QLOGIC, QLOGIC_ISP1022, "ISP1022"),
DEVICE( X, X_AGX016, "ITT AGX016"),
DEVICE( VORTEX, VORTEX_GDT, "GDT 6000b"),
- DEVICE( HP, HP_J2585A, "J2585A")
+ DEVICE( HP, HP_J2585A, "J2585A"),
+ DEVICE( MUTECH, MUTECH_MV1000, "MV-1000"),
+ DEVICE( TEKRAM, TEKRAM_DC290, "DC-290")
};
extern int get_module_list(char *);
extern int get_device_list(char *);
extern int get_filesystem_list(char *);
-extern int get_ksyms_list(char *);
+extern int get_ksyms_list(char *, char **, off_t, int);
extern int get_irq_list(char *);
extern int get_dma_list(char *);
extern int get_cpuinfo(char *);
extern int get_pci_list(char*);
-static int get_root_array(char * page, int type)
+static int get_root_array(char * page, int type, char **start, off_t offset, int length)
{
switch (type) {
case PROC_LOADAVG:
return get_filesystem_list(page);
case PROC_KSYMS:
- return get_ksyms_list(page);
+ return get_ksyms_list(page, start, offset, length);
case PROC_DMA:
return get_dma_list(page);
}
-static inline int fill_array(char * page, int pid, int type)
+static inline int fill_array(char * page, int pid, int type, char **start, off_t offset, int length)
{
if (pid)
return get_process_array(page, pid, type);
- return get_root_array(page, type);
+ return get_root_array(page, type, start, offset, length);
}
+#define PROC_BLOCK_SIZE (3*1024) /* 4K page size but our output routines use some slack for overruns */
+
static int array_read(struct inode * inode, struct file * file,char * buf, int count)
{
unsigned long page;
+ char *start;
int length;
int end;
unsigned int type, pid;
if (count < 0)
return -EINVAL;
+ if (count > PROC_BLOCK_SIZE)
+ count = PROC_BLOCK_SIZE;
if (!(page = __get_free_page(GFP_KERNEL)))
return -ENOMEM;
type = inode->i_ino;
pid = type >> 16;
type &= 0x0000ffff;
- length = fill_array((char *) page, pid, type);
+ start = NULL;
+ length = fill_array((char *) page, pid, type,
+ &start, file->f_pos, count);
if (length < 0) {
free_page(page);
return length;
}
- if (file->f_pos >= length) {
- free_page(page);
- return 0;
+ if (start != NULL) {
+ /* We have had block-adjusting processing! */
+ memcpy_tofs(buf, start, length);
+ file->f_pos += length;
+ count = length;
+ } else {
+ /* Static 4kB (or whatever) block capacity */
+ if (file->f_pos >= length) {
+ free_page(page);
+ return 0;
+ }
+ if (count + file->f_pos > length)
+ count = length - file->f_pos;
+ end = count + file->f_pos;
+ memcpy_tofs(buf, (char *) page + file->f_pos, count);
+ file->f_pos = end;
}
- if (count + file->f_pos > length)
- count = length - file->f_pos;
- end = count + file->f_pos;
- memcpy_tofs(buf, (char *) page + file->f_pos, count);
free_page(page);
- file->f_pos = end;
return count;
}
};
static struct proc_dir_entry base_dir[] = {
- { PROC_PID_INO, 1, "." },
- { PROC_ROOT_INO, 2, ".." },
- { PROC_PID_MEM, 3, "mem" },
- { PROC_PID_CWD, 3, "cwd" },
- { PROC_PID_ROOT, 4, "root" },
- { PROC_PID_EXE, 3, "exe" },
- { PROC_PID_FD, 2, "fd" },
- { PROC_PID_ENVIRON, 7, "environ" },
- { PROC_PID_CMDLINE, 7, "cmdline" },
- { PROC_PID_STAT, 4, "stat" },
- { PROC_PID_STATM, 5, "statm" },
- { PROC_PID_MAPS, 4, "maps" }
+ { PROC_PID_INO, NULL, 1, "." },
+ { PROC_ROOT_INO, NULL, 2, ".." },
+ { PROC_PID_MEM, NULL, 3, "mem" },
+ { PROC_PID_CWD, NULL, 3, "cwd" },
+ { PROC_PID_ROOT, NULL, 4, "root" },
+ { PROC_PID_EXE, NULL, 3, "exe" },
+ { PROC_PID_FD, NULL, 2, "fd" },
+ { PROC_PID_ENVIRON, NULL, 7, "environ" },
+ { PROC_PID_CMDLINE, NULL, 7, "cmdline" },
+ { PROC_PID_STAT, NULL, 4, "stat" },
+ { PROC_PID_STATM, NULL, 5, "statm" },
+ { PROC_PID_MAPS, NULL, 4, "maps" }
};
#define NR_BASE_DIRENTRY ((sizeof (base_dir))/(sizeof (base_dir[0])))
#include <asm/segment.h>
extern unsigned long prof_len;
+extern void proc_net_init(void);
void proc_put_inode(struct inode *inode)
{
return NULL;
}
parse_options(data, &s->s_mounted->i_uid, &s->s_mounted->i_gid);
+ proc_net_init();
return s;
}
return;
}
-#ifdef CONFIG_IP_ACCT
+/* #ifdef CONFIG_IP_ACCT */
/* this file may be opened R/W by root to reset the accounting */
if (ino == PROC_NET_IPACCT) {
inode->i_mode = S_IFREG | S_IRUGO | S_IWUSR;
inode->i_op = &proc_net_inode_operations;
return;
}
-#endif
-#ifdef CONFIG_IP_FIREWALL
+/* #endif */
+/* #ifdef CONFIG_IP_FIREWALL */
/* these files may be opened R/W by root to reset the counters */
if ((ino == PROC_NET_IPFWFWD) || (ino == PROC_NET_IPFWBLK)) {
inode->i_mode = S_IFREG | S_IRUGO | S_IWUSR;
inode->i_op = &proc_net_inode_operations;
return;
}
-#endif
+/* #endif */
/* other files within /proc/net */
if ((ino >= PROC_NET_UNIX) && (ino < PROC_NET_LAST)) {
void *, filldir_t filldir);
static int proc_lookupnet(struct inode *,const char *,int,struct inode **);
-/* the get_*_info() functions are in the net code, and are configured
- in via the standard mechanism... */
-extern int unix_get_info(char *, char **, off_t, int);
-#ifdef CONFIG_INET
-extern int tcp_get_info(char *, char **, off_t, int);
-extern int udp_get_info(char *, char **, off_t, int);
-extern int raw_get_info(char *, char **, off_t, int);
-extern int arp_get_info(char *, char **, off_t, int);
-extern int rarp_get_info(char *, char **, off_t, int);
-extern int dev_get_info(char *, char **, off_t, int);
-extern int rt_get_info(char *, char **, off_t, int);
-extern int snmp_get_info(char *, char **, off_t, int);
-extern int afinet_get_info(char *, char **, off_t, int);
-#if defined(CONFIG_WAVELAN)
-extern int wavelan_get_info(char *, char **, off_t, int);
-#endif /* defined(CONFIG_WAVELAN) */
-#ifdef CONFIG_IP_ACCT
-extern int ip_acct_procinfo(char *, char **, off_t, int, int);
-#endif /* CONFIG_IP_ACCT */
-#ifdef CONFIG_IP_FIREWALL
-extern int ip_fw_blk_procinfo(char *, char **, off_t, int, int);
-extern int ip_fw_fwd_procinfo(char *, char **, off_t, int, int);
-#endif /* CONFIG_IP_FIREWALL */
-extern int ip_msqhst_procinfo(char *, char **, off_t, int);
-extern int ip_mc_procinfo(char *, char **, off_t, int);
-#endif /* CONFIG_INET */
-#ifdef CONFIG_IPX
-extern int ipx_get_info(char *, char **, off_t, int);
-extern int ipx_rt_get_info(char *, char **, off_t, int);
-extern int ipx_get_interface_info(char *, char **, off_t , int);
-#endif /* CONFIG_IPX */
-#ifdef CONFIG_AX25
-extern int ax25_get_info(char *, char **, off_t, int);
-extern int ax25_rt_get_info(char *, char **, off_t, int);
-extern int ax25_cs_get_info(char *, char **, off_t, int);
-#ifdef CONFIG_NETROM
-extern int nr_get_info(char *, char **, off_t, int);
-extern int nr_nodes_get_info(char *, char **, off_t, int);
-extern int nr_neigh_get_info(char *, char **, off_t, int);
-#endif /* CONFIG_NETROM */
-#endif /* CONFIG_AX25 */
-#ifdef CONFIG_ATALK
-extern int atalk_get_info(char *, char **, off_t, int);
-extern int atalk_rt_get_info(char *, char **, off_t, int);
-extern int atalk_if_get_info(char *, char **, off_t, int);
-#endif
-
-
static struct file_operations proc_net_operations = {
NULL, /* lseek - default */
proc_readnet, /* read - bad */
NULL /* permission */
};
-static struct proc_dir_entry net_dir[] = {
- { PROC_NET, 1, "." },
- { PROC_ROOT_INO, 2, ".." },
- { PROC_NET_UNIX, 4, "unix" },
-#ifdef CONFIG_INET
- { PROC_NET_ARP, 3, "arp" },
- { PROC_NET_ROUTE, 5, "route" },
- { PROC_NET_DEV, 3, "dev" },
- { PROC_NET_RAW, 3, "raw" },
- { PROC_NET_TCP, 3, "tcp" },
- { PROC_NET_UDP, 3, "udp" },
- { PROC_NET_SNMP, 4, "snmp" },
- { PROC_NET_SOCKSTAT, 8, "sockstat" },
-#ifdef CONFIG_INET_RARP
- { PROC_NET_RARP, 4, "rarp"},
-#endif
-#ifdef CONFIG_IP_MULTICAST
- { PROC_NET_IGMP, 4, "igmp"},
-#endif
-#ifdef CONFIG_IP_FIREWALL
- { PROC_NET_IPFWFWD, 10, "ip_forward"},
- { PROC_NET_IPFWBLK, 8, "ip_block"},
-#endif
-#ifdef CONFIG_IP_MASQUERADE
- { PROC_NET_IPMSQHST, 13, "ip_masquerade"},
-#endif
-#ifdef CONFIG_IP_ACCT
- { PROC_NET_IPACCT, 7, "ip_acct"},
-#endif
-#if defined(CONFIG_WAVELAN)
- { PROC_NET_WAVELAN, 7, "wavelan" },
-#endif /* defined(CONFIG_WAVELAN) */
-#endif /* CONFIG_INET */
-#ifdef CONFIG_IPX
- { PROC_NET_IPX_ROUTE, 9, "ipx_route" },
- { PROC_NET_IPX, 3, "ipx" },
- { PROC_NET_IPX_INTERFACE, 13, "ipx_interface" },
-#endif /* CONFIG_IPX */
-#ifdef CONFIG_AX25
- { PROC_NET_AX25_ROUTE, 10, "ax25_route" },
- { PROC_NET_AX25, 4, "ax25" },
- { PROC_NET_AX25_CALLS, 10, "ax25_calls" },
-#ifdef CONFIG_NETROM
- { PROC_NET_NR_NODES, 8, "nr_nodes" },
- { PROC_NET_NR_NEIGH, 8, "nr_neigh" },
- { PROC_NET_NR, 2, "nr" },
-#endif /* CONFIG_NETROM */
-#endif /* CONFIG_AX25 */
-#ifdef CONFIG_ATALK
- { PROC_NET_ATALK, 9, "appletalk" },
- { PROC_NET_AT_ROUTE, 11,"atalk_route" },
- { PROC_NET_ATIF, 11,"atalk_iface" },
-#endif /* CONFIG_ATALK */
- { 0, 0, NULL }
+#define NR_MAX_PROC_NET_DIR 100
+static struct proc_dir_entry *net_dir[NR_MAX_PROC_NET_DIR] = {
+ NULL,
};
-#define NR_NET_DIRENTRY ((sizeof (net_dir))/(sizeof (net_dir[0])) - 1)
+static int nr_net_direntry = 0;
+
+int proc_net_register(struct proc_dir_entry *dp)
+{
+ int i;
+
+ for (i = 0; net_dir[i] != NULL; ++i ) ;
+
+ if (i >= NR_MAX_PROC_NET_DIR)
+ return -ENOMEM;
+
+ net_dir[i] = dp;
+ net_dir[i+1] = NULL; /* Just make sure.. */
+ ++nr_net_direntry;
+ return i;
+}
+
+int proc_net_unregister(int ino)
+{
+ int i;
+ for (i = 0; net_dir[i] != NULL && i < nr_net_direntry; ++i)
+ if (net_dir[i]->low_ino == ino) {
+ for ( ; net_dir[i] != NULL; ++i )
+ net_dir[i] = net_dir[i+1];
+ --nr_net_direntry;
+ return 0;
+ }
+ return -ENOENT;
+}
+
+static int dir_get_info(char * a, char ** b, off_t d, int e, int f)
+{
+ return -EISDIR;
+}
+
+void proc_net_init(void)
+{
+ static struct proc_dir_entry
+ nd_thisdir = { PROC_NET, dir_get_info, 1, "." },
+ nd_rootdir = { PROC_ROOT_INO, dir_get_info, 1, ".." };
+ static int already = 0;
+
+ if (already) return;
+ already = 1;
+
+ proc_net_register(&nd_thisdir);
+ proc_net_register(&nd_rootdir);
+}
+
static int proc_lookupnet(struct inode * dir,const char * name, int len,
- struct inode ** result)
+ struct inode ** result)
{
- struct proc_dir_entry *de;
+ struct proc_dir_entry **de;
*result = NULL;
if (!dir)
iput(dir);
return -ENOENT;
}
- for (de = net_dir ; de->name ; de++) {
- if (!proc_match(len, name, de))
+ for (de = net_dir ; (*de)->name ; de++) {
+ if (!proc_match(len, name, *de))
continue;
- *result = iget(dir->i_sb, de->low_ino);
+ *result = iget(dir->i_sb, (*de)->low_ino);
iput(dir);
if (!*result)
return -ENOENT;
if (!inode || !S_ISDIR(inode->i_mode))
return -EBADF;
ino = inode->i_ino;
- while (((unsigned) filp->f_pos) < NR_NET_DIRENTRY) {
- de = net_dir + filp->f_pos;
+ while (((unsigned) filp->f_pos) < nr_net_direntry) {
+ de = net_dir[filp->f_pos];
if (filldir(dirent, de->name, de->namelen, filp->f_pos, de->low_ino) < 0)
break;
filp->f_pos++;
char * buf, int count)
{
char * page;
- int length;
unsigned int ino;
int bytes=count;
- int thistime;
+ int i;
int copied=0;
char *start;
+ struct proc_dir_entry * dp;
if (count < 0)
return -EINVAL;
+ ino = inode->i_ino;
+ for (i = 0; ;i++) {
+ if (i >= NR_MAX_PROC_NET_DIR || (dp = net_dir[i]) == NULL)
+ return -EBADF;
+ if (dp->low_ino == ino)
+ break;
+ }
if (!(page = (char*) __get_free_page(GFP_KERNEL)))
return -ENOMEM;
- ino = inode->i_ino;
- while(bytes>0)
+ while (bytes>0)
{
- thistime=bytes;
- if(bytes>PROC_BLOCK_SIZE)
+ int length, thistime=bytes;
+ if (bytes > PROC_BLOCK_SIZE)
thistime=PROC_BLOCK_SIZE;
- switch (ino)
- {
- case PROC_NET_UNIX:
- length = unix_get_info(page,&start,file->f_pos,thistime);
- break;
-#ifdef CONFIG_INET
- case PROC_NET_SOCKSTAT:
- length = afinet_get_info(page,&start,file->f_pos,thistime);
- break;
- case PROC_NET_ARP:
- length = arp_get_info(page,&start,file->f_pos,thistime);
- break;
- case PROC_NET_ROUTE:
- length = rt_get_info(page,&start,file->f_pos,thistime);
- break;
- case PROC_NET_DEV:
- length = dev_get_info(page,&start,file->f_pos,thistime);
- break;
- case PROC_NET_RAW:
- length = raw_get_info(page,&start,file->f_pos,thistime);
- break;
- case PROC_NET_TCP:
- length = tcp_get_info(page,&start,file->f_pos,thistime);
- break;
- case PROC_NET_UDP:
- length = udp_get_info(page,&start,file->f_pos,thistime);
- break;
- case PROC_NET_SNMP:
- length = snmp_get_info(page, &start, file->f_pos,thistime);
- break;
-#ifdef CONFIG_IP_MULTICAST
- case PROC_NET_IGMP:
- length = ip_mc_procinfo(page, &start, file->f_pos,thistime);
- break;
-#endif
-#ifdef CONFIG_IP_FIREWALL
- case PROC_NET_IPFWFWD:
- length = ip_fw_fwd_procinfo(page, &start, file->f_pos,
- thistime, (file->f_flags & O_ACCMODE) == O_RDWR);
- break;
- case PROC_NET_IPFWBLK:
- length = ip_fw_blk_procinfo(page, &start, file->f_pos,
- thistime, (file->f_flags & O_ACCMODE) == O_RDWR);
- break;
-#endif
-#ifdef CONFIG_IP_ACCT
- case PROC_NET_IPACCT:
- length = ip_acct_procinfo(page, &start, file->f_pos,
- thistime, (file->f_flags & O_ACCMODE) == O_RDWR);
- break;
-#endif
-#ifdef CONFIG_IP_MASQUERADE
- case PROC_NET_IPMSQHST:
- length = ip_msqhst_procinfo(page, &start, file->f_pos,thistime);
- break;
-#endif
-#ifdef CONFIG_INET_RARP
- case PROC_NET_RARP:
- length = rarp_get_info(page,&start,file->f_pos,thistime);
- break;
-#endif /* CONFIG_INET_RARP */
-#if defined(CONFIG_WAVELAN)
- case PROC_NET_WAVELAN:
- length = wavelan_get_info(page, &start, file->f_pos, thistime);
- break;
-#endif /* defined(CONFIG_WAVELAN) */
-#endif /* CONFIG_INET */
-#ifdef CONFIG_IPX
- case PROC_NET_IPX_INTERFACE:
- length = ipx_get_interface_info(page, &start, file->f_pos, thistime);
- break;
- case PROC_NET_IPX_ROUTE:
- length = ipx_rt_get_info(page,&start,file->f_pos,thistime);
- break;
- case PROC_NET_IPX:
- length = ipx_get_info(page,&start,file->f_pos,thistime);
- break;
-#endif /* CONFIG_IPX */
-#ifdef CONFIG_ATALK
- case PROC_NET_ATALK:
- length = atalk_get_info(page, &start, file->f_pos, thistime);
- break;
- case PROC_NET_AT_ROUTE:
- length = atalk_rt_get_info(page, &start, file->f_pos, thistime);
- break;
- case PROC_NET_ATIF:
- length = atalk_if_get_info(page, &start, file->f_pos, thistime);
- break;
-#endif /* CONFIG_ATALK */
-#ifdef CONFIG_AX25
- case PROC_NET_AX25_ROUTE:
- length = ax25_rt_get_info(page,&start,file->f_pos,thistime);
- break;
- case PROC_NET_AX25:
- length = ax25_get_info(page,&start,file->f_pos,thistime);
- break;
- case PROC_NET_AX25_CALLS:
- length = ax25_cs_get_info(page,&start,file->f_pos,thistime);
- break;
-#ifdef CONFIG_NETROM
- case PROC_NET_NR_NODES:
- length = nr_nodes_get_info(page,&start,file->f_pos,thistime);
- break;
- case PROC_NET_NR_NEIGH:
- length = nr_neigh_get_info(page,&start,file->f_pos,thistime);
- break;
- case PROC_NET_NR:
- length = nr_get_info(page,&start,file->f_pos,thistime);
- break;
-#endif /* CONFIG_NETROM */
-#endif /* CONFIG_AX25 */
+ length = dp->get_info(page, &start,
+ file->f_pos,
+ thistime,
+ (file->f_flags & O_ACCMODE) == O_RDWR);
- default:
- free_page((unsigned long) page);
- return -EBADF;
- }
-
/*
* We have been given a non page aligned block of
* the data we asked for + a bit. We have been given
* Copy the bytes
*/
memcpy_tofs(buf+copied, start, length);
- file->f_pos+=length; /* Move down the file */
- bytes-=length;
- copied+=length;
- if(length<thistime)
+ file->f_pos += length; /* Move down the file */
+ bytes -= length;
+ copied += length;
+ if (length<thistime)
break; /* End of file */
}
free_page((unsigned long) page);
return copied;
-
}
};
static struct proc_dir_entry root_dir[] = {
- { PROC_ROOT_INO, 1, "." },
- { PROC_ROOT_INO, 2, ".." },
- { PROC_LOADAVG, 7, "loadavg" },
- { PROC_UPTIME, 6, "uptime" },
- { PROC_MEMINFO, 7, "meminfo" },
- { PROC_KMSG, 4, "kmsg" },
- { PROC_VERSION, 7, "version" },
+ { PROC_ROOT_INO, NULL, 1, "." },
+ { PROC_ROOT_INO, NULL, 2, ".." },
+ { PROC_LOADAVG, NULL, 7, "loadavg" },
+ { PROC_UPTIME, NULL, 6, "uptime" },
+ { PROC_MEMINFO, NULL, 7, "meminfo" },
+ { PROC_KMSG, NULL, 4, "kmsg" },
+ { PROC_VERSION, NULL, 7, "version" },
#ifdef CONFIG_PCI
- { PROC_PCI, 3, "pci" },
+ { PROC_PCI, NULL, 3, "pci" },
#endif
- { PROC_CPUINFO, 7, "cpuinfo" },
- { PROC_SELF, 4, "self" }, /* will change inode # */
- { PROC_NET, 3, "net" },
- { PROC_SCSI, 4, "scsi" },
+ { PROC_CPUINFO, NULL, 7, "cpuinfo" },
+ { PROC_SELF, NULL, 4, "self" }, /* will change inode # */
+ { PROC_NET, NULL, 3, "net" },
+ { PROC_SCSI, NULL, 4, "scsi" },
#ifdef CONFIG_DEBUG_MALLOC
- { PROC_MALLOC, 6, "malloc" },
+ { PROC_MALLOC, NULL, 6, "malloc" },
#endif
- { PROC_KCORE, 5, "kcore" },
- { PROC_MODULES, 7, "modules" },
- { PROC_STAT, 4, "stat" },
- { PROC_DEVICES, 7, "devices" },
- { PROC_INTERRUPTS, 10,"interrupts" },
- { PROC_FILESYSTEMS, 11,"filesystems" },
- { PROC_KSYMS, 5, "ksyms" },
- { PROC_DMA, 3, "dma" },
- { PROC_IOPORTS, 7, "ioports"},
+ { PROC_KCORE, NULL, 5, "kcore" },
+ { PROC_MODULES, NULL, 7, "modules" },
+ { PROC_STAT, NULL, 4, "stat" },
+ { PROC_DEVICES, NULL, 7, "devices" },
+ { PROC_INTERRUPTS, NULL, 10,"interrupts" },
+ { PROC_FILESYSTEMS, NULL, 11,"filesystems" },
+ { PROC_KSYMS, NULL, 5, "ksyms" },
+ { PROC_DMA, NULL, 3, "dma" },
+ { PROC_IOPORTS, NULL, 7, "ioports"},
#ifdef CONFIG_PROFILE
- { PROC_PROFILE, 7, "profile"},
+ { PROC_PROFILE, NULL, 7, "profile"},
#endif
};
struct proc_dir_entry scsi_hba_dir[(PROC_SCSI_LAST - PROC_SCSI_FILE) * 4];
static struct proc_dir_entry scsi_dir2[] = {
- { PROC_SCSI, 1, "." },
- { PROC_ROOT_INO, 2, ".." },
- { PROC_SCSI_NOT_PRESENT, 11, "not.present" },
- { 0, 0, NULL }
+ { PROC_SCSI, NULL, 1, "." },
+ { PROC_ROOT_INO, NULL, 2, ".." },
+ { PROC_SCSI_NOT_PRESENT, NULL, 11, "not.present" },
+ { 0, NULL, 0, NULL }
};
inline static uint count_dir_entries(uint inode, uint *num)
extern void eth_header_cache(struct device *dev, struct sock *sk, unsigned long saddr, unsigned long daddr);
extern void eth_copy_and_sum(struct sk_buff *dest,
unsigned char *src, int length, int base);
-
+extern struct device * init_etherdev(struct device *, int, unsigned long*);
#endif
#ifndef _LINUX_IOCTL_H
#define _LINUX_IOCTL_H
+#include <asm/page.h> /* for PAGE_SIZE */
/* ioctl command encoding: 32 bits total, command in lower 16 bits,
* size of the parameter structure in the lower 14 bits of the
#define IOC_INOUT (IOC_IN | IOC_OUT) /* both */
#define IOCSIZE_MASK 0x3fff0000 /* size (max 16k-1 bytes) */
#define IOCSIZE_SHIFT 16 /* how to get the size */
-#define IOCSIZE_MAX ((PAGE_SIZE-1)&(IOCSIZE_MASK >> IOC_SHIFT))
+#define IOCSIZE_MAX ((PAGE_SIZE-1)&(IOCSIZE_MASK >> IOCSIZE_SHIFT))
#define IOCCMD_MASK 0x0000ffff /* command code */
#define IOCCMD_SHIFT 0
#define IOCPARM_MASK IOCCMD_MASK
extern int in_net_bh(void);
extern void net_bh(void *tmp);
extern void dev_tint(struct device *dev);
-extern int dev_get_info(char *buffer, char **start, off_t offset, int length);
+extern int dev_get_info(char *buffer, char **start, off_t offset, int length, int dummy);
extern int dev_ioctl(unsigned int cmd, void *);
extern void dev_init(void);
#define PCI_VENDOR_ID_SMC 0x1042
#define PCI_DEVICE_ID_SMC_37C665 0x1000
+#define PCI_DEVICE_ID_SMC_37C922 0x1001
#define PCI_VENDOR_ID_ATI 0x1002
#define PCI_DEVICE_ID_ATI_M32 0x4158
#define PCI_VENDOR_ID_HP 0x103c
#define PCI_DEVICE_ID_HP_J2585A 0x1030
+#define PCI_VENDOR_ID_TEKRAM 0x1de1
+#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29
+
+#define PCI_VENDOR_ID_MUTECH 0x1159
+#define PCI_DEVICE_ID_MUTECH_MV1000 0x0001
+
/*
* The PCI interface treats multi-function devices as independent
* devices. The slot/function address of each device is encoded
* The proc filesystem constants/structures
*/
+/*
+ * We always define these enumerators
+ */
+
enum root_directory_inos {
PROC_ROOT_INO = 1,
PROC_LOADAVG,
PROC_SELF, /* will change inode # */
PROC_NET,
PROC_SCSI,
-#ifdef CONFIG_DEBUG_MALLOC
PROC_MALLOC,
-#endif
PROC_KCORE,
PROC_MODULES,
PROC_STAT,
enum net_directory_inos {
PROC_NET_UNIX = 128,
-#ifdef CONFIG_INET
PROC_NET_ARP,
PROC_NET_ROUTE,
PROC_NET_DEV,
PROC_NET_TCP,
PROC_NET_UDP,
PROC_NET_SNMP,
-#ifdef CONFIG_INET_RARP
PROC_NET_RARP,
-#endif
-#ifdef CONFIG_IP_MULTICAST
PROC_NET_IGMP,
-#endif
-#ifdef CONFIG_IP_FIREWALL
PROC_NET_IPFWFWD,
PROC_NET_IPFWBLK,
-#endif
-#ifdef CONFIG_IP_ACCT
PROC_NET_IPACCT,
-#endif
-#ifdef CONFIG_IP_MASQUERADE
PROC_NET_IPMSQHST,
-#endif
-#if defined(CONFIG_WAVELAN)
PROC_NET_WAVELAN,
-#endif /* defined(CONFIG_WAVELAN) */
-#endif
-#ifdef CONFIG_IPX
PROC_NET_IPX_INTERFACE,
PROC_NET_IPX_ROUTE,
PROC_NET_IPX,
-#endif
-#ifdef CONFIG_ATALK
PROC_NET_ATALK,
PROC_NET_AT_ROUTE,
PROC_NET_ATIF,
-#endif
-#ifdef CONFIG_AX25
PROC_NET_AX25_ROUTE,
PROC_NET_AX25,
PROC_NET_AX25_CALLS,
-#ifdef CONFIG_NETROM
PROC_NET_NR_NODES,
PROC_NET_NR_NEIGH,
PROC_NET_NR,
-#endif
-#endif
PROC_NET_SOCKSTAT,
PROC_NET_LAST
};
struct proc_dir_entry {
unsigned short low_ino;
+ int (*get_info)(char *, char **, off_t, int, int);
unsigned short namelen;
const char * name;
};
extern void proc_read_inode(struct inode *);
extern void proc_write_inode(struct inode *);
extern int proc_match(int, const char *, struct proc_dir_entry *);
+extern int proc_net_register(struct proc_dir_entry *);
+extern int proc_net_unregister(int);
extern struct inode_operations proc_root_inode_operations;
extern struct inode_operations proc_base_inode_operations;
#define PF_MAX AF_MAX
+/* Maximum queue length specificable by listen. */
+#define SOMAXCONN 128
+
/* Flags we can use with send/ and recv. */
#define MSG_OOB 1
#define MSG_PEEK 2
extern int arp_query(unsigned char *haddr, u32 paddr, unsigned short type);
extern int arp_find(unsigned char *haddr, u32 paddr,
struct device *dev, u32 saddr, struct sk_buff *skb);
-extern int arp_get_info(char *buffer, char **start, off_t origin, int length);
+extern int arp_get_info(char *buffer, char **start, off_t origin, int length, int dummy);
extern int arp_ioctl(unsigned int cmd, void *arg);
extern void arp_send(int type, int ptype, u32 dest_ip,
struct device *dev, u32 src_ip,
extern int ax25_encapsulate(struct sk_buff *, struct device *, unsigned short,
void *, void *, unsigned int);
extern int ax25_rebuild_header(unsigned char *, struct device *, unsigned long, struct sk_buff *);
-extern int ax25_get_info(char *, char **, off_t, int);
+extern int ax25_get_info(char *, char **, off_t, int, int);
extern ax25_uid_assoc *ax25_uid_list;
extern int ax25_uid_policy;
extern ax25_address *ax25_findbyuid(uid_t);
/* ax25_route.c */
extern void ax25_rt_rx_frame(ax25_address *, struct device *);
-extern int ax25_rt_get_info(char *, char **, off_t, int);
-extern int ax25_cs_get_info(char *, char **, off_t, int);
+extern int ax25_rt_get_info(char *, char **, off_t, int, int);
+extern int ax25_cs_get_info(char *, char **, off_t, int, int);
extern int ax25_rt_autobind(ax25_cb *, ax25_address *);
extern void ax25_rt_device_down(struct device *);
extern void ax25_ip_mode_set(ax25_address *, struct device *, char);
#ifdef CONFIG_IP_MULTICAST
extern void ip_mc_dropsocket(struct sock *);
extern void ip_mc_dropdevice(struct device *dev);
-extern int ip_mc_procinfo(char *, char **, off_t, int);
+extern int ip_mc_procinfo(char *, char **, off_t, int, int);
#endif
#define _RARP_H
extern int rarp_ioctl(unsigned int cmd, void *arg);
-extern int rarp_rcv(struct sk_buff *skb,
- struct device *dev,
- struct packet_type *pt);
extern int rarp_get_info(char *buffer,
char **start,
off_t offset,
- int length);
+ int length,
+ int dummy);
#endif /* _RARP_H */
unsigned long gw, struct device *dev, unsigned short mss, unsigned long window, unsigned short irtt, unsigned char metric);
extern struct rtable *ip_rt_route(unsigned long daddr, struct options *opt, unsigned long *src_addr);
extern struct rtable *ip_rt_local(unsigned long daddr, struct options *opt, unsigned long *src_addr);
-extern int rt_get_info(char * buffer, char **start, off_t offset, int length);
+extern int rt_get_info(char * buffer, char **start, off_t offset, int length, int dummy);
extern int ip_rt_ioctl(unsigned int cmd, void *arg);
extern unsigned long rt_stamp;
#include <net/protocol.h>
#include <net/arp.h>
#include <net/tcp.h>
+#include <net/route.h>
#if defined(CONFIG_PPP) || defined(CONFIG_SLIP)
#include "../drivers/net/slhc.h"
#endif
extern char *get_options(char *str, int *ints);
extern void set_device_ro(int dev,int flag);
extern struct file_operations * get_blkfops(unsigned int);
-
+
extern void *sys_call_table;
#ifdef CONFIG_FTAPE
extern int sys_tz;
extern int request_dma(unsigned int dmanr, char * deviceID);
extern void free_dma(unsigned int dmanr);
+extern int (*rarp_ioctl_hook)(int,void*);
extern int close_fp(struct file *filp);
extern void (* iABI_hook)(struct pt_regs * regs);
X(timer_table),
X(intr_count),
+ /* autoirq from drivers/net/auto_irq.c */
+ X(autoirq_setup),
+ X(autoirq_report),
+
/* dma handling */
X(request_dma),
X(free_dma),
#ifdef CONFIG_INET
X(inet_add_protocol),
X(inet_del_protocol),
+ X(rarp_ioctl_hook),
+ X(init_etherdev),
+ X(ip_rt_route),
+ X(arp_send),
#if defined(CONFIG_PPP) || defined(CONFIG_SLIP)
/* VJ header compression */
X(slhc_init),
X(msdos_unlink),
X(msdos_unlink_umsdos),
X(msdos_write_inode),
+#endif
+#ifdef CONFIG_PROC_FS
+ X(proc_net_register),
+ X(proc_net_unregister),
#endif
/********************************************************
* Do not add anything below this line,
* and finally: reducing the number of entries in ksyms.c
* since every subsystem should now be able to decide and
* control exactly what symbols it wants to export, locally!
+ *
+ * On 1-Aug-95: <Matti.Aarnio@utu.fi> altered code to use same style as
+ * do /proc/net/XXX "files". Namely allow more than 4kB
+ * (or what the block size if) output.
*/
#ifdef DEBUG_MODULE
static int module_init_flag = 0; /* Hmm... */
+extern struct symbol_table symbol_table; /* in kernel/ksyms.c */
+
/*
* Called at boot time
*/
void init_modules(void) {
- extern struct symbol_table symbol_table; /* in kernel/ksyms.c */
struct internal_symbol *sym;
int i;
/*
* Called by the /proc file system to return a current list of ksyms.
*/
-int get_ksyms_list(char *buf)
+int get_ksyms_list(char *buf, char **start, off_t offset, int length)
{
struct module *mp;
struct internal_symbol *sym;
int i;
char *p = buf;
+ int len = 0; /* code from net/ipv4/proc.c */
+ off_t pos = 0;
+ off_t begin = 0;
for (mp = module_list; mp; mp = mp->next) {
if ((mp->state == MOD_RUNNING) &&
- (mp->symtab != NULL) && (mp->symtab->n_symbols > 0)) {
+ (mp->symtab != NULL) &&
+ (mp->symtab->n_symbols > 0)) {
for (i = mp->symtab->n_symbols,
sym = mp->symtab->symbol;
i > 0; --i, ++sym) {
- if (p - buf > 4096 - 100) {
- strcat(p, "...\n");
- p += strlen(p);
- return p - buf; /* avoid overflowing buffer */
- }
-
+ p = buf + len;
if (mp->name[0]) {
- sprintf(p, "%08lx %s\t[%s]\n",
- (long)sym->addr, sym->name, mp->name);
+ len += sprintf(p, "%08lx %s\t[%s]\n",
+ (long)sym->addr,
+ sym->name, mp->name);
+ } else {
+ len += sprintf(p, "%08lx %s\n",
+ (long)sym->addr,
+ sym->name);
}
- else {
- sprintf(p, "%08lx %s\n",
- (long)sym->addr, sym->name);
+ pos = begin + len;
+ if (pos < offset) {
+ len = 0;
+ begin = pos;
}
- p += strlen(p);
+ pos = begin + len;
+ if (pos > offset+length)
+ goto leave_the_loop;
}
}
}
-
- return p - buf;
+ leave_the_loop:
+ *start = buf + (offset - begin);
+ len -= (offset - begin);
+ if (len > length)
+ len = length;
+ return len;
}
/*
tar:
tar -cvf /dev/f1 .
+modules:
include $(TOPDIR)/Rules.make
$(CPP) -M *.c > .depend
set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i dep; done
-modules:
+modules: dummy
+ set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i modules; done
+
include $(TOPDIR)/Rules.make
tar:
tar -cvf /dev/f1 .
-
+modules:
include $(TOPDIR)/Rules.make
#include <net/psnap.h>
#include <net/sock.h>
#include <linux/atalk.h>
+#include <linux/proc_fs.h>
#ifdef CONFIG_ATALK
{
static char ddp_snap_id[]={0x08,0x00,0x07,0x80,0x9B};
(void) sock_register(atalk_proto_ops.family, &atalk_proto_ops);
- if((ddp_dl=register_snap_client(ddp_snap_id, atalk_rcv))==NULL)
+ if ((ddp_dl = register_snap_client(ddp_snap_id, atalk_rcv)) == NULL)
printk("Unable to register DDP with SNAP.\n");
register_netdevice_notifier(&ddp_notifier);
aarp_proto_init();
+
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_ATALK, atalk_get_info, 9, "appletalk" });
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_AT_ROUTE, atalk_rt_get_info, 11,"atalk_route" });
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_ATIF, atalk_if_get_info, 11,"atalk_iface" });
+
printk("Appletalk BETA 0.11 for Linux NET3.030\n");
-
}
#endif
tar:
tar -cvf /dev/f1 .
+modules:
include $(TOPDIR)/Rules.make
return(0);
}
-int ax25_get_info(char *buffer, char **start, off_t offset, int length)
+int ax25_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
ax25_cb *ax25;
struct device *dev;
bpq_packet_type.type = htons(ETH_P_BPQ);
dev_add_pack(&bpq_packet_type);
register_netdevice_notifier(&ax25_dev_notifier);
+
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_AX25_ROUTE, ax25_rt_get_info, 10, "ax25_route" });
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_AX25, ax25_get_info, 4, "ax25" });
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_AX25_CALLS, ax25_cs_get_info, 10, "ax25_calls" });
+
printk("GW4PTS/G4KLX AX.25 for Linux. Version 0.30 ALPHA for Linux NET3.030 (Linux 1.3.0)\n");
}
}
}
-int ax25_rt_get_info(char *buffer, char **start, off_t offset, int length)
+int ax25_rt_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
struct ax25_route *ax25_rt;
int len = 0;
return len;
}
-int ax25_cs_get_info(char *buffer, char **start, off_t offset, int length)
+int ax25_cs_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
ax25_uid_assoc *pt;
int len = 0;
tar:
tar -cvf /dev/f1 .
+modules:
include $(TOPDIR)/Rules.make
switch(sel_type)
{
case SEL_IN:
+ if (sk->err)
+ return 1;
+ if (sk->shutdown & RCV_SHUTDOWN)
+ return 1;
if (sk->type==SOCK_SEQPACKET && sk->state==TCP_CLOSE)
{
/* Connection closed: Wake up */
return(1);
}
- if (skb_peek(&sk->receive_queue) != NULL || sk->err != 0)
+ if (skb_peek(&sk->receive_queue) != NULL)
{ /* This appears to be consistent
with other stacks */
return(1);
return(0);
case SEL_OUT:
+ if (sk->err)
+ return 1;
+ if (sk->shutdown & SEND_SHUTDOWN)
+ return 1;
if (sk->type==SOCK_SEQPACKET && sk->state==TCP_SYN_SENT)
{
/* Connection still in progress */
- return(0);
+ break;
}
if (sk->prot && sk->prot->wspace(sk) >= MIN_WRITE_SPACE)
{
#include <linux/skbuff.h>
#include <net/sock.h>
#include <net/arp.h>
-
+#include <linux/proc_fs.h>
/*
* The list of packet types we will receive (as opposed to discard)
* to create /proc/net/dev
*/
-int dev_get_info(char *buffer, char **start, off_t offset, int length)
+int dev_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
int len=0;
off_t begin=0;
dev2 = dev;
}
}
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_DEV, dev_get_info, 3, "dev" });
+
}
tar:
tar -cvf /dev/f1 .
+modules:
include $(TOPDIR)/Rules.make
.s.o:
$(AS) -o $*.o $<
-OBJS := utils.o route.o proc.o timer.o protocol.o packet.o \
+IPV4_OBJS := utils.o route.o proc.o timer.o protocol.o packet.o \
arp.o ip.o raw.o icmp.o tcp.o udp.o devinet.o af_inet.o \
igmp.o ip_fw.o ipip.o
-ifdef CONFIG_INET_RARP
-
-OBJS := $(OBJS) rarp.o
+MODULES :=
+ifdef CONFIG_INET_RARP
+IPV4_OBJS := $(IPV4_OBJS) rarp.o
+else
+MODULES := $(MODULES) rarp.o
endif
ifdef CONFIG_INET
-ipv4.o: $(OBJS)
- $(LD) -r -o ipv4.o $(OBJS)
+ipv4.o: $(IPV4_OBJS)
+ $(LD) -r -o ipv4.o $(IPV4_OBJS)
else
endif
+ifdef MODULES
dep:
- $(CPP) -M *.c > .depend
+ $(CPP) -M $(IPV4_OBJS:.o=.c) > .depend
+ $(CPP) -M -DMODULE $(MODULES:.o=.c) >> .depend
+else
+dep:
+ $(CPP) -M $(IPV4_OBJS:.o=.c) > .depend
+endif
tar:
tar -cvf /dev/f1 .
+ifdef MODULES
+
+modules: $(MODULES)
+ echo $(MODULES) > ../../modules/IPV4_MODULES
+ cd ../../modules; \
+ for i in $(MODULES); do ln -sf ../net/ipv4/$$i .; done
+
+else
+
+modules:
+
+endif
include $(TOPDIR)/Rules.make
#include <linux/fcntl.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
+#include <linux/proc_fs.h>
#include <asm/segment.h>
#include <asm/system.h>
#define min(a,b) ((a)<(b)?(a):(b))
extern struct proto packet_prot;
+extern int raw_get_info(char *, char **, off_t, int, int);
+extern int snmp_get_info(char *, char **, off_t, int, int);
+extern int afinet_get_info(char *, char **, off_t, int, int);
+extern int tcp_get_info(char *, char **, off_t, int, int);
+extern int udp_get_info(char *, char **, off_t, int, int);
+int (*rarp_ioctl_hook)(int,void*) = NULL;
/*
* See if a socket number is in use.
*/
if ((unsigned) backlog == 0) /* BSDism */
backlog = 1;
- if ((unsigned) backlog > 128)
- backlog = 128;
+ if ((unsigned) backlog > SOMAXCONN)
+ backlog = SOMAXCONN;
sk->max_ack_backlog = backlog;
if (sk->state != TCP_LISTEN)
{
case SIOCGARP:
case SIOCSARP:
return(arp_ioctl(cmd,(void *) arg));
-#ifdef CONFIG_INET_RARP
case SIOCDRARP:
case SIOCGRARP:
case SIOCSRARP:
- return(rarp_ioctl(cmd,(void *) arg));
-#endif
+ if (rarp_ioctl_hook != NULL)
+ return(rarp_ioctl_hook(cmd,(void *) arg));
case SIOCGIFCONF:
case SIOCGIFFLAGS:
case SIOCSIFFLAGS:
* Set the IP module up
*/
ip_init();
-}
+#ifdef CONFIG_INET_RARP
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_RARP, rarp_get_info, 4, "rarp"});
+ rarp_ioctl_hook = rarp_ioctl;
+#endif
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_RAW, raw_get_info, 3, "raw" });
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_SNMP, snmp_get_info, 4, "snmp" });
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_SOCKSTAT, afinet_get_info, 8, "sockstat" });
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_TCP, tcp_get_info, 3, "tcp" });
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_UDP, udp_get_info, 3, "udp" });
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_ROUTE, rt_get_info, 5, "route" });
+}
#include <net/netrom.h>
#endif
#endif
+#include <linux/proc_fs.h>
/*
#define HBUFFERLEN 30
-int arp_get_info(char *buffer, char **start, off_t offset, int length)
+int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
int len=0;
off_t begin=0;
add_timer(&arp_timer);
/* Register for device down reports */
register_netdevice_notifier(&arp_dev_notifier);
+
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_ARP, arp_get_info, 3, "arp" });
}
#include <linux/inet.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
+#include <linux/proc_fs.h>
#include <net/snmp.h>
#include <net/ip.h>
* read.
*/
-int ip_mc_procinfo(char *buffer, char **start, off_t offset, int length)
+int ip_mc_procinfo(char *buffer, char **start, off_t offset, int length, int dummy)
{
off_t pos=0, begin=0;
struct ip_mc_list *im;
/* So we flush routes when a device is downed */
register_netdevice_notifier(&ip_rt_notifier);
+
/* ip_raw_init();
ip_packet_init();
ip_tcp_init();
ip_udp_init();*/
+
+#ifdef CONFIG_IP_MULTICAST
+ proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_IGMP, ip_mc_procinfo, 4, "igmp"});
+#endif
}
#include <net/icmp.h>
#include <linux/ip_fw.h>
#include <net/checksum.h>
+#include <linux/proc_fs.h>
/*
* Implement IP packet firewall
#if defined(CONFIG_IP_FIREWALL) || defined(CONFIG_IP_ACCT)
static int ip_chain_procinfo(int stage, char *buffer, char **start,
- off_t offset, int length, int reset)
+ off_t offset, int length, int reset)
{
off_t pos=0, begin=0;
struct ip_fw *i;
#ifdef CONFIG_IP_ACCT
-int ip_acct_procinfo(char *buffer, char **start, off_t offset, int length, int reset)
+static int ip_acct_procinfo(char *buffer, char **start, off_t offset,
+ int length, int reset)
{
- return ip_chain_procinfo(IP_INFO_ACCT, buffer,start,offset,length,reset);
+ return ip_chain_procinfo(IP_INFO_ACCT, buffer,start, offset,length,
+ reset);
}
#endif
#ifdef CONFIG_IP_FIREWALL
-int ip_fw_blk_procinfo(char *buffer, char **start, off_t offset, int length, int reset)
+static int ip_fw_blk_procinfo(char *buffer, char **start, off_t offset,
+ int length, int reset)
{
- return ip_chain_procinfo(IP_INFO_BLK, buffer,start,offset,length,reset);
+ return ip_chain_procinfo(IP_INFO_BLK, buffer,start,offset,length,
+ reset);
}
-int ip_fw_fwd_procinfo(char *buffer, char **start, off_t offset, int length, int reset)
+static int ip_fw_fwd_procinfo(char *buffer, char **start, off_t offset,
+ int length, int reset)
{
- return ip_chain_procinfo(IP_INFO_FWD, buffer,start,offset,length,reset);
+ return ip_chain_procinfo(IP_INFO_FWD, buffer,start,offset,length,
+ reset);
}
#endif
#ifdef CONFIG_IP_MASQUERADE
-int ip_msqhst_procinfo(char *buffer, char **start, off_t offset, int length)
+static int ip_msqhst_procinfo(char *buffer, char **start, off_t offset,
+ int length)
{
off_t pos=0, begin=0;
struct ip_masq *ms;
#endif
+void ip_fw_init(void)
+{
+#ifdef CONFIG_IP_ACCT
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_IPACCT, ip_acct_procinfo, 7, "ip_acct"});
+#endif
+#ifdef CONFIG_IP_FIREWALL
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_IPFWBLK, ip_fw_blk_procinfo, 8, "ip_block"});
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_IPFWFWD, ip_fw_fwd_procinfo, 10, "ip_forward"});
+#endif
+#ifdef CONFIG_IP_MASQUERADE
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_IPMSQHST, ip_msqhst_procinfo, 13, "ip_masquerade"});
+#endif
+}
off_t begin=0;
s_array = pro->sock_array;
- len+=sprintf(buffer, "sl local_address rem_address st tx_queue rx_queue tr tm->when uid\n");
+ len += sprintf(buffer, "sl local_address rem_address st tx_queue rx_queue tr tm->when uid\n");
/*
- * This was very pretty but didn't work when a socket is destroyed at the wrong moment
- * (eg a syn recv socket getting a reset), or a memory timer destroy. Instead of playing
- * with timers we just concede defeat and cli().
+ * This was very pretty but didn't work when a socket is destroyed
+ * at the wrong moment (eg a syn recv socket getting a reset), or
+ * a memory timer destroy. Instead of playing with timers we just
+ * concede defeat and cli().
*/
for(i = 0; i < SOCK_ARRAY_SIZE; i++)
{
timer_active=timer_active2;
timer_expires=sp->timer.expires;
}
- len+=sprintf(buffer+len, "%2d: %08lX:%04X %08lX:%04X %02X %08lX:%08lX %02X:%08lX %08X %d %d\n",
+ len += sprintf(buffer+len, "%2d: %08lX:%04X %08lX:%04X %02X %08lX:%08lX %02X:%08lX %08X %d %d\n",
i, src, srcp, dest, destp, sp->state,
format==0?sp->write_seq-sp->rcv_ack_seq:sp->rmem_alloc,
format==0?sp->acked_seq-sp->copied_seq:sp->wmem_alloc,
if(pos>offset+length)
break;
}
- sti(); /* We only turn interrupts back on for a moment, but because the interrupt queues anything built up
- before this will clear before we jump back and cli, so it's not as bad as it looks */
+ sti(); /* We only turn interrupts back on for a moment,
+ but because the interrupt queues anything built
+ up before this will clear before we jump back
+ and cli(), so it's not as bad as it looks */
if(pos>offset+length)
break;
}
}
-int tcp_get_info(char *buffer, char **start, off_t offset, int length)
+int tcp_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
return get__netinfo(&tcp_prot, buffer,0, start, offset, length);
}
-int udp_get_info(char *buffer, char **start, off_t offset, int length)
+int udp_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
return get__netinfo(&udp_prot, buffer,1, start, offset, length);
}
-int raw_get_info(char *buffer, char **start, off_t offset, int length)
+int raw_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
return get__netinfo(&raw_prot, buffer,1, start, offset, length);
}
/*
* Report socket allocation statistics [mea@utu.fi]
*/
-int afinet_get_info(char *buffer, char **start, off_t offset, int length)
+int afinet_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
/* From net/socket.c */
extern int socket_get_info(char *, char **, off_t, int);
* Called from the PROCfs module. This outputs /proc/net/snmp.
*/
-int snmp_get_info(char *buffer, char **start, off_t offset, int length)
+int snmp_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
extern struct tcp_mib tcp_statistics;
extern struct udp_mib udp_statistics;
len = length;
return len;
}
-
*
*/
+#include <linux/config.h>
+
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
#include <linux/types.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/mm.h>
-#include <linux/config.h>
#include <linux/socket.h>
#include <linux/sockios.h>
#include <linux/errno.h>
#ifdef CONFIG_AX25
#include <net/ax25.h>
#endif
+#include <linux/proc_fs.h>
+
+#if defined(CONFIG_INET_RARP) || defined(MODULE)
-#ifdef CONFIG_INET_RARP
+extern int (*rarp_ioctl_hook)(unsigned int,void*);
/*
* This structure defines the RARP mapping cache. As long as we make
struct rarp_table *rarp_tables = NULL;
+static int rarp_rcv(struct sk_buff *, struct device *, struct packet_type *);
static struct packet_type rarp_packet_type =
{
0
};
-static void rarp_init (void)
+static void rarp_init_pkt (void)
{
/* Register the packet type */
rarp_packet_type.type=htons(ETH_P_RARP);
* "overhead" time isn't that high...
*/
-int rarp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
+static int rarp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
{
/*
* We shouldn't use this type conversion. Check later.
(rarp->ar_pro != htons(ETH_P_IP) && dev->type != ARPHRD_AX25)
|| rarp->ar_pln != 4)
{
- /*
- * This packet is not for us. Remove it.
- */
- kfree_skb(skb, FREE_READ);
- return 0;
-}
+ /*
+ * This packet is not for us. Remove it.
+ */
+ kfree_skb(skb, FREE_READ);
+ return 0;
+ }
/*
* Extract variable width fields
sti();
return -ENOMEM;
}
- if(initflag)
+ if (initflag)
{
- rarp_init();
+ rarp_init_pkt();
initflag=0;
}
return 0;
}
-int rarp_get_info(char *buffer, char **start, off_t offset, int length)
+int rarp_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
int len=0;
off_t begin=0;
struct rarp_table *entry;
char ipbuffer[20];
unsigned long netip;
- if(initflag)
+ if (initflag)
{
size = sprintf(buffer,"RARP disabled until entries added to cache.\n");
pos+=size;
sti();
}
- *start=buffer+(offset-begin); /* Start of wanted data */
- len-=(offset-begin); /* Start slop */
- if(len>length)
- len=length; /* Ending slop */
+ *start = buffer+(offset-begin); /* Start of wanted data */
+ len -= (offset-begin); /* Start slop */
+ if (len>length)
+ len = length; /* Ending slop */
return len;
}
+void
+rarp_init(void)
+{
+ proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_RARP, rarp_get_info, 4, "rarp"});
+ rarp_ioctl_hook = rarp_ioctl;
+}
+
+
+#endif
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+
+int init_module(void)
+{
+ rarp_init();
+ return 0;
+}
+
+void cleanup_module(void)
+{
+ if (MOD_IN_USE)
+ ;
+ else {
+ struct rarp_table *rt, *rt_next;
+ proc_net_unregister(PROC_NET_RARP);
+ rarp_ioctl_hook = NULL;
+ cli();
+ /* Destroy the RARP-table */
+ rt = rarp_tables;
+ rarp_tables = NULL;
+ sti();
+ /* ... and free it. */
+ for ( ; rt != NULL; rt = rt_next) {
+ rt_next = rt->next;
+ rarp_release_entry(rt);
+ }
+ }
+}
+
#endif
* Called from the PROCfs module. This outputs /proc/net/route.
*/
-int rt_get_info(char *buffer, char **start, off_t offset, int length)
+int rt_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
struct rtable *r;
int len=0;
* Recover the buffer pointers
*/
- iph = (struct iphdr *)(skb->data + skb->dev->hard_header_len);
+ iph = (struct iphdr *)skb->ip_hdr;
th = (struct tcphdr *)(((char *)iph) +(iph->ihl << 2));
/*
buff = sk->prot->wmalloc(sk, win_size + th->doff * 4 +
(iph->ihl << 2) +
- skb->dev->hard_header_len + 15,
+ sk->prot->max_header + 15,
1, GFP_ATOMIC);
if ( buff == NULL )
return;
tar:
tar -cvf /dev/f1 .
+modules:
include $(TOPDIR)/Rules.make
}
/* Called from proc fs */
-int
-ipx_get_interface_info(char *buffer, char **start, off_t offset, int length)
+static int ipx_interface_get_info(char *buffer, char **start, off_t offset,
+ int length, int dummy)
{
ipx_interface *i;
int len=0;
return len;
}
-int
-ipx_get_info(char *buffer, char **start, off_t offset, int length)
+static int ipx_get_info(char *buffer, char **start, off_t offset,
+ int length, int dummy)
{
ipx_socket *s;
ipx_interface *i;
return len;
}
-int ipx_rt_get_info(char *buffer, char **start, off_t offset, int length)
+static int ipx_rt_get_info(char *buffer, char **start, off_t offset,
+ int length, int dummy)
{
ipx_route *rt;
int len=0;
printk("IPX: Unable to register with SNAP\n");
register_netdevice_notifier(&ipx_dev_notifier);
+
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_IPX, ipx_get_info, 3, "ipx" });
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_IPX_INTERFACE, ipx_interface_get_info, 13,"ipx_interface"});
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_IPX_ROUTE, ipx_rt_get_info 9, "ipx_route" });
printk("Swansea University Computer Society IPX 0.31 for NET3.030\n");
printk("IPX Portions Copyright (c) 1995 Caldera, Inc.\n");
tar:
tar -cvf /dev/f1 .
+modules:
include $(TOPDIR)/Rules.make
return(0);
}
-int nr_get_info(char *buffer, char **start, off_t offset, int length)
+static int nr_get_info(char *buffer, char **start, off_t offset,
+ int length, int dummy)
{
struct sock *s;
struct device *dev;
nr_default.busy_delay = NR_DEFAULT_T4;
nr_default.tries = NR_DEFAULT_N2;
nr_default.window = NR_DEFAULT_WINDOW;
+
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_NR, nr_get_info, 2, "nr" });
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_NR_NEIGH, nr_neigh_get_info, 8, "nr_neigh" });
+proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_NR_NODES, nr_nodes_get_info, 8, "nr_nodes" });
+
}
#endif
return 1;
}
-int nr_nodes_get_info(char *buffer, char **start, off_t offset, int length)
+int nr_nodes_get_info(char *buffer, char **start, off_t offset,
+ int length, int dummy)
{
struct nr_node *nr_node;
int len = 0;
return(len);
}
-int nr_neigh_get_info(char *buffer, char **start, off_t offset, int length)
+int nr_neigh_get_info(char *buffer, char **start, off_t offset,
+ int length, int dummy)
{
struct nr_neigh *nr_neigh;
int len = 0;
#include <linux/net.h>
#include <linux/interrupt.h>
#include <linux/netdevice.h>
+#include <linux/proc_fs.h>
#include <asm/system.h>
#include <asm/segment.h>
static int sock_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
static int sock_fasync(struct inode *inode, struct file *filp, int on);
+
+extern int proc_net_register(struct proc_dir_entry *);
+extern int proc_net_unregister(int);
{
if (pops[i] == NULL)
continue;
- if(pops[i]->family == family)
+ if (pops[i]->family == family)
{
pops[i]=NULL;
sti();
dep:
$(CPP) -M *.c > .depend
+modules:
tar:
tar -cvf /dev/f1 .
#include <net/sock.h>
#include <net/tcp.h>
#include <net/af_unix.h>
+#include <linux/proc_fs.h>
static unix_socket *volatile unix_socket_list=NULL;
err=sk->err;
sk->err=0;
sti();
- return -sk->err;
+ return -err;
}
/* printk("get rcv sem\n");*/
if(skb==NULL)
{
up(&sk->protinfo.af_unix.readsem);
- if(sk->shutdown&RCV_SHUTDOWN)
+ if(sk->shutdown & RCV_SHUTDOWN)
+ return copied;
+ if(copied)
return copied;
if(noblock)
{
- if(copied)
- return copied;
return -EAGAIN;
}
interruptible_sleep_on(sk->sleep);
return(0);
}
-/* Exported for procfs. */
-
-int unix_get_info(char *buffer, char **start, off_t offset, int length)
+static int unix_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
off_t pos=0;
off_t begin=0;
iov.iov_base=ubuf;
iov.iov_len=size;
msg.msg_name=(void *)sa;
- msg.msg_namelen=get_user(addr_len);
+ msg.msg_namelen=0;
+ if (addr_len)
+ msg.msg_namelen = *addr_len;
msg.msg_accrights=NULL;
msg.msg_iov=&iov;
msg.msg_iovlen=1;
{
printk("NET3: Unix domain sockets 0.07 BETA for Linux NET3.030.\n");
sock_register(unix_proto_ops.family, &unix_proto_ops);
+ proc_net_register(&(struct proc_dir_entry)
+ { PROC_NET_UNIX, unix_get_info, 4, "unix" });
}
+/*
+ * Local variables:
+ * compile-command: "gcc -g -D__KERNEL__ -Wall -O6 -I/usr/src/linux/include -c af_unix.c"
+ * End:
+ */