public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] export legacy pty info via sysfs
@ 2004-08-10 13:54 Olaf Hering
  2004-08-10 23:28 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Olaf Hering @ 2004-08-10 13:54 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel


You missed that one last year.


export the legacy pty/tty device nodes via sysfs,
so udev has a chance to create them if /dev is in tmpfs.

Signed-off-by: Olaf Hering <olh@suse.de>

diff -purN linux-2.6.8-rc4.orig/drivers/char/tty_io.c linux-2.6.8-rc4/drivers/char/tty_io.c
--- linux-2.6.8-rc4.orig/drivers/char/tty_io.c	2004-08-10 14:01:54.000000000 +0200
+++ linux-2.6.8-rc4/drivers/char/tty_io.c	2004-08-10 14:04:53.230532914 +0200
@@ -749,6 +749,17 @@ ssize_t redirected_tty_write(struct file
 	return tty_write(file, buf, count, ppos);
 }
 
+static char ptychar[] = "pqrstuvwxyzabcde";
+
+static inline void pty_line_name(struct tty_driver *driver, int index, char *p)
+{
+	int i = index + driver->name_base;
+	/* ->name is initialized to "ttyp", but "tty" is expected */
+	sprintf(p, "%s%c%x",
+			driver->subtype == PTY_TYPE_SLAVE ? "tty" : driver->name,
+			ptychar[i >> 4 & 0xf], i & 0xf);
+}
+
 static inline void tty_line_name(struct tty_driver *driver, int index, char *p)
 {
 	sprintf(p, "%s%d", driver->name, index + driver->name_base);
@@ -2154,6 +2165,7 @@ static struct class_simple *tty_class;
 void tty_register_device(struct tty_driver *driver, unsigned index,
 			 struct device *device)
 {
+	char name[64];
 	dev_t dev = MKDEV(driver->major, driver->minor_start) + index;
 
 	if (index >= driver->num) {
@@ -2165,13 +2177,11 @@ void tty_register_device(struct tty_driv
 	devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR,
 			"%s%d", driver->devfs_name, index + driver->name_base);
 
-	/* we don't care about the ptys */
-	/* how nice to hide this behind some crappy interface.. */
-	if (driver->type != TTY_DRIVER_TYPE_PTY) {
-		char name[64];
+	if (driver->type == TTY_DRIVER_TYPE_PTY)
+		pty_line_name(driver, index, name);
+	else
 		tty_line_name(driver, index, name);
-		class_simple_device_add(tty_class, dev, device, name);
-	}
+	class_simple_device_add(tty_class, dev, device, name);
 }
 
 /**

-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG

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

* Re: [PATCH] export legacy pty info via sysfs
  2004-08-10 13:54 [PATCH] export legacy pty info via sysfs Olaf Hering
@ 2004-08-10 23:28 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2004-08-10 23:28 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linux-kernel

On Tue, Aug 10, 2004 at 03:54:02PM +0200, Olaf Hering wrote:
> 
> You missed that one last year.
> 
> 
> export the legacy pty/tty device nodes via sysfs,
> so udev has a chance to create them if /dev is in tmpfs.
> 
> Signed-off-by: Olaf Hering <olh@suse.de>

Applied, thanks.

greg k-h

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

end of thread, other threads:[~2004-08-10 23:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-10 13:54 [PATCH] export legacy pty info via sysfs Olaf Hering
2004-08-10 23:28 ` Greg KH

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