Skip to contentSkip to conversation

restore do_mmap_pgoff() semantics

PATCH New Gerd Knorr 3 participants 11 messages Oct 30, 2003 – Nov 8, 2003

Subsystems (4)
lore
Share & tools
lore

Gerd Knorr

author
#0 lore raw

PATCH 1/1 restore do_mmap_pgoff() semantics

Hi,

This patch makes do_mmap_pgoff behave as usual and intruduces a new __do_mmap_pgoff function with the additional struct mm_struct argument for the callers which need it.

Point of doing that is to allow a kernel tree with uml patch applied still build non-uml kernels.

Gerd

arch/um/kernel/syscall_kern.c +1 -1
diff -u linux-2.6.0-test3/arch/um/kernel/syscall_kern.c linux/arch/um/kernel/syscall_kern.c
@@ -81,7 +81,7 @@
 	}
 
 	down_write(&mm->mmap_sem);
-	error = do_mmap_pgoff(mm, file, addr, len, prot, flags, pgoff);
+	error = __do_mmap_pgoff(mm, file, addr, len, prot, flags, pgoff);
 	up_write(&mm->mmap_sem);
 
 	if (file)
include/linux/mm.h +13 -6
diff -u linux-2.6.0-test3/include/linux/mm.h linux/include/linux/mm.h
@@ -516,10 +516,18 @@
 
 extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
 
-extern unsigned long do_mmap_pgoff(struct mm_struct *mm, struct file *file, 
-				   unsigned long addr, unsigned long len,
-				   unsigned long prot, unsigned long flag,
-				   unsigned long pgoff);
+extern unsigned long __do_mmap_pgoff(struct mm_struct *mm,
+	struct file *file, unsigned long addr,
+	unsigned long len, unsigned long prot,
+	unsigned long flag, unsigned long pgoff);
+
+static inline unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
+	unsigned long len, unsigned long prot,
+	unsigned long flag, unsigned long pgoff)
+{
+	return __do_mmap_pgoff(current->mm, file, addr, len,
+		               prot, flag, pgoff);
+}
 
 static inline unsigned long do_mmap(struct file *file, unsigned long addr,
 	unsigned long len, unsigned long prot,
@@ -529,8 +537,7 @@
 	if ((offset + PAGE_ALIGN(len)) < offset)
 		goto out;
 	if (!(offset & ~PAGE_MASK))
-		ret = do_mmap_pgoff(current->mm, file, addr, len, prot, flag, 
-				    offset >> PAGE_SHIFT);
+		ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
 out:
 	return ret;
 }
mm/mmap.c +1 -1
diff -u linux-2.6.0-test3/mm/mmap.c linux/mm/mmap.c
@@ -457,7 +457,7 @@
  * The caller must hold down_write(current->mm->mmap_sem).
  */
 
-unsigned long do_mmap_pgoff(struct mm_struct *mm, struct file * file, 
+unsigned long __do_mmap_pgoff(struct mm_struct *mm, struct file * file, 
 			    unsigned long addr, unsigned long len,
 			    unsigned long prot, unsigned long flags,
 			    unsigned long pgoff)

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

author
#1 lore raw

PATCH 1/1 fixmap fix

Hi,

This patch just adds a #ifdef for those archs which don't have FIXADDR_START defined ...

Gerd

mm/memory.c renamed from mm/memory.c.fix +2 -1
@@ -682,7 +682,7 @@
 	return page;
 }
 
-
+#ifdef FIXADDR_START
 static struct vm_area_struct fixmap_vma = {
 	/* Catch users - if there are any valid
 	   ones, we can make this be "&init_mm" or
@@ -700,6 +700,7 @@
 }
 
 __initcall(init_fixmap_vma);
+#endif
 
 int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
 		unsigned long start, int len, int write, int force,

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

author
#2 lore raw

PATCH 1/1 serial console support

In reply to Gerd Knorr

Hi,

This patch adds serial console support to the
uml virtual serial lines.

Gerd

arch/um/drivers/ssl.c +36 -0
@@ -10,6 +10,7 @@
 #include "linux/major.h"
 #include "linux/mm.h"
 #include "linux/init.h"
+#include "linux/console.h"
 #include "asm/termbits.h"
 #include "asm/irq.h"
 #include "line.h"
@@ -150,6 +151,8 @@
 	case TCSETSW:
 	case TCGETA:
 	case TIOCMGET:
+	case TCSBRK:
+	case TCSBRKP:
 		ret = -ENOIOCTLCMD;
 		break;
 	default:
@@ -213,6 +216,38 @@
  */
 static int ssl_init_done = 0;
 
+static void ssl_console_write(struct console *c, const char *string, 
+			      unsigned len)
+{
+	struct line *line = &serial_lines[c->index];
+
+	if(ssl_init_done)
+		down(&line->sem);
+	console_write_chan(&line->chan_list, string, len);
+	if(ssl_init_done)
+		up(&line->sem);
+}
+
+static struct tty_driver *ssl_console_device(struct console *c, int *index)
+{
+	*index = c->index;
+	return ssl_driver;
+}
+
+static int ssl_console_setup(struct console *co, char *options)
+{
+	return(0);
+}
+
+static struct console ssl_cons = {
+	name:		"ttyS",
+	write:		ssl_console_write,
+	device:		ssl_console_device,
+	setup:		ssl_console_setup,
+	flags:		CON_PRINTBUFFER,
+	index:		-1,
+};
+
 int ssl_init(void)
 {
 	char *new_title;
@@ -228,6 +263,7 @@
 	new_title = add_xterm_umid(opts.xterm_title);
 	if(new_title != NULL) opts.xterm_title = new_title;
 
+	register_console(&ssl_cons);
 	ssl_init_done = 1;
 	return(0);
 }

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#3 lore raw

[uml-devel] Re: [patch] serial console support

Quoted 2 lines · [email protected] said:

This patch adds serial console support to the uml virtual serial lines.

Applied, how do you test it?

BTW, it would be good to take this code, and merge it with its twin in stdio_console.c into line.c. Those drivers are nearly identical, and this patch makes them more so.

Jeff

-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003, 16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

author
#4 lore raw

PATCH 1/1 kernel cmd line parser fix

In reply to Gerd Knorr

Hi,

This patch passes up the line_setup return value. That makes the kernel try the next __setup() handler in case line_setup didn't manage to parse the argument, which is especially important for the "console=ttyS0" argument (which is simply ignored without this patch).

Gerd

arch/um/drivers/stdio_console.c renamed from arch/um/drivers/stdio_console.c.arg +2 -1
@@ -230,7 +230,8 @@
 
 static int console_chan_setup(char *str)
 {
-	line_setup(vts, sizeof(vts)/sizeof(vts[0]), str, 1);
+	if (0 != line_setup(vts, sizeof(vts)/sizeof(vts[0]), str, 1))
+		return 0;
 	return(1);
 }
 

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

author
#5 lore raw

PATCH 1/1 change ubd names

In reply to Gerd Knorr

Hi,

This patch renames the virtual block devices from ubd0,1,2 to ubda,b,c (in /proc/partitions). This is how they are named in 2.4 kernels. And this is IMHO better to number devices that way because (a) hd + sd use the same scheme and (b) it is much less confusing if you create partitions on your virtual block devices.

Gerd

arch/um/drivers/ubd_kern.c renamed from arch/um/drivers/ubd_kern.c.ubd +1 -1
@@ -528,7 +528,7 @@
 	disk->fops = &ubd_blops;
 	set_capacity(disk, size / 512);
 	if(major == MAJOR_NR){
-		sprintf(disk->disk_name, "ubd%d", unit);
+		sprintf(disk->disk_name, "ubd%c", 'a' + unit);
 		sprintf(disk->devfs_name, "ubd/disc%d", unit);
 		sprintf(from, "ubd/%d", unit);
 		sprintf(to, "disc%d/disc", unit);

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#6 lore raw

Re: [uml-devel] [patch] change ubd names

Quoted 1 line · [email protected] said:

This patch ....

Mostly, I like these. But you are going to have to maintain the skas fix yourself. I've got skas4 working, which fixes all known issues with skas3, including the patchability problems. So, I'm not doing anything with skas3 any more.

If you think you can push that fixmap fix to Linus/Andrew, go right ahead. Strictly speaking, that's not a UML fix.

Jeff

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#7 lore raw

Re: [uml-devel] [patch] change ubd names

Quoted 7 lines · Jeff Dike
Quoted 1 line · [email protected] said:

This patch ....

Mostly, I like these. But you are going to have to maintain the skas fix yourself. I've got skas4 working, which fixes all known issues with skas3, including the patchability problems. So, I'm not doing anything with skas3 any more.

Oooh, oooh.

When can the drooling public see skas4?

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#8 lore raw

Re: [uml-devel] [patch] change ubd names

Quoted 1 line · [email protected] said:

When can the drooling public see skas4?

When I figure out what to do about the new system call numbers.

Jeff

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#9 lore raw

Re: [uml-devel] [patch] change ubd names

Quoted 4 lines · Jeff Dike
Quoted 1 line · [email protected] said:

When can the drooling public see skas4?

When I figure out what to do about the new system call numbers.

If that's all, I'd like to play with it now.

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

author
#10 lore raw

Re: [uml-devel] [patch] change ubd names

In reply to Jeff Dike
Quoted 4 lines

Mostly, I like these. But you are going to have to maintain the skas fix yourself. I've got skas4 working, which fixes all known issues with skas3, including the patchability problems. So, I'm not doing anything with skas3 any more.

Fine.

Quoted 2 lines

If you think you can push that fixmap fix to Linus/Andrew, go right ahead. Strictly speaking, that's not a UML fix.

Well, the block #ifdef'ed out comes from the -test9 uml patch ...

Gerd

Signature · 12 lines
You have a new virus in /var/mail/kraxel


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel