Import 1.3.391.3.39
authorLinus Torvalds<torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:10:21 +0000 (23 15:10 -0500)
committerLinus Torvalds<torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:10:21 +0000 (23 15:10 -0500)
188 files changed:
Makefile
Rules.make
arch/alpha/Makefile
arch/alpha/boot/Makefile
arch/alpha/config.in
arch/alpha/lib/io.c
arch/i386/defconfig
drivers/block/floppy.c
drivers/cdrom/aztcd.c
drivers/cdrom/cdu31a.c
drivers/cdrom/cm206.c
drivers/cdrom/gscd.c
drivers/cdrom/mcd.c
drivers/cdrom/mcdx.c
drivers/cdrom/optcd.c
drivers/cdrom/sbpcd.c
drivers/cdrom/sjcd.c
drivers/cdrom/sonycd535.c
drivers/char/ChangeLog
drivers/char/atixlmouse.c
drivers/char/busmouse.c
drivers/char/console.h[deleted file]
drivers/char/console_struct.h
drivers/char/lp.c
drivers/char/mem.c
drivers/char/msbusmouse.c
drivers/char/psaux.c
drivers/char/pty.c
drivers/char/random.c
drivers/char/stallion.c
drivers/char/tty_io.c
drivers/net/3c501.c
drivers/net/3c503.c
drivers/net/3c505.c
drivers/net/3c507.c
drivers/net/3c509.c
drivers/net/8390.c
drivers/net/Makefile
drivers/net/ac3200.c
drivers/net/apricot.c
drivers/net/arcnet.c
drivers/net/at1700.c
drivers/net/bsd_comp.c
drivers/net/de4x5.c
drivers/net/de600.c
drivers/net/de620.c
drivers/net/depca.c
drivers/net/dummy.c
drivers/net/e2100.c
drivers/net/eepro.c
drivers/net/eexpress.c
drivers/net/eql.c
drivers/net/ewrk3.c
drivers/net/hp-plus.c
drivers/net/hp.c
drivers/net/hp100.c
drivers/net/ibmtr.c
drivers/net/ne.c
drivers/net/pi2.c
drivers/net/plip.c
drivers/net/ppp.c
drivers/net/skeleton.c
drivers/net/slhc.c
drivers/net/slip.c
drivers/net/smc-ultra.c
drivers/net/tulip.c
drivers/net/tunnel.c
drivers/net/wavelan.c
drivers/net/wd.c
drivers/scsi/53c7,8xx.c
drivers/scsi/Makefile
drivers/scsi/scsi.c
drivers/scsi/scsi_module.c
drivers/scsi/scsi_syms.c
drivers/scsi/sd.c
drivers/scsi/sg.c
drivers/scsi/sr.c
drivers/scsi/st.c
drivers/sound/audio.c
drivers/sound/sb16_dsp.c
drivers/sound/sb_dsp.c
drivers/sound/soundcard.c
fs/binfmt_elf.c
fs/exec.c
fs/ext/inode.c
fs/ext2/super.c
fs/hpfs/hpfs_caps.c
fs/hpfs/hpfs_fs.c
fs/isofs/dir.c
fs/isofs/file.c
fs/isofs/inode.c
fs/isofs/namei.c
fs/isofs/rock.c
fs/isofs/symlink.c
fs/isofs/util.c
fs/minix/bitmap.c
fs/minix/dir.c
fs/minix/file.c
fs/minix/fsync.c
fs/minix/inode.c
fs/minix/namei.c
fs/minix/symlink.c
fs/minix/truncate.c
fs/msdos/buffer.c
fs/msdos/dir.c
fs/msdos/fat.c
fs/msdos/file.c
fs/msdos/inode.c
fs/msdos/misc.c
fs/msdos/mmap.c
fs/msdos/namei.c
fs/nfs/dir.c
fs/nfs/file.c
fs/nfs/inode.c
fs/nfs/mmap.c
fs/nfs/proc.c
fs/nfs/rpcsock.c
fs/nfs/sock.c
fs/nfs/symlink.c
fs/proc/array.c
fs/smbfs/inode.c
fs/smbfs/sock.c
fs/sysv/balloc.c
fs/sysv/dir.c
fs/sysv/file.c
fs/sysv/fsync.c
fs/sysv/ialloc.c
fs/sysv/inode.c
fs/sysv/namei.c
fs/sysv/symlink.c
fs/sysv/truncate.c
fs/umsdos/check.c
fs/umsdos/dir.c
fs/umsdos/emd.c
fs/umsdos/file.c
fs/umsdos/inode.c
fs/umsdos/ioctl.c
fs/umsdos/mangle.c
fs/umsdos/namei.c
fs/umsdos/rdir.c
fs/umsdos/symlink.c
fs/xiafs/bitmap.c
fs/xiafs/dir.c
fs/xiafs/file.c
fs/xiafs/fsync.c
fs/xiafs/inode.c
fs/xiafs/namei.c
fs/xiafs/symlink.c
fs/xiafs/truncate.c
include/asm-alpha/a.out.h
include/asm-alpha/floppy.h
include/asm-alpha/io.h
include/asm-alpha/resource.h
include/asm-alpha/string.h
include/asm-alpha/system.h
include/asm-i386/bitops.h
include/asm-i386/floppy.h
include/asm-i386/resource.h
include/asm-mips/floppy.h
include/linux/major.h
include/linux/mm.h
include/linux/module.h
include/linux/random.h
include/linux/sched.h
include/linux/symtab_begin.h
include/linux/symtab_end.h
include/linux/tty.h
include/net/sock.h
ipc/shm.c
kernel/Makefile
kernel/ksyms.c
mm/memory.c
mm/mmap.c
net/Makefile
net/ipv4/Config.in
net/ipv4/Makefile
net/ipv4/ipip.c
net/ipv4/rarp.c
net/netlink.c
net/unix/af_unix.c
scripts/Makefile
scripts/header.tk
scripts/tail.tk
scripts/tkcond.c
scripts/tkgen.c
scripts/tkparse.c
scripts/tkparse.h
versions.mk[deleted file]

index 66796a8..7686d59 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6+1,6 @@
 VERSION = 1
 PATCHLEVEL = 3
-SUBLEVEL = 38
+SUBLEVEL = 39
 
 ARCH = i386
 
@@ -224,12+224,12 @@ net: dummy
        $(MAKE) linuxsubdirs SUBDIRS=net
 
 ifdef CONFIG_MODVERSIONS
-MODV = -DCONFIG_MODVERSIONS
+MODV = -DMODVERSIONS
 endif
 
 modules: include/linux/version.h
        @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i CFLAGS="$(CFLAGS) -DMODULE $(MODV)" modules; done
-       
+
 modules_install:
        @( \
        MODLIB=/lib/modules/$(VERSION).$(PATCHLEVEL).$(SUBLEVEL); \
index 9b9dc96..a94ce94 100644 (file)
@@ -22,6+22,13 @@ unexport O_TARGET
 unexport O_OBJS
 unexport L_OBJS
 unexport M_OBJS
+unexport ALL_MOBJS
+# objects that export symbol tables
+unexport OX_OBJS
+unexport LX_OBJS
+unexport MX_OBJS
+unexport SYMTAB_OBJS
+
 unexport MOD_LIST_NAME
 
 #
@@ -46,10+53,11 @@ first_rule: sub_dirs $(O_TARGET) $(L_TARGET)
 # Rule to compile a set of .o files into one .o file
 #
 ifdef O_TARGET
-$(O_TARGET): $(O_OBJS) $(TOPDIR)/include/linux/config.h
+ALL_O = $(OX_OBJS) $(O_OBJS)
+$(O_TARGET): $(ALL_O) $(TOPDIR)/include/linux/config.h
        rm -f $@
-ifdef O_OBJS
-       $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(O_OBJS)
+ifneq "$(strip $(ALL_O))" ""
+       $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(ALL_O)
 else
        $(AR) rcs $@
 endif
@@ -59,9+67,9 @@ endif
 # Rule to compile a set of .o files into one .a file
 #
 ifdef L_TARGET
-$(L_TARGET): $(L_OBJS) $(TOPDIR)/include/linux/config.h
+$(L_TARGET): $(LX_OBJS) $(L_OBJS) $(TOPDIR)/include/linux/config.h
        rm -f $@
-       $(AR) $(EXTRA_ARFLAGS) rcs $@ $(L_OBJS)
+       $(AR) $(EXTRA_ARFLAGS) rcs $@ $(LX_OBJS) $(L_OBJS)
 endif
 
 #
@@ -85,10+93,11 @@ endif
 #
 # A rule to make modules
 #
-ifdef M_OBJS
+ALL_MOBJS = $(MX_OBJS) $(M_OBJS)
+ifneq "$(strip $(ALL_MOBJS))" ""
 PDWN=$(shell /bin/sh $(TOPDIR)/scripts/pathdown.sh)
 endif
-modules: $(M_OBJS) dummy
+modules: $(ALL_MOBJS) dummy
 ifdef MOD_SUB_DIRS
        set -e; for i in $(MOD_SUB_DIRS); do $(MAKE) -C $$i modules; done
 endif
@@ -98,13+107,13 @@ ifdef MOD_SUB_DIRS
        for i in $(MOD_SUB_DIRS); do \
            echo `basename $$i`.o >> $$TOPDIR/modules/$(MOD_LIST_NAME); done
 endif
-ifdef M_OBJS
-       echo $(M_OBJS) >> $$TOPDIR/modules/$(MOD_LIST_NAME)
+ifneq "$(strip $(ALL_MOBJS))" ""
+       echo $(ALL_MOBJS) >> $$TOPDIR/modules/$(MOD_LIST_NAME)
 endif
 endif
-ifdef M_OBJS
+ifneq "$(strip $(ALL_MOBJS))" ""
        echo $(PDWN)
-       cd $$TOPDIR/modules; for i in $(M_OBJS); do \
+       cd $$TOPDIR/modules; for i in $(ALL_MOBJS); do \
            ln -sf ../$(PDWN)/$$i .; done
 endif
 
@@ -118,6+127,41 @@ dummy:
 #
 script:
        $(SCRIPT)
+
+#
+# This sets version suffixes on exported symbols
+# Uses SYMTAB_OBJS
+# Separate the object into "normal" objects and "exporting" objects
+# Exporting objects are: all objects that define symbol tables
+#
+ifdef CONFIG_MODVERSIONS
+SYMTAB_OBJS = $(LX_OBJS) $(OX_OBJS) $(MX_OBJS)
+ifneq "$(strip $(SYMTAB_OBJS))" ""
+
+%.ver: %.c
+       @if [ ! -x /sbin/genksyms ]; then echo "Please read: README.modules"; fi
+       $(CC) $(CFLAGS) -E -D__GENKSYMS__ $< | /sbin/genksyms -w $(TOPDIR)/include/linux/modules
+       @ln -sf $(TOPDIR)/include/linux/modules/$@ .
+
+$(SYMTAB_OBJS:.o=.ver): $(TOPDIR)/include/linux/autoconf.h
+
+$(TOPDIR)/include/linux/modversions.h: $(SYMTAB_OBJS:.o=.ver)
+       @echo updating $(TOPDIR)/include/linux/modversions.h
+       @(cd $(TOPDIR)/include/linux/modules; for f in *.ver;\
+       do echo "#include <linux/modules/$${f}>"; done) \
+       > $(TOPDIR)/include/linux/modversions.h
+
+$(MX_OBJS): $(TOPDIR)/include/linux/modversions.h
+       $(CC) $(CFLAGS) -DEXPORT_SYMTAB -c $(@:.o=.c)
+
+$(LX_OBJS) $(OX_OBJS): $(TOPDIR)/include/linux/modversions.h
+       $(CC) $(CFLAGS) -DMODVERSIONS -DEXPORT_SYMTAB -c $(@:.o=.c)
+
+dep fastdep: $(TOPDIR)/include/linux/modversions.h
+
+endif
+endif
+
 #
 # include dependency files they exist
 #
index cab9700..c9363ae 100644 (file)
@@ -30,6+30,9 @@ LIBS := $(TOPDIR)/arch/alpha/lib/lib.a $(LIBS) $(TOPDIR)/arch/alpha/lib/lib.a
 
 MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
 
+rawboot:
+       @$(MAKEBOOT) rawboot
+
 #
 # my boot writes directly to a specific disk partition, I doubt most
 # people will want to do that without changes..
index acc2239..3155ae1 100644 (file)
@@ -22,20+22,28 @@ endif
        $(CC) -D__ASSEMBLY__ -traditional -c -o $*.o $<
 
 OBJECTS = head.o main.o
-TARGETS = tools/lxboot tools/bootlx vmlinux vmlinux.gz
+TARGETS = vmlinux.gz
 
 all:   $(TARGETS)
        @echo Ready to install kernel in $(shell pwd)/vmlinux.gz
 
-msb:   tools/lxboot tools/bootlx vmlinux
-       ( cat tools/lxboot tools/bootlx vmlinux ) > /dev/rz0a
+# normally no need to build these:
+rawboot: vmlinux.nh tools/lxboot tools/bootlx vmlinux
+
+msb:   tools/lxboot tools/bootlx vmlinux.nh
+       ( cat tools/lxboot tools/bootlx vmlinux.nh ) > /dev/rz0a
        disklabel -rw rz0 'linux' tools/lxboot tools/bootlx
 
 vmlinux.gz: vmlinux
        gzip -fv vmlinux
 
-vmlinux: tools/build $(TOPDIR)/vmlinux
-#      tools/build -v $(TOPDIR)/vmlinux > vmlinux
+#
+# A raw binary without header.  Used by raw boot.
+#
+vmlinux.nh: tools/build
+       tools/build -v $(TOPDIR)/vmlinux > vmlinux.nh
+
+vmlinux: $(TOPDIR)/vmlinux
        cp $(TOPDIR)/vmlinux vmlinux
        quickstrip vmlinux
 
index e2b68bf..0181362 100644 (file)
@@ -40,7+40,6 @@ then
        define_bool CONFIG_ALPHA_APECS y
 fi
 
-bool 'Kernel GDB support' CONFIG_KGDB
 bool 'Echo console messages on /dev/ttyS1' CONFIG_SERIAL_ECHO
 if [ "$CONFIG_PCI" = "y" ]; then
   bool 'TGA Console Support' CONFIG_TGA_CONSOLE
index c3d2936..a4a6b92 100644 (file)
@@ -180,7+180,7 @@ void insl (unsigned long port, void *dst, unsigned long count)
  * doing byte reads the "slow" way isn't nearly as slow as
  * doing byte writes the slow way (no r-m-w cycle).
  */
-void outsb(unsigned long port, void * src, unsigned long count)
+void outsb(unsigned long port, const void * src, unsigned long count)
 {
        while (count) {
                count--;
@@ -195,7+195,7 @@ void outsb(unsigned long port, void * src, unsigned long count)
  * interfaces seems to be slow: just using the inlined version of the
  * outw() breaks things.
  */
-void outsw (unsigned long port, void *src, unsigned long count)
+void outsw (unsigned long port, const void *src, unsigned long count)
 {
        if (((unsigned long)src) & 0x3) {
                if (((unsigned long)src) & 0x1) {
@@ -227,7+227,7 @@ void outsw (unsigned long port, void *src, unsigned long count)
  * interfaces seems to be slow: just using the inlined version of the
  * outw() breaks things.
  */
-void outsl (unsigned long port, void *src, unsigned long count)
+void outsl (unsigned long port, const void *src, unsigned long count)
 {
        if (((unsigned long)src) & 0x3) {
                panic("outsw: memory not aligned");
@@ -245,7+245,7 @@ void outsl (unsigned long port, void *src, unsigned long count)
  * Copy data from IO memory space to "real" memory space.
  * This needs to be optimized.
  */
-void memcpy_fromio(void * to, unsigned long from, unsigned long count)
+void _memcpy_fromio(void * to, unsigned long from, unsigned long count)
 {
        while (count) {
                count--;
@@ -259,7+259,7 @@ void memcpy_fromio(void * to, unsigned long from, unsigned long count)
  * Copy data from "real" memory space to IO memory space.
  * This needs to be optimized.
  */
-void memcpy_toio(unsigned long to, void * from, unsigned long count)
+void _memcpy_toio(unsigned long to, void * from, unsigned long count)
 {
        while (count) {
                count--;
@@ -273,7+273,7 @@ void memcpy_toio(unsigned long to, void * from, unsigned long count)
  * "memset" on IO memory space.
  * This needs to be optimized.
  */
-void memset_io(unsigned long dst, int c, unsigned long count)
+void _memset_io(unsigned long dst, int c, unsigned long count)
 {
        while (count) {
                count--;
index 140ab42..60b7eb2 100644 (file)
@@ -14,7+14,6 @@ CONFIG_SYSVIPC=y
 CONFIG_BINFMT_ELF=y
 CONFIG_KERNEL_ELF=y
 CONFIG_M486=y
-# CONFIG_SMP is not set
 
 #
 # Loadable module support
@@ -33,6+32,7 @@ CONFIG_ST506=y
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_BLK_DEV_IDE=y
 CONFIG_BLK_DEV_IDECD=y
+# CONFIG_BLK_DEV_TRITON is not set
 # CONFIG_BLK_DEV_XD is not set
 
 #
@@ -43,7+43,6 @@ CONFIG_INET=y
 # CONFIG_IP_FORWARD is not set
 # CONFIG_IP_MULTICAST is not set
 # CONFIG_IP_ACCT is not set
-# CONFIG_NET_IPIP is not set
 
 #
 # (it is safe to leave these untouched)
index 58fab49..efe1b5c 100644 (file)
@@ -109,29+109,14 @@ static int print_unex=1;
 
 #include <linux/module.h>
 
-#ifdef MODULE
-
-#define FD_MODULE
-
-int FLOPPY_IRQ=6;
-int FLOPPY_DMA=2;
-int ALLOWED_DRIVE_MASK = 0x33;
-
-#endif
-
-#ifndef FD_MODULE
 /* the following is the mask of allowed drives. By default units 2 and
  * 3 of both floppy controllers are disabled, because switching on the
  * motor of these drives causes system hangs on some PCI computers. drive
  * 0 is the low bit (0x1), and drive 7 is the high bit (0x80). Bits are on if
  * a drive is allowed. */
-static int ALLOWED_DRIVE_MASK=0x33;
-
-#define FLOPPY_IRQ 6
-#define FLOPPY_DMA 2
-#endif
-
-#define MODULE_AWARE_DRIVER
+static int FLOPPY_IRQ=6;
+static int FLOPPY_DMA=2;
+static int ALLOWED_DRIVE_MASK = 0x33;
 
 #include <linux/sched.h>
 #include <linux/fs.h>
@@ -3910,9+3895,7 @@ static int floppy_grab_irq_and_dma(void)
                return 0;
        }
        sti();
-#ifdef FD_MODULE
        MOD_INC_USE_COUNT;
-#endif
        for(i=0; i< N_FDC; i++){
                if(FDCS->address != -1){
                        fdc = i;
@@ -3955,9+3938,7 @@ static void floppy_release_irq_and_dma(void)
                return;
        }
        sti();
-#ifdef FD_MODULE
        MOD_DEC_USE_COUNT;
-#endif
        fd_disable_dma();
        fd_free_dma();
        fd_disable_irq();
index e7b6987..6e6300d 100644 (file)
        NOTE: 
        Points marked with ??? are questionable !
 */
-#include <linux/major.h>
-#include <linux/config.h>
-
-#ifdef MODULE
-# include <linux/module.h>
-# include <linux/version.h>
-# ifndef CONFIG_MODVERSIONS
-    char kernel_version[]= UTS_RELEASE;
-# endif
-#define aztcd_init init_module
-#endif
-
+#include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/cdrom.h>
 #include <linux/ioport.h>
 #include <linux/string.h>
+#include <linux/major.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
 
 #define MAJOR_NR AZTECH_CDROM_MAJOR 
 
-#include "blk.h"
-
-#ifdef MODULE
-#else
-# define MOD_INC_USE_COUNT
-# define MOD_DEC_USE_COUNT
-#endif
-
+#include <linux/blk.h>
 #include <linux/aztcd.h>
 
 #define SET_TIMER(func, jifs)   delay_timer.expires = jiffies + (jifs); \
@@ -246,7+229,7 @@ static volatile int azt_read_count = 1;
 #define READ_TIMEOUT 3000
 
 #define azt_port aztcd  /*needed for the modutils*/
-static short azt_port = AZT_BASE_ADDR;
+static int azt_port = AZT_BASE_ADDR;
 
 static char  azt_cont = 0;
 static char  azt_init_end = 0;
@@ -2079,11+2062,14 @@ static int aztGetToc(int multi)
 }
 
 #ifdef MODULE
+
+int init_module(void)
+{
+       return aztcd_init();
+}
+
 void cleanup_module(void)
-{ if (MOD_IN_USE)
-    { printk("aztcd module in use - can't remove it.\n");
-      return;
-    }
+{
   if ((unregister_blkdev(MAJOR_NR, "aztcd") == -EINVAL))    
     { printk("What's that: can't unregister aztcd\n");
       return;
index 7b42b9b..cc288ed 100644 (file)
@@ -2990,10+2990,6 @@ static int cdu31a_block_size;
 /*
  * Initialize the driver.
  */
-#ifdef MODULE
-#define cdu31a_init init_module
-#endif
-
 int
 cdu31a_init(void)
 {
@@ -3156,6+3152,13 @@ cdu31a_init(void)
 }
 
 #ifdef MODULE
+
+int
+init_module(void)
+{
+       return cdu31a_init();
+}
+
 void
 cleanup_module(void)
 {
index 9c7adad..e64d280 100644 (file)
@@ -81,16+81,7 @@ History:
  *                       David van Leeuwen, david@tm.tno.nl.  */
 #define VERSION "0.34"
 
-#ifdef MODULE                  /* OK, so some of this is stolen */
 #include <linux/module.h>      
-#include <linux/version.h>
-#ifndef CONFIG_MODVERSIONS
-char kernel_version[]=UTS_RELEASE;
-#endif
-#else 
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif MODULE
 
 #include <linux/errno.h>       /* These include what we really need */
 #include <linux/delay.h>
@@ -1123,41+1114,12 @@ int probe_irq(int nr) {
 }
 #endif
 
-#ifdef MODULE
-
-static int cm206[2] = {0,0};   /* for compatible `insmod' parameter passing */
-void parse_options(void) 
-{
-  int i;
-  for (i=0; i<2; i++) {
-    if (0x300 <= cm206[i] && i<= 0x370 && cm206[i] % 0x10 == 0) {
-      cm206_base = cm206[i];
-      auto_probe=0;
-    }
-    else if (3 <= cm206[i] && cm206[i] <= 15) {
-      cm206_irq = cm206[i];
-      auto_probe=0;
-    }
-  }
-}
-
-#define cm206_init init_module
-
-#endif MODULE
-
-
 int cm206_init(void)
 {
   uch e=0;
   long int size=sizeof(struct cm206_struct);
 
   printk("cm206: v" VERSION);
-#if defined(MODULE) 
-  parse_options();
-#if !defined(AUTO_PROBE_MODULE)
-   auto_probe=0;
-#endif
-#endif
   cm206_base = probe_base_port(auto_probe ? 0 : cm206_base);
   if (!cm206_base) {
     printk(" can't find adapter!\n");
@@ -1221,13+1183,40 @@ int cm206_init(void)
 }
 
 #ifdef MODULE
+
+static int cm206[2] = {0,0};   /* for compatible `insmod' parameter passing */
+
+void parse_options(void) 
+{
+  int i;
+  for (i=0; i<2; i++) {
+    if (0x300 <= cm206[i] && i<= 0x370 && cm206[i] % 0x10 == 0) {
+      cm206_base = cm206[i];
+      auto_probe=0;
+    }
+    else if (3 <= cm206[i] && cm206[i] <= 15) {
+      cm206_irq = cm206[i];
+      auto_probe=0;
+    }
+  }
+}
+
+int init_module(void)
+{
+       parse_options();
+#if !defined(AUTO_PROBE_MODULE)
+       auto_probe=0;
+#endif
+       return cm206_init();
+}
+
 void cleanup_module(void)
 {
   cleanup(4);
   printk("cm206 removed\n");
 }
       
-#else MODULE
+#else /* !MODULE */
 
 /* This setup function accepts either `auto' or numbers in the range
  * 3--11 (for irq) or 0x300--0x370 (for base port) or both. */
@@ -1246,4+1235,4 @@ void cm206_setup(char *s, int *p)
     }
   }
 }
-#endif MODULE
+#endif /* MODULE */
index c45119e..b105a89 100644 (file)
 #define  NO_FUTURE_WORK
 /*------------------------*/
 
-#include <linux/config.h>
-
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#include <linux/malloc.h>
-#ifndef CONFIG_MODVERSIONS
-char kernel_version[] = UTS_RELEASE;
-#endif
-#endif MODULE
 
+#include <linux/malloc.h>
 #include <linux/errno.h>
 #include <linux/signal.h>
 #include <linux/sched.h>
@@ -390,9+382,7 @@ printk ( "GSCD: open\n" );
                return -EIO;
 */
 
-        #ifdef MODULE
-           MOD_INC_USE_COUNT;
-        #endif
+       MOD_INC_USE_COUNT;
  
        return 0;
 }
@@ -413,9+403,7 @@ printk ( "GSCD: release\n" );
        sync_dev(inode->i_rdev);
        invalidate_buffers(inode -> i_rdev);
 
-        #ifdef MODULE
-           MOD_DEC_USE_COUNT;
-        #endif
+       MOD_DEC_USE_COUNT;
 }
 
 
@@ -963,6+951,7 @@ unsigned int AX;
 }
 #endif
 
+#ifdef MODULE
 /* Init for the Module-Version */
 int init_module (void)
 {
@@ -983,16+972,9 @@ long err;
      }    
 }
 
-#ifdef MODULE
 void cleanup_module (void)
 {
 
-   if (MOD_IN_USE)
-   {
-      printk("GoldStar-module in use - can't remove it.\n" );
-      return;
-   }
    if ((unregister_blkdev(MAJOR_NR, "gscd" ) == -EINVAL))
    {
       printk("What's that: can't unregister GoldStar-module\n" );
index 424e2ff..a245c68 100644 (file)
        DOS DRIVERS .... Accuracy counts... speed is secondary ;)
        17 June 95 Modifications By Andrew J. Kroll <ag784@freenet.buffalo.edu>
        07 July 1995 Modifications by Andrew J. Kroll
+       
+       0.6
+        8 November 95 More Modifications By Andrew J. Kroll
+        Media change detect now works :) That means that SuperMount and
+        other programs that depend on this will now work!
+        You are welcome in advance!  You will notice, however that you don't 
+        always get the kernel message saying "VFS: Disk change detected on 
+        device", so I'm not sure that it's *PERFECT* but it does seem to
+        actually work! What else should I add?
+                                                                
 
 */
 
-#include <linux/config.h>
 
-#ifdef MODULE
-# include <linux/module.h>
-# include <linux/version.h>
-# ifndef CONFIG_MODVERSIONS
-    char kernel_version[]= UTS_RELEASE;
-# endif
-#define mcd_init init_module
-#else
-# define MOD_INC_USE_COUNT
-# define MOD_DEC_USE_COUNT
-#endif
+#include <linux/module.h>
 
 #include <linux/errno.h>
 #include <linux/signal.h>
@@ -145,18+144,22 @@ static int mcdPresent = 0;
 #define MFL_STATUSorDATA (MFL_STATUS | MFL_DATA)
 #define MCD_BUF_SIZ 16
 static volatile int mcd_transfer_is_active;
+
+/* Are you sleeping, Are you sleeping, Brother John, Brother John? ;) */
+static volatile int sleeping_for_status;
+
 static char mcd_buf[2048*MCD_BUF_SIZ]; /* buffer for block size conversion */
 static volatile int mcd_buf_bn[MCD_BUF_SIZ], mcd_next_bn;
 static volatile int mcd_buf_in, mcd_buf_out = -1;
 static volatile int mcd_error;
 static int mcd_open_count;
 enum mcd_state_e {
-  MCD_S_IDLE,   /* 0 */
-  MCD_S_START,  /* 1 */
-  MCD_S_MODE, /* 2 */
-  MCD_S_READ,   /* 3 */
-  MCD_S_DATA,   /* 4 */
-  MCD_S_STOP,   /* 5 */
+  MCD_S_IDLE,    /* 0 */
+  MCD_S_START,   /* 1 */
+  MCD_S_MODE,    /* 2 */
+  MCD_S_READ,    /* 3 */
+  MCD_S_DATA,    /* 4 */
+  MCD_S_STOP,    /* 5 */
   MCD_S_STOPPING /* 6 */
 };
 static volatile enum mcd_state_e mcd_state = MCD_S_IDLE;
@@ -211,31+214,7 @@ void mcd_setup(char *str, int *ints)
       mitsumi_bug_93_wait = ints[3];
 #endif /* WORK_AROUND_MITSUMI_BUG_93 */
 }
-
  
-static int
-check_mcd_change(kdev_t full_dev)
-{
-   int retval, target;
-
-
-#if 1   /* the below is not reliable */
-   return 0;
-#endif  
-   target = MINOR(full_dev);
-
-   if (target > 0) {
-      printk("mcd: Mitsumi CD-ROM request error: invalid device.\n");
-      return 0;
-   }
-
-   retval = mcdDiskChanged;
-   mcdDiskChanged = 0;
-
-   return retval;
-}
-
-
 /*
  * Do a 'get status' command and get the result.  Only use from the top half
  * because it calls 'getMcdStatus' which sleeps.
@@ -258,6+237,69 @@ statusCmd(void)
        return st;
 }
 
+/*
+ *             This detects a media change on the CD ROM.
+ *        We need to grab the status right off the drive in here.
+ *     Before, it ALWAYS returned a value of 0, which was not right!
+ */
+static int
+check_mcd_change(dev_t full_dev)
+{
+   int retval, target, st, count;
+   st = -1;
+   target = MINOR(full_dev);
+
+   if (target > 0) 
+       {
+       printk("mcd: Mitsumi CD-ROM request error: invalid device.\n");
+       return 0;
+       }
+
+/* 
+ * SOMETIMES it changes, sometimes not! Well, here we FIX that little nasty!
+ * All we need to do is read the status from the drive without spamming the 
+ * kernel! In other words, this routine CANNOT sleep! 
+ * The kernel will automagically picks up on this now.
+ * Devilishly sneaky it is! 8) -- AJK
+ */
+if ((!mcd_transfer_is_active) && 
+    (!sleeping_for_status) &&
+    (mcd_state == MCD_S_IDLE)) /* YES I'm paraniod! :) */
+       {
+       outb(MCMD_GET_STATUS, MCDPORT(0));      /* send get-status cmd */
+       for (count = 0; count < 3000; count++) /* wait for the status */
+               {
+               if (!(inb(MCDPORT(1)) & MFL_STATUS))
+                       break;
+               }
+       if (count >= 3000)      /* Did we time out? */
+               {
+               retval = mcdDiskChanged; /* We can just jump out of here */
+               mcdDiskChanged = 0; /* as it's not needed all the time. */
+               return retval;  /* So we pretend nothing happened here! ;) */
+               }
+       st=inb(MCDPORT(0)) & 0xFF ;     /* Read the status in... */
+       
+       /* okay... here's that magic part! Muhuhuhuh...*/
+
+       if (st & MST_DSK_CHG)      /* Devil made me do it! O];) */ 
+               {
+               mcdDiskChanged = 1;  /* Show a change. */
+               audioStatus = CDROM_AUDIO_NO_STATUS; /* just incase... */
+               tocUpToDate = 0;        /* Frantic laughing continues... */
+               mcd_invalidate_buffers(); /* 666 wins! */
+               }               /* Stupid comments are fun! */
+       
+       
+       }
+   retval = mcdDiskChanged; /* Indicate status. */
+   mcdDiskChanged = 0;   /* Go, now. Enjoy a good beer! */
+
+   return retval; /* The End. */
+}
+
 
 /*
  * Send a 'Play' command and get the status.  Use only from the top half.
@@ -1175,7+1217,7 @@ mcd_init(void)
 {
        int count;
        unsigned char result[3];
-
+        sleeping_for_status = 0;
        if (mcd_port <= 0 || mcd_irq <= 0) {
          printk("skip mcd_init\n");
           return -EIO;
@@ -1377,10+1419,14 @@ getMcdStatus(int timeout)
 
        McdTimeout = timeout;
        SET_TIMER(mcdStatTimer, 1);
-       sleep_on(&mcd_waitq);
+        sleeping_for_status = 1;
+        sleep_on(&mcd_waitq);
        if (McdTimeout <= 0)
-               return -1;
-
+               {
+               sleeping_for_status = 0;
+               return -1;
+               }
+       sleeping_for_status = 0;
        st = inb(MCDPORT(0)) & 0xFF;
        if (st == 0xFF)
                return -1;
@@ -1616,11+1662,13 @@ Toc[i].diskTime.min, Toc[i].diskTime.sec, Toc[i].diskTime.frame);
 }
 
 #ifdef MODULE
+int init_module(void)
+{
+       return mcd_init();
+}
+
 void cleanup_module(void)
-{ if (MOD_IN_USE)
-     { printk("mcd module in use - can't remove it.\n");
-       return;    
-     }
+{
   if ((unregister_blkdev(MAJOR_NR, "mcd") == -EINVAL))
      { printk("What's that: can't unregister mcd\n");
        return;    
index 4c20166..a72b0a5 100644 (file)
@@ -37,18+37,7 @@ static const char *mcdx_c_version
                = "mcdx.c,v 1.7 1995/08/27 01:46:41 heiko Exp";
 #endif
 
-#include <linux/config.h>
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#ifndef CONFIG_MODVERSIONS
-char kernel_version[] = UTS_RELEASE;
-#endif
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#define MOD_IN_USE 1
-#endif MODULE
 
 #include <linux/errno.h>
 #include <linux/signal.h>
index d19dc06..9ca8988 100644 (file)
        29-9-95         v0.4a   Fixed bug that prevented compilation as module
 */
 
-#include <linux/major.h>
-#include <linux/config.h>
-
-#ifdef MODULE
-# include <linux/module.h>
-# include <linux/version.h>
-# ifndef CONFIG_MODVERSIONS
-       char kernel_version[]= UTS_RELEASE;
-# endif
-#define optcd_init init_module
-#else
-# define MOD_INC_USE_COUNT
-# define MOD_DEC_USE_COUNT
-#endif
+#include <linux/module.h>
 
 #include <linux/errno.h>
 #include <linux/mm.h>
 #include <linux/kernel.h>
 #include <linux/cdrom.h>
 #include <linux/ioport.h>
+#include <linux/major.h>
+
 #include <asm/io.h>
 
 #define MAJOR_NR OPTICS_CDROM_MAJOR
@@ -1466,11+1455,12 @@ int optcd_init(void) {
 }
 
 #ifdef MODULE
+int init_module(void)
+{
+       return optcd_init();
+}
+
 void cleanup_module(void) {
-       if (MOD_IN_USE) {
-               printk("optcd: module in use - can't remove it.\n");
-       return;
-       }
        if ((unregister_blkdev(MAJOR_NR, "optcd") == -EINVAL)) {
                printk("optcd: what's that: can't unregister\n");
                return;
index 6011e9c..bbe54f6 100644 (file)
 #define SBPCD_ISSUE 1
 #endif SBPCD_ISSUE
 
-#include <linux/config.h>
-
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#ifndef CONFIG_MODVERSIONS
-char kernel_version[]=UTS_RELEASE;
-#endif
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif MODULE
 
 #include <linux/errno.h>
 #include <linux/sched.h>
index c1f727e..5262c71 100644 (file)
  *
  */
 
-#include <linux/major.h>
-#include <linux/config.h>
-
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#define sjcd_init init_module
-#ifndef CONFIG_MODVERSIONS
-char kernel_version[]= UTS_RELEASE;
-#endif
-#endif
 
 #include <linux/errno.h>
 #include <linux/sched.h>
@@ -72,6+62,7 @@ char kernel_version[]= UTS_RELEASE;
 #include <linux/cdrom.h>
 #include <linux/ioport.h>
 #include <linux/string.h>
+#include <linux/major.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -1440,9+1431,7 @@ int sjcd_open( struct inode *ip, struct file *fp ){
     printk( "sjcd: open: done\n" );
 #endif
   }
-#ifdef MODULE
   MOD_INC_USE_COUNT;
-#endif
   ++sjcd_open_count;
   return( 0 );
 }
@@ -1456,9+1445,7 @@ static void sjcd_release( struct inode *inode, struct file *file ){
 #if defined( SJCD_TRACE )
   printk( "sjcd: release\n" );
 #endif
-#ifdef MODULE
   MOD_DEC_USE_COUNT;
-#endif
   if( --sjcd_open_count == 0 ){
     sjcd_invalidate_buffers();
     sync_dev( inode->i_rdev );
@@ -1632,10+1619,14 @@ int sjcd_init( void ){
 }
 
 #ifdef MODULE
+
+int init_module(void)
+{
+       return sjcd_init();
+}
+
 void cleanup_module( void ){
-  if( MOD_IN_USE ){
-    printk( "sjcd: module: in use - can not remove.\n" );
-  } else if( ( unregister_blkdev( MAJOR_NR, "sjcd" ) == -EINVAL ) ){
+  if( ( unregister_blkdev( MAJOR_NR, "sjcd" ) == -EINVAL ) ){
     printk( "sjcd: module: can not unregister device.\n" );
   } else {
     release_region( sjcd_port, 4 );
index b2b3101..b39d619 100644 (file)
  */
 
 
-#include <linux/config.h>
-
-#ifdef MODULE
 # include <linux/module.h>
-# include <linux/version.h>
-# ifndef CONFIG_MODVERSIONS
-       char kernel_version[]= UTS_RELEASE;
-# endif
-#define sony535_init init_module
-#else
-# define MOD_INC_USE_COUNT
-# define MOD_DEC_USE_COUNT
-#endif
 
 #include <linux/errno.h>
 #include <linux/signal.h>
@@ -209,10+197,7 @@ static int do_sony_cmd(Byte * cmd, int nCmd, Byte status[2],
 
 /* The base I/O address of the Sony Interface.  This is a variable (not a
    #define) so it can be easily changed via some future ioctl() */
-#ifndef MODULE
-static
-#endif
-unsigned short sony535_cd_base_io = CDU535_ADDRESS;
+static unsigned int sony535_cd_base_io = CDU535_ADDRESS;
 
 /*
  * The following are I/O addresses of the various registers for the drive.  The
@@ -271,10+256,7 @@ static Byte cur_pos_msf[3] = {0, 0, 0};
 static Byte final_pos_msf[3] = {0, 0, 0};
 
 /* What IRQ is the drive using?  0 if none. */
-#ifndef MODULE
-static
-#endif
-int sony535_irq_used = CDU535_INTERRUPT;
+static int sony535_irq_used = CDU535_INTERRUPT;
 
 /* The interrupt handler will wake this queue up when it gets an interrupt. */
 static struct wait_queue *cdu535_irq_wait = NULL;
@@ -1681,14+1663,16 @@ sonycd535_setup(char *strings, int *ints)
 
 #else /* MODULE */
 
+int init_module(void)
+{
+       return sony535_init();
+}
+
 void
 cleanup_module(void)
 {
        int i;
-       if (MOD_IN_USE) {
-               printk(CDU535_HANDLE " module in use, cannot remove\n");
-               return;
-       }
+
        release_region(sony535_cd_base_io, 4);
        for (i = 0; i < sony_buffer_sectors; i++)
                kfree_s(sony_buffer[i], 2048);
index da6f8be..6e9a7df 100644 (file)
@@ -1,3+1,30 @@
+Sat Nov  4 17:14:45 1995    <tytso@rsts-11.mit.edu>
+
+       * tty_io.c (tty_init): Move registration of TTY_MAJOR and
+               TTY_AUX_MAJOR to the end, so that /proc/devices looks
+               prettier. 
+
+       * pty.c (pty_init): Use new major numbers for PTY master and slave
+               devices.  This allow us to have more than 64 pty's.  We
+               register the old pty devices for backwards compatibility.
+               Note that a system should either be using the old pty
+               devices or the new pty devices --- in general, it should
+               try to use both, since they map into the same pty table.
+               The old pty devices are strictly for backwards compatibility.
+
+Wed Oct 11 12:45:24 1995    <tytso@rsts-11.mit.edu>
+
+       * tty_io.c (disassociate_ctty): If dissassociate_ctty is called by
+               exit, perform an implicit vhangup on the tty.
+
+       * pty.c (pty_close): When the master pty is closed, send a hangup
+               to the slave pty.
+               (pty_open): Use the flag TTY_SLAVE_CLOSED to test to see
+               if there are any open slave ptys, instead of using
+               tty->link->count.  The old method got confused if there
+               were processes that had hung-up file descriptors on the
+               slave tty.
+
 Tue May  2 00:53:25 1995    <tytso@rsx-11.mit.edu>
 
        * tty_io.c (tty_set_ldisc): Wait until the output buffer is
index 56c24d4..558faf7 100644 (file)
  * version 0.3a
  */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-
-char kernel_version[] = UTS_RELEASE;
-#define atixl_busmouse_init init_module
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
 
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -236,12+227,14 @@ int atixl_busmouse_init(void)
 }
 
 #ifdef MODULE
+
+int init_module(void)
+{
+       return atixl_busmouse_init();
+}
+
 void cleanup_module(void)
 {
-       if (MOD_IN_USE) {
-               printk("atixlmouse: in use, remove delayed\n");
-               return;
-       }
        mouse_deregister(&atixl_mouse);
 }
 #endif
index ad4579a..37c391b 100644 (file)
  * Modularised 6-Sep-95 Philip Blundell <pjb27@cam.ac.uk> 
  */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-
-char kernel_version[] = UTS_RELEASE;
-#define bus_mouse_init init_module
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
 
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -272,10+263,14 @@ int bus_mouse_init(void)
 }
 
 #ifdef MODULE
+
+int init_module(void)
+{
+       return bus_mouse_init();
+}
+
 void cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("busmouse: in use - remove delayed\n");
        mouse_deregister(&bus_mouse);
 }
 #endif
diff --git a/drivers/char/console.h b/drivers/char/console.h
deleted file mode 100644 (file)
index 4eb099a..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * console.h
- *
- * Data structure and defines shared between console.c, vga.c and tga.c
- */
-
-#define NPAR 16
-
-struct vc_data {
-       unsigned long   vc_screenbuf_size;
-       unsigned short  vc_video_erase_char;    /* Background erase character */
-       unsigned char   vc_attr;                /* Current attributes */
-       unsigned char   vc_def_color;           /* Default colors */
-       unsigned char   vc_color;               /* Foreground & background */
-       unsigned char   vc_s_color;             /* Saved foreground & background */
-       unsigned char   vc_ulcolor;             /* Colour for underline mode */
-       unsigned char   vc_halfcolor;           /* Colour for half intensity mode */
-       unsigned long   vc_origin;              /* Used for EGA/VGA fast scroll */
-       unsigned long   vc_scr_end;             /* Used for EGA/VGA fast scroll */
-       unsigned long   vc_pos;
-       unsigned long   vc_x,vc_y;
-       unsigned long   vc_top,vc_bottom;
-       unsigned long   vc_state;
-       unsigned long   vc_npar,vc_par[NPAR];
-       unsigned long   vc_video_mem_start;     /* Start of video RAM           */
-       unsigned long   vc_video_mem_end;       /* End of video RAM (sort of)   */
-       unsigned long   vc_saved_x;
-       unsigned long   vc_saved_y;
-       /* mode flags */
-       unsigned long   vc_charset      : 1;    /* Character set G0 / G1 */
-       unsigned long   vc_s_charset    : 1;    /* Saved character set */
-       unsigned long   vc_disp_ctrl    : 1;    /* Display chars < 32? */
-       unsigned long   vc_toggle_meta  : 1;    /* Toggle high bit? */
-       unsigned long   vc_decscnm      : 1;    /* Screen Mode */
-       unsigned long   vc_decom        : 1;    /* Origin Mode */
-       unsigned long   vc_decawm       : 1;    /* Autowrap Mode */
-       unsigned long   vc_deccm        : 1;    /* Cursor Visible */
-       unsigned long   vc_decim        : 1;    /* Insert Mode */
-       unsigned long   vc_deccolm      : 1;    /* 80/132 Column Mode */
-       /* attribute flags */
-       unsigned long   vc_intensity    : 2;    /* 0=half-bright, 1=normal, 2=bold */
-       unsigned long   vc_underline    : 1;
-       unsigned long   vc_blink        : 1;
-       unsigned long   vc_reverse      : 1;
-       unsigned long   vc_s_intensity  : 2;    /* saved rendition */
-       unsigned long   vc_s_underline  : 1;
-       unsigned long   vc_s_blink      : 1;
-       unsigned long   vc_s_reverse    : 1;
-       /* misc */
-       unsigned long   vc_ques         : 1;
-       unsigned long   vc_need_wrap    : 1;
-       unsigned long   vc_has_scrolled : 1;    /* Info for unblank_screen */
-       unsigned long   vc_kmalloced    : 1;    /* kfree_s() needed */
-       unsigned long   vc_report_mouse : 2;
-       unsigned char   vc_utf          : 1;    /* Unicode UTF-8 encoding */
-       unsigned char   vc_utf_count;
-                long   vc_utf_char;
-       unsigned long   vc_tab_stop[5];         /* Tab stops. 160 columns. */
-       unsigned char   vc_palette[16*3];       /* Colour palette for VGA+ */
-       unsigned short * vc_translate;
-       unsigned char   vc_G0_charset;
-       unsigned char   vc_G1_charset;
-       unsigned char   vc_saved_G0;
-       unsigned char   vc_saved_G1;
-       /* additional information is in vt_kern.h */
-};
-
-struct vc {
-       struct vc_data *d;
-
-       /* might add  scrmem, vt_struct, kbd  at some time,
-          to have everything in one place - the disadvantage
-          would be that vc_cons etc can no longer be static */
-};
-
-extern struct vc vc_cons [MAX_NR_CONSOLES];
-
-#define screenbuf_size (vc_cons[currcons].d->vc_screenbuf_size)
-#define origin         (vc_cons[currcons].d->vc_origin)
-#define scr_end        (vc_cons[currcons].d->vc_scr_end)
-#define pos            (vc_cons[currcons].d->vc_pos)
-#define top            (vc_cons[currcons].d->vc_top)
-#define bottom         (vc_cons[currcons].d->vc_bottom)
-#define x              (vc_cons[currcons].d->vc_x)
-#define y              (vc_cons[currcons].d->vc_y)
-#define vc_state       (vc_cons[currcons].d->vc_state)
-#define npar           (vc_cons[currcons].d->vc_npar)
-#define par            (vc_cons[currcons].d->vc_par)
-#define ques           (vc_cons[currcons].d->vc_ques)
-#define attr           (vc_cons[currcons].d->vc_attr)
-#define saved_x        (vc_cons[currcons].d->vc_saved_x)
-#define saved_y        (vc_cons[currcons].d->vc_saved_y)
-#define translate      (vc_cons[currcons].d->vc_translate)
-#define G0_charset     (vc_cons[currcons].d->vc_G0_charset)
-#define G1_charset     (vc_cons[currcons].d->vc_G1_charset)
-#define saved_G0       (vc_cons[currcons].d->vc_saved_G0)
-#define saved_G1       (vc_cons[currcons].d->vc_saved_G1)
-#define utf            (vc_cons[currcons].d->vc_utf)
-#define utf_count      (vc_cons[currcons].d->vc_utf_count)
-#define utf_char       (vc_cons[currcons].d->vc_utf_char)
-#define video_mem_start (vc_cons[currcons].d->vc_video_mem_start)
-#define video_mem_end  (vc_cons[currcons].d->vc_video_mem_end)
-#define video_erase_char (vc_cons[currcons].d->vc_video_erase_char)
-#define disp_ctrl      (vc_cons[currcons].d->vc_disp_ctrl)
-#define toggle_meta    (vc_cons[currcons].d->vc_toggle_meta)
-#define decscnm        (vc_cons[currcons].d->vc_decscnm)
-#define decom          (vc_cons[currcons].d->vc_decom)
-#define decawm         (vc_cons[currcons].d->vc_decawm)
-#define deccm          (vc_cons[currcons].d->vc_deccm)
-#define decim          (vc_cons[currcons].d->vc_decim)
-#define deccolm        (vc_cons[currcons].d->vc_deccolm)
-#define need_wrap      (vc_cons[currcons].d->vc_need_wrap)
-#define has_scrolled   (vc_cons[currcons].d->vc_has_scrolled)
-#define kmalloced      (vc_cons[currcons].d->vc_kmalloced)
-#define report_mouse   (vc_cons[currcons].d->vc_report_mouse)
-#define color          (vc_cons[currcons].d->vc_color)
-#define s_color        (vc_cons[currcons].d->vc_s_color)
-#define def_color      (vc_cons[currcons].d->vc_def_color)
-#define        foreground      (color & 0x0f)
-#define        background      (color & 0xf0)
-#define charset        (vc_cons[currcons].d->vc_charset)
-#define s_charset      (vc_cons[currcons].d->vc_s_charset)
-#define        intensity       (vc_cons[currcons].d->vc_intensity)
-#define        underline       (vc_cons[currcons].d->vc_underline)
-#define        blink           (vc_cons[currcons].d->vc_blink)
-#define        reverse         (vc_cons[currcons].d->vc_reverse)
-#define        s_intensity     (vc_cons[currcons].d->vc_s_intensity)
-#define        s_underline     (vc_cons[currcons].d->vc_s_underline)
-#define        s_blink         (vc_cons[currcons].d->vc_s_blink)
-#define        s_reverse       (vc_cons[currcons].d->vc_s_reverse)
-#define        ulcolor         (vc_cons[currcons].d->vc_ulcolor)
-#define        halfcolor       (vc_cons[currcons].d->vc_halfcolor)
-#define tab_stop       (vc_cons[currcons].d->vc_tab_stop)
-#define palette                (vc_cons[currcons].d->vc_palette)
-
-#define vcmode         (vt_cons[currcons]->vc_mode)
-#define structsize     (sizeof(struct vc_data) + sizeof(struct vt_struct))
-
index 517bfd7..cbaf803 100644 (file)
@@ -135,4+135,3 @@ extern struct vc vc_cons [MAX_NR_CONSOLES];
 
 #define vcmode         (vt_cons[currcons]->vc_mode)
 #define structsize     (sizeof(struct vc_data) + sizeof(struct vt_struct))
-
index 994f2da..48e4d7a 100644 (file)
@@ -9,13+9,7 @@
  * Statistics and support for slow printers by Rob Janssen, rob@knoware.nl
  */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
 
 #include <linux/errno.h>
 #include <linux/kernel.h>
@@ -556,9+550,9 @@ static int lp_probe(int offset)
 }
 
 #ifdef MODULE
-char kernel_version[]=UTS_RELEASE;
-int io[] = {0, 0, 0};
-int irq[] = {0, 0, 0};
+static int io[] = {0, 0, 0};
+static int irq[] = {0, 0, 0};
+
 #define lp_init init_module
 #endif
 
index 8c5ed82..accfd57 100644 (file)
@@ -323,30+323,6 @@ static struct file_operations full_fops = {
        NULL            /* no special release code */
 };
 
-static struct file_operations random_fops = {
-       memory_lseek,
-       read_random,
-       write_random,
-       NULL,           /* random_readdir */
-       NULL,           /* random_select */
-       random_ioctl,
-       NULL,           /* random_mmap */
-       NULL,           /* no special open code */
-       NULL            /* no special release code */
-};
-
-static struct file_operations urandom_fops = {
-       memory_lseek,
-       read_random_unlimited,
-       write_random,
-       NULL,           /* urandom_readdir */
-       NULL,           /* urandom_select */
-       random_ioctl,
-       NULL,           /* urandom_mmap */
-       NULL,           /* no special open code */
-       NULL            /* no special release code */
-};
-
 static int memory_open(struct inode * inode, struct file * filp)
 {
        switch (MINOR(inode->i_rdev)) {
index 9411abd..c54cc79 100644 (file)
  * version 0.3b
  */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-
-char kernel_version[] = UTS_RELEASE;
-#define ms_bus_mouse_init init_module
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
 
 #include <linux/kernel.h>
 #include <linux/ioport.h>
@@ -219,12+210,13 @@ int ms_bus_mouse_init(void)
 }
 
 #ifdef MODULE
+int init_module(void)
+{
+       return ms_bus_mouse_init();
+}
+
 void cleanup_module(void)
 {
-       if (MOD_IN_USE) {
-               printk("msbusmouse: in use, remove delayed\n");
-               return;
-       }
        mouse_deregister(&ms_bus_mouse);
        release_region(MS_MSE_CONTROL_PORT, 0x04);
 }
index 23599c4..698e78c 100644 (file)
 
 /* #define INITIALIZE_DEVICE */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
  
 #include <linux/sched.h>
 #include <linux/kernel.h>
@@ -537,10+531,13 @@ int psaux_init(void)
 }
 
 #ifdef MODULE
+int init_module(void)
+{
+       return psaux_init(); /*?? Bjorn */
+}
+
 void cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("psaux: in use, remove delayed\n");
        mouse_deregister(&psaux_mouse);
 }
 #endif
index 12425f7..e798ebc 100644 (file)
@@ -48,6+48,7 @@ static unsigned char *tmp_buf;
 static struct semaphore tmp_buf_sem = MUTEX;
 
 struct tty_driver pty_driver, pty_slave_driver;
+struct tty_driver old_pty_driver, old_pty_slave_driver;
 static int pty_refcount;
 
 static struct tty_struct *pty_table[NR_PTYS];
@@ -77,9+78,10 @@ static void pty_close(struct tty_struct * tty, struct file * filp)
                return;
        wake_up_interruptible(&tty->link->read_wait);
        wake_up_interruptible(&tty->link->write_wait);
-       if (tty->driver.subtype == PTY_TYPE_MASTER)
+       if (tty->driver.subtype == PTY_TYPE_MASTER) {
                tty_hangup(tty->link);
-       else {
+               set_bit(TTY_SLAVE_CLOSED, &tty->flags);
+       } else {
                start_tty(tty);
                set_bit(TTY_SLAVE_CLOSED, &tty->link->flags);
        }
@@ -204,7+206,8 @@ int pty_open(struct tty_struct *tty, struct file * filp)
        set_bit(TTY_THROTTLED, &tty->flags);
        if (filp->f_flags & O_NDELAY)
                return 0;
-       while (!tty->link->count && !(current->signal & ~current->blocked))
+       while (test_bit(TTY_SLAVE_CLOSED, &tty->link->flags) &&
+              !(current->signal & ~current->blocked))
                interruptible_sleep_on(&pty->open_wait);
        if (!tty->link->count)
                return -ERESTARTSYS;
@@ -217,8+220,8 @@ int pty_init(void)
        memset(&pty_driver, 0, sizeof(struct tty_driver));
        pty_driver.magic = TTY_DRIVER_MAGIC;
        pty_driver.name = "pty";
-       pty_driver.major = TTY_MAJOR;
-       pty_driver.minor_start = 128;
+       pty_driver.major = PTY_MASTER_MAJOR;
+       pty_driver.minor_start = 0;
        pty_driver.num = NR_PTYS;
        pty_driver.type = TTY_DRIVER_TYPE_PTY;
        pty_driver.subtype = PTY_TYPE_MASTER;
@@ -245,7+248,8 @@ int pty_init(void)
        pty_slave_driver = pty_driver;
        pty_slave_driver.name = "ttyp";
        pty_slave_driver.subtype = PTY_TYPE_SLAVE;
-       pty_slave_driver.minor_start = 192;
+       pty_slave_driver.major = PTY_SLAVE_MAJOR;
+       pty_slave_driver.minor_start = 0;
        pty_slave_driver.init_termios = tty_std_termios;
        pty_slave_driver.init_termios.c_cflag = B38400 | CS8 | CREAD;
        pty_slave_driver.table = ttyp_table;
@@ -253,12+257,28 @@ int pty_init(void)
        pty_slave_driver.termios_locked = ttyp_termios_locked;
        pty_slave_driver.other = &pty_driver;
 
+       old_pty_driver = pty_driver;
+       old_pty_driver.major = TTY_MAJOR;
+       old_pty_driver.minor_start = 128;
+       old_pty_driver.num = (NR_PTYS > 64) ? 64 : NR_PTYS;
+       old_pty_driver.other = &old_pty_slave_driver;
+       
+       old_pty_slave_driver = pty_slave_driver;
+       old_pty_slave_driver.major = TTY_MAJOR;
+       old_pty_slave_driver.minor_start = 192;
+       old_pty_slave_driver.num = (NR_PTYS > 64) ? 64 : NR_PTYS;
+       old_pty_slave_driver.other = &old_pty_driver;
+
        tmp_buf = 0;
 
        if (tty_register_driver(&pty_driver))
                panic("Couldn't register pty driver");
        if (tty_register_driver(&pty_slave_driver))
                panic("Couldn't register pty slave driver");
+       if (tty_register_driver(&old_pty_driver))
+               panic("Couldn't register compat pty driver");
+       if (tty_register_driver(&old_pty_slave_driver))
+               panic("Couldn't register compat pty slave driver");
        
        return 0;
 }
index e395d00..29352a9 100644 (file)
@@ -1,7+1,7 @@
 /*
  * random.c -- A strong random number generator
  *
- * Version 0.94, last modified 11-Oct-95
+ * Version 0.95, last modified 4-Nov-95
  * 
  * Copyright Theodore Ts'o, 1994, 1995.  All rights reserved.
  *
 
 /*
  * The pool is stirred with a primitive polynomial of degree 128
- * over GF(2), namely x^128 + x^119 + x^72 + x^64 + x^14 + x^8 + 1.
+ * over GF(2), namely x^128 + x^99 + x^59 + x^31 + x^9 + x^7 + 1.
  * For a pool of size 64, try x^64+x^62+x^38+x^10+x^6+x+1.
  */
 #define POOLWORDS 128    /* Power of 2 - note that this is 32-bit words */
 #define POOLBITS (POOLWORDS*32)
 #if POOLWORDS == 128
-#define TAP1    119     /* The polynomial taps */
-#define TAP2    72
-#define TAP3    64
-#define TAP4    14
-#define TAP5    8
+#define TAP1    99     /* The polynomial taps */
+#define TAP2    59
+#define TAP3    31
+#define TAP4    9
+#define TAP5    7
 #elif POOLWORDS == 64
 #define TAP1    62      /* The polynomial taps */
 #define TAP2    38
@@ -219,7+219,7 @@ struct random_bucket {
 struct timer_rand_state {
        unsigned long   last_time;
        int             last_delta;
-       int             nbits;
+       int             dont_count_entropy:1;
 };
 
 static struct random_bucket random_state;
@@ -231,6+231,18 @@ static struct timer_rand_state *irq_timer_state[NR_IRQS];
 static struct timer_rand_state *blkdev_timer_state[MAX_BLKDEV];
 static struct wait_queue *random_wait;
 
+static int random_read(struct inode * inode, struct file * file,
+                      char * buf, int nbytes);
+static int random_read_unlimited(struct inode * inode, struct file * file,
+                                char * buf, int nbytes);
+static int random_select(struct inode *inode, struct file *file,
+                        int sel_type, select_table * wait);
+static int random_write(struct inode * inode, struct file * file,
+                       const char * buffer, int count);
+static int random_ioctl(struct inode * inode, struct file * file,
+                       unsigned int cmd, unsigned long arg);
+
+
 #ifndef MIN
 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
 #endif
@@ -242,10+254,14 @@ void rand_initialize(void)
        random_state.pool = random_pool;
        memset(irq_timer_state, 0, sizeof(irq_timer_state));
        memset(blkdev_timer_state, 0, sizeof(blkdev_timer_state));
-       random_wait = NULL;}
+       extract_timer_state.dont_count_entropy = 1;
+       random_wait = NULL;
+}
 
 void rand_initialize_irq(int irq)
 {
+       struct timer_rand_state *state;
+       
        if (irq >= NR_IRQS || irq_timer_state[irq])
                return;
 
@@ -253,12+269,17 @@ void rand_initialize_irq(int irq)
         * If kamlloc returns null, we just won't use that entropy
         * source.
         */
-       irq_timer_state[irq] = kmalloc(sizeof(struct timer_rand_state), 
-                                      GFP_KERNEL);
+       state = kmalloc(sizeof(struct timer_rand_state), GFP_KERNEL);
+       if (state) {
+               irq_timer_state[irq] = state;
+               memset(state, 0, sizeof(struct timer_rand_state));
+       }
 }
 
 void rand_initialize_blkdev(int major)
 {
+       struct timer_rand_state *state;
+       
        if (major >= MAX_BLKDEV || blkdev_timer_state[major])
                return;
 
@@ -266,8+287,11 @@ void rand_initialize_blkdev(int major)
         * If kamlloc returns null, we just won't use that entropy
         * source.
         */
-       blkdev_timer_state[major] = kmalloc(sizeof(struct timer_rand_state), 
-                                           GFP_KERNEL);
+       state = kmalloc(sizeof(struct timer_rand_state), GFP_KERNEL);
+       if (state) {
+               blkdev_timer_state[major] = state;
+               memset(state, 0, sizeof(struct timer_rand_state));
+       }
 }
 
 /*
@@ -275,7+299,7 @@ void rand_initialize_blkdev(int major)
  * update the entropy estimate.  The caller must do this if appropriate.
  *
  * The pool is stirred with a primitive polynomial of degree 128
- * over GF(2), namely x^128 + x^119 + x^72 + x^64 + x^14 + x^8 + 1.
+ * over GF(2), namely x^128 + x^99 + x^59 + x^31 + x^9 + x^7 + 1.
  * For a pool of size 64, try x^64+x^62+x^38+x^10+x^6+x+1.
  * 
  * We rotate the input word by a changing number of bits, to help
@@ -352,7+376,8 @@ static void add_timer_randomness(struct random_bucket *r,
                outb_p(0x00, 0x43);     /* latch the count ASAP */
                num |= inb_p(0x40) << 16;
                num |= inb(0x40) << 24;
-               r->entropy_count += 2;
+               if (!state->dont_count_entropy)
+                       r->entropy_count += 2;
 #endif
                
                time = jiffies;
@@ -369,24+394,26 @@ static void add_timer_randomness(struct random_bucket *r,
         * added.  We take into account the first and second order
         * deltas in order to make our estimate.
         */
-       delta = time - state->last_time;
-       state->last_time = time;
+       if (!state->dont_count_entropy) {
+               delta = time - state->last_time;
+               state->last_time = time;
 
-       delta2 = delta - state->last_delta;
-       state->last_delta = delta;
+               delta2 = delta - state->last_delta;
+               state->last_delta = delta;
 
-       if (delta < 0) delta = -delta;
-       if (delta2 < 0) delta2 = -delta2;
-       delta = MIN(delta, delta2) >> 1;
-       for (nbits = 0; delta; nbits++)
-               delta >>= 1;
+               if (delta < 0) delta = -delta;
+               if (delta2 < 0) delta2 = -delta2;
+               delta = MIN(delta, delta2) >> 1;
+               for (nbits = 0; delta; nbits++)
+                       delta >>= 1;
 
-       r->entropy_count += nbits;
-       
-       /* Prevent overflow */
-       if (r->entropy_count > POOLBITS)
-               r->entropy_count = POOLBITS;
+               r->entropy_count += nbits;
        
+               /* Prevent overflow */
+               if (r->entropy_count > POOLBITS)
+                       r->entropy_count = POOLBITS;
+       }
+               
        wake_up_interruptible(&random_wait);    
 }
 
@@ -609,23+636,71 @@ void get_random_bytes(void *buf, int nbytes)
        extract_entropy(&random_state, (char *) buf, nbytes, 0);
 }
 
-int read_random(struct inode * inode, struct file * file,
-                char * buf, int nbytes)
+static int
+random_read(struct inode * inode, struct file * file, char * buf, int nbytes)
 {
-       if (nbytes > random_state.entropy_count / 8)
-               nbytes = random_state.entropy_count / 8;
+       struct wait_queue       wait = { current, NULL };
+       int                     n;
+       int                     retval = 0;
+       int                     count = 0;
        
-       return extract_entropy(&random_state, buf, nbytes, 1);
+       if (nbytes == 0)
+               return 0;
+
+       add_wait_queue(&random_wait, &wait);
+       while (nbytes > 0) {
+               current->state = TASK_INTERRUPTIBLE;
+               
+               n = nbytes;
+               if (n > random_state.entropy_count / 8)
+                       n = random_state.entropy_count / 8;
+               if (n == 0) {
+                       if (file->f_flags & O_NONBLOCK) {
+                               retval = -EAGAIN;
+                               break;
+                       }
+                       if (current->signal & ~current->blocked) {
+                               retval = -ERESTARTSYS;
+                               break;
+                       }
+                       schedule();
+                       continue;
+               }
+               n = extract_entropy(&random_state, buf, n, 1);
+               count += n;
+               buf += n;
+               nbytes -= n;
+               break;          /* This break makes the device work */
+                               /* like a named pipe */
+       }
+       current->state = TASK_RUNNING;
+       remove_wait_queue(&random_wait, &wait);
+
+       return (count ? count : retval);
 }
 
-int read_random_unlimited(struct inode * inode, struct file * file,
-                         char * buf, int nbytes)
+static int
+random_read_unlimited(struct inode * inode, struct file * file,
+                     char * buf, int nbytes)
 {
        return extract_entropy(&random_state, buf, nbytes, 1);
 }
 
-int write_random(struct inode * inode, struct file * file,
-                const char * buffer, int count)
+static int
+random_select(struct inode *inode, struct file *file,
+                     int sel_type, select_table * wait)
+{
+       if (sel_type == SEL_IN) {
+               if (random_state.entropy_count >= 8)
+                       return 1;
+               select_wait(&random_wait, wait);
+       }
+       return 0;
+}
+
+static int
+random_write(struct inode * inode, struct file * file,
+            const char * buffer, int count)
 {
        int i;
        __u32 word, *p;
@@ -641,22+716,31 @@ int write_random(struct inode * inode, struct file * file,
                memcpy_fromfs(&word, p, i);
                add_entropy_word(&random_state, word);
        }
-       inode->i_mtime = CURRENT_TIME;
+       if (inode)
+               inode->i_mtime = CURRENT_TIME;
        return count;
 }
 
-int random_ioctl(struct inode * inode, struct file * file,
-                       unsigned int cmd, unsigned long arg)
+static int
+random_ioctl(struct inode * inode, struct file * file,
+            unsigned int cmd, unsigned long arg)
 {
-       int *p, max_size;
+       int *p, size, ent_count;
+       int retval;
        
        switch (cmd) {
        case RNDGETENTCNT:
+               retval = verify_area(VERIFY_WRITE, (void *) arg, sizeof(int));
+               if (retval)
+                       return(retval);
                put_user(random_state.entropy_count, (int *) arg);
                return 0;
        case RNDADDTOENTCNT:
                if (!suser())
                        return -EPERM;
+               retval = verify_area(VERIFY_READ, (void *) arg, sizeof(int));
+               if (retval)
+                       return(retval);
                random_state.entropy_count += get_user((int *) arg);
                if (random_state.entropy_count > POOLBITS)
                        random_state.entropy_count = POOLBITS;
@@ -665,17+749,67 @@ int random_ioctl(struct inode * inode, struct file * file,
                if (!suser())
                        return -EPERM;
                p = (int *) arg;
-               put_user(random_state.entropy_count, p);
-               max_size = get_user(++p);
+               retval = verify_area(VERIFY_WRITE, (void *) p, sizeof(int));
+               if (retval)
+                       return(retval);
+               put_user(random_state.entropy_count, p++);
+               retval = verify_area(VERIFY_READ, (void *) p, sizeof(int));
+               if (retval)
+                       return(retval);
+               size = get_user(p);
                put_user(POOLWORDS, p);
-               if (max_size < 0)
+               if (size < 0)
                        return -EINVAL;
-               if (max_size > POOLWORDS)
-                       max_size = POOLWORDS;
+               if (size > POOLWORDS)
+                       size = POOLWORDS;
                memcpy_tofs(++p, random_state.pool,
-                           max_size*sizeof(__u32));
+                           size*sizeof(__u32));
+               return 0;
+       case RNDADDENTROPY:
+               if (!suser())
+                       return -EPERM;
+               p = (int *) arg;
+               retval = verify_area(VERIFY_READ, (void *) p, 2*sizeof(int));
+               if (retval)
+                       return(retval);
+               ent_count = get_user(p++);
+               size = get_user(p++);
+               (void) random_write(0, file, (const char *) p, size);
+               random_state.entropy_count += ent_count;
+               if (random_state.entropy_count > POOLBITS)
+                       random_state.entropy_count = POOLBITS;
+               return 0;
+       case RNDZAPENTCNT:
+               if (!suser())
+                       return -EPERM;
+               random_state.entropy_count = 0;
                return 0;
        default:
                return -EINVAL;
        }
 }
+
+struct file_operations random_fops = {
+       NULL,           /* random_lseek */
+       random_read,
+       random_write,
+       NULL,           /* random_readdir */
+       random_select,  /* random_select */
+       random_ioctl,
+       NULL,           /* random_mmap */
+       NULL,           /* no special open code */
+       NULL            /* no special release code */
+};
+
+struct file_operations urandom_fops = {
+       NULL,           /* unrandom_lseek */
+       random_read_unlimited,
+       random_write,
+       NULL,           /* urandom_readdir */
+       NULL,           /* urandom_select */
+       random_ioctl,
+       NULL,           /* urandom_mmap */
+       NULL,           /* no special open code */
+       NULL            /* no special release code */
+};
+
index cc03bb9..8edb549 100644 (file)
 
 /*****************************************************************************/
 
-#ifdef MODULE
-#include <linux/config.h>
 #include <linux/module.h>
-#include <linux/version.h>
-#endif
 
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/string.h>
 #include <linux/malloc.h>
 #include <linux/ioport.h>
+#include <linux/config.h>      /* for CONFIG_PCI */
+
 #include <asm/system.h>
 #include <asm/io.h>
 #include <asm/segment.h>
@@ -508,8+506,6 @@ static int  stl_findpcibrds(void);
 /*
  *     Use the kernel version number for modules.
  */
-char   kernel_version[] = UTS_RELEASE;
-
 int init_module()
 {
        unsigned long   flags;
index 710537d..15bf405 100644 (file)
@@ -443,22+443,28 @@ int tty_hung_up_p(struct file * filp)
  *     (2)  Clears the tty from being controlling the session
  *     (3)  Clears the controlling tty for all processes in the
  *             session group.
+ *
+ * The argument on_exit is set to 1 if called when a process is
+ * exiting; it is 0 if called by the ioctl TIOCNOTTY.
  */
-void disassociate_ctty(int priv)
+void disassociate_ctty(int on_exit)
 {
        struct tty_struct *tty = current->tty;
        struct task_struct *p;
 
-       if (!tty) {
+       if (tty) {
+               if (on_exit)
+                       tty_vhangup(tty);
+       } else {
                if (current->tty_old_pgrp) {
-                       kill_pg(current->tty_old_pgrp, SIGHUP, priv);
-                       kill_pg(current->tty_old_pgrp, SIGCONT, priv);
+                       kill_pg(current->tty_old_pgrp, SIGHUP, on_exit);
+                       kill_pg(current->tty_old_pgrp, SIGCONT, on_exit);
                }
                return;
        }
        if (tty->pgrp > 0) {
-               kill_pg(tty->pgrp, SIGHUP, priv);
-               kill_pg(tty->pgrp, SIGCONT, priv);
+               kill_pg(tty->pgrp, SIGHUP, on_exit);
+               kill_pg(tty->pgrp, SIGCONT, on_exit);
        }
 
        current->tty_old_pgrp = 0;
@@ -1781,11+1787,6 @@ int tty_init(void)
 {
        if (sizeof(struct tty_struct) > PAGE_SIZE)
                panic("size of tty structure > PAGE_SIZE!");
-       if (register_chrdev(TTY_MAJOR,"tty",&tty_fops))
-               panic("unable to get major %d for tty device", TTY_MAJOR);
-       if (register_chrdev(TTYAUX_MAJOR,"cua",&tty_fops))
-               panic("unable to get major %d for tty device", TTYAUX_MAJOR);
-
        kbd_init();
        rs_init();
 #ifdef CONFIG_SCC
@@ -1802,5+1803,10 @@ int tty_init(void)
 #endif
        pty_init();
        vcs_init();
+       if (register_chrdev(TTY_MAJOR,"tty",&tty_fops))
+               panic("unable to get major %d for tty device", TTY_MAJOR);
+       if (register_chrdev(TTYAUX_MAJOR,"cua",&tty_fops))
+               panic("unable to get major %d for tty device", TTYAUX_MAJOR);
+
        return 0;
 }
index 8b2956d..dbe26af 100644 (file)
@@ -83,14+83,7 @@ static const char *version =
   The 3c501 board.
   */
 
-#include <linux/config.h>
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
 
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -102,6+95,7 @@ static const char *version =
 #include <linux/string.h>
 #include <linux/ioport.h>
 #include <linux/errno.h>
+#include <linux/config.h>      /* for CONFIG_IP_MULTICAST */
 
 #include <asm/bitops.h>
 #include <asm/io.h>
@@ -677,7+671,6 @@ set_multicast_list(struct device *dev, int num_addrs, void *addrs)
     }
 }
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 static char devicename[9] = { 0, };
 static struct device dev_3c501 = {
        devicename, /* device name is inserted by linux/drivers/net/net_init.c */
@@ -685,8+678,8 @@ static struct device dev_3c501 = {
        0x280, 5,
        0, 0, 0, NULL, el1_probe };
 
-int io=0x280;
-int irq=5;
+static int io=0x280;
+static int irq=5;
        
 int
 init_module(void)
index 45f0f4d..210a98a 100644 (file)
 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>
 #include <linux/string.h>
 #include <linux/delay.h>
-#include <asm/io.h>
-#include <asm/system.h>
-
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 
+#include <asm/io.h>
+#include <asm/system.h>
+
 #include "8390.h"
 #include "3c503.h"
 
@@ -531,15+527,14 @@ el2_block_input(struct device *dev, int count, struct sk_buff *skb, int ring_off
     outb_p(ei_status.interface_num == 0 ? ECNTRL_THIN : ECNTRL_AUI, E33G_CNTRL);
 }
 #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 = 0x300;
-int irq = 0;
+static int io = 0x300;
+static int irq = 0;
 
 static int no_pio = 1;
 int init_module(void)
@@ -569,23+564,18 @@ int init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("3c503: device busy, remove delayed\n");
-       else {
-           int ioaddr;
+       int ioaddr;
 
-           if (no_pio) {
+       if (no_pio) {
                ioaddr = el2_drv.base_addr;
                unregister_netdev(&el2_drv);
-           } else {
+       } else {
                ioaddr = el2pio_drv.base_addr;
                unregister_netdev(&el2pio_drv);
-           }
-
-           /* If we don't do this, we can't re-insmod it later. */
-           release_region(ioaddr, EL2_IO_EXTENT);
-
        }
+
+       /* If we don't do this, we can't re-insmod it later. */
+       release_region(ioaddr, EL2_IO_EXTENT);
 }
 #endif /* MODULE */
 \f
index a18e6fe..f45d22d 100644 (file)
  *                     
  */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#endif
 
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -924,9+921,7 @@ elp_open (struct device *dev)
        if (elp_debug >= 3)
                printk("%s: start receive command sent\n", dev->name);
 
-#ifdef MODULE
        MOD_INC_USE_COUNT;
-#endif
 
        return 0;                       /* Always succeed */
 }
@@ -1157,9+1152,7 @@ elp_close (struct device *dev)
         */
        irq2dev_map[dev->irq] = 0;
 
-#ifdef MODULE
        MOD_DEC_USE_COUNT;
-#endif
 
        return 0;
 }
@@ -1462,7+1455,6 @@ elplus_probe (struct device *dev)
        return 0;
 }
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 static char devicename[9] = { 0, };
 static struct device dev_3c505 = {
        devicename, /* device name is inserted by linux/drivers/net/net_init.c */
@@ -1470,8+1462,8 @@ static struct device dev_3c505 = {
        0, 0,
        0, 0, 0, NULL, elplus_probe };
 
-int io = 0x300;
-int irq = 0;
+static int io = 0x300;
+static int irq = 0;
 
 int init_module(void)
 {
@@ -1489,16+1481,11 @@ int init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("3c505: device busy, remove delayed\n");
-       else
-       {
-               unregister_netdev(&dev_3c505);
-               kfree(dev_3c505.priv);
-               dev_3c505.priv = NULL;
-
-               /* If we don't do this, we can't re-insmod it later. */
-               release_region(dev_3c505.base_addr, ELP_IO_EXTENT);
-       }
+       unregister_netdev(&dev_3c505);
+       kfree(dev_3c505.priv);
+       dev_3c505.priv = NULL;
+
+       /* If we don't do this, we can't re-insmod it later. */
+       release_region(dev_3c505.base_addr, ELP_IO_EXTENT);
 }
 #endif /* MODULE */
index b2f94e7..f18bc0a 100644 (file)
@@ -442,9+442,7 @@ el16_open(struct device *dev)
        dev->interrupt = 0;
        dev->start = 1;
 
-#ifdef MODULE
        MOD_INC_USE_COUNT;
-#endif
 
        return 0;
 }
@@ -637,9+635,7 @@ el16_close(struct device *dev)
 
        /* Update the statistics here. */
 
-#ifdef MODULE
        MOD_DEC_USE_COUNT;
-#endif
 
        return 0;
 }
@@ -887,8+883,8 @@ static struct device dev_3c507 = {
        0, 0, 0, NULL, el16_probe
 };
 
-int io = 0x300;
-int irq = 0;
+static int io = 0x300;
+static int irq = 0;
 
 int init_module(void)
 {
@@ -906,18+902,13 @@ int init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("3c507: device busy, remove delayed\n");
-       else
-       {
-               unregister_netdev(&dev_3c507);
-               kfree(dev_3c507.priv);
-               dev_3c507.priv = NULL;
+       unregister_netdev(&dev_3c507);
+       kfree(dev_3c507.priv);
+       dev_3c507.priv = NULL;
 
-               /* If we don't do this, we can't re-insmod it later. */
-               free_irq(dev_3c507.irq);
-               release_region(dev_3c507.base_addr, EL16_IO_EXTENT);
-       }
+       /* If we don't do this, we can't re-insmod it later. */
+       free_irq(dev_3c507.irq);
+       release_region(dev_3c507.base_addr, EL16_IO_EXTENT);
 }
 #endif /* MODULE */
 \f
index c1f6d6f..dea7080 100644 (file)
 
 static const  char *version = "3c509.c:1.03 10/8/94 becker@cesdis.gsfc.nasa.gov\n";
 
-#include <linux/config.h>
-#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/string.h>
@@ -41,12+38,13 @@ static const  char *version = "3c509.c:1.03 10/8/94 becker@cesdis.gsfc.nasa.gov\
 #include <linux/in.h>
 #include <linux/malloc.h>
 #include <linux/ioport.h>
-#include <asm/bitops.h>
-#include <asm/io.h>
-
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
+#include <linux/config.h>      /* for CONFIG_MCA */
+
+#include <asm/bitops.h>
+#include <asm/io.h>
 
 
 #ifdef EL3_DEBUG
@@ -380,9+378,7 @@ el3_open(struct device *dev)
                printk("%s: Opened 3c509  IRQ %d  status %4.4x.\n",
                           dev->name, dev->irq, inw(ioaddr + EL3_STATUS));
 
-#ifdef MODULE
        MOD_INC_USE_COUNT;
-#endif
        return 0;                                       /* Always succeed */
 }
 
@@ -699,14+695,11 @@ el3_close(struct device *dev)
        irq2dev_map[dev->irq] = 0;
 
        update_stats(ioaddr, dev);
-#ifdef MODULE
        MOD_DEC_USE_COUNT;
-#endif
        return 0;
 }
 
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 static char devicename[9] = { 0, };
 static struct device dev_3c509 = {
        devicename, /* device name is inserted by linux/drivers/net/net_init.c */
@@ -714,8+707,8 @@ static struct device dev_3c509 = {
        0, 0,
        0, 0, 0, NULL, el3_probe };
 
-int io = 0;
-int irq = 0;
+static int io = 0;
+static int irq = 0;
 
 int
 init_module(void)
@@ -733,16+726,11 @@ init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("3c509: device busy, remove delayed\n");
-       else
-       {
-               unregister_netdev(&dev_3c509);
-               kfree_s(dev_3c509.priv,sizeof(struct el3_private));
-               dev_3c509.priv=NULL;
-               /* If we don't do this, we can't re-insmod it later. */
-               release_region(dev_3c509.base_addr, EL3_IO_EXTENT);
-       }
+       unregister_netdev(&dev_3c509);
+       kfree_s(dev_3c509.priv,sizeof(struct el3_private));
+       dev_3c509.priv=NULL;
+       /* If we don't do this, we can't re-insmod it later. */
+       release_region(dev_3c509.base_addr, EL3_IO_EXTENT);
 }
 #endif /* MODULE */
 \f
index a26b530..f21462b 100644 (file)
@@ -36,10+36,7 @@ static const char *version =
   The National Semiconductor LAN Databook, and the 3Com 3c503 databook.
   */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#endif
 
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -704,7+701,6 @@ static void NS8390_trigger_send(struct device *dev, unsigned int length,
 }
 
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 
 int init_module(void)
 {
index 843eb19..05321ce 100644 (file)
@@ -130,12+130,12 @@ else
 endif
 
 ifeq ($(CONFIG_PPP),y)
-L_OBJS += ppp.o
+LX_OBJS += ppp.o
 CONFIG_SLHC_BUILTIN = y
 else
   ifeq ($(CONFIG_PPP),m)
   CONFIG_SLHC_MODULE = y
-  M_OBJS += ppp.o
+  MX_OBJS += ppp.o
   endif
 endif
 
index 26075af..86eb9a6 100644 (file)
 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>
 #include <linux/string.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+
 #include <asm/system.h>
 #include <asm/io.h>
 
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
 #include "8390.h"
 
 /* Offsets from the base address. */
@@ -221,9+220,7 @@ static int ac_open(struct device *dev)
        rc = ei_open(dev);
        if (rc != 0) return rc;
 
-#ifdef MODULE
        MOD_INC_USE_COUNT;
-#endif
 
        return 0;
 }
@@ -298,15+295,12 @@ static int ac_close_card(struct device *dev)
 
        NS8390_init(dev, 0);
 
-#ifdef MODULE
        MOD_DEC_USE_COUNT;
-#endif
 
        return 0;
 }
 
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 static char devicename[9] = { 0, };
 static struct device dev_ac3200 = {
        devicename, /* device name is inserted by linux/drivers/net/net_init.c */
@@ -314,8+308,8 @@ static struct device dev_ac3200 = {
        0, 0,
        0, 0, 0, NULL, ac3200_probe };
 
-int io = 0;
-int irq = 0;
+static int io = 0;
+static int irq = 0;
 
 int init_module(void)
 {
@@ -331,16+325,11 @@ int init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("ac3200: device busy, remove delayed\n");
-       else
-       {
-               unregister_netdev(&dev_ac3200);
-
-               /* If we don't do this, we can't re-insmod it later. */
-               free_irq(dev_ac3200.irq);
-               release_region(dev_ac3200.base_addr, AC_IO_EXTENT);
-       }
+       unregister_netdev(&dev_ac3200);
+
+       /* If we don't do this, we can't re-insmod it later. */
+       free_irq(dev_ac3200.irq);
+       release_region(dev_ac3200.base_addr, AC_IO_EXTENT);
 }
 #endif /* MODULE */
 \f
index dcd15d4..66ce398 100644 (file)
 
 static const char *version = "apricot.c:v0.2 05/12/94\n";
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#endif
 
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -34,14+31,14 @@ static const char *version = "apricot.c:v0.2 05/12/94\n";
 #include <linux/ioport.h>
 #include <linux/malloc.h>
 #include <linux/interrupt.h>
-#include <asm/bitops.h>
-#include <asm/io.h>
-#include <asm/dma.h>
-
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 
+#include <asm/bitops.h>
+#include <asm/io.h>
+#include <asm/dma.h>
+
 #ifndef HAVE_PORTRESERVE
 #define check_region(addr, size)       0
 #define request_region(addr, size,name)        do ; while(0)
@@ -562,9+559,7 @@ i596_open(struct device *dev)
     dev->tbusy = 0;
     dev->interrupt = 0;
     dev->start = 1;
-#ifdef MODULE
     MOD_INC_USE_COUNT;
-#endif
 
     /* Initialize the 82596 memory */
     init_i596_mem(dev);
@@ -946,10+941,7 @@ i596_close(struct device *dev)
     free_irq(dev->irq);
     irq2dev_map[dev->irq] = 0;
     remove_rx_bufs(dev);
-#ifdef MODULE
     MOD_DEC_USE_COUNT;
-#endif
-
 
     return 0;
 }
@@ -1013,7+1005,6 @@ struct netdev_entry apricot_drv =
 #endif
 
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 static char devicename[9] = { 0, };
 static struct device dev_apricot = {
   devicename, /* device name inserted by /linux/drivers/net/net_init.c */
@@ -1021,8+1012,8 @@ static struct device dev_apricot = {
   0x300, 10,
   0, 0, 0, NULL, apricot_probe };
 
-int io = 0x300;
-int irq = 10;
+static int io = 0x300;
+static int irq = 10;
 
 int
 init_module(void)
@@ -1037,17+1028,12 @@ init_module(void)
 void
 cleanup_module(void)
 {
-  if (MOD_IN_USE)
-    printk("%s: device busy, remove delayed\n", dev_apricot.name);
-  else
-  {
     unregister_netdev(&dev_apricot);
     kfree_s((void *)dev_apricot.mem_start, sizeof(struct i596_private) + 0xf);
     dev_apricot.priv = NULL;
 
     /* If we don't do this, we can't re-insmod it later. */
     release_region(dev_apricot.base_addr, APRICOT_TOTAL_SIZE);
-  }
 }
 #endif /* MODULE */
 \f
index 3aca66b..4012f84 100644 (file)
 static const char *version =
  "arcnet.c:v2.12 ALPHA 95/10/27 Avery Pennarun <apenwarr@foxnet.net>\n";
 
-
-#include <linux/config.h>
-#include <linux/version.h>
-
-#ifdef MODULE
 #include <linux/module.h>
-#endif /* MODULE */
-
 
+#include <linux/config.h>
 /* are we Linux 1.2.x? */
 #if LINUX_VERSION_CODE < 0x10300
 #define LINUX12
@@ -155,16+148,17 @@ static const char *version =
 #include <linux/errno.h>
 #include <linux/delay.h>
 #include <linux/if_arp.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/skbuff.h>
+
+#include <linux/config.h>      /* for CONFIG_INET */
 
 #include <asm/system.h>
 #include <asm/bitops.h>
 #include <asm/io.h>
 #include <asm/dma.h>
 
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-
 #ifdef LINUX12
 #include "arp.h"
 #else
@@ -1140,11+1134,8 @@ arcnet_open(struct device *dev)
        JIFFER(ACKtime);
        outb(NORXflag|RECON_flag,INTMASK);
        
-
-#ifdef MODULE
        MOD_INC_USE_COUNT;
-#endif
-                                       
+
        return 0;
 }
 
@@ -1189,9+1180,7 @@ arcnet_close(struct device *dev)
 
        /* Update the statistics here. */
 
-#ifdef MODULE
        MOD_DEC_USE_COUNT;
-#endif
 
        return 0;
 }
@@ -2997,7+2986,6 @@ unsigned short arcnetS_type_trans(struct sk_buff *skb,struct device *dev)
 
 
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 static char devicename[9] = { 0, };
 static struct device thiscard = {
   devicename, /* device name is inserted by linux/drivers/net/net_init.c */
@@ -3007,10+2995,10 @@ static struct device thiscard = {
 };
        
        
-int io=0x0;    /* <--- EDIT THESE LINES FOR YOUR CONFIGURATION */
-int irqnum=0;  /* or use the insmod io= irqnum= shmem= options */
-int shmem=0;
-int num=0;     /* number of device (ie for 0 for arc0, 1 for arc1...) */
+static int io=0x0;     /* <--- EDIT THESE LINES FOR YOUR CONFIGURATION */
+static int irqnum=0;   /* or use the insmod io= irqnum= shmem= options */
+static int shmem=0;
+static int num=0;      /* number of device (ie for 0 for arc0, 1 for arc1...) */
 
 int
 init_module(void)
@@ -3038,20+3026,13 @@ init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-       {
-               printk("%s: device busy, remove delayed\n",thiscard.name);
-       }
-       else
-       {
-               if (thiscard.start) arcnet_close(&thiscard);
-               if (thiscard.irq) free_irq(thiscard.irq);
-               if (thiscard.base_addr) release_region(thiscard.base_addr,
+       if (thiscard.start) arcnet_close(&thiscard);
+       if (thiscard.irq) free_irq(thiscard.irq);
+       if (thiscard.base_addr) release_region(thiscard.base_addr,
                                                ARCNET_TOTAL_SIZE);
-               unregister_netdev(&thiscard);
-               kfree(thiscard.priv);
-               thiscard.priv = NULL;
-       }
+       unregister_netdev(&thiscard);
+       kfree(thiscard.priv);
+       thiscard.priv = NULL;
 }
 
 #endif /* MODULE */
index 11d1af4..8312a9a 100644 (file)
@@ -355,9+355,7 @@ static int net_open(struct device *dev)
        dev->interrupt = 0;
        dev->start = 1;
 
-#ifdef MODULE
        MOD_INC_USE_COUNT;
-#endif
 
        return 0;
 }
@@ -587,9+585,7 @@ static int net_close(struct device *dev)
        /* Power-down the chip.  Green, green, green! */
        outb(0x00, ioaddr + CONFIG_1);
 
-#ifdef MODULE
        MOD_DEC_USE_COUNT;
-#endif
 
        return 0;
 }
@@ -640,8+636,8 @@ static struct device dev_at1700 = {
        0, 0,
        0, 0, 0, NULL, at1700_probe };
 
-int io = 0x260;
-int irq = 0;
+static int io = 0x260;
+static int irq = 0;
 
 int init_module(void)
 {
@@ -659,19+655,14 @@ int init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("at1700: device busy, remove delayed\n");
-       else
-       {
-               unregister_netdev(&dev_at1700);
-               kfree(dev_at1700.priv);
-               dev_at1700.priv = NULL;
-
-               /* If we don't do this, we can't re-insmod it later. */
-               free_irq(dev_at1700.irq);
-               irq2dev_map[dev_at1700.irq] = NULL;
-               release_region(dev_at1700.base_addr, AT1700_IO_EXTENT);
-       }
+       unregister_netdev(&dev_at1700);
+       kfree(dev_at1700.priv);
+       dev_at1700.priv = NULL;
+
+       /* If we don't do this, we can't re-insmod it later. */
+       free_irq(dev_at1700.irq);
+       irq2dev_map[dev_at1700.irq] = NULL;
+       release_region(dev_at1700.base_addr, AT1700_IO_EXTENT);
 }
 #endif /* MODULE */
 \f
index 98b2fe9..9aa8785 100644 (file)
@@ -1197,8+1197,5 @@ init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("ppp_bsd_comp: device busy, remove delayed\n");
-       else
-               ppp_unregister_compressor (&ppp_bsd_compress);
+       ppp_unregister_compressor (&ppp_bsd_compress);
 }
index 04647b0..9997411 100644 (file)
@@ -2764,20+2764,16 @@ cleanup_module(void)
 {
   struct de4x5_private *lp = (struct de4x5_private *) thisDE4X5.priv;
 
-  if (MOD_IN_USE) {
-    printk("%s: device busy, remove delayed\n",thisDE4X5.name);
-  } else {
-    if (lp) {
-      kfree_s(bus_to_virt(lp->rx_ring[0].buf), RX_BUFF_SZ * NUM_RX_DESC + ALIGN);
-    }
-    kfree_s(thisDE4X5.priv, sizeof(struct de4x5_private) + ALIGN);
-    thisDE4X5.priv = NULL;
+  if (lp) {
+    kfree_s(bus_to_virt(lp->rx_ring[0].buf), RX_BUFF_SZ * NUM_RX_DESC + ALIGN);
+  }
+  kfree_s(thisDE4X5.priv, sizeof(struct de4x5_private) + ALIGN);
+  thisDE4X5.priv = NULL;
 
-    release_region(thisDE4X5.base_addr, (lp->bus == PCI ? 
+  release_region(thisDE4X5.base_addr, (lp->bus == PCI ? 
                                                     DE4X5_PCI_TOTAL_SIZE :
                                                     DE4X5_EISA_TOTAL_SIZE));
-    unregister_netdev(&thisDE4X5);
-  }
+  unregister_netdev(&thisDE4X5);
 }
 #endif /* MODULE */
 
index b325955..d80e5ca 100644 (file)
@@ -90,10+90,7 @@ static const char *version =
 #endif
 unsigned int de600_debug = DE600_DEBUG;
 \f
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#endif
 
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -345,9+342,7 @@ de600_open(struct device *dev)
        }
        irq2dev_map[DE600_IRQ] = dev;
 
-#ifdef MODULE
        MOD_INC_USE_COUNT;
-#endif
        dev->start = 1;
        if (adapter_init(dev)) {
                return 1;
@@ -373,9+368,7 @@ de600_close(struct device *dev)
                free_irq(DE600_IRQ);
                irq2dev_map[DE600_IRQ] = NULL;
                dev->start = 0;
-#ifdef MODULE
                MOD_DEC_USE_COUNT;
-#endif
        }
        return 0;
 }
@@ -832,7+825,6 @@ de600_rspace(struct sock *sk)
 #endif
 \f
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 static char nullname[8];
 static struct device de600_dev = {
        nullname, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, de600_probe };
index 9664ac1..fe4e0bd 100644 (file)
@@ -1,5+1,5 @@
 /*
- *     de620.c $Revision: 1.31 $ BETA
+ *     de620.c $Revision: 1.40 $ BETA
  *
  *
  *     Linux driver for the D-Link DE-620 Ethernet pocket adapter.
  *
  *****************************************************************************/
 static const char *version =
-       "de620.c: $Revision: 1.31 $,  Bjorn Ekwall <bj0rn@blox.se>\n";
+       "de620.c: $Revision: 1.40 $,  Bjorn Ekwall <bj0rn@blox.se>\n";
 \f
 /***********************************************************************
  *
@@ -57,6+57,22 @@ static const char *version =
  */
 
 /*
+ * This driver assumes that the printer port is a "normal",
+ * dumb, uni-directional port!
+ * If your port is "fancy" in any way, please try to set it to "normal"
+ * with your BIOS setup.  I have no access to machines with bi-directional
+ * ports, so I can't test such a driver :-(
+ * (Yes, I _know_ it is possible to use DE620 with bidirectional ports...)
+ *
+ * There are some clones of DE620 out there, with different names.
+ * If the current driver does not recognize a clone, try to change
+ * the following #define to:
+ *
+ * #define DE620_CLONE 1
+ */
+#define DE620_CLONE 0
+
+/*
  * If the adapter has problems with high speeds, enable this #define
  * otherwise full printerport speed will be attempted.
  *
@@ -100,18+116,8 @@ static const char *version =
 #define COUNT_LOOPS
  */
 #endif
-static int bnc = 0, utp = 0;
-/*
- * Force media with insmod:
- *     insmod de620.o bnc=1
- * or
- *     insmod de620.o utp=1
- */
 \f
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#endif
 
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -165,6+171,27 @@ typedef unsigned char byte;
 #define PRINTK(x) /**/
 #endif
 
+
+/*
+ * Force media with insmod:
+ *     insmod de620.o bnc=1
+ * or
+ *     insmod de620.o utp=1
+ *
+ * Force io and/or irq with insmod:
+ *     insmod de620.o io=0x378 irq=7
+ *
+ * Make a clone skip the Ethernet-address range check:
+ *     insmod de620.o clone=1
+ */
+static int bnc = 0;
+static int utp = 0;
+static int io  = DE620_IO;
+static int irq = DE620_IRQ;
+static int clone = DE620_CLONE;
+
+static unsigned int de620_debug = DE620_DEBUG;
+
 /***********************************************
  *                                             *
  * Index to functions, as function prototypes. *
@@ -200,8+227,6 @@ static int  read_eeprom(struct device *);
 #define DE620_RX_START_PAGE 12         /* 12 pages (=3k) reserved for tx */
 #define DEF_NIC_CMD IRQEN | ICEN | DS1
 
-unsigned int de620_debug = DE620_DEBUG;
-
 static volatile byte   NIC_Cmd;
 static volatile byte   next_rx_page;
 static byte            first_rx_page;
@@ -407,15+432,13 @@ de620_get_register(struct device *dev, byte reg)
 static int
 de620_open(struct device *dev)
 {
-       if (request_irq(DE620_IRQ, de620_interrupt, 0, "de620")) {
-               printk ("%s: unable to get IRQ %d\n", dev->name, DE620_IRQ);
+       if (request_irq(dev->irq, de620_interrupt, 0, "de620")) {
+               printk ("%s: unable to get IRQ %d\n", dev->name, dev->irq);
                return 1;
        }
-       irq2dev_map[DE620_IRQ] = dev;
+       irq2dev_map[dev->irq] = dev;
 
-#ifdef MODULE
        MOD_INC_USE_COUNT;
-#endif
        if (adapter_init(dev)) {
                return 1;
        }
@@ -434,13+457,11 @@ de620_close(struct device *dev)
        /* disable recv */
        de620_set_register(dev, W_TCR, RXOFF);
 
-       free_irq(DE620_IRQ);
-       irq2dev_map[DE620_IRQ] = NULL;
+       free_irq(dev->irq);
+       irq2dev_map[dev->irq] = NULL;
 
        dev->start = 0;
-#ifdef MODULE
        MOD_DEC_USE_COUNT;
-#endif
        return 0;
 }
 
@@ -580,16+601,16 @@ de620_start_xmit(struct sk_buff *skb, struct device *dev)
  *
  */
 static void
-de620_interrupt(int irq, struct pt_regs *regs)
+de620_interrupt(int irq_in, struct pt_regs *regs)
 {
-       struct device *dev = irq2dev_map[irq];
+       struct device *dev = irq2dev_map[irq_in];
        byte irq_status;
        int bogus_count = 0;
        int again = 0;
 
        /* This might be deleted now, no crummy drivers present :-) Or..? */
-       if ((dev == NULL) || (DE620_IRQ != irq)) {
-               printk("%s: bogus interrupt %d\n", dev?dev->name:"DE620", irq);
+       if ((dev == NULL) || (irq != irq_in)) {
+               printk("%s: bogus interrupt %d\n", dev?dev->name:"de620", irq_in);
                return;
        }
 
@@ -817,6+838,13 @@ de620_probe(struct device *dev)
        int i;
        byte checkbyte = 0xa5;
 
+       /*
+        * This is where the base_addr and irq gets set.
+        * Tunable at compile-time and insmod-time
+        */
+       dev->base_addr = io;
+       dev->irq       = irq;
+
        if (de620_debug)
                printk(version);
 
@@ -836,12+864,12 @@ de620_probe(struct device *dev)
        }
 
 #if 0 /* Not yet */
-       if (check_region(DE620_IO, 3)) {
-               printk(", port 0x%x busy\n", DE620_IO);
+       if (check_region(dev->base_addr, 3)) {
+               printk(", port 0x%x busy\n", dev->base_addr);
                return EBUSY;
        }
 #endif
-       request_region(DE620_IO, 3, "de620");
+       request_region(dev->base_addr, 3, "de620");
 
        /* else, got it! */
        printk(", Ethernet Address: %2.2X",
@@ -869,8+897,7 @@ de620_probe(struct device *dev)
        dev->stop = de620_close;
        dev->hard_start_xmit = &de620_start_xmit;
        dev->set_multicast_list = &de620_set_multicast_list;
-       dev->base_addr = DE620_IO;
-       dev->irq = DE620_IRQ;
+       /* base_addr and irq are already set, see above! */
 
        ether_setup(dev);
        
@@ -948,13+975,13 @@ read_eeprom(struct device *dev)
 
        /* D-Link Ethernet addresses are in the series  00:80:c8:7X:XX:XX:XX */
        wrd = ReadAWord(dev, 0x1aa);    /* bytes 0 + 1 of NodeID */
-       if (wrd != htons(0x0080)) /* Valid D-Link ether sequence? */
+       if (!clone && (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(dev, 0x1ab);    /* bytes 2 + 3 of NodeID */
-       if ((wrd & 0xff) != 0xc8) /* Valid D-Link ether sequence? */
+       if (!clone && ((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;
@@ -984,19+1011,13 @@ read_eeprom(struct device *dev)
  *
  */
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 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;
index 37e5661..3fe4f0c 100644 (file)
@@ -1837,9+1837,6 @@ init_module(void)
 void
 cleanup_module(void)
 {
-  if (MOD_IN_USE) {
-    printk("%s: device busy, remove delayed\n",thisDepca.name);
-  } else {
     release_region(thisDepca.base_addr, DEPCA_TOTAL_SIZE);
     if (thisDepca.priv) {
       kfree_s(thisDepca.priv, sizeof(struct depca_private));
@@ -1847,7+1844,6 @@ cleanup_module(void)
     }
 
     unregister_netdev(&thisDepca);
-  }
 }
 #endif /* MODULE */
 
index 30b7847..4cc00d9 100644 (file)
@@ -164,13+164,8 @@ int init_module(void)
 
 void cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("dummy: device busy, remove delayed\n");
-       else
-       {
-               unregister_netdev(&dev_dummy);
-               kfree(dev_dummy.priv);
-               dev_dummy.priv = NULL;
-       }
+       unregister_netdev(&dev_dummy);
+       kfree(dev_dummy.priv);
+       dev_dummy.priv = NULL;
 }
 #endif /* MODULE */
index 011917a..756a72b 100644 (file)
 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>
 #include <linux/string.h>
-#include <asm/io.h>
-#include <asm/system.h>
 #include <linux/ioport.h>
-
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
+
+#include <asm/io.h>
+#include <asm/system.h>
+
 #include "8390.h"
 
 static int e21_probe_list[] = {0x300, 0x280, 0x380, 0x220, 0};
@@ -261,9+259,7 @@ e21_open(struct device *dev)
 
        rc = ei_open(dev);
        if (rc != 0) return rc;
-#ifdef MODULE
        MOD_INC_USE_COUNT;
-#endif
        return 0;
 }
 
@@ -359,9+355,7 @@ e21_close(struct device *dev)
           really bad things happen if it isn't. */
        mem_off(ioaddr);
 
-#ifdef MODULE
        MOD_DEC_USE_COUNT;
-#endif
 
        return 0;
 }
@@ -372,7+366,6 @@ struct netdev_entry e21_drv =
 #endif
 
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 static char devicename[9] = { 0, };
 static struct device dev_e2100 = {
        devicename, /* device name is inserted by linux/drivers/net/net_init.c */
@@ -380,8+373,8 @@ static struct device dev_e2100 = {
        0, 0,
        0, 0, 0, NULL, e2100_probe };
 
-int io = 0x300;
-int irq = 0;
+static int io = 0x300;
+static int irq = 0;
 
 int init_module(void)
 {
@@ -399,15+392,10 @@ int init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("e2100: device busy, remove delayed\n");
-       else
-       {
-               unregister_netdev(&dev_e2100);
-
-               /* If we don't do this, we can't re-insmod it later. */
-               release_region(dev_e2100.base_addr, E21_IO_EXTENT);
-       }
+       unregister_netdev(&dev_e2100);
+
+       /* If we don't do this, we can't re-insmod it later. */
+       release_region(dev_e2100.base_addr, E21_IO_EXTENT);
 }
 #endif /* MODULE */
 \f
index c033050..b3f8eac 100644 (file)
@@ -587,9+587,7 @@ eepro_open(struct device *dev)
 
        outb(RCV_ENABLE_CMD, ioaddr);
 
-#ifdef MODULE
        MOD_INC_USE_COUNT;
-#endif
        return 0;
 }
 
@@ -756,9+754,7 @@ eepro_close(struct device *dev)
        SLOW_DOWN_IO;
        SLOW_DOWN_IO; /* May not be enough? */
 
-#ifdef MODULE
        MOD_DEC_USE_COUNT;
-#endif
        return 0;
 }
 
@@ -1138,8+1134,8 @@ static struct device dev_eepro = {
        0, 0,
        0, 0, 0, NULL, eepro_probe };
 
-int io = 0x200;
-int irq = 0;
+static int io = 0x200;
+static int irq = 0;
 
 int
 init_module(void)
@@ -1157,16+1153,11 @@ init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("eepro: device busy, remove delayed\n");
-       else
-       {
-               unregister_netdev(&dev_eepro);
-               kfree_s(dev_eepro.priv,sizeof(struct eepro_local));
-               dev_eepro.priv=NULL;
-
-               /* If we don't do this, we can't re-insmod it later. */
-               release_region(dev_eepro.base_addr, EEPRO_IO_EXTENT);
-       }
+       unregister_netdev(&dev_eepro);
+       kfree_s(dev_eepro.priv,sizeof(struct eepro_local));
+       dev_eepro.priv=NULL;
+
+       /* If we don't do this, we can't re-insmod it later. */
+       release_region(dev_eepro.base_addr, EEPRO_IO_EXTENT);
 }
 #endif /* MODULE */
index 4c30117..d525c7f 100644 (file)
@@ -442,9+442,7 @@ eexp_open(struct device *dev)
        dev->tbusy = 0;
        dev->interrupt = 0;
        dev->start = 1;
-#ifdef MODULE
        MOD_INC_USE_COUNT;
-#endif
        return 0;
 }
 
@@ -656,9+654,7 @@ eexp_close(struct device *dev)
 
        /* Update the statistics here. */
 
-#ifdef MODULE
        MOD_DEC_USE_COUNT;
-#endif
        return 0;
 }
 
@@ -1006,8+1002,8 @@ static struct device dev_eexpress = {
        0, 0, 0, NULL, express_probe };
        
 
-int irq=0x300;
-int io=0;      
+static int irq=0x300;
+static int io=0;       
 
 int
 init_module(void)
@@ -1024,17+1020,12 @@ init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("eexpress: device busy, remove delayed\n");
-       else
-       {
-               unregister_netdev(&dev_eexpress);
-               kfree_s(dev_eexpress.priv,sizeof(struct net_local));
-               dev_eexpress.priv=NULL;
+       unregister_netdev(&dev_eexpress);
+       kfree_s(dev_eexpress.priv,sizeof(struct net_local));
+       dev_eexpress.priv=NULL;
 
-               /* If we don't do this, we can't re-insmod it later. */
-               release_region(dev_eexpress.base_addr, EEXPRESS_IO_EXTENT);
-       }
+       /* If we don't do this, we can't re-insmod it later. */
+       release_region(dev_eexpress.base_addr, EEXPRESS_IO_EXTENT);
 }
 #endif /* MODULE */
 /*
index dcec176..ef1027a 100644 (file)
@@ -291,9+291,7 @@ eql_open(struct device *dev)
        eql->timer_on = 1;
        add_timer (&eql->timer);
 
-#ifdef MODULE
        MOD_INC_USE_COUNT;
-#endif
        return 0;
       }
   return 1;
@@ -318,9+316,7 @@ eql_close(struct device *dev)
 
   eql_delete_slave_queue (eql->queue);
 
-#ifdef MODULE
   MOD_DEC_USE_COUNT;
-#endif
 
   return 0;
 }
@@ -1203,12+1199,7 @@ int init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("eql: device busy, remove delayed\n");
-       else
-       {
-               unregister_netdev(&dev_eql);
-       }
+       unregister_netdev(&dev_eql);
 }
 #endif /* MODULE */
 
index 160ce39..bfe6093 100644 (file)
 
 static const char *version = "ewrk3.c:v0.32 1/16/95 davies@wanton.lkg.dec.com\n";
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#endif /* MODULE */
 
 #include <stdarg.h>
+
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/string.h>
@@ -142,19+140,18 @@ static const char *version = "ewrk3.c:v0.32 1/16/95 davies@wanton.lkg.dec.com\n"
 #include <linux/ioport.h>
 #include <linux/malloc.h>
 #include <linux/interrupt.h>
-#include <asm/bitops.h>
-#include <asm/io.h>
-#include <asm/dma.h>
-#include <asm/segment.h>
-
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
-
 #include <linux/time.h>
 #include <linux/types.h>
 #include <linux/unistd.h>
 
+#include <asm/bitops.h>
+#include <asm/io.h>
+#include <asm/dma.h>
+#include <asm/segment.h>
+
 #include "ewrk3.h"
 
 #ifdef EWRK3_DEBUG
@@ -712,10+709,7 @@ ewrk3_open(struct device *dev)
     printk("      Run the 'ewrk3setup' utility or remove the hard straps.\n");
   }
 
-#ifdef MODULE
-    MOD_INC_USE_COUNT;
-#endif       
-
+  MOD_INC_USE_COUNT;
 
   return status;
 }
@@ -1190,9+1184,7 @@ ewrk3_close(struct device *dev)
     irq2dev_map[dev->irq] = 0;
   }
 
-#ifdef MODULE
   MOD_DEC_USE_COUNT;
-#endif    
 
   return 0;
 }
@@ -1856,7+1848,6 @@ static char asc2hex(char value)
 }
 
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 static char devicename[9] = { 0, };
 static struct device thisEthwrk = {
   devicename, /* device name is inserted by linux/drivers/net/net_init.c */
@@ -1864,8+1855,8 @@ static struct device thisEthwrk = {
   0x300, 5,  /* I/O address, IRQ */
   0, 0, 0, NULL, ewrk3_probe };
        
-int io=0x300;  /* <--- EDIT THESE LINES FOR YOUR CONFIGURATION */
-int irq=5;     /* or use the insmod io= irq= options           */
+static int io=0x300;   /* <--- EDIT THESE LINES FOR YOUR CONFIGURATION */
+static int irq=5;      /* or use the insmod io= irq= options           */
 
 int
 init_module(void)
@@ -1880,14+1871,10 @@ init_module(void)
 void
 cleanup_module(void)
 {
-  if (MOD_IN_USE) {
-    printk("%s: device busy, remove delayed\n",thisEthwrk.name);
-  } else {
     release_region(thisEthwrk.base_addr, EWRK3_TOTAL_SIZE);
     unregister_netdev(&thisEthwrk);
     kfree(thisEthwrk.priv);
     thisEthwrk.priv = NULL;
-  }
 }
 #endif /* MODULE */
 
index 1110add..57e3949 100644 (file)
 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>
@@ -400,7+397,6 @@ hpp_mem_block_output(struct device *dev, int count,
 }
 
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 static char devicename[9] = { 0, };
 static struct device dev_hp = {
        devicename, /* device name is inserted by linux/drivers/net/net_init.c */
@@ -408,8+404,8 @@ static struct device dev_hp = {
        0, 0,
        0, 0, 0, NULL, hp_plus_probe };
 
-int io = 0x200;
-int irq = 0;
+static int io = 0x200;
+static int irq = 0;
 
 int init_module(void)
 {
@@ -427,17+423,12 @@ int init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("HP-plus: device busy, remove delayed\n");
-       else
-       {
-               int ioaddr = dev_hp.base_addr - NIC_OFFSET;
+       int ioaddr = dev_hp.base_addr - NIC_OFFSET;
 
-               unregister_netdev(&dev_hp);
+       unregister_netdev(&dev_hp);
 
-               /* If we don't do this, we can't re-insmod it later. */
-               release_region(ioaddr, HP_IO_EXTENT);
-       }
+       /* If we don't do this, we can't re-insmod it later. */
+       release_region(ioaddr, HP_IO_EXTENT);
 }
 #endif /* MODULE */
 \f
index 6e1adf1..a3631a8 100644 (file)
@@ -22,20+22,18 @@ 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>
 #include <linux/ioport.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+
 #include <asm/system.h>
 #include <asm/io.h>
 
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
 #include "8390.h"
 
 /* A zero-terminated list of I/O addresses to be probed. */
@@ -350,7+348,6 @@ hp_init_card(struct device *dev)
 }
 
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 static char devicename[9] = { 0, };
 static struct device dev_hp = {
        devicename, /* device name is inserted by linux/drivers/net/net_init.c */
@@ -358,8+355,8 @@ static struct device dev_hp = {
        0, 0,
        0, 0, 0, NULL, hp_probe };
 
-int io = 300;
-int irq = 0;
+static int io = 300;
+static int irq = 0;
 
 int init_module(void)
 {
@@ -377,18+374,13 @@ int init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("hp: device busy, remove delayed\n");
-       else
-       {
-               int ioaddr = dev_hp.base_addr - NIC_OFFSET;
+       int ioaddr = dev_hp.base_addr - NIC_OFFSET;
 
-               unregister_netdev(&dev_hp);
+       unregister_netdev(&dev_hp);
 
-               /* If we don't do this, we can't re-insmod it later. */
-               free_irq(dev_hp.irq);
-               release_region(ioaddr, HP_IO_EXTENT);
-       }
+       /* If we don't do this, we can't re-insmod it later. */
+       free_irq(dev_hp.irq);
+       release_region(ioaddr, HP_IO_EXTENT);
 }
 #endif /* MODULE */
 \f
index ca9ea8b..698e8fd 100644 (file)
@@ -499,9+499,7 @@ static int hp100_open( struct device *dev )
     }
   irq2dev_map[ dev -> irq ] = dev;
 
-#ifdef MODULE
   MOD_INC_USE_COUNT;
-#endif
   
   dev -> tbusy = 0;
   dev -> trans_start = jiffies;
@@ -569,9+567,7 @@ static int hp100_close( struct device *dev )
 
   free_irq( dev -> irq );
   irq2dev_map[ dev -> irq ] = NULL;
-#ifdef MODULE
   MOD_DEC_USE_COUNT;
-#endif
   return 0;
 }
 
index d2c3916..327c262 100644 (file)
       active adapter is identified.
 */
        
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#endif
 
 #define NO_AUTODETECT 1
 #undef NO_AUTODETECT
@@ -563,9+560,7 @@ static int tok_open(struct device *dev) {
       /*  NEED to see smem size *AND* reset high 512 bytes if
           needed */
 
-#ifdef MODULE
-       MOD_INC_USE_COUNT;
-#endif
+      MOD_INC_USE_COUNT;
 
       return 0;
    }
@@ -589,11+584,9 @@ static int tok_close(struct device *dev) {
 
        if(close_adapter->ret_code)
                DPRINTK("close adapter failed: %02X\n",close_adapter->ret_code);
-
-#ifdef MODULE
-       MOD_DEC_USE_COUNT;
-#endif
        
+       MOD_DEC_USE_COUNT;
+
        return 0;
 }
 
@@ -1294,7+1287,6 @@ static struct enet_statistics * tok_get_stats(struct device *dev) {
 }
 
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 static char devicename[9] = { 0, };
 static struct device dev_ibmtr = {
        devicename, /* device name is inserted by linux/drivers/net/net_init.c */
@@ -1302,7+1294,7 @@ static struct device dev_ibmtr = {
        0, 0,
        0, 0, 0, NULL, tok_probe };
 
-int io = 0xa20;
+static int io = 0xa20;
 
 int init_module(void)
 {
@@ -1320,16+1312,11 @@ int init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("ibmtr: device busy, remove delayed\n");
-       else
-       {
-               unregister_netdev(&dev_ibmtr);
-
-               /* If we don't do this, we can't re-insmod it later. */
-               free_irq(dev_ibmtr.irq);
-               irq2dev_map[dev_ibmtr.irq] = NULL;
-               release_region(dev_ibmtr.base_addr, TR_IO_EXTENT);
-       }
+       unregister_netdev(&dev_ibmtr);
+
+       /* If we don't do this, we can't re-insmod it later. */
+       free_irq(dev_ibmtr.irq);
+       irq2dev_map[dev_ibmtr.irq] = NULL;
+       release_region(dev_ibmtr.base_addr, TR_IO_EXTENT);
 }
 #endif /* MODULE */
index bbbc161..7f565aa 100644 (file)
@@ -30,10+30,7 @@ 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>
@@ -572,7+569,6 @@ ne_block_output(struct device *dev, int count,
 }
 
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 static char devicename[9] = { 0, };
 static struct device dev_ne2000 = {
        devicename, /* device name is inserted by linux/drivers/net/net_init.c */
@@ -580,8+576,8 @@ static struct device dev_ne2000 = {
        0, 0,
        0, 0, 0, NULL, ne_probe };
 
-int io = 0x300;
-int irq = 0;
+static int io = 0x300;
+static int irq = 0;
 
 int init_module(void)
 {
@@ -597,16+593,11 @@ int init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("ne2000: device busy, remove delayed\n");
-       else
-       {
-               unregister_netdev(&dev_ne2000);
-
-               /* If we don't do this, we can't re-insmod it later. */
-               free_irq(dev_ne2000.irq);
-               release_region(dev_ne2000.base_addr, NE_IO_EXTENT);
-       }
+       unregister_netdev(&dev_ne2000);
+
+       /* If we don't do this, we can't re-insmod it later. */
+       free_irq(dev_ne2000.irq);
+       release_region(dev_ne2000.base_addr, NE_IO_EXTENT);
 }
 #endif /* MODULE */
 \f
index b7f4143..273fe82 100644 (file)
@@ -91,7+91,7 @@ static const char *version =
 #define PI2_MODULE 0
 
 #if PI2_MODULE > 0
-#include <linux/modules.h>
+#include <linux/module.h>
 #endif
 
 #include <linux/kernel.h>
index 0e7f627..a0677c5 100644 (file)
@@ -85,13+85,7 @@ static const char *version = "NET3 PLIP version 2.1 gniibe@mri.co.jp\n";
     extra grounds are 18,19,20,21,22,23,24
 */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
 
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -1060,9+1054,8 @@ plip_ioctl(struct device *dev, struct ifreq *rq, int cmd)
 }
 \f
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
-int io[] = {0, 0, 0};
-int irq[] = {0, 0, 0};
+static int io[] = {0, 0, 0};
+static int irq[] = {0, 0, 0};
 
 static struct device dev_plip[] = {
        {
index 371d653..7248f64 100644 (file)
@@ -6,7+6,7 @@
  *  Dynamic PPP devices by Jim Freeman <jfree@caldera.com>.
  *  ppp_tty_receive ``noisy-raise-bug'' fixed by Ove Ewerlid <ewerlid@syscon.uu.se>
  *
- *  ==FILEVERSION 6==
+ *  ==FILEVERSION 7==
  *
  *  NOTE TO MAINTAINERS:
  *     If you modify this file at all, increment the number above.
  */
 
 #include <linux/module.h>
-#ifdef MODULE
-#define  STATIC
-#else
-#define  STATIC static
-#endif /* def MODULE */
 
 #include <endian.h>
 #include <linux/kernel.h>
@@ -131,8+126,8 @@ typedef struct sk_buff           sk_buff;
 #define PPP_LQR 0xc025  /* Link Quality Reporting Protocol */
 #endif
 
-STATIC int ppp_register_compressor (struct compressor *cp);
-STATIC void ppp_unregister_compressor (struct compressor *cp);
+static int ppp_register_compressor (struct compressor *cp);
+static void ppp_unregister_compressor (struct compressor *cp);
 
 /*
  * Local functions
@@ -176,8+171,8 @@ static int  rcv_proto_ccp (struct ppp *, u_short, u_char *, int);
  * Parameters which may be changed via insmod.
  */
 
-STATIC int  flag_time = OPTIMIZE_FLAG_TIME;
-STATIC int  max_dev   = PPP_MAX_DEV;
+static int  flag_time = OPTIMIZE_FLAG_TIME;
+static int  max_dev   = PPP_MAX_DEV;
 
 /*
  * The "main" procedure to the ppp device
@@ -541,6+536,14 @@ ppp_init_ctrl_blk (register struct ppp *ppp)
        ppp->sc_rc_state = NULL;
 }
 
+static struct symbol_table ppp_syms = {
+#include <linux/symtab_begin.h>
+       X(ppp_register_compressor),
+       X(ppp_unregister_compressor),
+       X(ppp_crc16_table),
+#include <linux/symtab_end.h>
+};
+
 /* called at boot/load time for each ppp device defined in the kernel */
 
 #ifndef MODULE
@@ -551,28+554,19 @@ ppp_init (struct device *dev)
        int    answer = 0;
 
        if (first_time) {
-               static struct symbol_table ppp_syms = {
-#include <linux/symtab_begin.h>
-#define Y(sym) { (void *) &sym, SYMBOL_NAME_STR (sym) }
-                       Y(ppp_register_compressor),
-                       Y(ppp_unregister_compressor),
-                       Y(ppp_crc16_table),
-#undef Y
-#include <linux/symtab_end.h>
-               };
-
                first_time = 0;
                answer     = ppp_first_time();
                if (answer == 0)
                        (void) register_symtab (&ppp_syms);
        }
-/*
- * Un-register the devices defined at the start of the system. They will
- * be added when they are needed again. The first device just gets us into
- * this code to register the handlers.
- */
-       unregister_netdev (dev);
-       return answer;
+       if (answer)
+               return answer;
+       /*
+        * Return "not found", so that dev_init() will unlink
+        * the placeholder device entry for us.
+        */
+       return ENODEV;
+
 }
 #endif
 
@@ -3471,7+3465,7 @@ static struct compressor *find_compressor (int type)
        return (struct compressor *) 0;
 }
 
-STATIC int ppp_register_compressor (struct compressor *cp)
+static int ppp_register_compressor (struct compressor *cp)
 {
        struct compressor_link *new;
        unsigned long flags;
@@ -3498,7+3492,7 @@ STATIC int ppp_register_compressor (struct compressor *cp)
        return 0;
 }
 
-STATIC void ppp_unregister_compressor (struct compressor *cp)
+static void ppp_unregister_compressor (struct compressor *cp)
 {
        struct compressor_link *prev = (struct compressor_link *) 0;
        struct compressor_link *lnk;
@@ -3528,7+3522,6 @@ STATIC void ppp_unregister_compressor (struct compressor *cp)
  *************************************************************/
 
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 
 int
 init_module(void)
@@ -3540,6+3533,8 @@ init_module(void)
        if (status != 0)
                printk (KERN_INFO
                       "PPP: ppp_init() failure %d\n", status);
+       else
+               (void) register_symtab (&ppp_syms);
        return (status);
 }
 
@@ -3550,26+3545,24 @@ cleanup_module(void)
        ppp_ctrl_t *ctl, *next_ctl;
        struct device *dev;
        struct ppp *ppp;
-       int busy_flag = MOD_IN_USE;
+       int busy_flag = 0;
 /*
  * Ensure that the devices are not in operation.
  */
-       if (!busy_flag) {
-               ctl = ppp_list;
-               while (ctl) {
-                       ppp = ctl2ppp (ctl);
-                       if (ppp->inuse && ppp->tty != NULL) {
-                               busy_flag = 1;
-                               break;
-                       }
+       ctl = ppp_list;
+       while (ctl) {
+               ppp = ctl2ppp (ctl);
+               if (ppp->inuse && ppp->tty != NULL) {
+                       busy_flag = 1;
+                       break;
+               }
 
-                       dev = ctl2dev (ctl);
-                       if (dev->start || dev->flags & IFF_UP) {
-                               busy_flag = 1;
-                               break;
-                       }
-                       ctl = ctl->next;
+               dev = ctl2dev (ctl);
+               if (dev->start || dev->flags & IFF_UP) {
+                       busy_flag = 1;
+                       break;
                }
+               ctl = ctl->next;
        }
 /*
  * Ensure that there are no compressor modules registered
@@ -3595,10+3588,6 @@ cleanup_module(void)
                printk (KERN_INFO
                       "PPP: ppp line discipline successfully unregistered\n");
 /*
- * Remove the symbol definitions
- */
-       (void) register_symtab ((struct symbol_table *) 0);
-/*
  * De-register the devices so that there is no problem with them
  */    
        next_ctl = ppp_list;
index 34eaef0..19ba388 100644 (file)
@@ -39,13+39,7 @@ static const char *version =
        under the GPL.
 */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#else
-#define  MOD_INC_USE_COUNT do {} while (0)
-#define  MOD_DEC_USE_COUNT do {} while (0)
-#endif
 
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -531,7+525,6 @@ set_multicast_list(struct device *dev, int num_addrs, void *addrs)
 \f
 #ifdef MODULE
 
-char kernel_version[] = UTS_RELEASE;
 static char devicename[9] = { 0, };
 static struct device this_device = {
        devicename, /* device name is inserted by linux/drivers/net/net_init.c */
@@ -539,10+532,10 @@ static struct device this_device = {
        0, 0,  /* I/O address, IRQ */
        0, 0, 0, NULL, netcard_probe };
 
-int io = 0x300;
-int irq = 0;
-int dma = 0;
-int mem = 0;
+static int io = 0x300;
+static int irq = 0;
+static int dma = 0;
+static int mem = 0;
 
 int init_module(void)
 {
index d2241e1..1fdbbaa 100644 (file)
 #include <linux/config.h>
 #ifdef CONFIG_INET
 /* Entire module is for IP only */
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#endif
 
 #include <linux/types.h>
 #include <linux/sched.h>
@@ -158,9+155,7 @@ slhc_init(int rslots, int tslots)
                ts[0].next = &(ts[comp->tslot_limit]);
                ts[0].cs_this = 0;
        }
-#ifdef MODULE
        MOD_INC_USE_COUNT;
-#endif
        return comp;
 }
 
@@ -178,9+173,7 @@ slhc_free(struct slcompress *comp)
        if ( comp->tstate != NULLSLSTATE )
                kfree( comp->tstate );
 
-#ifdef MODULE
        MOD_DEC_USE_COUNT;
-#endif
        kfree( comp );
 }
 
@@ -735,7+728,6 @@ void slhc_o_status(struct slcompress *comp)
 }
 
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 
 int init_module(void)
 {
@@ -745,9+737,6 @@ int init_module(void)
 
 void cleanup_module(void)
 {
-       if (MOD_IN_USE)  {
-               printk("CSLIP: module in use, remove delayed");
-       }
        return;
 }
 #endif /* MODULE */
index 724e33c..6bc36b0 100644 (file)
 
 #define SL_CHECK_TRANSMIT
 #include <linux/config.h>
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#endif
 
 /* Undef this, if you don't need 6bit encapsulation code in the driver */
 #define CONFIG_SLIP_MODE_SLIP6
@@ -761,9+758,7 @@ slip_open(struct tty_struct *tty)
                return err;
        }
        
-#ifdef MODULE
        MOD_INC_USE_COUNT;
-#endif
 
        /* Done.  We have linked the TTY line to a channel. */
        return sl->dev->base_addr;
@@ -792,9+787,7 @@ slip_close(struct tty_struct *tty)
        sl->tty = NULL;
        sl_free(sl);
        unregister_netdev(sl->dev);
-#ifdef MODULE
        MOD_DEC_USE_COUNT;
-#endif
 }
 
 
@@ -1235,7+1228,6 @@ slip_init(struct device *dev)
        return 0;
 }
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 
 int
 init_module(void)
@@ -1248,10+1240,6 @@ cleanup_module(void)
 {
        int i;
 
-       if (MOD_IN_USE)  {
-               printk("SLIP: device busy, remove delayed\n");
-               return;
-       }
        if (slip_ctrls != NULL) {
          for (i = 0; i < slip_maxdev; i++)  {
            if (slip_ctrls[i] != NULL) {
index 5075776..36a301c 100644 (file)
@@ -41,10+41,7 @@ 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>
@@ -235,9+232,7 @@ ultra_open(struct device *dev)
        outb(0x01, ioaddr + 6);         /* Enable interrupts and memory. */
        rc = ei_open(dev);
        if (rc != 0) return rc;
-#ifdef MODULE
        MOD_INC_USE_COUNT;
-#endif
        return 0;
 }
 
@@ -330,15+325,12 @@ ultra_close_card(struct device *dev)
        /* 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 char devicename[9] = { 0, };
 static struct device dev_ultra = {
        devicename, /* device name is inserted by linux/drivers/net/net_init.c */
@@ -346,8+338,8 @@ static struct device dev_ultra = {
        0, 0,
        0, 0, 0, NULL, ultra_probe };
 
-int io = 0x200;
-int irq = 0;
+static int io = 0x200;
+static int irq = 0;
 
 int init_module(void)
 {
@@ -365,17+357,12 @@ int init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("smc-ultra: device busy, remove delayed\n");
-       else
-       {
-               int ioaddr = dev_ultra.base_addr - ULTRA_NIC_OFFSET;
+       int ioaddr = dev_ultra.base_addr - ULTRA_NIC_OFFSET;
 
-               unregister_netdev(&dev_ultra);
+       unregister_netdev(&dev_ultra);
 
-               /* If we don't do this, we can't re-insmod it later. */
+       /* If we don't do this, we can't re-insmod it later. */
        release_region(ioaddr, ULTRA_IO_EXTENT);
-       }
 }
 #endif /* MODULE */
 \f
index 3c836a2..25dbca0 100644 (file)
@@ -344,9+344,7 @@ tulip_open(struct device *dev)
                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;
 }
 
@@ -660,9+658,7 @@ tulip_close(struct device *dev)
        free_irq(dev->irq);
        irq2dev_map[dev->irq] = 0;
 
-#ifdef MODULE
        MOD_DEC_USE_COUNT;
-#endif
        return 0;
 }
 
@@ -745,8+741,8 @@ static struct device dev_tulip = {
        0, 0, 0, NULL, tulip_probe
 };
 
-int io = 0;
-int irq = 0;
+static int io = 0;
+static int irq = 0;
 
 int init_module(void)
 {
@@ -768,12+764,7 @@ int init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               printk("tulip: device busy, remove delayed\n");
-       else
-       {
-               unregister_netdev(&dev_tulip);
-       }
+       unregister_netdev(&dev_tulip);
 }
 #endif /* MODULE */
 \f
index a925f5d..dcd54df 100644 (file)
                -Alan Cox       (Alan.Cox@linux.org) 21 March 95
 */
 
-#include <linux/config.h>
-#ifdef CONFIG_IP_FORWARD
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#endif
 
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -316,4+311,3 @@ void cleanup_module(void)
        dev_tunnel.priv=NULL;
 }
 #endif /* MODULE */
-#endif
index d780d14..e95eae6 100644 (file)
@@ -1264,9+1264,7 @@ wavelan_open(device *dev)
                return -EAGAIN;
        }
 
-#if    defined(MODULE)
        MOD_INC_USE_COUNT;
-#endif /* defined(MODULE) */
 
        if (wavelan_debug > 0)
                printk("%s: <-wavelan_open(): 0\n", dev->name);
@@ -1992,9+1990,7 @@ wavelan_close(device *dev)
         */
        release_region(ioaddr, sizeof(ha_t));
 
-#if    defined(MODULE)
        MOD_DEC_USE_COUNT;
-#endif /* defined(MODULE) */
 
        if (wavelan_debug > 0)
                printk("%s: <-wavelan_close(): 0\n", dev->name);
@@ -2179,8+2175,8 @@ static struct device      dev_wavelan             =
        0, 0, 0, NULL, wavelan_probe
 };
 
-int io = 0x390; /* Default from above.. */
-int irq = 0;
+static int io = 0x390; /* Default from above.. */
+static int irq = 0;
 
 int
 init_module(void)
@@ -2196,15+2192,10 @@ init_module(void)
 void
 cleanup_module(void)
 {
-       if (MOD_IN_USE)
-               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;
-       }
+       proc_net_unregister(PROC_NET_WAVELAN);
+       unregister_netdev(&dev_wavelan);
+       kfree_s(dev_wavelan.priv, sizeof(struct net_local));
+       dev_wavelan.priv = NULL;
 }
 #endif /* defined(MODULE) */
 
index c05cda6..eacf953 100644 (file)
 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>
@@ -302,9+299,7 @@ wd_open(struct device *dev)
 
   rc = ei_open(dev);
   if (rc != 0) return rc;
-#ifdef MODULE
   MOD_INC_USE_COUNT;
-#endif
   return 0;
 }
 
@@ -406,9+401,7 @@ wd_close_card(struct device *dev)
        /* And disable the shared memory. */
        outb(ei_status.reg0 & ~WD_MEMENB, wd_cmdreg);
 
-#ifdef MODULE
        MOD_DEC_USE_COUNT;
-#endif
 
        return 0;
 }
@@ -417,7+410,6 @@ wd_close_card(struct device *dev)
 #ifdef MODULE
 #define MAX_WD_MODS    4       /* Max number of wd modules allowed */
 #define NAMELEN                9       /* # of chars for storing dev->name */
-char kernel_version[] = UTS_RELEASE;
 static char namelist[NAMELEN * MAX_WD_MODS] = { 0, };
 static struct device dev_wd80x3[MAX_WD_MODS] = {
        {
index 24495b0..4874477 100644 (file)
  *
  */
 
-#ifdef MODULE
 #include <linux/module.h>
-#endif
 
 #include <asm/dma.h>
 #include <asm/io.h>
index 3716f99..9b03da7 100644 (file)
@@ -14,6+14,7 @@ endif
 L_TARGET := scsi.a
 L_OBJS   := 
 M_OBJS   := 
+MX_OBJS  := 
 MOD_LIST_NAME := SCSI_MODULES
 SCSI_SRCS = $(wildcard $(L_OBJS:%.o=%.c))
 
@@ -34,11+35,7 @@ ifeq ($(CONFIG_SCSI),y)
 L_OBJS += hosts.o scsi.o scsi_ioctl.o constants.o scsicam.o scsi_proc.o
 else
   ifeq ($(CONFIG_SCSI),m)
-    ifdef CONFIG_MODVERSIONS
-      # Create this before we build anything else.
-      SCSI_MODULE_VER := scsi_syms.ver
-    endif
-    SYMTAB_OBJS := scsi_syms.o
+    MX_OBJS += scsi_syms.o
     M_OBJS += scsi_mod.o
   endif
 endif
@@ -242,12+239,6 @@ endif
 
 include $(TOPDIR)/Rules.make
 
-ifeq ($(CONFIG_SCSI),m)
-  ifdef CONFIG_MODVERSIONS
-      include ../../versions.mk
-  endif
-endif
-
 aha152x.o: aha152x.c
        $(CC) $(CFLAGS) $(AHA152X) -c aha152x.c 
 
@@ -272,16+263,12 @@ seagate.o: seagate.c
        mv scriptu.h 53c8xx_u.h
        rm fake.c
 
-scsi_mod.o: $(SCSI_MODULE_VER) hosts.o scsi.o scsi_ioctl.o constants.o \
-               scsicam.o scsi_proc.o $(SYMTAB_OBJS)
-       $(LD) $(LD_RFLAG) -r -o $@ hosts.o scsi.o scsi_ioctl.o constants.o scsicam.o scsi_proc.o $(SYMTAB_OBJS)
+scsi_mod.o: $(MX_OBJS) hosts.o scsi.o scsi_ioctl.o constants.o \
+               scsicam.o scsi_proc.o
+       $(LD) $(LD_RFLAG) -r -o $@ $(MX_OBJS) hosts.o scsi.o scsi_ioctl.o constants.o scsicam.o scsi_proc.o
 
-sr_mod.o: $(SCSI_MODULE_VER) sr.o sr_ioctl.o
+sr_mod.o: sr.o sr_ioctl.o
        $(LD) $(LD_RFLAG) -r -o $@ sr.o sr_ioctl.o
 
-sd_mod.o: $(SCSI_MODULE_VER) sd.o sd_ioctl.o
+sd_mod.o: sd.o sd_ioctl.o
        $(LD) $(LD_RFLAG) -r -o $@ sd.o sd_ioctl.o
-
-$(SYMTAB_OBJS): $(SYMTAB_OBJS:.o=.c)
-
-modules: $(SCSI_MODULE_VER)
index 476d2dc..acc776f 100644 (file)
@@ -3107,12+3107,6 @@ void cleanup_module( void)
 
     timer_table[SCSI_TIMER].fn = NULL;
     timer_table[SCSI_TIMER].expires = 0;
-    /*
-     * Supposedly you just do this, and the last symtab registered will
-     * be removed.  If someone else registered a symtab, this could
-     * blow up in our faces.  FIXME.
-     */
-    register_symtab(0);
 }
 #endif /* MODULE */
 
index c054de5..9ba78d8 100644 (file)
  */
 
 #include <linux/module.h>
-#include <linux/version.h>
-
-char kernel_version[] = UTS_RELEASE;
 
 int init_module(void) {
     driver_template.usage_count = &mod_use_count_;
@@ -41,10+38,6 @@ int init_module(void) {
 }
 
 void cleanup_module( void) {
-    if (MOD_IN_USE) {
-       printk(KERN_INFO __FILE__ ": module is in use, remove rejected\n");
-       return;
-    }
     scsi_unregister_module(MODULE_SCSI_HA, &driver_template);
 }
 
index 8849afe..9b55cd2 100644 (file)
@@ -6,16+6,9 @@
 #error Go away.
 #endif
 
-/*
- * Even though we are building a module, we need to undef this, since
- * we are building a symbol table to be used by other modules.  For
- * the symbol table to build properly, we need to undefine this.
- */
-#undef MODULE
-
 #include <linux/module.h>
-
 #include <linux/config.h>
+
 #include <linux/sched.h>
 #include <linux/timer.h>
 #include <linux/string.h>
@@ -47,10+40,6 @@ extern void print_sense(const char * devclass, Scsi_Cmnd * SCpnt);
 
 struct symbol_table scsi_symbol_table = {
 #include <linux/symtab_begin.h>
-#ifdef CONFIG_MODVERSIONS
-    { (void *)1 /* Version version :-) */, 
-       SYMBOL_NAME_STR(Using_Versions) },
-#endif
     X(scsi_register_module),
     X(scsi_unregister_module),
     X(scsi_free),
index d85f8b2..19c9329 100644 (file)
  *       low-level scsi drivers.
  */
 
-#ifdef MODULE
-#include <linux/autoconf.h>
 #include <linux/module.h>
-#include <linux/version.h>
+#ifdef MODULE
 /*
  * This is a variable in scsi.c that is set when we are processing something
  * after boot time.  By definition, this is true when we are a loadable module
@@ -1462,10+1460,6 @@ static void sd_detach(Scsi_Device * SDp)
 }
 
 #ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-
-char kernel_version[] = UTS_RELEASE;
 
 int init_module(void) {
     sd_template.usage_count = &mod_use_count_;
@@ -1477,10+1471,6 @@ void cleanup_module( void)
     struct gendisk * prev_sdgd;
     struct gendisk * sdgd;
     
-    if (MOD_IN_USE) {
-       printk(KERN_INFO __FILE__ ": module is in use, remove rejected\n");
-       return;
-    }
     scsi_unregister_module(MODULE_SCSI_DEV, &sd_template);
     unregister_blkdev(SCSI_DISK_MAJOR, "sd");
     sd_registered--;
index 71b87ec..23b5c9f 100644 (file)
@@ -6,11+6,7 @@
  *   
  *  Borrows code from st driver.
  */
-#ifdef MODULE
-#include <linux/autoconf.h>
 #include <linux/module.h>
-#include <linux/version.h>
-#endif /* MODULE */
 
 #include <linux/fs.h>
 #include <linux/kernel.h>
@@ -602,7+598,6 @@ static void sg_detach(Scsi_Device * SDp)
 }
 
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 
 int init_module(void) {
     sg_template.usage_count = &mod_use_count_;
@@ -611,10+606,6 @@ int init_module(void) {
 
 void cleanup_module( void) 
 {
-    if (MOD_IN_USE) {
-       printk(KERN_INFO __FILE__ ": module is in use, remove rejected\n");
-       return;
-    }
     scsi_unregister_module(MODULE_SCSI_DEV, &sg_template);
     unregister_chrdev(SCSI_GENERIC_MAJOR, "sg");
     
index fb5b717..c093cef 100644 (file)
  *
  */
 
-#ifdef MODULE
-#include <linux/autoconf.h>
 #include <linux/module.h>
-#include <linux/version.h>
-#endif /* MODULE */
 
 #include <linux/fs.h>
 #include <linux/kernel.h>
@@ -1139,10+1135,6 @@ static void sr_detach(Scsi_Device * SDp)
 
 
 #ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-
-char kernel_version[] = UTS_RELEASE;
 
 int init_module(void) {
     sr_template.usage_count = &mod_use_count_;
index 9ecef95..b75be83 100644 (file)
   Last modified: Sat Nov  4 22:23:54 1995 by root@kai.makisara.fi
   Some small formal changes - aeb, 950809
 */
-#ifdef MODULE
-#include <linux/autoconf.h>
+
 #include <linux/module.h>
-#include <linux/version.h>
-#endif /* MODULE */
 
 #include <linux/fs.h>
 #include <linux/kernel.h>
@@ -2241,7+2238,6 @@ static void st_detach(Scsi_Device * SDp)
 
 
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 
 int init_module(void) {
   st_template.usage_count = &mod_use_count_;
@@ -2252,10+2248,6 @@ void cleanup_module( void)
 {
   int i;
 
-  if (MOD_IN_USE) {
-    printk(KERN_INFO __FILE__ ": module is in use, remove rejected\n");
-    return;
-  }
   scsi_unregister_module(MODULE_SCSI_DEV, &st_template);
   unregister_chrdev(SCSI_TAPE_MAJOR, "st");
   st_registered--;
index 33cc02b..fa747b5 100644 (file)
@@ -58,7+58,7 @@ static int      audio_format[MAX_AUDIO_DEV];
 static int      local_conversion[MAX_AUDIO_DEV];
 
 static int
-set_format (int dev, int fmt)
+set_format (int dev, long fmt)
 {
   if (fmt != AFMT_QUERY)
     {
@@ -87,7+87,7 @@ int
 audio_open (int dev, struct fileinfo *file)
 {
   int             ret;
-  int             bits;
+  long            bits;
   int             dev_type = dev & 0x0f;
   int             mode = file->mode & O_ACCMODE;
 
index fcff233..85e5824 100644 (file)
@@ -157,7+157,7 @@ sb16_dsp_ioctl (int dev, unsigned int cmd, ioctl_arg arg, int local)
     {
     case SOUND_PCM_WRITE_RATE:
       if (local)
-       return dsp_set_speed ((int) arg);
+       return dsp_set_speed ((long) arg);
       return snd_ioctl_return ((int *) arg, dsp_set_speed (get_fs_long ((long *) arg)));
 
     case SOUND_PCM_READ_RATE:
@@ -167,12+167,12 @@ sb16_dsp_ioctl (int dev, unsigned int cmd, ioctl_arg arg, int local)
 
     case SNDCTL_DSP_STEREO:
       if (local)
-       return dsp_set_stereo ((int) arg);
+       return dsp_set_stereo ((long) arg);
       return snd_ioctl_return ((int *) arg, dsp_set_stereo (get_fs_long ((long *) arg)));
 
     case SOUND_PCM_WRITE_CHANNELS:
       if (local)
-       return dsp_set_stereo ((int) arg - 1) + 1;
+       return dsp_set_stereo ((long) arg - 1) + 1;
       return snd_ioctl_return ((int *) arg, dsp_set_stereo (get_fs_long ((long *) arg) - 1) + 1);
 
     case SOUND_PCM_READ_CHANNELS:
@@ -182,7+182,7 @@ sb16_dsp_ioctl (int dev, unsigned int cmd, ioctl_arg arg, int local)
 
     case SNDCTL_DSP_SETFMT:
       if (local)
-       return dsp_set_bits ((int) arg);
+       return dsp_set_bits ((long) arg);
       return snd_ioctl_return ((int *) arg, dsp_set_bits (get_fs_long ((long *) arg)));
 
     case SOUND_PCM_READ_BITS:
index ed82e69..465e1bc 100644 (file)
@@ -737,7+737,7 @@ sb_dsp_ioctl (int dev, unsigned int cmd, ioctl_arg arg, int local)
     {
     case SOUND_PCM_WRITE_RATE:
       if (local)
-       return dsp_speed ((int) arg);
+       return dsp_speed ((long) arg);
       return snd_ioctl_return ((int *) arg, dsp_speed (get_fs_long ((long *) arg)));
       break;
 
@@ -749,7+749,7 @@ sb_dsp_ioctl (int dev, unsigned int cmd, ioctl_arg arg, int local)
 
     case SOUND_PCM_WRITE_CHANNELS:
       if (local)
-       return dsp_set_stereo ((int) arg - 1) + 1;
+       return dsp_set_stereo ((long) arg - 1) + 1;
       return snd_ioctl_return ((int *) arg, dsp_set_stereo (get_fs_long ((long *) arg) - 1) + 1);
       break;
 
@@ -761,7+761,7 @@ sb_dsp_ioctl (int dev, unsigned int cmd, ioctl_arg arg, int local)
 
     case SNDCTL_DSP_STEREO:
       if (local)
-       return dsp_set_stereo ((int) arg);
+       return dsp_set_stereo ((long) arg);
       return snd_ioctl_return ((int *) arg, dsp_set_stereo (get_fs_long ((long *) arg)));
       break;
 
@@ -785,9+785,7 @@ sb_dsp_ioctl (int dev, unsigned int cmd, ioctl_arg arg, int local)
     case SOUND_PCM_READ_BITS:
       if (local)
        return 8;
-      return snd_ioctl_return ((int *) (int) arg, 8);  /*
-                                                          * Only 8 bits/sample supported
-                                                        */
+      return snd_ioctl_return ((int *) arg, 8);        /* Only 8 bits/sample supported */
       break;
 #endif /* ifdef JAZZ16  */
 
index c36496b..ff37cc3 100644 (file)
@@ -308,8+308,6 @@ free_all_irqs (void)
   irqs = 0;
 }
 
-char            kernel_version[] = UTS_RELEASE;
-
 #endif
 
 static int      debugmem = 0;  /* switched off by default */
index 6baf075..9990615 100644 (file)
@@ -9,13+9,7 @@
  * Copyright 1993, 1994: Eric Youngdale (ericy@cais.com).
  */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
 
 #include <linux/fs.h>
 #include <linux/stat.h>
@@ -1229,23+1223,17 @@ static int elf_core_dump(long signr, struct pt_regs * regs)
 }
 
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 
 int init_module(void) {
        /* Install the COFF, ELF and XOUT loaders.
         * N.B. We *rely* on the table being the right size with the
         * right number of free slots...
         */
-       register_binfmt(&elf_format);
-       return 0;
+       return register_binfmt(&elf_format);
 }
 
 
 void cleanup_module( void) {
-       
-       if (MOD_IN_USE)
-               printk(KERN_INFO "iBCS: module is in use, remove delayed\n");
-
        /* Remove the COFF and ELF loaders. */
        unregister_binfmt(&elf_format);
 }
index 23d286c..a4f389e 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -853,10+853,19 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
        current->suid = current->euid = current->fsuid = bprm->e_uid;
        current->sgid = current->egid = current->fsgid = bprm->e_gid;
        if (N_MAGIC(ex) == OMAGIC) {
+#ifdef __alpha__
+               do_mmap(NULL, N_TXTADDR(ex) & PAGE_MASK,
+                       ex.a_text+ex.a_data + PAGE_SIZE - 1,
+                       PROT_READ|PROT_WRITE|PROT_EXEC,
+                       MAP_FIXED|MAP_PRIVATE, 0);
+               read_exec(bprm->inode, fd_offset, (char *) N_TXTADDR(ex),
+                         ex.a_text+ex.a_data, 0);
+#else
                do_mmap(NULL, 0, ex.a_text+ex.a_data,
                        PROT_READ|PROT_WRITE|PROT_EXEC,
                        MAP_FIXED|MAP_PRIVATE, 0);
                read_exec(bprm->inode, 32, (char *) 0, ex.a_text+ex.a_data, 0);
+#endif
        } else {
                if (ex.a_text & 0xfff || ex.a_data & 0xfff)
                        printk(KERN_NOTICE "executable not page aligned\n");
index 2c107b2..aef0ed5 100644 (file)
  *  Copyright (C) 1991, 1992  Linus Torvalds
  */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
 
 #include <linux/sched.h>
 #include <linux/ext_fs.h>
@@ -459,16+453,13 @@ int ext_sync_inode (struct inode *inode)
 
 #ifdef MODULE
 
-char kernel_version[] = UTS_RELEASE;
-
 static struct file_system_type ext_fs_type = {
         ext_read_super, "ext", 1, NULL
 };
 
 int init_module(void)
 {
-        register_filesystem(&ext_fs_type);
-        return 0;
+        return register_filesystem(&ext_fs_type);
 }
 
 void cleanup_module(void)
index ec6c610..f16af45 100644 (file)
  *  Copyright (C) 1991, 1992  Linus Torvalds
  */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
 
 #include <stdarg.h>
 
@@ -687,16+681,13 @@ int ext2_remount (struct super_block * sb, int * flags, char * data)
 
 #ifdef MODULE
 
-char kernel_version[] = UTS_RELEASE;
-
 static struct file_system_type ext2_fs_type = {
         ext2_read_super, "ext2", 1, NULL
 };
 
 int init_module(void)
 {
-        register_filesystem(&ext2_fs_type);
-        return 0;
+        return register_filesystem(&ext2_fs_type);
 }
 
 void cleanup_module(void)
index c6673a8..1a1b223 100644 (file)
    code pages OS/2 is using.  Recoding from on-disk names to UTF-8
    could use the code page tags, though this is not what OS/2 does. */
 
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
-
 
 static const unsigned char tb_cp850_to_latin1[128] =
 {
index 5eab178..5edae65 100644 (file)
  *   linux/fs/isofs  Copyright (C) 1991  Eric Youngdale
  */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
 
 #include <linux/fs.h>
 #include <linux/hpfs_fs.h>
@@ -1743,16+1737,13 @@ static void brelse4(struct quad_buffer_head *qbh)
 
 #ifdef MODULE
 
-char kernel_version[] = UTS_RELEASE;
-
 static struct file_system_type hpfs_fs_type = {
         hpfs_read_super, "hpfs", 1, NULL
 };
 
 int init_module(void)
 {
-        register_filesystem(&hpfs_fs_type);
-        return 0;
+        return register_filesystem(&hpfs_fs_type);
 }
 
 void cleanup_module(void)
index 36c98bc..7d7c0ed 100644 (file)
@@ -8,14+8,7 @@
  *  isofs directory handling functions
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/errno.h>
-
-#include <asm/segment.h>
-
 #include <linux/fs.h>
 #include <linux/iso_fs.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/locks.h>
 
+#include <asm/segment.h>
+
 static int isofs_readdir(struct inode *, struct file *, void *, filldir_t);
 
 static struct file_operations isofs_dir_operations =
index f2626b7..8be7e54 100644 (file)
@@ -8,13+8,6 @@
  *  isofs regular file handling primitives
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-#include <asm/system.h>
-
 #include <linux/sched.h>
 #include <linux/iso_fs.h>
 #include <linux/fcntl.h>
 #include <linux/stat.h>
 #include <linux/locks.h>
 
-#include <linux/dirent.h>
+#include <asm/segment.h>
+#include <asm/system.h>
 
 #define        NBUF    32
 
index d48248b..ad2b4c1 100644 (file)
@@ -8,13+8,7 @@
  *
  */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
 
 #include <linux/stat.h>
 #include <linux/sched.h>
@@ -798,16+792,13 @@ void leak_check_brelse(struct buffer_head * bh){
 
 #ifdef MODULE
 
-char kernel_version[] = UTS_RELEASE;
-
 static struct file_system_type iso9660_fs_type = {
        isofs_read_super, "iso9660", 1, NULL
 };
 
 int init_module(void)
 {
-       register_filesystem(&iso9660_fs_type);
-       return 0;
+       return register_filesystem(&iso9660_fs_type);
 }
 
 void cleanup_module(void)
index 67421ca..8d7a067 100644 (file)
@@ -6,10+6,6 @@
  *  (C) 1991  Linus Torvalds - minix filesystem
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/sched.h>
 #include <linux/iso_fs.h>
 #include <linux/kernel.h>
index dd2e8ec..86f0f8d 100644 (file)
@@ -5,9+5,6 @@
  *
  *  Rock Ridge Extensions to iso9660
  */
-#ifdef MODULE
-#include <linux/module.h>
-#endif
 
 #include <linux/stat.h>
 #include <linux/sched.h>
index 4b43418..50910f6 100644 (file)
@@ -9,12+9,6 @@
  *  extensions to iso9660
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/fs.h>
 #include <linux/stat.h>
 #include <linux/malloc.h>
 
+#include <asm/segment.h>
+
 static int isofs_readlink(struct inode *, char *, int);
 static int isofs_follow_link(struct inode *, struct inode *, int, int, struct inode **);
 
index ba432b3..9e6ae07 100644 (file)
@@ -9,11+9,6 @@
  * the bsd386 iso9660 filesystem, by Pace Williamson.
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-
 int
 isonum_711 (char * p)
 {
index d557f06..9b38c63 100644 (file)
@@ -6,10+6,6 @@
 
 /* bitmap.c contains the code that handles the inode and block bitmaps */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/sched.h>
 #include <linux/minix_fs.h>
 #include <linux/stat.h>
index dccc104..7f3cdb1 100644 (file)
@@ -6,10+6,6 @@
  *  minix directory handling functions
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/fs.h>
index cf24664..d22fa2a 100644 (file)
@@ -6,13+6,6 @@
  *  minix regular file handling primitives
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-#include <asm/system.h>
-
 #include <linux/sched.h>
 #include <linux/minix_fs.h>
 #include <linux/kernel.h>
 #include <linux/stat.h>
 #include <linux/locks.h>
 
+#include <asm/segment.h>
+#include <asm/system.h>
+
 #define        NBUF    32
 
 #define MIN(a,b) (((a)<(b))?(a):(b))
index 436d271..796aa42 100644 (file)
@@ -8,13+8,6 @@
  *  minix fsync primitive
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-#include <asm/system.h>
-
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/stat.h>
 #include <linux/fs.h>
 #include <linux/minix_fs.h>
 
+#include <asm/segment.h>
+#include <asm/system.h>
 
 #define blocksize BLOCK_SIZE
 #define addr_per_block 512
index b99e714..b41664c 100644 (file)
@@ -4,13+4,7 @@
  *  Copyright (C) 1991, 1992  Linus Torvalds
  */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
 
 #include <linux/sched.h>
 #include <linux/minix_fs.h>
@@ -530,16+524,13 @@ int minix_sync_inode(struct inode * inode)
 
 #ifdef MODULE
 
-char kernel_version[] = UTS_RELEASE;
-
 static struct file_system_type minix_fs_type = {
        minix_read_super, "minix", 1, NULL
 };
 
 int init_module(void)
 {
-       register_filesystem(&minix_fs_type);
-       return 0;
+       return register_filesystem(&minix_fs_type);
 }
 
 void cleanup_module(void)
index f1bee44..4b64d02 100644 (file)
@@ -4,10+4,6 @@
  *  Copyright (C) 1991, 1992  Linus Torvalds
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/sched.h>
 #include <linux/minix_fs.h>
 #include <linux/kernel.h>
index c390bb3..0cb1d78 100644 (file)
  *  minix symlink handling code
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/fs.h>
 #include <linux/minix_fs.h>
 #include <linux/stat.h>
 
+#include <asm/segment.h>
+
 static int minix_readlink(struct inode *, char *, int);
 static int minix_follow_link(struct inode *, struct inode *, int, int, struct inode **);
 
index 3ed7e2f..0eea1d5 100644 (file)
@@ -4,10+4,6 @@
  *  Copyright (C) 1991, 1992  Linus Torvalds
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/minix_fs.h>
index 13e7aae..62a4bde 100644 (file)
@@ -1,6+1,8 @@
-#ifdef MODULE
-#include <linux/module.h>
-#endif
+/*
+ * linux/fs/msdos/buffer.c
+ *
+ *
+ */
 
 #include <linux/mm.h>
 #include <linux/malloc.h>
index 4654eb0..725a16d 100644 (file)
  *  MS-DOS directory handling functions
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-
 #include <linux/fs.h>
 #include <linux/msdos_fs.h>
 #include <linux/errno.h>
 #include <linux/stat.h>
 #include <linux/string.h>
 
+#include <asm/segment.h>
+
 #include "msbuffer.h"
 
 
index 6c2fcca..049eaed 100644 (file)
@@ -4,10+4,6 @@
  *  Written 1992,1993 by Werner Almesberger
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/msdos_fs.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
index a265128..691a504 100644 (file)
@@ -6,12+6,7 @@
  *  MS-DOS regular file handling primitives
  */
 
-#ifdef MODULE
 #include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-#include <asm/system.h>
 
 #include <linux/sched.h>
 #include <linux/locks.h>
 #include <linux/stat.h>
 #include <linux/string.h>
 
+#include <asm/segment.h>
+#include <asm/system.h>
+
 #include "msbuffer.h"
 
 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
index c8f32fb..f74edb4 100644 (file)
@@ -4,13+4,7 @@
  *  Written 1992,1993 by Werner Almesberger
  */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
 
 #include <linux/msdos_fs.h>
 #include <linux/kernel.h>
@@ -506,9+500,8 @@ int msdos_notify_change(struct inode * inode,struct iattr * attr)
            ~MSDOS_SB(inode->i_sb)->fs_umask;
        return 0;
 }
-#ifdef MODULE
 
-char kernel_version[] = UTS_RELEASE;
+#ifdef MODULE
 
 static struct file_system_type msdos_fs_type = {
        msdos_read_super, "msdos", 1, NULL
@@ -516,8+509,7 @@ static struct file_system_type msdos_fs_type = {
 
 int init_module(void)
 {
-       register_filesystem(&msdos_fs_type);
-       return 0;
+       return register_filesystem(&msdos_fs_type);
 }
 
 void cleanup_module(void)
index 30e88c1..42f477c 100644 (file)
@@ -4,10+4,6 @@
  *  Written 1992,1993 by Werner Almesberger
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/fs.h>
 #include <linux/msdos_fs.h>
 #include <linux/sched.h>
index 7da98d4..ffd0871 100644 (file)
@@ -6,9+6,6 @@
  *
  *     msdos mmap handling
  */
-#ifdef MODULE
-#include <linux/module.h>
-#endif
 
 #include <linux/stat.h>
 #include <linux/sched.h>
 #include <linux/mman.h>
 #include <linux/string.h>
 #include <linux/malloc.h>
+#include <linux/msdos_fs.h>
+
 #include <asm/segment.h>
 #include <asm/system.h>
-#include <linux/msdos_fs.h>
 
 /*
  * Fill in the supplied page for mmap
index 4b23f30..f26a9bd 100644 (file)
@@ -4,12+4,6 @@
  *  Written 1992,1993 by Werner Almesberger
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-
 #include <linux/sched.h>
 #include <linux/msdos_fs.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
 #include <linux/stat.h>
 
+#include <asm/segment.h>
+
 #include "msbuffer.h"
 
 #define PRINTK(x)
index 591feff..41bec08 100644 (file)
@@ -6,10+6,6 @@
  *  nfs directory handling functions
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/sched.h>
 #include <linux/errno.h>
 #include <linux/stat.h>
index a94c68a..dcc1d9e 100644 (file)
  *  nfs regular file handling functions
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-#include <asm/system.h>
-
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/nfs_fs.h>
 #include <linux/malloc.h>
 
+#include <asm/segment.h>
+#include <asm/system.h>
+
 static int nfs_file_read(struct inode *, struct file *, char *, int);
 static int nfs_file_write(struct inode *, struct file *, const char *, int);
 static int nfs_fsync(struct inode *, struct file *);
index 9285929..d390e58 100644 (file)
  *
  */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
-
-#include <asm/system.h>
-#include <asm/segment.h>
 
 #include <linux/sched.h>
 #include <linux/nfs_fs.h>
 #include <linux/errno.h>
 #include <linux/locks.h>
 
+#include <asm/system.h>
+#include <asm/segment.h>
+
 extern int close_fp(struct file *filp);
 
 static int nfs_notify_change(struct inode *, struct iattr *);
@@ -298,16+292,13 @@ int nfs_notify_change(struct inode *inode, struct iattr *attr)
 
 /* Every kernel module contains stuff like this. */
 
-char kernel_version[] = UTS_RELEASE;
-
 static struct file_system_type nfs_fs_type = {
        nfs_read_super, "nfs", 0, NULL
 };
 
 int init_module(void)
 {
-       register_filesystem(&nfs_fs_type);
-       return 0;
+       return register_filesystem(&nfs_fs_type);
 }
 
 void cleanup_module(void)
index eb7f0da..2781c76 100644 (file)
@@ -9,9+9,6 @@
  *     Copyright (C) 1993
  *
  */
-#ifdef MODULE
-#include <linux/module.h>
-#endif
 
 #include <linux/stat.h>
 #include <linux/sched.h>
index ec83c3b..ce59376 100644 (file)
 #define NFS_PROC_DEBUG
 #endif
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/param.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
index 0e80b77..ab4a966 100644 (file)
  *  Copyright (C) 1995, Olaf Kirch <okir@monad.swb.de>
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/types.h>
 #include <linux/malloc.h>
 #include <linux/sched.h>
 #include <linux/errno.h>
 #include <linux/socket.h>
 #include <linux/fcntl.h>
-#include <asm/segment.h>
 #include <linux/in.h>
 #include <linux/net.h>
 #include <linux/mm.h>
 #include <linux/rpcsock.h>
 
+#include <asm/segment.h>
+
 #define msleep(sec)    { current->timeout = sec * HZ / 1000; \
                          current->state = TASK_INTERRUPTIBLE; \
                          schedule(); \
index dcb82d9..39875bc 100644 (file)
  *
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/sched.h>
 #include <linux/nfs_fs.h>
 #include <linux/errno.h>
 #include <linux/socket.h>
 #include <linux/fcntl.h>
-#include <asm/segment.h>
 #include <linux/in.h>
 #include <linux/net.h>
 #include <linux/mm.h>
 #include <linux/rpcsock.h>
 
+#include <asm/segment.h>
+
 /* JEJB/JSP 2/7/94
  * this must match the value of NFS_SLACK_SPACE in linux/fs/nfs/proc.c 
  * ***FIXME*** should probably put this in nfs_fs.h */
index 13ce639..2c19020 100644 (file)
@@ -8,12+8,6 @@
  *  nfs symlink handling code
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-
 #include <linux/sched.h>
 #include <linux/errno.h>
 #include <linux/nfs_fs.h>
 #include <linux/malloc.h>
 #include <linux/string.h>
 
+#include <asm/segment.h>
+
 static int nfs_readlink(struct inode *, char *, int);
 static int nfs_follow_link(struct inode *, struct inode *, int, int,
                           struct inode **);
index 106e6a2..9ef88d7 100644 (file)
@@ -450,15+450,14 @@ static int get_stat(int pid, char * buffer)
                state = "RSDZTD"[tsk->state];
        vsize = eip = esp = 0;
        if (tsk->mm) {
+               struct vm_area_struct *vma = tsk->mm->mmap;
+               while (vma) {
+                       vsize += vma->vm_end - vma->vm_start;
+                       vma = vma->vm_next;
+               }
                if (tsk->kernel_stack_page) {
                        eip = KSTK_EIP(tsk);
                        esp = KSTK_ESP(tsk);
-                       vsize = (  (tsk->mm->end_code - tsk->mm->start_code)    /* text */
-                                + (tsk->mm->end_data - tsk->mm->start_data)    /* data */
-                                + (tsk->mm->brk - tsk->mm->start_brk));        /* bss + heap */
-                       if (esp) {
-                               vsize += tsk->mm->start_stack - esp;            /* stack */
-                       }
                }
        }
        wchan = get_wchan(tsk);
@@ -482,11+481,12 @@ static int get_stat(int pid, char * buffer)
        else
                tty_pgrp = -1;
 
-       /* scale priority and nice values from timeslices to 0..40 */
+       /* scale priority and nice values from timeslices to -20..20 */
        priority = tsk->counter;
-       priority = (priority * 10 + 5) / DEF_PRIORITY;
+       priority = (priority * 10 + DEF_PRIORITY / 2) / DEF_PRIORITY - 20;
        nice = tsk->priority;
-       nice = (nice * 20 + 10) / DEF_PRIORITY;
+       nice = (nice * 20 + DEF_PRIORITY / 2) / DEF_PRIORITY - 20;
+
        return sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \
 %lu %lu %lu %ld %ld %ld %ld %ld %ld %lu %lu %ld %lu %lu %lu %lu %lu %lu %lu %lu %lu \
 %lu %lu %lu %lu\n",
index 322024d..81b0285 100644 (file)
@@ -405,8+405,6 @@ int smb_current_malloced;
 
 #ifdef MODULE
 
-char kernel_version[] = UTS_RELEASE;
-
 /* looks ugly, taken from gcc-info */
 static void *shut_up_gcc = (&shut_up_gcc, kernel_version);
 
@@ -425,8+423,7 @@ init_module( void)
 #endif
 
         smb_init_dir_cache();
-        register_filesystem(&smb_fs_type);
-        return 0;
+        return register_filesystem(&smb_fs_type);
 }
 
 void
index 87430f7..c7c0253 100644 (file)
 
 #define _S(nr) (1<<((nr)-1))
 
+static int _recvfrom(struct socket *sock, unsigned char *ubuf, int size, int noblock, unsigned flags,
+                struct sockaddr_in *sa, int *addr_len)
+{
+        struct iovec iov;
+        struct msghdr msg;
+
+        iov.iov_base = ubuf;
+        iov.iov_len  = size;
+
+        msg.msg_name      = (void *)sa;
+        msg.msg_namelen   = 0;
+        if (addr_len)
+                msg.msg_namelen = *addr_len;
+        msg.msg_accrights = NULL;
+        msg.msg_iov       = &iov;
+        msg.msg_iovlen    = 1;
+
+        return sock->ops->recvmsg(sock, &msg, size, noblock, flags, addr_len);
+}
+
+static int _send(struct socket *sock, const void *buff, int len, int nonblock, unsigned flags) {
+        struct iovec iov;
+        struct msghdr msg;
+
+        iov.iov_base = (void *)buff;
+        iov.iov_len  = len;
+
+        msg.msg_name      = NULL;
+        msg.msg_namelen   = 0;
+        msg.msg_accrights = NULL;
+        msg.msg_iov       = &iov;
+        msg.msg_iovlen    = 1;
+
+        return sock->ops->sendmsg(sock, &msg, len, nonblock, flags);
+}
+
 static void
 smb_data_callback(struct sock *sk,int len)
 {
@@ -40,13+76,13 @@ smb_data_callback(struct sock *sk,int len)
                 fs = get_fs();
                 set_fs(get_ds());
 
-               result = sock->ops->recvfrom(sock, (void *)peek_buf, 1, 1,
+               result = _recvfrom(sock, (void *)peek_buf, 1, 1,
                                              MSG_PEEK, NULL, NULL);
 
                 while ((result != -EAGAIN) && (peek_buf[0] == 0x85)) {
 
                         /* got SESSION KEEP ALIVE */
-                        result = sock->ops->recvfrom(sock, (void *)peek_buf,
+                        result = _recvfrom(sock, (void *)peek_buf,
                                                      4, 1, 0, NULL, NULL);
 
                         DDPRINTK("smb_data_callback:"
@@ -55,7+91,7 @@ smb_data_callback(struct sock *sk,int len)
                         if (result == -EAGAIN)
                                 break;
 
-                        result = sock->ops->recvfrom(sock, (void *)peek_buf,
+                        result = _recvfrom(sock, (void *)peek_buf,
                                                      1, 1, MSG_PEEK,
                                                      NULL, NULL);
 
@@ -190,7+226,7 @@ smb_receive_raw(struct socket *sock, unsigned char *target,
 
        fs = get_fs();
        set_fs(get_ds());
-        result = sock->ops->recvfrom(sock, (void *)peek_buf, 4, 0,
+        result = _recvfrom(sock, (void *)peek_buf, 4, 0,
                                      0, NULL, NULL);
         set_fs(fs);
 
@@ -236,8+272,7 @@ smb_receive_raw(struct socket *sock, unsigned char *target,
 
         while (already_read < len) {
                 
-                result = sock->ops->
-                        recvfrom(sock,
+                result = _recvfrom(sock,
                                  (void *)(target+already_read),
                                  len - already_read, 0, 0,
                                  NULL, NULL);
@@ -488,7+523,7 @@ smb_request(struct smb_server *server)
        fs = get_fs();
        set_fs(get_ds());
 
-        result = sock->ops->send(sock, (void *)buffer, len, 0, 0);
+        result = _send(sock, (void *)buffer, len, 0, 0);
         if (result < 0) {
                 printk("smb_request: send error = %d\n", result);
         }
@@ -556,7+591,7 @@ smb_trans2_request(struct smb_server *server,
 
         DDPRINTK("smb_request: len = %d cmd = 0x%X\n", len, buffer[8]);
 
-        result = sock->ops->send(sock, (void *)buffer, len, 0, 0);
+        result = _send(sock, (void *)buffer, len, 0, 0);
         if (result < 0) {
                 printk("smb_trans2_request: send error = %d\n", result);
         }
@@ -627,7+662,7 @@ smb_request_read_raw(struct smb_server *server,
         DPRINTK("smb_request_read_raw: buffer=%X, sock=%X\n",
                 (unsigned int)buffer, (unsigned int)sock);
 
-        result = sock->ops->send(sock, (void *)buffer, len, 0, 0);
+        result = _send(sock, (void *)buffer, len, 0, 0);
 
         DPRINTK("smb_request_read_raw: send returned %d\n", result);
 
@@ -695,11+730,11 @@ smb_request_write_raw(struct smb_server *server,
 
         smb_encode_smb_length(nb_header, length);
 
-        result = sock->ops->send(sock, (void *)nb_header, 4, 0, 0);
+        result = _send(sock, (void *)nb_header, 4, 0, 0);
 
         if (result == 4) {
                 set_fs(fs);     /* source is in user-land */
-                result = sock->ops->send(sock, (void *)source, length, 0, 0);
+                result = _send(sock, (void *)source, length, 0, 0);
                 set_fs(get_ds());
         } else {
                 result = -EIO;
index eddbb0b..f0fb850 100644 (file)
  *  This file contains code for allocating/freeing blocks.
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/sysv_fs.h>
index 2af026b..952efd6 100644 (file)
  *  SystemV/Coherent directory handling functions
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-
 #include <linux/errno.h>
 #include <linux/fs.h>
 #include <linux/sysv_fs.h>
 #include <linux/stat.h>
 #include <linux/string.h>
 
+#include <asm/segment.h>
+
 static int sysv_dir_read(struct inode * inode, struct file * filp, char * buf, int count)
 {
        return -EISDIR;
index 68daa89..0ed50a1 100644 (file)
  *  SystemV/Coherent regular file handling primitives
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-
 #include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/sysv_fs.h>
 #include <linux/string.h>
 #include <linux/locks.h>
 
+#include <asm/segment.h>
+
 #define        NBUF    32
 
 #define MIN(a,b) (((a)<(b))?(a):(b))
index af1218f..9e10507 100644 (file)
  *  SystemV/Coherent fsync primitive
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/errno.h>
 #include <linux/stat.h>
 
index dcbd3af..85ba640 100644 (file)
  *  This file contains code for allocating/freeing inodes.
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/fs.h>
index e26e0db..c33a96c 100644 (file)
  *  the superblock.
  */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
 
 #include <linux/sched.h>
 #include <linux/kernel.h>
@@ -979,8+973,6 @@ int sysv_sync_inode(struct inode * inode)
 
 /* Every kernel module contains stuff like this. */
 
-char kernel_version[] = UTS_RELEASE;
-
 static struct file_system_type sysv_fs_type[3] = {
        {sysv_read_super, "xenix", 1, NULL},
        {sysv_read_super, "sysv", 1, NULL},
@@ -990,10+982,12 @@ static struct file_system_type sysv_fs_type[3] = {
 int init_module(void)
 {
        int i;
+       int ouch;
 
-       for (i = 0; i < 3; i++)
-               register_filesystem(&sysv_fs_type[i]);
-
+       for (i = 0; i < 3; i++) {
+               if ((ouch = register_filesystem(&sysv_fs_type[i])) != 0)
+                       return ouch;
+       }
        return 0;
 }
 
@@ -1002,6+996,7 @@ void cleanup_module(void)
        int i;
 
        for (i = 0; i < 3; i++)
+               /* No error message if this breaks... that's OK... */
                unregister_filesystem(&sysv_fs_type[i]);
 }
 
index e7c3fd1..13951f6 100644 (file)
  *  Copyright (C) 1993  Bruno Haible
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/fs.h>
index 5bb2ae6..575c0b6 100644 (file)
  *  SystemV/Coherent symlink handling code
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/sysv_fs.h>
 #include <linux/stat.h>
 
+#include <asm/segment.h>
+
 static int sysv_readlink(struct inode *, char *, int);
 static int sysv_follow_link(struct inode *, struct inode *, int, int, struct inode **);
 
index 6de370e..21451e6 100644 (file)
  *  Copyright (C) 1993  Bruno Haible
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/sched.h>
 #include <linux/fs.h>
 #include <linux/sysv_fs.h>
index 7fb060c..74d862c 100644 (file)
@@ -1,8+1,8 @@
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/system.h>
+/*
+ * linux/fs/umsdos/check.c
+ *
+ *
+ */
 
 #include <linux/signal.h>
 #include <linux/sched.h>
 #include <linux/ptrace.h>
 #include <linux/mman.h>
 
+#include <asm/system.h>
+
 extern unsigned long high_memory;
 
 static int check_one_table(struct pde * page_dir)
index 69bff1b..cf0f576 100644 (file)
@@ -7,12+7,6 @@
  *  Extended MS-DOS directory handling functions
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-
 #include <linux/sched.h>
 #include <linux/string.h>
 #include <linux/fs.h>
 #include <linux/umsdos_fs.h>
 #include <linux/malloc.h>
 
+#include <asm/segment.h>
+
 #define PRINTK(x)
 #define Printk(x) printk x
 
index 3fea3c3..dc62e2a 100644 (file)
  *
  *  Extended MS-DOS directory handling functions
  */
-#ifdef MODULE
-#include <linux/module.h>
-#endif
 
 #include <linux/types.h>
 #include <linux/fcntl.h>
 #include <linux/kernel.h>
-#include <asm/segment.h>
 #include <linux/sched.h>
 #include <linux/errno.h>
 #include <linux/string.h>
 #include <linux/msdos_fs.h>
 #include <linux/umsdos_fs.h>
 
+#include <asm/segment.h>
+
 #define PRINTK(x)
 #define Printk(x) printk x
 
index 1e349d1..6ae2fb9 100644 (file)
@@ -7,13+7,6 @@
  *  Extended MS-DOS regular file handling primitives
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-#include <asm/system.h>
-
 #include <linux/sched.h>
 #include <linux/fs.h>
 #include <linux/msdos_fs.h>
 #include <linux/msdos_fs.h>
 #include <linux/umsdos_fs.h>
 
+#include <asm/segment.h>
+#include <asm/system.h>
 
 #define PRINTK(x)
 #define Printk(x)      printk x
index 22be740..893a7ef 100644 (file)
@@ -6,13+6,7 @@
  *
  */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
 
 #include <linux/fs.h>
 #include <linux/msdos_fs.h>
@@ -501,16+495,13 @@ struct super_block *UMSDOS_read_super(
 
 #ifdef MODULE
 
-char kernel_version[] = UTS_RELEASE;
-
 static struct file_system_type umsdos_fs_type = {
        UMSDOS_read_super, "umsdos", 1, NULL
 };
 
 int init_module(void)
 {
-       register_filesystem(&umsdos_fs_type);
-       return 0;
+       return register_filesystem(&umsdos_fs_type);
 }
 
 void cleanup_module(void)
index e71090d..bb32d63 100644 (file)
@@ -5,9+5,6 @@
  *
  *  Extended MS-DOS ioctl directory handling functions
  */
-#ifdef MODULE
-#include <linux/module.h>
-#endif
 
 #include <asm/segment.h>
 #include <linux/errno.h>
index 54f1618..5135c41 100644 (file)
@@ -5,10+5,7 @@
  *
  * Control the mangling of file name to fit msdos name space.
  * Many optimisation by GLU == dglaude@is1.vub.ac.be (GLAUDE DAVID)
-*/
-#ifdef MODULE
-#include <linux/module.h>
-#endif
+ */
 
 #include <linux/errno.h>
 #include <linux/ctype.h>
index 1b1c893..fcda9ab 100644 (file)
@@ -5,10+5,7 @@
  *     Inspired from linux/fs/msdos/... by Werner Almesberger
  *
  * Maintain and access the --linux alternate directory file.
-*/
-#ifdef MODULE
-#include <linux/module.h>
-#endif
+ */
 
 #include <linux/errno.h>
 #include <linux/kernel.h>
index 351defc..34cdba7 100644 (file)
@@ -7,12+7,6 @@
  *  (For directory without EMD file).
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-
 #include <linux/sched.h>
 #include <linux/fs.h>
 #include <linux/msdos_fs.h>
 #include <linux/umsdos_fs.h>
 #include <linux/malloc.h>
 
+#include <asm/segment.h>
+
 #define PRINTK(x)
 #define Printk(x) printk x
 
index 6ab27c5..97d94ec 100644 (file)
@@ -6,12+6,6 @@
  *
  *  Extended MS-DOS regular file handling primitives
  */
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-#include <asm/system.h>
 
 #include <linux/sched.h>
 #include <linux/fs.h>
 #include <linux/umsdos_fs.h>
 #include <linux/malloc.h>
 
+#include <asm/segment.h>
+#include <asm/system.h>
+
 #define PRINTK(x)
 #define Printk(x)      printk x
+
 /*
        Read the data associate with the symlink.
        Return length read in buffer or  a negative error code.
index 38a66d3..a28321a 100644 (file)
 
 /* bitmap.c contains the code that handles the inode and block bitmaps */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/sched.h>
 #include <linux/locks.h>
 #include <linux/xia_fs.h>
index 5a88c2f..9773a56 100644 (file)
@@ -9,11+9,6 @@
  *  This software may be redistributed per Linux Copyright.
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
 #include <linux/sched.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/xia_fs.h>
 #include <linux/stat.h>
 
+#include <asm/segment.h>
+
 #include "xiafs_mac.h"
 
 static int xiafs_dir_read(struct inode *, struct file *, char *, int);
index 3f8801a..5f72bf5 100644 (file)
@@ -9,13+9,6 @@
  *  This software may be redistributed per Linux Copyright.
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-#include <asm/system.h>
-
 #include <linux/sched.h>
 #include <linux/fs.h>
 #include <linux/xia_fs.h>
 #include <linux/stat.h>
 #include <linux/locks.h>
 
+#include <asm/segment.h>
+#include <asm/system.h>
+
 #include "xiafs_mac.h"
 
 #define        NBUF    32
index 5bd0a70..cb50281 100644 (file)
@@ -8,13+8,6 @@
  *  xiafs fsync primitive
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-#include <asm/system.h>
-
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/stat.h>
 #include <linux/fs.h>
 #include <linux/xia_fs.h>
 
+#include <asm/segment.h>
+#include <asm/system.h>
+
 #include "xiafs_mac.h"
 
 
index a691413..2ec8234 100644 (file)
@@ -9,13+9,7 @@
  *  This software may be redistributed per Linux Copyright.
  */
 
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
 
 #include <linux/sched.h>
 #include <linux/xia_fs.h>
@@ -521,16+515,13 @@ int xiafs_sync_inode (struct inode *inode)
 
 /* Every kernel module contains stuff like this. */
 
-char kernel_version[] = UTS_RELEASE;
-
 static struct file_system_type xiafs_fs_type = {
        xiafs_read_super, "xiafs", 1, NULL
 };
 
 int init_module(void)
 {
-       register_filesystem(&xiafs_fs_type);
-       return 0;
+       return register_filesystem(&xiafs_fs_type);
 }
 
 void cleanup_module(void)
index 0d66a3e..489b305 100644 (file)
@@ -9,10+9,6 @@
  *  This software may be redistributed per Linux Copyright.
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/sched.h>
 #include <linux/xia_fs.h>
 #include <linux/kernel.h>
 #include <linux/stat.h>
 #include <linux/fcntl.h>
 #include <linux/errno.h>
+
 #include <asm/segment.h>
 
 #include "xiafs_mac.h"
index 9f4d4e9..d273256 100644 (file)
  *  This software may be redistributed per Linux Copyright.
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
-#include <asm/segment.h>
-
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/fs.h>
 #include <linux/xia_fs.h>
 #include <linux/stat.h>
 
+#include <asm/segment.h>
+
 static int 
 xiafs_readlink(struct inode *, char *, int);
 
index 2e8dec1..bdb9d39 100644 (file)
@@ -9,10+9,6 @@
  *  This software may be redistributed per Linux Copyright.
  */
 
-#ifdef MODULE
-#include <linux/module.h>
-#endif
-
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/xia_fs.h>
index cf75a2c..f1965d5 100644 (file)
@@ -32,7+32,7 @@ struct aouthdr
        __u64 text_start;       /* with a few additions that actually make sense */
        __u64 data_start;
        __u64 bss_start;
-       __u32 gprmask, fprmask; /* but what are these? */
+       __u32 gprmask, fprmask; /* bitmask of general & floating point regs used in binary */
        __u64 gpvalue;
 };
 
index 0642870..a2e50f2 100644 (file)
@@ -34,13+34,8 @@ __inline__ void virtual_dma_init(void)
        /* Nothing to do on an Alpha */
 }
 
-#ifdef MODULE
-int FDC1 = 0x3f0;
-int FDC2 = -1;
-#else
-#define FDC1 0x3f0
+static int FDC1 = 0x3f0;
 static int FDC2 = -1;
-#endif
 
 /*
  * Again, the CMOS information doesn't work on the alpha..
index 464e82d..1039332 100644 (file)
@@ -156,19+156,23 @@ extern void               _writew(unsigned short b, unsigned long addr);
 /*
  * String version of IO memory access ops:
  */
-extern void memcpy_fromio(void *, unsigned long, unsigned long);
-extern void memcpy_toio(unsigned long, void *, unsigned long);
-extern void memset_io(unsigned long, int, unsigned long);
+extern void _memcpy_fromio(void *, unsigned long, unsigned long);
+extern void _memcpy_toio(unsigned long, void *, unsigned long);
+extern void _memset_io(unsigned long, int, unsigned long);
+
+#define memcpy_fromio(to,from,len)     _memcpy_fromio((to),(unsigned long)(from),(len))
+#define memcpy_toio(to,from,len)       _memcpy_toio((unsigned long)(to),(from),(len))
+#define memset_io(addr,c,len)          _memset_io((unsigned long)(addr),(c),(len))
 
 /*
  * String versions of in/out ops:
  */
-extern void insb (unsigned long port, void *src, unsigned long count);
-extern void insw (unsigned long port, void *src, unsigned long count);
-extern void insl (unsigned long port, void *src, unsigned long count);
-extern void outsb (unsigned long port, void *dst, unsigned long count);
-extern void outsw (unsigned long port, void *dst, unsigned long count);
-extern void outsl (unsigned long port, void *dst, unsigned long count);
+extern void insb (unsigned long port, void *dst, unsigned long count);
+extern void insw (unsigned long port, void *dst, unsigned long count);
+extern void insl (unsigned long port, void *dst, unsigned long count);
+extern void outsb (unsigned long port, const void *src, unsigned long count);
+extern void outsw (unsigned long port, const void *src, unsigned long count);
+extern void outsl (unsigned long port, const void *src, unsigned long count);
 
 /*
  * XXX - We don't have csum_partial_copy_fromio() yet, so we cheat here and 
index daf5c40..667353b 100644 (file)
 
 #define RLIM_NLIMITS   9
 
-#endif
+#ifdef __KERNEL__
+
+#define INIT_RLIMITS                                                   \
+{                                                                      \
+    {LONG_MAX, LONG_MAX},                      /* RLIMIT_CPU */        \
+    {LONG_MAX, LONG_MAX},                      /* RLIMIT_FSIZE */      \
+    {LONG_MAX, LONG_MAX},                      /* RLIMIT_DATA */       \
+    {_STK_LIM, _STK_LIM},                      /* RLIMIT_STACK */      \
+    {       0, LONG_MAX},                      /* RLIMIT_CORE */       \
+    {LONG_MAX, LONG_MAX},                      /* RLIMIT_RSS */        \
+    { NR_OPEN,  NR_OPEN},                      /* RLIMIT_NOFILE */     \
+    {LONG_MAX, LONG_MAX},                      /* RLIMIT_AS */         \
+    {MAX_TASKS_PER_USER, MAX_TASKS_PER_USER},  /* RLIMIT_NPROC */      \
+}
+
+#endif /* __KERNEL__ */
+
+#endif /* _ALPHA_RESOURCE_H */
index fa27183..ef8d43d 100644 (file)
@@ -1,6+1,8 @@
 #ifndef __ALPHA_STRING_H__
 #define __ALPHA_STRING_H__
 
+#ifdef __KERNEL__
+
 extern void * __constant_c_memset(void *, unsigned long, long);
 extern void * __memset(void *, char, size_t);
 
@@ -27,4+29,6 @@ extern void * __memcpy(void *, const void *, size_t);
 
 #define __HAVE_ARCH_STRLEN
 
+#endif /* __KERNEL__ */
+
 #endif /* __ALPHA_STRING_H__ */
index 97cce45..6606c81 100644 (file)
@@ -100,37+100,37 @@ __old_ipl; })
 /*
  * Give prototypes to shut up gcc.
  */
-extern inline unsigned long xchg_u32 (volatile int * m, unsigned long val);
-extern inline unsigned long xchg_u64 (volatile long * m, unsigned long val);
+extern inline unsigned long xchg_u32 (volatile int * m, unsigned long new_val);
+extern inline unsigned long xchg_u64 (volatile long * m, unsigned long new_val);
 
-extern inline unsigned long xchg_u32(volatile int * m, unsigned long val)
+extern inline unsigned long xchg_u32(volatile int * m, unsigned long new_val)
 {
-       unsigned long dummy, dummy2;
-
-       __asm__ __volatile__(
-               "\n1:\t"
-               "ldl_l %0,%1\n\t"
-               "bis %2,%2,%3\n\t"
-               "stl_c %3,%1\n\t"
-               "beq %3,1b\n"
-               : "=r" (val), "=m" (*m), "=r" (dummy), "=r" (dummy2)
-               : "1" (*m), "2" (val));
-       return val;
+       unsigned long old_val;
+
+       __asm__ __volatile__("\n1:\t"
+                            "ldl_l %0,%2\n\t"
+                            "bis %3,%3,$25\n\t"
+                            "stl_c $25,%1\n\t"
+                            "beq $25,1b\n"
+                            : "=r"(old_val), "=m"(*m)
+                            : "m"(*m), "r"(new_val)
+                            : "$25");
+       return old_val;
 }
 
-extern inline unsigned long xchg_u64(volatile long * m, unsigned long val)
+extern inline unsigned long xchg_u64(volatile long * m, unsigned long new_val)
 {
-       unsigned long dummy, dummy2;
-
-       __asm__ __volatile__(
-               "\n1:\t"
-               "ldq_l %0,%1\n\t"
-               "bis %2,%2,%3\n\t"
-               "stq_c %3,%1\n\t"
-               "beq %3,1b\n"
-               : "=r" (val), "=m" (*m), "=r" (dummy), "=r" (dummy2)
-               : "1" (*m), "2" (val));
-       return val;
+       unsigned long old_val;
+
+       __asm__ __volatile__("\n1:\t"
+                            "ldq_l %0,%2\n\t"
+                            "bis %3,%3,$25\n\t"
+                            "stq_c $25,%1\n\t"
+                            "beq $25,1b\n"
+                            : "=r"(old_val), "=m"(*m)
+                            : "m"(*m), "r"(new_val)
+                            : "$25");
+       return old_val;
 }
 
 #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
index 059e827..46d23eb 100644 (file)
  */
 struct __dummy { unsigned long a[100]; };
 #define ADDR (*(struct __dummy *) addr)
+#define CONST_ADDR (*(const struct __dummy *) addr)
 
 extern __inline__ int set_bit(int nr, void * addr)
 {
@@ -68,7+69,7 @@ extern __inline__ int test_bit(int nr, const void * addr)
 
        __asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0"
                :"=r" (oldbit)
-               :"m" (ADDR),"ir" (nr));
+               :"m" (CONST_ADDR),"ir" (nr));
        return oldbit;
 }
 
index 844bbce..93c58fe 100644 (file)
@@ -34,13+34,8 @@ __inline__ void virtual_dma_init(void)
        /* Nothing to do on an i386 */
 }
 
-#ifdef MODULE
-int FDC1 = 0x3f0;
-int FDC2 = -1;
-#else
-#define FDC1 0x3f0
+static int FDC1 = 0x3f0;
 static int FDC2 = -1;
-#endif
 
 #define FLOPPY0_TYPE   ((CMOS_READ(0x10) >> 4) & 15)
 #define FLOPPY1_TYPE   (CMOS_READ(0x10) & 15)
index f5fa979..0b17fe5 100644 (file)
 
 #define RLIM_NLIMITS   8
 
+#ifdef __KERNEL__
+
+#define INIT_RLIMITS                                                   \
+{                                                                      \
+    {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX},                                \
+    {LONG_MAX, LONG_MAX}, {_STK_LIM, _STK_LIM},                                \
+    {       0, LONG_MAX}, {LONG_MAX, LONG_MAX},                                \
+    {MAX_TASKS_PER_USER, MAX_TASKS_PER_USER}, {NR_OPEN, NR_OPEN}       \
+}
+
+#endif /* __KERNEL__ */
+
 #endif
index 550eec3..911276c 100644 (file)
 #define FLOPPY0_TYPE 4         /* this is wrong for the Olli M700, but who cares... */
 #define FLOPPY1_TYPE 0
 
-#ifdef MODULE
-#define FDC1                   ((boot_info.machtype == MACH_ACER_PICA_61 || \
-                               boot_info.machtype == MACH_MIPS_MAGNUM_4000 || \
-                               boot_info.machtype == MACH_OLIVETTI_M700) ? \
-                               0xe0003000 : 0x3f0)
-int FDC2=-1;
-#else
 #define FDC1                   ((boot_info.machtype == MACH_ACER_PICA_61 || \
                                boot_info.machtype == MACH_MIPS_MAGNUM_4000 || \
                                boot_info.machtype == MACH_OLIVETTI_M700) ? \
                                0xe0003000 : 0x3f0)
 static int FDC2=-1;
-#endif /* MODULE */
 
 #define N_FDC 1                        /* do you *really* want a second controller? */
 #define N_DRIVE 8
index f4e7590..a5d9ccb 100644 (file)
  *      --------------------   --------------------   --------------------
  *  0 - unnamed                unnamed                minor 0 = true nodev
  *  1 - /dev/mem               ramdisk
- *  2 -                        floppy
- *  3 -                        ide0 or hd
+ *  2 - /dev/ptyp*             floppy
+ *  3 - /dev/ttyp*             ide0 or hd
  *  4 - /dev/tty*
  *  5 - /dev/tty; /dev/cua*
  *  6 - lp
 #define UNNAMED_MAJOR  0
 #define MEM_MAJOR      1
 #define FLOPPY_MAJOR   2
+#define PTY_MASTER_MAJOR 2
 #define IDE0_MAJOR     3
+#define PTY_SLAVE_MAJOR 3
 #define HD_MAJOR       IDE0_MAJOR
 #define TTY_MAJOR      4
 #define TTYAUX_MAJOR   5
index 0efcc47..a9a9f0b 100644 (file)
@@ -179,12+179,11 @@ extern void free_page_tables(struct task_struct * tsk);
 extern void clear_page_tables(struct task_struct * tsk);
 extern int new_page_tables(struct task_struct * tsk);
 extern int copy_page_tables(struct task_struct * to);
-extern int clone_page_tables(struct task_struct * to);
-extern int unmap_page_range(unsigned long from, unsigned long size);
+
+extern int zap_page_range(struct mm_struct *mm, unsigned long address, unsigned long size);
+extern int copy_page_range(struct mm_struct *dst, struct mm_struct *src, struct vm_area_struct *vma);
 extern int remap_page_range(unsigned long from, unsigned long to, unsigned long size, pgprot_t prot);
 extern int zeromap_page_range(unsigned long from, unsigned long size, pgprot_t prot);
-extern int copy_page_range(struct mm_struct *dst, struct mm_struct *src, struct vm_area_struct *vma);
-extern int zap_page_range(struct mm_struct *mm, unsigned long address, unsigned long size);
 
 extern void vmtruncate(struct inode * inode, unsigned long offset);
 extern void handle_mm_fault(struct vm_area_struct *vma, unsigned long address, int write_access);
index 9c0487f..54a9a3a 100644 (file)
 #ifndef _LINUX_MODULE_H
 #define _LINUX_MODULE_H
 
-#ifdef MODVERSIONS
-# ifndef __GENKSYMS__
+#ifdef __GENKSYMS__
+#  define _set_ver(sym,vers) sym
+#  define MODVERSIONS
+#else /* ! __GENKSYMS__ */
+# ifdef MODVERSIONS
+#  undef CONFIG_MODVERSIONS /* the *.ver files need this... */
+#  define CONFIG_MODVERSIONS /* the *.ver files need this... */
 #  ifdef MODULE
 #   define _set_ver(sym,vers) sym ## _R ## vers
 #   include <linux/modversions.h>
-#  else /* MODULE */
+#  else /* !MODULE */
 #   ifdef EXPORT_SYMTAB
 #    define _set_ver(sym,vers) sym
 #    include <linux/modversions.h>
 #   endif /* EXPORT_SYMTAB */
 #  endif /* MODULE */
-# else /* __GENKSYMS__ */
-#  define _set_ver(sym,vers) sym
-# endif /* __GENKSYMS__ */
-#endif /* MODVERSIONS */
+#  undef CONFIG_MODVERSIONS /* the *.ver files needed this... */
+# endif /* MODVERSIONS */
+#endif /* __GENKSYMS__ */
 
 /* values of module.state */
 #define MOD_UNINITIALIZED 0
index 9dfde32..83c3f19 100644 (file)
 #define RNDGETENTCNT   0x01080000
 #define RNDADDTOENTCNT 0x01080001
 #define RNDGETPOOL     0x01080002
+#define RNDADDENTROPY  0x01080003
+#define RNDZAPENTCNT   0x01080004
 
-struct rand_pool_state {
+struct rand_pool_info {
        int     entropy_count;
-       int     pool_size;
-       __u32   pool[0];
+       int     buf_size;
+       __u32   buf[0];
 };
 
 /* Exported functions */
@@ -33,14+35,8 @@ void add_interrupt_randomness(int irq);
 void add_blkdev_randomness(int major);
 
 void get_random_bytes(void *buf, int nbytes);
-int read_random(struct inode * inode, struct file * file,
-               char * buf, int nbytes);
-int read_random_unlimited(struct inode * inode, struct file * file,
-                         char * buf, int nbytes);
-int write_random(struct inode * inode, struct file * file,
-                const char * buffer, int count);
-int random_ioctl(struct inode * inode, struct file * file,
-                unsigned int cmd, unsigned long arg);
+
+struct file_operations random_fops, urandom_fops;
 
 #endif /* __KERNEL___ */
 
index de32181..2573a31 100644 (file)
@@ -267,10+267,7 @@ struct task_struct {
 /* utime */    0,0,0,0,0, \
 /* flt */      0,0,0,0,0,0, \
 /* swp */      0,0,0,0,0, \
-/* rlimits */   { {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX},  \
-                 {LONG_MAX, LONG_MAX}, {_STK_LIM, _STK_LIM},  \
-                 {       0, LONG_MAX}, {LONG_MAX, LONG_MAX}, \
-                 {MAX_TASKS_PER_USER, MAX_TASKS_PER_USER}, {NR_OPEN, NR_OPEN}}, \
+/* rlimits */   INIT_RLIMITS, \
 /* math */     0, \
 /* comm */     "swapper", \
 /* fs info */  0,NULL, \
index d73b388..4d069b9 100644 (file)
@@ -1,7+1,6 @@
-#include <linux/config.h>
 #include <linux/linkage.h>
 
-#ifdef CONFIG_MODVERSIONS
+#ifdef MODVERSIONS
 # undef _set_ver
 # undef X
 
 #  endif /* !MODULE */
 #  define X(a) a
 # endif /* !__GENKSYMS__ */
-#else /* !CONFIG_MODVERSIONS */
+#else /* !MODVERSIONS */
 # define X(sym) { (void *) & sym, SYMBOL_NAME_STR(sym)}
-#endif /* !CONFIG_MODVERSIONS */
+#endif /* MODVERSIONS */
 
 #define EMPTY {0,0}
        0, 0, 0, {
index 7e40584..91b92e2 100644 (file)
@@ -1,4+1,4 @@
-#ifdef MODVERSIONS /* MODVERSIONS */
+#ifdef MODVERSIONS
 #undef _set_ver
 #if defined(MODULE) && !defined(__GENKSYMS__)
 #define _set_ver(sym,vers) sym ## _R ## vers
index cbd6a0e..4b8ceee 100644 (file)
 #define MAX_NR_USER_CONSOLES 63        /* must be root to allocate above this */
                /* Note: the ioctl VT_GETSTATE does not work for
                   consoles 16 and higher (since it returns a short) */
-#define NR_PTYS                64
+#define NR_PTYS                256
 #define NR_LDISCS      16
 
 /*
index 5e613d7..5964051 100644 (file)
@@ -172,7+172,7 @@ struct sock
  */
  
        volatile unsigned short backoff;
-       volatile short          err;
+       volatile int            err;
        unsigned char           protocol;
        volatile unsigned char  state;
        volatile unsigned char  ack_backlog;
index d9d7bd4..c360f3d 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -360,9+360,9 @@ asmlinkage int sys_shmctl (int shmid, int cmd, struct shmid_ds *buf)
  */
 
 static struct vm_operations_struct shm_vm_ops = {
-       shm_open,               /* open */
-       shm_close,              /* close */
-       NULL,                   /* unmap */
+       shm_open,               /* open - callback for a new vm-area open */
+       shm_close,              /* close - callback for when the vm-area is released */
+       NULL,                   /* no need to sync pages at unmap */
        NULL,                   /* protect */
        NULL,                   /* sync */
        NULL,                   /* advise */
@@ -570,8+570,6 @@ static void shm_close (struct vm_area_struct *shmd)
        struct shmid_ds *shp;
        int id;
 
-       unmap_page_range (shmd->vm_start, shmd->vm_end - shmd->vm_start);
-
        /* remove from the list of attaches of the shm segment */
        id = SWP_OFFSET(shmd->vm_pte) & SHM_ID_MASK;
        shp = shm_segs[id];
index 3b08522..18e6efc 100644 (file)
@@ -14,19+14,9 @@ O_TARGET := kernel.o
 O_OBJS    = sched.o dma.o fork.o exec_domain.o panic.o printk.o sys.o \
        module.o exit.o signal.o itimer.o info.o time.o softirq.o \
        resource.o
-
-SYMTAB_OBJS = ksyms.o
-O_OBJS     += $(SYMTAB_OBJS)
-
-ifdef CONFIG_MODVERSIONS
-$(O_TARGET): $(SYMTAB_OBJS:.o=.ver)
-dep: $(SYMTAB_OBJS:.o=.ver)
-fastdep: $(SYMTAB_OBJS:.o=.ver)
-endif
+OX_OBJS = ksyms.o
 
 include $(TOPDIR)/Rules.make
 
-include ../versions.mk
-
 sched.o: sched.c
        $(CC) $(CFLAGS) $(PROFILING) -fno-omit-frame-pointer -c $<
index db13988..b7ee31b 100644 (file)
@@ -9,8+9,8 @@
  * by Bjorn Ekwall <bj0rn@blox.se>
  */
 
-#include <linux/autoconf.h>
 #include <linux/module.h>
+#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/blkdev.h>
 #include <linux/locks.h>
 #include <linux/string.h>
 #include <linux/delay.h>
-#include <linux/config.h>
 #include <linux/sem.h>
 #include <linux/minix_fs.h>
 #include <linux/ext2_fs.h>
@@ -191,8+190,6 @@ struct symbol_table symbol_table = {
        X(verify_area),
        X(do_mmap),
        X(do_munmap),
-       X(zeromap_page_range),
-       X(unmap_page_range),
        X(insert_vm_struct),
        X(merge_segments),
 
index 9a47259..0d0766e 100644 (file)
@@ -118,60+118,30 @@ static inline void free_one_pgd(pgd_t * dir)
        pmd_free(pmd);
 }
        
-int new_page_tables(struct task_struct * tsk)
-{
-       pgd_t * page_dir, * new_pg;
-       int i;
-
-       if (!(new_pg = pgd_alloc()))
-               return -ENOMEM;
-       page_dir = pgd_offset(&init_mm, 0);
-       for (i = USER_PTRS_PER_PGD ; i < PTRS_PER_PGD ; i++)
-               new_pg[i] = page_dir[i];
-       SET_PAGE_DIR(tsk, new_pg);
-       tsk->mm->pgd = new_pg;
-       return 0;
-}
-
 /*
  * This function clears all user-level page tables of a process - this
- * is needed by execve(), so that old pages aren't in the way. Note that
- * unlike 'free_page_tables()', this function still leaves a valid
- * page-table-tree in memory: it just removes the user pages. The two
- * functions are similar, but there is a fundamental difference.
+ * is needed by execve(), so that old pages aren't in the way.
  */
 void clear_page_tables(struct task_struct * tsk)
 {
        int i;
        pgd_t * page_dir;
 
-       if (!tsk)
-               return;
-       if (tsk == task[0])
-               panic("task[0] (swapper) doesn't support exec()\n");
-       page_dir = pgd_offset(tsk->mm, 0);
-       if (!page_dir) {
-               printk("%s trying to clear NULL page-directory: not good\n", tsk->comm);
-               return;
-       }
-       if (pgd_inuse(page_dir)) {
-               if (new_page_tables(tsk))
-                       oom(tsk);
-               pgd_free(page_dir);
-               return;
-       }
-       if (page_dir == swapper_pg_dir) {
+       page_dir = tsk->mm->pgd;
+       if (!page_dir || page_dir == swapper_pg_dir) {
                printk("%s trying to clear kernel page-directory: not good\n", tsk->comm);
                return;
        }
        for (i = 0 ; i < USER_PTRS_PER_PGD ; i++)
                free_one_pgd(page_dir + i);
        invalidate();
-       return;
 }
 
 /*
- * This function frees up all page tables of a process when it exits.
+ * This function frees up all page tables of a process when it exits. It
+ * is the same as "clear_page_tables()", except it also changes the process'
+ * page table directory to the kernel page tables and then frees the old
+ * page table directory.
  */
 void free_page_tables(struct task_struct * tsk)
 {
@@ -184,10+154,6 @@ void free_page_tables(struct task_struct * tsk)
                return;
        }
        SET_PAGE_DIR(tsk, swapper_pg_dir);
-       if (pgd_inuse(page_dir)) {
-               pgd_free(page_dir);
-               return;
-       }
        tsk->mm->pgd = swapper_pg_dir;  /* or else... */
        for (i = 0 ; i < PTRS_PER_PGD ; i++)
                free_one_pgd(page_dir + i);
@@ -195,6+161,21 @@ void free_page_tables(struct task_struct * tsk)
        invalidate();
 }
 
+int new_page_tables(struct task_struct * tsk)
+{
+       pgd_t * page_dir, * new_pg;
+       int i;
+
+       if (!(new_pg = pgd_alloc()))
+               return -ENOMEM;
+       page_dir = pgd_offset(&init_mm, 0);
+       for (i = USER_PTRS_PER_PGD ; i < PTRS_PER_PGD ; i++)
+               new_pg[i] = page_dir[i];
+       SET_PAGE_DIR(tsk, new_pg);
+       tsk->mm->pgd = new_pg;
+       return 0;
+}
+
 static inline void copy_one_pte(pte_t * old_pte, pte_t * new_pte)
 {
        pte_t pte = *old_pte;
@@ -324,7+305,7 @@ static inline void forget_pte(pte_t page)
        swap_free(pte_val(page));
 }
 
-static inline void unmap_pte_range(pmd_t * pmd, unsigned long address, unsigned long size)
+static inline void zap_pte_range(pmd_t * pmd, unsigned long address, unsigned long size)
 {
        pte_t * pte;
        unsigned long end;
@@ -332,7+313,7 @@ static inline void unmap_pte_range(pmd_t * pmd, unsigned long address, unsigned
        if (pmd_none(*pmd))
                return;
        if (pmd_bad(*pmd)) {
-               printk("unmap_pte_range: bad pmd (%08lx)\n", pmd_val(*pmd));
+               printk("zap_pte_range: bad pmd (%08lx)\n", pmd_val(*pmd));
                pmd_clear(pmd);
                return;
        }
@@ -350,7+331,7 @@ static inline void unmap_pte_range(pmd_t * pmd, unsigned long address, unsigned
        } while (address < end);
 }
 
-static inline void unmap_pmd_range(pgd_t * dir, unsigned long address, unsigned long size)
+static inline void zap_pmd_range(pgd_t * dir, unsigned long address, unsigned long size)
 {
        pmd_t * pmd;
        unsigned long end;
@@ -358,7+339,7 @@ static inline void unmap_pmd_range(pgd_t * dir, unsigned long address, unsigned
        if (pgd_none(*dir))
                return;
        if (pgd_bad(*dir)) {
-               printk("unmap_pmd_range: bad pgd (%08lx)\n", pgd_val(*dir));
+               printk("zap_pmd_range: bad pgd (%08lx)\n", pgd_val(*dir));
                pgd_clear(dir);
                return;
        }
@@ -368,7+349,7 @@ static inline void unmap_pmd_range(pgd_t * dir, unsigned long address, unsigned
        if (end > PGDIR_SIZE)
                end = PGDIR_SIZE;
        do {
-               unmap_pte_range(pmd, address, end - address);
+               zap_pte_range(pmd, address, end - address);
                address = (address + PMD_SIZE) & PMD_MASK; 
                pmd++;
        } while (address < end);
@@ -384,7+365,7 @@ int zap_page_range(struct mm_struct *mm, unsigned long address, unsigned long si
 
        dir = pgd_offset(mm, address);
        while (address < end) {
-               unmap_pmd_range(dir, address, end - address);
+               zap_pmd_range(dir, address, end - address);
                address = (address + PGDIR_SIZE) & PGDIR_MASK;
                dir++;
        }
@@ -392,15+373,6 @@ int zap_page_range(struct mm_struct *mm, unsigned long address, unsigned long si
        return 0;
 }
 
-/*
- * a more complete version of free_page_tables which performs with page
- * granularity.
- */
-int unmap_page_range(unsigned long address, unsigned long size)
-{
-       return zap_page_range(current->mm, address, size);
-}
-
 static inline void zeromap_pte_range(pte_t * pte, unsigned long address, unsigned long size, pte_t zero_pte)
 {
        unsigned long end;
index 48d071e..11a6c1f 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -773,7+773,7 @@ int do_munmap(unsigned long addr, size_t len)
                kfree(mpnt);
        }
 
-       unmap_page_range(addr, len);
+       zap_page_range(current->mm, addr, len);
        return 0;
 }
 
index a47b4a0..e971b05 100644 (file)
@@ -32,6+32,15 @@ SUB_DIRS += ax25
 endif
 
 L_TARGET     := network.a
-L_OBJS      := socket.o protocols.o netlink.o $(join $(SUB_DIRS),$(SUB_DIRS:%=/%.o))
+L_OBJS      := socket.o protocols.o $(join $(SUB_DIRS),$(SUB_DIRS:%=/%.o))
+M_OBJS      :=
+
+ifeq ($(CONFIG_NETLINK),y)
+L_OBJS += netlink.o
+else
+  ifeq ($(CONFIG_NETLINK),m)
+    M_OBJS += netlink.o
+  endif
+endif
 
 include $(TOPDIR)/Rules.make
index 4938b60..ddb75a4 100644 (file)
@@ -7,13+7,15 @@ if [ "$CONFIG_FIREWALL" = "y" ]; then
   bool 'IP: firewalling' CONFIG_IP_FIREWALL
 fi
 bool 'IP: accounting' CONFIG_IP_ACCT
-tristate 'IP: tunneling' CONFIG_NET_IPIP
-if [ "$CONFIG_IP_FORWARD" = "y" -a "$CONFIG_IP_FIREWALL" = "y" ]; then
-  bool 'IP: firewall packet logging' CONFIG_IP_FIREWALL_VERBOSE
-  bool 'IP: masquerading (ALPHA)' CONFIG_IP_MASQUERADE
-fi
-if [ "$CONFIG_IP_FORWARD" = "y" -a "$CONFIG_IP_MULTICAST" = "y" ]; then
-  bool 'IP: multicast routing(in progress)' CONFIG_IP_MROUTE
+if [ "$CONFIG_IP_FORWARD" = "y" ]; then
+  tristate 'IP: tunneling' CONFIG_NET_IPIP
+  if [ "$CONFIG_IP_FIREWALL" = "y" ]; then
+    bool 'IP: firewall packet logging' CONFIG_IP_FIREWALL_VERBOSE
+    bool 'IP: masquerading (ALPHA)' CONFIG_IP_MASQUERADE
+  fi
+  if [ "$CONFIG_IP_MULTICAST" = "y" ]; then
+    bool 'IP: multicast routing(in progress)' CONFIG_IP_MROUTE
+  fi
 fi
 comment '(it is safe to leave these untouched)'
 bool 'IP: PC/TCP compatibility mode' CONFIG_INET_PCTCP
index 3bf0bdf..8f9816e 100644 (file)
@@ -30,6+30,10 @@ endif
 
 ifeq ($(CONFIG_NET_IPIP),y)
 IPV4_OBJS += ipip.o
+else
+  ifeq ($(CONFIG_NET_IPIP),m)
+  M_OBJS += ipip.o
+  endif
 endif
 
 ifdef CONFIG_INET
index 4f93cc5..a0e5ba0 100644 (file)
  *
  */
  
+#include <linux/module.h>
+
+#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
 #include <linux/in.h>
+#include <linux/tcp.h>
+#include <linux/udp.h>
+#include <linux/firewall.h>
+#include <linux/config.h>      /* For CONFIG_FIREWALL */
+
 #include <net/datalink.h>
 #include <net/sock.h>
 #include <net/ip.h>
 #include <net/icmp.h>
-#include <linux/tcp.h>
-#include <linux/udp.h>
 #include <net/protocol.h>
 #include <net/ipip.h>
-#include <linux/firewall.h>
-
-#include <linux/config.h>
-
-#include <linux/module.h>
-
-#if ( defined(CONFIG_NET_IPIP) && defined(CONFIG_IP_FORWARD)) || defined(MODULE)
-
 
 /*
  *     The IPIP protocol driver.
@@ -114,6+112,7 @@ int ipip_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
 }
 
 #ifdef MODULE
+
 static struct inet_protocol ipip_protocol = {
   ipip_rcv,             /* IPIP handler          */
   NULL,                 /* Will be UDP fraglist handler */
@@ -143,4+142,3 @@ void cleanup_module( void)
 }
 
 #endif
-#endif
index 02a956d..e4b2140 100644 (file)
  *
  */
 
-#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/errno.h>
 #include <linux/if_arp.h>
 #include <linux/in.h>
+#include <linux/config.h>
+
 #include <asm/system.h>
 #include <asm/segment.h>
 #include <stdarg.h>
 #include <linux/proc_fs.h>
 #include <linux/stat.h>
 
-#if    defined(CONFIG_INET_RARP) || defined(MODULE)
-
 extern int (*rarp_ioctl_hook)(unsigned int,void*);
 
 /*
@@ -555,10+550,7 @@ rarp_init(void)
        rarp_ioctl_hook = rarp_ioctl;
 }
 
-
-#endif
 #ifdef MODULE
-char kernel_version[] = UTS_RELEASE;
 
 int init_module(void)
 {
@@ -568,22+560,18 @@ int init_module(void)
 
 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);
-               }
+       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);
        }
 }
 
index 617889d..c72abe4 100644 (file)
  * 
  */
 
-#include <linux/config.h>
-
-#if defined(CONFIG_NETLINK) || defined(MODULE)
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
 
 #include <linux/errno.h>
 #include <linux/kernel.h>
@@ -134,6+125,7 @@ static int netlink_open(struct inode * inode, struct file * file)
        if(active_map&(1<<minor))
        {
                open_map|=(1<<minor);
+               MOD_INC_USE_COUNT;
                return 0;
        }
        return -EUNATCH;
@@ -220,15+212,11 @@ int netlink_post(int unit, struct sk_buff *skb)
        return ret;
 }
 
-
-#ifdef MODULE
-char kernel_version[]=UTS_RELEASE;
-
-int init_module(void)
+int init_netlink(void)
 {
        int ct;
-       printk("Network Kernel/User communications module 0.03\n");
-       if (register_chrdev(NET_MAJOR,"netlink",&netlink_fops)) {
+
+       if(register_chrdev(NET_MAJOR,"netlink", &netlink_fops)) {
                printk("netlink: unable to get major %d\n", NET_MAJOR);
                return -EIO;
        }
@@ -240,25+228,17 @@ int init_module(void)
        return 0;
 }
 
-void cleanup_module(void)
+#ifdef MODULE
+
+int init_module(void)
 {
-       unregister_chrdev(NET_MAJOR,"netlink");
+       printk("Network Kernel/User communications module 0.03\n");
+       return init_netlink();
 }
 
-#else
-
-void init_netlink(void)
+void cleanup_module(void)
 {
-       int ct;
-       /* Keep quiet on booting, we don't want too many messages */
-       if(register_chrdev(NET_MAJOR,"netlink", &netlink_fops))
-               printk("netlink: unable to get major %d\n", NET_MAJOR);
-       for(ct=0;ct<MAX_LINKS;ct++)
-       {
-               skb_queue_head_init(&skb_queue_rd[ct]);
-               netlink_handler[ct]=netlink_err;
-       }
+       unregister_chrdev(NET_MAJOR,"netlink");
 }
 
 #endif
-#endif
index 7cc8331..7b7d521 100644 (file)
@@ -796,6+796,20 @@ static int unix_sendmsg(struct socket *sock, struct msghdr *msg, int len, int no
        }
        return sent;
 }
+
+/*
+ * Sleep until data has arrive. But check for races..
+ */
+static void unix_data_wait(unix_socket * sk)
+{
+       cli();
+       if (!skb_peek(&sk->receive_queue)) {
+               sk->socket->flags |= SO_WAITDATA;
+               interruptible_sleep_on(sk->sleep);
+               sk->socket->flags &= ~SO_WAITDATA;
+       }
+       sti();
+}
                
 static int unix_recvmsg(struct socket *sock, struct msghdr *msg, int size, int noblock, int flags, int *addr_len)
 {
@@ -818,10+832,7 @@ static int unix_recvmsg(struct socket *sock, struct msghdr *msg, int size, int n
        if(sk->err)
                return sock_error(sk);
        
-/*     printk("get rcv sem\n");*/
        down(&sk->protinfo.af_unix.readsem);            /* Lock the socket */
-/*     printk("got rcv sem\n");*/
-
        while(ct--)
        {
                int done=0;
@@ -831,42+842,23 @@ static int unix_recvmsg(struct socket *sock, struct msghdr *msg, int size, int n
                
                while(done<len)
                {
-                       if(copied & (flags&MSG_PEEK))
-                       {
-                               up(&sk->protinfo.af_unix.readsem);
-                               return copied;
-                       }
-                       cli();
-                       skb=skb_peek(&sk->receive_queue);
+                       if (copied && (flags & MSG_PEEK))
+                               goto out;
+                       if (copied == size)
+                               goto out;
+                       skb=skb_dequeue(&sk->receive_queue);
                        if(skb==NULL)
                        {
                                up(&sk->protinfo.af_unix.readsem);
                                if(sk->shutdown & RCV_SHUTDOWN)
-                               {
-                                       sti();
                                        return copied;
-                               }
                                if(copied)
-                               {
-                                       sti();
                                        return copied;
-                               }
                                if(noblock)
-                               {
-                                       sti();
                                        return -EAGAIN;
-                               }
-                               sk->socket->flags |= SO_WAITDATA;
-                               interruptible_sleep_on(sk->sleep);
-                               sk->socket->flags &= ~SO_WAITDATA;
-                               if( current->signal & ~current->blocked)
-                               {
-                                       sti();
-                                       if(copied)
-                                               return copied;
+                               if(current->signal & ~current->blocked)
                                        return -ERESTARTSYS;
-                               }
-                               sti();
+                               unix_data_wait(sk);
                                down(&sk->protinfo.af_unix.readsem);
                                continue;
                        }
@@ -884,29+876,23 @@ static int unix_recvmsg(struct socket *sock, struct msghdr *msg, int size, int n
                                                *addr_len=sizeof(short);
                        }
                        num=min(skb->len,size-copied);
+                       memcpy_tofs(sp, skb->data, num);
                        copied+=num;
                        done+=num;
-                       if(flags&MSG_PEEK)
-                       {
-                               memcpy_tofs(sp, skb->data, num);
-                               break;
-                       }
-                       else
-                       {
-                               memcpy_tofs(sp, skb->data,num);
-                               skb_pull(skb,num);
-                               sp+=num;
-                               if(skb->len==0)
-                               {
-                                       skb_unlink(skb);
-                                       kfree_skb(skb, FREE_WRITE);
-                                       if(sock->type==SOCK_DGRAM)
-                                               break;
-                               }
+                       sp+=num;
+                       if (!(flags & MSG_PEEK))
+                               skb_pull(skb, num);
+                       /* put the skb back if we didn't use it up.. */
+                       if (skb->len) {
+                               skb_queue_head(&sk->receive_queue, skb);
+                               continue;
                        }
-                       sti();
-               }       
-       }       
+                       kfree_skb(skb, FREE_WRITE);
+                       if(sock->type==SOCK_DGRAM)
+                               goto out;
+               }
+       }
+out:
        up(&sk->protinfo.af_unix.readsem);
        return copied;
 }
index 6dc8643..4d6b9c5 100644 (file)
+HOSTCFLAGS=-g
 HEADER=header.tk
 TAIL=tail.tk
 
 kconfig.tk: ../arch/${ARCH}/config.in tkparse ${HEADER} ${TAIL}
-       ./tkparse < ../arch/${ARCH}/config.in > kconfig.tmp
-       cp ${HEADER} ./kconfig.tk
+       ./tkparse < ../arch/${ARCH}/config.in  > kconfig.tmp
+       @if [ -f /usr/local/bin/wish ]; then \
+               echo '#!'"/usr/local/bin/wish -f" > kconfig.tk; \
+       else \
+               echo '#!'"/usr/bin/wish -f" > kconfig.tk; \
+       fi
+       cat ${HEADER} >> ./kconfig.tk
        cat kconfig.tmp >> kconfig.tk
        rm -f kconfig.tmp
+       echo "set defaults \"arch/${ARCH}/config.in\"" >> kconfig.tk
        cat ${TAIL} >> kconfig.tk
        chmod 755 kconfig.tk
 
-
 tkparse: tkparse.o tkcond.o tkgen.o
        ${HOSTCC} -o tkparse tkparse.o tkcond.o tkgen.o
 
index 9f01734..1842e88 100644 (file)
@@ -1,5+1,3 @@
-#!/usr/bin/wish -f
-
 #
 # Used to determine size of canvas inserted for booleans. It holds the
 # place where the 'm' button goes in a tristate, and keeps the look and feel
@@ -52,7+50,7 @@ proc do_cmd { w command } {
        pack $w.back -side bottom -pady 10
 
        focus $w
-       wm geometry $w +30+35   
+       wm geometry $w +30+35
 
        $w.tb.text delete 1.0 end
        set f [open |$command]
@@ -86,7+84,34 @@ proc load_configfile { w title func } {
        pack $w.f.back $w.f.canc -side left -pady 10 -padx 45
        pack $w.f -pady 10 -side bottom -padx 10 -anchor w
        focus $w
-       wm geometry $w +30+35   
+       global winx; global winy
+       set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
+       wm geometry $w +$winx+$winy
+}
+
+proc maybe_exit { w } {
+       catch {destroy $w}
+       toplevel $w -class Dialog
+       label $w.bm -bitmap questhead
+       pack  $w.bm -pady 10 -side top -padx 10
+       message $w.m -width 400 -aspect 300 \
+               -text "Changes will be lost.  Are you sure?"  -relief raised \
+               -fg black
+       pack  $w.m -pady 10 -side top -padx 10
+       wm title $w "Are you sure?" 
+
+       set oldFocus [focus]
+       frame $w.f
+       button $w.f.back -text "OK" -activebackground green -width 20 \
+               -command "exit"
+       button $w.f.canc -text "Cancel" -activebackground red \
+               -width 20 -command "destroy $w; focus $oldFocus"
+       pack $w.f.back $w.f.canc -side left -pady 10 -padx 45
+       pack $w.f -pady 10 -side bottom -padx 10 -anchor w
+       focus $w
+       global winx; global winy
+       set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
+       wm geometry $w +$winx+$winy
 }
 
 proc read_config_file { w } {
@@ -110,7+135,9 @@ proc read_config_file { w } {
                pack $w.f.back -side bottom -pady 10 -anchor s
                pack $w.f -pady 10 -side top -padx 10 -anchor s
                focus $w
-               wm geometry $w +30+35
+               global winx; global winy
+               set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
+               wm geometry $w +$winx+$winy
        }
 }
 
@@ -136,12+163,15 @@ proc write_config_file  { w } {
                pack $w.f.back -side bottom -pady 10 -anchor s
                pack $w.f -pady 10 -side top -padx 10 -anchor s
                focus $w
-               wm geometry $w +30+35
+               global winx; global winy
+               set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
+               wm geometry $w +$winx+$winy
        }
 }
 
 proc read_config { filename } {
        set file1 [open $filename r]
+       clear_choices
        while { [gets $file1 line] >= 0} {
                if [regexp {([0-9A-Z_]+)=([ynm])} $line foo var value] {
                        if { $value == "y" } then { set cmd "global $var; set $var 1" }
@@ -155,8+185,11 @@ proc read_config { filename } {
                }
        }
        close $file1
+       update_choices
+       update_mainmenu .rdupd
 }
 proc write_comment { file1 file2 text } {
+       puts $file1 ""
        puts $file1 "#"
        puts $file1 "# $text"
        puts $file1 "#"
@@ -180,7+213,7 @@ proc write_variable { file1 file2 varname variable dep } {
        }
 }
 
-proc bool {w mnum line text variable default} {
+proc bool {w mnum line text variable} {
        frame $w.x$line
        global modbutton_width
        global modbutton_height
@@ -210,7+243,7 @@ proc bool {w mnum line text variable default} {
        }
 }
 
-proc int { w mnum line text variable default } {
+proc int { w mnum line text variable } {
        frame $w.x$line
        button $w.x$line.help -text "Help" -relief raised \
                -command "dohelp .dohelp $variable "
@@ -235,6+268,7 @@ proc dohelp {w varname }  {
 
        set filefound 0
        set found 0
+       set lineno 0
        if { [file readable Documentation/Configure.help] == 1} then {
                set f [open Documentation/Configure.help r]
                set filefound 1 
@@ -247,15+281,23 @@ proc dohelp {w varname }  {
                                if { $found == 0 } continue 
                        }
                        if { [string length $line1 ] == 0 } break
-                       append message $line
+                       if { [string  range $line1 0 0 ] == "#" } continue
+                       if { $lineno == 0 } then {
+                           append message $line1
+                           append message ":"
+                       } else {
+                           append message " "
+                           append message $line1
+                       }
+                       set lineno [expr $lineno + 1]
                }
                close $f
        }
 
        if { $found == 0 } then {
                if { $filefound == 0 } then {
-               message $w.m -width 400 -aspect 300 -text \
-                       "No help available - unable to open file Documentation/Configure.help"  -relief raised -fg black
+               message $w.m -width 750 -aspect 300 -text \
+                       "No help available - unable to open file Documentation/Configure.help.  This file is available from http://math-www.uni-paderborn.de/~axel/config_help.html or ftp://sunsite.unc.edu/pub/Linux/kernel/config/krnl_cnfg_hlp_1.X.XX.tgz"  -relief raised -fg black
                } else {
                message $w.m -width 400 -aspect 300 -text \
                        "No help available for $varname"  -relief raised -fg black
@@ -277,7+319,9 @@ proc dohelp {w varname }  {
        pack $w.f.back -side bottom -pady 10 -anchor s
        pack $w.f -pady 10 -side top -padx 10 -anchor s
        focus $w
-       wm geometry $w +30+35
+       global winx; global winy
+       set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
+       wm geometry $w +$winx+$winy
 }
 
 proc wrapup {w }  {
@@ -296,7+340,9 @@ proc wrapup {w }  {
        pack $w.f.back -side bottom -pady 10 -anchor s
        pack $w.f -pady 10 -side top -padx 10 -anchor s
        focus $w
-       wm geometry $w +30+35
+       global winx; global winy
+       set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
+       wm geometry $w +$winx+$winy
 
 }
 
@@ -304,7+350,7 @@ proc check_sound_config { num } {
 #nothing for now.
 }
 
-proc tristate {w mnum line text variable default} {
+proc tristate {w mnum line text variable } {
        frame $w.x$line
        radiobutton $w.x$line.y -text "y" -variable $variable -value 1 \
                -width 2 -command "update_menu$mnum .menu$mnum"
@@ -319,7+365,7 @@ proc tristate {w mnum line text variable default} {
        pack $w.x$line -anchor w
 }
 
-proc dep_tristate {w mnum line text variable default} {
+proc dep_tristate {w mnum line text variable } {
        frame $w.x$line
        radiobutton $w.x$line.y -text "y" -variable $variable -value 1 \
                -width 2 -command "update_menu$mnum .menu$mnum"
@@ -335,6+381,11 @@ proc dep_tristate {w mnum line text variable default} {
 }
 
 
+proc do_sound {w mnum line} {
+       message $w.x$line -width 400 -aspect 300 -text "Note: The sound drivers cannot as of yet be configured via the X-based interface" -relief raised
+       pack $w.x$line -side top -pady 10
+}
+
 #
 # Next set up the particulars for the top level menu, and define a few
 # buttons which we will stick down at the bottom.
index 84593a4..cfe815f 100644 (file)
@@ -18,23+18,31 @@ if { [file readable .config] == 1} then {
                if { [lindex $argv 0] != "-D" } then {
                        read_config .config
                }
+               else
+               {
+                       read_config $defaults
+               }
        } else {
                read_config .config
        }
+} else {
+       read_config $defaults
 }
 
+update_mainmenu .f0
+
 button .f0r_bot.save -text "Write Configuration" -width 25 -command {
        writeconfig .config include/linux/autoconf.h; wrapup .wrap }
 
-button .f0r_bot.quit -text "Quit" -command { exit } -width 25 \
+button .f0r_bot.quit -text "Quit" -command { maybe_exit .maybe } -width 25 \
        -activebackground red -activeforeground white
 
 button .f0l_bot.store -text "Store Configuration to file" -width 25 -command {
-       load_configfile .load "Store Configuration" write_config_file
+       load_configfile .load "Save Configuration in file" write_config_file
 }
 
 button .f0l_bot.load -text "Load Configuration" -width 25 -command {
-       load_configfile .load "Load Configuration" read_config_file
+       load_configfile .load "Load Configuration from file" read_config_file
 }
 
 pack  .f0r_bot.save .f0r_bot.quit -padx 25 -ipadx 10 -ipady 2 -anchor w
index 21d011d..ed75981 100644 (file)
  * If the input condition contains '(' or ')' it would screw us up, but for now
  * this is not a problem.
  */
+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include "tkparse.h"
@@ -52,7+53,15 @@ static int invert_condition(struct condition * cnd)
          cnd->op = op_or;
          break;
        case op_or:
-         cnd->op = op_and;
+         /*
+          * This is not turned into op_and - we need to keep track
+          * of what operators were used here since we have an optimization
+          * later on to remove duplicate conditions, and having
+          * inverted ors in there would make it harder if we did not
+          * distinguish an inverted or from an and we inserted because
+          * of nested ifs.
+          */
+         cnd->op = op_and1;
          break;
        case op_neq:
          cnd->op = op_eq;
@@ -82,6+91,54 @@ static int free_condition(struct condition * cnd)
 }
 
 /*
+ * Walk all of the conditions, and look for choice values.  Convert
+ * the tokens into something more digestable.
+ */
+void fix_choice_cond()
+{
+  struct condition * cond;
+  struct condition * cond2;
+  struct kconfig * cfg;
+  char tmpbuf[10];
+
+  for(cfg = config;cfg != NULL; cfg = cfg->next)
+    {
+      if( cfg->cond == NULL )
+       {
+         continue;
+       }
+
+      for(cond = cfg->cond; cond != NULL; cond = cond->next)
+       {
+         if( cond->op != op_kvariable )
+           continue;
+
+         if( cond->variable.cfg->tok != tok_choice )
+           continue;
+
+         /*
+          * Look ahead for what we are comparing this to.  There should
+          * be one operator inbetween.
+          */
+         cond2 = cond->next->next;
+         sprintf(tmpbuf, "%d", cond->variable.cfg->choice_value);
+
+         if( strcmp(cond2->variable.str, "y") == 0 )
+           {
+             cond->variable.cfg = cond->variable.cfg->choice_label;
+             cond2->variable.str = strdup(tmpbuf);
+           }
+         else
+           {
+             fprintf(stderr,"Ooops\n");
+             exit(0);
+           }
+       }
+
+    }
+}
+
+/*
  * Walk the stack of conditions, and clone all of them with "&&" operators
  * gluing them together.  The conditions from each level of the stack
  * are wrapped in parenthesis so as to guarantee that the results
@@ -135,6+192,7 @@ struct condition * get_token_cond(struct condition ** cond, int depth)
                    {
                      if( cfg->tok != tok_bool && cfg->tok != tok_int
                         && cfg->tok != tok_tristate 
+                        && cfg->tok != tok_choice
                         && cfg->tok != tok_dep_tristate)
                        {
                          continue;
@@ -146,6+204,10 @@ struct condition * get_token_cond(struct condition ** cond, int depth)
                          break;
                        }
                    }
+                 if( cfg == NULL )
+                   {
+                     new->variable.str = strdup(ocond->variable.str);
+                   }
                }
              else
                {
@@ -288,11+350,13 @@ int fix_conditionals(struct kconfig * scfg)
          cfg->tok = tok_nop;
          break;
        case tok_comment:
+       case tok_define:
        case tok_menuoption:
        case tok_bool:
        case tok_tristate:
        case tok_dep_tristate:
        case tok_int:
+       case tok_choice:
          /*
           * We need to duplicate the chain of conditions and attach them to
           * this token.
@@ -303,6+367,12 @@ int fix_conditionals(struct kconfig * scfg)
          break;
        }
     }
+
+  /*
+   * Fix any conditions involving the "choice" operator.
+   */
+  fix_choice_cond();
+
   /*
    * Walk through and see if there are multiple options that control the
    * same kvariable.  If there are we need to treat them a little bit
@@ -320,6+390,7 @@ int fix_conditionals(struct kconfig * scfg)
            {
              switch(cfg1->tok)
                {
+               case tok_define:
                case tok_bool:
                case tok_tristate:
                case tok_dep_tristate:
index d006c25..38dbd0a 100644 (file)
  * of submenus.  I need to fix the window titles before it would really be
  * appropriate to enable this.
  */
-/* #define PREVLAST_LIMITED_RANGE */
+#define PREVLAST_LIMITED_RANGE
 
 /*
  * This is the total number of submenus that we have.
@@ -67,12+67,14 @@ generate_if(struct kconfig * item,
            int menu_num,
            int line_num)
 {
+  int i;
   struct condition * ocond;
 
+  ocond = cond;
+
   /*
    * First write any global declarations we need for this conditional.
    */
-  ocond = cond;
   while(cond != NULL )
     {
       switch(cond->op){
@@ -89,15+91,16 @@ generate_if(struct kconfig * item,
       }
       cond = cond->next;
     }
-
+  
   /*
    * Now write this option.
    */
-  if( (item->flags & GLOBAL_WRITTEN) == 0)
+  if(   (item->flags & GLOBAL_WRITTEN) == 0
+     && (item->optionname != NULL) )
     {
-       printf("\tglobal %s\n", item->optionname);
+      printf("\tglobal %s\n", item->optionname);
+      item->flags |= GLOBAL_WRITTEN;
     }
-
   /*
    * Now generate the body of the conditional.
    */
@@ -116,6+119,7 @@ generate_if(struct kconfig * item,
        printf(" != ");
        break;
       case op_and:
+      case op_and1:
        printf(" && ");
        break;
       case op_or:
@@ -133,6+137,9 @@ generate_if(struct kconfig * item,
       case op_kvariable:
        printf("$%s", cond->variable.cfg->optionname);
        break;
+      case op_shellcmd:
+       printf("[exec %s]", cond->variable.str);
+       break;
       case op_constant:
        if( strcmp(cond->variable.str, "y") == 0 )
          printf("1");
@@ -141,7+148,7 @@ generate_if(struct kconfig * item,
        else if( strcmp(cond->variable.str, "m") == 0 )
          printf("2");
        else
-         printf("'%s'", cond->variable);
+         printf("\"%s\"", cond->variable);
        break;
       }
       cond = cond->next;
@@ -155,6+162,9 @@ generate_if(struct kconfig * item,
    */
   switch(item->tok)
     {
+    case tok_define:
+      printf("} then { set %s %s } \n",  item->optionname, item->value);
+      break;
     case tok_menuoption:
       printf("} then { .f0.x%d configure -state normal } else { .f0.x%d configure -state disabled }\n",
             menu_num, menu_num);
@@ -189,7+199,7 @@ generate_if(struct kconfig * item,
       printf(".menu%d.x%d.y configure -state disabled;",menu_num, line_num);
       printf(".menu%d.x%d.n configure -state disabled;",menu_num, line_num);
       printf(".menu%d.x%d.l configure -state disabled;",menu_num, line_num);
-      printf("set %s [ expr $%s | 16 ];", item->optionname, item->optionname);
+      printf("set %s [expr $%s|16];", item->optionname, item->optionname);
       printf("}\n");
 #endif
       break;
@@ -229,6+239,10 @@ generate_if(struct kconfig * item,
       printf("set %s [expr $%s|16];", item->optionname, item->optionname);
       printf("}\n");
       break;
+    case tok_choose:
+    case tok_choice:
+      fprintf(stderr,"Fixme\n");
+      exit(0);
     default:
       break;
     }
@@ -283,6+297,7 @@ generate_if_for_outfile(struct kconfig * item,
        printf(" != ");
        break;
       case op_and:
+      case op_and1:
        printf(" && ");
        break;
       case op_or:
@@ -297,6+312,9 @@ generate_if_for_outfile(struct kconfig * item,
       case op_variable:
        printf("$%s", cond->variable.str);
        break;
+      case op_shellcmd:
+       printf("[exec %s]", cond->variable.str);
+       break;
       case op_kvariable:
        printf("$%s", cond->variable.cfg->optionname);
        break;
@@ -308,7+326,7 @@ generate_if_for_outfile(struct kconfig * item,
        else if( strcmp(cond->variable.str, "m") == 0 )
          printf("2");
        else
-         printf("'%s'", cond->variable);
+         printf("\"%s\"", cond->variable);
        break;
       }
       cond = cond->next;
@@ -323,6+341,9 @@ generate_if_for_outfile(struct kconfig * item,
    */
   switch(item->tok)
     {
+    case tok_define:
+      printf("} then {write_variable $cfg $autocfg %s %s $notmod }\n", item->optionname, item->value);
+      break;
     case tok_comment:
       printf("} then {write_comment $cfg $autocfg \"%s\"}\n", item->label);
       break;
@@ -336,6+357,10 @@ generate_if_for_outfile(struct kconfig * item,
       printf("} then { write_variable $cfg $autocfg %s $%s $notmod }\n", 
             item->optionname, item->optionname);
       break;
+    case tok_choose:
+    case tok_choice:
+      fprintf(stderr,"Fixme\n");
+      exit(0);
     default:
       break;
     }
@@ -384,7+409,7 @@ static end_proc(int menu_num, int first, int last)
   printf("}\n\n\n");
 
   /*
-   * Now we generate the companion procedure for the muen we just
+   * Now we generate the companion procedure for the menu we just
    * generated.  This procedure contains all of the code to
    * disable/enable widgets based upon the settings of the other
    * widgets, and will be called first when the window is mapped,
@@ -392,6+417,7 @@ static end_proc(int menu_num, int first, int last)
    */
   printf("proc update_menu%d {w}  {\n", menu_num);
 
+  printf("\tupdate_define\n");
   clear_globalflags(config);
   for(cfg = config;cfg != NULL; cfg = cfg->next)
     {
@@ -399,6+425,25 @@ static end_proc(int menu_num, int first, int last)
        * Skip items not for this menu, or ones having no conditions.
        */
       if (cfg->menu_number != menu_num ) continue;
+      if (cfg->tok != tok_define) continue;
+      /*
+       * Clear all of the booleans that are defined in this menu.
+       */
+      if(   (cfg->flags & GLOBAL_WRITTEN) == 0
+        && (cfg->optionname != NULL) )
+       {
+         printf("\tglobal %s\n", cfg->optionname);
+         cfg->flags |= GLOBAL_WRITTEN;
+         printf("\tset %s 0\n", cfg->optionname);
+       }
+
+    }
+  for(cfg = config;cfg != NULL; cfg = cfg->next)
+    {
+      /*
+       * Skip items not for this menu, or ones having no conditions.
+       */
+      if (cfg->menu_number != menu_num ) continue;
       if (cfg->tok == tok_menuoption) continue;
       if (cfg->cond != NULL ) 
        generate_if(cfg, cfg->cond, menu_num, cfg->menu_line);
@@ -453,6+498,9 @@ static int find_menu_size(struct kconfig *cfg,
       case tok_tristate:
       case tok_dep_tristate:
       case tok_int:
+      case tok_choose:
+      case tok_choice:
+      case tok_sound:
        tot++;
        break;
       default:
@@ -474,12+522,14 @@ static int find_menu_size(struct kconfig *cfg,
  */
 dump_tk_script(struct kconfig *scfg)
 {
+  int i;
   int menu_num =0;
   int menu_max =0;
   int menu_min =0;
   int menu_line = 0;
   int menu_maxlines = 0;
   struct kconfig * cfg;
+  struct kconfig * cfg1 = NULL;
   char * menulabel;
 
   /*
@@ -510,6+560,9 @@ dump_tk_script(struct kconfig *scfg)
        case tok_tristate:
        case tok_dep_tristate:
        case tok_int:
+       case tok_choose:
+       case tok_choice:
+       case tok_sound:
          /*
           * If we have overfilled the menu, then go to the next one.
           */
@@ -523,6+576,8 @@ dump_tk_script(struct kconfig *scfg)
          cfg->submenu_end = menu_max;
          cfg->menu_line = menu_line++;
          break;
+       case tok_define:
+         cfg->menu_number = -1;
        default:
          break;
        };
@@ -530,10+585,8 @@ dump_tk_script(struct kconfig *scfg)
 
   /*
    * Record this so we can set up the prev/next buttons correctly.
-   * We will be adding one more menu for sound configuration, so
-   * take this into account.
    */
-  tot_menu_num = menu_num+1;
+  tot_menu_num = menu_num;
 
   /*
    * Now start generating the actual wish script that we will use.
@@ -577,14+630,35 @@ dump_tk_script(struct kconfig *scfg)
              start_proc(menulabel, cfg->menu_number, FALSE);
              menu_num = cfg->menu_number;
            }
-         printf("\tbool $w %d %d \"%s\" %s %s\n",
+         printf("\tbool $w %d %d \"%s\" %s\n",
                 cfg->menu_number,
                 cfg->menu_line,
                 cfg->label,
-                cfg->optionname,
-                cfg->dflt);
+                cfg->optionname);
          break;
 
+       case tok_choice:
+         printf("\t$w.line%d.menu add radiobutton -label \"%s\" -variable %s -value %d -command \"update_menu%d .menu%d\"\n",
+                cfg1->menu_line,
+                cfg->label,
+                cfg1->optionname,
+                cfg->choice_value,
+                cfg->menu_number, cfg->menu_number);
+         break;
+       case tok_choose:
+         if( cfg->menu_number != menu_num )
+           {
+             end_proc(menu_num, menu_min, menu_max);
+             start_proc(menulabel, cfg->menu_number, FALSE);
+             menu_num = cfg->menu_number;
+           }
+         printf("\tmenubutton $w.line%d -text \"%s\" -menu $w.line%d.menu \\\n",
+                cfg->menu_line, cfg->label, cfg->menu_line);
+         printf("\t    -relief raised -width 35\n");
+         printf("\tpack $w.line%d -anchor w\n", cfg->menu_line);
+         printf("\tmenu $w.line%d.menu\n", cfg->menu_line);
+         cfg1 = cfg;
+         break;
        case tok_tristate:
          if( cfg->menu_number != menu_num )
            {
@@ -592,12+666,11 @@ dump_tk_script(struct kconfig *scfg)
              start_proc(menulabel, cfg->menu_number, FALSE);
              menu_num = cfg->menu_number;
            }
-         printf("\ttristate $w %d %d \"%s\" %s %s\n",
+         printf("\ttristate $w %d %d \"%s\" %s\n",
                 cfg->menu_number,
                 cfg->menu_line,
                 cfg->label,
-                cfg->optionname,
-                cfg->dflt);
+                cfg->optionname);
          break;
        case tok_dep_tristate:
          if( cfg->menu_number != menu_num )
@@ -606,12+679,11 @@ dump_tk_script(struct kconfig *scfg)
              start_proc(menulabel, cfg->menu_number, FALSE);
              menu_num = cfg->menu_number;
            }
-         printf("\tdep_tristate $w %d %d \"%s\" %s %s\n",
+         printf("\tdep_tristate $w %d %d \"%s\" %s\n",
                 cfg->menu_number,
                 cfg->menu_line,
                 cfg->label,
                 cfg->optionname,
-                cfg->dflt,
                 cfg->depend);
          break;
        case tok_int:
@@ -621,12+693,23 @@ dump_tk_script(struct kconfig *scfg)
              start_proc(menulabel, cfg->menu_number, FALSE);
              menu_num = cfg->menu_number;
            }
-         printf("\tint $w %d %d \"%s\" %s %s\n",
+         printf("\tint $w %d %d \"%s\" %s\n",
                 cfg->menu_number,
                 cfg->menu_line,
                 cfg->label,
-                cfg->optionname,
-                cfg->dflt);
+                cfg->optionname);
+         break;
+       case tok_sound:
+         if( cfg->menu_number != menu_num )
+           {
+             end_proc(menu_num, menu_min, menu_max);
+             start_proc(menulabel, cfg->menu_number, FALSE);
+             menu_num = cfg->menu_number;
+           }
+         printf("\tdo_sound $w %d %d\n",
+                cfg->menu_number,
+                cfg->menu_line);
+         break;
        default:
          break;
        }
@@ -638,6+721,7 @@ dump_tk_script(struct kconfig *scfg)
    */
   end_proc(menu_num, menu_min, menu_max);
 
+#ifdef ERIC_DONT_DEF
   /*
    * Generate the code for configuring the sound driver.  Right now this
    * cannot be done from the X script, but we insert the menu anyways.
@@ -650,11+734,11 @@ dump_tk_script(struct kconfig *scfg)
   printf("\tlabel $w.m0 -bitmap error\n");
   printf("\tmessage $w.m1 -width 400 -aspect 300 -text \"The sound drivers cannot as of yet be configured via the X-based interface\" -relief raised\n");
   printf("\tpack $w.m0 $w.m1 -side top -pady 10\n");
-
   /*
    * Close out the last menu.
    */
   end_proc(menu_num, menu_num, menu_num);
+#endif
 
   /*
    * The top level menu also needs an update function.  When we exit a
@@ -678,6+762,26 @@ dump_tk_script(struct kconfig *scfg)
 
   printf("}\n\n\n");
 
+#if 0
+  /*
+   * Generate some code to set the variables that are "defined".
+   */
+  for(cfg = config;cfg != NULL; cfg = cfg->next)
+    {
+      /*
+       * Skip items not for this menu, or ones having no conditions.
+       */
+      if( cfg->tok != tok_define) continue;
+      if (cfg->cond != NULL ) 
+       generate_if(cfg, cfg->cond, menu_num, cfg->menu_line);
+      else
+       {
+         printf("\twrite_define %s %s\n", cfg->optionname, cfg->value);
+       }
+
+    }
+#endif
+
   /*
    * Now generate code to load the default settings into the variables.
    * Note that the script in tail.tk will attempt to load .config,
@@ -688,18+792,14 @@ dump_tk_script(struct kconfig *scfg)
       switch (cfg->tok)
        {
        case tok_int:
-           printf("set %s %s\n", cfg->optionname, cfg->dflt);
-           break;
        case tok_bool:
        case tok_tristate:
        case tok_dep_tristate:
-         if( strcmp(cfg->dflt, "y") == 0 )
-           printf("set %s 1\n", cfg->optionname);
-         else if( strcmp(cfg->dflt, "n") == 0 )
-           printf("set %s 0\n", cfg->optionname);
-         else if( strcmp(cfg->dflt, "m") == 0 )
-           printf("set %s 2\n", cfg->optionname);
+       case tok_choice:
+         printf("set %s 0\n", cfg->optionname);
          break;
+       case tok_choose:
+         printf("set %s %d\n", cfg->optionname, cfg->choice_value);
        default:
          break;
        }
@@ -731,6+831,8 @@ dump_tk_script(struct kconfig *scfg)
        case tok_bool:
        case tok_tristate:
        case tok_dep_tristate:
+       case tok_define:
+       case tok_choose:
          if(cfg->flags & GLOBAL_WRITTEN) break;
          cfg->flags |= GLOBAL_WRITTEN;
          printf("\tglobal %s\n", cfg->optionname);
@@ -752,6+854,25 @@ dump_tk_script(struct kconfig *scfg)
                {
                  printf("\twrite_comment $cfg $autocfg \"%s\"\n", cfg->label);
                }
+#if 0
+             else if(cfg->tok == tok_define)
+               {
+                 printf("\twrite_define %s %s\n", cfg->optionname,
+                        cfg->value);
+               }
+#endif
+             else if (cfg->tok == tok_choose )
+               {
+                 for(cfg1 = cfg->next; 
+                     cfg1 != NULL && cfg1->tok == tok_choice;
+                     cfg1 = cfg1->next)
+                   {
+                     printf("\tif { $%s == %d } then { write_variable $cfg $autocfg %s 1 $notmod }\n",
+                            cfg->optionname,
+                            cfg1->choice_value,
+                            cfg1->optionname);
+                   }
+               }
              else
                {
                  printf("\twrite_variable $cfg $autocfg %s $%s $notmod\n",
@@ -770,6+891,62 @@ dump_tk_script(struct kconfig *scfg)
   printf("}\n\n\n");
 
   /*
+   * Finally write a simple function that updates the master choice
+   * variable depending upon what values were loaded from a .config
+   * file.  
+   */
+  printf("proc clear_choices { } {\n");
+  for(cfg = scfg; cfg != NULL; cfg = cfg->next)
+    {
+      if( cfg->tok != tok_choose ) continue;
+      for(cfg1 = cfg->next; 
+         cfg1 != NULL && cfg1->tok == tok_choice;
+         cfg1 = cfg1->next)
+       {
+         printf("\tglobal %s; set %s 0\n",  cfg1->optionname, cfg1->optionname);
+       }
+    }
+  printf("}\n\n\n");
+
+  printf("proc update_choices { } {\n");
+  for(cfg = scfg; cfg != NULL; cfg = cfg->next)
+    {
+      if( cfg->tok != tok_choose ) continue;
+      printf("\tglobal %s\n", cfg->optionname);
+      for(cfg1 = cfg->next; 
+         cfg1 != NULL && cfg1->tok == tok_choice;
+         cfg1 = cfg1->next)
+       {
+         printf("\tglobal %s\n", cfg1->optionname);
+         printf("\tif { $%s == 1 } then { set %s %d }\n",
+                cfg1->optionname,
+                cfg->optionname,
+                cfg1->choice_value);
+       }
+    }
+  printf("}\n\n\n");
+
+  printf("proc update_define { } {\n");
+  clear_globalflags(config);
+  for(cfg = scfg; cfg != NULL; cfg = cfg->next)
+    {
+      if( cfg->tok != tok_define ) continue;
+      printf("\tglobal %s; set %s 0\n",  cfg->optionname,  cfg->optionname);
+      cfg->flags |= GLOBAL_WRITTEN;
+    }
+  for(cfg = scfg; cfg != NULL; cfg = cfg->next)
+    {
+      if( cfg->tok != tok_define ) continue;
+      if (cfg->cond != NULL ) 
+       generate_if(cfg, cfg->cond, -1, 0);
+      else
+       {
+         printf("\tset %s %s\n",
+                cfg->optionname, cfg->value);
+       }
+    }
+  printf("}\n\n\n");
+  /*
    * That's it.  We are done.  The output of this file will have header.tk
    * prepended and tail.tk appended to create an executable wish script.
    */
index 403c5ad..8c30ae8 100644 (file)
  *
  * This file contains the code to do the first parse of config.in.
  */
+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include "tkparse.h"
@@ -29,6+30,10 @@ static int lineno = 0;
 static int menus_seen = 0;
 static char * current_file = NULL;
 static int do_source(char * filename);
+static char * get_string(char *pnt, char ** labl);
+static int choose_number = 0;
+
+
 /*
  * Simple function just to skip over spaces and tabs in config.in.
  */
@@ -93,6+98,13 @@ static struct condition * parse_if(char * pnt)
        continue;
       }
 
+    if( *pnt == '-' && pnt[1] == 'o' )
+      {
+       cpnt->op = op_or;
+       pnt += 2;
+       continue;
+      }
+
     if( *pnt == '!' && pnt[1] == '=' )
       {
        cpnt->op = op_neq;
@@ -116,6+128,18 @@ static struct condition * parse_if(char * pnt)
 
     if( *pnt != '"' ) goto error;  /* This cannot be right. */
     pnt++;
+    if( *pnt == '`' )
+      {
+       cpnt->op = op_shellcmd;
+       pnt1 = varname;
+       pnt++;
+       while(*pnt && *pnt != '`') *pnt1++ = *pnt++;
+       *pnt1++ = '\0';
+       cpnt->variable = strdup(varname);
+       if( *pnt == '`' ) pnt++;
+       if( *pnt == '"' ) pnt++;
+       continue;
+      }
     if( *pnt == '$' )
       {
        cpnt->op = op_variable;
@@ -141,9+165,11 @@ static struct condition * parse_if(char * pnt)
 
  error:
   if(current_file != NULL) 
-    printf("Bad if clause at line %d(%s):%s\n", lineno, current_file, opnt);
+    fprintf(stderr, 
+           "Bad if clause at line %d(%s):%s\n", lineno, current_file, opnt);
   else
-    printf("Bad if clause at line %d:%s\n", lineno, opnt);
+    fprintf(stderr,
+           "Bad if clause at line %d:%s\n", lineno, opnt);
   return NULL;
 }
 
@@ -190,6+216,44 @@ static char * get_qstring(char *pnt, char ** labl)
   return pnt;
 }
 
+static char * parse_choices(struct kconfig * choice_kcfg, char * pnt)
+{
+  struct kconfig * kcfg;
+  int index = 1;
+
+  /*
+   * Choices appear in pairs of strings.  The parse is fairly trivial.
+   */
+  while(1)
+    {
+      pnt = skip_whitespace(pnt);
+      if(*pnt == '\0') break;
+
+      kcfg = (struct kconfig *) malloc(sizeof(struct kconfig));
+      memset(kcfg, 0, sizeof(struct kconfig));
+      kcfg->tok = tok_choice;
+      if( clast != NULL )
+       {
+         clast->next = kcfg;
+         clast = kcfg;
+       }
+      else
+       {
+         clast = config = kcfg;
+       }
+
+      pnt = get_string(pnt, &kcfg->label);
+      pnt = skip_whitespace(pnt);
+      pnt = get_string(pnt, &kcfg->optionname);
+      kcfg->choice_label = choice_kcfg;
+      kcfg->choice_value = index++;
+      if( strcmp(kcfg->label, choice_kcfg->value) == 0 )
+       choice_kcfg->choice_value = kcfg->choice_value;
+    }
+
+}
+
+
 /*
  * This function grabs one text token from the input buffer
  * and returns a pointer to a copy of just the identifier.
@@ -229,6+293,8 @@ static char * get_string(char *pnt, char ** labl)
 int parse(char * pnt) {
   enum token tok;
   struct kconfig * kcfg;
+  char tmpbuf[24];
+
   /*
    * Ignore comments and leading whitespace.
    */
@@ -260,11+326,26 @@ int parse(char * pnt) {
       tok = tok_menuoption;
       pnt += 15;
     }
+  else if      (strncmp(pnt, "$MAKE -C drivers/sound", 22) == 0) 
+    {
+      pnt += 22;
+      tok = tok_sound;
+    }
   else if (strncmp(pnt, "comment", 7) == 0) 
     {
       tok = tok_comment;
       pnt += 7;
     }
+  else if (strncmp(pnt, "choice", 6) == 0) 
+    {
+      tok = tok_choose;
+      pnt += 6;
+    }
+  else if (strncmp(pnt, "define_bool", 11) == 0) 
+    {
+      tok = tok_define;
+      pnt += 11;
+    }
   else if (strncmp(pnt, "bool", 4) == 0) 
     {
       tok = tok_bool;
@@ -303,7+384,13 @@ int parse(char * pnt) {
 
   if( tok == tok_unknown)
     {
-      printf("unknown command=%s\n", pnt);
+      if( clast != NULL && clast->tok == tok_if 
+         && strcmp(pnt,"then") == 0) return 0;
+      if( current_file != NULL )
+       fprintf(stderr, "unknown command=%s(%s %d)\n", pnt,
+               current_file, lineno);
+      else
+       fprintf(stderr, "unknown command=%s(%d)\n", pnt,lineno);
       return 1;
     }
 
@@ -332,6+419,25 @@ int parse(char * pnt) {
    */
   switch (tok)
     {
+    case tok_choose:
+      pnt = get_qstring(pnt, &kcfg->label);
+      pnt = get_qstring(pnt, &kcfg->optionname);
+      pnt = get_string(pnt, &kcfg->value);
+      /*
+       * Now we need to break apart the individual options into their
+       * own configuration structures.
+       */
+      parse_choices(kcfg, kcfg->optionname);
+      free(kcfg->optionname);
+      sprintf(tmpbuf, "tmpvar_%d", choose_number++);
+      kcfg->optionname = strdup(tmpbuf);
+      break;
+    case tok_define:
+      pnt = get_string(pnt, &kcfg->optionname);
+      if(*pnt == 'y' || *pnt == 'Y' ) kcfg->value = "1";
+      if(*pnt == 'n' || *pnt == 'N' ) kcfg->value = "0";
+      if(*pnt == 'm' || *pnt == 'M' ) kcfg->value = "2";
+      break;
     case tok_menuname:
       pnt = get_qstring(pnt, &kcfg->label);
       break;
@@ -340,12+446,10 @@ int parse(char * pnt) {
     case tok_int:
       pnt = get_qstring(pnt, &kcfg->label);
       pnt = get_string(pnt, &kcfg->optionname);
-      pnt = get_string(pnt, &kcfg->dflt);
       break;
     case tok_dep_tristate:
       pnt = get_qstring(pnt, &kcfg->label);
       pnt = get_string(pnt, &kcfg->optionname);
-      pnt = get_string(pnt, &kcfg->dflt);
       pnt = skip_whitespace(pnt);
       if( *pnt == '$') pnt++;
       pnt = get_string(pnt, &kcfg->depend.str);
@@ -371,6+475,7 @@ int parse(char * pnt) {
       break;
     case tok_else:
     case tok_fi:
+    case tok_sound:
       break;
     case tok_if:
       /*
@@ -432,55+537,78 @@ dump_if(struct condition * cond)
 static int do_source(char * filename)
 {
   char buffer[1024];
+  int  offset;
   int old_lineno;
+  char * old_file;
   char * pnt;
   FILE * infile;
 
-  infile = fopen(filename,"r");
+  if( strcmp(filename, "-") == 0 )
+    infile = stdin;
+  else
+    infile = fopen(filename,"r");
+
+  /*
+   * If our cwd was in the scripts directory, we might have to go up one
+   * to find the sourced file.
+   */
+  if(!infile) {
+    strcpy (buffer, "../");
+    strcat (buffer, filename);
+    infile = fopen(buffer,"r");
+  }
+
   if(!infile) {
     fprintf(stderr,"Unable to open file %s\n", filename);
     return 1;
   }
   old_lineno = lineno;
   lineno = 0;
-  current_file = filename;
-  while (fgets(buffer, sizeof(buffer), infile))
+  if( infile != stdin ) {
+    old_file = current_file;
+    current_file = filename;
+  }
+  offset = 0;
+  while(1)
     {
+      fgets(&buffer[offset], sizeof(buffer) - offset, infile);
+      if(feof(infile)) break;
+
       /*
        * Strip the trailing return character.
        */
       pnt = buffer + strlen(buffer) - 1;
-      if( *pnt == '\n') *pnt = 0;
+      if( *pnt == '\n') *pnt-- = 0;
       lineno++;
-      parse(buffer);
+      if( *pnt == '\\' )
+       {
+         offset = pnt - buffer;
+       }
+      else
+       {
+         parse(buffer);
+         offset = 0;
+       }
     }
   fclose(infile);
-  current_file = NULL;
+  if( infile != stdin ) {
+    current_file = old_file;
+  }
   lineno = old_lineno;
   return 0;
 }
 
 main(int argc, char * argv[])
 {
+  char buffer[1024];
   char * pnt;
   struct kconfig * cfg;
-  char buffer[1024];
   int    i;
 
   /*
-   * Loop over every input line, and parse it into the tables.
+   * Read stdin to get the top level script.
    */
-  while(fgets(buffer, sizeof(buffer), stdin))
-    {
-      /*
-       * Strip the trailing return character.
-       */
-      pnt = buffer + strlen(buffer) - 1;
-      if( *pnt == '\n') *pnt = 0;
-      lineno++;
-      parse(buffer);
-    }
-
+  do_source("-");
 
   if( menus_seen == 0 )
     {
@@ -558,7+686,7 @@ main(int argc, char * argv[])
        case tok_tristate:
        case tok_dep_tristate:
        case tok_int:
-         printf("%s %s %s\n", cfg->label, cfg->optionname, cfg->dflt);
+         printf("%s %s\n", cfg->label, cfg->optionname);
          break;
        case tok_if:
          dump_if(cfg->cond);
index 45d3ebd..a4c302f 100644 (file)
@@ -11,6+11,10 @@ enum token {
   tok_else, 
   tok_fi, 
   tok_int,
+  tok_sound,
+  tok_define,
+  tok_choose,
+  tok_choice,
   tok_unknown
 };
 
@@ -18,12+22,14 @@ enum operator {
   op_eq,
   op_neq,
   op_and,
+  op_and1,
   op_or,
   op_bang,
   op_lparen,
   op_rparen,
   op_variable,
   op_kvariable,
+  op_shellcmd,
   op_constant,
   op_nuked
 };
@@ -43,21+49,24 @@ struct condition
 
 #define GLOBAL_WRITTEN  1
 #define CFG_DUP        2
+#define UNSAFE         4
 
 struct kconfig
 {
-  struct kconfig * next;
-  int flags;
-  enum token tok;
-  char   menu_number;
-  char   menu_line;
-  char   submenu_start;
-  char   submenu_end;
-  char * optionname;
-  char * dflt;
-  char * label;
-  union var depend;
-  struct condition * cond;
+  struct kconfig       * next;
+  int                    flags;
+  enum                           token tok;
+  char                   menu_number;
+  char                   menu_line;
+  char                   submenu_start;
+  char                   submenu_end;
+  char                         * optionname;
+  char                         * label;
+  char                         * value;
+  int                    choice_value;
+  struct kconfig        * choice_label;
+  union var              depend;
+  struct condition     * cond;
 };
 
 extern struct kconfig * config;
diff --git a/versions.mk b/versions.mk
deleted file mode 100644 (file)
index 905a04f..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-ifdef CONFIG_MODVERSIONS
-TOPINCL := $(TOPDIR)/include/linux
-
-# Uses SYMTAB_OBJS
-# Separate the object into "normal" objects and "exporting" objects
-# Exporting objects are: all objects that define symbol tables
-#
-# Add dependence on $(SYMTAB_OBJS) to the main target
-#
-
-.SUFFIXES: .ver
-
-.c.ver:
-       @if [ ! -x /sbin/genksyms ]; then echo "Please read: README.modules"; fi
-       $(CC) $(CFLAGS) -E -DCONFIG_MODVERSIONS -D__GENKSYMS__ $< | /sbin/genksyms -w $(TOPINCL)/modules
-       @ln -sf $(TOPINCL)/modules/$@ .
-
-$(SYMTAB_OBJS): $(TOPINCL)/modversions.h
-       $(CC) $(CFLAGS) -DEXPORT_SYMTAB -c $(@:.o=.c)
-
-$(SYMTAB_OBJS:.o=.ver): $(TOPINCL)/autoconf.h
-
-$(TOPINCL)/modversions.h: $(SYMTAB_OBJS:.o=.ver)
-       @echo updating $(TOPINCL)/modversions.h
-       @(cd $(TOPINCL)/modules; for f in *.ver;\
-       do echo "#include <linux/modules/$${f}>"; done) \
-       > $(TOPINCL)/modversions.h
-
-fastdep: $(TOPINCL)/modversions.h
-
-endif
close