Update of /cvsroot/linuxconsole/ruby/linux/drivers/char In directory sc8-pr-cvs1:/tmp/cvs-serv1514/linux/drivers/char Modified Files: Kconfig Makefile consolemap.c keyboard.c misc.c sysrq.c tty_io.c vc_screen.c vt.c Log Message: Synced to 2.5.49 console BK tree. Index: Kconfig =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/Kconfig,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Kconfig 1 Nov 2002 23:18:31 -0000 1.1 +++ Kconfig 23 Nov 2002 00:55:50 -0000 1.2 @@ -641,289 +641,7 @@ comment "metalab.unc.edu or ftp://titus.cfw.com/pub/Linux/util/" depends on QIC02_TAPE && QIC02_DYNCONF - -menu "Watchdog Cards" - -config WATCHDOG - bool "Watchdog Timer Support" - ---help--- - If you say Y here (and to one of the following options) and create a - character special file /dev/watchdog with major number 10 and minor - number 130 using mknod ("man mknod"), you will get a watchdog, i.e.: - subsequently opening the file and then failing to write to it for - longer than 1 minute will result in rebooting the machine. This - could be useful for a networked machine that needs to come back - online as fast as possible after a lock-up. There's both a watchdog - implementation entirely in software (which can sometimes fail to - reboot the machine) and a driver for hardware watchdog boards, which - are more robust and can also keep track of the temperature inside - your computer. For details, read <file:Documentation/watchdog.txt> - in the kernel source. - - The watchdog is usually used together with the watchdog daemon - which is available from - <ftp://ibiblio.org/pub/Linux/system/daemons/watchdog/>. This daemon can - also monitor NFS connections and can reboot the machine when the process - table is full. - - If unsure, say N. - -config WATCHDOG_NOWAYOUT - bool "Disable watchdog shutdown on close" - depends on WATCHDOG - help - The default watchdog behaviour (which you get if you say N here) is - to stop the timer if the process managing it closes the file - /dev/watchdog. It's always remotely possible that this process might - get killed. If you say Y here, the watchdog cannot be stopped once - it has been started. - -config SOFT_WATCHDOG - tristate "Software watchdog" - depends on WATCHDOG - help - A software monitoring watchdog. This will fail to reboot your system - from some situations that the hardware watchdog will recover - from. Equally it's a lot cheaper to install. - - This driver is also available as a module ( = code which can be - inserted in and removed from the running kernel whenever you want). - If you want to compile it as a module, say M here and read - <file:Documentation/modules.txt>. The module will be called - softdog.o. - -config WDT - tristate "WDT Watchdog timer" - depends on WATCHDOG - ---help--- - If you have a WDT500P or WDT501P watchdog board, say Y here, - otherwise N. It is not possible to probe for this board, which means - that you have to inform the kernel about the IO port and IRQ using - the "wdt=" kernel option (try "man bootparam" or see the - documentation of your boot loader (lilo or loadlin) about how to - pass options to the kernel at boot time). - - If you want to compile this as a module ( = code which can be - inserted in and removed from the running kernel whenever you want), - say M here and read <file:Documentation/modules.txt>. The module - will be called wdt.o. - -config WDTPCI - tristate "WDT PCI Watchdog timer" - depends on WATCHDOG - ---help--- - If you have a PCI WDT500/501 watchdog board, say Y here, otherwise - N. It is not possible to probe for this board, which means that you - have to inform the kernel about the IO port and IRQ using the "wdt=" - kernel option (try "man bootparam" or see the documentation of your - boot loader (lilo or loadlin) about how to pass options to the - kernel at boot time). - - If you want to compile this as a module ( = code which can be - inserted in and removed from the running kernel whenever you want), - say M here and read <file:Documentation/modules.txt>. The module - will be called wdt_pci.o. - -config WDT_501 - bool "WDT501 features" - depends on WDT - help - Saying Y here and creating a character special file /dev/temperature - with major number 10 and minor number 131 ("man mknod") will give - you a thermometer inside your computer: reading from - /dev/temperature yields one byte, the temperature in degrees - Fahrenheit. This works only if you have a WDT501P watchdog board - installed. - -config WDT_501_FAN - bool "Fan Tachometer" - depends on WDT_501 - help - Enable the Fan Tachometer on the WDT501. Only do this if you have a - fan tachometer actually set up. - -config PCWATCHDOG - tristate "Berkshire Products PC Watchdog" - depends on WATCHDOG - ---help--- - This is the driver for the Berkshire Products PC Watchdog card. - This card simply watches your kernel to make sure it doesn't freeze, - and if it does, it reboots your computer after a certain amount of - time. This driver is like the WDT501 driver but for different - hardware. Please read <file:Documentation/pcwd-watchdog.txt>. The PC - watchdog cards can be ordered from <http://www.berkprod.com/>. - - This driver is also available as a module ( = code which can be - inserted in and removed from the running kernel whenever you want). - The module is called pcwd.o. If you want to compile it as a module, - say M here and read <file:Documentation/modules.txt>. - - Most people will say N. - -config ACQUIRE_WDT - tristate "Acquire SBC Watchdog Timer" - depends on WATCHDOG - ---help--- - This is the driver for the hardware watchdog on the PSC-6x86 Single - Board Computer produced by Acquire Inc (and others). This watchdog - simply watches your kernel to make sure it doesn't freeze, and if - it does, it reboots your computer after a certain amount of time. - - This driver is like the WDT501 driver but for different hardware. - This driver is also available as a module ( = code which can be - inserted in and removed from the running kernel whenever you want). - The module is called pscwdt.o. If you want to compile it as a - module, say M here and read <file:Documentation/modules.txt>. Most - people will say N. - -config ADVANTECH_WDT - tristate "Advantech SBC Watchdog Timer" - depends on WATCHDOG - help - If you are configuring a Linux kernel for the Advantech single-board - computer, say `Y' here to support its built-in watchdog timer - feature. See the help for CONFIG_WATCHDOG for discussion. - -config 21285_WATCHDOG - tristate "DC21285 watchdog" - depends on WATCHDOG && FOOTBRIDGE - help - The Intel Footbridge chip contains a builtin watchdog circuit. Say Y - here if you wish to use this. Alternatively say M to compile the - driver as a module, which will be called wdt285.o. - - This driver does not work on all machines. In particular, early CATS - boards have hardware problems that will cause the machine to simply - lock up if the watchdog fires. - - "If in doubt, leave it out" - say N. - -config 977_WATCHDOG - tristate "NetWinder WB83C977 watchdog" - depends on WATCHDOG && FOOTBRIDGE && ARCH_NETWINDER - help - Say Y here to include support for the WB977 watchdog included in - NetWinder machines. Alternatively say M to compile the driver as - a module, which will be called wdt977.o. - - Not sure? It's safe to say N. - -config EUROTECH_WDT - tristate "Eurotech CPU-1220/1410 Watchdog Timer" - depends on WATCHDOG - help - Enable support for the watchdog timer on the Eurotech CPU-1220 and - CPU-1410 cards. These are PC/104 SBCs. Spec sheets and product - information are at <http://www.eurotech.it/>. - -config IB700_WDT - tristate "IB700 SBC Watchdog Timer" - depends on WATCHDOG - ---help--- - This is the driver for the hardware watchdog on the IB700 Single - Board Computer produced by TMC Technology (www.tmc-uk.com). This watchdog - simply watches your kernel to make sure it doesn't freeze, and if - it does, it reboots your computer after a certain amount of time. - - This driver is like the WDT501 driver but for slightly different hardware. - - This driver is also available as a module ( = code which can be - inserted in and removed from the running kernel whenever you want). - The module is called ib700wdt.o. If you want to compile it as a - module, say M here and read Documentation/modules.txt. Most people - will say N. - -config I810_TCO - tristate "Intel i810 TCO timer / Watchdog" - depends on WATCHDOG - ---help--- - Hardware driver for the TCO timer built into the Intel i810 and i815 - chipset family. The TCO (Total Cost of Ownership) timer is a - watchdog timer that will reboot the machine after its second - expiration. The expiration time can be configured by commandline - argument "i810_margin=<n>" where <n> is the counter initial value. - It is decremented every 0.6 secs, the default is 50 which gives a - timeout of 30 seconds and one minute until reset. - - On some motherboards the driver may fail to reset the chipset's - NO_REBOOT flag which prevents the watchdog from rebooting the - machine. If this is the case you will get a kernel message like - "i810tco init: failed to reset NO_REBOOT flag". - - If you want to compile this as a module, say M and read - <file:Documentation/modules.txt>. The module will be called - i810-tco.o. - -config MIXCOMWD - tristate "Mixcom Watchdog" - depends on WATCHDOG - ---help--- - This is a driver for the Mixcom hardware watchdog cards. This - watchdog simply watches your kernel to make sure it doesn't freeze, - and if it does, it reboots your computer after a certain amount of - time. - - This driver is also available as a module ( = code which can be - inserted in and removed from the running kernel whenever you want). - The module is called mixcomwd.o. If you want to compile it as a - module, say M here and read <file:Documentation/modules.txt>. Most - people will say N. - -config SCx200_WDT - tristate "NatSemi SCx200 Watchdog" - depends on WATCHDOG - help - Enable the built-in watchdog timer support on the National - Semiconductor SCx200 processors. - - If compiled as a module, it will be called scx200_watchdog.o. - -config 60XX_WDT - tristate "SBC-60XX Watchdog Timer" - depends on WATCHDOG - help - This driver can be used with the watchdog timer found on some - single board computers, namely the 6010 PII based computer. - It may well work with other cards. It reads port 0x443 to enable - and re-set the watchdog timer, and reads port 0x45 to disable - the watchdog. If you have a card that behave in similar ways, - you can probably make this driver work with your card as well. - - You can compile this driver directly into the kernel, or use - it as a module. The module will be called sbc60xxwdt.o. - -config W83877F_WDT - tristate "W83877F (EMACS) Watchdog Timer" - depends on WATCHDOG - ---help--- - This is the driver for the hardware watchdog on the W83877F chipset - as used in EMACS PC-104 motherboards (and likely others). This - watchdog simply watches your kernel to make sure it doesn't freeze, - and if it does, it reboots your computer after a certain amount of - time. - - This driver is also available as a module ( = code which can be - inserted in and removed from the running kernel whenever you want). - The module is called mixcomwd.o. If you want to compile it as a - module, say M here and read <file:Documentation/modules.txt>. Most - people will say N. - -config MACHZ_WDT - tristate "ZF MachZ Watchdog" - depends on WATCHDOG - ---help--- - If you are using a ZF Micro MachZ processor, say Y here, otherwise - N. This is the driver for the watchdog timer builtin on that - processor using ZF-Logic interface. This watchdog simply watches - your kernel to make sure it doesn't freeze, and if it does, it - reboots your computer after a certain amount of time. - - This driver is also available as a module ( = code which can be - inserted in and removed from the running kernel whenever you want). - The module is called machzwd.o. If you want to compile it as a - module, say M here and read <file:Documentation/modules.txt>. - -endmenu +source "drivers/char/watchdog/Kconfig" config DS1620 tristate "NetWinder thermometer support" Index: Makefile =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/Makefile,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- Makefile 5 Nov 2002 14:36:19 -0000 1.50 +++ Makefile 23 Nov 2002 00:55:50 -0000 1.51 @@ -7,16 +7,16 @@ # FONTMAPFILE = cp437.uni -obj-y += mem.o tty_io.o n_tty.o tty_ioctl.o pty.o misc.o random.o eventpoll.o +obj-y += mem.o tty_io.o n_tty.o tty_ioctl.o pty.o misc.o random.o # All of the (potential) objects that export symbols. # This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'. export-objs := busmouse.o vt.o generic_serial.o ip2main.o \ ite_gpio.o keyboard.o misc.o nvram.o random.o rtc.o \ - selection.o sonypi.o sysrq.o tty_io.o tty_ioctl.o eventpoll.o + selection.o sonypi.o sysrq.o tty_io.o tty_ioctl.o -obj-$(CONFIG_VT) += vt_ioctl.o decvte.o vc_screen.o consolemap.o consolemap_deftbl.o selection.o keyboard.o +obj-$(CONFIG_VT) += vt_ioctl.o vc_screen.o consolemap.o consolemap_deftbl.o selection.o keyboard.o obj-$(CONFIG_HW_CONSOLE) += vt.o defkeymap.o obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o obj-$(CONFIG_ATARI_DSP56K) += dsp56k.o @@ -57,7 +57,6 @@ obj-$(CONFIG_R3964) += n_r3964.o obj-$(CONFIG_APPLICOM) += applicom.o obj-$(CONFIG_SONYPI) += sonypi.o -obj-$(CONFIG_ATARIMOUSE) += atarimouse.o obj-$(CONFIG_RTC) += rtc.o obj-$(CONFIG_GEN_RTC) += genrtc.o obj-$(CONFIG_EFI_RTC) += efirtc.o @@ -78,31 +77,12 @@ obj-$(CONFIG_NWFLASH) += nwflash.o obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o -# Only one watchdog can succeed. We probe the hardware watchdog -# drivers first, then the softdog driver. This means if your hardware -# watchdog dies or is 'borrowed' for some reason the software watchdog -# still gives you some cover. - -obj-$(CONFIG_PCWATCHDOG) += pcwd.o -obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o -obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o -obj-$(CONFIG_IB700_WDT) += ib700wdt.o -obj-$(CONFIG_MIXCOMWD) += mixcomwd.o -obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o -obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o -obj-$(CONFIG_WDT) += wdt.o -obj-$(CONFIG_WDTPCI) += wdt_pci.o -obj-$(CONFIG_21285_WATCHDOG) += wdt285.o -obj-$(CONFIG_977_WATCHDOG) += wdt977.o -obj-$(CONFIG_I810_TCO) += i810-tco.o -obj-$(CONFIG_MACHZ_WDT) += machzwd.o -obj-$(CONFIG_SH_WDT) += shwdt.o -obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o -obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o +obj-$(CONFIG_WATCHDOGS) += watchdog/ obj-$(CONFIG_MWAVE) += mwave/ obj-$(CONFIG_AGP) += agp/ obj-$(CONFIG_DRM) += drm/ obj-$(CONFIG_PCMCIA) += pcmcia/ + # Files generated that shall be removed upon make clean clean-files := consolemap_deftbl.c defkeymap.c qtronixmap.c Index: consolemap.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/consolemap.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- consolemap.c 1 Nov 2002 23:27:32 -0000 1.14 +++ consolemap.c 23 Nov 2002 00:55:50 -0000 1.15 @@ -234,7 +234,7 @@ struct uni_pagedir *p, *q = NULL; int i; - for (i = 0; i < MAX_NR_CONSOLES; i++) { + for (i = 0; i < MAX_NR_USER_CONSOLES; i++) { struct vc_data *tmp = vc->display_fg->vc_cons[i]; if (!tmp) @@ -379,7 +379,7 @@ struct uni_pagedir *q; int i, j, k; - for (i = 0; i < MAX_NR_CONSOLES; i++) { + for (i = 0; i < MAX_NR_USER_CONSOLES; i++) { struct vc_data *tmp = vc->display_fg->vc_cons[i]; if (!tmp) @@ -670,7 +670,7 @@ struct vt_struct *vt = vt_cons; int i; - for (i = 0; i < MAX_NR_CONSOLES; i++) { + for (i = 0; i < MAX_NR_USER_CONSOLES; i++) { struct vc_data *vc = vt->vc_cons[i]; if (vc && !*vc->vc_uni_pagedir_loc) Index: keyboard.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/keyboard.c,v retrieving revision 1.79 retrieving revision 1.80 diff -u -d -r1.79 -r1.80 --- keyboard.c 1 Nov 2002 23:27:32 -0000 1.79 +++ keyboard.c 23 Nov 2002 00:55:50 -0000 1.80 @@ -35,6 +35,8 @@ #include <linux/init.h> #include <linux/slab.h> +#include <linux/console_struct.h> +#include <linux/kbd_kern.h> #include <linux/kbd_diacr.h> #include <linux/vt_kern.h> #include <linux/sysrq.h> @@ -42,6 +44,28 @@ static void kbd_disconnect(struct input_handle *handle); extern void ctrl_alt_del(void); + +/* + * Exported functions/variables + */ + +#ifndef KBD_DEFMODE +#define KBD_DEFMODE ((1 << VC_REPEAT) | (1 << VC_META)) +#endif + +#ifndef KBD_DEFLEDS +/* + * Some laptops take the 789uiojklm,. keys as number pad when NumLock is on. + * This seems a good reason to start with NumLock off. + */ +#define KBD_DEFLEDS 0 +#endif + +#ifndef KBD_DEFLOCK +#define KBD_DEFLOCK 0 +#endif + +extern int do_poke_blanked_console; void compute_shiftstate(void); struct pt_regs *kbd_pt_regs; EXPORT_SYMBOL(kbd_pt_regs); @@ -84,11 +108,17 @@ }; const int NR_TYPES = ARRAY_SIZE(max_vals); + +struct kbd_struct kbd_table[MAX_NR_CONSOLES]; +static struct kbd_struct *kbd = kbd_table; +static struct kbd_struct kbd0; + int spawnpid, spawnsig; /* * Variables exported for vt.c */ + int shift_state = 0; /* @@ -131,78 +161,106 @@ * Translation of scancodes to keycodes. We set them on only the first attached * keyboard - for per-keyboard setting, /dev/input/event is more useful. */ -int getkeycode(struct input_handle *handle, unsigned int scancode) +int getkeycode(unsigned int scancode) { - struct input_dev *dev = handle->dev; + struct list_head * node; + struct input_dev *dev = NULL; + + list_for_each(node,&kbd_handler.h_list) { + struct input_handle * handle = to_handle_h(node); + if (handle->dev->keycodesize) { + dev = handle->dev; + break; + } + } if (!dev) return -ENODEV; - - if (!dev->keycodesize || (scancode < 0 || scancode >= dev->keycodemax)) + + if (scancode < 0 || scancode >= dev->keycodemax) return -EINVAL; return INPUT_KEYCODE(dev, scancode); } -int setkeycode(struct input_handle *handle, unsigned int scancode, unsigned int keycode) +int setkeycode(unsigned int scancode, unsigned int keycode) { - struct input_dev *dev = handle->dev; + struct list_head * node; + struct input_dev *dev = NULL; int i, oldkey; + list_for_each(node,&kbd_handler.h_list) { + struct input_handle *handle = to_handle_h(node); + if (handle->dev->keycodesize) { + dev = handle->dev; + break; + } + } + if (!dev) return -ENODEV; - if (!dev->keycodesize || (scancode < 0 || scancode >= dev->keycodemax)) + if (scancode < 0 || scancode >= dev->keycodemax) return -EINVAL; oldkey = INPUT_KEYCODE(dev, scancode); INPUT_KEYCODE(dev, scancode) = keycode; for (i = 0; i < dev->keycodemax; i++) - if (INPUT_KEYCODE(dev, scancode) == oldkey) + if(INPUT_KEYCODE(dev, scancode) == oldkey) break; if (i == dev->keycodemax) clear_bit(oldkey, dev->keybit); set_bit(keycode, dev->keybit); + return 0; } /* * Making beeps and bells. */ -void kd_nosound(unsigned long private) +static void kd_nosound(unsigned long ignored) { - struct input_handle *handle = (struct input_handle *) private; - - if (test_bit(EV_SND, handle->dev->evbit)) { - if (test_bit(SND_TONE, handle->dev->sndbit)) - input_event(handle->dev, EV_SND, SND_TONE, 0); - if (test_bit(SND_BELL, handle->dev->sndbit)) - input_event(handle->dev, EV_SND, SND_BELL, 0); + struct list_head * node; + + list_for_each(node,&kbd_handler.h_list) { + struct input_handle *handle = to_handle_h(node); + if (test_bit(EV_SND, handle->dev->evbit)) { + if (test_bit(SND_TONE, handle->dev->sndbit)) + input_event(handle->dev, EV_SND, SND_TONE, 0); + if (test_bit(SND_BELL, handle->dev->sndbit)) + input_event(handle->dev, EV_SND, SND_BELL, 0); + } } } -void kd_mksound(struct input_handle *handle, unsigned int hz, unsigned int ticks) +static struct timer_list kd_mksound_timer = + TIMER_INITIALIZER(kd_nosound, 0, 0); + +void kd_mksound(unsigned int hz, unsigned int ticks) { -/* - struct vt_struct *vt = vt_cons; + struct list_head * node; - if (vt) { - del_timer(&vt->beep); + del_timer(&kd_mksound_timer); - if (hz) { + if (hz) { + list_for_each(node,&kbd_handler.h_list) { + struct input_handle *handle = to_handle_h(node); if (test_bit(EV_SND, handle->dev->evbit)) { - if (test_bit(SND_TONE, handle->dev->sndbit)) + if (test_bit(SND_TONE, handle->dev->sndbit)) { input_event(handle->dev, EV_SND, SND_TONE, hz); - if (test_bit(SND_BELL, handle->dev->sndbit)) + break; + } + if (test_bit(SND_BELL, handle->dev->sndbit)) { input_event(handle->dev, EV_SND, SND_BELL, 1); + break; + } } - if (ticks) - mod_timer(&vt->beep, jiffies + ticks); - } else - kd_nosound((long) handle); - } -*/ + } + if (ticks) + mod_timer(&kd_mksound_timer, jiffies + ticks); + } else + kd_nosound(0); } /* @@ -215,19 +273,24 @@ return (j > 0) ? j : 1; } -int kbd_rate(struct input_handle *handle, struct kbd_repeat *rep) +int kbd_rate(struct kbd_repeat *rep) { - struct input_dev *dev = handle->dev; + struct list_head *node; unsigned int d = 0; unsigned int p = 0; - if (test_bit(EV_REP, dev->evbit)) { - if (rep->delay > 0) - dev->rep[REP_DELAY] = ms_to_jiffies(rep->delay); - if (rep->period > 0) - dev->rep[REP_PERIOD] = ms_to_jiffies(rep->period); - d = dev->rep[REP_DELAY] * 1000 / HZ; - p = dev->rep[REP_PERIOD] * 1000 / HZ; + list_for_each(node,&kbd_handler.h_list) { + struct input_handle *handle = to_handle_h(node); + struct input_dev *dev = handle->dev; + + if (test_bit(EV_REP, dev->evbit)) { + if (rep->delay > 0) + dev->rep[REP_DELAY] = ms_to_jiffies(rep->delay); + if (rep->period > 0) + dev->rep[REP_PERIOD] = ms_to_jiffies(rep->period); + d = dev->rep[REP_DELAY] * 1000 / HZ; + p = dev->rep[REP_PERIOD] * 1000 / HZ; + } } rep->delay = d; rep->period = p; @@ -243,11 +306,11 @@ if (tty) { tty_insert_flip_char(tty, ch, 0); - schedule_work(&tty->flip.work); + con_schedule_flip(tty); } } -void puts_queue(struct vc_data *vc, char *cp) +static void puts_queue(struct vc_data *vc, char *cp) { struct tty_struct *tty = vc->vc_tty; @@ -258,7 +321,7 @@ tty_insert_flip_char(tty, *cp, 0); cp++; } - schedule_work(&tty->flip.work); + con_schedule_flip(tty); } static void applkey(struct vc_data *vc, int key, char mode) @@ -280,7 +343,7 @@ void to_utf8(struct vc_data *vc, ushort c) { if (c < 0x80) - /* 0******* */ + /* 0******* */ put_queue(vc, c); else if (c < 0x800) { /* 110***** 10****** */ @@ -368,7 +431,7 @@ diacr = 0; } put_queue(vc, 13); - if (get_kbd_mode(vc->kbd_table, VC_CRLF)) + if (vc_kbd_mode(kbd, VC_CRLF)) put_queue(vc, 10); } @@ -376,14 +439,14 @@ { if (rep) return; - chg_kbd_led(vc->kbd_table, VC_CAPSLOCK); + chg_vc_kbd_led(kbd, VC_CAPSLOCK); } static void fn_caps_on(struct vc_data *vc) { if (rep) return; - set_kbd_led(vc->kbd_table, VC_CAPSLOCK); + set_vc_kbd_led(kbd, VC_CAPSLOCK); } static void fn_show_ptregs(struct vc_data *vc) @@ -412,7 +475,7 @@ static void fn_num(struct vc_data *vc) { - if (get_kbd_mode(vc->kbd_table, VC_APPLIC)) + if (vc_kbd_mode(kbd,VC_APPLIC)) applkey(vc, 'P', 1); else fn_bare_num(vc); @@ -427,45 +490,39 @@ static void fn_bare_num(struct vc_data *vc) { if (!rep) - chg_kbd_led(vc->kbd_table, VC_NUMLOCK); + chg_vc_kbd_led(kbd, VC_NUMLOCK); } static void fn_lastcons(struct vc_data *vc) { /* switch to the last used console, ChN */ - set_console(vc->display_fg->last_console); + set_console(last_console); } static void fn_dec_console(struct vc_data *vc) { - struct vt_struct *vt = vc->display_fg; - int i, j = vt->fg_console->vc_num - vt->first_vc; - struct vc_data *tmp = NULL; + int i; - for (i = j-1; i != j; i--) { + for (i = fg_console-1; i != fg_console; i--) { if (i == -1) - i = MAX_NR_USER_CONSOLES-1; - tmp = vt->vc_cons[i]; - if (tmp) + i = MAX_NR_CONSOLES-1; + if (vc_cons_allocated(i)) break; } - set_console(tmp); + set_console(i); } static void fn_inc_console(struct vc_data *vc) { - struct vt_struct *vt = vc->display_fg; - int i, j = vt->fg_console->vc_num - vt->first_vc; - struct vc_data *tmp = NULL; + int i; - for (i = j+1; i != j; i++) { - if (i == MAX_NR_USER_CONSOLES) + for (i = fg_console+1; i != fg_console; i++) { + if (i == MAX_NR_CONSOLES) i = 0; - tmp = vt->vc_cons[i]; - if (tmp) + if (vc_cons_allocated(i)) break; } - set_console(tmp); + set_console(i); } static void fn_send_intr(struct vc_data *vc) @@ -475,17 +532,17 @@ if (!tty) return; tty_insert_flip_char(tty, 0, TTY_BREAK); - schedule_work(&tty->flip.work); + con_schedule_flip(tty); } static void fn_scroll_forw(struct vc_data *vc) { - scroll_down(vc, 0); + scrollfront(0); } static void fn_scroll_back(struct vc_data *vc) { - scroll_up(vc, 0); + scrollback(0); } static void fn_show_mem(struct vc_data *vc) @@ -525,7 +582,7 @@ */ if (tty) do_SAK(tty); - reset_vc(vc); + reset_vc(fg_console); } static void fn_null(struct vc_data *vc) @@ -546,8 +603,8 @@ return; if (value >= ARRAY_SIZE(fn_handler)) return; - if ((vc->kbd_table.kbdmode == VC_RAW || - vc->kbd_table.kbdmode == VC_MEDIUMRAW) && + if ((kbd->kbdmode == VC_RAW || + kbd->kbdmode == VC_MEDIUMRAW) && value != K_SAK) return; /* SAK is allowed even in raw mode */ fn_handler[value](vc); @@ -598,11 +655,9 @@ static void k_cons(struct vc_data *vc, unsigned char value, char up_flag) { - struct vc_data *tmp = find_vc(value + vc->display_fg->first_vc); - - if (up_flag || !tmp) + if (up_flag) return; - set_console(tmp); + set_console(value); } static void k_fn(struct vc_data *vc, unsigned char value, char up_flag) @@ -622,7 +677,7 @@ if (up_flag) return; - applkey(vc, cur_chars[value], get_kbd_mode(vc->kbd_table, VC_CKMODE)); + applkey(vc, cur_chars[value], vc_kbd_mode(kbd, VC_CKMODE)); } static void k_pad(struct vc_data *vc, unsigned char value, char up_flag) @@ -634,12 +689,12 @@ return; /* no action, if this is a key release */ /* kludge... shift forces cursor/number keys */ - if (get_kbd_mode(vc->kbd_table, VC_APPLIC) && !shift_down[KG_SHIFT]) { + if (vc_kbd_mode(kbd, VC_APPLIC) && !shift_down[KG_SHIFT]) { applkey(vc, app_map[value], 1); return; } - if (!get_kbd_led(vc->kbd_table, VC_NUMLOCK)) + if (!vc_kbd_led(kbd, VC_NUMLOCK)) switch (value) { case KVAL(K_PCOMMA): case KVAL(K_PDOT): @@ -673,12 +728,12 @@ k_fn(vc, KVAL(K_PGUP), 0); return; case KVAL(K_P5): - applkey(vc, 'G', get_kbd_mode(vc->kbd_table, VC_APPLIC)); + applkey(vc, 'G', vc_kbd_mode(kbd, VC_APPLIC)); return; } put_queue(vc, pad_chars[value]); - if (value == KVAL(K_PENTER) && get_kbd_mode(vc->kbd_table, VC_CRLF)) + if (value == KVAL(K_PENTER) && vc_kbd_mode(kbd, VC_CRLF)) put_queue(vc, 10); } @@ -695,7 +750,7 @@ if (value == KVAL(K_CAPSSHIFT)) { value = KVAL(K_SHIFT); if (!up_flag) - clr_kbd_led(vc->kbd_table, VC_CAPSLOCK); + clr_vc_kbd_led(kbd, VC_CAPSLOCK); } if (up_flag) { @@ -715,7 +770,7 @@ /* kludge */ if (up_flag && shift_state != old_state && npadch != -1) { - if (vc->kbd_table.kbdmode == VC_UNICODE) + if (kbd->kbdmode == VC_UNICODE) to_utf8(vc, npadch & 0xffff); else put_queue(vc, npadch & 0xff); @@ -728,7 +783,7 @@ if (up_flag) return; - if (get_kbd_mode(vc->kbd_table, VC_META)) { + if (vc_kbd_mode(kbd, VC_META)) { put_queue(vc, '\033'); put_queue(vc, value); } else @@ -761,7 +816,7 @@ { if (up_flag || rep) return; - chg_kbd_lock(vc->kbd_table, value); + chg_vc_kbd_lock(kbd, value); } static void k_slock(struct vc_data *vc, unsigned char value, char up_flag) @@ -769,11 +824,11 @@ k_shift(vc, value, up_flag); if (up_flag || rep) return; - chg_kbd_slock(vc->kbd_table, value); + chg_vc_kbd_slock(kbd, value); /* try to make Alt, oops, AltGr and such work */ - if (!key_maps[vc->kbd_table.lockstate ^ vc->kbd_table.slockstate]) { - vc->kbd_table.slockstate = 0; - chg_kbd_slock(vc->kbd_table, value); + if (!key_maps[kbd->lockstate ^ kbd->slockstate]) { + kbd->slockstate = 0; + chg_vc_kbd_slock(kbd, value); } } @@ -809,17 +864,18 @@ kbd->ledmode = LED_SHOW_FLAGS; } -static inline unsigned char getleds(struct vc_data *vc) +static inline unsigned char getleds(void) { + struct kbd_struct *kbd = kbd_table + fg_console; unsigned char leds; int i; - if (vc->kbd_table.ledmode == LED_SHOW_IOCTL) + if (kbd->ledmode == LED_SHOW_IOCTL) return ledioctl; - leds = vc->kbd_table.ledflagstate; + leds = kbd->ledflagstate; - if (vc->kbd_table.ledmode == LED_SHOW_MEM) { + if (kbd->ledmode == LED_SHOW_MEM) { for (i = 0; i < 3; i++) if (ledptrs[i].valid) { if (*ledptrs[i].addr & ledptrs[i].mask) @@ -848,24 +904,18 @@ static void kbd_bh(unsigned long dummy) { struct list_head * node; - unsigned char leds; + unsigned char leds = getleds(); - list_for_each(node, &kbd_handler.h_list) { - struct input_handle *handle = to_handle_h(node); - struct vt_struct *vt = vt_cons; - - if (vt) { - leds = getleds(vt->fg_console); - - if (leds != ledstate) { - input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01)); - input_event(handle->dev, EV_LED, LED_NUML, !!(leds & 0x02)); - input_event(handle->dev, EV_LED, LED_CAPSL, !!(leds & 0x04)); - - ledstate = leds; - } + if (leds != ledstate) { + list_for_each(node,&kbd_handler.h_list) { + struct input_handle * handle = to_handle_h(node); + input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01)); + input_event(handle->dev, EV_LED, LED_NUML, !!(leds & 0x02)); + input_event(handle->dev, EV_LED, LED_CAPSL, !!(leds & 0x04)); } } + + ledstate = leds; } DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0); @@ -948,9 +998,9 @@ } #endif -void kbd_keycode(struct vt_struct *vt, unsigned int keycode, int down) +void kbd_keycode(unsigned int keycode, int down) { - struct vc_data *vc = vt->fg_console; + struct vc_data *vc = vc_cons[fg_console].d; unsigned short keysym, *key_map; unsigned char type, raw_mode; struct tty_struct *tty; @@ -966,6 +1016,8 @@ tty->driver_data = vc; } + kbd = kbd_table + fg_console; + if (keycode == KEY_LEFTALT || keycode == KEY_RIGHTALT) sysrq_alt = down; #if defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64) @@ -975,7 +1027,7 @@ rep = (down == 2); - if ((raw_mode = (vc->kbd_table.kbdmode == VC_RAW))) + if ((raw_mode = (kbd->kbdmode == VC_RAW))) if (emulate_raw(vc, keycode, !down << 7)) printk(KERN_WARNING "keyboard.c: can't emulate rawmode for keycode %d\n", keycode); @@ -996,7 +1048,7 @@ } #endif - if (vc->kbd_table.kbdmode == VC_MEDIUMRAW) { + if (kbd->kbdmode == VC_MEDIUMRAW) { /* * This is extended medium raw mode, with keys above 127 * encoded as 0, high 7 bits, low 7 bits, with the 0 bearing @@ -1021,7 +1073,7 @@ else clear_bit(keycode, key_down); - if (rep && (!get_kbd_mode(vc->kbd_table, VC_REPEAT) || (tty && + if (rep && (!vc_kbd_mode(kbd, VC_REPEAT) || (tty && (!L_ECHO(tty) && tty->driver.chars_in_buffer(tty))))) { /* * Don't repeat a key if the input buffers are not empty and the @@ -1031,12 +1083,12 @@ return; } - shift_final = (shift_state | vc->kbd_table.slockstate) ^ vc->kbd_table.lockstate; + shift_final = (shift_state | kbd->slockstate) ^ kbd->lockstate; key_map = key_maps[shift_final]; if (!key_map) { compute_shiftstate(); - vc->kbd_table.slockstate = 0; + kbd->slockstate = 0; return; } @@ -1055,7 +1107,7 @@ if (type == KT_LETTER) { type = KT_LATIN; - if (get_kbd_led(vc->kbd_table, VC_CAPSLOCK)) { + if (vc_kbd_led(kbd, VC_CAPSLOCK)) { key_map = key_maps[shift_final ^ (1 << KG_SHIFT)]; if (key_map) keysym = key_map[keycode]; @@ -1065,20 +1117,18 @@ (*k_handler[type])(vc, keysym & 0xff, !down); if (type != KT_SLOCK) - vc->kbd_table.slockstate = 0; + kbd->slockstate = 0; } static void kbd_event(struct input_handle *handle, unsigned int event_type, unsigned int keycode, int down) { - struct vt_struct *vt = vt_cons; - - if ((event_type != EV_KEY) || !vt) + if (event_type != EV_KEY) return; - kbd_keycode(vt, keycode, down); + kbd_keycode(keycode, down); tasklet_schedule(&keyboard_tasklet); do_poke_blanked_console = 1; - schedule_work(&vt->vt_work); + schedule_console_callback(); } static char kbd_name[] = "kbd"; @@ -1093,7 +1143,6 @@ struct input_dev *dev, struct input_device_id *id) { - struct vt_struct *vt = vt_cons; struct input_handle *handle; int i; @@ -1105,46 +1154,32 @@ if (!(handle = kmalloc(sizeof(struct input_handle), GFP_KERNEL))) return NULL; - memset(handle, 0, sizeof(struct input_handle)); - /* - * If we have more keyboards than VTs we still register the handler. - * It is possible someone might add a graphics card thus needing the - * keyboard later - */ + handle->dev = dev; handle->handler = handler; handle->name = kbd_name; - if (!vt->keyboard) { - vt->keyboard = handle; - handle->private = vt; - vt_map_input(vt); - } + input_open_device(handle); + return handle; } static void kbd_disconnect(struct input_handle *handle) { - struct vt_struct *vt = handle->private; - - if (vt && vt->keyboard == handle) { - vt->keyboard = NULL; - handle->private = NULL; - } input_close_device(handle); kfree(handle); } static struct input_device_id kbd_ids[] = { { - flags: INPUT_DEVICE_ID_MATCH_EVBIT, - evbit: { BIT(EV_KEY) }, + .flags = INPUT_DEVICE_ID_MATCH_EVBIT, + .evbit = { BIT(EV_KEY) }, }, { - flags: INPUT_DEVICE_ID_MATCH_EVBIT, - evbit: { BIT(EV_SND) }, + .flags = INPUT_DEVICE_ID_MATCH_EVBIT, + .evbit = { BIT(EV_SND) }, }, { }, /* Terminating entry */ @@ -1153,17 +1188,31 @@ MODULE_DEVICE_TABLE(input, kbd_ids); static struct input_handler kbd_handler = { - event: kbd_event, - connect: kbd_connect, - disconnect: kbd_disconnect, - name: "kbd", - id_table: kbd_ids, + .event = kbd_event, + .connect = kbd_connect, + .disconnect = kbd_disconnect, + .name = "kbd", + .id_table = kbd_ids, }; int __init kbd_init(void) { + int i; + + kbd0.ledflagstate = kbd0.default_ledflagstate = KBD_DEFLEDS; + kbd0.ledmode = LED_SHOW_FLAGS; + kbd0.lockstate = KBD_DEFLOCK; + kbd0.slockstate = 0; + kbd0.modeflags = KBD_DEFMODE; + kbd0.kbdmode = VC_XLATE; + + for (i = 0 ; i < MAX_NR_CONSOLES ; i++) + kbd_table[i] = kbd0; + input_register_handler(&kbd_handler); + tasklet_enable(&keyboard_tasklet); tasklet_schedule(&keyboard_tasklet); + return 0; } Index: misc.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/misc.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- misc.c 30 Oct 2002 16:54:34 -0000 1.19 +++ misc.c 23 Nov 2002 00:55:50 -0000 1.20 @@ -143,8 +143,8 @@ } static struct file_operations misc_fops = { - owner: THIS_MODULE, - open: misc_open, + .owner = THIS_MODULE, + .open = misc_open, }; Index: sysrq.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/sysrq.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- sysrq.c 1 Nov 2002 23:14:55 -0000 1.25 +++ sysrq.c 23 Nov 2002 00:55:50 -0000 1.26 @@ -58,9 +58,9 @@ console_loglevel = i; } static struct sysrq_key_op sysrq_loglevel_op = { - handler: sysrq_handle_loglevel, - help_msg: "loglevel0-8", - action_msg: "Changing Loglevel", + .handler = sysrq_handle_loglevel, + .help_msg = "loglevel0-8", + .action_msg = "Changing Loglevel", }; @@ -77,9 +77,9 @@ reset_vc(vc); } static struct sysrq_key_op sysrq_SAK_op = { - handler: sysrq_handle_SAK, - help_msg: "saK", - action_msg: "SAK", + .handler = sysrq_handle_SAK, + .help_msg = "saK", + .action_msg = "SAK", }; /* unraw sysrq handler */ @@ -92,9 +92,9 @@ vc->kbd_table.kbdmode = VC_XLATE; } static struct sysrq_key_op sysrq_unraw_op = { - handler: sysrq_handle_unraw, - help_msg: "unRaw", - action_msg: "Keyboard mode set to XLATE", + .handler = sysrq_handle_unraw, + .help_msg = "unRaw", + .action_msg = "Keyboard mode set to XLATE", }; #endif /* CONFIG_VT */ @@ -105,9 +105,9 @@ machine_restart(NULL); } static struct sysrq_key_op sysrq_reboot_op = { - handler: sysrq_handle_reboot, - help_msg: "reBoot", - action_msg: "Resetting", + .handler = sysrq_handle_reboot, + .help_msg = "reBoot", + .action_msg = "Resetting", }; @@ -235,9 +235,9 @@ wakeup_bdflush(0); } static struct sysrq_key_op sysrq_sync_op = { - handler: sysrq_handle_sync, - help_msg: "Sync", - action_msg: "Emergency Sync", + .handler = sysrq_handle_sync, + .help_msg = "Sync", + .action_msg = "Emergency Sync", }; static void sysrq_handle_mountro(int key, struct pt_regs *pt_regs, @@ -247,9 +247,9 @@ wakeup_bdflush(0); } static struct sysrq_key_op sysrq_mountro_op = { - handler: sysrq_handle_mountro, - help_msg: "Unmount", - action_msg: "Emergency Remount R/O", + .handler = sysrq_handle_mountro, + .help_msg = "Unmount", + .action_msg = "Emergency Remount R/O", }; /* END SYNC SYSRQ HANDLERS BLOCK */ @@ -264,9 +264,9 @@ show_regs(pt_regs); } static struct sysrq_key_op sysrq_showregs_op = { - handler: sysrq_handle_showregs, - help_msg: "showPc", - action_msg: "Show Regs", + .handler = sysrq_handle_showregs, + .help_msg = "showPc", + .action_msg = "Show Regs", }; @@ -276,9 +276,9 @@ show_state(); } static struct sysrq_key_op sysrq_showstate_op = { - handler: sysrq_handle_showstate, - help_msg: "showTasks", - action_msg: "Show State", + .handler = sysrq_handle_showstate, + .help_msg = "showTasks", + .action_msg = "Show State", }; @@ -288,9 +288,9 @@ show_mem(); } static struct sysrq_key_op sysrq_showmem_op = { - handler: sysrq_handle_showmem, - help_msg: "showMem", - action_msg: "Show Memory", + .handler = sysrq_handle_showmem, + .help_msg = "showMem", + .action_msg = "Show Memory", }; /* SHOW SYSRQ HANDLERS BLOCK */ @@ -318,16 +318,16 @@ console_loglevel = 8; } static struct sysrq_key_op sysrq_term_op = { - handler: sysrq_handle_term, - help_msg: "tErm", - action_msg: "Terminate All Tasks", + .handler = sysrq_handle_term, + .help_msg = "tErm", + .action_msg = "Terminate All Tasks", }; #ifdef CONFIG_VOYAGER static struct sysrq_key_op sysrq_voyager_dump_op = { - handler: voyager_dump, - help_msg: "voyager", - action_msg: "Dump Voyager Status\n", + .handler = voyager_dump, + .help_msg = "voyager", + .action_msg = "Dump Voyager Status\n", }; #endif @@ -338,9 +338,9 @@ console_loglevel = 8; } static struct sysrq_key_op sysrq_kill_op = { - handler: sysrq_handle_kill, - help_msg: "kIll", - action_msg: "Kill All Tasks", + .handler = sysrq_handle_kill, + .help_msg = "kIll", + .action_msg = "Kill All Tasks", }; /* END SIGNAL SYSRQ HANDLERS BLOCK */ Index: tty_io.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/tty_io.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -r1.54 -r1.55 --- tty_io.c 1 Nov 2002 23:27:32 -0000 1.54 +++ tty_io.c 23 Nov 2002 00:55:50 -0000 1.55 @@ -142,10 +142,9 @@ extern void console_8xx_init(void); extern int rs_8xx_init(void); extern void mac_scc_console_init(void); -extern void hwc_console_init(void); -extern void hwc_tty_init(void); +extern void sclp_console_init(void); +extern void sclp_tty_init(void); extern void con3215_init(void); -extern void tty3215_init(void); extern void tub3270_con_init(void); extern void tub3270_init(void); extern void uart_console_init(void); @@ -400,23 +399,23 @@ } static struct file_operations tty_fops = { - llseek: no_llseek, - read: tty_read, - write: tty_write, - poll: tty_poll, - ioctl: tty_ioctl, - open: tty_open, - release: tty_release, - fasync: tty_fasync, + .llseek = no_llseek, + .read = tty_read, + .write = tty_write, + .poll = tty_poll, + .ioctl = tty_ioctl, + .open = tty_open, + .release = tty_release, + .fasync = tty_fasync, }; static struct file_operations hung_up_tty_fops = { - llseek: no_llseek, - read: hung_up_tty_read, - write: hung_up_tty_write, - poll: hung_up_tty_poll, - ioctl: hung_up_tty_ioctl, - release: tty_release, + .llseek = no_llseek, + .read = hung_up_tty_read, + .write = hung_up_tty_write, + .poll = hung_up_tty_poll, + .ioctl = hung_up_tty_ioctl, + .release = tty_release, }; /* @@ -2045,14 +2044,7 @@ void tty_unregister_devfs (struct tty_driver *driver, unsigned minor) { -#ifdef CONFIG_DEVFS_FS - int idx = minor - driver->minor_start; - char buf[32]; - - sprintf(buf, driver->name, idx + driver->name_base); - devfs_find_and_unregister(NULL, buf, driver->major, minor, - DEVFS_SPECIAL_CHR, 0); -#endif /* CONFIG_DEVFS_FS */ + devfs_remove(driver->name, minor-driver->minor_start+driver->name_base); } EXPORT_SYMBOL(tty_register_devfs); @@ -2210,8 +2202,8 @@ #ifdef CONFIG_TN3215 con3215_init(); #endif -#ifdef CONFIG_HWC - hwc_console_init(); +#ifdef CONFIG_SCLP_CONSOLE + sclp_console_init(); #endif #ifdef CONFIG_STDIO_CONSOLE stdio_console_init(); @@ -2340,8 +2332,8 @@ #ifdef CONFIG_TN3215 tty3215_init(); #endif -#ifdef CONFIG_HWC - hwc_tty_init(); +#ifdef CONFIG_SCLP + sclp_tty_init(); #endif #ifdef CONFIG_A2232 a2232board_init(); Index: vc_screen.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/vc_screen.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- vc_screen.c 1 Nov 2002 23:27:32 -0000 1.22 +++ vc_screen.c 23 Nov 2002 00:55:50 -0000 1.23 @@ -86,12 +86,7 @@ struct vc_data *vc; int size; - if (currcons == 0) - currcons = vt_cons->fg_console->vc_num; - else - currcons--; - - vc = vt_cons->vc_cons[currcons]; + vc = find_vc(currcons); if (!vc) return -ENXIO; @@ -160,15 +155,13 @@ attr = (currcons & 128); currcons = (currcons & 127); if (currcons == 0) { - currcons = vt_cons->fg_console->vc_num; viewed = 1; } else { - currcons--; viewed = 0; } ret = -ENXIO; - vc = vt_cons->vc_cons[currcons]; + vc = find_vc(currcons); if (!vc) goto unlock_out; @@ -335,15 +328,13 @@ currcons = (currcons & 127); if (currcons == 0) { - currcons = vt_cons->fg_console->vc_num; viewed = 1; } else { - currcons--; viewed = 0; } ret = -ENXIO; - vc = vt_cons->vc_cons[currcons]; + vc = find_vc(currcons); if (!vc) goto unlock_out; @@ -504,42 +495,36 @@ { unsigned int currcons = minor(inode->i_rdev) & 127; - if (currcons && !vt_cons->vc_cons[currcons-1]) + if (currcons && !find_vc(currcons)) return -ENXIO; return 0; } static struct file_operations vcs_fops = { - llseek: vcs_lseek, - read: vcs_read, - write: vcs_write, - open: vcs_open, + .llseek = vcs_lseek, + .read = vcs_read, + .write = vcs_write, + .open = vcs_open, }; -static devfs_handle_t devfs_handle; - void vcs_make_devfs (unsigned int index, int unregister) { #ifdef CONFIG_DEVFS_FS - char name[8]; - sprintf (name, "a%u", index + 1); - if (unregister) - { - devfs_find_and_unregister(devfs_handle, name + 1, 0, 0, - DEVFS_SPECIAL_CHR, 0); - devfs_find_and_unregister(devfs_handle, name, 0, 0, - DEVFS_SPECIAL_CHR, 0); - } - else - { - devfs_register (devfs_handle, name + 1, DEVFS_FL_DEFAULT, - VCS_MAJOR, index + 1, - S_IFCHR | S_IRUSR | S_IWUSR, &vcs_fops, NULL); - devfs_register (devfs_handle, name, DEVFS_FL_DEFAULT, - VCS_MAJOR, index + 129, - S_IFCHR | S_IRUSR | S_IWUSR, &vcs_fops, NULL); - } + if (unregister) { + devfs_remove("vcc/%u", index + 1); + devfs_remove("vcc/a%u", index + 1); + } else { + char name[16]; + sprintf(name, "vcc/%u", index + 1); + devfs_register(NULL, name, DEVFS_FL_DEFAULT, + VCS_MAJOR, index + 1, + S_IFCHR | S_IRUSR | S_IWUSR, &vcs_fops, NULL); + sprintf(name, "vcc/a%u", index + 1); + devfs_register(NULL, name, DEVFS_FL_DEFAULT, + VCS_MAJOR, index + 129, + S_IFCHR | S_IRUSR | S_IWUSR, &vcs_fops, NULL); + } #endif /* CONFIG_DEVFS_FS */ } @@ -552,12 +537,9 @@ if (error) printk("unable to get major %d for vcs device", VCS_MAJOR); - devfs_handle = devfs_mk_dir (NULL, "vcc", NULL); - devfs_register (devfs_handle, "0", DEVFS_FL_DEFAULT, - VCS_MAJOR, 0, + devfs_register(NULL, "vcc/0", DEVFS_FL_DEFAULT, VCS_MAJOR, 0, S_IFCHR | S_IRUSR | S_IWUSR, &vcs_fops, NULL); - devfs_register (devfs_handle, "a", DEVFS_FL_DEFAULT, - VCS_MAJOR, 128, + devfs_register(NULL, "vcc/a", DEVFS_FL_DEFAULT, VCS_MAJOR, 128, S_IFCHR | S_IRUSR | S_IWUSR, &vcs_fops, NULL); return error; Index: vt.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/char/vt.c,v retrieving revision 1.123 retrieving revision 1.124 diff -u -d -r1.123 -r1.124 --- vt.c 1 Nov 2002 23:27:32 -0000 1.123 +++ vt.c 23 Nov 2002 00:55:50 -0000 1.124 @@ -1562,12 +1562,12 @@ } struct console vt_console_driver = { - name: "tty", - write: vt_console_print, - device: vt_console_device, - unblank: unblank_screen, - flags: CON_PRINTBUFFER, - index: -1, + .name = "tty", + .write = vt_console_print, + .device = vt_console_device, + .unblank = unblank_screen, + .flags = CON_PRINTBUFFER, + .index = -1, }; #endif |