From: Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
Date: Fri, 19 Sep 97 10:45:05 +0200
To: linux-m68k@phil.uni-sb.de
Subject: L68K: No megapatch for 2.1.55
X-Yow: I feel like a wet parking meter on Darvon!
Sender: owner-linux-m68k@phil.uni-sb.de
Reply-To: linux-m68k@phil.uni-sb.de

Hi!

Sorry, i have no megapatch for 2.1.55, there were only few things to
change. <g>

- arch/m68k/kernel/entry.S, arch/m68k/kernel/sys_m68k.c: kill sys_uname
  and sys_olduname, they were never used by any libc version on the m68k.
- arch/m68k/kernel/process.c: don't sleep when reschedule is needed.
- drivers/video/atafb.c: replace cast by correct expression.
- fs/msdos/namei.c: cleanup, instead of passing each option separately to
  msdos_format_name just pass a pointer to the whole structure.
- include/asm-m68k/elf.h: fix ELF_ET_DYN_BASE, the default isn't even page
  aligned.
- kernel/module.c: don't include <asm/pgtable.h> twice.
- net/core/dev.c: fix dev_ifname (already sent to maintainer).

Andreas.

----------------------------------------------------------------------
--- linux-2.1.55/arch/m68k/kernel/entry.S.~1~	Thu Sep 18 17:44:20 1997
+++ linux-2.1.55/arch/m68k/kernel/entry.S	Thu Sep 18 19:09:54 1997
@@ -457,7 +457,7 @@
 	.long SYMBOL_NAME(sys_ni_syscall)				/* old mpx syscall holder */
 	.long SYMBOL_NAME(sys_setpgid)
 	.long SYMBOL_NAME(sys_ni_syscall)				/* old ulimit syscall holder */
-	.long SYMBOL_NAME(sys_olduname)
+	.long SYMBOL_NAME(sys_ni_syscall)
 	.long SYMBOL_NAME(sys_umask)		/* 60 */
 	.long SYMBOL_NAME(sys_chroot)
 	.long SYMBOL_NAME(sys_ustat)
@@ -507,7 +507,7 @@
 	.long SYMBOL_NAME(sys_newstat)
 	.long SYMBOL_NAME(sys_newlstat)
 	.long SYMBOL_NAME(sys_newfstat)
-	.long SYMBOL_NAME(sys_uname)
+	.long SYMBOL_NAME(sys_ni_syscall)
 	.long SYMBOL_NAME(sys_ni_syscall)	/* iopl for i386 */ /* 110 */
 	.long SYMBOL_NAME(sys_vhangup)
 	.long SYMBOL_NAME(sys_idle)
--- linux-2.1.55/arch/m68k/kernel/process.c.~1~	Thu Sep 18 17:44:20 1997
+++ linux-2.1.55/arch/m68k/kernel/process.c	Thu Aug 21 23:17:08 1997
@@ -65,7 +65,7 @@
 	current->priority = -100;
 	current->counter = -100;
 	for (;;){
-		if (need_resched)
+		if (!need_resched)
 #if defined(CONFIG_ATARI) && !defined(CONFIG_AMIGA) && !defined(CONFIG_MAC)
 			/* block out HSYNC on the atari (falcon) */
 			__asm__("stop #0x2200" : : : "cc");
--- linux-2.1.55/arch/m68k/kernel/sys_m68k.c.~1~	Thu Sep 18 17:44:22 1997
+++ linux-2.1.55/arch/m68k/kernel/sys_m68k.c	Thu Sep 18 19:11:48 1997
@@ -604,37 +604,6 @@
 /*
  * Old cruft
  */
-asmlinkage int sys_uname(struct old_utsname * name)
-{
-	if (name && !copy_to_user(name, &system_utsname, sizeof (*name)))
-		return 0;
-	return -EFAULT;
-}
-
-asmlinkage int sys_olduname(struct oldold_utsname * name)
-{
-	int error;
-
-	if (!name)
-		return -EFAULT;
-	if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname)))
-		return -EFAULT;
-  
-	error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN);
-	error -= __put_user(0,name->sysname+__OLD_UTS_LEN);
-	error -= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN);
-	error -= __put_user(0,name->nodename+__OLD_UTS_LEN);
-	error -= __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN);
-	error -= __put_user(0,name->release+__OLD_UTS_LEN);
-	error -= __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN);
-	error -= __put_user(0,name->version+__OLD_UTS_LEN);
-	error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN);
-	error = __put_user(0,name->machine+__OLD_UTS_LEN);
-	error = error ? -EFAULT : 0;
-
-	return error;
-}
-
 asmlinkage int sys_pause(void)
 {
 	current->state = TASK_INTERRUPTIBLE;
--- linux-2.1.55/drivers/video/atafb.c.~1~	Thu Sep 18 17:50:48 1997
+++ linux-2.1.55/drivers/video/atafb.c	Thu Sep 18 19:33:36 1997
@@ -2788,7 +2788,7 @@
 		mem_req = default_mem_req + ovsc_offset +
 			ovsc_addlen;
 		mem_req = ((mem_req + PAGE_SIZE - 1) & PAGE_MASK) + PAGE_SIZE;
-		screen_base = (unsigned long) atari_stram_alloc(mem_req, (unsigned long *)mem_start);
+		screen_base = (unsigned long) atari_stram_alloc(mem_req, &mem_start);
 		memset((char *) screen_base, 0, mem_req);
 		pad = ((screen_base + PAGE_SIZE-1) & PAGE_MASK) - screen_base;
 		screen_base+=pad;
--- linux-2.1.55/fs/msdos/namei.c.~1~	Thu Sep 18 17:51:27 1997
+++ linux-2.1.55/fs/msdos/namei.c	Thu Aug 21 19:31:57 1997
@@ -38,7 +38,7 @@
 static char bad_chars[] = "*?<>|\"";
 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)
+#define	bad_if_strict(opts) ((opts)->atari ? bad_if_strict_atari : bad_if_strict_pc)
 
 void msdos_put_super(struct super_block *sb)
 {
@@ -59,8 +59,8 @@
 };
 
 /***** Formats an MS-DOS file name. Rejects invalid names. */
-static int msdos_format_name(int atari,char conv,const char *name,int len,
-	char *res,int dot_dirs,char dotsOK)
+static int msdos_format_name(const char *name,int len,
+	char *res,int dot_dirs,struct fat_mount_options *opts)
 	/* conv is relaxed/normal/strict, name is proposed name,
 	 * len is the length of the proposed name, res is the result name,
 	 * dot_dirs is . and .. are OK, dotsOK is if hidden files get dots.
@@ -78,22 +78,25 @@
 		return 0;
 	}
 	if (name[0] == '.') {  /* dotfile because . and .. already done */
-		if (dotsOK) {
+		if (opts->dotsOK) {
+			/* Get rid of dot - test for it elsewhere */
 			name++; len--;
 		}
-		else if (!atari) return -EINVAL;
-		/* Get rid of dot - test for it elsewhere */
+		else if (!opts->atari) return -EINVAL;
 	}
 	/* disallow names that _really_ start with a dot for MS-DOS, GEMDOS does
 	 * not care */
-	space = !atari;
+	space = !opts->atari;
 	c = 0;
 	for (walk = res; len && walk-res < 8; walk++) {
 	    	c = *name++;
 		len--;
-		if (conv != 'r' && strchr(bad_chars,c)) return -EINVAL;
-		if (conv == 's' && strchr(bad_if_strict,c)) return -EINVAL;
-  		if (c >= 'A' && c <= 'Z' && conv == 's') return -EINVAL;
+		if (opts->conversion != 'r' && strchr(bad_chars,c))
+			return -EINVAL;
+		if (opts->conversion == 's' && strchr(bad_if_strict(opts),c))
+			return -EINVAL;
+  		if (c >= 'A' && c <= 'Z' && opts->conversion == 's')
+			return -EINVAL;
 		if (c < ' ' || c == ':' || c == '\\') return -EINVAL;
 /*  0xE5 is legal as a first character, but we must substitute 0x05     */
 /*  because 0xE5 marks deleted files.  Yes, DOS really does this.       */
@@ -105,7 +108,7 @@
 		*walk = (c >= 'a' && c <= 'z') ? c-32 : c;
 	}
 	if (space) return -EINVAL;
-	if (conv == 's' && len && c != '.') {
+	if (opts->conversion == 's' && len && c != '.') {
 		c = *name++;
 		len--;
 		if (c != '.') return -EINVAL;
@@ -116,25 +119,28 @@
 		while (len > 0 && walk-res < MSDOS_NAME) {
 			c = *name++;
 			len--;
-			if (conv != 'r' && strchr(bad_chars,c)) return -EINVAL;
-			if (conv == 's' && strchr(bad_if_strict,c))
+			if (opts->conversion != 'r' && strchr(bad_chars,c))
+				return -EINVAL;
+			if (opts->conversion == 's' &&
+			    strchr(bad_if_strict(opts),c))
 				return -EINVAL;
 			if (c < ' ' || c == ':' || c == '\\')
 				return -EINVAL;
 			if (c == '.') {
-				if (conv == 's')
+				if (opts->conversion == 's')
 					return -EINVAL;
 				break;
 			}
-			if (c >= 'A' && c <= 'Z' && conv == 's') return -EINVAL;
+			if (c >= 'A' && c <= 'Z' && opts->conversion == 's')
+				return -EINVAL;
 			space = c == ' ';
 			*walk++ = c >= 'a' && c <= 'z' ? c-32 : c;
 		}
 		if (space) return -EINVAL;
-		if (conv == 's' && len) return -EINVAL;
+		if (opts->conversion == 's' && len) return -EINVAL;
 	}
 	while (walk-res < MSDOS_NAME) *walk++ = ' ';
-	if (!atari)
+	if (!opts->atari)
 		/* GEMDOS is less stupid and has no reserved names */
 		for (reserved = reserved_names; *reserved; reserved++)
 			if (!strncmp(res,*reserved,8)) return -EINVAL;
@@ -152,9 +158,7 @@
 	char scantype;
 
 	dotsOK = MSDOS_SB(dir->i_sb)->options.dotsOK;
-	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);
+	res = msdos_format_name(name,len, msdos_name,1,&MSDOS_SB(dir->i_sb)->options);
 	if (res < 0)
 		return -ENOENT;
 	if((name[0]=='.') && dotsOK){
@@ -180,9 +184,8 @@
 	struct fat_mount_options *options = 
 		& (MSDOS_SB(dentry->d_inode->i_sb)->options);
 	
-	error = msdos_format_name(options->atari, options->name_check,
-				  qstr->name, qstr->len, msdos_name,1,
-				  options->dotsOK);
+	error = msdos_format_name(qstr->name, qstr->len, msdos_name,1,
+				  options);
 	if(error)
 		return error;
 	hash = init_name_hash();
@@ -201,14 +204,10 @@
 	struct fat_mount_options *options = 
 		& (MSDOS_SB(dentry->d_inode->i_sb)->options);
 
-	error = msdos_format_name(options->atari, options->name_check,
-				  a->name, a->len, a_msdos_name,1,
-				  options->dotsOK);
+	error = msdos_format_name(a->name, a->len, a_msdos_name,1, options);
 	if(error)
 		return error;
-	error = msdos_format_name(options->atari, options->name_check,
-				  b->name, b->len, b_msdos_name,1,
-				  options->dotsOK);
+	error = msdos_format_name(b->name, b->len, b_msdos_name,1, options);
 	if(error)
 		return error;
 
@@ -353,13 +352,12 @@
 	int ino,res,is_hid;
 
 	if (!dir) return -ENOENT;
-	if ((res = msdos_format_name(MSDOS_SB(dir->i_sb)->options.atari,
-				     MSDOS_SB(dir->i_sb)->options.name_check,
-				     dentry->d_name.name,dentry->d_name.len,
+	if ((res = msdos_format_name(dentry->d_name.name,dentry->d_name.len,
 				     msdos_name,0,
-				     MSDOS_SB(dir->i_sb)->options.dotsOK)) < 0)
+				     &MSDOS_SB(dir->i_sb)->options)) < 0)
 		return res;
-	is_hid = (dentry->d_name.name[0]=='.') && (msdos_name[0]!='.');
+	is_hid = MSDOS_SB(dir->i_sb)->options.dotsOK
+	  && (dentry->d_name.name[0]=='.') && (msdos_name[0]!='.');
 	fat_lock_creation();
 	/* Scan for existing file twice, so that creating a file fails
 	 * with -EINVAL if the other (dotfile/nondotfile) exists.
@@ -476,13 +474,12 @@
 	char msdos_name[MSDOS_NAME];
 	int ino,res,is_hid;
 
-	if ((res = msdos_format_name(MSDOS_SB(dir->i_sb)->options.atari,
-				     MSDOS_SB(dir->i_sb)->options.name_check,
-				     dentry->d_name.name,dentry->d_name.len,
+	if ((res = msdos_format_name(dentry->d_name.name,dentry->d_name.len,
 				     msdos_name,0,
-				     MSDOS_SB(dir->i_sb)->options.dotsOK)) < 0)
+				     &MSDOS_SB(dir->i_sb)->options)) < 0)
 		return res;
-	is_hid = (dentry->d_name.name[0]=='.') && (msdos_name[0]!='.');
+	is_hid = MSDOS_SB(dir->i_sb)->options.dotsOK
+	  && (dentry->d_name.name[0]=='.') && (msdos_name[0]!='.');
 	fat_lock_creation();
 	if (fat_scan(dir,msdos_name,&bh,&de,&ino,SCAN_ANY) >= 0) {
 		fat_unlock_creation();
@@ -767,20 +764,18 @@
 	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.atari,
-				       MSDOS_SB(old_dir->i_sb)->options.name_check,
-				       old_dentry->d_name.name,
+	if ((error = msdos_format_name(old_dentry->d_name.name,
 				       old_dentry->d_name.len,old_msdos_name,1,
-				       MSDOS_SB(old_dir->i_sb)->options.dotsOK))
+				       &MSDOS_SB(old_dir->i_sb)->options))
 	    < 0) goto rename_done;
-	if ((error = msdos_format_name(MSDOS_SB(new_dir->i_sb)->options.atari,
-				       MSDOS_SB(new_dir->i_sb)->options.name_check,
-				       new_dentry->d_name.name,
+	if ((error = msdos_format_name(new_dentry->d_name.name,
 				       new_dentry->d_name.len,new_msdos_name,0,
-				       MSDOS_SB(new_dir->i_sb)->options.dotsOK))
+				       &MSDOS_SB(new_dir->i_sb)->options))
 	    < 0) goto rename_done;
-	is_hid = (new_dentry->d_name.name[0]=='.') && (new_msdos_name[0]!='.');
-	old_hid = (old_dentry->d_name.name[0]=='.') && (old_msdos_name[0]!='.');
+	is_hid = MSDOS_SB(new_dir->i_sb)->options.dotsOK
+	  && (new_dentry->d_name.name[0]=='.') && (new_msdos_name[0]!='.');
+	old_hid = MSDOS_SB(old_dir->i_sb)->options.dotsOK
+	  && (old_dentry->d_name.name[0]=='.') && (old_msdos_name[0]!='.');
 	if ((error = fat_scan(old_dir,old_msdos_name,&old_bh,&old_de,
 	    &old_ino,old_hid?SCAN_HID:SCAN_NOTHID)) < 0) goto rename_done;
 	fat_lock_creation();
--- linux-2.1.55/include/asm-m68k/elf.h.~1~	Thu Sep 18 17:51:57 1997
+++ linux-2.1.55/include/asm-m68k/elf.h	Tue Sep  9 20:38:15 1997
@@ -40,7 +40,7 @@
    the loader.  We need to make sure that it is out of the way of the program
    that it will "exec", and that there is sufficient room for the brk.  */
 
-#define ELF_ET_DYN_BASE         (2 * TASK_SIZE / 3)
+#define ELF_ET_DYN_BASE         0xD0000000UL
 
 #define ELF_CORE_COPY_REGS(pr_reg, regs)				\
 	/* Bleech. */							\
--- linux-2.1.55/kernel/module.c.~1~	Thu Sep 18 17:53:08 1997
+++ linux-2.1.55/kernel/module.c	Thu Sep 18 20:02:08 1997
@@ -5,7 +5,6 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/config.h>
-#include <asm/pgtable.h>
 #include <asm/uaccess.h>
 #include <linux/vmalloc.h>
 #include <linux/smp.h>
--- linux-2.1.55/net/core/dev.c.~1~	Thu Sep 18 17:53:22 1997
+++ linux-2.1.55/net/core/dev.c	Tue Sep  9 19:13:11 1997
@@ -47,6 +47,8 @@
  *					1 device.
  *	    Thomas Bogendoerfer :	Return ENODEV for dev_open, if there
  *					is no device open function.
+ *		Andreas Schwab	:	Fix copy_to_user arguments in
+ *					dev_ifname.
  *
  */
 
@@ -1006,7 +1008,7 @@
 
 	strcpy(ifr.ifr_name, dev->name);
 
-	err = copy_to_user(&ifr, arg, sizeof(struct ifreq));
+	err = copy_to_user(arg, &ifr, sizeof(struct ifreq));
 	return (err)?-EFAULT:0;
 }
 
