Date: Fri, 19 Jun 1998 00:48:20 +0200 (CEST)
From: Geert Uytterhoeven <Geert.Uytterhoeven@cs.kuleuven.ac.be>
To: Jes Sorensen <Jes.Sorensen@cern.ch>
cc: linux-m68k@lists.linux-m68k.org
Subject: Re: L68K: 2.1.106
In-Reply-To: <199806181234.OAA20575@valhall.cern.ch>
Sender: owner-linux-m68k@phil.uni-sb.de
Reply-To: Geert Uytterhoeven <Geert.Uytterhoeven@cs.kuleuven.ac.be>

On Thu, 18 Jun 1998, Jes Sorensen wrote:
> In order to keep you guys busy I have released 2.1.106, though it does
> not contain all the patches I received as I have been too busy with
> other things to look at all of them.

After merging in 2.1.106 I found these missing parts:

  - Partition format patches by Roman Hodek and Russell King
  - kbd_reset fix (Geert Stappers)
  - Andreas Schwab's fixes for 2.1.105 (incl. dmasound)
  - Tiny frame buffer things

The other things in my tree (not included in this patch) are APUS changes.
Any comments Jesper?

diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/Makefile m68k/Makefile
--- jes-2.1.106/Makefile	Thu Jun 18 20:52:51 1998
+++ m68k/Makefile	Thu Jun 18 21:55:17 1998
@@ -325,15 +325,16 @@
 		echo Installing modules under $$MODLIB/$$2; \
 	}; \
 	\
-	if [ -f BLOCK_MODULES ]; then inst_mod BLOCK_MODULES block; fi; \
-	if [ -f NET_MODULES   ]; then inst_mod NET_MODULES   net;   fi; \
-	if [ -f IPV4_MODULES  ]; then inst_mod IPV4_MODULES  ipv4;  fi; \
-	if [ -f IPV6_MODULES  ]; then inst_mod IPV6_MODULES  ipv6;  fi; \
-	if [ -f SCSI_MODULES  ]; then inst_mod SCSI_MODULES  scsi;  fi; \
-	if [ -f FS_MODULES    ]; then inst_mod FS_MODULES    fs;    fi; \
-	if [ -f NLS_MODULES   ]; then inst_mod NLS_MODULES   fs;    fi; \
-	if [ -f CDROM_MODULES ]; then inst_mod CDROM_MODULES cdrom; fi; \
-	if [ -f VIDEO_MODULES ]; then inst_mod VIDEO_MODULES video; fi; \
-	if [ -f HAM_MODULES   ]; then inst_mod HAM_MODULES   net;   fi; \
-	if [ -f SOUND_MODULES ]; then inst_mod SOUND_MODULES sound; fi; \
+	if [ -f BLOCK_MODULES  ]; then inst_mod BLOCK_MODULES  block;  fi; \
+	if [ -f NET_MODULES    ]; then inst_mod NET_MODULES    net;    fi; \
+	if [ -f IPV4_MODULES   ]; then inst_mod IPV4_MODULES   ipv4;   fi; \
+	if [ -f IPV6_MODULES   ]; then inst_mod IPV6_MODULES   ipv6;   fi; \
+	if [ -f SCSI_MODULES   ]; then inst_mod SCSI_MODULES   scsi;   fi; \
+	if [ -f FS_MODULES     ]; then inst_mod FS_MODULES     fs;     fi; \
+	if [ -f NLS_MODULES    ]; then inst_mod NLS_MODULES    fs;     fi; \
+	if [ -f PARTBL_MODULES ]; then inst_mod PARTBL_MODULES partbl; fi; \
+	if [ -f CDROM_MODULES  ]; then inst_mod CDROM_MODULES  cdrom;  fi; \
+	if [ -f VIDEO_MODULES  ]; then inst_mod VIDEO_MODULES  video;  fi; \
+	if [ -f HAM_MODULES    ]; then inst_mod HAM_MODULES    net;    fi; \
+	if [ -f SOUND_MODULES  ]; then inst_mod SOUND_MODULES  sound;  fi; \
 	\
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/arch/m68k/amiga/config.c m68k/arch/m68k/amiga/config.c
--- jes-2.1.106/arch/m68k/amiga/config.c	Thu Jun 18 20:52:52 1998
+++ m68k/arch/m68k/amiga/config.c	Thu Jun 18 21:56:17 1998
@@ -51,6 +55,7 @@
 /* amiga specific keyboard functions */
 extern int amiga_keyb_init(void);
 extern int amiga_kbdrate (struct kbd_repeat *);
+extern void amiga_kbd_reset_setup(char*, int);
 /* amiga specific irq functions */
 extern void amiga_init_IRQ (void);
 extern void (*amiga_default_handler[]) (int, void *, struct pt_regs *);
@@ -341,6 +346,7 @@
   mach_sched_init      = amiga_sched_init;
   mach_keyb_init       = amiga_keyb_init;
   mach_kbdrate         = amiga_kbdrate;
+  kbd_reset_setup      = amiga_kbd_reset_setup;
   mach_init_IRQ        = amiga_init_IRQ;
   mach_default_handler = &amiga_default_handler;
   mach_request_irq     = amiga_request_irq;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/arch/m68k/atari/atakeyb.c m68k/arch/m68k/atari/atakeyb.c
--- jes-2.1.106/arch/m68k/atari/atakeyb.c	Thu May 14 21:34:07 1998
+++ m68k/arch/m68k/atari/atakeyb.c	Sun Jun 14 22:18:24 1998
@@ -864,6 +864,6 @@
 }
 
 /* for "kbd-reset" cmdline param */
-__initfunc(void kbd_reset_setup(char *str, int *ints))
+__initfunc(void atari_kbd_reset_setup(char *str, int *ints))
 {
 }
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/arch/m68k/atari/config.c m68k/arch/m68k/atari/config.c
--- jes-2.1.106/arch/m68k/atari/config.c	Thu May 14 21:34:07 1998
+++ m68k/arch/m68k/atari/config.c	Sun Jun 14 22:18:24 1998
@@ -59,6 +59,7 @@
 extern int atari_keyb_init(void);
 extern int atari_kbdrate (struct kbd_repeat *);
 extern void atari_kbd_leds (unsigned int);
+extern void atari_kbd_reset_setup(char*, int);
 /* atari specific irq functions */
 extern void atari_init_IRQ (void);
 extern int atari_request_irq (unsigned int irq, void (*handler)(int, void *, struct pt_regs *),
@@ -249,6 +250,7 @@
     mach_keyb_init       = atari_keyb_init;
     mach_kbdrate         = atari_kbdrate;
     mach_kbd_leds        = atari_kbd_leds;
+    kbd_reset_setup      = atari_kbd_reset_setup;
     mach_init_IRQ        = atari_init_IRQ;
     mach_request_irq     = atari_request_irq;
     mach_free_irq        = atari_free_irq;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/arch/m68k/kernel/m68k_ksyms.c m68k/arch/m68k/kernel/m68k_ksyms.c
--- jes-2.1.106/arch/m68k/kernel/m68k_ksyms.c	Mon Jun  8 20:45:27 1998
+++ m68k/arch/m68k/kernel/m68k_ksyms.c	Sun Jun 14 22:20:25 1998
@@ -1,4 +1,3 @@
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/linkage.h>
 #include <linux/sched.h>
@@ -8,7 +7,6 @@
 #include <linux/elfcore.h>
 #include <linux/in6.h>
 #include <linux/interrupt.h>
-#include <linux/pci.h>
 
 #include <asm/setup.h>
 #include <asm/machdep.h>
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/arch/m68k/kernel/setup.c m68k/arch/m68k/kernel/setup.c
--- jes-2.1.106/arch/m68k/kernel/setup.c	Mon Jun  8 20:45:27 1998
+++ m68k/arch/m68k/kernel/setup.c	Sun Jun 14 22:18:24 1998
@@ -61,6 +68,8 @@
 int (*mach_keyb_init) (void) __initdata;
 int (*mach_kbdrate) (struct kbd_repeat *) = NULL;
 void (*mach_kbd_leds) (unsigned int) = NULL;
+/* machine dependent "kbd-reset" setup function */
+void (*kbd_reset_setup) (char *, int) __initdata = NULL;
 /* machine dependent irq functions */
 void (*mach_init_IRQ) (void) __initdata;
 void (*(*mach_default_handler)[]) (int, void *, struct pt_regs *) = NULL;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/arch/m68k/mac/config.c m68k/arch/m68k/mac/config.c
--- jes-2.1.106/arch/m68k/mac/config.c	Mon Jun  8 20:45:27 1998
+++ m68k/arch/m68k/mac/config.c	Sun Jun 14 22:18:24 1998
@@ -60,23 +60,40 @@
 /* The phys. video addr. - might be bogus on some machines */
 unsigned long mac_orig_videoaddr;
 
+/* Mac specific keyboard functions */
 extern int mac_keyb_init(void);
 extern int mac_kbdrate(struct kbd_repeat *k);
 extern void mac_kbd_leds(unsigned int leds);
+extern void mac_kbd_reset_setup(char*, int);
+
+/* Mac specific irq functions */
+extern void mac_init_IRQ (void);
+extern void (*mac_handlers[]) (int, void *, struct pt_regs *);
+extern int mac_request_irq (unsigned int irq,
+			    void (*handler)(int, void *, struct pt_regs *),
+                            unsigned long flags, const char *devname,
+			    void *dev_id);
+extern void mac_free_irq (unsigned int irq, void *dev_id);
+extern void mac_enable_irq (unsigned int);
+extern void mac_disable_irq (unsigned int);
+static void mac_get_model(char *model);
+/*static int mac_get_hardware_list(char *buffer);*/
+extern int mac_get_irq_list (char *);
+
+/* Mac specific timer functions */
+extern void mac_gettod (int *, int *, int *, int *, int *, int *);
+extern void via_init_clock(void (*func)(int, void *, struct pt_regs *));
 
 extern void (*kd_mksound)(unsigned int, unsigned int);
 extern void mac_mksound(unsigned int, unsigned int);
 extern int mac_floppy_init(void);
 extern void mac_floppy_setup(char *,int *);
 
-extern void mac_gettod (int *, int *, int *, int *, int *, int *);
-
 extern void nubus_sweep_video(void);
-extern void via_init_clock(void (*func)(int, void *, struct pt_regs *));
-extern void mac_debugging_long(int, long);
 
 /* Mac specific debug functions (in debug.c) */
 extern void mac_debug_init(void);
+extern void mac_debugging_long(int, long);
 
 #ifdef CONFIG_MAGIC_SYSRQ
 
@@ -258,6 +275,7 @@
     mach_keyb_init       = mac_keyb_init;
     mach_kbdrate         = mac_kbdrate;
     mach_kbd_leds        = mac_kbd_leds;
+    kbd_reset_setup      = mac_kbd_reset_setup;
     mach_init_IRQ        = mac_init_IRQ;
     mach_request_irq     = mac_request_irq;
     mach_free_irq        = mac_free_irq;
@@ -495,7 +513,7 @@
 	 * Report booter data:
 	 */
 	printk (" Penguin bootinfo data:\n");
-	printk (" Video: addr 0x%lx row 0x%lx depth %lx dimensions %d x %d\n", 
+	printk (" Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n", 
 		mac_bi_data.videoaddr, mac_bi_data.videorow, 
 		mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF, 
 		mac_bi_data.dimensions >> 16); 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/arch/m68k/mac/mackeyb.c m68k/arch/m68k/mac/mackeyb.c
--- jes-2.1.106/arch/m68k/mac/mackeyb.c	Thu May 14 21:34:08 1998
+++ m68k/arch/m68k/mac/mackeyb.c	Sun Jun 14 22:18:24 1998
@@ -750,3 +750,8 @@
 
 	return 0;
 }
+
+/* for "kbd-reset" cmdline param */
+__initfunc(void mac_kbd_reset_setup(char *str, int *ints))
+{
+}
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/drivers/block/Makefile m68k/drivers/block/Makefile
--- jes-2.1.106/drivers/block/Makefile	Mon Jun  8 20:45:34 1998
+++ m68k/drivers/block/Makefile	Sun Jun 14 22:23:52 1998
@@ -28,54 +28,6 @@
 
 IDE_OBJS :=
 
-ifeq ($(CONFIG_MSDOS_PARTITION),y)
-  L_OBJS += partbl_msdos.o
-else
-  ifeq ($(CONFIG_MSDOS_PARTITION),m)
-    M_OBJS += partbl_msdos.o
-  endif
-endif
-
-ifeq ($(CONFIG_OSF_PARTITION),y)
-  L_OBJS += partbl_osf.o
-else
-  ifeq ($(CONFIG_OSF_PARTITION),m)
-    M_OBJS += partbl_osf.o
-  endif
-endif
-
-ifeq ($(CONFIG_SUN_PARTITION),y)
-  L_OBJS += partbl_sun.o
-else
-  ifeq ($(CONFIG_SUN_PARTITION),m)
-    M_OBJS += partbl_sun.o
-  endif
-endif
-
-ifeq ($(CONFIG_AMIGA_PARTITION),y)
-  L_OBJS += partbl_amiga.o
-else
-  ifeq ($(CONFIG_AMIGA_PARTITION),m)
-    M_OBJS += partbl_amiga.o
-  endif
-endif
-
-ifeq ($(CONFIG_ATARI_PARTITION),y)
-  L_OBJS += partbl_atari.o
-else
-  ifeq ($(CONFIG_ATARI_PARTITION),m)
-    M_OBJS += partbl_atari.o
-  endif
-endif
-
-ifeq ($(CONFIG_MAC_PARTITION),y)
-  L_OBJS += partbl_mac.o
-else
-  ifeq ($(CONFIG_MAC_PARTITION),m)
-    M_OBJS += partbl_mac.o
-  endif
-endif
-
 ifeq ($(CONFIG_MAC_FLOPPY),y)
 L_OBJS += swim3.o
 endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/drivers/block/genhd.c m68k/drivers/block/genhd.c
--- jes-2.1.106/drivers/block/genhd.c	Tue Mar 24 19:03:50 1998
+++ m68k/drivers/block/genhd.c	Sun Jun 14 22:23:52 1998
@@ -17,8 +17,8 @@
  *
  *  Check partition table on IDE disks for common CHS translations
  *
- *  Moved partition table parsers into separate files and modularized them
- *  (10/08/97 Roman Hodek)
+ *  Moved partition table parsers to fs/partitions and modularized them
+ *  (10/08/97 Roman Hodek, Russell King)
  */
 
 #include <linux/config.h>
@@ -30,15 +30,16 @@
 #include <linux/string.h>
 #include <linux/blk.h>
 #include <linux/init.h>
-#ifdef CONFIG_PROC_FS
-#include <linux/proc_fs.h>
-#endif
 
 #include <asm/system.h>
 
+/* defined in fs/partitions/check.c */
+extern void partbl_init( void );
+extern void check_partition(struct gendisk *hd, kdev_t dev, int first_minor);
+
+
 struct gendisk *gendisk_head = NULL;
 
-int current_minor = 0;
 extern int *blk_size[];
 extern void rd_load(void);
 extern void initrd_load(void);
@@ -48,362 +49,6 @@
 extern int scsi_dev_init(void);
 extern int net_dev_init(void);
 
-struct partition_parser *partition_parsers = NULL;
-
-/*
- * disk_name() is used by genhd.c and md.c.
- * It formats the devicename of the indicated disk
- * into the supplied buffer, and returns a pointer
- * to that same buffer (for convenience).
- */
-char *disk_name (struct gendisk *hd, int minor, char *buf)
-{
-	unsigned int part;
-	const char *maj = hd->major_name;
-	char unit = (minor >> hd->minor_shift) + 'a';
-
-	/*
-	 * IDE devices use multiple major numbers, but the drives
-	 * are named as:  {hda,hdb}, {hdc,hdd}, {hde,hdf}, {hdg,hdh}..
-	 * This requires special handling here.
-	 */
-	switch (hd->major) {
-		case IDE3_MAJOR:
-			unit += 2;
-		case IDE2_MAJOR:
-			unit += 2;
-		case IDE1_MAJOR:
-			unit += 2;
-		case IDE0_MAJOR:
-			maj = "hd";
-	}
-	part = minor & ((1 << hd->minor_shift) - 1);
-	if (part)
-		sprintf(buf, "%s%c%d", maj, unit, part);
-	else
-		sprintf(buf, "%s%c", maj, unit);
-	return buf;
-}
-
-void add_partition (struct gendisk *hd, int minor, int start, int size)
-{
-	char buf[8];
-	hd->part[minor].start_sect = start;
-	hd->part[minor].nr_sects   = size;
-	printk(" %s", disk_name(hd, minor, buf));
-}
-
-unsigned int get_ptable_blocksize(kdev_t dev)
-{
-  int ret = 1024;
-
-  /*
-   * See whether the low-level driver has given us a minumum blocksize.
-   * If so, check to see whether it is larger than the default of 1024.
-   */
-  if (!blksize_size[MAJOR(dev)])
-    {
-      return ret;
-    }
-
-  /*
-   * Check for certain special power of two sizes that we allow.
-   * With anything larger than 1024, we must force the blocksize up to
-   * the natural blocksize for the device so that we don't have to try
-   * and read partial sectors.  Anything smaller should be just fine.
-   */
-  switch( blksize_size[MAJOR(dev)][MINOR(dev)] )
-    {
-    case 2048:
-      ret = 2048;
-      break;
-    case 4096:
-      ret = 4096;
-      break;
-    case 8192:
-      ret = 8192;
-      break;
-    case 1024:
-    case 512:
-    case 256:
-    case 0:
-      /*
-       * These are all OK.
-       */
-      break;
-    default:
-      panic("Strange blocksize for partition table\n");
-    }
-
-  return ret;
-
-}
-
-
-#if CONFIG_KERNELD && CONFIG_FOREIGN_PARTITIONS
-
-#include <linux/kerneld.h>
-
-#ifdef CONFIG_AMIGA_PARTITION_MODULE
-#include <linux/affs_hardblocks.h>
-static int probe_amiga_partition(struct gendisk *hd, kdev_t dev,
-				 struct buffer_head *bh_0)
-{
-	struct buffer_head *bh;
-	int blk, res;
-
-	if (*(u32 *)bh_0->b_data == cpu_to_be32(IDNAME_RIGIDDISK))
-		return 1;
-
-	/* also need to check other possible RDB blocks */
-	for (blk = 1; blk < RDB_ALLOCATION_LIMIT; blk++) {
-		if (!(bh = bread(dev,blk,512)))
-			return -1;
-		res = *(u32 *)bh->b_data == cpu_to_be32(IDNAME_RIGIDDISK);
-		brelse(bh);
-		if (res)
-			return 1;
-	}
-	return 0;
-}
-#endif
-
-#ifdef CONFIG_ATARI_PARTITION_MODULE
-#include <linux/atari_rootsec.h>
-#include <linux/ctype.h>
-#define	VALID_PARTITION(pi,hdsiz)					     \
-    (((pi)->flg & 1) &&							     \
-     isalnum((pi)->id[0]) && isalnum((pi)->id[1]) && isalnum((pi)->id[2]) && \
-     be32_to_cpu((pi)->st) <= (hdsiz) &&				     \
-     be32_to_cpu((pi)->st) + be32_to_cpu((pi)->siz) <= (hdsiz))
-static int probe_atari_partition(struct gendisk *hd, kdev_t dev,
-				 struct buffer_head *bh_0)
-{
-	struct rootsector *rs;
-	u32 hd_size;
-	int res;
-
-	rs = (struct rootsector *)bh_0->b_data;
-	hd_size = hd->part[0].nr_sects;
-	res = VALID_PARTITION( &rs->part[0], hd_size ) ||
-	      VALID_PARTITION( &rs->part[1], hd_size ) ||
-	      VALID_PARTITION( &rs->part[2], hd_size ) ||
-	      VALID_PARTITION( &rs->part[3], hd_size );
-	return res;
-}
-#endif
-
-/*
- * This table lists the magics to recognize the partition formats that are
- * availble as modules. The magics can be stored as 16 or 32 bit little-endian
- * or big-endian numbers. For the more complicated cases (Amiga and Atari), a
- * function doing the real work is called.
- */
-
-enum partbl_probe_type { BE16, BE32, LE16, LE32, FUNC };
-
-static struct partbl_probe {
-	char *name;
-	enum partbl_probe_type type;
-	u32 offset;
-	u32 magic;
-	int (*func)(struct gendisk *hd, kdev_t dev, struct buffer_head *bh_0);
-} partbl_modules[] = {
-#ifdef CONFIG_MSDOS_PARTITION_MODULE
-	{ "msdos", LE16, 510, 0xAA55, NULL },
-#endif
-#ifdef CONFIG_OSF_PARTITION_MODULE
-	{ "osf",   LE32,  64, 0x82564557, NULL },
-#endif
-#ifdef CONFIG_SUN_PARTITION_MODULE
-	{ "sun",   BE16, 508, 0xDABE, NULL },
-#endif
-#ifdef CONFIG_AMIGA_PARTITION_MODULE
-	{ "amiga", FUNC,   0,      0, probe_amiga_partition },
-#endif
-#ifdef CONFIG_ATARI_PARTITION_MODULE
-	{ "atari", FUNC,   0,      0, probe_atari_partition },
-#endif
-#ifdef CONFIG_MAC_PARTITION_MODULE
-	{ "mac",   BE16,   0, 0x4552, NULL },
-#endif
-};
-
-#define N_PARTBL_MODULES sizeof(partbl_modules)/sizeof(*partbl_modules)
-
-/*
- * Try to load all partition parsers that could apply to this device
- */
-static int try_to_load_parser(struct gendisk *hd, kdev_t dev)
-{
-	int i, hit = 0, loaded = 0;
-	char modname[24];
-	struct partbl_probe *mod;
-	struct partition_parser *p;
-	struct buffer_head *bh;
-
-	if (!(bh = bread(dev,0,get_ptable_blocksize(dev))))
-		return -1;
-
-	for( i = 0, mod = partbl_modules; i < N_PARTBL_MODULES; ++i, ++mod ) {
-		/* don't probe already loaded formats again */
-		for( p = partition_parsers; p; p = p->next )
-			if (!strcmp( mod->name, p->name))
-				goto skip;
-		
-		switch( mod->type ) {
-		    case LE16:
-			hit = le16_to_cpu(*(u16 *)(bh->b_data+mod->offset)) ==
-			      mod->magic;
-			break;
-		    case LE32:
-			hit = le32_to_cpu(*(u32 *)(bh->b_data+mod->offset)) ==
-			      mod->magic;
-			break;
-		    case BE16:
-			hit = be16_to_cpu(*(u16 *)(bh->b_data+mod->offset)) ==
-			      mod->magic;
-			break;
-		    case BE32:
-			hit = be32_to_cpu(*(u32 *)(bh->b_data+mod->offset)) ==
-			      mod->magic;
-			break;
-		    case FUNC:
-			hit = mod->func(hd, dev, bh) > 0;
-			break;
-		}
-		if (hit) {
-			strcpy(modname, "part-format-");
-			strcat(modname, mod->name);
-			request_module(modname);
-			++loaded;
-		}
-	    skip:
-	}
-	brelse(bh);
-	return loaded;
-}
-
-#endif /* CONFIG_KERNELD && CONFIG_FOREIGN_PARTITIONS */
-
-
-static void check_partition(struct gendisk *hd, kdev_t dev)
-{
-	static int first_time = 1;
-	int tries = 0;
-	unsigned long first_sector;
-	char buf[8];
-	struct partition_parser *parser;
-
-	if (first_time)
-		printk("Partition check:\n");
-	first_time = 0;
-	first_sector = hd->part[MINOR(dev)].start_sect;
-
-	/*
-	 * This is a kludge to allow the partition check to be
-	 * skipped for specific drives (e.g. IDE cd-rom drives)
-	 */
-	if ((int)first_sector == -1) {
-		hd->part[MINOR(dev)].start_sect = 0;
-		return;
-	}
-
-#if CONFIG_KERNELD && CONFIG_FOREIGN_PARTITIONS
-    retry:
-#endif
-	printk(" %s:", disk_name(hd, MINOR(dev), buf));
-	for( parser = partition_parsers; parser; parser = parser->next ) {
-		if (parser->func(hd, dev, first_sector))
-			return;
-	}
-	++tries;
-#if CONFIG_KERNELD && CONFIG_FOREIGN_PARTITIONS
-	if (tries == 1 && try_to_load_parser(hd, dev))
-		goto retry;
-#endif
-	printk(" unknown partition table\n");
-}
-
-int register_partbl( struct partition_parser *parser )
-{
-	struct partition_parser **p;
-    
-	if (!parser)
-		return -EINVAL;
-	if (parser->next)
-		return -EBUSY;
-	for( p = &partition_parsers; *p; p = &(*p)->next )
-		if (*p == parser)
-			return -EBUSY;
-
-	/* Insert new parser at front of list, so that a user-loaded module can
-	 * (in case of some misdetection) override other parsers */
-	parser->next = partition_parsers;
-	partition_parsers = parser;
-	return 0;
-}
-
-#ifdef CONFIG_MODULES
-int unregister_partbl( struct partition_parser *parser )
-{
-	struct partition_parser **p;
-    
-	for( p = &partition_parsers; *p; p = &(*p)->next ) {
-		if (*p == parser) {
-			*p = parser->next;
-			parser->next = NULL;
-			return 0;
-		}
-	}
-	return -EINVAL;
-}
-#endif
-
-#ifdef CONFIG_PROC_FS
-static struct proc_dir_entry *proc_partbl;
-
-static int partbl_read_proc(char *buf, char **start, off_t offset,
-			    int len, int *eof, void *private)
-{
-	struct partition_parser *p;
-
-	len = 0;
-	for( p = partition_parsers; p && len < 4000; p = p->next )
-		len += sprintf(buf + len, "%s\n", p->name );
-	*start = buf + offset;
-	return len > offset ? len - offset : 0;
-}
-#endif
-
-__initfunc(static void partbl_init( void ))
-{
-	extern void msdos_partbl_init(void);
-	extern void osf_partbl_init(void);
-	extern void sun_partbl_init(void);
-	extern void amiga_partbl_init(void);
-	extern void atari_partbl_init(void);
-	extern void mac_partbl_init(void);
-    
-	if (HAVE_MAC_PARTITION)
-		mac_partbl_init();
-	if (HAVE_ATARI_PARTITION)
-		atari_partbl_init();
-	if (HAVE_AMIGA_PARTITION)
-		amiga_partbl_init();
-	if (HAVE_SUN_PARTITION)
-		sun_partbl_init();
-	if (HAVE_OSF_PARTITION)
-		osf_partbl_init();
-	if (HAVE_MSDOS_PARTITION)
-		msdos_partbl_init();
-
-#ifdef CONFIG_PROC_FS
-	proc_partbl = create_proc_entry("partition-formats", 0, 0);
-	if (proc_partbl)
-		proc_partbl->read_proc = partbl_read_proc;
-#endif
-}
 
 /* This function is used to re-read partition tables for removable disks.
    Much of the cleanup from the old partition tables should have already been
@@ -421,8 +66,7 @@
 	int end_minor	= first_minor + dev->max_p;
 
 	blk_size[dev->major] = NULL;
-	current_minor = 1 + first_minor;
-	check_partition(dev, MKDEV(dev->major, first_minor));
+	check_partition(dev, MKDEV(dev->major, first_minor), 1 + first_minor);
 
  	/*
  	 * We need to set the sizes array before we will be able to access
@@ -448,8 +92,7 @@
 	dev->init(dev);	
 	for (drive = 0 ; drive < dev->nr_real ; drive++) {
 		int first_minor	= drive << dev->minor_shift;
-		current_minor = 1 + first_minor;
-		check_partition(dev, MKDEV(dev->major, first_minor));
+		check_partition(dev, MKDEV(dev->major, first_minor), 1 + first_minor);
 	}
 	if (dev->sizes != NULL) {	/* optional safeguard in ll_rw_blk.c */
 		for (i = 0; i < end_minor; i++)
@@ -502,10 +145,3 @@
         md_setup_drive();
 #endif
 }
-
-/* symbols visible for partbl_* modules */
-EXPORT_SYMBOL(add_partition);
-EXPORT_SYMBOL(get_ptable_blocksize);
-EXPORT_SYMBOL(current_minor);
-EXPORT_SYMBOL(register_partbl);
-EXPORT_SYMBOL(unregister_partbl);
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/drivers/block/ll_rw_blk.c m68k/drivers/block/ll_rw_blk.c
--- jes-2.1.106/drivers/block/ll_rw_blk.c	Thu Jun 18 20:52:53 1998
+++ m68k/drivers/block/ll_rw_blk.c	Thu Jun 18 21:57:21 1998
@@ -584,7 +584,9 @@
 
 	/* Verify requested block sizes.  */
 	for (i = 0; i < nr; i++) {
-		if (bh[i] && bh[i]->b_size != correct_size) {
+		if (!bh[i])
+			continue;
+		if (bh[i]->b_size != correct_size) {
 			printk(KERN_NOTICE "ll_rw_block: device %s: "
 			       "only %d-char blocks implemented (%lu)\n",
 			       kdevname(bh[0]->b_dev),
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/drivers/block/partbl_amiga.c m68k/drivers/block/partbl_amiga.c
--- jes-2.1.106/drivers/block/partbl_amiga.c	Sun Feb  8 22:32:52 1998
+++ m68k/drivers/block/partbl_amiga.c	Thu Jan  1 01:00:00 1970
@@ -1,121 +0,0 @@
-/*
- *  partbl_amiga.c -- Amiga RDSK partition table parser
- *
- *  Code extracted from
- *  linux/drivers/block/genhd.c
- *
- */
-
-#include <linux/module.h>
-
-#include <linux/fs.h>
-#include <linux/genhd.h>
-#include <linux/kernel.h>
-#include <linux/major.h>
-#include <linux/string.h>
-#include <linux/init.h>
-#include <linux/affs_hardblocks.h>
-#include <asm/byteorder.h>
-
-static __inline__ u32
-checksum_block(u32 *m, int size)
-{
-	u32 sum = 0;
-
-	while (size--)
-		sum += be32_to_cpu(*m++);
-	return sum;
-}
-
-static int
-amiga_partition(struct gendisk *hd, kdev_t dev, unsigned long first_sector)
-{
-	struct buffer_head	*bh;
-	struct RigidDiskBlock	*rdb;
-	struct PartitionBlock	*pb;
-	int			 start_sect;
-	int			 nr_sects;
-	int			 blk;
-	int			 part, res;
-
-	MOD_INC_USE_COUNT;
-	set_blocksize(dev,512);
-	res = 0;
-
-	for (blk = 0; blk < RDB_ALLOCATION_LIMIT; blk++) {
-		if(!(bh = bread(dev,blk,512))) {
-			printk("Dev %s: unable to read RDB block %d\n",
-			       kdevname(dev),blk);
-			res = -1;
-			goto rdb_done;
-		}
-		if (*(u32 *)bh->b_data == cpu_to_be32(IDNAME_RIGIDDISK)) {
-			rdb = (struct RigidDiskBlock *)bh->b_data;
-			if (checksum_block((u32 *)bh->b_data,be32_to_cpu(rdb->rdb_SummedLongs) & 0x7F)) {
-				printk("Dev %s: RDB in block %d has bad checksum\n",
-				       kdevname(dev),blk);
-				brelse(bh);
-				continue;
-			}
-			printk(" RDSK");
-			blk = be32_to_cpu(rdb->rdb_PartitionList);
-			brelse(bh);
-			for (part = 1; blk > 0 && part <= 16; part++) {
-				if (!(bh = bread(dev,blk,512))) {
-					printk("Dev %s: unable to read partition block %d\n",
-						       kdevname(dev),blk);
-					res = -1;
-					goto rdb_done;
-				}
-				pb  = (struct PartitionBlock *)bh->b_data;
-				blk = be32_to_cpu(pb->pb_Next);
-				if (pb->pb_ID == cpu_to_be32(IDNAME_PARTITION) && checksum_block(
-				    (u32 *)pb,be32_to_cpu(pb->pb_SummedLongs) & 0x7F) == 0 ) {
-					
-					/* Tell Kernel about it */
-
-					if (!(nr_sects = (be32_to_cpu(pb->pb_Environment[10]) + 1 -
-							  be32_to_cpu(pb->pb_Environment[9])) *
-							 be32_to_cpu(pb->pb_Environment[3]) *
-							 be32_to_cpu(pb->pb_Environment[5]))) {
-						continue;
-					}
-					start_sect = be32_to_cpu(pb->pb_Environment[9]) *
-						     be32_to_cpu(pb->pb_Environment[3]) *
-						     be32_to_cpu(pb->pb_Environment[5]);
-					add_partition(hd,current_minor,start_sect,nr_sects);
-					current_minor++;
-					res = 1;
-				}
-				brelse(bh);
-			}
-			printk("\n");
-			break;
-		}
-	}
-
-rdb_done:
-	set_blocksize(dev,BLOCK_SIZE);
-	MOD_DEC_USE_COUNT;
-	return res;
-}
-
-static struct partition_parser amiga_partition_parser =
-    { NULL, "amiga", amiga_partition };
-
-#ifndef MODULE
-__initfunc(void amiga_partbl_init( void ))
-{
-	(void)register_partbl( &amiga_partition_parser );
-}
-#else
-int init_module(void)
-{
-	return register_partbl( &amiga_partition_parser );
-}
-
-void cleanup_module(void)
-{
-	(void)unregister_partbl( &amiga_partition_parser );
-}
-#endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/drivers/block/partbl_atari.c m68k/drivers/block/partbl_atari.c
--- jes-2.1.106/drivers/block/partbl_atari.c	Sun Feb  8 22:32:52 1998
+++ m68k/drivers/block/partbl_atari.c	Thu Jan  1 01:00:00 1970
@@ -1,203 +0,0 @@
-/*
- *  partbl_atari.c -- Atari partition table parser
- *
- *  Code extracted from
- *  linux/drivers/block/genhd.c
- *
- */
-
-#include <linux/module.h>
-
-#include <linux/fs.h>
-#include <linux/genhd.h>
-#include <linux/kernel.h>
-#include <linux/major.h>
-#include <linux/string.h>
-#include <linux/ctype.h>
-#include <linux/init.h>
-#include <linux/atari_rootsec.h>
-#include <asm/byteorder.h>
-
-
-/* ++guenther: this should be settable by the user ("make config")?.
- * roman: doesn't use much code, better always include it :-)
- */
-#define ICD_PARTS
-
-/* check if a partition entry looks valid -- Atari format is assumed if at
- * least one of the primary entries is ok this way */
-#define	VALID_PARTITION(pi,hdsiz)					     \
-    (((pi)->flg & 1) &&							     \
-     isalnum((pi)->id[0]) && isalnum((pi)->id[1]) && isalnum((pi)->id[2]) && \
-     be32_to_cpu((pi)->st) <= (hdsiz) &&				     \
-     be32_to_cpu((pi)->st) + be32_to_cpu((pi)->siz) <= (hdsiz))
-
-static int atari_partition (struct gendisk *hd, kdev_t dev,
-			    unsigned long first_sector)
-{
-  int minor = current_minor, m_lim = current_minor + hd->max_p;
-  int i;
-  struct buffer_head *bh;
-  struct rootsector *rs;
-  struct partition_info *pi;
-  u32 extensect;
-  u32 hd_size;
-#ifdef ICD_PARTS
-  int part_fmt = 0; /* 0:unknown, 1:AHDI, 2:ICD/Supra */
-#endif
-
-  MOD_INC_USE_COUNT;
-  bh = bread (dev, 0, get_ptable_blocksize(dev));
-  if (!bh)
-    {
-      printk (" unable to read block 0\n");
-      MOD_DEC_USE_COUNT;
-      return -1;
-    }
-
-  rs = (struct rootsector *) bh->b_data;
-  hd_size = hd->part[current_minor-1].nr_sects;
-  if (!VALID_PARTITION( &rs->part[0], hd_size ) &&
-      !VALID_PARTITION( &rs->part[1], hd_size ) &&
-      !VALID_PARTITION( &rs->part[2], hd_size ) &&
-      !VALID_PARTITION( &rs->part[3], hd_size )) {
-      /* if there's no valid primary partition, assume that no Atari format
-       * partition table (there's no reliable magic or the like :-() */
-      MOD_DEC_USE_COUNT;
-      return 0;
-  }
-
-  printk (" AHDI");
-  pi = &rs->part[0];
-  for (; pi < &rs->part[4] && minor < m_lim; minor++, pi++)
-    {
-      if (pi->flg & 1)
-	/* active partition */
-	{
-	  if (memcmp (pi->id, "XGM", 3) == 0)
-	    /* extension partition */
-	    {
-	      struct rootsector *xrs;
-	      struct buffer_head *xbh;
-	      u32 partsect;
-
-#ifdef ICD_PARTS
-	      part_fmt = 1;
-#endif
-	      printk(" XGM<");
-	      partsect = extensect = be32_to_cpu(pi->st);
-	      while (1)
-		{
-		  xbh = bread (dev, partsect / 2, 1024);
-		  if (!xbh)
-		    {
-		      printk (" block %u read failed\n", partsect);
-		      brelse(bh);
-		      MOD_DEC_USE_COUNT;
-		      return -1;
-		    }
-		  if (partsect & 1)
-		    xrs = (struct rootsector *) &xbh->b_data[512];
-		  else
-		    xrs = (struct rootsector *) &xbh->b_data[0];
-
-		  /* ++roman: valid bit must be set in one of the first 3
-		   * slots */
-		  for( i = 0; i < 3; ++i )
-		      if (xrs->part[0].flg & 1)
-			  break;
-		  if (i == 3) {
-		    printk( "\nNo valid subpartition in extended "
-			    "partition!\n" );
-		    break;
-		  }
-		  
-		  add_partition(hd, minor,
-				partsect + be32_to_cpu(xrs->part[i].st),
-				be32_to_cpu(xrs->part[i].siz));
-
-		  /* the slot following must be either invalid (end of list)
-		   * or another XGM entry */
-		  if (!(xrs->part[i+1].flg & 1)) {
-		    brelse( xbh );
-		    break;
-		  }
-		  if (memcmp( xrs->part[i+1].id, "XGM", 3 ) != 0) {
-		    printk( "\nLink ID in extended partition is not XGM!\n" );
-		    brelse( xbh );
-		    break;
-		  }
-
-		  partsect = be32_to_cpu(xrs->part[i+1].st) + extensect;
-		  brelse (xbh);
-		  minor++;
-		  if (minor >= m_lim) {
-		    printk( "\nMaximum number of partitions reached!\n" );
-		    break;
-		  }
-		}
-	      printk(" >");
-	    }
-	  else
-	    {
-	      /* we don't care about other id's */
-	      add_partition (hd, minor, be32_to_cpu(pi->st),
-			     be32_to_cpu(pi->siz));
-	    }
-	}
-    }
-#ifdef ICD_PARTS
-  if ( part_fmt!=1 ) /* no extended partitions -> test ICD-format */
-  {
-    pi = &rs->icdpart[0];
-    /* sanity check: no ICD format if first partition invalid */
-    if (memcmp (pi->id, "GEM", 3) == 0 ||
-        memcmp (pi->id, "BGM", 3) == 0 ||
-        memcmp (pi->id, "LNX", 3) == 0 ||
-        memcmp (pi->id, "SWP", 3) == 0 ||
-        memcmp (pi->id, "RAW", 3) == 0 )
-    {
-      printk(" ICD<");
-      for (; pi < &rs->icdpart[8] && minor < m_lim; minor++, pi++)
-      {
-        /* accept only GEM,BGM,RAW,LNX,SWP partitions */
-        if (pi->flg & 1 && 
-            (memcmp (pi->id, "GEM", 3) == 0 ||
-             memcmp (pi->id, "BGM", 3) == 0 ||
-             memcmp (pi->id, "LNX", 3) == 0 ||
-             memcmp (pi->id, "SWP", 3) == 0 ||
-             memcmp (pi->id, "RAW", 3) == 0) )
-        {
-          part_fmt = 2;
-	  add_partition (hd, minor, be32_to_cpu(pi->st), be32_to_cpu(pi->siz));
-        }
-      }
-      printk(" >");
-    }
-  }
-#endif
-  brelse (bh);
-  printk ("\n");
-  MOD_DEC_USE_COUNT;
-  return 1;
-}
-
-static struct partition_parser atari_partition_parser =
-    { NULL, "atari", atari_partition };
-
-#ifndef MODULE
-__initfunc(void atari_partbl_init( void ))
-{
-	(void)register_partbl( &atari_partition_parser );
-}
-#else
-int init_module(void)
-{
-	return register_partbl( &atari_partition_parser );
-}
-
-void cleanup_module(void)
-{
-	(void)unregister_partbl( &atari_partition_parser );
-}
-#endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/drivers/block/partbl_mac.c m68k/drivers/block/partbl_mac.c
--- jes-2.1.106/drivers/block/partbl_mac.c	Sun Feb  8 22:32:52 1998
+++ m68k/drivers/block/partbl_mac.c	Thu Jan  1 01:00:00 1970
@@ -1,170 +0,0 @@
-/*
- *  partbl_mac.c -- Mac partition table parser
- *
- *  Code extracted from
- *  linux/drivers/block/genhd.c
- *
- */
-
-#include <linux/module.h>
-
-#include <linux/config.h>
-#include <linux/fs.h>
-#include <linux/genhd.h>
-#include <linux/kernel.h>
-#include <linux/major.h>
-#include <linux/string.h>
-#include <linux/ctype.h>
-#include <linux/init.h>
-
-
-/*
- * Code to understand MacOS partition tables.
- */
-
-#define MAC_PARTITION_MAGIC	0x504d
-
-/* type field value for A/UX or other Unix partitions */
-#define APPLE_AUX_TYPE	"Apple_UNIX_SVR2"
-
-struct mac_partition {
-	__u16	signature;	/* expected to be MAC_PARTITION_MAGIC */
-	__u16	res1;
-	__u32	map_count;	/* # blocks in partition map */
-	__u32	start_block;	/* absolute starting block # of partition */
-	__u32	block_count;	/* number of blocks in partition */
-	char	name[32];	/* partition name */
-	char	type[32];	/* string type description */
-	__u32	data_start;	/* rel block # of first data block */
-	__u32	data_count;	/* number of data blocks */
-	__u32	status;		/* partition status bits */
-	__u32	boot_start;
-	__u32	boot_size;
-	__u32	boot_load;
-	__u32	boot_load2;
-	__u32	boot_entry;
-	__u32	boot_entry2;
-	__u32	boot_cksum;
-	char	processor[16];	/* identifies ISA of boot */
-	/* there is more stuff after this that we don't need */
-};
-
-#define MAC_STATUS_BOOTABLE	8	/* partition is bootable */
-
-#define MAC_DRIVER_MAGIC	0x4552
-
-/* Driver descriptor structure, in block 0 */
-struct mac_driver_desc {
-	__u16	signature;	/* expected to be MAC_DRIVER_MAGIC */
-	__u16	block_size;
-	__u32	block_count;
-    /* ... more stuff */
-};
-
-static int mac_partition(struct gendisk *hd, kdev_t dev, unsigned long fsec)
-{
-	struct buffer_head *bh;
-	int blk, blocks_in_map;
-	int dev_bsize, dev_pos, pos;
-	unsigned secsize;
-#ifdef CONFIG_PMAC
-	int first_bootable = 1;
-#endif
-	struct mac_partition *part;
-	struct mac_driver_desc *md;
-
-	MOD_INC_USE_COUNT;
-	dev_bsize = get_ptable_blocksize(dev);
-	dev_pos = 0;
-	/* Get 0th block and look at the first partition map entry. */
-	if ((bh = bread(dev, 0, dev_bsize)) == 0) {
-	    printk("%s: error reading partition table\n",
-		   kdevname(dev));
-	    MOD_DEC_USE_COUNT;
-	    return -1;
-	}
-	md = (struct mac_driver_desc *) bh->b_data;
-	if (be16_to_cpu(md->signature) != MAC_DRIVER_MAGIC) {
-		brelse(bh);
-		MOD_DEC_USE_COUNT;
-		return 0;
-	}
-	secsize = be16_to_cpu(md->block_size);
-	if (secsize >= dev_bsize) {
-		brelse(bh);
-		dev_pos = secsize;
-		if ((bh = bread(dev, secsize/dev_bsize, dev_bsize)) == 0) {
-			printk("%s: error reading partition table\n",
-			       kdevname(dev));
-			MOD_DEC_USE_COUNT;
-			return -1;
-		}
-	}
-	part = (struct mac_partition *) (bh->b_data + secsize - dev_pos);
-	if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC) {
-		brelse(bh);
-		MOD_DEC_USE_COUNT;
-		return 0;		/* not a MacOS disk */
-	}
-	printk(" MAC");
-	blocks_in_map = be32_to_cpu(part->map_count);
-	for (blk = 1; blk <= blocks_in_map; ++blk) {
-		pos = blk * secsize;
-		if (pos >= dev_pos + dev_bsize) {
-			brelse(bh);
-			dev_pos = pos;
-			if ((bh = bread(dev, pos/dev_bsize, dev_bsize)) == 0) {
-				printk("%s: error reading partition table\n",
-				       kdevname(dev));
-				MOD_DEC_USE_COUNT;
-				return -1;
-			}
-		}
-		part = (struct mac_partition *) (bh->b_data + pos - dev_pos);
-		if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC)
-			break;
-		blocks_in_map = be32_to_cpu(part->map_count);
-		add_partition(hd, current_minor,
-			fsec + be32_to_cpu(part->start_block) * (secsize/512),
-			be32_to_cpu(part->block_count) * (secsize/512));
-
-#ifdef CONFIG_PMAC
-		/*
-		 * If this is the first bootable partition, tell the
-		 * setup code, in case it wants to make this the root.
-		 */
-		if (first_bootable
-		    && (be32_to_cpu(part->status) & MAC_STATUS_BOOTABLE)
-		    && strcasecmp(part->processor, "powerpc") == 0) {
-			note_bootable_part(dev, blk);
-			first_bootable = 0;
-		}
-#endif /* CONFIG_PMAC */
-
-		++current_minor;
-	}
-	brelse(bh);
-	printk("\n");
-	MOD_DEC_USE_COUNT;
-	return 1;
-}
-
-static struct partition_parser mac_partition_parser =
-    { NULL, "mac", mac_partition };
-
-#ifndef MODULE
-__initfunc(void mac_partbl_init( void ))
-{
-	(void)register_partbl( &mac_partition_parser );
-}
-#else
-int init_module(void)
-{
-	return register_partbl( &mac_partition_parser );
-}
-
-void cleanup_module(void)
-{
-	(void)unregister_partbl( &mac_partition_parser );
-}
-#endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/drivers/block/partbl_msdos.c m68k/drivers/block/partbl_msdos.c
--- jes-2.1.106/drivers/block/partbl_msdos.c	Tue Mar 24 19:04:12 1998
+++ m68k/drivers/block/partbl_msdos.c	Thu Jan  1 01:00:00 1970
@@ -1,423 +0,0 @@
-/*
- *  partbl_msdos.c -- MSDOS partition table parser
- *
- *  Code extracted from
- *  linux/drivers/block/genhd.c
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- *
- *  Thanks to Branko Lankester, lankeste@fwi.uva.nl, who found a bug
- *  in the early extended-partition checks and added DM partitions
- *
- *  Support for DiskManager v6.0x added by Mark Lord,
- *  with information provided by OnTrack.  This now works for linux fdisk
- *  and LILO, as well as loadlin and bootln.  Note that disks other than
- *  /dev/hda *must* have a "DOS" type 0x51 partition in the first slot (hda1).
- *
- *  More flexible handling of extended partitions - aeb, 950831
- *
- *  Check partition table on IDE disks for common CHS translations
- */
-
-#include <linux/module.h>
-
-#include <linux/config.h>
-#include <linux/fs.h>
-#include <linux/genhd.h>
-#include <linux/kernel.h>
-#include <linux/major.h>
-#include <linux/string.h>
-#include <linux/blk.h>
-#include <linux/init.h>
-
-#include <asm/system.h>
-
-/*
- * Many architectures don't like unaligned accesses, which is
- * frequently the case with the nr_sects and start_sect partition
- * table entries.
- */
-#include <asm/unaligned.h>
-
-#define SYS_IND(p)	(get_unaligned(&p->sys_ind))
-#define NR_SECTS(p)	({ __typeof__(p->nr_sects) __a =	\
-				get_unaligned(&p->nr_sects);	\
-				le32_to_cpu(__a); \
-			})
-
-#define START_SECT(p)	({ __typeof__(p->start_sect) __a =	\
-				get_unaligned(&p->start_sect);	\
-				le32_to_cpu(__a); \
-			})
-
-
-static inline int is_extended_partition(struct partition *p)
-{
-	return (SYS_IND(p) == DOS_EXTENDED_PARTITION ||
-		SYS_IND(p) == WIN98_EXTENDED_PARTITION ||
-		SYS_IND(p) == LINUX_EXTENDED_PARTITION);
-}
-
-/*
- * Create devices for each logical partition in an extended partition.
- * The logical partitions form a linked list, with each entry being
- * a partition table with two entries.  The first entry
- * is the real data partition (with a start relative to the partition
- * table start).  The second is a pointer to the next logical partition
- * (with a start relative to the entire extended partition).
- * We do not create a Linux partition for the partition tables, but
- * only for the actual data partitions.
- */
-
-#define MSDOS_LABEL_MAGIC		0xAA55
-
-static void extended_partition(struct gendisk *hd, kdev_t dev)
-{
-	struct buffer_head *bh;
-	struct partition *p;
-	unsigned long first_sector, first_size, this_sector, this_size;
-	int mask = (1 << hd->minor_shift) - 1;
-	int i;
-
-	first_sector = hd->part[MINOR(dev)].start_sect;
-	first_size = hd->part[MINOR(dev)].nr_sects;
-	this_sector = first_sector;
-
-	while (1) {
-		if ((current_minor & mask) == 0)
-			return;
-		if (!(bh = bread(dev,0,get_ptable_blocksize(dev))))
-			return;
-	  /*
-	   * This block is from a device that we're about to stomp on.
-	   * So make sure nobody thinks this block is usable.
-	   */
-		bh->b_state = 0;
-
-		if ((*(unsigned short *) (bh->b_data+510)) != cpu_to_le16(MSDOS_LABEL_MAGIC))
-			goto done;
-
-		p = (struct partition *) (0x1BE + bh->b_data);
-
-		this_size = hd->part[MINOR(dev)].nr_sects;
-
-		/*
-		 * Usually, the first entry is the real data partition,
-		 * the 2nd entry is the next extended partition, or empty,
-		 * and the 3rd and 4th entries are unused.
-		 * However, DRDOS sometimes has the extended partition as
-		 * the first entry (when the data partition is empty),
-		 * and OS/2 seems to use all four entries.
-		 */
-
-		/* 
-		 * First process the data partition(s)
-		 */
-		for (i=0; i<4; i++, p++) {
-		    if (!NR_SECTS(p) || is_extended_partition(p))
-		      continue;
-
-		    /* Check the 3rd and 4th entries -
-		       these sometimes contain random garbage */
-		    if (i >= 2
-			&& START_SECT(p) + NR_SECTS(p) > this_size
-			&& (this_sector + START_SECT(p) < first_sector ||
-			    this_sector + START_SECT(p) + NR_SECTS(p) >
-			     first_sector + first_size))
-		      continue;
-
-		    add_partition(hd, current_minor, this_sector+START_SECT(p), NR_SECTS(p));
-		    current_minor++;
-		    if ((current_minor & mask) == 0)
-		      goto done;
-		}
-		/*
-		 * Next, process the (first) extended partition, if present.
-		 * (So far, there seems to be no reason to make
-		 *  extended_partition()  recursive and allow a tree
-		 *  of extended partitions.)
-		 * It should be a link to the next logical partition.
-		 * Create a minor for this just long enough to get the next
-		 * partition table.  The minor will be reused for the next
-		 * data partition.
-		 */
-		p -= 4;
-		for (i=0; i<4; i++, p++)
-		  if(NR_SECTS(p) && is_extended_partition(p))
-		    break;
-		if (i == 4)
-		  goto done;	 /* nothing left to do */
-
-		hd->part[current_minor].nr_sects = NR_SECTS(p);
-		hd->part[current_minor].start_sect = first_sector + START_SECT(p);
-		this_sector = first_sector + START_SECT(p);
-		dev = MKDEV(hd->major, current_minor);
-		brelse(bh);
-	}
-done:
-	brelse(bh);
-}
-
-#ifdef CONFIG_SOLARIS_X86_PARTITION
-static void
-solaris_x86_partition(struct gendisk *hd, kdev_t dev, long offset) {
-
-	struct buffer_head *bh;
-	struct solaris_x86_vtoc *v;
-	struct solaris_x86_slice *s;
-	int i;
-
-	if(!(bh = bread(dev, 0, get_ptable_blocksize(dev))))
-		return;
-	v = (struct solaris_x86_vtoc *)(bh->b_data + 512);
-	if(v->v_sanity != cpu_to_le32(SOLARIS_X86_VTOC_SANE)) {
-		brelse(bh);
-		return;
-	}
-	printk(" <solaris:");
-	if(v->v_version != cpu_to_le32(1)) {
-		printk("  cannot handle version %ld vtoc>", le32_to_cpu(v->v_version));
-		brelse(bh);
-		return;
-	}
-	for(i=0; i<SOLARIS_X86_NUMSLICE; i++) {
-		s = &v->v_slice[i];
-
-		if (s->s_tag == 0)
-			continue;
-		printk(" [s%d]", i);
-		/* solaris partitions are relative to current MS-DOS
-		 * one but add_partition starts relative to sector
-		 * zero of the disk.  Therefore, must add the offset
-		 * of the current partition */
-		add_partition(hd, current_minor, le32_to_cpu(s->s_start)+offset,
-					  le32_to_cpu(s->s_size));
-		current_minor++;
-	}
-	brelse(bh);
-	printk(" >");
-}
-#endif
-
-#ifdef CONFIG_BSD_DISKLABEL
-/* 
- * Create devices for BSD partitions listed in a disklabel, under a
- * dos-like partition. See extended_partition() for more information.
- */
-static void bsd_disklabel_partition(struct gendisk *hd, kdev_t dev)
-{
-	struct buffer_head *bh;
-	struct bsd_disklabel *l;
-	struct bsd_partition *p;
-	int mask = (1 << hd->minor_shift) - 1;
-
-	if (!(bh = bread(dev,0,get_ptable_blocksize(dev))))
-		return;
-	bh->b_state = 0;
-	l = (struct bsd_disklabel *) (bh->b_data+512);
-	if (l->d_magic != cpu_to_le32(BSD_DISKMAGIC)) {
-		brelse(bh);
-		return;
-	}
-
-	p = &l->d_partitions[0];
-	while (p - &l->d_partitions[0] <= BSD_MAXPARTITIONS) {
-		if ((current_minor & mask) >= (4 + hd->max_p))
-			break;
-
-		if (p->p_fstype != BSD_FS_UNUSED) {
-			add_partition(hd, current_minor, le32_to_cpu(p->p_offset),
-						  le32_to_cpu(p->p_size));
-			current_minor++;
-		}
-		p++;
-	}
-	brelse(bh);
-
-}
-#endif
-
-static int msdos_partition(struct gendisk *hd, kdev_t dev, unsigned long first_sector)
-{
-	int i, minor = current_minor;
-	struct buffer_head *bh;
-	struct partition *p;
-	unsigned char *data;
-	int mask = (1 << hd->minor_shift) - 1;
-#ifdef CONFIG_BLK_DEV_IDE
-	int tested_for_xlate = 0;
-
-	MOD_INC_USE_COUNT;
-read_mbr:
-#endif
-	if (!(bh = bread(dev,0,get_ptable_blocksize(dev)))) {
-		printk(" unable to read partition table\n");
-	    MOD_DEC_USE_COUNT;
-		return -1;
-	}
-	data = bh->b_data;
-	/* In some cases we modify the geometry    */
-	/*  of the drive (below), so ensure that   */
-	/*  nobody else tries to re-use this data. */
-	bh->b_state = 0;
-#ifdef CONFIG_BLK_DEV_IDE
-check_table:
-#endif
-	if (*(unsigned short *)  (0x1fe + data) != cpu_to_le16(MSDOS_LABEL_MAGIC)) {
-		brelse(bh);
-	    MOD_DEC_USE_COUNT;
-		return 0;
-	}
-	p = (struct partition *) (0x1be + data);
-
-#ifdef CONFIG_BLK_DEV_IDE
-	if (!tested_for_xlate++) {	/* Do this only once per disk */
-		/*
-		 * Look for various forms of IDE disk geometry translation
-		 */
-		extern int ide_xlate_1024(kdev_t, int, const char *);
-		unsigned int sig = le16_to_cpu(*(unsigned short *)(data + 2));
-		if (SYS_IND(p) == EZD_PARTITION) {
-			/*
-			 * The remainder of the disk must be accessed using
-			 * a translated geometry that reduces the number of 
-			 * apparent cylinders to less than 1024 if possible.
-			 *
-			 * ide_xlate_1024() will take care of the necessary
-			 * adjustments to fool fdisk/LILO and partition check.
-			 */
-			if (ide_xlate_1024(dev, -1, " [EZD]")) {
-				data += 512;
-				goto check_table;
-			}
-		} else if (SYS_IND(p) == DM6_PARTITION) {
-
-			/*
-			 * Everything on the disk is offset by 63 sectors,
-			 * including a "new" MBR with its own partition table,
-			 * and the remainder of the disk must be accessed using
-			 * a translated geometry that reduces the number of 
-			 * apparent cylinders to less than 1024 if possible.
-			 *
-			 * ide_xlate_1024() will take care of the necessary
-			 * adjustments to fool fdisk/LILO and partition check.
-			 */
-			if (ide_xlate_1024(dev, 1, " [DM6:DDO]")) {
-				brelse(bh);
-				goto read_mbr;	/* start over with new MBR */
-			}
-		} else if (sig <= 0x1ae &&
-			   *(unsigned short *)(data + sig) == cpu_to_le16(0x55AA) &&
-			   (1 & *(unsigned char *)(data + sig + 2))) {
-			/* DM6 signature in MBR, courtesy of OnTrack */
-			(void) ide_xlate_1024 (dev, 0, " [DM6:MBR]");
-		} else if (SYS_IND(p) == DM6_AUX1PARTITION || SYS_IND(p) == DM6_AUX3PARTITION) {
-			/*
-			 * DM6 on other than the first (boot) drive
-			 */
-			(void) ide_xlate_1024(dev, 0, " [DM6:AUX]");
-		} else {
-			/*
-			 * Examine the partition table for common translations.
-			 * This is necessary for drives for situations where
-			 * the translated geometry is unavailable from the BIOS.
-			 */
-			for (i = 0; i < 4 ; i++) {
-				struct partition *q = &p[i];
-				if (NR_SECTS(q)
-				   && (q->sector & 63) == 1
-				   && (q->end_sector & 63) == 63) {
-					unsigned int heads = q->end_head + 1;
-					if (heads == 32 || heads == 64 || heads == 128 || heads == 255) {
-
-						(void) ide_xlate_1024(dev, heads, " [PTBL]");
-						break;
-					}
-				}
-			}
-		}
-	}
-#endif	/* CONFIG_BLK_DEV_IDE */
-
-	printk(" DOS");	/* show partition type */
-	current_minor += 4;  /* first "extra" minor (for extended partitions) */
-	for (i=1 ; i<=4 ; minor++,i++,p++) {
-		if (!NR_SECTS(p))
-			continue;
-		add_partition(hd, minor, first_sector+START_SECT(p), NR_SECTS(p));
-		if (is_extended_partition(p)) {
-			printk(" <");
-			/*
-			 * If we are rereading the partition table, we need
-			 * to set the size of the partition so that we will
-			 * be able to bread the block containing the extended
-			 * partition info.
-			 */
-			hd->sizes[minor] = hd->part[minor].nr_sects 
-			  	>> (BLOCK_SIZE_BITS - 9);
-			extended_partition(hd, MKDEV(hd->major, minor));
-			printk(" >");
-			/* prevent someone doing mkfs or mkswap on an
-			   extended partition, but leave room for LILO */
-			if (hd->part[minor].nr_sects > 2)
-				hd->part[minor].nr_sects = 2;
-		}
-#ifdef CONFIG_BSD_DISKLABEL
-		if (SYS_IND(p) == BSD_PARTITION) {
-			printk(" BSD<");
-			bsd_disklabel_partition(hd, MKDEV(hd->major, minor));
-			printk(" >");
-		}
-#endif
-#ifdef CONFIG_SOLARIS_X86_PARTITION
-
-		/* james@bpgc.com: Solaris has a nasty indicator: 0x82
-		 * which also means linux swap.  For that reason, all
-		 * of the prints are done inside the
-		 * solaris_x86_partition routine */
-
-		if(SYS_IND(p) == SOLARIS_X86_PARTITION) {
-			solaris_x86_partition(hd, MKDEV(hd->major, minor),
-					      first_sector+START_SECT(p));
-		}
-#endif
-	}
-	/*
-	 *  Check for old-style Disk Manager partition table
-	 */
-	if (*(unsigned short *) (data+0xfc) == cpu_to_le16(MSDOS_LABEL_MAGIC)) {
-		p = (struct partition *) (0x1be + data);
-		for (i = 4 ; i < 16 ; i++, current_minor++) {
-			p--;
-			if ((current_minor & mask) == 0)
-				break;
-			if (!(START_SECT(p) && NR_SECTS(p)))
-				continue;
-			add_partition(hd, current_minor, START_SECT(p), NR_SECTS(p));
-		}
-	}
-	printk("\n");
-	brelse(bh);
-	MOD_DEC_USE_COUNT;
-	return 1;
-}
-
-static struct partition_parser msdos_partition_parser =
-    { NULL, "msdos", msdos_partition };
-
-#ifndef MODULE
-__initfunc(void msdos_partbl_init( void ))
-{
-	(void)register_partbl( &msdos_partition_parser );
-}
-#else
-int init_module(void)
-{
-	return register_partbl( &msdos_partition_parser );
-}
-
-void cleanup_module(void)
-{
-	(void)unregister_partbl( &msdos_partition_parser );
-}
-#endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/drivers/block/partbl_osf.c m68k/drivers/block/partbl_osf.c
--- jes-2.1.106/drivers/block/partbl_osf.c	Sun Feb  8 22:32:52 1998
+++ m68k/drivers/block/partbl_osf.c	Thu Jan  1 01:00:00 1970
@@ -1,117 +0,0 @@
-/*
- *  partbl_osf.c -- partition table parser for OSF partitions (alpha)
- *
- *  Code extracted from
- *  linux/drivers/block/genhd.c
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- */
-
-#include <linux/module.h>
-
-#include <linux/fs.h>
-#include <linux/genhd.h>
-#include <linux/kernel.h>
-#include <linux/major.h>
-#include <linux/string.h>
-#include <linux/init.h>
-
-
-static int osf_partition(struct gendisk *hd, kdev_t dev, unsigned long first_sector)
-{
-	int i;
-	int mask = (1 << hd->minor_shift) - 1;
-	struct buffer_head *bh;
-	struct disklabel {
-		u32 d_magic;
-		u16 d_type,d_subtype;
-		u8 d_typename[16];
-		u8 d_packname[16];
-		u32 d_secsize;
-		u32 d_nsectors;
-		u32 d_ntracks;
-		u32 d_ncylinders;
-		u32 d_secpercyl;
-		u32 d_secprtunit;
-		u16 d_sparespertrack;
-		u16 d_sparespercyl;
-		u32 d_acylinders;
-		u16 d_rpm, d_interleave, d_trackskew, d_cylskew;
-		u32 d_headswitch, d_trkseek, d_flags;
-		u32 d_drivedata[5];
-		u32 d_spare[5];
-		u32 d_magic2;
-		u16 d_checksum;
-		u16 d_npartitions;
-		u32 d_bbsize, d_sbsize;
-		struct d_partition {
-			u32 p_size;
-			u32 p_offset;
-			u32 p_fsize;
-			u8  p_fstype;
-			u8  p_frag;
-			u16 p_cpg;
-		} d_partitions[8];
-	} * label;
-	struct d_partition * partition;
-#define DISKLABELMAGIC (0x82564557UL)
-
-	MOD_INC_USE_COUNT;
-	if (!(bh = bread(dev,0,get_ptable_blocksize(dev)))) {
-		printk("unable to read partition table\n");
-	    MOD_DEC_USE_COUNT;
-		return -1;
-	}
-	label = (struct disklabel *) (bh->b_data+64);
-	partition = label->d_partitions;
-	if (label->d_magic != cpu_to_le32(DISKLABELMAGIC)) {
-#if 0
-		printk("magic: %08x\n", label->d_magic);
-#endif
-		brelse(bh);
-	    MOD_DEC_USE_COUNT;
-		return 0;
-	}
-	if (label->d_magic2 != cpu_to_le32(DISKLABELMAGIC)) {
-#if 0
-		printk("magic2: %08x\n", label->d_magic2);
-#endif
-		brelse(bh);
-	    MOD_DEC_USE_COUNT;
-		return 0;
-	}
-	printk(" OSF");
-	for (i = 0 ; i < le16_to_cpu(label->d_npartitions); i++, partition++) {
-		if ((current_minor & mask) == 0)
-		        break;
-		if (partition->p_size)
-			add_partition(hd, current_minor,
-				first_sector+le32_to_cpu(partition->p_offset),
-				le32_to_cpu(partition->p_size));
-		current_minor++;
-	}
-	printk("\n");
-	brelse(bh);
-	MOD_DEC_USE_COUNT;
-	return 1;
-}
-
-static struct partition_parser osf_partition_parser =
-    { NULL, "osf",  osf_partition };
-
-#ifndef MODULE
-__initfunc(void osf_partbl_init( void ))
-{
-	(void)register_partbl( &osf_partition_parser );
-}
-#else
-int init_module(void)
-{
-	return register_partbl( &osf_partition_parser );
-}
-
-void cleanup_module(void)
-{
-	(void)unregister_partbl( &osf_partition_parser );
-}
-#endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/drivers/block/partbl_sun.c m68k/drivers/block/partbl_sun.c
--- jes-2.1.106/drivers/block/partbl_sun.c	Tue Mar 24 19:04:12 1998
+++ m68k/drivers/block/partbl_sun.c	Thu Jan  1 01:00:00 1970
@@ -1,113 +0,0 @@
-/*
- *  partbl_sun.c -- Sun partition table parser
- *
- *  Code extracted from
- *  linux/drivers/block/genhd.c
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- */
-
-#include <linux/module.h>
-
-#include <linux/fs.h>
-#include <linux/genhd.h>
-#include <linux/kernel.h>
-#include <linux/major.h>
-#include <linux/string.h>
-#include <linux/init.h>
-
-
-static int sun_partition(struct gendisk *hd, kdev_t dev, unsigned long first_sector)
-{
-	int i, csum;
-	unsigned short *ush;
-	struct buffer_head *bh;
-	struct sun_disklabel {
-		unsigned char info[128];   /* Informative text string */
-		unsigned char spare[292];  /* Boot information etc. */
-		unsigned short rspeed;     /* Disk rotational speed */
-		unsigned short pcylcount;  /* Physical cylinder count */
-		unsigned short sparecyl;   /* extra sects per cylinder */
-		unsigned char spare2[4];   /* More magic... */
-		unsigned short ilfact;     /* Interleave factor */
-		unsigned short ncyl;       /* Data cylinder count */
-		unsigned short nacyl;      /* Alt. cylinder count */
-		unsigned short ntrks;      /* Tracks per cylinder */
-		unsigned short nsect;      /* Sectors per track */
-		unsigned char spare3[4];   /* Even more magic... */
-		struct sun_partition {
-			__u32 start_cylinder;
-			__u32 num_sectors;
-		} partitions[8];
-		unsigned short magic;      /* Magic number */
-		unsigned short csum;       /* Label xor'd checksum */
-	} * label;		
-	struct sun_partition *p;
-	unsigned long spc;
-#define SUN_LABEL_MAGIC          0xDABE
-
-	MOD_INC_USE_COUNT;
-	if(!(bh = bread(dev, 0, get_ptable_blocksize(dev)))) {
-		printk("Dev %s: unable to read partition table\n",
-		       kdevname(dev));
-	    MOD_DEC_USE_COUNT;
-		return -1;
-	}
-	label = (struct sun_disklabel *) bh->b_data;
-	p = label->partitions;
-	if (be16_to_cpu(label->magic) != SUN_LABEL_MAGIC) {
-		printk("Dev %s Sun disklabel: bad magic %04x\n",
-		       kdevname(dev), be16_to_cpu(label->magic));
-		brelse(bh);
-	    MOD_DEC_USE_COUNT;
-		return 0;
-	}
-	/* Look at the checksum */
-	ush = ((unsigned short *) (label+1)) - 1;
-	for(csum = 0; ush >= ((unsigned short *) label);)
-		csum ^= *ush--;
-	if(csum) {
-		printk("Dev %s Sun disklabel: Csum bad, label corrupted\n",
-		       kdevname(dev));
-		brelse(bh);
-	    MOD_DEC_USE_COUNT;
-		return 0;
-	}
-	printk(" UFS");
-	/* All Sun disks have 8 partition entries */
-	spc = be16_to_cpu(label->ntrks) * be16_to_cpu(label->nsect);
-	for(i=0; i < 8; i++, p++) {
-		unsigned long st_sector;
-		int num_sectors;
-
-		st_sector = first_sector + be32_to_cpu(p->start_cylinder) * spc;
-		num_sectors = be32_to_cpu(p->num_sectors);
-		if (num_sectors)
-			add_partition(hd, current_minor, st_sector, num_sectors);
-		current_minor++;
-	}
-	printk("\n");
-	brelse(bh);
-	MOD_DEC_USE_COUNT;
-	return 1;
-}
-
-static struct partition_parser sun_partition_parser =
-    { NULL, "sun", sun_partition };
-
-#ifndef MODULE
-__initfunc(void sun_partbl_init( void ))
-{
-	(void)register_partbl( &sun_partition_parser );
-}
-#else
-int init_module(void)
-{
-	return register_partbl( &sun_partition_parser );
-}
-
-void cleanup_module(void)
-{
-	(void)unregister_partbl( &sun_partition_parser );
-}
-#endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/drivers/char/amikeyb.c m68k/drivers/char/amikeyb.c
--- jes-2.1.106/drivers/char/amikeyb.c	Thu May 14 21:34:33 1998
+++ m68k/drivers/char/amikeyb.c	Sun Jun 14 22:18:24 1998
@@ -343,6 +343,6 @@
 }
 
 /* for "kbd-reset" cmdline param */
-__initfunc(void kbd_reset_setup(char *str, int *ints))
+__initfunc(void amiga_kbd_reset_setup(char *str, int *ints))
 {
 }
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/drivers/char/n_tty.c m68k/drivers/char/n_tty.c
--- jes-2.1.106/drivers/char/n_tty.c	Tue Mar 24 19:04:23 1998
+++ m68k/drivers/char/n_tty.c	Sun Jun 14 22:20:25 1998
@@ -59,10 +59,10 @@
 
 static inline void put_tty_queue(unsigned char c, struct tty_struct *tty)
 {
-	if (tty->read_cnt < N_TTY_BUF_SIZE) {
+	if (atomic_read(&tty->read_cnt) < N_TTY_BUF_SIZE) {
 		tty->read_buf[tty->read_head] = c;
 		tty->read_head = (tty->read_head + 1) & (N_TTY_BUF_SIZE-1);
-		tty->read_cnt++;
+		atomic_inc(&tty->read_cnt);
 	}
 }
 
@@ -85,7 +85,8 @@
  */
 static void reset_buffer_flags(struct tty_struct *tty)
 {
-	tty->read_head = tty->read_tail = tty->read_cnt = 0;
+	tty->read_head = tty->read_tail = 0;
+	atomic_set(&tty->read_cnt, 0);
 	tty->canon_head = tty->canon_data = tty->erasing = 0;
 	memset(&tty->read_flags, 0, sizeof tty->read_flags);
 	check_unthrottle(tty);
@@ -120,7 +121,7 @@
 			tty->canon_head - tty->read_tail :
 			tty->canon_head + (N_TTY_BUF_SIZE - tty->read_tail);
 	}
-	return tty->read_cnt;
+	return atomic_read(&tty->read_cnt);
 }
 
 /*
@@ -293,14 +294,16 @@
 		kill_type = WERASE;
 	else {
 		if (!L_ECHO(tty)) {
-			tty->read_cnt -= ((tty->read_head - tty->canon_head) &
-					  (N_TTY_BUF_SIZE - 1));
+			atomic_sub(((tty->read_head - tty->canon_head) &
+				    (N_TTY_BUF_SIZE - 1)),
+				   &tty->read_cnt);
 			tty->read_head = tty->canon_head;
 			return;
 		}
 		if (!L_ECHOK(tty) || !L_ECHOKE(tty) || !L_ECHOE(tty)) {
-			tty->read_cnt -= ((tty->read_head - tty->canon_head) &
-					  (N_TTY_BUF_SIZE - 1));
+			atomic_sub(((tty->read_head - tty->canon_head) &
+				    (N_TTY_BUF_SIZE - 1)),
+				   &tty->read_cnt);
 			tty->read_head = tty->canon_head;
 			finish_erasing(tty);
 			echo_char(KILL_CHAR(tty), tty);
@@ -324,7 +327,7 @@
 				break;
 		}
 		tty->read_head = head;
-		tty->read_cnt--;
+		atomic_dec(&tty->read_cnt);
 		if (L_ECHO(tty)) {
 			if (L_ECHOPRT(tty)) {
 				if (!tty->erasing) {
@@ -482,7 +485,7 @@
 		finish_erasing(tty);
 		tty->lnext = 0;
 		if (L_ECHO(tty)) {
-			if (tty->read_cnt >= N_TTY_BUF_SIZE-1) {
+			if (atomic_read(&tty->read_cnt) >= N_TTY_BUF_SIZE-1) {
 				put_char('\a', tty); /* beep if no space */
 				return;
 			}
@@ -561,7 +564,7 @@
 		}
 		if (c == '\n') {
 			if (L_ECHO(tty) || L_ECHONL(tty)) {
-				if (tty->read_cnt >= N_TTY_BUF_SIZE-1) {
+				if (atomic_read(&tty->read_cnt) >= N_TTY_BUF_SIZE-1) {
 					put_char('\a', tty);
 					return;
 				}
@@ -581,7 +584,7 @@
 			 * XXX are EOL_CHAR and EOL2_CHAR echoed?!?
 			 */
 			if (L_ECHO(tty)) {
-				if (tty->read_cnt >= N_TTY_BUF_SIZE-1) {
+				if (atomic_read(&tty->read_cnt) >= N_TTY_BUF_SIZE-1) {
 					put_char('\a', tty);
 					return;
 				}
@@ -612,7 +615,7 @@
 	
 	finish_erasing(tty);
 	if (L_ECHO(tty)) {
-		if (tty->read_cnt >= N_TTY_BUF_SIZE-1) {
+		if (atomic_read(&tty->read_cnt) >= N_TTY_BUF_SIZE-1) {
 			put_char('\a', tty); /* beep if no space */
 			return;
 		}
@@ -634,7 +637,7 @@
 
 static int n_tty_receive_room(struct tty_struct *tty)
 {
-	int	left = N_TTY_BUF_SIZE - tty->read_cnt - 1;
+	int	left = N_TTY_BUF_SIZE - atomic_read(&tty->read_cnt) - 1;
 
 	/*
 	 * If we are doing input canonicalization, and there are no
@@ -662,19 +665,20 @@
 		return;
 
 	if (tty->real_raw) {
-		i = MIN(count, MIN(N_TTY_BUF_SIZE - tty->read_cnt,
+		int read_cnt = atomic_read(&tty->read_cnt);
+		i = MIN(count, MIN(N_TTY_BUF_SIZE - read_cnt,
 				   N_TTY_BUF_SIZE - tty->read_head));
 		memcpy(tty->read_buf + tty->read_head, cp, i);
 		tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1);
-		tty->read_cnt += i;
+		read_cnt += i;
 		cp += i;
 		count -= i;
 
-		i = MIN(count, MIN(N_TTY_BUF_SIZE - tty->read_cnt,
+		i = MIN(count, MIN(N_TTY_BUF_SIZE - read_cnt,
 			       N_TTY_BUF_SIZE - tty->read_head));
 		memcpy(tty->read_buf + tty->read_head, cp, i);
 		tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1);
-		tty->read_cnt += i;
+		atomic_set(&tty->read_cnt, read_cnt + i);
 	} else {
 		for (i=count, p = cp, f = fp; i; i--, p++) {
 			if (f)
@@ -703,7 +707,7 @@
 			tty->driver.flush_chars(tty);
 	}
 
-	if (!tty->icanon && (tty->read_cnt >= tty->minimum_to_wake)) {
+	if (!tty->icanon && (atomic_read(&tty->read_cnt) >= tty->minimum_to_wake)) {
 		if (tty->fasync)
 			kill_fasync(tty->fasync, SIGIO);
 		if (tty->read_wait)
@@ -828,7 +832,7 @@
 	if (tty->icanon) {
 		if (tty->canon_data)
 			return 1;
-	} else if (tty->read_cnt >= (amt ? amt : 1))
+	} else if (atomic_read(&tty->read_cnt) >= (amt ? amt : 1))
 		return 1;
 
 	return 0;
@@ -848,14 +852,16 @@
 
 {
 	ssize_t n;
+	int read_cnt = atomic_read(&tty->read_cnt);
 
-	n = MIN(*nr, MIN(tty->read_cnt, N_TTY_BUF_SIZE - tty->read_tail));
+	n = MIN(*nr, MIN(read_cnt, N_TTY_BUF_SIZE - tty->read_tail));
 	if (!n)
 		return;
 	/* N.B. copy_to_user may work only partially */
 	n -= copy_to_user(*b, &tty->read_buf[tty->read_tail], n);
 	tty->read_tail = (tty->read_tail + n) & (N_TTY_BUF_SIZE-1);
-	tty->read_cnt -= n;
+	/* tty->read_cnt may have changed while we slept. */
+	atomic_sub(n, &tty->read_cnt);
 	*b += n;
 	*nr -= n;
 }
@@ -973,7 +979,7 @@
 
 		if (tty->icanon) {
 			/* N.B. avoid overrun if nr == 0 */
-			while (nr && tty->read_cnt) {
+			while (nr && atomic_read(&tty->read_cnt)) {
  				int eol;
 
 				eol = test_and_clear_bit(tty->read_tail,
@@ -981,7 +987,7 @@
 				c = tty->read_buf[tty->read_tail];
 				tty->read_tail = ((tty->read_tail+1) &
 						  (N_TTY_BUF_SIZE-1));
-				tty->read_cnt--;
+				atomic_dec(&tty->read_cnt);
 
 				if (!eol || (c != __DISABLED_CHAR)) {
 					put_user(c, b++);
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/drivers/char/tty_ioctl.c m68k/drivers/char/tty_ioctl.c
--- jes-2.1.106/drivers/char/tty_ioctl.c	Tue Mar 24 19:04:17 1998
+++ m68k/drivers/char/tty_ioctl.c	Sun Jun 14 22:20:25 1998
@@ -120,7 +120,7 @@
 		tty->erasing = 0;
 	}
 	sti();
-	if (canon_change && !L_ICANON(tty) && tty->read_cnt)
+	if (canon_change && !L_ICANON(tty) && atomic_read(&tty->read_cnt))
 		/* Get characters left over from canonical mode. */
 		wake_up_interruptible(&tty->read_wait);
 
@@ -477,7 +477,7 @@
 					tty->driver.chars_in_buffer(tty) : 0,
 					(int *) arg);
 		case TIOCINQ:
-			retval = tty->read_cnt;
+			retval = atomic_read(&tty->read_cnt);
 			if (L_ICANON(tty))
 				retval = inq_canon(tty);
 			return put_user(retval, (unsigned int *) arg);
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/drivers/sound/Makefile m68k/drivers/sound/Makefile
--- jes-2.1.106/drivers/sound/Makefile	Thu Jun 18 20:52:59 1998
+++ m68k/drivers/sound/Makefile	Thu Jun 18 21:59:26 1998
@@ -42,7 +42,7 @@
 
 ifeq ($(ARCH),m68k)
 
-obj-$(CONFIG_DMASOUND)		+= dmasound.o
+obj-$(CONFIG_DMASOUND)		+= dmasound.o sound_core.o
 
 else
 
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/drivers/sound/dmasound.c m68k/drivers/sound/dmasound.c
--- jes-2.1.106/drivers/sound/dmasound.c	Thu Jun 18 20:52:59 1998
+++ m68k/drivers/sound/dmasound.c	Thu Jun 18 21:59:29 1998
@@ -73,6 +73,8 @@
 
 1996/9/25	++geert: modularization
 
+1998-06-10	++andreas: converted to use sound_core
+
 */
 
 
@@ -85,6 +87,7 @@
 #include <linux/errno.h>
 #include <linux/mm.h>
 #include <linux/malloc.h>
+#include <linux/sound.h>
 
 #ifdef __mc68000__
 #include <asm/setup.h>
@@ -121,8 +124,10 @@
 
 #define HAS_8BIT_TABLES
 
+static int sq_unit = -1;
+static int mixer_unit = -1;
+static int state_unit = -1;
 #ifdef MODULE
-static int chrdev_registered = 0;
 static int irq_installed = 0;
 #endif /* MODULE */
 static char **sound_buffers = NULL;
@@ -510,74 +515,105 @@
 
 
 #ifdef CONFIG_ATARI
-static long ata_ct_law(const u_char *userPtr, unsigned long userCount,
-		       u_char frame[], long *frameUsed, long frameLeft);
-static long ata_ct_s8(const u_char *userPtr, unsigned long userCount,
-		      u_char frame[], long *frameUsed, long frameLeft);
-static long ata_ct_u8(const u_char *userPtr, unsigned long userCount,
-		      u_char frame[], long *frameUsed, long frameLeft);
-static long ata_ct_s16be(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft);
-static long ata_ct_u16be(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft);
-static long ata_ct_s16le(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft);
-static long ata_ct_u16le(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft);
-static long ata_ctx_law(const u_char *userPtr, unsigned long userCount,
-			u_char frame[], long *frameUsed, long frameLeft);
-static long ata_ctx_s8(const u_char *userPtr, unsigned long userCount,
-		       u_char frame[], long *frameUsed, long frameLeft);
-static long ata_ctx_u8(const u_char *userPtr, unsigned long userCount,
-		       u_char frame[], long *frameUsed, long frameLeft);
-static long ata_ctx_s16be(const u_char *userPtr, unsigned long userCount,
-			  u_char frame[], long *frameUsed, long frameLeft);
-static long ata_ctx_u16be(const u_char *userPtr, unsigned long userCount,
-			  u_char frame[], long *frameUsed, long frameLeft);
-static long ata_ctx_s16le(const u_char *userPtr, unsigned long userCount,
-			  u_char frame[], long *frameUsed, long frameLeft);
-static long ata_ctx_u16le(const u_char *userPtr, unsigned long userCount,
-			  u_char frame[], long *frameUsed, long frameLeft);
+static ssize_t ata_ct_law(const u_char *userPtr, size_t userCount,
+			  u_char frame[], ssize_t *frameUsed,
+			  ssize_t frameLeft);
+static ssize_t ata_ct_s8(const u_char *userPtr, size_t userCount,
+			 u_char frame[], ssize_t *frameUsed,
+			 ssize_t frameLeft);
+static ssize_t ata_ct_u8(const u_char *userPtr, size_t userCount,
+			 u_char frame[], ssize_t *frameUsed,
+			 ssize_t frameLeft);
+static ssize_t ata_ct_s16be(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft);
+static ssize_t ata_ct_u16be(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft);
+static ssize_t ata_ct_s16le(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft);
+static ssize_t ata_ct_u16le(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft);
+static ssize_t ata_ctx_law(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft);
+static ssize_t ata_ctx_s8(const u_char *userPtr, size_t userCount,
+			  u_char frame[], ssize_t *frameUsed,
+			  ssize_t frameLeft);
+static ssize_t ata_ctx_u8(const u_char *userPtr, size_t userCount,
+			  u_char frame[], ssize_t *frameUsed,
+			  ssize_t frameLeft);
+static ssize_t ata_ctx_s16be(const u_char *userPtr, size_t userCount,
+			     u_char frame[], ssize_t *frameUsed,
+			     ssize_t frameLeft);
+static ssize_t ata_ctx_u16be(const u_char *userPtr, size_t userCount,
+			     u_char frame[], ssize_t *frameUsed,
+			     ssize_t frameLeft);
+static ssize_t ata_ctx_s16le(const u_char *userPtr, size_t userCount,
+			     u_char frame[], ssize_t *frameUsed,
+			     ssize_t frameLeft);
+static ssize_t ata_ctx_u16le(const u_char *userPtr, size_t userCount,
+			     u_char frame[], ssize_t *frameUsed,
+			     ssize_t frameLeft);
 #endif /* CONFIG_ATARI */
 
 #ifdef CONFIG_AMIGA
-static long ami_ct_law(const u_char *userPtr, unsigned long userCount,
-		       u_char frame[], long *frameUsed, long frameLeft);
-static long ami_ct_s8(const u_char *userPtr, unsigned long userCount,
-		      u_char frame[], long *frameUsed, long frameLeft);
-static long ami_ct_u8(const u_char *userPtr, unsigned long userCount,
-		      u_char frame[], long *frameUsed, long frameLeft);
-static long ami_ct_s16be(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft);
-static long ami_ct_u16be(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft);
-static long ami_ct_s16le(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft);
-static long ami_ct_u16le(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft);
+static ssize_t ami_ct_law(const u_char *userPtr, size_t userCount,
+			  u_char frame[], ssize_t *frameUsed,
+			  ssize_t frameLeft);
+static ssize_t ami_ct_s8(const u_char *userPtr, size_t userCount,
+			 u_char frame[], ssize_t *frameUsed,
+			 ssize_t frameLeft);
+static ssize_t ami_ct_u8(const u_char *userPtr, size_t userCount,
+			 u_char frame[], ssize_t *frameUsed,
+			 ssize_t frameLeft);
+static ssize_t ami_ct_s16be(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft);
+static ssize_t ami_ct_u16be(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft);
+static ssize_t ami_ct_s16le(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft);
+static ssize_t ami_ct_u16le(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft);
 #endif /* CONFIG_AMIGA */
 
 #ifdef CONFIG_PMAC
-static long pmac_ct_law(const u_char *userPtr, unsigned long userCount,
-			u_char frame[], long *frameUsed, long frameLeft);
-static long pmac_ct_s8(const u_char *userPtr, unsigned long userCount,
-		       u_char frame[], long *frameUsed, long frameLeft);
-static long pmac_ct_u8(const u_char *userPtr, unsigned long userCount,
-		       u_char frame[], long *frameUsed, long frameLeft);
-static long pmac_ct_s16(const u_char *userPtr, unsigned long userCount,
-			u_char frame[], long *frameUsed, long frameLeft);
-static long pmac_ct_u16(const u_char *userPtr, unsigned long userCount,
-			u_char frame[], long *frameUsed, long frameLeft);
-static long pmac_ctx_law(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft);
-static long pmac_ctx_s8(const u_char *userPtr, unsigned long userCount,
-			u_char frame[], long *frameUsed, long frameLeft);
-static long pmac_ctx_u8(const u_char *userPtr, unsigned long userCount,
-			u_char frame[], long *frameUsed, long frameLeft);
-static long pmac_ctx_s16(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft);
-static long pmac_ctx_u16(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft);
+static ssize_t pmac_ct_law(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft);
+static ssize_t pmac_ct_s8(const u_char *userPtr, size_t userCount,
+			  u_char frame[], ssize_t *frameUsed,
+			  ssize_t frameLeft);
+static ssize_t pmac_ct_u8(const u_char *userPtr, size_t userCount,
+			  u_char frame[], ssize_t *frameUsed,
+			  ssize_t frameLeft);
+static ssize_t pmac_ct_s16(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft);
+static ssize_t pmac_ct_u16(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft);
+static ssize_t pmac_ctx_law(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft);
+static ssize_t pmac_ctx_s8(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft);
+static ssize_t pmac_ctx_u8(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft);
+static ssize_t pmac_ctx_s16(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft);
+static ssize_t pmac_ctx_u16(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft);
 #endif /* CONFIG_PMAC */
 
 /*** Machine definitions *****************************************************/
@@ -613,14 +649,14 @@
 } SETTINGS;
 
 typedef struct {
-	long (*ct_ulaw)(const u_char *, unsigned long, u_char *, long *, long);
-	long (*ct_alaw)(const u_char *, unsigned long, u_char *, long *, long);
-	long (*ct_s8)(const u_char *, unsigned long, u_char *, long *, long);
-	long (*ct_u8)(const u_char *, unsigned long, u_char *, long *, long);
-	long (*ct_s16be)(const u_char *, unsigned long, u_char *, long *, long);
-	long (*ct_u16be)(const u_char *, unsigned long, u_char *, long *, long);
-	long (*ct_s16le)(const u_char *, unsigned long, u_char *, long *, long);
-	long (*ct_u16le)(const u_char *, unsigned long, u_char *, long *, long);
+	ssize_t (*ct_ulaw)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
+	ssize_t (*ct_alaw)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
+	ssize_t (*ct_s8)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
+	ssize_t (*ct_u8)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
+	ssize_t (*ct_s16be)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
+	ssize_t (*ct_u16be)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
+	ssize_t (*ct_s16le)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
+	ssize_t (*ct_u16le)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
 } TRANS;
 
 struct sound_settings {
@@ -720,10 +756,10 @@
 #if defined(CONFIG_ATARI) || defined(CONFIG_AMIGA)
 static int sound_set_treble(int treble);
 #endif /* CONFIG_ATARI || CONFIG_AMIGA */
-static long sound_copy_translate(const u_char *userPtr,
-				 unsigned long userCount,
-				 u_char frame[], long *frameUsed,
-				 long frameLeft);
+static ssize_t sound_copy_translate(const u_char *userPtr,
+				    size_t userCount,
+				    u_char frame[], ssize_t *frameUsed,
+				    ssize_t frameLeft);
 
 
 /*
@@ -736,13 +772,6 @@
 
 static struct sound_mixer mixer;
 
-static void mixer_init(void);
-static int mixer_open(int open_mode);
-static int mixer_release(void);
-static int mixer_ioctl(struct inode *inode, struct file *file, u_int cmd,
-		       u_long arg);
-
-
 /*
  * Sound queue stuff, the heart of the driver
  */
@@ -787,16 +816,6 @@
 	interruptible_sleep_on(&queue);
 #define WAKE_UP(queue)	(wake_up_interruptible(&queue))
 
-static void sq_init(int numBufs, int bufSize, char **buffers);
-static void sq_play(void);
-static long sq_write(const char *src, unsigned long uLeft);
-static int sq_open(int open_mode);
-static void sq_reset(void);
-static int sq_sync(void);
-static int sq_release(void);
-static void init_settings(void);
-
-
 /*
  * /dev/sndstat
  */
@@ -809,23 +828,9 @@
 
 static struct sound_state state;
 
-static void state_init(void);
-static int state_open(int open_mode);
-static int state_release(void);
-static long state_read(char *dest, unsigned long count);
+/*** Common stuff ********************************************************/
 
-
-/*** High level stuff ********************************************************/
-
-
-static int sound_open(struct inode *inode, struct file *file);
-static int sound_fsync(struct file *filp, struct dentry *dentry);
-static int sound_release(struct inode *inode, struct file *file);
 static long long sound_lseek(struct file *file, long long offset, int orig);
-static ssize_t sound_read(struct file *file, char *buf, size_t count,
-			  loff_t *ppos);
-static ssize_t sound_write(struct file *file, const char *buf, size_t count,
-			   loff_t *ppos);
 static inline int ioctl_return(int *addr, int value)
 {
 	if (value < 0)
@@ -833,15 +838,12 @@
 
 	return put_user(value, addr)? -EFAULT: 0;
 }
-static int unknown_minor_dev(char *fname, int dev);
-static int sound_ioctl(struct inode *inode, struct file *file, u_int cmd,
-		       u_long arg);
 
 
 /*** Config & Setup **********************************************************/
 
 
-void soundcard_init(void);
+void dmasound_init(void);
 void dmasound_setup(char *str, int *ints);
 
 
@@ -873,11 +875,12 @@
  */
 
 #ifdef CONFIG_ATARI
-static long ata_ct_law(const u_char *userPtr, unsigned long userCount,
-		       u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ata_ct_law(const u_char *userPtr, size_t userCount,
+			  u_char frame[], ssize_t *frameUsed,
+			  ssize_t frameLeft)
 {
 	char *table = sound.soft.format == AFMT_MU_LAW ? ulaw2dma8 : alaw2dma8;
-	long count, used;
+	ssize_t count, used;
 	u_char *p = &frame[*frameUsed];
 
 	count = min(userCount, frameLeft);
@@ -892,14 +895,15 @@
 		count--;
 	}
 	*frameUsed += used;
-	return(used);
+	return used;
 }
 
 
-static long ata_ct_s8(const u_char *userPtr, unsigned long userCount,
-		      u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ata_ct_s8(const u_char *userPtr, size_t userCount,
+			 u_char frame[], ssize_t *frameUsed,
+			 ssize_t frameLeft)
 {
-	long count, used;
+	ssize_t count, used;
 	void *p = &frame[*frameUsed];
 
 	count = min(userCount, frameLeft);
@@ -913,10 +917,11 @@
 }
 
 
-static long ata_ct_u8(const u_char *userPtr, unsigned long userCount,
-		      u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ata_ct_u8(const u_char *userPtr, size_t userCount,
+			 u_char frame[], ssize_t *frameUsed,
+			 ssize_t frameLeft)
 {
-	long count, used;
+	ssize_t count, used;
 
 	if (!sound.soft.stereo) {
 		u_char *p = &frame[*frameUsed];
@@ -946,10 +951,11 @@
 }
 
 
-static long ata_ct_s16be(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ata_ct_s16be(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft)
 {
-	long count, used;
+	ssize_t count, used;
 	u_long data;
 
 	if (!sound.soft.stereo) {
@@ -976,10 +982,11 @@
 }
 
 
-static long ata_ct_u16be(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ata_ct_u16be(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft)
 {
-	long count, used;
+	ssize_t count, used;
 	u_long data;
 
 	if (!sound.soft.stereo) {
@@ -1011,10 +1018,11 @@
 }
 
 
-static long ata_ct_s16le(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ata_ct_s16le(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft)
 {
-	long count, used;
+	ssize_t count, used;
 	u_long data;
 
 	count = frameLeft;
@@ -1048,10 +1056,11 @@
 }
 
 
-static long ata_ct_u16le(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ata_ct_u16le(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft)
 {
-	long count, used;
+	ssize_t count, used;
 	u_long data;
 
 	count = frameLeft;
@@ -1084,15 +1093,16 @@
 }
 
 
-static long ata_ctx_law(const u_char *userPtr, unsigned long userCount,
-			u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ata_ctx_law(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft)
 {
 	char *table = sound.soft.format == AFMT_MU_LAW ? ulaw2dma8 : alaw2dma8;
 	/* this should help gcc to stuff everything into registers */
 	u_long data = sound.data;
 	long bal = sound.bal;
 	long hSpeed = sound.hard.speed, sSpeed = sound.soft.speed;
-	long used, usedf;
+	ssize_t used, usedf;
 
 	used = userCount;
 	usedf = frameLeft;
@@ -1142,14 +1152,15 @@
 }
 
 
-static long ata_ctx_s8(const u_char *userPtr, unsigned long userCount,
-		       u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ata_ctx_s8(const u_char *userPtr, size_t userCount,
+			  u_char frame[], ssize_t *frameUsed,
+			  ssize_t frameLeft)
 {
 	/* this should help gcc to stuff everything into registers */
 	u_long data = sound.data;
 	long bal = sound.bal;
 	long hSpeed = sound.hard.speed, sSpeed = sound.soft.speed;
-	long used, usedf;
+	ssize_t used, usedf;
 
 	used = userCount;
 	usedf = frameLeft;
@@ -1192,14 +1203,15 @@
 }
 
 
-static long ata_ctx_u8(const u_char *userPtr, unsigned long userCount,
-		       u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ata_ctx_u8(const u_char *userPtr, size_t userCount,
+			  u_char frame[], ssize_t *frameUsed,
+			  ssize_t frameLeft)
 {
 	/* this should help gcc to stuff everything into registers */
 	u_long data = sound.data;
 	long bal = sound.bal;
 	long hSpeed = sound.hard.speed, sSpeed = sound.soft.speed;
-	long used, usedf;
+	ssize_t used, usedf;
 
 	used = userCount;
 	usedf = frameLeft;
@@ -1244,14 +1256,15 @@
 }
 
 
-static long ata_ctx_s16be(const u_char *userPtr, unsigned long userCount,
-			  u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ata_ctx_s16be(const u_char *userPtr, size_t userCount,
+			     u_char frame[], ssize_t *frameUsed,
+			     ssize_t frameLeft)
 {
 	/* this should help gcc to stuff everything into registers */
 	u_long data = sound.data;
 	long bal = sound.bal;
 	long hSpeed = sound.hard.speed, sSpeed = sound.soft.speed;
-	long used, usedf;
+	ssize_t used, usedf;
 
 	used = userCount;
 	usedf = frameLeft;
@@ -1295,14 +1308,15 @@
 }
 
 
-static long ata_ctx_u16be(const u_char *userPtr, unsigned long userCount,
-			  u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ata_ctx_u16be(const u_char *userPtr, size_t userCount,
+			     u_char frame[], ssize_t *frameUsed,
+			     ssize_t frameLeft)
 {
 	/* this should help gcc to stuff everything into registers */
 	u_long data = sound.data;
 	long bal = sound.bal;
 	long hSpeed = sound.hard.speed, sSpeed = sound.soft.speed;
-	long used, usedf;
+	ssize_t used, usedf;
 
 	used = userCount;
 	usedf = frameLeft;
@@ -1348,14 +1362,15 @@
 }
 
 
-static long ata_ctx_s16le(const u_char *userPtr, unsigned long userCount,
-			  u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ata_ctx_s16le(const u_char *userPtr, size_t userCount,
+			     u_char frame[], ssize_t *frameUsed,
+			     ssize_t frameLeft)
 {
 	/* this should help gcc to stuff everything into registers */
 	u_long data = sound.data;
 	long bal = sound.bal;
 	long hSpeed = sound.hard.speed, sSpeed = sound.soft.speed;
-	long used, usedf;
+	ssize_t used, usedf;
 
 	used = userCount;
 	usedf = frameLeft;
@@ -1401,14 +1416,15 @@
 }
 
 
-static long ata_ctx_u16le(const u_char *userPtr, unsigned long userCount,
-			  u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ata_ctx_u16le(const u_char *userPtr, size_t userCount,
+			     u_char frame[], ssize_t *frameUsed,
+			     ssize_t frameLeft)
 {
 	/* this should help gcc to stuff everything into registers */
 	u_long data = sound.data;
 	long bal = sound.bal;
 	long hSpeed = sound.hard.speed, sSpeed = sound.soft.speed;
-	long used, usedf;
+	ssize_t used, usedf;
 
 	used = userCount;
 	usedf = frameLeft;
@@ -1456,11 +1472,12 @@
 
 
 #ifdef CONFIG_AMIGA
-static long ami_ct_law(const u_char *userPtr, unsigned long userCount,
-		       u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ami_ct_law(const u_char *userPtr, size_t userCount,
+			  u_char frame[], ssize_t *frameUsed,
+			  ssize_t frameLeft)
 {
 	char *table = sound.soft.format == AFMT_MU_LAW ? ulaw2dma8 : alaw2dma8;
-	long count, used;
+	ssize_t count, used;
 
 	if (!sound.soft.stereo) {
 		u_char *p = &frame[*frameUsed];
@@ -1494,10 +1511,10 @@
 }
 
 
-static long ami_ct_s8(const u_char *userPtr, unsigned long userCount,
-		      u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ami_ct_s8(const u_char *userPtr, size_t userCount,
+			 u_char frame[], ssize_t *frameUsed, ssize_t frameLeft)
 {
-	long count, used;
+	ssize_t count, used;
 
 	if (!sound.soft.stereo) {
 		void *p = &frame[*frameUsed];
@@ -1522,10 +1539,10 @@
 }
 
 
-static long ami_ct_u8(const u_char *userPtr, unsigned long userCount,
-		      u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ami_ct_u8(const u_char *userPtr, size_t userCount,
+			 u_char frame[], ssize_t *frameUsed, ssize_t frameLeft)
 {
-	long count, used;
+	ssize_t count, used;
 
 	if (!sound.soft.stereo) {
 		char *p = &frame[*frameUsed];
@@ -1559,10 +1576,11 @@
 }
 
 
-static long ami_ct_s16be(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ami_ct_s16be(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft)
 {
-	long count, used;
+	ssize_t count, used;
 	u_long data;
 
 	if (!sound.soft.stereo) {
@@ -1601,10 +1619,11 @@
 }
 
 
-static long ami_ct_u16be(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ami_ct_u16be(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft)
 {
-	long count, used;
+	ssize_t count, used;
 	u_long data;
 
 	if (!sound.soft.stereo) {
@@ -1646,10 +1665,11 @@
 }
 
 
-static long ami_ct_s16le(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ami_ct_s16le(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft)
 {
-	long count, used;
+	ssize_t count, used;
 	u_long data;
 
 	if (!sound.soft.stereo) {
@@ -1691,10 +1711,11 @@
 }
 
 
-static long ami_ct_u16le(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t ami_ct_u16le(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft)
 {
-	long count, used;
+	ssize_t count, used;
 	u_long data;
 
 	if (!sound.soft.stereo) {
@@ -1737,11 +1758,12 @@
 #endif /* CONFIG_AMIGA */
 
 #ifdef CONFIG_PMAC
-static long pmac_ct_law(const u_char *userPtr, unsigned long userCount,
-			u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t pmac_ct_law(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft)
 {
 	short *table = sound.soft.format == AFMT_MU_LAW ? ulaw2dma16: alaw2dma16;
-	long count, used;
+	ssize_t count, used;
 	short *p = (short *) &frame[*frameUsed];
 	int val, stereo = sound.soft.stereo;
 
@@ -1768,10 +1790,11 @@
 }
 
 
-static long pmac_ct_s8(const u_char *userPtr, unsigned long userCount,
-		       u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t pmac_ct_s8(const u_char *userPtr, size_t userCount,
+			  u_char frame[], ssize_t *frameUsed,
+			  ssize_t frameLeft)
 {
-	long count, used;
+	ssize_t count, used;
 	short *p = (short *) &frame[*frameUsed];
 	int val, stereo = sound.soft.stereo;
 
@@ -1798,10 +1821,11 @@
 }
 
 
-static long pmac_ct_u8(const u_char *userPtr, unsigned long userCount,
-		       u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t pmac_ct_u8(const u_char *userPtr, size_t userCount,
+			  u_char frame[], ssize_t *frameUsed,
+			  ssize_t frameLeft)
 {
-	long count, used;
+	ssize_t count, used;
 	short *p = (short *) &frame[*frameUsed];
 	int val, stereo = sound.soft.stereo;
 
@@ -1828,10 +1852,11 @@
 }
 
 
-static long pmac_ct_s16(const u_char *userPtr, unsigned long userCount,
-			u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t pmac_ct_s16(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft)
 {
-	long count, used;
+	ssize_t count, used;
 	int stereo = sound.soft.stereo;
 	short *fp = (short *) &frame[*frameUsed];
 
@@ -1856,10 +1881,11 @@
 	return stereo? used * 4: used * 2;
 }
 
-static long pmac_ct_u16(const u_char *userPtr, unsigned long userCount,
-			u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t pmac_ct_u16(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft)
 {
-	long count, used;
+	ssize_t count, used;
 	int mask = (sound.soft.format == AFMT_U16_LE? 0x0080: 0x8000);
 	int stereo = sound.soft.stereo;
 	short *fp = (short *) &frame[*frameUsed];
@@ -1887,8 +1913,9 @@
 }
 
 
-static long pmac_ctx_law(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t pmac_ctx_law(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft)
 {
 	unsigned short *table = (unsigned short *)
 		(sound.soft.format == AFMT_MU_LAW ? ulaw2dma16: alaw2dma16);
@@ -1933,8 +1960,9 @@
 }
 
 
-static long pmac_ctx_s8(const u_char *userPtr, unsigned long userCount,
-			u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t pmac_ctx_s8(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft)
 {
 	unsigned int *p = (unsigned int *) &frame[*frameUsed];
 	unsigned int data = sound.data;
@@ -1977,8 +2005,9 @@
 }
 
 
-static long pmac_ctx_u8(const u_char *userPtr, unsigned long userCount,
-			u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t pmac_ctx_u8(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft)
 {
 	unsigned int *p = (unsigned int *) &frame[*frameUsed];
 	unsigned int data = sound.data;
@@ -2021,8 +2050,9 @@
 }
 
 
-static long pmac_ctx_s16(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t pmac_ctx_s16(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft)
 {
 	unsigned int *p = (unsigned int *) &frame[*frameUsed];
 	unsigned int data = sound.data;
@@ -2065,8 +2095,9 @@
 }
 
 
-static long pmac_ctx_u16(const u_char *userPtr, unsigned long userCount,
-			 u_char frame[], long *frameUsed, long frameLeft)
+static ssize_t pmac_ctx_u16(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft)
 {
 	int mask = (sound.soft.format == AFMT_U16_LE? 0x0080: 0x8000);
 	unsigned int *p = (unsigned int *) &frame[*frameUsed];
@@ -3424,12 +3455,12 @@
 #endif /* CONFIG_ATARI || CONFIG_AMIGA */
 
 
-static long sound_copy_translate(const u_char *userPtr,
-				 unsigned long userCount,
-				 u_char frame[], long *frameUsed,
-				 long frameLeft)
+static ssize_t sound_copy_translate(const u_char *userPtr,
+				    size_t userCount,
+				    u_char frame[], ssize_t *frameUsed,
+				    ssize_t frameLeft)
 {
-	long (*ct_func)(const u_char *, unsigned long, u_char *, long *, long) = NULL;
+	ssize_t (*ct_func)(const u_char *, size_t, u_char *, ssize_t *, ssize_t) = NULL;
 
 	switch (sound.soft.format) {
 	case AFMT_MU_LAW:
@@ -3458,9 +3489,9 @@
 		break;
 	}
 	if (ct_func)
-		return(ct_func(userPtr, userCount, frame, frameUsed, frameLeft));
+		return ct_func(userPtr, userCount, frame, frameUsed, frameLeft);
 	else
-		return(0);
+		return 0;
 }
 
 
@@ -3474,53 +3505,19 @@
 #define RECLEVEL_GAIN_TO_VOXWARE(v) (((v) * 20 + 2) / 3)
 
 
-static void mixer_init(void)
-{
-	mixer.busy = 0;
-	sound.treble = 0;
-	sound.bass = 0;
-	switch (sound.mach.type) {
-#ifdef CONFIG_ATARI
-	case DMASND_TT:
-		atari_microwire_cmd(MW_LM1992_VOLUME(0));
-		sound.volume_left = 0;
-		atari_microwire_cmd(MW_LM1992_BALLEFT(0));
-		sound.volume_right = 0;
-		atari_microwire_cmd(MW_LM1992_BALRIGHT(0));
-		atari_microwire_cmd(MW_LM1992_TREBLE(0));
-		atari_microwire_cmd(MW_LM1992_BASS(0));
-		break;
-	case DMASND_FALCON:
-		sound.volume_left = (tt_dmasnd.output_atten & 0xf00) >> 8;
-		sound.volume_right = (tt_dmasnd.output_atten & 0xf0) >> 4;
-		break;
-#endif /* CONFIG_ATARI */
-#ifdef CONFIG_AMIGA
-	case DMASND_AMIGA:
-		sound.volume_left = 64;
-		sound.volume_right = 64;
-		custom.aud[0].audvol = sound.volume_left;
-		custom.aud[3].audvol = 1;	/* For pseudo 14bit */
-		custom.aud[1].audvol = sound.volume_right;
-		custom.aud[2].audvol = 1;	/* For pseudo 14bit */
-		sound.treble = 50;
-		break;
-#endif /* CONFIG_AMIGA */
-	}
-}
-
-
-static int mixer_open(int open_mode)
+static int mixer_open(struct inode *inode, struct file *file)
 {
+	MOD_INC_USE_COUNT;
 	mixer.busy = 1;
-	return(0);
+	return 0;
 }
 
 
-static int mixer_release(void)
+static int mixer_release(struct inode *inode, struct file *file)
 {
 	mixer.busy = 0;
-	return(0);
+	MOD_DEC_USE_COUNT;
+	return 0;
 }
 
 
@@ -3533,17 +3530,17 @@
 	case DMASND_FALCON:
 		switch (cmd) {
 		case SOUND_MIXER_READ_DEVMASK:
-			return(IOCTL_OUT(arg, SOUND_MASK_VOLUME | SOUND_MASK_MIC | SOUND_MASK_SPEAKER));
+			return IOCTL_OUT(arg, SOUND_MASK_VOLUME | SOUND_MASK_MIC | SOUND_MASK_SPEAKER);
 		case SOUND_MIXER_READ_RECMASK:
-			return(IOCTL_OUT(arg, SOUND_MASK_MIC));
+			return IOCTL_OUT(arg, SOUND_MASK_MIC);
 		case SOUND_MIXER_READ_STEREODEVS:
-			return(IOCTL_OUT(arg, SOUND_MASK_VOLUME | SOUND_MASK_MIC));
+			return IOCTL_OUT(arg, SOUND_MASK_VOLUME | SOUND_MASK_MIC);
 		case SOUND_MIXER_READ_CAPS:
-			return(IOCTL_OUT(arg, SOUND_CAP_EXCL_INPUT));
+			return IOCTL_OUT(arg, SOUND_CAP_EXCL_INPUT);
 		case SOUND_MIXER_READ_VOLUME:
-			return(IOCTL_OUT(arg,
+			return IOCTL_OUT(arg,
 				VOLUME_ATT_TO_VOXWARE(sound.volume_left) |
-				VOLUME_ATT_TO_VOXWARE(sound.volume_right) << 8));
+				VOLUME_ATT_TO_VOXWARE(sound.volume_right) << 8);
 		case SOUND_MIXER_WRITE_MIC:
 			IOCTL_IN(arg, data);
 			tt_dmasnd.input_gain =
@@ -3551,9 +3548,9 @@
 				RECLEVEL_VOXWARE_TO_GAIN(data >> 8 & 0xff);
 			/* fall thru, return set value */
 		case SOUND_MIXER_READ_MIC:
-			return(IOCTL_OUT(arg,
+			return IOCTL_OUT(arg,
 				RECLEVEL_GAIN_TO_VOXWARE(tt_dmasnd.input_gain >> 4 & 0xf) |
-				RECLEVEL_GAIN_TO_VOXWARE(tt_dmasnd.input_gain & 0xf) << 8));
+				RECLEVEL_GAIN_TO_VOXWARE(tt_dmasnd.input_gain & 0xf) << 8);
 		case SOUND_MIXER_READ_SPEAKER:
 			{
 				int porta;
@@ -3561,11 +3558,11 @@
 				sound_ym.rd_data_reg_sel = 14;
 				porta = sound_ym.rd_data_reg_sel;
 				sti();
-				return(IOCTL_OUT(arg, porta & 0x40 ? 0 : 100));
+				return IOCTL_OUT(arg, porta & 0x40 ? 0 : 100);
 			}
 		case SOUND_MIXER_WRITE_VOLUME:
 			IOCTL_IN(arg, data);
-			return(IOCTL_OUT(arg, sound_set_volume(data)));
+			return IOCTL_OUT(arg, sound_set_volume(data));
 		case SOUND_MIXER_WRITE_SPEAKER:
 			{
 				int porta;
@@ -3576,7 +3573,7 @@
 					(data < 50 ? 0x40 : 0);
 				sound_ym.wd_data = porta;
 				sti();
-				return(IOCTL_OUT(arg, porta & 0x40 ? 0 : 100));
+				return IOCTL_OUT(arg, porta & 0x40 ? 0 : 100);
 			}
 		}
 		break;
@@ -3584,23 +3581,23 @@
 	case DMASND_TT:
 		switch (cmd) {
 		case SOUND_MIXER_READ_DEVMASK:
-			return(IOCTL_OUT(arg,
+			return IOCTL_OUT(arg,
 					 SOUND_MASK_VOLUME | SOUND_MASK_TREBLE | SOUND_MASK_BASS |
-					 (MACH_IS_TT ? SOUND_MASK_SPEAKER : 0)));
+					 (MACH_IS_TT ? SOUND_MASK_SPEAKER : 0));
 		case SOUND_MIXER_READ_RECMASK:
-			return(IOCTL_OUT(arg, 0));
+			return IOCTL_OUT(arg, 0);
 		case SOUND_MIXER_READ_STEREODEVS:
-			return(IOCTL_OUT(arg, SOUND_MASK_VOLUME));
+			return IOCTL_OUT(arg, SOUND_MASK_VOLUME);
 		case SOUND_MIXER_READ_VOLUME:
-			return(IOCTL_OUT(arg,
+			return IOCTL_OUT(arg,
 					 VOLUME_DB_TO_VOXWARE(sound.volume_left) |
-					 (VOLUME_DB_TO_VOXWARE(sound.volume_right) << 8)));
+					 (VOLUME_DB_TO_VOXWARE(sound.volume_right) << 8));
 		case SOUND_MIXER_READ_BASS:
-			return(IOCTL_OUT(arg, TONE_DB_TO_VOXWARE(sound.bass)));
+			return IOCTL_OUT(arg, TONE_DB_TO_VOXWARE(sound.bass));
 		case SOUND_MIXER_READ_TREBLE:
-			return(IOCTL_OUT(arg, TONE_DB_TO_VOXWARE(sound.treble)));
+			return IOCTL_OUT(arg, TONE_DB_TO_VOXWARE(sound.treble));
 		case SOUND_MIXER_READ_OGAIN:
-			return(IOCTL_OUT(arg, GAIN_DB_TO_VOXWARE(sound.gain)));
+			return IOCTL_OUT(arg, GAIN_DB_TO_VOXWARE(sound.gain));
 		case SOUND_MIXER_READ_SPEAKER:
 			{
 				int porta;
@@ -3609,22 +3606,22 @@
 					sound_ym.rd_data_reg_sel = 14;
 					porta = sound_ym.rd_data_reg_sel;
 					sti();
-					return(IOCTL_OUT(arg, porta & 0x40 ? 0 : 100));
-				} else
-					return(-EINVAL);
+					return IOCTL_OUT(arg, porta & 0x40 ? 0 : 100);
+				}
 			}
+			break;
 		case SOUND_MIXER_WRITE_VOLUME:
 			IOCTL_IN(arg, data);
-			return(IOCTL_OUT(arg, sound_set_volume(data)));
+			return IOCTL_OUT(arg, sound_set_volume(data));
 		case SOUND_MIXER_WRITE_BASS:
 			IOCTL_IN(arg, data);
-			return(IOCTL_OUT(arg, sound_set_bass(data)));
+			return IOCTL_OUT(arg, sound_set_bass(data));
 		case SOUND_MIXER_WRITE_TREBLE:
 			IOCTL_IN(arg, data);
-			return(IOCTL_OUT(arg, sound_set_treble(data)));
+			return IOCTL_OUT(arg, sound_set_treble(data));
 		case SOUND_MIXER_WRITE_OGAIN:
 			IOCTL_IN(arg, data);
-			return(IOCTL_OUT(arg, sound_set_gain(data)));
+			return IOCTL_OUT(arg, sound_set_gain(data));
 		case SOUND_MIXER_WRITE_SPEAKER:
 			if (MACH_IS_TT) {
 				int porta;
@@ -3635,9 +3632,8 @@
 					(data < 50 ? 0x40 : 0);
 				sound_ym.wd_data = porta;
 				sti();
-				return(IOCTL_OUT(arg, porta & 0x40 ? 0 : 100));
-			} else
-				return(-EINVAL);
+				return IOCTL_OUT(arg, porta & 0x40 ? 0 : 100);
+			}
 		}
 		break;
 #endif /* CONFIG_ATARI */
@@ -3646,23 +3642,23 @@
 	case DMASND_AMIGA:
 		switch (cmd) {
 		case SOUND_MIXER_READ_DEVMASK:
-			return(IOCTL_OUT(arg, SOUND_MASK_VOLUME | SOUND_MASK_TREBLE));
+			return IOCTL_OUT(arg, SOUND_MASK_VOLUME | SOUND_MASK_TREBLE);
 		case SOUND_MIXER_READ_RECMASK:
-			return(IOCTL_OUT(arg, 0));
+			return IOCTL_OUT(arg, 0);
 		case SOUND_MIXER_READ_STEREODEVS:
-			return(IOCTL_OUT(arg, SOUND_MASK_VOLUME));
+			return IOCTL_OUT(arg, SOUND_MASK_VOLUME);
 		case SOUND_MIXER_READ_VOLUME:
-			return(IOCTL_OUT(arg,
+			return IOCTL_OUT(arg,
 				VOLUME_AMI_TO_VOXWARE(sound.volume_left) |
-				VOLUME_AMI_TO_VOXWARE(sound.volume_right) << 8));
+				VOLUME_AMI_TO_VOXWARE(sound.volume_right) << 8);
 		case SOUND_MIXER_WRITE_VOLUME:
 			IOCTL_IN(arg, data);
-			return(IOCTL_OUT(arg, sound_set_volume(data)));
+			return IOCTL_OUT(arg, sound_set_volume(data));
 		case SOUND_MIXER_READ_TREBLE:
-			return(IOCTL_OUT(arg, sound.treble));
+			return IOCTL_OUT(arg, sound.treble);
 		case SOUND_MIXER_WRITE_TREBLE:
 			IOCTL_IN(arg, data);
-			return(IOCTL_OUT(arg, sound_set_treble(data)));
+			return IOCTL_OUT(arg, sound_set_treble(data));
 		}
 		break;
 #endif /* CONFIG_AMIGA */
@@ -3777,17 +3773,70 @@
 #endif
 	}
 
-	return(-EINVAL);
+	return -EINVAL;
 }
 
 
+static struct file_operations mixer_fops =
+{
+	sound_lseek,
+	NULL,			/* mixer_read */
+	NULL,			/* mixer_write */
+	NULL,			/* mixer_readdir */
+	NULL,			/* mixer_poll */
+	mixer_ioctl,
+	NULL,			/* mixer_mmap */
+	mixer_open,
+	mixer_release,
+};
+
+
+static void mixer_init(void)
+{
+	mixer_unit = register_sound_mixer(&mixer_fops);
+	if (mixer_unit < 0)
+		return;
+
+	mixer.busy = 0;
+	sound.treble = 0;
+	sound.bass = 0;
+	switch (sound.mach.type) {
+#ifdef CONFIG_ATARI
+	case DMASND_TT:
+		atari_microwire_cmd(MW_LM1992_VOLUME(0));
+		sound.volume_left = 0;
+		atari_microwire_cmd(MW_LM1992_BALLEFT(0));
+		sound.volume_right = 0;
+		atari_microwire_cmd(MW_LM1992_BALRIGHT(0));
+		atari_microwire_cmd(MW_LM1992_TREBLE(0));
+		atari_microwire_cmd(MW_LM1992_BASS(0));
+		break;
+	case DMASND_FALCON:
+		sound.volume_left = (tt_dmasnd.output_atten & 0xf00) >> 8;
+		sound.volume_right = (tt_dmasnd.output_atten & 0xf0) >> 4;
+		break;
+#endif /* CONFIG_ATARI */
+#ifdef CONFIG_AMIGA
+	case DMASND_AMIGA:
+		sound.volume_left = 64;
+		sound.volume_right = 64;
+		custom.aud[0].audvol = sound.volume_left;
+		custom.aud[3].audvol = 1;	/* For pseudo 14bit */
+		custom.aud[1].audvol = sound.volume_right;
+		custom.aud[2].audvol = 1;	/* For pseudo 14bit */
+		sound.treble = 50;
+		break;
+#endif /* CONFIG_AMIGA */
+	}
+}
+
 
 /*
  * Sound queue stuff, the heart of the driver
  */
 
 
-static void sq_init(int numBufs, int bufSize, char **buffers)
+static void sq_setup(int numBufs, int bufSize, char **buffers)
 {
 #ifdef CONFIG_PMAC
 	int i;
@@ -3827,47 +3876,6 @@
 #endif /* CONFIG_PMAC */
 }
 
-static void
-init_settings(void)
-{
-	/* whatever you like as startup mode for /dev/dsp,
-	 * (/dev/audio hasn't got a startup mode). note that
-	 * once changed a new open() will *not* restore these!
-	 */
-	sound.dsp.format = AFMT_U8;
-	sound.dsp.stereo = 0;
-	sound.dsp.size = 8;
-
-	/* set minimum rate possible without expanding */
-	switch (sound.mach.type) {
-#ifdef CONFIG_ATARI
-	case DMASND_TT:
-		sound.dsp.speed = 6258;
-		break;
-	case DMASND_FALCON:
-		sound.dsp.speed = 8195;
-		break;
-#endif /* CONFIG_ATARI */
-#ifdef CONFIG_AMIGA
-	case DMASND_AMIGA:
-		sound.dsp.speed = 8000;
-		break;
-#endif /* CONFIG_AMIGA */
-#ifdef CONFIG_PMAC
-	case DMASND_AWACS:
-		sound.dsp.speed = 8000;
-		break;
-#endif /* CONFIG_PMAC */
-	}
-
-	/* before the first open to /dev/dsp this wouldn't be set */
-	sound.soft = sound.dsp;
-	sound.hard = sound.dsp;
-
-	sound_silence();
-}
-
-
 static void sq_play(void)
 {
 	(*sound.mach.play)();
@@ -3876,18 +3884,19 @@
 
 /* ++TeSche: radically changed this one too */
 
-static long sq_write(const char *src, unsigned long uLeft)
+static ssize_t sq_write(struct file *file, const char *src, size_t uLeft,
+			loff_t *ppos)
 {
-	long uWritten = 0;
+	ssize_t uWritten = 0;
 	u_char *dest;
-	long uUsed, bUsed, bLeft;
+	ssize_t uUsed, bUsed, bLeft;
 
 	/* ++TeSche: Is something like this necessary?
 	 * Hey, that's an honest question! Or does any other part of the
 	 * filesystem already checks this situation? I really don't know.
 	 */
 	if (uLeft == 0)
-		return(0);
+		return 0;
 
 	/* The interrupt doesn't start to play the last, incomplete frame.
 	 * Thus we can append to it without disabling the interrupts! (Note
@@ -3910,10 +3919,10 @@
 		while (sq.count == sq.max_active) {
 			sq_play();
 			if (NON_BLOCKING(sq.open_mode))
-				return(uWritten > 0 ? uWritten : -EAGAIN);
+				return uWritten > 0 ? uWritten : -EAGAIN;
 			SLEEP(sq.write_queue, ONE_SECOND);
 			if (SIGNAL_RECEIVED)
-				return(uWritten > 0 ? uWritten : -EINTR);
+				return uWritten > 0 ? uWritten : -EINTR;
 		}
 
 		/* Here, we can avoid disabling the interrupt by first
@@ -3941,28 +3950,46 @@
 
 	sq_play();
 
-	return(uUsed < 0? uUsed: uWritten);
+	return uUsed < 0? uUsed: uWritten;
 }
 
 
-static int sq_open(int open_mode)
+static int sq_open(struct inode *inode, struct file *file)
 {
+	int rc = 0;
+
+	MOD_INC_USE_COUNT;
 	if (sq.busy) {
-		if (NON_BLOCKING(open_mode))
-			return(-EBUSY);
+		rc = -EBUSY;
+		if (NON_BLOCKING(file->f_flags))
+			goto err_out;
+		rc = -EINTR;
 		while (sq.busy) {
 			SLEEP(sq.open_queue, ONE_SECOND);
 			if (SIGNAL_RECEIVED)
-				return(-EINTR);
+				goto err_out;
 		}
+		rc = 0;
 	}
-	sq_init(numBufs, bufSize << 10, sound_buffers);
-	sq.open_mode = open_mode;
+	sq_setup(numBufs, bufSize << 10, sound_buffers);
+	sq.open_mode = file->f_flags;
 	sq.busy = 1;
 #ifdef CONFIG_ATARI
 	sq.ignore_int = 1;
 #endif /* CONFIG_ATARI */
-	return(0);
+	sound.minDev = MINOR(inode->i_rdev) & 0x0f;
+	sound.soft = sound.dsp;
+	sound.hard = sound.dsp;
+	sound_init();
+	if ((MINOR(inode->i_rdev) & 0x0f) == SND_DEV_AUDIO) {
+		sound_set_speed(8000);
+		sound_set_stereo(0);
+		sound_set_format(AFMT_MU_LAW);
+	}
+	return 0;
+err_out:
+	MOD_DEC_USE_COUNT;
+	return rc;
 }
 
 
@@ -3975,7 +4002,7 @@
 }
 
 
-static int sq_sync(void)
+static int sq_fsync(struct file *filp, struct dentry *dentry)
 {
 	int rc = 0;
 
@@ -3995,47 +4022,192 @@
 	}
 
 	sq.syncing = 0;
-	return(rc);
+	return rc;
 }
 
-
-static int sq_release(void)
+static int sq_release(struct inode *inode, struct file *file)
 {
 	int rc = 0;
 	if (sq.busy) {
-		rc = sq_sync();
+		rc = sq_fsync(file, file->f_dentry);
 		sq.busy = 0;
 		WAKE_UP(sq.open_queue);
 		/* Wake up a process waiting for the queue being released.
 		 * Note: There may be several processes waiting for a call
 		 * to open() returning. */
 	}
-	return(rc);
+	sound.soft = sound.dsp;
+	sound.hard = sound.dsp;
+	sound_silence();
+	if (rc == 0)
+		MOD_DEC_USE_COUNT;
+	return rc;
 }
 
 
+static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd,
+		    u_long arg)
+{
+	u_long fmt;
+	int data;
+	int size, nbufs;
 
-/*
- * /dev/sndstat
- */
+	switch (cmd) {
+	case SNDCTL_DSP_RESET:
+		sq_reset();
+		return 0;
+	case SNDCTL_DSP_POST:
+	case SNDCTL_DSP_SYNC:
+		return sq_fsync(file, file->f_dentry);
+
+		/* ++TeSche: before changing any of these it's
+		 * probably wise to wait until sound playing has
+		 * settled down. */
+	case SNDCTL_DSP_SPEED:
+		sq_fsync(file, file->f_dentry);
+		IOCTL_IN(arg, data);
+		return IOCTL_OUT(arg, sound_set_speed(data));
+	case SNDCTL_DSP_STEREO:
+		sq_fsync(file, file->f_dentry);
+		IOCTL_IN(arg, data);
+		return IOCTL_OUT(arg, sound_set_stereo(data));
+	case SOUND_PCM_WRITE_CHANNELS:
+		sq_fsync(file, file->f_dentry);
+		IOCTL_IN(arg, data);
+		return IOCTL_OUT(arg, sound_set_stereo(data-1)+1);
+	case SNDCTL_DSP_SETFMT:
+		sq_fsync(file, file->f_dentry);
+		IOCTL_IN(arg, data);
+		return IOCTL_OUT(arg, sound_set_format(data));
+	case SNDCTL_DSP_GETFMTS:
+		fmt = 0;
+		if (sound.trans) {
+			if (sound.trans->ct_ulaw)
+				fmt |= AFMT_MU_LAW;
+			if (sound.trans->ct_alaw)
+				fmt |= AFMT_A_LAW;
+			if (sound.trans->ct_s8)
+				fmt |= AFMT_S8;
+			if (sound.trans->ct_u8)
+				fmt |= AFMT_U8;
+			if (sound.trans->ct_s16be)
+				fmt |= AFMT_S16_BE;
+			if (sound.trans->ct_u16be)
+				fmt |= AFMT_U16_BE;
+			if (sound.trans->ct_s16le)
+				fmt |= AFMT_S16_LE;
+			if (sound.trans->ct_u16le)
+				fmt |= AFMT_U16_LE;
+		}
+		return IOCTL_OUT(arg, fmt);
+	case SNDCTL_DSP_GETBLKSIZE:
+		size = sq.block_size
+			* sound.soft.size * (sound.soft.stereo + 1)
+			/ (sound.hard.size * (sound.hard.stereo + 1));
+		return IOCTL_OUT(arg, size);
+	case SNDCTL_DSP_SUBDIVIDE:
+		break;
+	case SNDCTL_DSP_SETFRAGMENT:
+		if (sq.count || sq.playing || sq.syncing)
+			return -EINVAL;
+		IOCTL_IN(arg, size);
+		nbufs = size >> 16;
+		if (nbufs < 2 || nbufs > numBufs)
+			nbufs = numBufs;
+		size &= 0xffff;
+		if (size >= 8 && size <= 30) {
+			size = 1 << size;
+			size *= sound.hard.size * (sound.hard.stereo + 1);
+			size /= sound.soft.size * (sound.soft.stereo + 1);
+			if (size > (bufSize << 10))
+				size = bufSize << 10;
+		} else
+			size = bufSize << 10;
+		sq_setup(numBufs, size, sound_buffers);
+		sq.max_active = nbufs;
+		return 0;
 
+	default:
+		return mixer_ioctl(inode, file, cmd, arg);
+	}
+	return -EINVAL;
+}
 
-static void state_init(void)
+
+
+static struct file_operations sq_fops =
 {
-	state.busy = 0;
+	sound_lseek,
+	NULL,			/* sq_read */
+	sq_write,
+	NULL,			/* sq_readdir */
+	NULL,			/* sq_poll */
+	sq_ioctl,
+	NULL,			/* sq_mmap */
+	sq_open,
+	sq_release,
+};
+
+
+static void sq_init(void)
+{
+	sq_unit = register_sound_dsp(&sq_fops);
+	if (sq_unit < 0)
+		return;
+
+	/* whatever you like as startup mode for /dev/dsp,
+	 * (/dev/audio hasn't got a startup mode). note that
+	 * once changed a new open() will *not* restore these!
+	 */
+	sound.dsp.format = AFMT_U8;
+	sound.dsp.stereo = 0;
+	sound.dsp.size = 8;
+
+	/* set minimum rate possible without expanding */
+	switch (sound.mach.type) {
+#ifdef CONFIG_ATARI
+	case DMASND_TT:
+		sound.dsp.speed = 6258;
+		break;
+	case DMASND_FALCON:
+		sound.dsp.speed = 8195;
+		break;
+#endif /* CONFIG_ATARI */
+#ifdef CONFIG_AMIGA
+	case DMASND_AMIGA:
+		sound.dsp.speed = 8000;
+		break;
+#endif /* CONFIG_AMIGA */
+#ifdef CONFIG_PMAC
+	case DMASND_AWACS:
+		sound.dsp.speed = 8000;
+		break;
+#endif /* CONFIG_PMAC */
+	}
+
+	/* before the first open to /dev/dsp this wouldn't be set */
+	sound.soft = sound.dsp;
+	sound.hard = sound.dsp;
+
+	sound_silence();
 }
 
+/*
+ * /dev/sndstat
+ */
+
 
 /* state.buf should not overflow! */
 
-static int state_open(int open_mode)
+static int state_open(struct inode *inode, struct file *file)
 {
 	char *buffer = state.buf, *mach = "";
 	int len = 0;
 
 	if (state.busy)
-		return(-EBUSY);
+		return -EBUSY;
 
+	MOD_INC_USE_COUNT;
 	state.ptr = 0;
 	state.busy = 1;
 
@@ -4127,117 +4299,57 @@
 	len += sprintf(buffer+len, "\tsq.playing = %d sq.syncing = %d\n",
 		       sq.playing, sq.syncing);
 	state.len = len;
-	return(0);
+	return 0;
 }
 
 
-static int state_release(void)
+static int state_release(struct inode *inode, struct file *file)
 {
 	state.busy = 0;
-	return(0);
+	MOD_DEC_USE_COUNT;
+	return 0;
 }
 
 
-static long state_read(char *dest, unsigned long count)
+static ssize_t state_read(struct file *file, char *buf, size_t count,
+			  loff_t *ppos)
 {
-	int n = state.len-state.ptr;
+	int n = state.len - state.ptr;
 	if (n > count)
 		n = count;
 	if (n <= 0)
-		return(0);
-	if (copy_to_user(dest, &state.buf[state.ptr], n))
+		return 0;
+	if (copy_to_user(buf, &state.buf[state.ptr], n))
 		return -EFAULT;
 	state.ptr += n;
-	return(n);
+	return n;
 }
 
 
-
-/*** High level stuff ********************************************************/
-
-
-static int sound_open(struct inode *inode, struct file *file)
+static struct file_operations state_fops =
 {
-	int dev = MINOR(inode->i_rdev) & 0x0f;
-	int rc = 0;
-
-	switch (dev) {
-	case SND_DEV_STATUS:
-		rc = state_open(file->f_flags);
-		break;
-	case SND_DEV_CTL:
-		rc = mixer_open(file->f_flags);
-		break;
-	case SND_DEV_DSP:
-	case SND_DEV_AUDIO:
-		rc = sq_open(file->f_flags);
-		if (rc == 0) {
-			sound.minDev = dev;
-			sound.soft = sound.dsp;
-			sound.hard = sound.dsp;
-			sound_init();
-			if (dev == SND_DEV_AUDIO) {
-				sound_set_speed(8000);
-				sound_set_stereo(0);
-				sound_set_format(AFMT_MU_LAW);
-			}
-		}
-		break;
-	default:
-		rc = -ENXIO;
-	}
-#ifdef MODULE
-	if (rc >= 0)
-		MOD_INC_USE_COUNT;
-#endif
-	return(rc);
-}
+	sound_lseek,
+	state_read,
+	NULL,			/* state_write */
+	NULL,			/* state_readdir */
+	NULL,			/* state_poll */
+	NULL,			/* state_ioctl */
+	NULL,			/* state_mmap */
+	state_open,
+	state_release,
+};
 
 
-static int sound_fsync(struct file *filp, struct dentry *dentry)
+static void state_init(void)
 {
-	int dev = MINOR(dentry->d_inode->i_rdev) & 0x0f;
-
-	switch (dev) {
-	case SND_DEV_STATUS:
-	case SND_DEV_CTL:
-		return(0);
-	case SND_DEV_DSP:
-	case SND_DEV_AUDIO:
-		return(sq_sync());
-	default:
-		return(unknown_minor_dev("sound_fsync", dev));
-	}
+	state_unit = register_sound_special(&state_fops, SND_DEV_STATUS);
+	if (state_unit < 0)
+		return;
+	state.busy = 0;
 }
 
 
-static int sound_release(struct inode *inode, struct file *file)
-{
-	int dev = MINOR(inode->i_rdev);
-
-	switch (dev & 0x0f) {
-	case SND_DEV_STATUS:
-		state_release();
-		break;
-	case SND_DEV_CTL:
-		mixer_release();
-		break;
-	case SND_DEV_DSP:
-	case SND_DEV_AUDIO:
-		sq_release();
-		sound.soft = sound.dsp;
-		sound.hard = sound.dsp;
-		sound_silence();
-		break;
-	default:
-		return unknown_minor_dev("sound_release", dev);
-	}
-#ifdef MODULE
-	MOD_DEC_USE_COUNT;
-#endif
-	return 0;
-}
-
+/*** Common stuff ********************************************************/
 
 static long long sound_lseek(struct file *file, long long offset, int orig)
 {
@@ -4245,176 +4357,16 @@
 }
 
 
-static ssize_t sound_read(struct file *file, char *buf, size_t count,
-			  loff_t *ppos)
-{
-	struct inode *inode = file->f_dentry->d_inode;
-	int dev = MINOR(inode->i_rdev);
-
-	switch (dev & 0x0f) {
-	case SND_DEV_STATUS:
-		return(state_read(buf, count));
-	case SND_DEV_CTL:
-	case SND_DEV_DSP:
-	case SND_DEV_AUDIO:
-		return(-EPERM);
-	default:
-		return(unknown_minor_dev("sound_read", dev));
-	}
-}
-
-
-static ssize_t sound_write(struct file *file, const char *buf, size_t count,
-			   loff_t *ppos)
-{
-	struct inode *inode = file->f_dentry->d_inode;
-	int dev = MINOR(inode->i_rdev);
-
-	switch (dev & 0x0f) {
-	case SND_DEV_STATUS:
-	case SND_DEV_CTL:
-		return(-EPERM);
-	case SND_DEV_DSP:
-	case SND_DEV_AUDIO:
-		return(sq_write(buf, count));
-	default:
-		return(unknown_minor_dev("sound_write", dev));
-	}
-}
-
-
-static int unknown_minor_dev(char *fname, int dev)
-{
-	/* printk("%s: Unknown minor device %d\n", fname, dev); */
-	return(-ENXIO);
-}
-
-
-static int sound_ioctl(struct inode *inode, struct file *file, u_int cmd,
-		       u_long arg)
-{
-	int dev = MINOR(inode->i_rdev);
-	u_long fmt;
-	int data;
-	int size, nbufs;
-
-	switch (dev & 0x0f) {
-	case SND_DEV_STATUS:
-		return(-EPERM);
-	case SND_DEV_CTL:
-		return(mixer_ioctl(inode, file, cmd, arg));
-	case SND_DEV_AUDIO:
-	case SND_DEV_DSP:
-		switch (cmd) {
-		case SNDCTL_DSP_RESET:
-			sq_reset();
-			return(0);
-		case SNDCTL_DSP_POST:
-		case SNDCTL_DSP_SYNC:
-			return(sound_fsync(file, file->f_dentry));
-
-			/* ++TeSche: before changing any of these it's
-			 * probably wise to wait until sound playing has
-			 * settled down. */
-		case SNDCTL_DSP_SPEED:
-			sound_fsync(file, file->f_dentry);
-			IOCTL_IN(arg, data);
-			return(IOCTL_OUT(arg, sound_set_speed(data)));
-		case SNDCTL_DSP_STEREO:
-			sound_fsync(file, file->f_dentry);
-			IOCTL_IN(arg, data);
-			return(IOCTL_OUT(arg, sound_set_stereo(data)));
-		case SOUND_PCM_WRITE_CHANNELS:
-			sound_fsync(file, file->f_dentry);
-			IOCTL_IN(arg, data);
-			return(IOCTL_OUT(arg, sound_set_stereo(data-1)+1));
-		case SNDCTL_DSP_SETFMT:
-			sound_fsync(file, file->f_dentry);
-			IOCTL_IN(arg, data);
-			return(IOCTL_OUT(arg, sound_set_format(data)));
-		case SNDCTL_DSP_GETFMTS:
-			fmt = 0;
-			if (sound.trans) {
-				if (sound.trans->ct_ulaw)
-					fmt |= AFMT_MU_LAW;
-				if (sound.trans->ct_alaw)
-					fmt |= AFMT_A_LAW;
-				if (sound.trans->ct_s8)
-					fmt |= AFMT_S8;
-				if (sound.trans->ct_u8)
-					fmt |= AFMT_U8;
-				if (sound.trans->ct_s16be)
-					fmt |= AFMT_S16_BE;
-				if (sound.trans->ct_u16be)
-					fmt |= AFMT_U16_BE;
-				if (sound.trans->ct_s16le)
-					fmt |= AFMT_S16_LE;
-				if (sound.trans->ct_u16le)
-					fmt |= AFMT_U16_LE;
-			}
-			return(IOCTL_OUT(arg, fmt));
-		case SNDCTL_DSP_GETBLKSIZE:
-			size = sq.block_size
-				* sound.soft.size * (sound.soft.stereo + 1)
-				/ (sound.hard.size * (sound.hard.stereo + 1));
-			return(IOCTL_OUT(arg, size));
-		case SNDCTL_DSP_SUBDIVIDE:
-			break;
-		case SNDCTL_DSP_SETFRAGMENT:
-			if (sq.count || sq.playing || sq.syncing)
-				return -EINVAL;
-			IOCTL_IN(arg, size);
-			nbufs = size >> 16;
-			if (nbufs < 2 || nbufs > numBufs)
-				nbufs = numBufs;
-			size &= 0xffff;
-			if (size >= 8 && size <= 30) {
-				size = 1 << size;
-				size *= sound.hard.size * (sound.hard.stereo + 1);
-				size /= sound.soft.size * (sound.soft.stereo + 1);
-				if (size > (bufSize << 10))
-					size = bufSize << 10;
-			} else
-				size = bufSize << 10;
-			sq_init(numBufs, size, sound_buffers);
-			sq.max_active = nbufs;
-			break;
-
-		default:
-			return(mixer_ioctl(inode, file, cmd, arg));
-		}
-		break;
-
-	default:
-		return(unknown_minor_dev("sound_ioctl", dev));
-	}
-	return(-EINVAL);
-}
-
-
-static struct file_operations sound_fops =
-{
-	sound_lseek,
-	sound_read,
-	sound_write,
-	NULL,
-	NULL,                      /* select */
-	sound_ioctl,
-	NULL,
-	sound_open,
-	sound_release,
-	sound_fsync
-};
-
-
-
 /*** Config & Setup **********************************************************/
 
 
-void soundcard_init(void)
+void dmasound_init(void)
 {
 	int has_sound = 0;
 	int i;
+#ifdef CONFIG_PMAC
+	struct device_node *np;
+#endif
 
 #ifdef __mc68000__
 	switch (m68k_machtype) {
@@ -4447,8 +4399,6 @@
 #endif /* __mc68000__ */
 
 #ifdef CONFIG_PMAC
-	struct device_node *np;
-
 	np = find_devices("awacs");
 	if (np != NULL && np->n_addrs >= 3 && np->n_intrs >= 3) {
 		int vol;
@@ -4516,15 +4466,10 @@
 		}
 	}
 
-#ifndef MODULE
-	/* Register driver with the VFS. */
-	register_chrdev(SOUND_MAJOR, "sound", &sound_fops);
-#endif
-
-	sq_init(numBufs, bufSize << 10, sound_buffers);
+	sq_setup(numBufs, bufSize << 10, sound_buffers);
 
 	/* Set default settings. */
-	init_settings();
+	sq_init();
 
 	/* Set up /dev/sndstat. */
 	state_init();
@@ -4594,14 +4539,7 @@
 	if (i)
 		dmasound_setup("dmasound=", ints);
 
-	err = register_chrdev(SOUND_MAJOR, "sound", &sound_fops);
-	if (err) {
-		printk("dmasound: driver already loaded/included in kernel\n");
-		return err;
-	}
-	chrdev_registered = 1;
-	soundcard_init();
-
+	dmasound_init();
 	return 0;
 }
 
@@ -4610,12 +4548,6 @@
 {
 	int i;
 
-	if (MOD_IN_USE)
-		return;
-
-	if (chrdev_registered)
-		unregister_chrdev(SOUND_MAJOR, "sound");
-
 	if (irq_installed) {
 		sound_silence();
 		sound.mach.irqcleanup();
@@ -4626,6 +4558,13 @@
 			sound.mach.dma_free(sound_buffers[i], bufSize << 10);
 		kfree(sound_buffers);
 	}
+
+	if (mixer_unit >= 0)
+		unregister_sound_mixer(mixer_unit);
+	if (state_unit >= 0)
+		unregister_sound_special(state_unit);
+	if (sq_unit >= 0)
+		unregister_sound_dsp(sq_unit);
 }
 
 #endif /* MODULE */
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/drivers/video/atyfb.c m68k/drivers/video/atyfb.c
--- jes-2.1.106/drivers/video/atyfb.c	Thu Jun 18 20:53:01 1998
+++ m68k/drivers/video/atyfb.c	Thu Jun 18 21:59:38 1998
@@ -1654,12 +1654,7 @@
 	    default:
 		info->total_vram = 0x80000;
 	}
-#ifdef CONFIG_ATARI
-    /*
-     * this is definately the wrong way to set this, maybe this depends
-     * on the card being ISA - but using the size to determine this and
-     * only on the Atari is bollocks.
-     */
+#ifdef CONFIG_ATARI	/* this is definately not the wrong way to set this */
     if ((info->total_vram == 0x400000) || (info->total_vram == 0x800000)) {
 	/* protect GUI-regs if complete Aperture is VRAM */
 	info->total_vram -= 0x00001000;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/drivers/video/vfb.c m68k/drivers/video/vfb.c
--- jes-2.1.106/drivers/video/vfb.c	Mon Jun  8 20:46:54 1998
+++ m68k/drivers/video/vfb.c	Sun Jun 14 23:11:52 1998
@@ -629,13 +629,13 @@
 #ifdef MODULE
 int init_module(void)
 {
-    return(vfb_init(NULL));
+    return(vfb_init(0));
 }
 
 void cleanup_module(void)
 {
     unregister_framebuffer(&fb_info);
-    vfree(videomemory);
+    vfree((void *)videomemory);
 }
 
 #endif /* MODULE */
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/fs/Config.in m68k/fs/Config.in
--- jes-2.1.106/fs/Config.in	Mon May  4 20:08:51 1998
+++ m68k/fs/Config.in	Sun Jun 14 22:23:53 1998
@@ -65,72 +65,6 @@
 tristate 'Kernel automounter support' CONFIG_AUTOFS_FS
 tristate 'UFS filesystem support (read only)' CONFIG_UFS_FS
 
-comment 'Partition Tables'
-if [ "$ARCH" = "i386" ]; then
-  define_bool CONFIG_MSDOS_PARTITION y
-fi
-if [ "$ARCH" = "alpha" ]; then
-  define_bool CONFIG_OSF_PARTITION y
-fi
-if [ "$ARCH" = "m68k" ]; then
-  if [ "$CONFIG_AMIGA" = "y" ]; then
-    define_bool CONFIG_AMIGA_PARTITION y
-  fi
-  if [ "$CONFIG_ATARI" = "y" ]; then
-    define_bool CONFIG_ATARI_PARTITION y
-  fi
-  if [ "$CONFIG_MAC" = "y" ]; then
-    define_bool CONFIG_MAC_PARTITION y
-  fi
-fi
-if [ "$ARCH" = "sparc" -o "$ARCH" = "sparc64" ]; then
-  define_bool CONFIG_SUN_PARTITION y
-fi
-if [ "$ARCH" = "ppc" ]; then
-  if [ "$CONFIG_MACH_SPECIFIC" = "y" ]; then
-    if [ "$CONFIG_PMAC" = "y" -o "$CONFIG_CHRP" = "y" ]; then
-      define_bool CONFIG_MAC_PARTITION y
-    fi
-    if [ "$CONFIG_PREP" = "y" -o "$CONFIG_CHRP" = "y" ]; then
-      define_bool CONFIG_MSDOS_PARTITION y
-    fi
-  else
-    define_bool CONFIG_MAC_PARTITION y
-    define_bool CONFIG_MSDOS_PARTITION y
-  fi
-fi
-
-bool 'Support for foreign partition tables' CONFIG_FOREIGN_PARTITIONS
-if [ "$CONFIG_FOREIGN_PARTITIONS" = "y" ]; then
-  if [ ! \( "$ARCH" = "i386" -o \
-            \( "$ARCH" = "ppc" -a \
-               \( "$CONFIG_MACH_SPECIFIC" = "n" -o "$CONFIG_PREP" = "y" -o \
-                  "$CONFIG_CHRP" = "y" \) \) \) ]; then
-  	tristate 'MS-DOS partition support' CONFIG_MSDOS_PARTITION
-  fi
-  if [ "$ARCH" != "alpha" ]; then
-  	tristate 'OSF partition support' CONFIG_OSF_PARTITION
-  fi
-  if [ "$ARCH" != "sparc" -a "$ARCH" != "sparc64" ]; then
-  	tristate 'Sun partition support' CONFIG_SUN_PARTITION
-  fi
-  if [ "$CONFIG_AMIGA" != "y" ]; then
-  	tristate 'Amiga RDB partition support' CONFIG_AMIGA_PARTITION
-  fi
-  if [ "$CONFIG_ATARI" != "y" ]; then
-  	tristate 'Atari partition support' CONFIG_ATARI_PARTITION
-  fi
-  if [ ! \( \( "$ARCH" = "m68k" -a "$CONFIG_MAC" = "y" \) -o \
-            \( "$ARCH" = "ppc" -a \
-               \( "$CONFIG_MACH_SPECIFIC" = "n" -o "$CONFIG_PMAC" = "y" -o \
-                  "$CONFIG_CHRP" = "y" \) \) \) ]; then
-  	tristate 'Mac partition support' CONFIG_MAC_PARTITION
-  fi
-fi
-if [ "$CONFIG_MSDOS_PARTITION" != "n" ]; then
-  bool 'BSD disklabel (FreeBSD partition tables) support' CONFIG_BSD_DISKLABEL
-  bool 'Solaris (x86) partition table support' CONFIG_SOLARIS_X86_PARTITION
-fi
 if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
   tristate 'ADFS filesystem support (read only) (EXPERIMENTAL)' CONFIG_ADFS_FS
   tristate '/dev/pts filesystem support (EXPERIMENTAL)' CONFIG_DEVPTS_FS
@@ -138,3 +72,4 @@
 
 endmenu
 
+source fs/partitions/Config.in
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/fs/Makefile m68k/fs/Makefile
--- jes-2.1.106/fs/Makefile	Thu May 14 21:34:49 1998
+++ m68k/fs/Makefile	Sun Jun 14 22:23:53 1998
@@ -14,11 +14,15 @@
 		super.o  block_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
 		ioctl.o readdir.o select.o fifo.o locks.o filesystems.o \
 		dcache.o inode.o attr.o bad_inode.o $(BINFMTS) 
+OX_OBJS  := partcheck.o
 
 MOD_LIST_NAME := FS_MODULES
 ALL_SUB_DIRS = coda minix ext2 fat msdos vfat proc isofs nfs umsdos ntfs \
 		hpfs sysv smbfs ncpfs ufs affs romfs autofs hfs lockd nfsd \
-		nls devpts adfs
+		nls devpts adfs partitions
+
+SUB_DIRS := partitions
+MOD_IN_SUB_DIRS := partitions
 
 ifeq ($(CONFIG_QUOTA),y)
 O_OBJS += dquot.o
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/fs/ext2/inode.c m68k/fs/ext2/inode.c
--- jes-2.1.106/fs/ext2/inode.c	Thu May 14 21:34:50 1998
+++ m68k/fs/ext2/inode.c	Sun Jun 14 22:20:26 1998
@@ -722,10 +722,11 @@
 	unsigned int	flags;
 	
 	retval = -EPERM;
-	if ((iattr->ia_attr_flags &
-	     (ATTR_FLAG_APPEND | ATTR_FLAG_IMMUTABLE)) ^
-	    (inode->u.ext2_i.i_flags &
-	     (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL))) {
+	if (iattr->ia_valid & ATTR_ATTR_FLAG &&
+	    ((!(iattr->ia_attr_flags & ATTR_FLAG_APPEND) !=
+	      !(inode->u.ext2_i.i_flags & EXT2_APPEND_FL)) ||
+	     (!(iattr->ia_attr_flags & ATTR_FLAG_IMMUTABLE) !=
+	      !(inode->u.ext2_i.i_flags & EXT2_IMMUTABLE_FL)))) {
 		if (!capable(CAP_LINUX_IMMUTABLE))
 			goto out;
 	} else if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/fs/partcheck.c m68k/fs/partcheck.c
--- jes-2.1.106/fs/partcheck.c	Thu Jan  1 01:00:00 1970
+++ m68k/fs/partcheck.c	Sun Jun 14 22:23:53 1998
@@ -0,0 +1,431 @@
+/*
+ *  Code extracted from drivers/block/genhd.c
+ *  Copyright (C) 1991-1998  Linus Torvalds
+ *  Re-organised May 1998 Roman Hodek and Russell King
+ *
+ *  We now have independent partition support from the
+ *  block drivers, which allows all the partition code to
+ *  be grouped in one location, and it to be mostly self
+ *  contained.
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/fs.h>
+#include <linux/genhd.h>
+#include <linux/kernel.h>
+#include <linux/major.h>
+#include <linux/string.h>
+#include <linux/blk.h>
+#include <linux/init.h>
+#ifdef CONFIG_PROC_FS
+#include <linux/proc_fs.h>
+#endif
+
+#include <asm/system.h>
+#include "partcheck.h"
+
+static struct partition_parser *partition_parsers = NULL;
+
+/*
+ * disk_name() is used by genhd.c and md.c.
+ * It formats the devicename of the indicated disk
+ * into the supplied buffer, and returns a pointer
+ * to that same buffer (for convenience).
+ */
+char *disk_name (struct gendisk *hd, int minor, char *buf)
+{
+	unsigned int part;
+	const char *maj = hd->major_name;
+	char unit = (minor >> hd->minor_shift) + 'a';
+
+	/*
+	 * IDE devices use multiple major numbers, but the drives
+	 * are named as:  {hda,hdb}, {hdc,hdd}, {hde,hdf}, {hdg,hdh}..
+	 * This requires special handling here.
+	 */
+	switch (hd->major) {
+		case IDE3_MAJOR:
+			unit += 2;
+		case IDE2_MAJOR:
+			unit += 2;
+		case IDE1_MAJOR:
+			unit += 2;
+		case IDE0_MAJOR:
+			maj = "hd";
+	}
+	part = minor & ((1 << hd->minor_shift) - 1);
+	if (part)
+		sprintf(buf, "%s%c%d", maj, unit, part);
+	else
+		sprintf(buf, "%s%c", maj, unit);
+	return buf;
+}
+
+void add_partition (struct gendisk *hd, int minor, int start, int size)
+{
+	char buf[8];
+	hd->part[minor].start_sect = start;
+	hd->part[minor].nr_sects   = size;
+	printk(" %s", disk_name(hd, minor, buf));
+}
+
+unsigned int get_ptable_blocksize(kdev_t dev)
+{
+  int ret = 1024;
+
+  /*
+   * See whether the low-level driver has given us a minumum blocksize.
+   * If so, check to see whether it is larger than the default of 1024.
+   */
+  if (!blksize_size[MAJOR(dev)])
+    {
+      return ret;
+    }
+
+  /*
+   * Check for certain special power of two sizes that we allow.
+   * With anything larger than 1024, we must force the blocksize up to
+   * the natural blocksize for the device so that we don't have to try
+   * and read partial sectors.  Anything smaller should be just fine.
+   */
+  switch( blksize_size[MAJOR(dev)][MINOR(dev)] )
+    {
+    case 2048:
+      ret = 2048;
+      break;
+    case 4096:
+      ret = 4096;
+      break;
+    case 8192:
+      ret = 8192;
+      break;
+    case 1024:
+    case 512:
+    case 256:
+    case 0:
+      /*
+       * These are all OK.
+       */
+      break;
+    default:
+      panic("Strange blocksize for partition table\n");
+    }
+
+  return ret;
+
+}
+
+
+#if CONFIG_KMOD && CONFIG_FOREIGN_PARTITIONS
+
+#include <linux/kmod.h>
+
+#ifdef CONFIG_AMIGA_PARTITION_MODULE
+#include <linux/affs_hardblocks.h>
+static int probe_amiga_partition(struct gendisk *hd, kdev_t dev,
+				 struct buffer_head *bh_0)
+{
+	struct buffer_head *bh;
+	int blk, res;
+
+	if (*(u32 *)bh_0->b_data == cpu_to_be32(IDNAME_RIGIDDISK))
+		return 1;
+
+	/* also need to check other possible RDB blocks */
+	for (blk = 1; blk < RDB_ALLOCATION_LIMIT; blk++) {
+		if (!(bh = bread(dev,blk,512)))
+			return -1;
+		res = *(u32 *)bh->b_data == cpu_to_be32(IDNAME_RIGIDDISK);
+		brelse(bh);
+		if (res)
+			return 1;
+	}
+	return 0;
+}
+#endif
+
+#ifdef CONFIG_ATARI_PARTITION_MODULE
+#include <linux/atari_rootsec.h>
+#include <linux/ctype.h>
+#define	VALID_PARTITION(pi,hdsiz)					     \
+    (((pi)->flg & 1) &&							     \
+     isalnum((pi)->id[0]) && isalnum((pi)->id[1]) && isalnum((pi)->id[2]) && \
+     be32_to_cpu((pi)->st) <= (hdsiz) &&				     \
+     be32_to_cpu((pi)->st) + be32_to_cpu((pi)->siz) <= (hdsiz))
+static int probe_atari_partition(struct gendisk *hd, kdev_t dev,
+				 struct buffer_head *bh_0)
+{
+	struct rootsector *rs;
+	u32 hd_size;
+	int res;
+
+	rs = (struct rootsector *)bh_0->b_data;
+	hd_size = hd->part[0].nr_sects;
+	res = VALID_PARTITION( &rs->part[0], hd_size ) ||
+	      VALID_PARTITION( &rs->part[1], hd_size ) ||
+	      VALID_PARTITION( &rs->part[2], hd_size ) ||
+	      VALID_PARTITION( &rs->part[3], hd_size );
+	return res;
+}
+#endif
+
+#ifdef CONFIG_ACORN_PARTITION_MODULE
+# ifdef CONFIG_ACORN_PARTITION_ICS
+static int probe_acorn_ICS_partition(struct gendisk *hd, kdev_t dev,
+				     struct buffer_head *bh_0)
+{
+	unsigned long sum;
+	unsigned int i;
+
+	for (i = 0, sum = 0x50617274; i < 508; i++)
+	    sum += bh_0->b_data[i];
+	return sum == le32_to_cpu(*(unsigned long *)(&bh_0->b_data[508]));
+}
+# endif
+# ifdef CONFIG_ACORN_PARTITION_ADFS
+#include <linux/adfs_fs.h>
+static int probe_acorn_ADFS_partition(struct gendisk *hd, kdev_t dev,
+				      struct buffer_head *bh_0)
+{
+	struct buffer_head *bh;
+	int res;
+
+	if (!(bh = bread(dev, 3, 1024)))
+		return -1;
+	res = adfs_checkbblk(bh->b_data) == 0;
+	brelse(bh);
+	return res;
+}
+# endif
+#endif
+
+
+/*
+ * This table lists the magics to recognize the partition formats that are
+ * availble as modules. The magics can be stored as 16 or 32 bit little-endian
+ * or big-endian numbers. For the more complicated cases (Amiga and Atari), a
+ * function doing the real work is called.
+ */
+
+enum partbl_probe_type { BE16, BE32, LE16, LE32, FUNC };
+
+static struct partbl_probe {
+	char *name;
+	enum partbl_probe_type type;
+	u32 offset;
+	u32 magic;
+	int (*func)(struct gendisk *hd, kdev_t dev, struct buffer_head *bh_0);
+} partbl_modules[] = {
+#ifdef CONFIG_MSDOS_PARTITION_MODULE
+	{ "pc", LE16, 510, 0xAA55, NULL },
+#endif
+#ifdef CONFIG_OSF_PARTITION_MODULE
+	{ "osf",   LE32,  64, 0x82564557, NULL },
+#endif
+#ifdef CONFIG_SUN_PARTITION_MODULE
+	{ "sun",   BE16, 508, 0xDABE, NULL },
+#endif
+#ifdef CONFIG_AMIGA_PARTITION_MODULE
+	{ "amiga", FUNC,   0,      0, probe_amiga_partition },
+#endif
+#ifdef CONFIG_ATARI_PARTITION_MODULE
+	{ "atari", FUNC,   0,      0, probe_atari_partition },
+#endif
+#ifdef CONFIG_MAC_PARTITION_MODULE
+	{ "mac",   BE16,   0, 0x4552, NULL },
+#endif
+#ifdef CONFIG_ACORN_PARTITION_MODULE
+# ifdef CONFIG_ACORN_PARTITION_ICS
+	{ "acorn", FUNC,   0,      0, probe_acorn_ICS_partition },
+# endif
+# ifdef CONFIG_ACORN_PARTITION_ADFS
+	{ "acorn", FUNC,   0,      0, probe_acorn_ADFS_partition },
+# endif
+#endif
+};
+
+#define N_PARTBL_MODULES sizeof(partbl_modules)/sizeof(*partbl_modules)
+
+/*
+ * Try to load all partition parsers that could apply to this device
+ */
+static int try_to_load_parser(struct gendisk *hd, kdev_t dev)
+{
+	int i, hit = 0, loaded = 0;
+	char modname[24];
+	struct partbl_probe *mod;
+	struct partition_parser *p;
+	struct buffer_head *bh;
+
+	if (!(bh = bread(dev,0,get_ptable_blocksize(dev))))
+		return -1;
+
+	for( i = 0, mod = partbl_modules; i < N_PARTBL_MODULES; ++i, ++mod ) {
+		/* don't probe already loaded formats again */
+		for( p = partition_parsers; p; p = p->next )
+			if (!strcmp( mod->name, p->name))
+				goto skip;
+		
+		switch( mod->type ) {
+		    case LE16:
+			hit = le16_to_cpu(*(u16 *)(bh->b_data+mod->offset)) ==
+			      mod->magic;
+			break;
+		    case LE32:
+			hit = le32_to_cpu(*(u32 *)(bh->b_data+mod->offset)) ==
+			      mod->magic;
+			break;
+		    case BE16:
+			hit = be16_to_cpu(*(u16 *)(bh->b_data+mod->offset)) ==
+			      mod->magic;
+			break;
+		    case BE32:
+			hit = be32_to_cpu(*(u32 *)(bh->b_data+mod->offset)) ==
+			      mod->magic;
+			break;
+		    case FUNC:
+			hit = mod->func(hd, dev, bh) > 0;
+			break;
+		}
+		if (hit) {
+			strcpy(modname, "part-format-");
+			strcat(modname, mod->name);
+			request_module(modname);
+			++loaded;
+		}
+	    skip:
+	}
+	brelse(bh);
+	return loaded;
+}
+
+#endif /* CONFIG_KMOD && CONFIG_FOREIGN_PARTITIONS */
+
+
+void check_partition(struct gendisk *hd, kdev_t dev, int first_minor)
+{
+	static int first_time = 1;
+	int tries = 0;
+	unsigned long first_sector;
+	char buf[8];
+	struct partition_parser *parser;
+
+	if (first_time)
+		printk("Partition check:\n");
+	first_time = 0;
+	first_sector = hd->part[MINOR(dev)].start_sect;
+
+	/*
+	 * This is a kludge to allow the partition check to be
+	 * skipped for specific drives (e.g. IDE cd-rom drives)
+	 */
+	if ((int)first_sector == -1) {
+		hd->part[MINOR(dev)].start_sect = 0;
+		return;
+	}
+
+#if CONFIG_KMOD && CONFIG_FOREIGN_PARTITIONS
+    retry:
+#endif
+	printk(" %s:", disk_name(hd, MINOR(dev), buf));
+	for( parser = partition_parsers; parser; parser = parser->next ) {
+		if (parser->func(hd, dev, first_sector, first_minor))
+			return;
+	}
+	++tries;
+#if CONFIG_KMOD && CONFIG_FOREIGN_PARTITIONS
+	if (tries == 1 && try_to_load_parser(hd, dev))
+		goto retry;
+#endif
+	printk(" unknown partition table\n");
+}
+
+int register_partbl( struct partition_parser *parser )
+{
+	struct partition_parser **p;
+    
+	if (!parser)
+		return -EINVAL;
+	if (parser->next)
+		return -EBUSY;
+	for( p = &partition_parsers; *p; p = &(*p)->next )
+		if (*p == parser)
+			return -EBUSY;
+
+	/* Insert new parser at front of list, so that a user-loaded module can
+	 * (in case of some misdetection) override other parsers */
+	parser->next = partition_parsers;
+	partition_parsers = parser;
+	return 0;
+}
+
+#ifdef CONFIG_MODULES
+int unregister_partbl( struct partition_parser *parser )
+{
+	struct partition_parser **p;
+    
+	for( p = &partition_parsers; *p; p = &(*p)->next ) {
+		if (*p == parser) {
+			*p = parser->next;
+			parser->next = NULL;
+			return 0;
+		}
+	}
+	return -EINVAL;
+}
+#endif
+
+#ifdef CONFIG_PROC_FS
+static struct proc_dir_entry *proc_partbl;
+
+static int partbl_read_proc(char *buf, char **start, off_t offset,
+			    int len, int *eof, void *private)
+{
+	struct partition_parser *p;
+
+	len = 0;
+	for( p = partition_parsers; p && len < 4000; p = p->next )
+		len += sprintf(buf + len, "%s\n", p->name );
+	*start = buf + offset;
+	return len > offset ? len - offset : 0;
+}
+#endif
+
+__initfunc(void partbl_init( void ))
+{
+	extern void msdos_partbl_init(void);
+	extern void osf_partbl_init(void);
+	extern void sun_partbl_init(void);
+	extern void amiga_partbl_init(void);
+	extern void atari_partbl_init(void);
+	extern void mac_partbl_init(void);
+	extern void acorn_partbl_init(void);
+    
+	if (HAVE_ACORN_PARTITION)
+		acorn_partbl_init();
+	if (HAVE_MAC_PARTITION)
+		mac_partbl_init();
+	if (HAVE_ATARI_PARTITION)
+		atari_partbl_init();
+	if (HAVE_AMIGA_PARTITION)
+		amiga_partbl_init();
+	if (HAVE_SUN_PARTITION)
+		sun_partbl_init();
+	if (HAVE_OSF_PARTITION)
+		osf_partbl_init();
+	if (HAVE_MSDOS_PARTITION)
+		msdos_partbl_init();
+
+#ifdef CONFIG_PROC_FS
+	proc_partbl = create_proc_entry("partition-formats", 0, 0);
+	if (proc_partbl)
+		proc_partbl->read_proc = partbl_read_proc;
+#endif
+}
+
+/* symbols visible for modules */
+EXPORT_SYMBOL(add_partition);
+EXPORT_SYMBOL(get_ptable_blocksize);
+EXPORT_SYMBOL(register_partbl);
+EXPORT_SYMBOL(unregister_partbl);
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/fs/partcheck.h m68k/fs/partcheck.h
--- jes-2.1.106/fs/partcheck.h	Thu Jan  1 01:00:00 1970
+++ m68k/fs/partcheck.h	Sun Jun 14 22:23:53 1998
@@ -0,0 +1,26 @@
+#ifndef _FS_PARTCHECK_H
+#define _FS_PARTCHECK_H
+
+#include <linux/genhd.h>
+
+/*
+ * disk_name() is used by genhd.c and md.c.
+ * It formats the devicename of the indicated disk
+ * into the supplied buffer, and returns a pointer
+ * to that same buffer (for convenience).
+ */
+char *disk_name (struct gendisk *hd, int minor, char *buf);
+void add_partition (struct gendisk *hd, int minor, int start, int size);
+unsigned int get_ptable_blocksize(kdev_t dev);
+
+struct partition_parser {
+	struct partition_parser *next;
+	char *name;
+	int (*func)(struct gendisk *hd, kdev_t dev,
+		    unsigned long first_sector, int first_minor);
+};
+
+int register_partbl( struct partition_parser *parser );
+int unregister_partbl( struct partition_parser *parser );
+
+#endif /* _FS_PARTCHECK_H */
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/fs/partitions/Config.in m68k/fs/partitions/Config.in
--- jes-2.1.106/fs/partitions/Config.in	Thu Jan  1 01:00:00 1970
+++ m68k/fs/partitions/Config.in	Sun Jun 14 22:23:53 1998
@@ -0,0 +1,88 @@
+#
+# Partition configuration
+#
+mainmenu_option next_comment
+comment 'Partition Tables'
+
+if [ "$ARCH" = "i386" ]; then
+  define_bool CONFIG_MSDOS_PARTITION y
+fi
+if [ "$ARCH" = "alpha" ]; then
+  define_bool CONFIG_OSF_PARTITION y
+fi
+if [ "$ARCH" = "m68k" ]; then
+  if [ "$CONFIG_AMIGA" = "y" ]; then
+    define_bool CONFIG_AMIGA_PARTITION y
+  fi
+  if [ "$CONFIG_ATARI" = "y" ]; then
+    define_bool CONFIG_ATARI_PARTITION y
+  fi
+  if [ "$CONFIG_MAC" = "y" ]; then
+    define_bool CONFIG_MAC_PARTITION y
+  fi
+fi
+if [ "$ARCH" = "sparc" -o "$ARCH" = "sparc64" ]; then
+  define_bool CONFIG_SUN_PARTITION y
+fi
+if [ "$ARCH" = "ppc" ]; then
+  if [ "$CONFIG_MACH_SPECIFIC" = "y" ]; then
+    if [ "$CONFIG_PMAC" = "y" -o "$CONFIG_CHRP" = "y" ]; then
+      define_bool CONFIG_MAC_PARTITION y
+    fi
+    if [ "$CONFIG_PREP" = "y" -o "$CONFIG_CHRP" = "y" ]; then
+      define_bool CONFIG_MSDOS_PARTITION y
+    fi
+  else
+    define_bool CONFIG_MAC_PARTITION y
+    define_bool CONFIG_MSDOS_PARTITION y
+  fi
+fi
+if [ "$CONFIG_ARCH_ACORN" = "y" ]; then
+  define_bool CONFIG_ACORN_PARTITION y
+fi
+
+bool 'Support for foreign partition tables' CONFIG_FOREIGN_PARTITIONS
+if [ "$CONFIG_FOREIGN_PARTITIONS" = "y" ]; then
+  if [ ! \( "$ARCH" = "i386" -o \
+            \( "$ARCH" = "ppc" -a \
+               \( "$CONFIG_MACH_SPECIFIC" = "n" -o "$CONFIG_PREP" = "y" -o \
+                  "$CONFIG_CHRP" = "y" \) \) \) ]; then
+  	tristate 'MS-DOS partition support' CONFIG_MSDOS_PARTITION
+  fi
+  if [ "$ARCH" != "alpha" ]; then
+  	tristate 'OSF partition support' CONFIG_OSF_PARTITION
+  fi
+  if [ "$ARCH" != "sparc" -a "$ARCH" != "sparc64" ]; then
+  	tristate 'Sun partition support' CONFIG_SUN_PARTITION
+  fi
+  if [ "$CONFIG_AMIGA" != "y" ]; then
+  	tristate 'Amiga RDB partition support' CONFIG_AMIGA_PARTITION
+  fi
+  if [ "$CONFIG_ATARI" != "y" ]; then
+  	tristate 'Atari partition support' CONFIG_ATARI_PARTITION
+  fi
+  if [ ! \( \( "$ARCH" = "m68k" -a "$CONFIG_MAC" = "y" \) -o \
+            \( "$ARCH" = "ppc" -a \
+               \( "$CONFIG_MACH_SPECIFIC" = "n" -o "$CONFIG_PMAC" = "y" -o \
+                  "$CONFIG_CHRP" = "y" \) \) \) ]; then
+  	tristate 'Mac partition support' CONFIG_MAC_PARTITION
+  fi
+  if [ "$CONFIG_ARCH_ACORN" != "y" ]; then
+    tristate 'Acorn partition support' CONFIG_ACORN_PARTITION
+  fi
+fi
+
+if [ "$CONFIG_MSDOS_PARTITION" != "n" ]; then
+  bool 'BSD disklabel (FreeBSD partition tables) support' CONFIG_BSD_DISKLABEL
+  bool 'Solaris (x86) partition table support' CONFIG_SOLARIS_X86_PARTITION
+fi
+
+if [ "$CONFIG_ACORN_PARTITION" != "n" ]; then
+  bool 'Acorn native filecore partition support' CONFIG_ACORN_PARTITION_ADFS
+#  bool 'Acorn Cumana partition support' CONFIG_ACORN_PARTITION_CUMANA
+  bool 'Acorn ICS partition support' CONFIG_ACORN_PARTITION_ICS
+#  bool 'Acorn PowerTec partition support' CONFIG_ACORN_PARTITION_POWERTEC
+  bool 'Acorn RISCiX partition support' CONFIG_ACORN_PARTITION_RISCIX
+fi
+
+endmenu
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/fs/partitions/Makefile m68k/fs/partitions/Makefile
--- jes-2.1.106/fs/partitions/Makefile	Thu Jan  1 01:00:00 1970
+++ m68k/fs/partitions/Makefile	Sun Jun 14 22:23:53 1998
@@ -0,0 +1,72 @@
+#
+# Makefile for the linux kernel.
+#
+# Note! Dependencies are done automagically by 'make dep', which also
+# removes any old dependencies. DON'T put your own dependencies here
+# unless it's something special (ie not a .c file).
+#
+# Note 2! The CFLAGS definitions are now in the main makefile...
+
+O_TARGET := partitions.o
+O_OBJS   := 
+M_OBJS   := 
+
+MOD_LIST_NAME := PARTBL_MODULES
+
+ifeq ($(CONFIG_MSDOS_PARTITION),y)
+  O_OBJS += pc.o
+else
+  ifeq ($(CONFIG_MSDOS_PARTITION),m)
+    M_OBJS += pc.o
+  endif
+endif
+
+ifeq ($(CONFIG_OSF_PARTITION),y)
+  O_OBJS += osf.o
+else
+  ifeq ($(CONFIG_OSF_PARTITION),m)
+    M_OBJS += osf.o
+  endif
+endif
+
+ifeq ($(CONFIG_SUN_PARTITION),y)
+  O_OBJS += sun.o
+else
+  ifeq ($(CONFIG_SUN_PARTITION),m)
+    M_OBJS += sun.o
+  endif
+endif
+
+ifeq ($(CONFIG_AMIGA_PARTITION),y)
+  O_OBJS += amiga.o
+else
+  ifeq ($(CONFIG_AMIGA_PARTITION),m)
+    M_OBJS += amiga.o
+  endif
+endif
+
+ifeq ($(CONFIG_ATARI_PARTITION),y)
+  O_OBJS += atari.o
+else
+  ifeq ($(CONFIG_ATARI_PARTITION),m)
+    M_OBJS += atari.o
+  endif
+endif
+
+ifeq ($(CONFIG_MAC_PARTITION),y)
+  O_OBJS += mac.o
+else
+  ifeq ($(CONFIG_MAC_PARTITION),m)
+    M_OBJS += mac.o
+  endif
+endif
+
+ifeq ($(CONFIG_ACORN_PARTITION),y)
+  O_OBJS += acorn.o
+else
+  ifeq ($(CONFIG_ACORN_PARTITION),m)
+    M_OBJS += acorn.o
+  endif
+endif
+
+include $(TOPDIR)/Rules.make
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/fs/partitions/acorn.c m68k/fs/partitions/acorn.c
--- jes-2.1.106/fs/partitions/acorn.c	Thu Jan  1 01:00:00 1970
+++ m68k/fs/partitions/acorn.c	Sun Jun 14 22:23:53 1998
@@ -0,0 +1,447 @@
+/*
+ * fs/partitions/acorn.c
+ *
+ * Copyright (c) 1996,1997 Russell King.
+ *
+ * Scan ADFS partitions on hard disk drives.
+ */
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/kdev_t.h>
+#include <linux/major.h>
+#include <linux/string.h>
+#include <linux/fs.h>
+#include <linux/genhd.h>
+
+#include "acorn.h"
+#include "../partcheck.h"
+
+static void adfspart_setgeometry (kdev_t dev, unsigned int secspertrack, unsigned int heads, unsigned long totalblocks)
+{
+	extern void hd_set_geometry (kdev_t dev, unsigned char, unsigned char, unsigned long, unsigned int);
+	extern void xd_set_geometry (kdev_t dev, unsigned char, unsigned char, unsigned long, unsigned int);
+
+	switch (MAJOR(dev)) {
+#ifdef CONFIG_BLK_DEV_HD
+	/*
+	 * It would actually look like the HD driver doesn't actually need this,
+	 * since it asks the drive about its the geometry...  However, the 'BIOS'
+	 * information is not updated...
+	 */
+	case HD_MAJOR:
+		hd_set_geometry (dev, secspertrack, heads, totalblocks, 1);
+		break;
+#endif
+#ifdef CONFIG_BLK_DEV_IDE
+#ifndef CONFIG_BLK_DEV_HD
+	case IDE0_MAJOR:
+#endif
+	case IDE1_MAJOR:
+	case IDE2_MAJOR:
+	case IDE3_MAJOR:
+		break;
+#endif
+#ifdef CONFIG_BLK_DEV_XD
+	case XT_DISK_MAJOR:
+		xd_set_geometry (dev, secspertrack, heads, totalblocks, 1);
+		break;
+#endif
+	case SCSI_DISK_MAJOR:
+		/* we don't need to set geometry for SCSI disks */
+		break;
+
+	default:
+		printk ("%s: don't know how to set geometry\n", kdevname (dev));
+		break;
+    }
+}
+
+#define LINUX_NATIVE_MAGIC 0xdeafa1de
+#define LINUX_SWAP_MAGIC   0xdeafab1e
+
+struct linux_part {
+	unsigned long magic;
+	unsigned long start_sect;
+	unsigned long nr_sects;
+};
+
+static struct disc_record *adfs_partition (struct gendisk *hd, char *name, char *data,
+					   unsigned long first_sector, unsigned int minor)
+{
+	struct disc_record *dr;
+	unsigned int nr_sects;
+
+	if (adfs_checkbblk (data))
+		return NULL;
+
+	dr = (struct disc_record *)(data + 0x1c0);
+
+	if (dr->disc_size == 0 && dr->disc_size_high == 0)
+		return NULL;
+
+	nr_sects = (le32_to_cpu(dr->disc_size_high) << 23) |
+		   (le32_to_cpu(dr->disc_size) >> 9);
+
+	if (name)
+		printk (" [%s]", name);
+	add_partition (hd, minor, first_sector, nr_sects);
+	return dr;
+}
+
+#ifdef CONFIG_ACORN_PARTITION_RISCIX
+static int riscix_partition (struct gendisk *hd, kdev_t dev, unsigned long first_sect,
+			     unsigned int minor, unsigned long nr_sects)
+{
+	struct buffer_head *bh;
+	struct riscix_record *rr;
+	unsigned int riscix_minor;
+
+	printk (" [RISCiX]");
+
+	add_partition (hd, riscix_minor = minor++, first_sect, nr_sects);
+	hd->sizes[riscix_minor] = hd->part[riscix_minor].nr_sects >> (BLOCK_SIZE_BITS - 9);
+	dev = MKDEV(hd->major, riscix_minor);
+
+	if (!(bh = bread (dev, 0, 1024)))
+		return -1;
+
+	rr = (struct riscix_record *)bh->b_data;
+	if (rr->magic == cpu_to_le32(RISCIX_MAGIC)) {
+		int part;
+
+		printk (" <");
+
+		for (part = 0; part < 8; part++) {
+			if (rr->part[part].one &&
+			    memcmp (rr->part[part].name, "All\0", 4)) {
+				add_partition (hd, minor++,
+						le32_to_cpu(rr->part[part].start),
+						le32_to_cpu(rr->part[part].length));
+				printk ("(%s)", rr->part[part].name);
+			}
+		}
+
+		printk (" >");
+
+		if (hd->part[riscix_minor].nr_sects > 2)
+			hd->part[riscix_minor].nr_sects = 2;
+	}
+
+	brelse (bh);
+	return minor;
+}
+#endif
+
+static int linux_partition (struct gendisk *hd, kdev_t dev, unsigned long first_sect,
+			    unsigned int minor, unsigned long nr_sects)
+{
+	struct buffer_head *bh;
+	struct linux_part *linuxp;
+	unsigned int linux_minor, mask = (1 << hd->minor_shift) - 1;
+
+	printk (" [Linux]");
+
+	add_partition (hd, linux_minor = minor++, first_sect, nr_sects);
+	hd->sizes[linux_minor] = hd->part[linux_minor].nr_sects >> (BLOCK_SIZE_BITS - 9);
+	dev = MKDEV(hd->major, linux_minor);
+
+	if (!(bh = bread (dev, 0, 1024)))
+		return -1;
+
+	linuxp = (struct linux_part *)bh->b_data;
+	printk (" <");
+	while (linuxp->magic == cpu_to_le32(LINUX_NATIVE_MAGIC) ||
+	       linuxp->magic == cpu_to_le32(LINUX_SWAP_MAGIC)) {
+		if (!(minor & mask))
+			break;
+		add_partition (hd, minor++,
+			       first_sect + le32_to_cpu(linuxp->start_sect),
+			       le32_to_cpu(linuxp->nr_sects));
+		linuxp ++;
+	}
+	printk (" >");
+	/*
+	 * Prevent someone doing a mkswap or mkfs on this partition
+	 */
+	if(hd->part[linux_minor].nr_sects > 2)
+		hd->part[linux_minor].nr_sects = 2;
+
+	brelse(bh);
+	return minor;
+}
+
+#ifdef CONFIG_ACORN_PARTITION_CUMANA
+static int adfspart_check_CUMANA (struct gendisk *hd, kdev_t dev, unsigned long first_sector,
+				  unsigned int minor)
+{
+	unsigned int start_blk = 0, mask = (1 << hd->minor_shift) - 1;
+	struct buffer_head *bh = NULL;
+	char *name = "CUMANA/ADFS";
+	int first = 1;
+
+	/*
+	 * Try Cumana style partitions - sector 3 contains ADFS boot block with pointer
+	 * to next 'drive'.
+	 *
+	 * There are unknowns in this code - is the 'cylinder number' of the next
+	 * partition relative to the start of this one - I'm assuming it is.
+	 *
+	 * Also, which ID did Cumana use?
+	 *
+	 * This is totally unfinished, and will require more work to get it going.
+	 * Hence it is totally untested.
+	 */
+	do {
+		struct disc_record *dr;
+		unsigned int nr_sects;
+
+		if (!(minor & mask))
+			break;
+
+		if (!(bh = bread (dev, start_blk + 3, 1024)))
+			return -1;
+
+		dr = adfs_partition (hd, name, bh->b_data, first_sector, minor++);
+		if (!dr)
+			break;
+		name = NULL;
+
+		nr_sects = (bh->b_data[0x1fd] + (bh->b_data[0x1fe] << 8)) *
+			 (dr->heads + (dr->lowsector & 0x40 ? 1 : 0)) * dr->secspertrack;
+
+		if (!nr_sects)
+			break;
+
+		first = 0;
+		first_sector += nr_sects;
+		start_blk += nr_sects >> (BLOCK_SIZE_BITS - 9);
+		nr_sects = 0; /* hmm - should be partition size */
+
+		switch (bh->b_data[0x1fc] & 15) {
+		case 0: /* No partition / ADFS? */
+			break;
+
+#ifdef CONFIG_ACORN_PARTITION_RISCIX
+		case PARTITION_RISCIX_SCSI: /* RiscIX - we don't know how to find the next one. */
+			minor = riscix_partition (hd, dev, first_sector, minor, nr_sects);
+			break;
+#endif
+
+		case PARTITION_LINUX:
+			minor = linux_partition (hd, dev, first_sector, minor, nr_sects);
+			break;
+		}
+		brelse (bh);
+		bh = NULL;
+		if (minor == -1)
+			return minor;
+	} while (1);
+	if (bh)
+		brelse (bh);
+	return first ? 0 : 1;
+}
+#endif
+
+#ifdef CONFIG_ACORN_PARTITION_ADFS
+/*
+ * Purpose: allocate ADFS partitions.
+ *
+ * Params : hd		- pointer to gendisk structure to store partition info.
+ *	    dev		- device number to access.
+ *	    first_sector- first readable sector on the device.
+ *	    minor	- first available minor on device.
+ *
+ * Returns: -1 on error, 0 for no ADFS boot sector, 1 for ok.
+ *
+ * Alloc  : hda  = whole drive
+ *	    hda1 = ADFS partition on first drive.
+ *	    hda2 = non-ADFS partition.
+ */
+static int adfspart_check_ADFS (struct gendisk *hd, kdev_t dev, unsigned long first_sector,
+				unsigned int minor)
+{
+	unsigned long start_sect, nr_sects, sectscyl, heads;
+	struct buffer_head *bh;
+	struct disc_record *dr;
+
+	if (!(bh = bread (dev, 3, 1024)))
+		return -1;
+
+	dr = adfs_partition (hd, "ADFS", bh->b_data, first_sector, minor++);
+	if (!dr) {
+	    	brelse (bh);
+    		return 0;
+	}
+
+	heads = dr->heads + ((dr->lowsector >> 6) & 1);
+	adfspart_setgeometry (dev, dr->secspertrack, heads, hd->part[MINOR(dev)].nr_sects);
+	sectscyl = dr->secspertrack * heads;
+
+	/*
+	 * Work out start of non-adfs partition.
+	 */
+	start_sect = ((bh->b_data[0x1fe] << 8) + bh->b_data[0x1fd]) * sectscyl;
+	nr_sects = hd->part[MINOR(dev)].nr_sects - start_sect;
+
+	if (start_sect) {
+		first_sector += start_sect;
+		/*
+		 * we now have a problem - how to set the origional disk size if the
+		 * disk doesn't report it, since there is no standard way of getting
+		 * that info.
+		 */
+		switch (bh->b_data[0x1fc] & 15) {
+#ifdef CONFIG_ACORN_PARTITION_RISCIX
+		case PARTITION_RISCIX_SCSI:
+		case PARTITION_RISCIX_MFM:
+			minor = riscix_partition (hd, dev, first_sector, minor, nr_sects);
+			break;
+#endif
+
+		case PARTITION_LINUX:
+			minor = linux_partition (hd, dev, first_sector, minor, nr_sects);
+			break;
+		}
+	}
+	brelse(bh);
+	return 1;
+}
+#endif
+
+#ifdef CONFIG_ACORN_PARTITION_ICS
+static int adfspart_check_ICSLinux (kdev_t dev, unsigned long block)
+{
+	struct buffer_head *bh;
+	int result = 0;
+
+	if ((bh = bread (dev, block >> 1, 1024)) != NULL) {
+		if (memcmp (bh->b_data + ((block & 1) ? 512 : 0),
+			    "LinuxPart", 9) == 0)
+			result = 1;
+
+		brelse (bh);
+	}
+
+	return result;
+}
+
+/*
+ * Purpose: allocate ICS partitions.
+ * Params : hd		- pointer to gendisk structure to store partition info.
+ *	    dev		- device number to access.
+ *	    first_sector- first readable sector on the device.
+ *	    minor	- first available minor on device.
+ * Returns: -1 on error, 0 for no ICS table, 1 for partitions ok.
+ * Alloc  : hda  = whole drive
+ *	    hda1 = ADFS partition 0 on first drive.
+ *	    hda2 = ADFS partition 1 on first drive.
+ *		..etc..
+ */
+static int adfspart_check_ICS (struct gendisk *hd, kdev_t dev, unsigned long first_sector,
+			       unsigned int minor)
+{
+	struct buffer_head *bh;
+	unsigned long sum;
+	unsigned int i, mask = (1 << hd->minor_shift) - 1;
+	struct ics_part { unsigned long start; unsigned long size; } *p;
+
+	/*
+	 * Try ICS style partitions - sector 0 contains partition info.
+	 */
+	if (!(bh = bread (dev, 0, 1024)))
+	    	return -1;
+
+	/*
+	 * check for a valid checksum
+	 */
+	for (i = 0, sum = 0x50617274; i < 508; i++)
+		sum += bh->b_data[i];
+
+	if (sum != le32_to_cpu(*(unsigned long *)(&bh->b_data[508]))) {
+	    	brelse (bh);
+		return 0; /* not ICS partition table */
+	}
+
+	printk (" [ICS]");
+
+	for (p = (struct ics_part *)bh->b_data; p->size; p++) {
+		if ((minor & mask) == 0)
+			break;
+
+		if (p->size < 0 && adfspart_check_ICSLinux (dev, p->start)) {
+			/*
+			 * We use the first sector to identify what type
+			 * this partition is...
+			 */
+			if (p->size > 1)
+				add_partition (hd, minor, first_sector + p->start + 1, p->size - 1);
+		} else
+			add_partition (hd, minor, first_sector + p->start, p->size);
+		minor++;
+	}
+	brelse (bh);
+
+	return 1;
+}
+#endif
+
+/*
+ * Purpose: initialise all the partitions on an ADFS drive.
+ *          These may be other ADFS partitions or a Linux/RiscBSD/RiscIX
+ *	    partition.
+ *
+ * Params : hd		 - pointer to gendisk structure to store devices partitions.
+ *          dev		 - device number to access
+ *	    first_sector - first available sector on the disk.
+ *	    minor	 - first available minor on this device.
+ *
+ * Returns: -1 on error, 0 if not ADFS format, 1 if ok.
+ */
+int acorn_partition(struct gendisk *hd, kdev_t dev,
+		    unsigned long first_sector, int first_part_minor)
+{
+	int r = 0;
+
+	MOD_INC_USE_COUNT;
+#ifdef CONFIG_ACORN_PARTITION_ICS
+	if (r == 0)
+		r = adfspart_check_ICS (hd, dev, first_sector, first_part_minor);
+#endif
+#if 0
+#ifdef CONFIG_ACORN_PARTITION_CUMANA
+	if (r == 0)    
+		r = adfspart_check_CUMANA (hd, dev, first_sector, first_part_minor);
+#endif
+#endif
+#ifdef CONFIG_ACORN_PARTITION_ADFS
+	if (r == 0)
+		r = adfspart_check_ADFS (hd, dev, first_sector, first_part_minor);
+#endif
+	if (r < 0)
+		printk (" unable to read boot sectors / partition sectors\n");
+	else if (r)
+		printk ("\n");
+	MOD_DEC_USE_COUNT;
+	return r;
+}
+
+static struct partition_parser acorn_partition_parser =
+    { NULL, "acorn", acorn_partition };
+
+#ifndef MODULE
+__initfunc(void acorn_partbl_init( void ))
+{
+	(void)register_partbl( &acorn_partition_parser );
+}
+#else
+int init_module(void)
+{
+	return register_partbl( &acorn_partition_parser );
+}
+
+void cleanup_module(void)
+{
+	(void)unregister_partbl( &acorn_partition_parser );
+}
+#endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/fs/partitions/acorn.h m68k/fs/partitions/acorn.h
--- jes-2.1.106/fs/partitions/acorn.h	Thu Jan  1 01:00:00 1970
+++ m68k/fs/partitions/acorn.h	Sun Jun 14 22:23:53 1998
@@ -0,0 +1,68 @@
+/*
+ * fs/partitions/acorn.h
+ *
+ * Copyright (C) 1996-1998 Russell King
+ */
+#include <linux/adfs_fs.h>
+
+/*
+ * Offset in bytes of the boot block on the disk.
+ */
+#define BOOT_SECTOR_ADDRESS 0xc00
+
+/*
+ * Disc record size
+ */
+#define RECSIZE 60
+
+/*
+ * Disc record
+ */
+struct disc_record {
+	unsigned char  log2secsize;
+	unsigned char  secspertrack;
+	unsigned char  heads;
+	unsigned char  density;
+	unsigned char  idlen;
+	unsigned char  log2bpmb;
+	unsigned char  skew;
+	unsigned char  bootoption;
+	unsigned char  lowsector;
+	unsigned char  nzones;
+	unsigned short zone_spare;
+	unsigned long  root;
+	unsigned long  disc_size;
+	unsigned short disc_id;
+	unsigned char  disc_name[10];
+	unsigned long  disc_type;
+	unsigned long  disc_size_high;
+	unsigned char  log2sharesize:4;
+	unsigned char  unused:4;
+	unsigned char  big_flag:1;
+};
+
+/*
+ * Partition types. (Oh for reusability)
+ */
+#define PARTITION_RISCIX_MFM	1
+#define PARTITION_RISCIX_SCSI	2
+#define PARTITION_LINUX		9
+
+struct riscix_part {
+	unsigned long  start;
+	unsigned long  length;
+	unsigned long  one;
+	char name[16];
+};
+
+struct riscix_record {
+	unsigned long  magic;
+#define RISCIX_MAGIC	(0x4a657320)
+	unsigned long  date;
+	struct riscix_part part[8];
+};
+
+int
+acorn_partition(struct gendisk *hd, kdev_t dev,
+		unsigned long first_sector, int first_part_minor);
+
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/fs/partitions/amiga.c m68k/fs/partitions/amiga.c
--- jes-2.1.106/fs/partitions/amiga.c	Thu Jan  1 01:00:00 1970
+++ m68k/fs/partitions/amiga.c	Sun Jun 14 22:23:53 1998
@@ -0,0 +1,122 @@
+/*
+ *  fs/partitions/amiga.c -- Amiga RDSK partition table parser
+ *
+ *  Code extracted from
+ *  linux/drivers/block/genhd.c
+ *
+ */
+
+#include <linux/module.h>
+
+#include <linux/fs.h>
+#include <linux/kernel.h>
+#include <linux/major.h>
+#include <linux/string.h>
+#include <linux/init.h>
+#include <linux/affs_hardblocks.h>
+#include <asm/byteorder.h>
+#include "../partcheck.h"
+
+static __inline__ u32
+checksum_block(u32 *m, int size)
+{
+	u32 sum = 0;
+
+	while (size--)
+		sum += be32_to_cpu(*m++);
+	return sum;
+}
+
+static int
+amiga_partition(struct gendisk *hd, kdev_t dev, unsigned long first_sector,
+		int current_minor)
+{
+	struct buffer_head	*bh;
+	struct RigidDiskBlock	*rdb;
+	struct PartitionBlock	*pb;
+	int			 start_sect;
+	int			 nr_sects;
+	int			 blk;
+	int			 part, res;
+
+	MOD_INC_USE_COUNT;
+	set_blocksize(dev,512);
+	res = 0;
+
+	for (blk = 0; blk < RDB_ALLOCATION_LIMIT; blk++) {
+		if(!(bh = bread(dev,blk,512))) {
+			printk("Dev %s: unable to read RDB block %d\n",
+			       kdevname(dev),blk);
+			res = -1;
+			goto rdb_done;
+		}
+		if (*(u32 *)bh->b_data == cpu_to_be32(IDNAME_RIGIDDISK)) {
+			rdb = (struct RigidDiskBlock *)bh->b_data;
+			if (checksum_block((u32 *)bh->b_data,be32_to_cpu(rdb->rdb_SummedLongs) & 0x7F)) {
+				printk("Dev %s: RDB in block %d has bad checksum\n",
+				       kdevname(dev),blk);
+				brelse(bh);
+				continue;
+			}
+			printk(" RDSK");
+			blk = be32_to_cpu(rdb->rdb_PartitionList);
+			brelse(bh);
+			for (part = 1; blk > 0 && part <= 16; part++) {
+				if (!(bh = bread(dev,blk,512))) {
+					printk("Dev %s: unable to read partition block %d\n",
+						       kdevname(dev),blk);
+					res = -1;
+					goto rdb_done;
+				}
+				pb  = (struct PartitionBlock *)bh->b_data;
+				blk = be32_to_cpu(pb->pb_Next);
+				if (pb->pb_ID == cpu_to_be32(IDNAME_PARTITION) && checksum_block(
+				    (u32 *)pb,be32_to_cpu(pb->pb_SummedLongs) & 0x7F) == 0 ) {
+					
+					/* Tell Kernel about it */
+
+					if (!(nr_sects = (be32_to_cpu(pb->pb_Environment[10]) + 1 -
+							  be32_to_cpu(pb->pb_Environment[9])) *
+							 be32_to_cpu(pb->pb_Environment[3]) *
+							 be32_to_cpu(pb->pb_Environment[5]))) {
+						continue;
+					}
+					start_sect = be32_to_cpu(pb->pb_Environment[9]) *
+						     be32_to_cpu(pb->pb_Environment[3]) *
+						     be32_to_cpu(pb->pb_Environment[5]);
+					add_partition(hd,current_minor,start_sect,nr_sects);
+					current_minor++;
+					res = 1;
+				}
+				brelse(bh);
+			}
+			printk("\n");
+			break;
+		}
+	}
+
+rdb_done:
+	set_blocksize(dev,BLOCK_SIZE);
+	MOD_DEC_USE_COUNT;
+	return res;
+}
+
+static struct partition_parser amiga_partition_parser =
+    { NULL, "amiga", amiga_partition };
+
+#ifndef MODULE
+__initfunc(void amiga_partbl_init( void ))
+{
+	(void)register_partbl( &amiga_partition_parser );
+}
+#else
+int init_module(void)
+{
+	return register_partbl( &amiga_partition_parser );
+}
+
+void cleanup_module(void)
+{
+	(void)unregister_partbl( &amiga_partition_parser );
+}
+#endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/fs/partitions/atari.c m68k/fs/partitions/atari.c
--- jes-2.1.106/fs/partitions/atari.c	Thu Jan  1 01:00:00 1970
+++ m68k/fs/partitions/atari.c	Sun Jun 14 22:23:53 1998
@@ -0,0 +1,192 @@
+/*
+ *  fs/partitions/atari.c -- Atari partition table parser
+ *
+ *  Code extracted from
+ *  linux/drivers/block/genhd.c
+ *
+ */
+
+#include <linux/module.h>
+
+#include <linux/fs.h>
+#include <linux/kernel.h>
+#include <linux/major.h>
+#include <linux/string.h>
+#include <linux/ctype.h>
+#include <linux/init.h>
+#include <linux/atari_rootsec.h>
+#include <asm/byteorder.h>
+#include "../partcheck.h"
+
+
+/* check if a partition entry looks valid -- Atari format is assumed if at
+ * least one of the primary entries is ok this way */
+#define	VALID_PARTITION(pi,hdsiz)					     \
+    (((pi)->flg & 1) &&							     \
+     isalnum((pi)->id[0]) && isalnum((pi)->id[1]) && isalnum((pi)->id[2]) && \
+     be32_to_cpu((pi)->st) <= (hdsiz) &&				     \
+     be32_to_cpu((pi)->st) + be32_to_cpu((pi)->siz) <= (hdsiz))
+
+static int atari_partition (struct gendisk *hd, kdev_t dev,
+			    unsigned long first_sector, int current_minor)
+{
+  int minor = current_minor, m_lim = current_minor + hd->max_p;
+  int i;
+  struct buffer_head *bh;
+  struct rootsector *rs;
+  struct partition_info *pi;
+  u32 extensect;
+  u32 hd_size;
+  int bsize, bdiv;
+  int part_fmt = 0; /* 0:unknown, 1:AHDI, 2:ICD/Supra */
+
+  MOD_INC_USE_COUNT;
+  bsize = get_ptable_blocksize(dev);
+  bdiv  = bsize / 512;
+  bh = bread (dev, 0, bsize);
+  if (!bh)
+    {
+      printk (" unable to read block 0\n");
+      MOD_DEC_USE_COUNT;
+      return -1;
+    }
+
+  rs = (struct rootsector *) bh->b_data;
+  hd_size = hd->part[current_minor-1].nr_sects;
+  if (!VALID_PARTITION( &rs->part[0], hd_size ) &&
+      !VALID_PARTITION( &rs->part[1], hd_size ) &&
+      !VALID_PARTITION( &rs->part[2], hd_size ) &&
+      !VALID_PARTITION( &rs->part[3], hd_size )) {
+      /* if there's no valid primary partition, assume that no Atari format
+       * partition table (there's no reliable magic or the like :-() */
+      MOD_DEC_USE_COUNT;
+      return 0;
+  }
+
+  printk (" AHDI");
+  pi = &rs->part[0];
+  for (; pi < &rs->part[4] && minor < m_lim; minor++, pi++)
+    {
+      if (pi->flg & 1)
+	/* active partition */
+	{
+	  if (memcmp (pi->id, "XGM", 3) == 0)
+	    /* extension partition */
+	    {
+	      struct rootsector *xrs;
+	      struct buffer_head *xbh;
+	      u32 partsect;
+
+	      part_fmt = 1;
+	      printk(" XGM<");
+	      partsect = extensect = be32_to_cpu(pi->st);
+	      while (1)
+		{
+		  xbh = bread (dev, partsect / bdiv, bsize);
+		  if (!xbh)
+		    {
+		      printk (" block %u read failed\n", partsect);
+		      brelse(bh);
+		      MOD_DEC_USE_COUNT;
+		      return -1;
+		    }
+		  xrs = (struct rootsector *) &xbh->b_data[(partsect%bdiv)*512];
+
+		  /* ++roman: valid bit must be set in one of the first 3
+		   * slots */
+		  for( i = 0; i < 3; ++i )
+		      if (xrs->part[0].flg & 1)
+			  break;
+		  if (i == 3) {
+		    printk( "\nNo valid subpartition in extended "
+			    "partition!\n" );
+		    break;
+		  }
+		  
+		  add_partition(hd, minor,
+				partsect + be32_to_cpu(xrs->part[i].st),
+				be32_to_cpu(xrs->part[i].siz));
+
+		  /* the slot following must be either invalid (end of list)
+		   * or another XGM entry */
+		  if (!(xrs->part[i+1].flg & 1)) {
+		    brelse( xbh );
+		    break;
+		  }
+		  if (memcmp( xrs->part[i+1].id, "XGM", 3 ) != 0) {
+		    printk( "\nLink ID in extended partition is not XGM!\n" );
+		    brelse( xbh );
+		    break;
+		  }
+
+		  partsect = be32_to_cpu(xrs->part[i+1].st) + extensect;
+		  brelse (xbh);
+		  minor++;
+		  if (minor >= m_lim) {
+		    printk( "\nMaximum number of partitions reached!\n" );
+		    break;
+		  }
+		}
+	      printk(" >");
+	    }
+	  else
+	    {
+	      /* we don't care about other id's */
+	      add_partition (hd, minor, be32_to_cpu(pi->st),
+			     be32_to_cpu(pi->siz));
+	    }
+	}
+    }
+  if ( part_fmt!=1 ) /* no extended partitions -> test ICD-format */
+  {
+    pi = &rs->icdpart[0];
+    /* sanity check: no ICD format if first partition invalid */
+    if (memcmp (pi->id, "GEM", 3) == 0 ||
+        memcmp (pi->id, "BGM", 3) == 0 ||
+        memcmp (pi->id, "LNX", 3) == 0 ||
+        memcmp (pi->id, "SWP", 3) == 0 ||
+        memcmp (pi->id, "RAW", 3) == 0 )
+    {
+      printk(" ICD<");
+      for (; pi < &rs->icdpart[8] && minor < m_lim; minor++, pi++)
+      {
+        /* accept only GEM,BGM,RAW,LNX,SWP partitions */
+        if (pi->flg & 1 && 
+            (memcmp (pi->id, "GEM", 3) == 0 ||
+             memcmp (pi->id, "BGM", 3) == 0 ||
+             memcmp (pi->id, "LNX", 3) == 0 ||
+             memcmp (pi->id, "SWP", 3) == 0 ||
+             memcmp (pi->id, "RAW", 3) == 0) )
+        {
+          part_fmt = 2;
+	  add_partition (hd, minor, be32_to_cpu(pi->st), be32_to_cpu(pi->siz));
+        }
+      }
+      printk(" >");
+    }
+  }
+  brelse (bh);
+  printk ("\n");
+  MOD_DEC_USE_COUNT;
+  return 1;
+}
+
+static struct partition_parser atari_partition_parser =
+    { NULL, "atari", atari_partition };
+
+#ifndef MODULE
+__initfunc(void atari_partbl_init( void ))
+{
+	(void)register_partbl( &atari_partition_parser );
+}
+#else
+int init_module(void)
+{
+	return register_partbl( &atari_partition_parser );
+}
+
+void cleanup_module(void)
+{
+	(void)unregister_partbl( &atari_partition_parser );
+}
+#endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/fs/partitions/mac.c m68k/fs/partitions/mac.c
--- jes-2.1.106/fs/partitions/mac.c	Thu Jan  1 01:00:00 1970
+++ m68k/fs/partitions/mac.c	Sun Jun 14 22:23:53 1998
@@ -0,0 +1,171 @@
+/*
+ *  fs/partitions/mac.c -- Mac partition table parser
+ *
+ *  Code extracted from
+ *  linux/drivers/block/genhd.c
+ *
+ */
+
+#include <linux/module.h>
+
+#include <linux/config.h>
+#include <linux/fs.h>
+#include <linux/kernel.h>
+#include <linux/major.h>
+#include <linux/string.h>
+#include <linux/ctype.h>
+#include <linux/init.h>
+#include "../partcheck.h"
+
+
+/*
+ * Code to understand MacOS partition tables.
+ */
+
+#define MAC_PARTITION_MAGIC	0x504d
+
+/* type field value for A/UX or other Unix partitions */
+#define APPLE_AUX_TYPE	"Apple_UNIX_SVR2"
+
+struct mac_partition {
+	__u16	signature;	/* expected to be MAC_PARTITION_MAGIC */
+	__u16	res1;
+	__u32	map_count;	/* # blocks in partition map */
+	__u32	start_block;	/* absolute starting block # of partition */
+	__u32	block_count;	/* number of blocks in partition */
+	char	name[32];	/* partition name */
+	char	type[32];	/* string type description */
+	__u32	data_start;	/* rel block # of first data block */
+	__u32	data_count;	/* number of data blocks */
+	__u32	status;		/* partition status bits */
+	__u32	boot_start;
+	__u32	boot_size;
+	__u32	boot_load;
+	__u32	boot_load2;
+	__u32	boot_entry;
+	__u32	boot_entry2;
+	__u32	boot_cksum;
+	char	processor[16];	/* identifies ISA of boot */
+	/* there is more stuff after this that we don't need */
+};
+
+#define MAC_STATUS_BOOTABLE	8	/* partition is bootable */
+
+#define MAC_DRIVER_MAGIC	0x4552
+
+/* Driver descriptor structure, in block 0 */
+struct mac_driver_desc {
+	__u16	signature;	/* expected to be MAC_DRIVER_MAGIC */
+	__u16	block_size;
+	__u32	block_count;
+    /* ... more stuff */
+};
+
+static int mac_partition(struct gendisk *hd, kdev_t dev, unsigned long fsec,
+						 int current_minor)
+{
+	struct buffer_head *bh;
+	int blk, blocks_in_map;
+	int dev_bsize, dev_pos, pos;
+	unsigned secsize;
+#ifdef CONFIG_PMAC
+	int first_bootable = 1;
+#endif
+	struct mac_partition *part;
+	struct mac_driver_desc *md;
+
+	MOD_INC_USE_COUNT;
+	dev_bsize = get_ptable_blocksize(dev);
+	dev_pos = 0;
+	/* Get 0th block and look at the first partition map entry. */
+	if ((bh = bread(dev, 0, dev_bsize)) == 0) {
+	    printk("%s: error reading partition table\n",
+		   kdevname(dev));
+	    MOD_DEC_USE_COUNT;
+	    return -1;
+	}
+	md = (struct mac_driver_desc *) bh->b_data;
+	if (be16_to_cpu(md->signature) != MAC_DRIVER_MAGIC) {
+		brelse(bh);
+		MOD_DEC_USE_COUNT;
+		return 0;
+	}
+	secsize = be16_to_cpu(md->block_size);
+	if (secsize >= dev_bsize) {
+		brelse(bh);
+		dev_pos = secsize;
+		if ((bh = bread(dev, secsize/dev_bsize, dev_bsize)) == 0) {
+			printk("%s: error reading partition table\n",
+			       kdevname(dev));
+			MOD_DEC_USE_COUNT;
+			return -1;
+		}
+	}
+	part = (struct mac_partition *) (bh->b_data + secsize - dev_pos);
+	if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC) {
+		brelse(bh);
+		MOD_DEC_USE_COUNT;
+		return 0;		/* not a MacOS disk */
+	}
+	printk(" MAC");
+	blocks_in_map = be32_to_cpu(part->map_count);
+	for (blk = 1; blk <= blocks_in_map; ++blk) {
+		pos = blk * secsize;
+		if (pos >= dev_pos + dev_bsize) {
+			brelse(bh);
+			dev_pos = pos;
+			if ((bh = bread(dev, pos/dev_bsize, dev_bsize)) == 0) {
+				printk("%s: error reading partition table\n",
+				       kdevname(dev));
+				MOD_DEC_USE_COUNT;
+				return -1;
+			}
+		}
+		part = (struct mac_partition *) (bh->b_data + pos - dev_pos);
+		if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC)
+			break;
+		blocks_in_map = be32_to_cpu(part->map_count);
+		add_partition(hd, current_minor,
+			fsec + be32_to_cpu(part->start_block) * (secsize/512),
+			be32_to_cpu(part->block_count) * (secsize/512));
+
+#ifdef CONFIG_PMAC
+		/*
+		 * If this is the first bootable partition, tell the
+		 * setup code, in case it wants to make this the root.
+		 */
+		if (first_bootable
+		    && (be32_to_cpu(part->status) & MAC_STATUS_BOOTABLE)
+		    && strcasecmp(part->processor, "powerpc") == 0) {
+			note_bootable_part(dev, blk);
+			first_bootable = 0;
+		}
+#endif /* CONFIG_PMAC */
+
+		++current_minor;
+	}
+	brelse(bh);
+	printk("\n");
+	MOD_DEC_USE_COUNT;
+	return 1;
+}
+
+static struct partition_parser mac_partition_parser =
+    { NULL, "mac", mac_partition };
+
+#ifndef MODULE
+__initfunc(void mac_partbl_init( void ))
+{
+	(void)register_partbl( &mac_partition_parser );
+}
+#else
+int init_module(void)
+{
+	return register_partbl( &mac_partition_parser );
+}
+
+void cleanup_module(void)
+{
+	(void)unregister_partbl( &mac_partition_parser );
+}
+#endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/fs/partitions/osf.c m68k/fs/partitions/osf.c
--- jes-2.1.106/fs/partitions/osf.c	Thu Jan  1 01:00:00 1970
+++ m68k/fs/partitions/osf.c	Sun Jun 14 22:23:53 1998
@@ -0,0 +1,117 @@
+/*
+ *  fs/partitions/osf.c -- partition table parser for OSF partitions (alpha)
+ *
+ *  Code extracted from
+ *  linux/drivers/block/genhd.c
+ *
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <linux/module.h>
+
+#include <linux/fs.h>
+#include <linux/kernel.h>
+#include <linux/major.h>
+#include <linux/string.h>
+#include <linux/init.h>
+#include "../partcheck.h"
+
+
+static int osf_partition(struct gendisk *hd, kdev_t dev, unsigned long first_sector, int current_minor)
+{
+	int i;
+	int mask = (1 << hd->minor_shift) - 1;
+	struct buffer_head *bh;
+	struct disklabel {
+		u32 d_magic;
+		u16 d_type,d_subtype;
+		u8 d_typename[16];
+		u8 d_packname[16];
+		u32 d_secsize;
+		u32 d_nsectors;
+		u32 d_ntracks;
+		u32 d_ncylinders;
+		u32 d_secpercyl;
+		u32 d_secprtunit;
+		u16 d_sparespertrack;
+		u16 d_sparespercyl;
+		u32 d_acylinders;
+		u16 d_rpm, d_interleave, d_trackskew, d_cylskew;
+		u32 d_headswitch, d_trkseek, d_flags;
+		u32 d_drivedata[5];
+		u32 d_spare[5];
+		u32 d_magic2;
+		u16 d_checksum;
+		u16 d_npartitions;
+		u32 d_bbsize, d_sbsize;
+		struct d_partition {
+			u32 p_size;
+			u32 p_offset;
+			u32 p_fsize;
+			u8  p_fstype;
+			u8  p_frag;
+			u16 p_cpg;
+		} d_partitions[8];
+	} * label;
+	struct d_partition * partition;
+#define DISKLABELMAGIC (0x82564557UL)
+
+	MOD_INC_USE_COUNT;
+	if (!(bh = bread(dev,0,get_ptable_blocksize(dev)))) {
+		printk("unable to read partition table\n");
+	    MOD_DEC_USE_COUNT;
+		return -1;
+	}
+	label = (struct disklabel *) (bh->b_data+64);
+	partition = label->d_partitions;
+	if (label->d_magic != cpu_to_le32(DISKLABELMAGIC)) {
+#if 0
+		printk("magic: %08x\n", label->d_magic);
+#endif
+		brelse(bh);
+	    MOD_DEC_USE_COUNT;
+		return 0;
+	}
+	if (label->d_magic2 != cpu_to_le32(DISKLABELMAGIC)) {
+#if 0
+		printk("magic2: %08x\n", label->d_magic2);
+#endif
+		brelse(bh);
+	    MOD_DEC_USE_COUNT;
+		return 0;
+	}
+	printk(" OSF");
+	for (i = 0 ; i < le16_to_cpu(label->d_npartitions); i++, partition++) {
+		if ((current_minor & mask) == 0)
+		        break;
+		if (partition->p_size)
+			add_partition(hd, current_minor,
+				first_sector+le32_to_cpu(partition->p_offset),
+				le32_to_cpu(partition->p_size));
+		current_minor++;
+	}
+	printk("\n");
+	brelse(bh);
+	MOD_DEC_USE_COUNT;
+	return 1;
+}
+
+static struct partition_parser osf_partition_parser =
+    { NULL, "osf",  osf_partition };
+
+#ifndef MODULE
+__initfunc(void osf_partbl_init( void ))
+{
+	(void)register_partbl( &osf_partition_parser );
+}
+#else
+int init_module(void)
+{
+	return register_partbl( &osf_partition_parser );
+}
+
+void cleanup_module(void)
+{
+	(void)unregister_partbl( &osf_partition_parser );
+}
+#endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/fs/partitions/pc.c m68k/fs/partitions/pc.c
--- jes-2.1.106/fs/partitions/pc.c	Thu Jan  1 01:00:00 1970
+++ m68k/fs/partitions/pc.c	Sun Jun 14 22:23:53 1998
@@ -0,0 +1,425 @@
+/*
+ *  fs/partitions/pc.c -- PC (= MSDOS) partition table parser
+ *
+ *  Code extracted from
+ *  linux/drivers/block/genhd.c
+ *
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ *
+ *  Thanks to Branko Lankester, lankeste@fwi.uva.nl, who found a bug
+ *  in the early extended-partition checks and added DM partitions
+ *
+ *  Support for DiskManager v6.0x added by Mark Lord,
+ *  with information provided by OnTrack.  This now works for linux fdisk
+ *  and LILO, as well as loadlin and bootln.  Note that disks other than
+ *  /dev/hda *must* have a "DOS" type 0x51 partition in the first slot (hda1).
+ *
+ *  More flexible handling of extended partitions - aeb, 950831
+ *
+ *  Check partition table on IDE disks for common CHS translations
+ */
+
+#include <linux/module.h>
+
+#include <linux/config.h>
+#include <linux/fs.h>
+#include <linux/kernel.h>
+#include <linux/major.h>
+#include <linux/string.h>
+#include <linux/blk.h>
+#include <linux/init.h>
+
+#include <asm/system.h>
+#include "../partcheck.h"
+
+static int current_minor;
+
+/*
+ * Many architectures don't like unaligned accesses, which is
+ * frequently the case with the nr_sects and start_sect partition
+ * table entries.
+ */
+#include <asm/unaligned.h>
+
+#define SYS_IND(p)	(get_unaligned(&p->sys_ind))
+#define NR_SECTS(p)	({ __typeof__(p->nr_sects) __a =	\
+				get_unaligned(&p->nr_sects);	\
+				le32_to_cpu(__a); \
+			})
+
+#define START_SECT(p)	({ __typeof__(p->start_sect) __a =	\
+				get_unaligned(&p->start_sect);	\
+				le32_to_cpu(__a); \
+			})
+
+
+static inline int is_extended_partition(struct partition *p)
+{
+	return (SYS_IND(p) == DOS_EXTENDED_PARTITION ||
+		SYS_IND(p) == WIN98_EXTENDED_PARTITION ||
+		SYS_IND(p) == LINUX_EXTENDED_PARTITION);
+}
+
+/*
+ * Create devices for each logical partition in an extended partition.
+ * The logical partitions form a linked list, with each entry being
+ * a partition table with two entries.  The first entry
+ * is the real data partition (with a start relative to the partition
+ * table start).  The second is a pointer to the next logical partition
+ * (with a start relative to the entire extended partition).
+ * We do not create a Linux partition for the partition tables, but
+ * only for the actual data partitions.
+ */
+
+#define MSDOS_LABEL_MAGIC		0xAA55
+
+static void extended_partition(struct gendisk *hd, kdev_t dev)
+{
+	struct buffer_head *bh;
+	struct partition *p;
+	unsigned long first_sector, first_size, this_sector, this_size;
+	int mask = (1 << hd->minor_shift) - 1;
+	int i;
+
+	first_sector = hd->part[MINOR(dev)].start_sect;
+	first_size = hd->part[MINOR(dev)].nr_sects;
+	this_sector = first_sector;
+
+	while (1) {
+		if ((current_minor & mask) == 0)
+			return;
+		if (!(bh = bread(dev,0,get_ptable_blocksize(dev))))
+			return;
+	  /*
+	   * This block is from a device that we're about to stomp on.
+	   * So make sure nobody thinks this block is usable.
+	   */
+		bh->b_state = 0;
+
+		if ((*(unsigned short *) (bh->b_data+510)) != cpu_to_le16(MSDOS_LABEL_MAGIC))
+			goto done;
+
+		p = (struct partition *) (0x1BE + bh->b_data);
+
+		this_size = hd->part[MINOR(dev)].nr_sects;
+
+		/*
+		 * Usually, the first entry is the real data partition,
+		 * the 2nd entry is the next extended partition, or empty,
+		 * and the 3rd and 4th entries are unused.
+		 * However, DRDOS sometimes has the extended partition as
+		 * the first entry (when the data partition is empty),
+		 * and OS/2 seems to use all four entries.
+		 */
+
+		/* 
+		 * First process the data partition(s)
+		 */
+		for (i=0; i<4; i++, p++) {
+		    if (!NR_SECTS(p) || is_extended_partition(p))
+		      continue;
+
+		    /* Check the 3rd and 4th entries -
+		       these sometimes contain random garbage */
+		    if (i >= 2
+			&& START_SECT(p) + NR_SECTS(p) > this_size
+			&& (this_sector + START_SECT(p) < first_sector ||
+			    this_sector + START_SECT(p) + NR_SECTS(p) >
+			     first_sector + first_size))
+		      continue;
+
+		    add_partition(hd, current_minor, this_sector+START_SECT(p), NR_SECTS(p));
+		    current_minor++;
+		    if ((current_minor & mask) == 0)
+		      goto done;
+		}
+		/*
+		 * Next, process the (first) extended partition, if present.
+		 * (So far, there seems to be no reason to make
+		 *  extended_partition()  recursive and allow a tree
+		 *  of extended partitions.)
+		 * It should be a link to the next logical partition.
+		 * Create a minor for this just long enough to get the next
+		 * partition table.  The minor will be reused for the next
+		 * data partition.
+		 */
+		p -= 4;
+		for (i=0; i<4; i++, p++)
+		  if(NR_SECTS(p) && is_extended_partition(p))
+		    break;
+		if (i == 4)
+		  goto done;	 /* nothing left to do */
+
+		hd->part[current_minor].nr_sects = NR_SECTS(p);
+		hd->part[current_minor].start_sect = first_sector + START_SECT(p);
+		this_sector = first_sector + START_SECT(p);
+		dev = MKDEV(hd->major, current_minor);
+		brelse(bh);
+	}
+done:
+	brelse(bh);
+}
+
+#ifdef CONFIG_SOLARIS_X86_PARTITION
+static void
+solaris_x86_partition(struct gendisk *hd, kdev_t dev, long offset) {
+
+	struct buffer_head *bh;
+	struct solaris_x86_vtoc *v;
+	struct solaris_x86_slice *s;
+	int i;
+
+	if(!(bh = bread(dev, 0, get_ptable_blocksize(dev))))
+		return;
+	v = (struct solaris_x86_vtoc *)(bh->b_data + 512);
+	if(v->v_sanity != cpu_to_le32(SOLARIS_X86_VTOC_SANE)) {
+		brelse(bh);
+		return;
+	}
+	printk(" <solaris:");
+	if(v->v_version != cpu_to_le32(1)) {
+		printk("  cannot handle version %d vtoc>", le32_to_cpu(v->v_version));
+		brelse(bh);
+		return;
+	}
+	for(i=0; i<SOLARIS_X86_NUMSLICE; i++) {
+		s = &v->v_slice[i];
+
+		if (s->s_tag == 0)
+			continue;
+		printk(" [s%d]", i);
+		/* solaris partitions are relative to current MS-DOS
+		 * one but add_partition starts relative to sector
+		 * zero of the disk.  Therefore, must add the offset
+		 * of the current partition */
+		add_partition(hd, current_minor, le32_to_cpu(s->s_start)+offset,
+					  le32_to_cpu(s->s_size));
+		current_minor++;
+	}
+	brelse(bh);
+	printk(" >");
+}
+#endif
+
+#ifdef CONFIG_BSD_DISKLABEL
+/* 
+ * Create devices for BSD partitions listed in a disklabel, under a
+ * dos-like partition. See extended_partition() for more information.
+ */
+static void bsd_disklabel_partition(struct gendisk *hd, kdev_t dev)
+{
+	struct buffer_head *bh;
+	struct bsd_disklabel *l;
+	struct bsd_partition *p;
+	int mask = (1 << hd->minor_shift) - 1;
+
+	if (!(bh = bread(dev,0,get_ptable_blocksize(dev))))
+		return;
+	bh->b_state = 0;
+	l = (struct bsd_disklabel *) (bh->b_data+512);
+	if (l->d_magic != cpu_to_le32(BSD_DISKMAGIC)) {
+		brelse(bh);
+		return;
+	}
+
+	p = &l->d_partitions[0];
+	while (p - &l->d_partitions[0] <= BSD_MAXPARTITIONS) {
+		if ((current_minor & mask) >= (4 + hd->max_p))
+			break;
+
+		if (p->p_fstype != BSD_FS_UNUSED) {
+			add_partition(hd, current_minor, le32_to_cpu(p->p_offset),
+						  le32_to_cpu(p->p_size));
+			current_minor++;
+		}
+		p++;
+	}
+	brelse(bh);
+
+}
+#endif
+
+static int msdos_partition(struct gendisk *hd, kdev_t dev, unsigned long first_sector, int first_minor)
+{
+	int i, minor = current_minor = first_minor;
+	struct buffer_head *bh;
+	struct partition *p;
+	unsigned char *data;
+	int mask = (1 << hd->minor_shift) - 1;
+#ifdef CONFIG_BLK_DEV_IDE
+	int tested_for_xlate = 0;
+
+	MOD_INC_USE_COUNT;
+read_mbr:
+#endif
+	if (!(bh = bread(dev,0,get_ptable_blocksize(dev)))) {
+		printk(" unable to read partition table\n");
+	    MOD_DEC_USE_COUNT;
+		return -1;
+	}
+	data = bh->b_data;
+	/* In some cases we modify the geometry    */
+	/*  of the drive (below), so ensure that   */
+	/*  nobody else tries to re-use this data. */
+	bh->b_state = 0;
+#ifdef CONFIG_BLK_DEV_IDE
+check_table:
+#endif
+	if (*(unsigned short *)  (0x1fe + data) != cpu_to_le16(MSDOS_LABEL_MAGIC)) {
+		brelse(bh);
+	    MOD_DEC_USE_COUNT;
+		return 0;
+	}
+	p = (struct partition *) (0x1be + data);
+
+#ifdef CONFIG_BLK_DEV_IDE
+	if (!tested_for_xlate++) {	/* Do this only once per disk */
+		/*
+		 * Look for various forms of IDE disk geometry translation
+		 */
+		extern int ide_xlate_1024(kdev_t, int, const char *);
+		unsigned int sig = le16_to_cpu(*(unsigned short *)(data + 2));
+		if (SYS_IND(p) == EZD_PARTITION) {
+			/*
+			 * The remainder of the disk must be accessed using
+			 * a translated geometry that reduces the number of 
+			 * apparent cylinders to less than 1024 if possible.
+			 *
+			 * ide_xlate_1024() will take care of the necessary
+			 * adjustments to fool fdisk/LILO and partition check.
+			 */
+			if (ide_xlate_1024(dev, -1, " [EZD]")) {
+				data += 512;
+				goto check_table;
+			}
+		} else if (SYS_IND(p) == DM6_PARTITION) {
+
+			/*
+			 * Everything on the disk is offset by 63 sectors,
+			 * including a "new" MBR with its own partition table,
+			 * and the remainder of the disk must be accessed using
+			 * a translated geometry that reduces the number of 
+			 * apparent cylinders to less than 1024 if possible.
+			 *
+			 * ide_xlate_1024() will take care of the necessary
+			 * adjustments to fool fdisk/LILO and partition check.
+			 */
+			if (ide_xlate_1024(dev, 1, " [DM6:DDO]")) {
+				brelse(bh);
+				goto read_mbr;	/* start over with new MBR */
+			}
+		} else if (sig <= 0x1ae &&
+			   *(unsigned short *)(data + sig) == cpu_to_le16(0x55AA) &&
+			   (1 & *(unsigned char *)(data + sig + 2))) {
+			/* DM6 signature in MBR, courtesy of OnTrack */
+			(void) ide_xlate_1024 (dev, 0, " [DM6:MBR]");
+		} else if (SYS_IND(p) == DM6_AUX1PARTITION || SYS_IND(p) == DM6_AUX3PARTITION) {
+			/*
+			 * DM6 on other than the first (boot) drive
+			 */
+			(void) ide_xlate_1024(dev, 0, " [DM6:AUX]");
+		} else {
+			/*
+			 * Examine the partition table for common translations.
+			 * This is necessary for drives for situations where
+			 * the translated geometry is unavailable from the BIOS.
+			 */
+			for (i = 0; i < 4 ; i++) {
+				struct partition *q = &p[i];
+				if (NR_SECTS(q)
+				   && (q->sector & 63) == 1
+				   && (q->end_sector & 63) == 63) {
+					unsigned int heads = q->end_head + 1;
+					if (heads == 32 || heads == 64 || heads == 128 || heads == 255) {
+
+						(void) ide_xlate_1024(dev, heads, " [PTBL]");
+						break;
+					}
+				}
+			}
+		}
+	}
+#endif	/* CONFIG_BLK_DEV_IDE */
+
+	printk(" PC");	/* show partition type */
+	current_minor += 4;  /* first "extra" minor (for extended partitions) */
+	for (i=1 ; i<=4 ; minor++,i++,p++) {
+		if (!NR_SECTS(p))
+			continue;
+		add_partition(hd, minor, first_sector+START_SECT(p), NR_SECTS(p));
+		if (is_extended_partition(p)) {
+			printk(" <");
+			/*
+			 * If we are rereading the partition table, we need
+			 * to set the size of the partition so that we will
+			 * be able to bread the block containing the extended
+			 * partition info.
+			 */
+			hd->sizes[minor] = hd->part[minor].nr_sects 
+			  	>> (BLOCK_SIZE_BITS - 9);
+			extended_partition(hd, MKDEV(hd->major, minor));
+			printk(" >");
+			/* prevent someone doing mkfs or mkswap on an
+			   extended partition, but leave room for LILO */
+			if (hd->part[minor].nr_sects > 2)
+				hd->part[minor].nr_sects = 2;
+		}
+#ifdef CONFIG_BSD_DISKLABEL
+		if (SYS_IND(p) == BSD_PARTITION) {
+			printk(" BSD<");
+			bsd_disklabel_partition(hd, MKDEV(hd->major, minor));
+			printk(" >");
+		}
+#endif
+#ifdef CONFIG_SOLARIS_X86_PARTITION
+
+		/* james@bpgc.com: Solaris has a nasty indicator: 0x82
+		 * which also means linux swap.  For that reason, all
+		 * of the prints are done inside the
+		 * solaris_x86_partition routine */
+
+		if(SYS_IND(p) == SOLARIS_X86_PARTITION) {
+			solaris_x86_partition(hd, MKDEV(hd->major, minor),
+					      first_sector+START_SECT(p));
+		}
+#endif
+	}
+	/*
+	 *  Check for old-style Disk Manager partition table
+	 */
+	if (*(unsigned short *) (data+0xfc) == cpu_to_le16(MSDOS_LABEL_MAGIC)) {
+		p = (struct partition *) (0x1be + data);
+		for (i = 4 ; i < 16 ; i++, current_minor++) {
+			p--;
+			if ((current_minor & mask) == 0)
+				break;
+			if (!(START_SECT(p) && NR_SECTS(p)))
+				continue;
+			add_partition(hd, current_minor, START_SECT(p), NR_SECTS(p));
+		}
+	}
+	printk("\n");
+	brelse(bh);
+	MOD_DEC_USE_COUNT;
+	return 1;
+}
+
+static struct partition_parser msdos_partition_parser =
+    { NULL, "msdos", msdos_partition };
+
+#ifndef MODULE
+__initfunc(void msdos_partbl_init( void ))
+{
+	(void)register_partbl( &msdos_partition_parser );
+}
+#else
+int init_module(void)
+{
+	return register_partbl( &msdos_partition_parser );
+}
+
+void cleanup_module(void)
+{
+	(void)unregister_partbl( &msdos_partition_parser );
+}
+#endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/fs/partitions/sun.c m68k/fs/partitions/sun.c
--- jes-2.1.106/fs/partitions/sun.c	Thu Jan  1 01:00:00 1970
+++ m68k/fs/partitions/sun.c	Sun Jun 14 22:23:53 1998
@@ -0,0 +1,113 @@
+/*
+ *  fs/partitions/sun.c -- Sun partition table parser
+ *
+ *  Code extracted from
+ *  linux/drivers/block/genhd.c
+ *
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <linux/module.h>
+
+#include <linux/fs.h>
+#include <linux/kernel.h>
+#include <linux/major.h>
+#include <linux/string.h>
+#include <linux/init.h>
+#include "../partcheck.h"
+
+
+static int sun_partition(struct gendisk *hd, kdev_t dev, unsigned long first_sector, int current_minor)
+{
+	int i, csum;
+	unsigned short *ush;
+	struct buffer_head *bh;
+	struct sun_disklabel {
+		unsigned char info[128];   /* Informative text string */
+		unsigned char spare[292];  /* Boot information etc. */
+		unsigned short rspeed;     /* Disk rotational speed */
+		unsigned short pcylcount;  /* Physical cylinder count */
+		unsigned short sparecyl;   /* extra sects per cylinder */
+		unsigned char spare2[4];   /* More magic... */
+		unsigned short ilfact;     /* Interleave factor */
+		unsigned short ncyl;       /* Data cylinder count */
+		unsigned short nacyl;      /* Alt. cylinder count */
+		unsigned short ntrks;      /* Tracks per cylinder */
+		unsigned short nsect;      /* Sectors per track */
+		unsigned char spare3[4];   /* Even more magic... */
+		struct sun_partition {
+			__u32 start_cylinder;
+			__u32 num_sectors;
+		} partitions[8];
+		unsigned short magic;      /* Magic number */
+		unsigned short csum;       /* Label xor'd checksum */
+	} * label;		
+	struct sun_partition *p;
+	unsigned long spc;
+#define SUN_LABEL_MAGIC          0xDABE
+
+	MOD_INC_USE_COUNT;
+	if(!(bh = bread(dev, 0, get_ptable_blocksize(dev)))) {
+		printk("Dev %s: unable to read partition table\n",
+		       kdevname(dev));
+	    MOD_DEC_USE_COUNT;
+		return -1;
+	}
+	label = (struct sun_disklabel *) bh->b_data;
+	p = label->partitions;
+	if (be16_to_cpu(label->magic) != SUN_LABEL_MAGIC) {
+		printk("Dev %s Sun disklabel: bad magic %04x\n",
+		       kdevname(dev), be16_to_cpu(label->magic));
+		brelse(bh);
+	    MOD_DEC_USE_COUNT;
+		return 0;
+	}
+	/* Look at the checksum */
+	ush = ((unsigned short *) (label+1)) - 1;
+	for(csum = 0; ush >= ((unsigned short *) label);)
+		csum ^= *ush--;
+	if(csum) {
+		printk("Dev %s Sun disklabel: Csum bad, label corrupted\n",
+		       kdevname(dev));
+		brelse(bh);
+	    MOD_DEC_USE_COUNT;
+		return 0;
+	}
+	printk(" UFS");
+	/* All Sun disks have 8 partition entries */
+	spc = be16_to_cpu(label->ntrks) * be16_to_cpu(label->nsect);
+	for(i=0; i < 8; i++, p++) {
+		unsigned long st_sector;
+		int num_sectors;
+
+		st_sector = first_sector + be32_to_cpu(p->start_cylinder) * spc;
+		num_sectors = be32_to_cpu(p->num_sectors);
+		if (num_sectors)
+			add_partition(hd, current_minor, st_sector, num_sectors);
+		current_minor++;
+	}
+	printk("\n");
+	brelse(bh);
+	MOD_DEC_USE_COUNT;
+	return 1;
+}
+
+static struct partition_parser sun_partition_parser =
+    { NULL, "sun", sun_partition };
+
+#ifndef MODULE
+__initfunc(void sun_partbl_init( void ))
+{
+	(void)register_partbl( &sun_partition_parser );
+}
+#else
+int init_module(void)
+{
+	return register_partbl( &sun_partition_parser );
+}
+
+void cleanup_module(void)
+{
+	(void)unregister_partbl( &sun_partition_parser );
+}
+#endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/include/asm-m68k/machdep.h m68k/include/asm-m68k/machdep.h
--- jes-2.1.106/include/asm-m68k/machdep.h	Sun Feb  8 22:29:50 1998
+++ m68k/include/asm-m68k/machdep.h	Sun Jun 14 22:18:24 1998
@@ -13,6 +13,7 @@
 extern int (*mach_keyb_init) (void);
 extern int (*mach_kbdrate) (struct kbd_repeat *);
 extern void (*mach_kbd_leds) (unsigned int);
+extern void (*kbd_reset_setup) (char *, int);
 /* machine dependent irq functions */
 extern void (*mach_init_IRQ) (void);
 extern void (*(*mach_default_handler)[]) (int, void *, struct pt_regs *);
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/include/linux/genhd.h m68k/include/linux/genhd.h
--- jes-2.1.106/include/linux/genhd.h	Sun Feb  8 22:28:08 1998
+++ m68k/include/linux/genhd.h	Sun Jun 14 22:23:53 1998
@@ -48,6 +48,12 @@
 # define HAVE_MAC_PARTITION 0
 #endif
 
+#ifdef CONFIG_ACORN_PARTITION
+# define HAVE_ACORN_PARTITION 1
+#else
+# define HAVE_ACORN_PARTITION 0
+#endif
+
 /* These three have identical behaviour; use the second one if DOS fdisk gets
    confused about extended/logical partitions starting past cylinder 1023. */
 #define DOS_EXTENDED_PARTITION 5
@@ -183,26 +189,5 @@
 #endif	/* CONFIG_BSD_DISKLABEL */
 
 extern struct gendisk *gendisk_head;	/* linked list of disks */
-
-/*
- * disk_name() is used by genhd.c and md.c.
- * It formats the devicename of the indicated disk
- * into the supplied buffer, and returns a pointer
- * to that same buffer (for convenience).
- */
-char *disk_name (struct gendisk *hd, int minor, char *buf);
-void add_partition (struct gendisk *hd, int minor, int start, int size);
-unsigned int get_ptable_blocksize(kdev_t dev);
-extern int current_minor;
-
-struct partition_parser {
-	struct partition_parser *next;
-	char *name;
-	int (*func)(struct gendisk *hd, kdev_t dev,
-		    unsigned long first_sector);
-};
-
-int register_partbl( struct partition_parser *parser );
-int unregister_partbl( struct partition_parser *parser );
 
 #endif
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/include/linux/tty.h m68k/include/linux/tty.h
--- jes-2.1.106/include/linux/tty.h	Tue Mar 24 18:57:24 1998
+++ m68k/include/linux/tty.h	Thu Jun 18 22:15:18 1998
@@ -24,6 +24,7 @@
 #include <linux/serialP.h>
 
 #include <asm/system.h>
+#include <asm/atomic.h>
 
 
 /*
@@ -254,7 +255,7 @@
 	char *read_buf;
 	int read_head;
 	int read_tail;
-	int read_cnt;
+	atomic_t read_cnt;
 	unsigned long read_flags[N_TTY_BUF_SIZE/(8*sizeof(unsigned long))];
 	int canon_data;
 	unsigned long canon_head;
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file jes-2.1.106/include/linux/zorro.h m68k/include/linux/zorro.h
--- jes-2.1.106/include/linux/zorro.h	Thu Jun 18 20:53:07 1998
+++ m68k/include/linux/zorro.h	Thu Jun 18 22:06:25 1998
@@ -411,7 +411,7 @@
 #define ZORRO_MANUF_ARMAX					0x0885
 #define  ZORRO_PROD_ARMAX_OMNIBUS				ZORRO_ID(ARMAX, 0x00, 0)
 
-#define ZORRO_MANUF_ZEUS					0x088d
+#define ZORRO_MANUF_ZEUS					0x088D
 #define  ZORRO_PROD_ZEUS_SPIDER					ZORRO_ID(ZEUS, 0x04, 0)
 
 #define ZORRO_MANUF_NEWTEK					0x088F
Greetings,

						Geert

--
Geert Uytterhoeven                     Geert.Uytterhoeven@cs.kuleuven.ac.be
Wavelets, Linux/{m68k~Amiga,PPC~CHRP}  http://www.cs.kuleuven.ac.be/~geert/
Department of Computer Science -- Katholieke Universiteit Leuven -- Belgium


