From: rnhodek@inf2.informatik.uni-erlangen.de (Roman Hodek)
Date: Fri, 11 Jul 1997 23:03:25 +0200 (CEST)
To: linux-m68k@phil.uni-sb.de
Subject: L68K: msdos_fs patch + misc other things
Sender: owner-linux-m68k@phil.uni-sb.de
Reply-To: linux-m68k@phil.uni-sb.de


The patch for today: I've now implemented that the GEMDOS variation of
the MS-DOS fs is a mount option instead of being compiled in, as Jes
(and Linus) asked for. The mount option's name is "atari" and can be
set to values "yes" or "no". Default is yes on Atari machines, no
otherwise. The differences between PC and Atari variant are basically
still the same, with the two little exceptions listed below.

Other changes:

 - Remove some warnings in acsi.c and acsi_slm.c (*_release now
   returns int, some unused functions, wrong arg type to free_pages()).

 - In my /dev/nvram patch, I forgot to add CONFIG_NVRAM to the big #if
   in mem.c whether to call misc_init().

 - drivers/char/nvram.c: Print also Falcon-specific infos in NVRAM.

 - include/linux/msdos_fs.h, fs/fat/*.c: replace EOF_FAT12 and
   EOF_FAT16 macros by EOF_FAT, which hides different values for
   Atari/PC and 12/16 bit FAT. But keep old macros in header, some
   application programs may use them (e.g. dosfsck!)

 - fs/fat/inode.c: a missing '=' after mount option "dotsOK" caused
   a NULL pointer access

 - fs/fat/inode.c: In Atari mode, if the device to be mounted is a
   ramdisk or loopback device, and the fs size is 360k, 720k, or
   1.44M, also assume 12bit FAT. (Specially for Michael :-)

 - fs/msdos/namei.c: Though someone already worked on it, filenames
   starting with a '.' still weren't working on GEMDOS filesystems.
   msdos_format_name() returned EINVAL too early. Now it works both
   with dotsOK=yes and dotsOK=no. In the former case, you use one dot
   for hidden files, and two dots for files that should really start
   with a dot (and then are hidden, too). I think this mode is not
   very useful on Atari...

Roman

------------------------------------------------------------------------------
diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.42-orig/drivers/block/acsi.c linux-2.1.42/drivers/block/acsi.c
--- linux-2.1.42-orig/drivers/block/acsi.c	Fri Feb 28 15:34:07 1997
+++ linux-2.1.42/drivers/block/acsi.c	Fri Jul 11 20:13:07 1997
@@ -370,7 +370,7 @@
 static int acsi_ioctl( struct inode *inode, struct file *file, unsigned int
                        cmd, unsigned long arg );
 static int acsi_open( struct inode * inode, struct file * filp );
-static void acsi_release( struct inode * inode, struct file * file );
+static int acsi_release( struct inode * inode, struct file * file );
 static void acsi_prevent_removal( int target, int flag );
 static int acsi_change_blk_size( int target, int lun);
 static int acsi_mode_sense( int target, int lun, SENSE_DATA *sd );
@@ -1200,7 +1200,7 @@
  * be forgotten about...
  */
 
-static void acsi_release( struct inode * inode, struct file * file )
+static int acsi_release( struct inode * inode, struct file * file )
 {
 	int device;
 
@@ -1210,6 +1210,7 @@
 	if (--access_count[device] == 0 && acsi_info[device].removable)
 		acsi_prevent_removal(device, 0);
 	MOD_DEC_USE_COUNT;
+	return( 0 );
 }
 
 /*
@@ -1821,7 +1822,7 @@
 {
 	del_timer( &acsi_timer );
 	blk_dev[MAJOR_NR].request_fn = 0;
-	free_pages( acsi_buffer, ACSI_BUFFER_ORDER );
+	free_pages( (unsigned long)acsi_buffer, ACSI_BUFFER_ORDER );
 
 	if (unregister_blkdev( MAJOR_NR, "ad" ) != 0)
 		printk( KERN_ERR "acsi: cleanup_module failed\n");
diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.42-orig/drivers/block/acsi_slm.c linux-2.1.42/drivers/block/acsi_slm.c
--- linux-2.1.42-orig/drivers/block/acsi_slm.c	Mon Feb 10 13:28:31 1997
+++ linux-2.1.42/drivers/block/acsi_slm.c	Fri Jul 11 20:27:06 1997
@@ -117,7 +117,9 @@
 static char slmprint_cmd[6]    = { 0x0a, 0, 0, 0, 0, 0 };
 static char slminquiry_cmd[6]  = { 0x12, 0, 0, 0, 0, 0x80 };
 static char slmmsense_cmd[6]   = { 0x1a, 0, 0, 0, 255, 0 };
+#if 0
 static char slmmselect_cmd[6]  = { 0x15, 0, 0, 0, 0, 0 };
+#endif
 
 
 #define	MAX_SLM		2
@@ -262,11 +264,13 @@
 static int slm_ioctl( struct inode *inode, struct file *file, unsigned int
                       cmd, unsigned long arg );
 static int slm_open( struct inode *inode, struct file *file );
-static void slm_release( struct inode *inode, struct file *file );
+static int slm_release( struct inode *inode, struct file *file );
 static int slm_req_sense( int device );
 static int slm_mode_sense( int device, char *buffer, int abs_flag );
+#if 0
 static int slm_mode_select( int device, char *buffer, int len, int
                             default_flag );
+#endif
 static int slm_get_pagesize( int device, int *w, int *h );
 
 /************************* End of Prototypes **************************/
@@ -794,7 +798,7 @@
 }
 
 
-static void slm_release( struct inode *inode, struct file *file )
+static int slm_release( struct inode *inode, struct file *file )
 
 {	int device;
 	struct slm *sip;
@@ -806,6 +810,8 @@
 		sip->wbusy = 0;
 	if (file->f_mode & 1)
 		sip->rbusy = 0;
+	
+	return( 0 );
 }
 
 
@@ -876,6 +882,8 @@
 }
 
 
+#if 0
+/* currently unused */
 static int slm_mode_select( int device, char *buffer, int len,
 							int default_flag )
 
@@ -911,6 +919,7 @@
 	stdma_release();
 	return( rv );
 }
+#endif
 
 
 static int slm_get_pagesize( int device, int *w, int *h )
diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.42-orig/drivers/char/mem.c linux-2.1.42/drivers/char/mem.c
--- linux-2.1.42-orig/drivers/char/mem.c	Fri May 16 16:56:51 1997
+++ linux-2.1.42/drivers/char/mem.c	Fri Jul 11 20:39:09 1997
@@ -538,7 +538,9 @@
     defined (CONFIG_ATIXL_BUSMOUSE) || defined(CONFIG_SOFT_WATCHDOG) || \
     defined (CONFIG_AMIGAMOUSE) || defined (CONFIG_ATARIMOUSE) || \
     defined (CONFIG_PCWATCHDOG) || \
-    defined (CONFIG_APM) || defined (CONFIG_RTC) || defined (CONFIG_SUN_MOUSE)
+    defined (CONFIG_APM) || defined (CONFIG_RTC) || \
+	defined (CONFIG_SUN_MOUSE) || defined (CONFIG_NVRAM) || \
+	defined (CONFIG_ATARI)
 	misc_init();
 #endif
 #ifdef CONFIG_SOUND
diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.42-orig/drivers/char/nvram.c linux-2.1.42/drivers/char/nvram.c
--- linux-2.1.42-orig/drivers/char/nvram.c	Fri Jun 20 23:19:36 1997
+++ linux-2.1.42/drivers/char/nvram.c	Fri Jul 11 22:22:12 1997
@@ -590,16 +590,46 @@
 	{ 0x00, "unspecified" }
 };
 
+static char *languages[] = {
+	"English (US)",
+	"German",
+	"French",
+	"English (UK)",
+	"Spanish",
+	"Italian",
+	"6 (undefined)",
+	"Swiss (French)",
+	"Swiss (German)"
+};
+
+static char *dateformat[] = {
+	"MM%cDD%cYY",
+	"DD%cMM%cYY",
+	"YY%cMM%cDD",
+	"YY%cDD%cMM",
+	"4 (undefined)",
+	"5 (undefined)",
+	"6 (undefined)",
+	"7 (undefined)"
+};
+
+static char *colors[] = {
+	"2", "4", "16", "256", "65536", "??", "??", "??"
+};
+
+#define fieldsize(a)	(sizeof(a)/sizeof(*a))
+
 static int atari_proc_infos( unsigned char *nvram, char *buffer, int *len,
 							 off_t *begin, off_t offset, int size )
 {
 	int checksum = nvram_check_checksum();
 	int i;
+	unsigned vmode;
 	
-	PRINT_PROC( "Checksum status : %svalid\n", checksum ? "" : "not " );
+	PRINT_PROC( "Checksum status  : %svalid\n", checksum ? "" : "not " );
 
-	PRINT_PROC( "Boot preference : " );
-	for( i = sizeof(boot_prefs)/sizeof(*boot_prefs)-1; i >= 0; --i ) {
+	PRINT_PROC( "Boot preference  : " );
+	for( i = fieldsize(boot_prefs)-1; i >= 0; --i ) {
 		if (nvram[1] == boot_prefs[i].val) {
 			PRINT_PROC( "%s\n", boot_prefs[i].name );
 			break;
@@ -608,13 +638,50 @@
 	if (i < 0)
 		PRINT_PROC( "0x%02x (undefined)\n", nvram[1] );
 
-	PRINT_PROC( "SCSI arbitration: %s\n", (nvram[16] & 0x80) ? "on" : "off" );
-	PRINT_PROC( "SCSI host ID    : " );
+	PRINT_PROC( "SCSI arbitration : %s\n", (nvram[16] & 0x80) ? "on" : "off" );
+	PRINT_PROC( "SCSI host ID     : " );
 	if (nvram[16] & 0x80)
 		PRINT_PROC( "%d\n", nvram[16] & 7 );
 	else
 		PRINT_PROC( "n/a\n" );
 
+	/* the following entries are defined only for the Falcon */
+	if ((atari_mch_cookie >> 16) != ATARI_MCH_FALCON)
+		return;
+
+	PRINT_PROC( "OS language      : " );
+	if (nvram[6] < fieldsize(languages))
+		PRINT_PROC( "%s\n", languages[nvram[6]] );
+	else
+		PRINT_PROC( "%u (undefined)\n", nvram[6] );
+	PRINT_PROC( "Keyboard language: " );
+	if (nvram[7] < fieldsize(languages))
+		PRINT_PROC( "%s\n", languages[nvram[7]] );
+	else
+		PRINT_PROC( "%u (undefined)\n", nvram[7] );
+	PRINT_PROC( "Date format      : " );
+	PRINT_PROC( dateformat[nvram[8]&7],
+				nvram[9] ? nvram[9] : '/', nvram[9] ? nvram[9] : '/' );
+	PRINT_PROC( ", %dh clock\n", nvram[8] & 16 ? 24 : 12 );
+	PRINT_PROC( "Boot delay       : " );
+	if (nvram[10] == 0)
+		PRINT_PROC( "default" );
+	else
+		PRINT_PROC( "%ds%s\n", nvram[10],
+					nvram[10] < 8 ? ", no memory test" : "" );
+
+	vmode = (nvram[14] << 8) || nvram[15];
+	PRINT_PROC( "Video mode       : %s colors, %d columns, %s %s monitor\n",
+				colors[vmode & 7],
+				vmode & 8 ? 80 : 40,
+				vmode & 16 ? "VGA" : "TV",
+				vmode & 32 ? "PAL" : "NTSC" );
+	PRINT_PROC( "                   %soverscan, compat. mode %s%s\n",
+				vmode & 64 ? "" : "no ",
+				vmode & 128 ? "on" : "off",
+				vmode & 256 ?
+				  (vmode & 16 ? ", line doubling" : ", half screen") : "" );
+		
 	return( 1 );
 }
 #endif
diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.42-orig/fs/fat/cache.c linux-2.1.42/fs/fat/cache.c
--- linux-2.1.42-orig/fs/fat/cache.c	Sun Dec 29 19:51:29 1996
+++ linux-2.1.42/fs/fat/cache.c	Fri Jul 11 19:34:56 1997
@@ -276,8 +276,7 @@
 		}
 	}
 	if (last)
-		fat_access(inode->i_sb,last,MSDOS_SB(inode->i_sb)->fat_bits ==
-		    12 ? EOF_FAT12 : EOF_FAT16);
+		fat_access(inode->i_sb,last,EOF_FAT(inode->i_sb));
 	else {
 		MSDOS_I(inode)->i_start = 0;
 		inode->i_dirt = 1;
diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.42-orig/fs/fat/inode.c linux-2.1.42/fs/fat/inode.c
--- linux-2.1.42-orig/fs/fat/inode.c	Mon Apr  7 12:49:23 1997
+++ linux-2.1.42/fs/fat/inode.c	Fri Jul 11 22:11:13 1997
@@ -25,6 +25,7 @@
 
 #include <asm/uaccess.h>
 #include <asm/unaligned.h>
+#include <asm/setup.h>
 
 
 
@@ -97,6 +98,12 @@
 	opts->fs_gid = current->gid;
 	opts->fs_umask = current->fs->umask;
 	opts->quiet = opts->sys_immutable = opts->dotsOK = opts->showexec = opts->isvfat = 0;
+#ifdef MACH_IS_ATARI
+	/* make Atari GEMDOS format the default if machine is an Atari */
+	opts->atari = MACH_IS_ATARI;
+#else
+	opts->atari = 0;
+#endif
 	*debug = *fat = 0;
 
 	if (!options) return 1;
@@ -129,7 +136,7 @@
 			opts->showexec = 1;
 		}
 		else if (!strcmp(this_char,"dotsOK") && value) {
-			if (!strcmp(value,"yes")) opts->dotsOK = 1;
+			if (!value || !strcmp(value,"yes")) opts->dotsOK = 1;
 			else if (!strcmp(value,"no")) opts->dotsOK = 0;
 			else return 0;
 		}
@@ -182,6 +189,11 @@
 				return 0;
 			opts->sys_immutable = 1;
 		}
+		else if (!strcmp(this_char,"atari")) {
+			if (!value || !strcmp(value,"yes")) opts->atari = 1;
+			else if (!strcmp(value,"no")) opts->atari = 0;
+			else return 0;
+		}
 	}
 	return 1;
 }
@@ -278,35 +290,39 @@
 	if (!error) {
 		MSDOS_SB(sb)->clusters = b->cluster_size ? data_sectors/
 		    b->cluster_size/sector_mult : 0;
-#ifndef CONFIG_ATARI
-		MSDOS_SB(sb)->fat_bits = fat ? fat : MSDOS_SB(sb)->clusters >
-		    MSDOS_FAT12 ? 16 : 12;
-#else
-		/* Atari GEMDOS partitions always have 16-bit fat */
-		MSDOS_SB(sb)->fat_bits = fat ? fat : 16;
-		/* If more clusters than fat entries in 16-bit fat, we assume
-		 * it's a real MSDOS partition with 12-bit fat.
-		 */
-		if (MSDOS_SB(sb)->clusters+2 > MSDOS_SB(sb)->
-		    fat_length*SECTOR_SIZE*8/MSDOS_SB(sb)->fat_bits)
-			MSDOS_SB(sb)->fat_bits = 12;
-		/* if its a floppy disk --> 12bit fat */
-		if (MAJOR(sb->s_dev) == FLOPPY_MAJOR)
-			MSDOS_SB(sb)->fat_bits = 12;
-#endif
+		if (!opts.atari)
+			MSDOS_SB(sb)->fat_bits = fat ? fat : MSDOS_SB(sb)->clusters >
+									 MSDOS_FAT12 ? 16 : 12;
+		else {
+			int sectors;
+			/* Atari GEMDOS partitions always have 16-bit fat */
+			MSDOS_SB(sb)->fat_bits = fat ? fat : 16;
+			/* If more clusters than fat entries in 16-bit fat, we assume
+			 * it's a real MSDOS partition with 12-bit fat.
+			 */
+			if (MSDOS_SB(sb)->clusters+2 > MSDOS_SB(sb)->
+				fat_length*SECTOR_SIZE*8/MSDOS_SB(sb)->fat_bits)
+				MSDOS_SB(sb)->fat_bits = 12;
+			/* if it's a floppy disk --> 12bit fat */
+			if (MAJOR(sb->s_dev) == FLOPPY_MAJOR)
+				MSDOS_SB(sb)->fat_bits = 12;
+			/* if it's a ramdisk or loopback device and has one of the usual
+			 * floppy sizes -> 12bit FAT  */
+			sectors = data_sectors + MSDOS_SB(sb)->data_start;
+			if ((MAJOR(sb->s_dev) == RAMDISK_MAJOR ||
+				 MAJOR(sb->s_dev) == LOOP_MAJOR) &&
+				(sectors == 720 || sectors == 1440 || sectors == 2880))
+				MSDOS_SB(sb)->fat_bits = 12;
+		}
 		fat_clusters = MSDOS_SB(sb)->fat_length*SECTOR_SIZE*8/
 		    MSDOS_SB(sb)->fat_bits;
 		error = !MSDOS_SB(sb)->fats || (MSDOS_SB(sb)->dir_entries &
 		    (MSDOS_DPS-1)) || MSDOS_SB(sb)->clusters+2 > fat_clusters+
 		    MSDOS_MAX_EXTRA || (logical_sector_size & (SECTOR_SIZE-1))
-#ifndef CONFIG_ATARI
-		    || !b->secs_track || !b->heads;
-#else
 		    /* secs_track and heads may be arbitrary on GEMDOS
 		       partitions, it depends on partitioning software
 		       used.  */
-		    /*|| !b->secs_track || !b->heads */;
-#endif
+		    || (!opts.atari && (!b->secs_track || !b->heads));
 	}
 	fat_brelse(sb, bh);
 	/*
@@ -320,10 +336,10 @@
 	sb->s_blocksize_bits = blksize == 512 ? 9 : (blksize == 1024 ? 10 : 11);
 	if (error || debug) {
 		/* The MSDOS_CAN_BMAP is obsolete, but left just to remember */
-		printk("[MS-DOS FS Rel. 12,FAT %d,check=%c,conv=%c,"
+		printk("[MS-DOS FS Rel. 12,FAT %d,check=%c,conv=%c,atari=%c,"
 		       "uid=%d,gid=%d,umask=%03o%s]\n",
-		       MSDOS_SB(sb)->fat_bits,opts.name_check,
-		       opts.conversion,opts.fs_uid,opts.fs_gid,opts.fs_umask,
+		       MSDOS_SB(sb)->fat_bits,opts.name_check,opts.conversion,
+		       opts.atari?'y':'n',opts.fs_uid,opts.fs_gid,opts.fs_umask,
 		       MSDOS_CAN_BMAP(MSDOS_SB(sb)) ? ",bmap" : "");
 		printk("[me=0x%x,cs=%d,#f=%d,fs=%d,fl=%d,ds=%d,de=%d,data=%d,"
 		       "se=%d,ts=%d,ls=%d]\n",b->media,MSDOS_SB(sb)->cluster_size,
diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.42-orig/fs/fat/misc.c linux-2.1.42/fs/fat/misc.c
--- linux-2.1.42-orig/fs/fat/misc.c	Wed Apr 16 16:58:53 1997
+++ linux-2.1.42/fs/fat/misc.c	Fri Jul 11 19:34:56 1997
@@ -139,8 +139,7 @@
 		unlock_fat(sb);
 		return -ENOSPC;
 	}
-	fat_access(sb,nr,MSDOS_SB(sb)->fat_bits == 12 ?
-	    EOF_FAT12 : EOF_FAT16);
+	fat_access(sb,nr,EOF_FAT(sb));
 	if (MSDOS_SB(sb)->free_clusters != -1)
 		MSDOS_SB(sb)->free_clusters--;
 	unlock_fat(sb);
diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.42-orig/fs/msdos/namei.c linux-2.1.42/fs/msdos/namei.c
--- linux-2.1.42-orig/fs/msdos/namei.c	Wed Nov  6 23:26:56 1996
+++ linux-2.1.42/fs/msdos/namei.c	Fri Jul 11 22:12:21 1997
@@ -27,23 +27,18 @@
 /* MS-DOS "device special files" */
 
 static const char *reserved_names[] = {
-#ifndef CONFIG_ATARI /* GEMDOS is less stupid */
     "CON     ","PRN     ","NUL     ","AUX     ",
     "LPT1    ","LPT2    ","LPT3    ","LPT4    ",
     "COM1    ","COM2    ","COM3    ","COM4    ",
-#endif
     NULL };
 
 
 /* Characters that are undesirable in an MS-DOS file name */
   
 static char bad_chars[] = "*?<>|\"";
-#ifdef CONFIG_ATARI
-/* GEMDOS is less restrictive */
-static char bad_if_strict[] = " ";
-#else
-static char bad_if_strict[] = "+=,; ";
-#endif
+static char bad_if_strict_pc[] = "+=,; ";
+static char bad_if_strict_atari[] = " "; /* GEMDOS is less restrictive */
+#define	bad_if_strict (atari ? bad_if_strict_atari : bad_if_strict_pc)
 
 void msdos_put_super(struct super_block *sb)
 {
@@ -81,7 +76,7 @@
 
 
 /***** Formats an MS-DOS file name. Rejects invalid names. */
-static int msdos_format_name(char conv,const char *name,int len,
+static int msdos_format_name(int atari,char conv,const char *name,int len,
 	char *res,int dot_dirs,char dotsOK)
 	/* conv is relaxed/normal/strict, name is proposed name,
 	 * len is the length of the proposed name, res is the result name,
@@ -100,15 +95,15 @@
 		return 0;
 	}
 	if (name[0] == '.') {  /* dotfile because . and .. already done */
-		if (!dotsOK) return -EINVAL;
+		if (dotsOK) {
+			name++; len--;
+		}
+		else if (!atari) return -EINVAL;
 		/* Get rid of dot - test for it elsewhere */
-		name++; len--;
 	}
-#ifndef CONFIG_ATARI
-	space = 1; /* disallow names that _really_ start with a dot */
-#else
-	space = 0; /* GEMDOS does not care */
-#endif
+	/* disallow names that _really_ start with a dot for MS-DOS, GEMDOS does
+	 * not care */
+	space = !atari;
 	c = 0;
 	for (walk = res; len && walk-res < 8; walk++) {
 	    	c = *name++;
@@ -156,8 +151,10 @@
 		if (conv == 's' && len) return -EINVAL;
 	}
 	while (walk-res < MSDOS_NAME) *walk++ = ' ';
-	for (reserved = reserved_names; *reserved; reserved++)
-		if (!strncmp(res,*reserved,8)) return -EINVAL;
+	if (!atari)
+		/* GEMDOS is less stupid and has no reserved names */
+		for (reserved = reserved_names; *reserved; reserved++)
+			if (!strncmp(res,*reserved,8)) return -EINVAL;
 	return 0;
 }
 
@@ -172,7 +169,8 @@
 	char scantype;
 
 	dotsOK = MSDOS_SB(dir->i_sb)->options.dotsOK;
-	res = msdos_format_name(MSDOS_SB(dir->i_sb)->options.name_check,
+	res = msdos_format_name(MSDOS_SB(dir->i_sb)->options.atari,
+				MSDOS_SB(dir->i_sb)->options.name_check,
 				name,len, msdos_name,1,dotsOK);
 	if (res < 0)
 		return -ENOENT;
@@ -319,7 +317,8 @@
 	int ino,res,is_hid;
 
 	if (!dir) return -ENOENT;
-	if ((res = msdos_format_name(MSDOS_SB(dir->i_sb)->options.name_check,
+	if ((res = msdos_format_name(MSDOS_SB(dir->i_sb)->options.atari,
+				     MSDOS_SB(dir->i_sb)->options.name_check,
 				     name,len,msdos_name,0,
 				     MSDOS_SB(dir->i_sb)->options.dotsOK)) < 0) {
 		iput(dir);
@@ -445,7 +444,8 @@
 	char msdos_name[MSDOS_NAME];
 	int ino,res,is_hid;
 
-	if ((res = msdos_format_name(MSDOS_SB(dir->i_sb)->options.name_check,
+	if ((res = msdos_format_name(MSDOS_SB(dir->i_sb)->options.atari,
+				     MSDOS_SB(dir->i_sb)->options.name_check,
 				     name,len,msdos_name,0,
 				     MSDOS_SB(dir->i_sb)->options.dotsOK)) < 0) {
 		iput(dir);
@@ -765,11 +765,13 @@
 	int old_ino,error;
 	int is_hid,old_hid; /* if new file and old file are hidden */
 
-	if ((error = msdos_format_name(MSDOS_SB(old_dir->i_sb)->options.name_check,
+	if ((error = msdos_format_name(MSDOS_SB(old_dir->i_sb)->options.atari,
+				       MSDOS_SB(old_dir->i_sb)->options.name_check,
 				       old_name,old_len,old_msdos_name,1,
 				       MSDOS_SB(old_dir->i_sb)->options.dotsOK))
 	    < 0) goto rename_done;
-	if ((error = msdos_format_name(MSDOS_SB(new_dir->i_sb)->options.name_check,
+	if ((error = msdos_format_name(MSDOS_SB(new_dir->i_sb)->options.atari,
+				       MSDOS_SB(new_dir->i_sb)->options.name_check,
 				       new_name,new_len,new_msdos_name,0,
 				       MSDOS_SB(new_dir->i_sb)->options.dotsOK))
 	    < 0) goto rename_done;
diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.42-orig/include/linux/msdos_fs.h linux-2.1.42/include/linux/msdos_fs.h
--- linux-2.1.42-orig/include/linux/msdos_fs.h	Fri Jun 20 16:39:46 1997
+++ linux-2.1.42/include/linux/msdos_fs.h	Fri Jul 11 22:23:56 1997
@@ -72,13 +72,10 @@
 
 #define MSDOS_FAT12 4078 /* maximum number of clusters in a 12 bit FAT */
 
-#ifdef CONFIG_ATARI
-#define EOF_FAT12 0xFFF		/* Atari GEMDOS fs uses a different EOF */
-#define EOF_FAT16 0xFFFF
-#else
 #define EOF_FAT12 0xFF8		/* standard EOF */
 #define EOF_FAT16 0xFFF8
-#endif
+#define EOF_FAT(s) ((MSDOS_SB(s)->options.atari ? 0xFFF : 0xFF8) | \
+				    (MSDOS_SB(s)->fat_bits == 16 ? 0xF000 : 0))
 
 /*
  * Inode flags
diff -u --recursive --exclude-from=diff-excludes --new-file linux-2.1.42-orig/include/linux/msdos_fs_sb.h linux-2.1.42/include/linux/msdos_fs_sb.h
--- linux-2.1.42-orig/include/linux/msdos_fs_sb.h	Sat Aug 24 14:48:28 1996
+++ linux-2.1.42/include/linux/msdos_fs_sb.h	Fri Jul 11 19:34:56 1997
@@ -18,7 +18,8 @@
 		 isvfat:1,        /* 0=no vfat long filename support, 1=vfat support */
 		 unicode_xlate:1, /* create escape sequences for unhandled Unicode */
 		 posixfs:1,       /* Allow names like makefile and Makefile to coexist */
-		 numtail:1;       /* Does first alias have a numeric '~1' type tail? */
+		 numtail:1,       /* Does first alias have a numeric '~1' type tail? */
+		 atari:1;         /* Use Atari GEMDOS variation of MS-DOS fs */
 };
 
 
