public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Clean up old names in tty code to current names
@ 2006-07-10  4:11 Jon Smirl
  2006-07-10  4:54 ` Andrew Morton
                   ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Jon Smirl @ 2006-07-10  4:11 UTC (permalink / raw)
  To: lkml, Alan Cox, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 2524 bytes --]

Fix various places in the tty code to make it match the current naming system.

-- 
Jon Smirl
jonsmirl@gmail.com

Signed-off-by: Jon Smirl <jonsmirl@gmail.com>

diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 34dd4c3..af43f37 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -279,7 +279,7 @@ static void __init legacy_pty_init(void)

 	pty_slave_driver->owner = THIS_MODULE;
 	pty_slave_driver->driver_name = "pty_slave";
-	pty_slave_driver->name = "ttyp";
+	pty_slave_driver->name = "pts";
 	pty_slave_driver->major = PTY_SLAVE_MAJOR;
 	pty_slave_driver->minor_start = 0;
 	pty_slave_driver->type = TTY_DRIVER_TYPE_PTY;
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index bfdb902..4a83e94 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -3245,7 +3245,7 @@ #endif
 #ifdef CONFIG_VT
 	cdev_init(&vc0_cdev, &console_fops);
 	if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
-	    register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
+	    register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/tty0") < 0)
 		panic("Couldn't register /dev/tty0 driver\n");
 	class_device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");

diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index da7e66a..a627e8b 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -2662,6 +2662,7 @@ int __init vty_init(void)
 	if (!console_driver)
 		panic("Couldn't allocate console driver\n");
 	console_driver->owner = THIS_MODULE;
+	console_driver->driver_name = "vtconsole";
 	console_driver->name = "tty";
 	console_driver->name_base = 1;
 	console_driver->major = TTY_MAJOR;
diff --git a/fs/proc/proc_tty.c b/fs/proc/proc_tty.c
index 15c4455..042aefe 100644
--- a/fs/proc/proc_tty.c
+++ b/fs/proc/proc_tty.c
@@ -48,7 +48,7 @@ static void show_tty_range(struct seq_fi
 			seq_printf(m, ":vtmaster");
 		break;
 	case TTY_DRIVER_TYPE_CONSOLE:
-		seq_printf(m, "console");
+		seq_printf(m, "vt:console");
 		break;
 	case TTY_DRIVER_TYPE_SERIAL:
 		seq_printf(m, "serial");
@@ -84,10 +84,10 @@ static int show_tty_driver(struct seq_fi
 #ifdef CONFIG_UNIX98_PTYS
 		seq_printf(m, "%-20s /dev/%-8s ", "/dev/ptmx", "ptmx");
 		seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 2);
-		seq_printf(m, "system\n");
+		seq_printf(m, "system:/dev/ptmx\n");
 #endif
 #ifdef CONFIG_VT
-		seq_printf(m, "%-20s /dev/%-8s ", "/dev/vc/0", "vc/0");
+		seq_printf(m, "%-20s /dev/%-8s ", "/dev/tty0", "tty0");
 		seq_printf(m, "%3d %7d ", TTY_MAJOR, 0);
 		seq_printf(m, "system:vtmaster\n");
 #endif

[-- Attachment #2: cleanup-tty-naming.patch --]
[-- Type: text/x-patch, Size: 2365 bytes --]

diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 34dd4c3..af43f37 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -279,7 +279,7 @@ static void __init legacy_pty_init(void)
 
 	pty_slave_driver->owner = THIS_MODULE;
 	pty_slave_driver->driver_name = "pty_slave";
-	pty_slave_driver->name = "ttyp";
+	pty_slave_driver->name = "pts";
 	pty_slave_driver->major = PTY_SLAVE_MAJOR;
 	pty_slave_driver->minor_start = 0;
 	pty_slave_driver->type = TTY_DRIVER_TYPE_PTY;
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index bfdb902..4a83e94 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -3245,7 +3245,7 @@ #endif
 #ifdef CONFIG_VT
 	cdev_init(&vc0_cdev, &console_fops);
 	if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
-	    register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
+	    register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/tty0") < 0)
 		panic("Couldn't register /dev/tty0 driver\n");
 	class_device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
 
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index da7e66a..a627e8b 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -2662,6 +2662,7 @@ int __init vty_init(void)
 	if (!console_driver)
 		panic("Couldn't allocate console driver\n");
 	console_driver->owner = THIS_MODULE;
+	console_driver->driver_name = "vtconsole";
 	console_driver->name = "tty";
 	console_driver->name_base = 1;
 	console_driver->major = TTY_MAJOR;
diff --git a/fs/proc/proc_tty.c b/fs/proc/proc_tty.c
index 15c4455..042aefe 100644
--- a/fs/proc/proc_tty.c
+++ b/fs/proc/proc_tty.c
@@ -48,7 +48,7 @@ static void show_tty_range(struct seq_fi
 			seq_printf(m, ":vtmaster");
 		break;
 	case TTY_DRIVER_TYPE_CONSOLE:
-		seq_printf(m, "console");
+		seq_printf(m, "vt:console");
 		break;
 	case TTY_DRIVER_TYPE_SERIAL:
 		seq_printf(m, "serial");
@@ -84,10 +84,10 @@ static int show_tty_driver(struct seq_fi
 #ifdef CONFIG_UNIX98_PTYS
 		seq_printf(m, "%-20s /dev/%-8s ", "/dev/ptmx", "ptmx");
 		seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 2);
-		seq_printf(m, "system\n");
+		seq_printf(m, "system:/dev/ptmx\n");
 #endif
 #ifdef CONFIG_VT
-		seq_printf(m, "%-20s /dev/%-8s ", "/dev/vc/0", "vc/0");
+		seq_printf(m, "%-20s /dev/%-8s ", "/dev/tty0", "tty0");
 		seq_printf(m, "%3d %7d ", TTY_MAJOR, 0);
 		seq_printf(m, "system:vtmaster\n");
 #endif

^ permalink raw reply related	[flat|nested] 27+ messages in thread
* Re: [PATCH] Clean up old names in tty code to current names
@ 2006-07-11  2:18 Albert Cahalan
  0 siblings, 0 replies; 27+ messages in thread
From: Albert Cahalan @ 2006-07-11  2:18 UTC (permalink / raw)
  To: jonsmirl, alan, hpa, greg, linux-kernel, akpm

Jon Smirl writes:

> If I use udev to rename my devices, the names aren't going
> to match /proc/tty and what ps shows.

It's not as if ps will mislead you. You get "?" if you
redirected stderr or if you lack permission to examine
the /proc/*/fd/* links.

Of course, failing to follow Documentation/devices.txt is
complete foolishness. We have standards you know. The names
are pretty much part of the ABI. Feel free to swap /dev/zero
with /dev/random if you believe otherwise.

> The idea behind udev is that the kernel only deals in device
> numbers and all naming happens in user space.

For many things, the kernel knows:

$ cat /proc/*/maps | egrep '000[ ].*/dev'
3001e000-30020000 rw-s 90000000 03:0d 2989877    /dev/fb0
3002a000-3004a000 rw-s f0000000 03:0d 2990830    /dev/mem
3004a000-3104a000 rw-s 94000000 03:0d 2989877    /dev/fb0

The kernel only needs to remember, by keeping a dentry around.

Not that a devices.txt-compliant devfs wouldn't kick ass...

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2006-07-11 21:58 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-10  4:11 [PATCH] Clean up old names in tty code to current names Jon Smirl
2006-07-10  4:54 ` Andrew Morton
2006-07-10  7:14 ` H. Peter Anvin
2006-07-10  9:44 ` Alan Cox
2006-07-10 12:41   ` Jon Smirl
2006-07-10 13:10     ` Alan Cox
2006-07-10 13:03       ` Jon Smirl
2006-07-10 13:12         ` CaT
2006-07-10 13:18           ` Jon Smirl
2006-07-10 13:43         ` Alan Cox
2006-07-10 14:07           ` Jon Smirl
2006-07-10 14:17             ` Jan Engelhardt
2006-07-10 14:37             ` Alan Cox
2006-07-10 14:42             ` Antonino A. Daplas
2006-07-10 14:57               ` Jon Smirl
2006-07-10 15:19                 ` Alan Cox
2006-07-10 15:10                   ` Valdis.Kletnieks
2006-07-10 15:21                     ` Russell King
2006-07-10 15:38                       ` Valdis.Kletnieks
2006-07-10 15:35                   ` Antonino A. Daplas
2006-07-10 15:54                     ` Jon Smirl
2006-07-10 16:04                       ` H. Peter Anvin
2006-07-10 22:14                       ` Jan Engelhardt
2006-07-10 18:13               ` Alistair John Strachan
2006-07-11 21:54             ` Greg KH
2006-07-11 21:52     ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2006-07-11  2:18 Albert Cahalan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox