Commit e40ef359 authored by Olaf Hering's avatar Olaf Hering Committed by Greg Kroah-Hartman

[PATCH] export legacy pty info via sysfs

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: default avatarOlaf Hering <olh@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 715bf8d2
...@@ -766,6 +766,17 @@ ssize_t redirected_tty_write(struct file * file, const char __user * buf, size_t ...@@ -766,6 +766,17 @@ ssize_t redirected_tty_write(struct file * file, const char __user * buf, size_t
return tty_write(file, buf, count, ppos); 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) static inline void tty_line_name(struct tty_driver *driver, int index, char *p)
{ {
sprintf(p, "%s%d", driver->name, index + driver->name_base); sprintf(p, "%s%d", driver->name, index + driver->name_base);
...@@ -2170,6 +2181,7 @@ static struct class_simple *tty_class; ...@@ -2170,6 +2181,7 @@ static struct class_simple *tty_class;
void tty_register_device(struct tty_driver *driver, unsigned index, void tty_register_device(struct tty_driver *driver, unsigned index,
struct device *device) struct device *device)
{ {
char name[64];
dev_t dev = MKDEV(driver->major, driver->minor_start) + index; dev_t dev = MKDEV(driver->major, driver->minor_start) + index;
if (index >= driver->num) { if (index >= driver->num) {
...@@ -2181,13 +2193,11 @@ void tty_register_device(struct tty_driver *driver, unsigned index, ...@@ -2181,13 +2193,11 @@ void tty_register_device(struct tty_driver *driver, unsigned index,
devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR, devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR,
"%s%d", driver->devfs_name, index + driver->name_base); "%s%d", driver->devfs_name, index + driver->name_base);
/* we don't care about the ptys */ if (driver->type == TTY_DRIVER_TYPE_PTY)
/* how nice to hide this behind some crappy interface.. */ pty_line_name(driver, index, name);
if (driver->type != TTY_DRIVER_TYPE_PTY) { else
char name[64];
tty_line_name(driver, index, name); tty_line_name(driver, index, name);
class_simple_device_add(tty_class, dev, device, name); class_simple_device_add(tty_class, dev, device, name);
}
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment