From: Aivils S. <ai...@us...> - 2004-05-25 05:27:00
|
Update of /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/char In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14912/ruby-2.6/drivers/char Modified Files: Kconfig selection.c tty_io.c vc_screen.c vt.c vt_ioctl.c Log Message: sync to 2.6.6 Index: Kconfig =================================================================== RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/char/Kconfig,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Kconfig 23 Apr 2004 07:36:55 -0000 1.7 +++ Kconfig 25 May 2004 05:26:48 -0000 1.8 @@ -7,7 +7,7 @@ config VT bool "Virtual terminal" if EMBEDDED select INPUT - default y + default y if !VIOCONS ---help--- If you say Y here, you will get support for terminal devices with display and keyboard devices. These are called "virtual" because you @@ -117,7 +117,7 @@ config CYCLADES tristate "Cyclades async mux support" - depends on SERIAL_NONSTANDARD && BROKEN_ON_SMP + depends on SERIAL_NONSTANDARD ---help--- This is a driver for a card that gives you many serial ports. You would need something like this to connect more than two modems to @@ -312,7 +312,7 @@ help This is a driver for the Specialix RIO, a smart serial card which drives an outboard box that can support up to 128 ports. Product - information is at <http://www.sphinxcst.co.uk/perle/multi.htm>. + information is at <http://www.perle.com/support/documentation.html#multiport>. There are both ISA and PCI versions. config RIO_OLDPCI @@ -422,7 +422,7 @@ Say Y here to support smart-card reader 0 (SCR0) on the Integrated Technology Express, Inc. ITE8172 SBC. Vendor page at <http://www.ite.com.tw/ia/brief_it8172bsp.htm>; picture of the - board at <http://www.mvista.com/allies/semiconductor/ite.html>. + board at <http://www.mvista.com/partners/semiconductor/ite.html>. config IT8172_SCR1 bool "Enable Smart Card Reader 1 Support " @@ -431,7 +431,7 @@ Say Y here to support smart-card reader 1 (SCR1) on the Integrated Technology Express, Inc. ITE8172 SBC. Vendor page at <http://www.ite.com.tw/ia/brief_it8172bsp.htm>; picture of the - board at <http://www.mvista.com/allies/semiconductor/ite.html>. + board at <http://www.mvista.com/partners/semiconductor/ite.html>. config A2232 tristate "Commodore A2232 serial support (EXPERIMENTAL)" @@ -775,7 +775,7 @@ config GEN_RTC tristate "Generic /dev/rtc emulation" - depends on RTC!=y + depends on RTC!=y && !IA64 ---help--- If you say Y here and create a character special file /dev/rtc with major number 10 and minor number 135 using mknod ("man mknod"), you Index: selection.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/char/selection.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- selection.c 20 Feb 2004 06:52:18 -0000 1.3 +++ selection.c 25 May 2004 05:26:48 -0000 1.4 @@ -12,6 +12,7 @@ */ #include <linux/module.h> +#include <linux/console.h> #include <linux/tty.h> #include <linux/sched.h> #include <linux/mm.h> Index: tty_io.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/char/tty_io.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- tty_io.c 23 Apr 2004 07:36:55 -0000 1.9 +++ tty_io.c 25 May 2004 05:26:48 -0000 1.10 @@ -81,6 +81,7 @@ #include <linux/console.h> #include <linux/timer.h> #include <linux/ctype.h> +#include <linux/kd.h> #include <linux/mm.h> #include <linux/string.h> #include <linux/slab.h> @@ -95,7 +96,9 @@ #include <asm/system.h> #include <asm/bitops.h> +#include <linux/kbd_kern.h> #include <linux/vt_kern.h> +#include <linux/selection.h> #include <linux/devfs_fs_kernel.h> #include <linux/kmod.h> @@ -119,6 +122,9 @@ LIST_HEAD(tty_drivers); /* linked list of tty drivers */ struct tty_ldisc ldiscs[NR_LDISCS]; /* line disc dispatch table */ +/* Semaphore to protect creating and releasing a tty */ +DECLARE_MUTEX(tty_sem); + #ifdef CONFIG_UNIX98_PTYS extern struct tty_driver *ptm_driver; /* Unix98 pty masters; for /dev/ptmx */ extern int pty_limit; /* Config limit on Unix98 ptys */ @@ -138,6 +144,8 @@ unsigned int cmd, unsigned long arg); static int tty_fasync(int fd, struct file * filp, int on); extern void rs_360_init(void); +static void release_mem(struct tty_struct *tty, int idx); + static struct tty_struct *alloc_tty_struct(void) { @@ -313,7 +321,7 @@ */ int tty_check_change(struct tty_struct * tty) { - if (current->tty != tty) + if (current->signal->tty != tty) return 0; if (tty->pgrp <= 0) { printk(KERN_WARNING "tty_check_change: tty->pgrp <= 0!\n"); @@ -478,17 +486,14 @@ if (tty->session > 0) { struct list_head *l; for_each_task_pid(tty->session, PIDTYPE_SID, p, l, pid) { - task_t *task = p; - do { - if (task->tty == tty) - task->tty = NULL; - if (task->leader) { - send_group_sig_info(SIGHUP, SEND_SIG_PRIV, task); - send_group_sig_info(SIGCONT, SEND_SIG_PRIV, task); - } - } while_each_thread(p, task); + if (p->signal->tty == tty) + p->signal->tty = NULL; + if (!p->signal->leader) + continue; + send_group_sig_info(SIGHUP, SEND_SIG_PRIV, p); + send_group_sig_info(SIGCONT, SEND_SIG_PRIV, p); if (tty->pgrp > 0) - p->tty_old_pgrp = tty->pgrp; + p->signal->tty_old_pgrp = tty->pgrp; } } read_unlock(&tasklist_lock); @@ -567,15 +572,15 @@ lock_kernel(); - tty = current->tty; + tty = current->signal->tty; if (tty) { tty_pgrp = tty->pgrp; if (on_exit && tty->driver->type != TTY_DRIVER_TYPE_PTY) tty_vhangup(tty); } else { - if (current->tty_old_pgrp) { - kill_pg(current->tty_old_pgrp, SIGHUP, on_exit); - kill_pg(current->tty_old_pgrp, SIGCONT, on_exit); + if (current->signal->tty_old_pgrp) { + kill_pg(current->signal->tty_old_pgrp, SIGHUP, on_exit); + kill_pg(current->signal->tty_old_pgrp, SIGCONT, on_exit); } unlock_kernel(); return; @@ -586,17 +591,13 @@ kill_pg(tty_pgrp, SIGCONT, on_exit); } - current->tty_old_pgrp = 0; + current->signal->tty_old_pgrp = 0; tty->session = 0; tty->pgrp = -1; read_lock(&tasklist_lock); - for_each_task_pid(current->session, PIDTYPE_SID, p, l, pid) { - task_t *task = p; - do { - task->tty = NULL; - } while_each_thread(p, task); - } + for_each_task_pid(current->signal->session, PIDTYPE_SID, p, l, pid) + p->signal->tty = NULL; read_unlock(&tasklist_lock); unlock_kernel(); } @@ -762,21 +763,6 @@ return tty_write(file, buf, count, ppos); } -/* Semaphore to protect creating and releasing a tty */ -static DECLARE_MUTEX(tty_sem); - -static void down_tty_sem(int index) -{ - down(&tty_sem); -} - -static void up_tty_sem(int index) -{ - up(&tty_sem); -} - -static void release_mem(struct tty_struct *tty, int idx); - static inline void tty_line_name(struct tty_driver *driver, int index, char *p) { sprintf(p, "%s%d", driver->name, index + driver->name_base); @@ -800,7 +786,7 @@ * Check whether we need to acquire the tty semaphore to avoid * race conditions. For now, play it safe. */ - down_tty_sem(idx); + down(&tty_sem); /* check whether we're reopening an existing tty */ if (driver->flags & TTY_DRIVER_DEVPTS_MEM) { @@ -984,7 +970,7 @@ /* All paths come through here to release the semaphore */ end_init: - up_tty_sem(idx); + up(&tty_sem); return retval; /* Release locally allocated memory ... nothing placed in slots */ @@ -1264,20 +1250,11 @@ struct pid *pid; read_lock(&tasklist_lock); - for_each_task_pid(tty->session, PIDTYPE_SID, p, l, pid) { - task_t *task = p; - do { - task->tty = NULL; - } while_each_thread(p, task); - } - if (o_tty) { - for_each_task_pid(o_tty->session, PIDTYPE_SID, p,l, pid) { - task_t *task = p; - do { - task->tty = NULL; - } while_each_thread(p, task); - } - } + for_each_task_pid(tty->session, PIDTYPE_SID, p, l, pid) + p->signal->tty = NULL; + if (o_tty) + for_each_task_pid(o_tty->session, PIDTYPE_SID, p,l, pid) + p->signal->tty = NULL; read_unlock(&tasklist_lock); } @@ -1348,10 +1325,10 @@ retry_open: noctty = filp->f_flags & O_NOCTTY; if (device == MKDEV(TTYAUX_MAJOR,0)) { - if (!current->tty) + if (!current->signal->tty) return -ENXIO; - driver = current->tty->driver; - index = current->tty->index; + driver = current->signal->tty->driver; + index = current->signal->tty->index; filp->f_flags |= O_NONBLOCK; /* Don't let /dev/tty block */ /* noctty = 1; */ goto got_driver; @@ -1362,11 +1339,11 @@ extern struct tty_driver *console_driver; driver = console_driver; - if (current->tty && + if (current->signal->tty && filp->f_op->write == redirected_tty_write && - current->tty->index > 0 && - current->tty->index < MAX_NR_CONSOLES) - vc = (struct vc_data *)current->tty->driver_data; + current->signal->tty->index > 0 && + current->signal->tty->index < MAX_NR_CONSOLES) + vc = current->signal->tty->driver_data; if (vc) index = vc->display_fg->fg_console->vc_num; else @@ -1461,14 +1438,14 @@ goto retry_open; } if (!noctty && - current->leader && - !current->tty && + current->signal->leader && + !current->signal->tty && tty->session == 0) { task_lock(current); - current->tty = tty; + current->signal->tty = tty; task_unlock(current); - current->tty_old_pgrp = 0; - tty->session = current->session; + current->signal->tty_old_pgrp = 0; + tty->session = current->signal->session; tty->pgrp = process_group(current); } return 0; @@ -1526,7 +1503,7 @@ { char ch, mbz = 0; - if ((current->tty != tty) && !capable(CAP_SYS_ADMIN)) + if ((current->signal->tty != tty) && !capable(CAP_SYS_ADMIN)) return -EPERM; if (get_user(ch, arg)) return -EFAULT; @@ -1619,14 +1596,14 @@ struct pid *pid; task_t *p; - if (current->leader && - (current->session == tty->session)) + if (current->signal->leader && + (current->signal->session == tty->session)) return 0; /* * The process must be a session leader and * not have a controlling tty already. */ - if (!current->leader || current->tty) + if (!current->signal->leader || current->signal->tty) return -EPERM; if (tty->session > 0) { /* @@ -1639,21 +1616,17 @@ */ read_lock(&tasklist_lock); - for_each_task_pid(tty->session, PIDTYPE_SID, p, l, pid) { - task_t *task = p; - do { - task->tty = NULL; - } while_each_thread(p, task); - } + for_each_task_pid(tty->session, PIDTYPE_SID, p, l, pid) + p->signal->tty = NULL; read_unlock(&tasklist_lock); } else return -EPERM; } task_lock(current); - current->tty = tty; + current->signal->tty = tty; task_unlock(current); - current->tty_old_pgrp = 0; - tty->session = current->session; + current->signal->tty_old_pgrp = 0; + tty->session = current->signal->session; tty->pgrp = process_group(current); return 0; } @@ -1664,7 +1637,7 @@ * (tty == real_tty) is a cheap way of * testing if the tty is NOT a master pty. */ - if (tty == real_tty && current->tty != real_tty) + if (tty == real_tty && current->signal->tty != real_tty) return -ENOTTY; return put_user(real_tty->pgrp, arg); } @@ -1678,15 +1651,15 @@ return -ENOTTY; if (retval) return retval; - if (!current->tty || - (current->tty != real_tty) || - (real_tty->session != current->session)) + if (!current->signal->tty || + (current->signal->tty != real_tty) || + (real_tty->session != current->signal->session)) return -ENOTTY; if (get_user(pgrp, (pid_t *) arg)) return -EFAULT; if (pgrp < 0) return -EINVAL; - if (session_of_pgrp(pgrp) != current->session) + if (session_of_pgrp(pgrp) != current->signal->session) return -EPERM; real_tty->pgrp = pgrp; return 0; @@ -1698,7 +1671,7 @@ * (tty == real_tty) is a cheap way of * testing if the tty is NOT a master pty. */ - if (tty == real_tty && current->tty != real_tty) + if (tty == real_tty && current->signal->tty != real_tty) return -ENOTTY; if (real_tty->session <= 0) return -ENOTTY; @@ -1856,12 +1829,12 @@ clear_bit(TTY_EXCLUSIVE, &tty->flags); return 0; case TIOCNOTTY: - if (current->tty != tty) + if (current->signal->tty != tty) return -ENOTTY; - if (current->leader) + if (current->signal->leader) disassociate_ctty(0); task_lock(current); - current->tty = NULL; + current->signal->tty = NULL; task_unlock(current); return 0; case TIOCSCTTY: @@ -1965,9 +1938,9 @@ tty->driver->flush_buffer(tty); read_lock(&tasklist_lock); for_each_task_pid(session, PIDTYPE_SID, p, l, pid) { - if (p->tty == tty || session > 0) { + if (p->signal->tty == tty || session > 0) { printk(KERN_NOTICE "SAK: killed process %d" - " (%s): p->session==tty->session\n", + " (%s): p->signal->session==tty->session\n", p->pid, p->comm); send_sig(SIGKILL, p, 1); continue; Index: vc_screen.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/char/vc_screen.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- vc_screen.c 20 Feb 2004 06:52:18 -0000 1.4 +++ vc_screen.c 25 May 2004 05:26:48 -0000 1.5 @@ -35,6 +35,7 @@ #include <linux/selection.h> #include <linux/console.h> #include <linux/smp_lock.h> +#include <linux/device.h> #include <asm/uaccess.h> #include <asm/byteorder.h> #include <asm/unaligned.h> @@ -507,6 +508,8 @@ .open = vcs_open, }; +static struct class_simple *vc_class; + void vcs_make_devfs(struct tty_struct *tty) { devfs_mk_cdev(MKDEV(VCS_MAJOR, tty->index + 1), @@ -515,19 +518,26 @@ devfs_mk_cdev(MKDEV(VCS_MAJOR, tty->index + 129), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/a%u", tty->index + 1); + class_simple_device_add(vc_class, MKDEV(VCS_MAJOR, tty->index + 1), NULL, "vcs%u", tty->index + 1); + class_simple_device_add(vc_class, MKDEV(VCS_MAJOR, tty->index + 129), NULL, "vcsa%u", tty->index + 1); } void vcs_remove_devfs(struct tty_struct *tty) { devfs_remove("vcc/%u", tty->index + 1); devfs_remove("vcc/a%u", tty->index + 1); + class_simple_device_remove(MKDEV(VCS_MAJOR, tty->index + 1)); + class_simple_device_remove(MKDEV(VCS_MAJOR, tty->index + 129)); } int __init vcs_init(void) { if (register_chrdev(VCS_MAJOR, "vcs", &vcs_fops)) panic("unable to get major %d for vcs device", VCS_MAJOR); + vc_class = class_simple_create(THIS_MODULE, "vc"); devfs_mk_cdev(MKDEV(VCS_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/0"); devfs_mk_cdev(MKDEV(VCS_MAJOR, 128), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/a0"); + class_simple_device_add(vc_class, MKDEV(VCS_MAJOR, 0), NULL, "vcs"); + class_simple_device_add(vc_class, MKDEV(VCS_MAJOR, 128), NULL, "vcsa"); return 0; } Index: vt.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/char/vt.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- vt.c 23 Apr 2004 07:36:55 -0000 1.18 +++ vt.c 25 May 2004 05:26:48 -0000 1.19 @@ -1208,7 +1208,7 @@ #define CON_BUF_SIZE PAGE_SIZE DECLARE_MUTEX(con_buf_sem); -static int do_con_write(struct tty_struct * tty, int from_user, +static int do_con_write(struct tty_struct *tty, int from_user, const unsigned char *buf, int count) { #ifdef VT_BUF_VRAM_ONLY @@ -1219,7 +1219,7 @@ draw_x = -1; \ } #endif - struct vc_data *vc = (struct vc_data *)tty->driver_data; + struct vc_data *vc = tty->driver_data; unsigned long draw_from = 0, draw_to = 0; const unsigned char *orig_buf = NULL; int c, tc, ok, n = 0, draw_x = -1; @@ -1404,13 +1404,13 @@ } /* - * /dev/ttyN handling + * /dev/ttyN handling */ /* Allocate the console screen memory. */ -static int vt_open(struct tty_struct *tty, struct file * filp) +static int vt_open(struct tty_struct *tty, struct file *filp) { - struct vc_data *vc = (struct vc_data *) tty->driver_data; + struct vc_data *vc = tty->driver_data; unsigned int index = tty->index; if (!vc) { @@ -1445,7 +1445,7 @@ return; } - vc = (struct vc_data *)tty->driver_data; + vc = tty->driver_data; if (vc) { vcs_remove_devfs(tty); vc->vc_tty = NULL; @@ -1457,7 +1457,7 @@ static int vt_write(struct tty_struct * tty, int from_user, const unsigned char *buf, int count) { - struct vc_data *vc = (struct vc_data *) tty->driver_data; + struct vc_data *vc = tty->driver_data; int retval; pm_access(vc->display_fg->pm_con); @@ -1469,10 +1469,10 @@ static void vt_put_char(struct tty_struct *tty, unsigned char ch) { - struct vc_data *vc = (struct vc_data *) tty->driver_data; + struct vc_data *vc = tty->driver_data; if (in_interrupt()) - return; /* n_r3964 calls put_char() from interrupt context */ + return; /* n_r3964 calls put_char() from interrupt context */ pm_access(vc->display_fg->pm_con); do_con_write(tty, 0, &ch, 1); } @@ -1486,7 +1486,7 @@ static void vt_flush_chars(struct tty_struct *tty) { - struct vc_data *vc = (struct vc_data *) tty->driver_data; + struct vc_data *vc = tty->driver_data; if (in_interrupt()) /* from flush_to_ldisc */ return; @@ -1516,7 +1516,7 @@ if (!tty) return; - vc = (struct vc_data *)tty->driver_data; + vc = tty->driver_data; if (!vc) return; set_kbd_led(&vc->kbd_table, VC_SCROLLOCK); @@ -1532,7 +1532,7 @@ if (!tty) return; - vc = (struct vc_data *)tty->driver_data; + vc = tty->driver_data; if (!vc) return; @@ -1551,7 +1551,7 @@ static void vt_unthrottle(struct tty_struct *tty) { - struct vc_data *vc = (struct vc_data *) tty->driver_data; + struct vc_data *vc = tty->driver_data; wake_up_interruptible(&vc->paste_wait); } @@ -1564,7 +1564,7 @@ * The console must be locked when we get here. */ -void vt_console_print(struct console *co, const char * b, unsigned count) +void vt_console_print(struct console *co, const char *b, unsigned count) { struct vc_data *vc = find_vc(kmsg_redirect); static unsigned long printing; @@ -1682,13 +1682,13 @@ int tioclinux(struct tty_struct *tty, unsigned long arg) { - struct vc_data *vc = (struct vc_data *) tty->driver_data; + struct vc_data *vc = tty->driver_data; char type, data; int lines, ret; if (tty->driver->type != TTY_DRIVER_TYPE_CONSOLE) return -EINVAL; - if (current->tty != tty && !capable(CAP_SYS_ADMIN)) + if (current->signal->tty != tty && !capable(CAP_SYS_ADMIN)) return -EPERM; if (get_user(type, (char *)arg)) return -EFAULT; @@ -1872,6 +1872,8 @@ if (list_empty(&vt_list)) return -ENXIO; + vcs_init(); + console_driver = alloc_tty_driver(MAX_NR_CONSOLES); if (!console_driver) panic("Couldn't allocate VT console driver\n"); @@ -1900,7 +1902,6 @@ #endif kbd_init(); console_map_init(); - vcs_init(); return 0; } Index: vt_ioctl.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/char/vt_ioctl.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- vt_ioctl.c 20 Feb 2004 06:52:18 -0000 1.6 +++ vt_ioctl.c 25 May 2004 05:26:48 -0000 1.7 @@ -701,7 +701,7 @@ * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG. */ perm = 0; - if (current->tty == tty || capable(CAP_SYS_TTY_CONFIG)) + if (current->signal->tty == tty || capable(CAP_SYS_TTY_CONFIG)) perm = 1; switch (cmd) { @@ -1360,4 +1360,3 @@ return -ENOIOCTLCMD; } } - |